net/pkt: Remove parameters to "reserve" some headroom

Such parameter is not used anymore, it was defaulted to 0 previously.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2018-06-28 17:10:37 +02:00 committed by Carles Cufí
commit e97a543e9b
58 changed files with 255 additions and 314 deletions

View file

@ -86,7 +86,7 @@ static void eth_rx(struct device *dev)
frm_len -= sizeof(u32_t); frm_len -= sizeof(u32_t);
} }
pkt = net_pkt_get_reserve_rx(0, K_NO_WAIT); pkt = net_pkt_get_reserve_rx(K_NO_WAIT);
if (!pkt) { if (!pkt) {
LOG_ERR("Failed to obtain RX buffer"); LOG_ERR("Failed to obtain RX buffer");
goto error; goto error;

View file

@ -99,7 +99,7 @@ static struct net_pkt *e1000_rx(struct e1000_dev *dev)
goto out; goto out;
} }
pkt = net_pkt_get_reserve_rx(0, K_NO_WAIT); pkt = net_pkt_get_reserve_rx(K_NO_WAIT);
if (!pkt) { if (!pkt) {
LOG_ERR("Out of RX buffers"); LOG_ERR("Out of RX buffers");
goto out; goto out;

View file

@ -538,7 +538,7 @@ static int eth_enc28j60_rx(struct device *dev)
lengthfr = frm_len; lengthfr = frm_len;
/* Get the frame from the buffer */ /* Get the frame from the buffer */
pkt = net_pkt_get_reserve_rx(0, config->timeout); pkt = net_pkt_get_reserve_rx(config->timeout);
if (!pkt) { if (!pkt) {
LOG_ERR("Could not allocate rx buffer"); LOG_ERR("Could not allocate rx buffer");
eth_stats_update_errors_rx(context->iface); eth_stats_update_errors_rx(context->iface);

View file

@ -555,7 +555,7 @@ static void eth_rx(struct device *iface)
goto flush; goto flush;
} }
pkt = net_pkt_get_reserve_rx(0, K_NO_WAIT); pkt = net_pkt_get_reserve_rx(K_NO_WAIT);
if (!pkt) { if (!pkt) {
goto flush; goto flush;
} }

View file

@ -281,7 +281,7 @@ static int read_data(struct eth_context *ctx, int fd)
return 0; return 0;
} }
pkt = net_pkt_get_reserve_rx(0, NET_BUF_TIMEOUT); pkt = net_pkt_get_reserve_rx(NET_BUF_TIMEOUT);
if (!pkt) { if (!pkt) {
return -ENOMEM; return -ENOMEM;
} }

View file

@ -275,7 +275,7 @@ static int rx_descriptors_init(Gmac *gmac, struct gmac_queue *queue)
rx_frag_list->tail = 0U; rx_frag_list->tail = 0U;
for (int i = 0; i < rx_desc_list->len; i++) { for (int i = 0; i < rx_desc_list->len; i++) {
rx_buf = net_pkt_get_reserve_rx_data(0, K_NO_WAIT); rx_buf = net_pkt_get_reserve_rx_data(K_NO_WAIT);
if (rx_buf == NULL) { if (rx_buf == NULL) {
free_rx_bufs(rx_frag_list); free_rx_bufs(rx_frag_list);
LOG_ERR("Failed to reserve data net buffers"); LOG_ERR("Failed to reserve data net buffers");
@ -1129,7 +1129,7 @@ static struct net_pkt *frame_get(struct gmac_queue *queue)
return NULL; return NULL;
} }
rx_frame = net_pkt_get_reserve_rx(0, K_NO_WAIT); rx_frame = net_pkt_get_reserve_rx(K_NO_WAIT);
/* Process a frame */ /* Process a frame */
tail = rx_desc_list->tail; tail = rx_desc_list->tail;

View file

@ -193,7 +193,7 @@ static void eth_stellaris_rx(struct device *dev)
int frame_len, ret; int frame_len, ret;
/* Obtain the packet to be populated. */ /* Obtain the packet to be populated. */
pkt = net_pkt_get_reserve_rx(0, K_NO_WAIT); pkt = net_pkt_get_reserve_rx(K_NO_WAIT);
if (!pkt) { if (!pkt) {
LOG_ERR("Could not allocate pkt"); LOG_ERR("Could not allocate pkt");
goto err_mem; goto err_mem;

View file

@ -146,7 +146,7 @@ static struct net_pkt *eth_rx(struct device *dev)
total_len = heth->RxFrameInfos.length; total_len = heth->RxFrameInfos.length;
dma_buffer = (u8_t *)heth->RxFrameInfos.buffer; dma_buffer = (u8_t *)heth->RxFrameInfos.buffer;
pkt = net_pkt_get_reserve_rx(0, K_NO_WAIT); pkt = net_pkt_get_reserve_rx(K_NO_WAIT);
if (!pkt) { if (!pkt) {
LOG_ERR("Failed to obtain RX buffer"); LOG_ERR("Failed to obtain RX buffer");
goto release_desc; goto release_desc;

View file

@ -473,7 +473,7 @@ static void cc1200_rx(struct device *dev)
goto flush; goto flush;
} }
pkt = net_pkt_get_reserve_rx(0, K_NO_WAIT); pkt = net_pkt_get_reserve_rx(K_NO_WAIT);
if (!pkt) { if (!pkt) {
LOG_ERR("No free pkt available"); LOG_ERR("No free pkt available");
goto flush; goto flush;

View file

@ -638,7 +638,7 @@ static void cc2520_rx(int arg)
goto flush; goto flush;
} }
pkt = net_pkt_get_reserve_rx(0, K_NO_WAIT); pkt = net_pkt_get_reserve_rx(K_NO_WAIT);
if (!pkt) { if (!pkt) {
LOG_ERR("No pkt available"); LOG_ERR("No pkt available");
goto flush; goto flush;

View file

@ -490,7 +490,7 @@ static inline void kw41z_rx(struct kw41z_context *kw41z, u8_t len)
pkt_len = len - KW41Z_FCS_LENGTH; pkt_len = len - KW41Z_FCS_LENGTH;
#endif #endif
pkt = net_pkt_get_reserve_rx(0, K_NO_WAIT); pkt = net_pkt_get_reserve_rx(K_NO_WAIT);
if (!pkt) { if (!pkt) {
LOG_ERR("No buf available"); LOG_ERR("No buf available");
goto out; goto out;

View file

@ -547,7 +547,7 @@ static inline void mcr20a_rx(struct mcr20a_context *mcr20a, u8_t len)
pkt_len = len - MCR20A_FCS_LENGTH; pkt_len = len - MCR20A_FCS_LENGTH;
pkt = net_pkt_get_reserve_rx(0, K_NO_WAIT); pkt = net_pkt_get_reserve_rx(K_NO_WAIT);
if (!pkt) { if (!pkt) {
LOG_ERR("No buf available"); LOG_ERR("No buf available");
goto out; goto out;

View file

@ -78,7 +78,7 @@ static void nrf5_rx_thread(void *arg1, void *arg2, void *arg3)
LOG_DBG("Frame received"); LOG_DBG("Frame received");
pkt = net_pkt_get_reserve_rx(0, K_NO_WAIT); pkt = net_pkt_get_reserve_rx(K_NO_WAIT);
if (!pkt) { if (!pkt) {
LOG_ERR("No pkt available"); LOG_ERR("No pkt available");
goto out; goto out;

View file

@ -125,7 +125,7 @@ static u8_t *upipe_rx(u8_t *buf, size_t *off)
upipe->rx_buf[upipe->rx_off++] = *buf; upipe->rx_buf[upipe->rx_off++] = *buf;
if (upipe->rx_len == upipe->rx_off) { if (upipe->rx_len == upipe->rx_off) {
pkt = net_pkt_get_reserve_rx(0, K_NO_WAIT); pkt = net_pkt_get_reserve_rx(K_NO_WAIT);
if (!pkt) { if (!pkt) {
LOG_DBG("No pkt available"); LOG_DBG("No pkt available");
goto flush; goto flush;

View file

@ -282,7 +282,7 @@ static inline int slip_input_byte(struct slip_context *slip,
if (!slip->first) { if (!slip->first) {
slip->first = true; slip->first = true;
slip->rx = net_pkt_get_reserve_rx(0, K_NO_WAIT); slip->rx = net_pkt_get_reserve_rx(K_NO_WAIT);
if (!slip->rx) { if (!slip->rx) {
LOG_ERR("[%p] cannot allocate pkt", slip); LOG_ERR("[%p] cannot allocate pkt", slip);
return 0; return 0;
@ -316,7 +316,7 @@ static inline int slip_input_byte(struct slip_context *slip,
/* We need to allocate a new fragment */ /* We need to allocate a new fragment */
struct net_buf *frag; struct net_buf *frag;
frag = net_pkt_get_reserve_rx_data(0, K_NO_WAIT); frag = net_pkt_get_reserve_rx_data(K_NO_WAIT);
if (!frag) { if (!frag) {
LOG_ERR("[%p] cannot allocate next data frag", slip); LOG_ERR("[%p] cannot allocate next data frag", slip);
net_pkt_unref(slip->rx); net_pkt_unref(slip->rx);

View file

@ -111,7 +111,7 @@ static void eswifi_off_read_work(struct k_work *work)
LOG_DBG("payload sz = %d", len); LOG_DBG("payload sz = %d", len);
pkt = net_pkt_get_reserve_rx(0, K_NO_WAIT); pkt = net_pkt_get_reserve_rx(K_NO_WAIT);
if (!pkt) { if (!pkt) {
LOG_ERR("Cannot allocate rx packet"); LOG_ERR("Cannot allocate rx packet");
goto done; goto done;

View file

@ -512,7 +512,7 @@ static int winc1500_sendto(struct net_pkt *pkt,
static int prepare_pkt(struct socket_data *sock_data) static int prepare_pkt(struct socket_data *sock_data)
{ {
/* Get the frame from the buffer */ /* Get the frame from the buffer */
sock_data->rx_pkt = net_pkt_get_reserve_rx(0, K_NO_WAIT); sock_data->rx_pkt = net_pkt_get_reserve_rx(K_NO_WAIT);
if (!sock_data->rx_pkt) { if (!sock_data->rx_pkt) {
LOG_ERR("Could not allocate rx packet"); LOG_ERR("Could not allocate rx packet");
return -1; return -1;

View file

@ -751,23 +751,19 @@ static inline void net_pkt_set_src_ipv6_addr(struct net_pkt *pkt)
*/ */
struct net_pkt *net_pkt_get_reserve_debug(struct k_mem_slab *slab, struct net_pkt *net_pkt_get_reserve_debug(struct k_mem_slab *slab,
u16_t reserve_head,
s32_t timeout, s32_t timeout,
const char *caller, const char *caller,
int line); int line);
#define net_pkt_get_reserve(slab, reserve_head, timeout) \ #define net_pkt_get_reserve(slab, timeout) \
net_pkt_get_reserve_debug(slab, reserve_head, timeout, \ net_pkt_get_reserve_debug(slab, timeout, __func__, __LINE__)
__func__, __LINE__)
struct net_buf *net_pkt_get_reserve_data_debug(struct net_buf_pool *pool, struct net_buf *net_pkt_get_reserve_data_debug(struct net_buf_pool *pool,
u16_t reserve_head,
s32_t timeout, s32_t timeout,
const char *caller, const char *caller,
int line); int line);
#define net_pkt_get_reserve_data(pool, reserve_head, timeout) \ #define net_pkt_get_reserve_data(pool, timeout) \
net_pkt_get_reserve_data_debug(pool, reserve_head, timeout, \ net_pkt_get_reserve_data_debug(pool, timeout, __func__, __LINE__)
__func__, __LINE__)
struct net_pkt *net_pkt_get_rx_debug(struct net_context *context, struct net_pkt *net_pkt_get_rx_debug(struct net_context *context,
s32_t timeout, s32_t timeout,
@ -787,31 +783,27 @@ struct net_buf *net_pkt_get_data_debug(struct net_context *context,
#define net_pkt_get_data(context, timeout) \ #define net_pkt_get_data(context, timeout) \
net_pkt_get_data_debug(context, timeout, __func__, __LINE__) net_pkt_get_data_debug(context, timeout, __func__, __LINE__)
struct net_pkt *net_pkt_get_reserve_rx_debug(u16_t reserve_head, struct net_pkt *net_pkt_get_reserve_rx_debug(s32_t timeout,
s32_t timeout,
const char *caller, int line); const char *caller, int line);
#define net_pkt_get_reserve_rx(res, timeout) \ #define net_pkt_get_reserve_rx(timeout) \
net_pkt_get_reserve_rx_debug(res, timeout, __func__, __LINE__) net_pkt_get_reserve_rx_debug(timeout, __func__, __LINE__)
struct net_pkt *net_pkt_get_reserve_tx_debug(u16_t reserve_head, struct net_pkt *net_pkt_get_reserve_tx_debug(s32_t timeout,
s32_t timeout,
const char *caller, int line); const char *caller, int line);
#define net_pkt_get_reserve_tx(res, timeout) \ #define net_pkt_get_reserve_tx(timeout) \
net_pkt_get_reserve_tx_debug(res, timeout, __func__, __LINE__) net_pkt_get_reserve_tx_debug(timeout, __func__, __LINE__)
struct net_buf *net_pkt_get_reserve_rx_data_debug(u16_t reserve_head, struct net_buf *net_pkt_get_reserve_rx_data_debug(s32_t timeout,
s32_t timeout,
const char *caller, const char *caller,
int line); int line);
#define net_pkt_get_reserve_rx_data(res, timeout) \ #define net_pkt_get_reserve_rx_data(timeout) \
net_pkt_get_reserve_rx_data_debug(res, timeout, __func__, __LINE__) net_pkt_get_reserve_rx_data_debug(timeout, __func__, __LINE__)
struct net_buf *net_pkt_get_reserve_tx_data_debug(u16_t reserve_head, struct net_buf *net_pkt_get_reserve_tx_data_debug(s32_t timeout,
s32_t timeout,
const char *caller, const char *caller,
int line); int line);
#define net_pkt_get_reserve_tx_data(res, timeout) \ #define net_pkt_get_reserve_tx_data(timeout) \
net_pkt_get_reserve_tx_data_debug(res, timeout, __func__, __LINE__) net_pkt_get_reserve_tx_data_debug(timeout, __func__, __LINE__)
struct net_buf *net_pkt_get_frag_debug(struct net_pkt *pkt, struct net_buf *net_pkt_get_frag_debug(struct net_pkt *pkt,
s32_t timeout, s32_t timeout,
@ -871,7 +863,6 @@ void net_pkt_print_frags(struct net_pkt *pkt);
* @details Get network packet from the specific packet slab. * @details Get network packet from the specific packet slab.
* *
* @param slab Network packet slab. * @param slab Network packet slab.
* @param reserve_head How many bytes to reserve for headroom.
* @param timeout Affects the action taken should the net pkt slab be empty. * @param timeout Affects the action taken should the net pkt slab be empty.
* If K_NO_WAIT, then return immediately. If K_FOREVER, then * If K_NO_WAIT, then return immediately. If K_FOREVER, then
* wait as long as necessary. Otherwise, wait up to the specified * wait as long as necessary. Otherwise, wait up to the specified
@ -880,7 +871,6 @@ void net_pkt_print_frags(struct net_pkt *pkt);
* @return Network packet if successful, NULL otherwise. * @return Network packet if successful, NULL otherwise.
*/ */
struct net_pkt *net_pkt_get_reserve(struct k_mem_slab *slab, struct net_pkt *net_pkt_get_reserve(struct k_mem_slab *slab,
u16_t reserve_head,
s32_t timeout); s32_t timeout);
/** /**
@ -937,13 +927,11 @@ struct net_buf *net_pkt_get_data(struct net_context *context,
s32_t timeout); s32_t timeout);
/** /**
* @brief Get RX packet from slab but also reserve headroom for * @brief Get RX packet from slab
* potential headers.
* *
* @details Normally this version is not useful for applications * @details Normally this version is not useful for applications
* but is mainly used by network fragmentation code. * but is mainly used by network fragmentation code.
* *
* @param reserve_head How many bytes to reserve for headroom.
* @param timeout Affects the action taken should the net pkt slab be empty. * @param timeout Affects the action taken should the net pkt slab be empty.
* If K_NO_WAIT, then return immediately. If K_FOREVER, then * If K_NO_WAIT, then return immediately. If K_FOREVER, then
* wait as long as necessary. Otherwise, wait up to the specified * wait as long as necessary. Otherwise, wait up to the specified
@ -951,17 +939,14 @@ struct net_buf *net_pkt_get_data(struct net_context *context,
* *
* @return Network packet if successful, NULL otherwise. * @return Network packet if successful, NULL otherwise.
*/ */
struct net_pkt *net_pkt_get_reserve_rx(u16_t reserve_head, struct net_pkt *net_pkt_get_reserve_rx(s32_t timeout);
s32_t timeout);
/** /**
* @brief Get TX packet from slab but also reserve headroom for * @brief Get TX packet from slab
* potential headers.
* *
* @details Normally this version is not useful for applications * @details Normally this version is not useful for applications
* but is mainly used by network fragmentation code. * but is mainly used by network fragmentation code.
* *
* @param reserve_head How many bytes to reserve for headroom.
* @param timeout Affects the action taken should the net pkt slab be empty. * @param timeout Affects the action taken should the net pkt slab be empty.
* If K_NO_WAIT, then return immediately. If K_FOREVER, then * If K_NO_WAIT, then return immediately. If K_FOREVER, then
* wait as long as necessary. Otherwise, wait up to the specified * wait as long as necessary. Otherwise, wait up to the specified
@ -969,17 +954,15 @@ struct net_pkt *net_pkt_get_reserve_rx(u16_t reserve_head,
* *
* @return Network packet if successful, NULL otherwise. * @return Network packet if successful, NULL otherwise.
*/ */
struct net_pkt *net_pkt_get_reserve_tx(u16_t reserve_head, struct net_pkt *net_pkt_get_reserve_tx(s32_t timeout);
s32_t timeout);
/** /**
* @brief Get RX DATA buffer from pool but also reserve headroom for * @brief Get RX DATA buffer from pool.
* potential headers. Normally you should use net_pkt_get_frag() instead. * Normally you should use net_pkt_get_frag() instead.
* *
* @details Normally this version is not useful for applications * @details Normally this version is not useful for applications
* but is mainly used by network fragmentation code. * but is mainly used by network fragmentation code.
* *
* @param reserve_head How many bytes to reserve for headroom.
* @param timeout Affects the action taken should the net buf pool be empty. * @param timeout Affects the action taken should the net buf pool be empty.
* If K_NO_WAIT, then return immediately. If K_FOREVER, then * If K_NO_WAIT, then return immediately. If K_FOREVER, then
* wait as long as necessary. Otherwise, wait up to the specified * wait as long as necessary. Otherwise, wait up to the specified
@ -987,17 +970,15 @@ struct net_pkt *net_pkt_get_reserve_tx(u16_t reserve_head,
* *
* @return Network buffer if successful, NULL otherwise. * @return Network buffer if successful, NULL otherwise.
*/ */
struct net_buf *net_pkt_get_reserve_rx_data(u16_t reserve_head, struct net_buf *net_pkt_get_reserve_rx_data(s32_t timeout);
s32_t timeout);
/** /**
* @brief Get TX DATA buffer from pool but also reserve headroom for * @brief Get TX DATA buffer from pool.
* potential headers. Normally you should use net_pkt_get_frag() instead. * Normally you should use net_pkt_get_frag() instead.
* *
* @details Normally this version is not useful for applications * @details Normally this version is not useful for applications
* but is mainly used by network fragmentation code. * but is mainly used by network fragmentation code.
* *
* @param reserve_head How many bytes to reserve for headroom.
* @param timeout Affects the action taken should the net buf pool be empty. * @param timeout Affects the action taken should the net buf pool be empty.
* If K_NO_WAIT, then return immediately. If K_FOREVER, then * If K_NO_WAIT, then return immediately. If K_FOREVER, then
* wait as long as necessary. Otherwise, wait up to the specified * wait as long as necessary. Otherwise, wait up to the specified
@ -1005,8 +986,7 @@ struct net_buf *net_pkt_get_reserve_rx_data(u16_t reserve_head,
* *
* @return Network buffer if successful, NULL otherwise. * @return Network buffer if successful, NULL otherwise.
*/ */
struct net_buf *net_pkt_get_reserve_tx_data(u16_t reserve_head, struct net_buf *net_pkt_get_reserve_tx_data(s32_t timeout);
s32_t timeout);
/** /**
* @brief Get a data fragment that might be from user specific * @brief Get a data fragment that might be from user specific
@ -1100,9 +1080,9 @@ void net_pkt_frag_insert(struct net_pkt *pkt, struct net_buf *frag);
* *
* @param pkt Network packet. * @param pkt Network packet.
* @param amount Max amount of data to be copied. * @param amount Max amount of data to be copied.
* @param reserve Amount of extra data (this is not link layer header) in the * @param reserve Amount of extra data in the first data fragment that is
* first data fragment that is returned. The function will copy the original * returned. The function will copy the original buffer right after the
* buffer right after the reserved bytes in the first destination fragment. * reserved bytes in the first destination fragment.
* @param timeout Affects the action taken should the net buf pool be empty. * @param timeout Affects the action taken should the net buf pool be empty.
* If K_NO_WAIT, then return immediately. If K_FOREVER, then * If K_NO_WAIT, then return immediately. If K_FOREVER, then
* wait as long as necessary. Otherwise, wait up to the specified * wait as long as necessary. Otherwise, wait up to the specified
@ -1118,9 +1098,9 @@ struct net_buf *net_pkt_copy(struct net_pkt *pkt, size_t amount,
* in destination buffer before a copy. * in destination buffer before a copy.
* *
* @param pkt Network packet. * @param pkt Network packet.
* @param reserve Amount of extra data (this is not link layer header) in the * @param reserve Amount of extra data in the first data fragment that is
* first data fragment that is returned. The function will copy the original * returned. The function will copy the original buffer right after the
* buffer right after the reserved bytes in the first destination fragment. * reserved bytes in the first destination fragment.
* @param timeout Affects the action taken should the net buf pool be empty. * @param timeout Affects the action taken should the net buf pool be empty.
* If K_NO_WAIT, then return immediately. If K_FOREVER, then * If K_NO_WAIT, then return immediately. If K_FOREVER, then
* wait as long as necessary. Otherwise, wait up to the specified * wait as long as necessary. Otherwise, wait up to the specified
@ -1129,8 +1109,7 @@ struct net_buf *net_pkt_copy(struct net_pkt *pkt, size_t amount,
* @return New fragment list if successful, NULL otherwise. * @return New fragment list if successful, NULL otherwise.
*/ */
static inline struct net_buf *net_pkt_copy_all(struct net_pkt *pkt, static inline struct net_buf *net_pkt_copy_all(struct net_pkt *pkt,
size_t reserve, size_t reserve, s32_t timeout)
s32_t timeout)
{ {
return net_pkt_copy(pkt, net_buf_frags_len(pkt->frags), return net_pkt_copy(pkt, net_buf_frags_len(pkt->frags),
reserve, timeout); reserve, timeout);
@ -1458,7 +1437,7 @@ struct net_buf *net_frag_read(struct net_buf *frag, u16_t offset,
* @details Skip N number of bytes starting from fragment's offset. If the total * @details Skip N number of bytes starting from fragment's offset. If the total
* length of data is placed in multiple fragments, this function will skip from * length of data is placed in multiple fragments, this function will skip from
* all fragments until it reaches N number of bytes. This function is useful * all fragments until it reaches N number of bytes. This function is useful
* when unwanted data (e.g. reserved or not supported data in message) is part * when unwanted data (e.g. not supported data in message) is part
* of fragment and we want to skip it. * of fragment and we want to skip it.
* *
* @param frag Network buffer fragment. * @param frag Network buffer fragment.

View file

@ -145,7 +145,7 @@ static int slip_process_byte(unsigned char c)
#endif #endif
if (!pkt_curr) { if (!pkt_curr) {
pkt_curr = net_pkt_get_reserve_rx(0, K_NO_WAIT); pkt_curr = net_pkt_get_reserve_rx(K_NO_WAIT);
if (!pkt_curr) { if (!pkt_curr) {
LOG_ERR("No more buffers"); LOG_ERR("No more buffers");
return 0; return 0;
@ -223,7 +223,7 @@ static void send_data(u8_t *cfg, u8_t *data, size_t len)
struct net_pkt *pkt; struct net_pkt *pkt;
struct net_buf *buf; struct net_buf *buf;
pkt = net_pkt_get_reserve_rx(0, K_NO_WAIT); pkt = net_pkt_get_reserve_rx(K_NO_WAIT);
if (!pkt) { if (!pkt) {
LOG_DBG("No pkt available"); LOG_DBG("No pkt available");
return; return;

View file

@ -310,7 +310,7 @@ static int wpanusb_vendor_handler(struct usb_setup_packet *setup,
struct net_pkt *pkt; struct net_pkt *pkt;
struct net_buf *buf; struct net_buf *buf;
pkt = net_pkt_get_reserve_tx(0, K_NO_WAIT); pkt = net_pkt_get_reserve_tx(K_NO_WAIT);
if (!pkt) { if (!pkt) {
return -ENOMEM; return -ENOMEM;
} }

View file

@ -184,7 +184,7 @@ static struct net_pkt *dhcpv4_prepare_message(struct net_if *iface, u8_t type,
struct net_buf *frag; struct net_buf *frag;
struct dhcp_msg *msg; struct dhcp_msg *msg;
pkt = net_pkt_get_reserve_tx(0, K_FOREVER); pkt = net_pkt_get_reserve_tx(K_FOREVER);
net_pkt_set_iface(pkt, iface); net_pkt_set_iface(pkt, iface);
net_pkt_set_ipv4_ttl(pkt, 0xFF); net_pkt_set_ipv4_ttl(pkt, 0xFF);

View file

@ -178,7 +178,7 @@ int net_icmpv4_send_echo_request(struct net_if *iface,
/* Take the first address of the network interface */ /* Take the first address of the network interface */
src = &ipv4->unicast[0].address.in_addr; src = &ipv4->unicast[0].address.in_addr;
pkt = net_pkt_get_reserve_tx(0, PKT_WAIT_TIME); pkt = net_pkt_get_reserve_tx(PKT_WAIT_TIME);
if (!pkt) { if (!pkt) {
return -ENOMEM; return -ENOMEM;
} }
@ -255,7 +255,7 @@ int net_icmpv4_send_error(struct net_pkt *orig, u8_t type, u8_t code)
dst = &NET_IPV4_HDR(orig)->src; dst = &NET_IPV4_HDR(orig)->src;
src = &NET_IPV4_HDR(orig)->dst; src = &NET_IPV4_HDR(orig)->dst;
pkt = net_pkt_get_reserve_tx(0, PKT_WAIT_TIME); pkt = net_pkt_get_reserve_tx(PKT_WAIT_TIME);
if (!pkt) { if (!pkt) {
err = -ENOMEM; err = -ENOMEM;
goto drop_no_pkt; goto drop_no_pkt;

View file

@ -311,7 +311,7 @@ static enum net_verdict handle_echo_request(struct net_pkt *orig)
goto drop_no_pkt; goto drop_no_pkt;
} }
pkt = net_pkt_get_reserve_tx(0, PKT_WAIT_TIME); pkt = net_pkt_get_reserve_tx(PKT_WAIT_TIME);
if (!pkt) { if (!pkt) {
goto drop_no_pkt; goto drop_no_pkt;
} }
@ -427,7 +427,7 @@ int net_icmpv6_send_error(struct net_pkt *orig, u8_t type, u8_t code,
} }
} }
pkt = net_pkt_get_reserve_tx(0, PKT_WAIT_TIME); pkt = net_pkt_get_reserve_tx(PKT_WAIT_TIME);
if (!pkt) { if (!pkt) {
err = -ENOMEM; err = -ENOMEM;
goto drop_no_pkt; goto drop_no_pkt;
@ -547,7 +547,7 @@ int net_icmpv6_send_echo_request(struct net_if *iface,
src = net_if_ipv6_select_src_addr(iface, dst); src = net_if_ipv6_select_src_addr(iface, dst);
pkt = net_pkt_get_reserve_tx(0, PKT_WAIT_TIME); pkt = net_pkt_get_reserve_tx(PKT_WAIT_TIME);
if (!pkt) { if (!pkt) {
return -ENOMEM; return -ENOMEM;
} }

View file

@ -35,7 +35,7 @@ static struct net_pkt *ipv4_autoconf_prepare_arp(struct net_if *iface)
struct net_pkt *pkt; struct net_pkt *pkt;
struct net_buf *frag; struct net_buf *frag;
pkt = net_pkt_get_reserve_tx(0, BUF_ALLOC_TIMEOUT); pkt = net_pkt_get_reserve_tx(BUF_ALLOC_TIMEOUT);
if (!pkt) { if (!pkt) {
goto fail; goto fail;
} }

View file

@ -88,7 +88,7 @@ static int send_mldv2_raw(struct net_if *iface, struct net_buf *frags)
/* Sent to all MLDv2-capable routers */ /* Sent to all MLDv2-capable routers */
net_ipv6_addr_create(&dst, 0xff02, 0, 0, 0, 0, 0, 0, 0x0016); net_ipv6_addr_create(&dst, 0xff02, 0, 0, 0, 0, 0, 0, 0x0016);
pkt = net_pkt_get_reserve_tx(0, NET_BUF_TIMEOUT); pkt = net_pkt_get_reserve_tx(NET_BUF_TIMEOUT);
if (!pkt) { if (!pkt) {
return -ENOMEM; return -ENOMEM;
} }
@ -170,7 +170,7 @@ static int send_mldv2(struct net_if *iface, const struct in6_addr *addr,
struct net_pkt *pkt; struct net_pkt *pkt;
int ret; int ret;
pkt = net_pkt_get_reserve_tx(0, NET_BUF_TIMEOUT); pkt = net_pkt_get_reserve_tx(NET_BUF_TIMEOUT);
if (!pkt) { if (!pkt) {
return -ENOMEM; return -ENOMEM;
} }
@ -251,7 +251,7 @@ static void send_mld_report(struct net_if *iface)
NET_ASSERT(ipv6); NET_ASSERT(ipv6);
pkt = net_pkt_get_reserve_tx(0, NET_BUF_TIMEOUT); pkt = net_pkt_get_reserve_tx(NET_BUF_TIMEOUT);
if (!pkt) { if (!pkt) {
return; return;
} }

View file

@ -1011,7 +1011,7 @@ int net_ipv6_send_na(struct net_if *iface, const struct in6_addr *src,
u8_t llao_len; u8_t llao_len;
int ret; int ret;
pkt = net_pkt_get_reserve_tx(0, ND_NET_BUF_TIMEOUT); pkt = net_pkt_get_reserve_tx(ND_NET_BUF_TIMEOUT);
if (!pkt) { if (!pkt) {
return -ENOMEM; return -ENOMEM;
} }
@ -1840,7 +1840,7 @@ int net_ipv6_send_ns(struct net_if *iface,
u8_t llao_len; u8_t llao_len;
int ret; int ret;
pkt = net_pkt_get_reserve_tx(0, ND_NET_BUF_TIMEOUT); pkt = net_pkt_get_reserve_tx(ND_NET_BUF_TIMEOUT);
if (!pkt) { if (!pkt) {
return -ENOMEM; return -ENOMEM;
} }
@ -1994,7 +1994,7 @@ int net_ipv6_send_rs(struct net_if *iface)
u8_t llao_len = 0U; u8_t llao_len = 0U;
int ret; int ret;
pkt = net_pkt_get_reserve_tx(0, ND_NET_BUF_TIMEOUT); pkt = net_pkt_get_reserve_tx(ND_NET_BUF_TIMEOUT);
if (!pkt) { if (!pkt) {
return -ENOMEM; return -ENOMEM;
} }

View file

@ -287,7 +287,7 @@ void net_pkt_print_frags(struct net_pkt *pkt)
{ {
struct net_buf *frag; struct net_buf *frag;
size_t total = 0; size_t total = 0;
int count = 0, frag_size = 0, ll_overhead = 0; int count = 0, frag_size = 0;
if (!pkt) { if (!pkt) {
NET_INFO("pkt %p", pkt); NET_INFO("pkt %p", pkt);
@ -303,10 +303,9 @@ void net_pkt_print_frags(struct net_pkt *pkt)
total += frag->len; total += frag->len;
frag_size = frag->size; frag_size = frag->size;
ll_overhead = net_buf_headroom(frag);
NET_INFO("[%d] frag %p len %d size %d reserve %d pool %p", NET_INFO("[%d] frag %p len %d size %d pool %p",
count, frag, frag->len, frag_size, ll_overhead, count, frag, frag->len, frag_size,
net_buf_pool_get(frag->pool_id)); net_buf_pool_get(frag->pool_id));
count++; count++;
@ -314,23 +313,20 @@ void net_pkt_print_frags(struct net_pkt *pkt)
frag = frag->frags; frag = frag->frags;
} }
NET_INFO("Total data size %zu, occupied %d bytes, ll overhead %d, " NET_INFO("Total data size %zu, occupied %d bytes, utilization %zu%%",
"utilization %zu%%", total, count * frag_size,
total, count * frag_size - count * ll_overhead, count ? (total * 100) / (count * frag_size) : 0);
count * ll_overhead, count ? (total * 100) / (count * frag_size) : 0);
} }
#endif /* CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG */ #endif /* CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG */
#if NET_LOG_LEVEL >= LOG_LEVEL_DBG #if NET_LOG_LEVEL >= LOG_LEVEL_DBG
struct net_pkt *net_pkt_get_reserve_debug(struct k_mem_slab *slab, struct net_pkt *net_pkt_get_reserve_debug(struct k_mem_slab *slab,
u16_t reserve_head,
s32_t timeout, s32_t timeout,
const char *caller, const char *caller,
int line) int line)
#else /* #if NET_LOG_LEVEL >= LOG_LEVEL_DBG */ #else /* #if NET_LOG_LEVEL >= LOG_LEVEL_DBG */
struct net_pkt *net_pkt_get_reserve(struct k_mem_slab *slab, struct net_pkt *net_pkt_get_reserve(struct k_mem_slab *slab,
u16_t reserve_head,
s32_t timeout) s32_t timeout)
#endif /* #if NET_LOG_LEVEL >= LOG_LEVEL_DBG */ #endif /* #if NET_LOG_LEVEL >= LOG_LEVEL_DBG */
{ {
@ -358,22 +354,20 @@ struct net_pkt *net_pkt_get_reserve(struct k_mem_slab *slab,
net_pkt_alloc_add(pkt, true, caller, line); net_pkt_alloc_add(pkt, true, caller, line);
#if NET_LOG_LEVEL == LOG_LEVEL_DBG #if NET_LOG_LEVEL == LOG_LEVEL_DBG
NET_DBG("%s [%u] pkt %p reserve %u ref %d (%s():%d)", NET_DBG("%s [%u] pkt %p ref %d (%s():%d)",
slab2str(slab), k_mem_slab_num_free_get(slab), slab2str(slab), k_mem_slab_num_free_get(slab),
pkt, reserve_head, pkt->ref, caller, line); pkt, pkt->ref, caller, line);
#endif #endif
return pkt; return pkt;
} }
#if NET_LOG_LEVEL >= LOG_LEVEL_DBG #if NET_LOG_LEVEL >= LOG_LEVEL_DBG
struct net_buf *net_pkt_get_reserve_data_debug(struct net_buf_pool *pool, struct net_buf *net_pkt_get_reserve_data_debug(struct net_buf_pool *pool,
u16_t reserve_head,
s32_t timeout, s32_t timeout,
const char *caller, const char *caller,
int line) int line)
#else /* NET_LOG_LEVEL >= LOG_LEVEL_DBG */ #else /* NET_LOG_LEVEL >= LOG_LEVEL_DBG */
struct net_buf *net_pkt_get_reserve_data(struct net_buf_pool *pool, struct net_buf *net_pkt_get_reserve_data(struct net_buf_pool *pool,
u16_t reserve_head,
s32_t timeout) s32_t timeout)
#endif /* NET_LOG_LEVEL >= LOG_LEVEL_DBG */ #endif /* NET_LOG_LEVEL >= LOG_LEVEL_DBG */
{ {
@ -394,18 +388,16 @@ struct net_buf *net_pkt_get_reserve_data(struct net_buf_pool *pool,
return NULL; return NULL;
} }
net_buf_reserve(frag, reserve_head);
#if NET_LOG_LEVEL >= LOG_LEVEL_DBG #if NET_LOG_LEVEL >= LOG_LEVEL_DBG
NET_FRAG_CHECK_IF_NOT_IN_USE(frag, frag->ref + 1); NET_FRAG_CHECK_IF_NOT_IN_USE(frag, frag->ref + 1);
#endif #endif
net_pkt_alloc_add(frag, false, caller, line); net_pkt_alloc_add(frag, false, caller, line);
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG #if NET_LOG_LEVEL >= LOG_LEVEL_DBG
NET_DBG("%s (%s) [%d] frag %p reserve %u ref %d (%s():%d)", NET_DBG("%s (%s) [%d] frag %p ref %d (%s():%d)",
pool2str(pool), get_name(pool), get_frees(pool), pool2str(pool), get_name(pool), get_frees(pool),
frag, reserve_head, frag->ref, caller, line); frag, frag->ref, caller, line);
#endif #endif
return frag; return frag;
@ -430,90 +422,74 @@ struct net_buf *net_pkt_get_frag(struct net_pkt *pkt,
if (context && context->data_pool) { if (context && context->data_pool) {
#if NET_LOG_LEVEL >= LOG_LEVEL_DBG #if NET_LOG_LEVEL >= LOG_LEVEL_DBG
return net_pkt_get_reserve_data_debug(context->data_pool(), return net_pkt_get_reserve_data_debug(context->data_pool(),
0, timeout, caller, line); timeout, caller, line);
#else #else
return net_pkt_get_reserve_data(context->data_pool(), return net_pkt_get_reserve_data(context->data_pool(), timeout);
0,
timeout);
#endif /* NET_LOG_LEVEL >= LOG_LEVEL_DBG */ #endif /* NET_LOG_LEVEL >= LOG_LEVEL_DBG */
} }
#endif /* CONFIG_NET_CONTEXT_NET_PKT_POOL */ #endif /* CONFIG_NET_CONTEXT_NET_PKT_POOL */
if (pkt->slab == &rx_pkts) { if (pkt->slab == &rx_pkts) {
#if NET_LOG_LEVEL >= LOG_LEVEL_DBG #if NET_LOG_LEVEL >= LOG_LEVEL_DBG
return net_pkt_get_reserve_rx_data_debug(0, timeout, return net_pkt_get_reserve_rx_data_debug(timeout,
caller, line); caller, line);
#else #else
return net_pkt_get_reserve_rx_data(0, return net_pkt_get_reserve_rx_data(timeout);
timeout);
#endif #endif
} }
#if NET_LOG_LEVEL >= LOG_LEVEL_DBG #if NET_LOG_LEVEL >= LOG_LEVEL_DBG
return net_pkt_get_reserve_tx_data_debug(0, timeout, return net_pkt_get_reserve_tx_data_debug(timeout, caller, line);
caller, line);
#else #else
return net_pkt_get_reserve_tx_data(0, timeout); return net_pkt_get_reserve_tx_data(timeout);
#endif #endif
} }
#if NET_LOG_LEVEL >= LOG_LEVEL_DBG #if NET_LOG_LEVEL >= LOG_LEVEL_DBG
struct net_pkt *net_pkt_get_reserve_rx_debug(u16_t reserve_head, struct net_pkt *net_pkt_get_reserve_rx_debug(s32_t timeout,
s32_t timeout,
const char *caller, int line) const char *caller, int line)
{ {
return net_pkt_get_reserve_debug(&rx_pkts, reserve_head, timeout, return net_pkt_get_reserve_debug(&rx_pkts, timeout, caller, line);
caller, line);
} }
struct net_pkt *net_pkt_get_reserve_tx_debug(u16_t reserve_head, struct net_pkt *net_pkt_get_reserve_tx_debug(s32_t timeout,
s32_t timeout,
const char *caller, int line) const char *caller, int line)
{ {
return net_pkt_get_reserve_debug(&tx_pkts, reserve_head, timeout, return net_pkt_get_reserve_debug(&tx_pkts, timeout, caller, line);
caller, line);
} }
struct net_buf *net_pkt_get_reserve_rx_data_debug(u16_t reserve_head, struct net_buf *net_pkt_get_reserve_rx_data_debug(s32_t timeout,
s32_t timeout,
const char *caller, int line) const char *caller, int line)
{ {
return net_pkt_get_reserve_data_debug(&rx_bufs, reserve_head, return net_pkt_get_reserve_data_debug(&rx_bufs, timeout, caller, line);
timeout, caller, line);
} }
struct net_buf *net_pkt_get_reserve_tx_data_debug(u16_t reserve_head, struct net_buf *net_pkt_get_reserve_tx_data_debug(s32_t timeout,
s32_t timeout,
const char *caller, int line) const char *caller, int line)
{ {
return net_pkt_get_reserve_data_debug(&tx_bufs, reserve_head, return net_pkt_get_reserve_data_debug(&tx_bufs, timeout, caller, line);
timeout, caller, line);
} }
#else /* NET_LOG_LEVEL >= LOG_LEVEL_DBG */ #else /* NET_LOG_LEVEL >= LOG_LEVEL_DBG */
struct net_pkt *net_pkt_get_reserve_rx(u16_t reserve_head, struct net_pkt *net_pkt_get_reserve_rx(s32_t timeout)
s32_t timeout)
{ {
return net_pkt_get_reserve(&rx_pkts, reserve_head, timeout); return net_pkt_get_reserve(&rx_pkts, timeout);
} }
struct net_pkt *net_pkt_get_reserve_tx(u16_t reserve_head, struct net_pkt *net_pkt_get_reserve_tx(s32_t timeout)
s32_t timeout)
{ {
return net_pkt_get_reserve(&tx_pkts, reserve_head, timeout); return net_pkt_get_reserve(&tx_pkts, timeout);
} }
struct net_buf *net_pkt_get_reserve_rx_data(u16_t reserve_head, struct net_buf *net_pkt_get_reserve_rx_data(s32_t timeout)
s32_t timeout)
{ {
return net_pkt_get_reserve_data(&rx_bufs, reserve_head, timeout); return net_pkt_get_reserve_data(&rx_bufs, timeout);
} }
struct net_buf *net_pkt_get_reserve_tx_data(u16_t reserve_head, struct net_buf *net_pkt_get_reserve_tx_data(s32_t timeout)
s32_t timeout)
{ {
return net_pkt_get_reserve_data(&tx_bufs, reserve_head, timeout); return net_pkt_get_reserve_data(&tx_bufs, timeout);
} }
#endif /* NET_LOG_LEVEL >= LOG_LEVEL_DBG */ #endif /* NET_LOG_LEVEL >= LOG_LEVEL_DBG */
@ -550,9 +526,9 @@ static struct net_pkt *net_pkt_get(struct k_mem_slab *slab,
} }
#if NET_LOG_LEVEL >= LOG_LEVEL_DBG #if NET_LOG_LEVEL >= LOG_LEVEL_DBG
pkt = net_pkt_get_reserve_debug(slab, 0, timeout, caller, line); pkt = net_pkt_get_reserve_debug(slab, timeout, caller, line);
#else #else
pkt = net_pkt_get_reserve(slab, 0, timeout); pkt = net_pkt_get_reserve(slab, timeout);
#endif #endif
if (!pkt) { if (!pkt) {
return NULL; return NULL;
@ -645,9 +621,9 @@ static struct net_buf *_pkt_get_data(struct net_buf_pool *pool,
} }
#if NET_LOG_LEVEL >= LOG_LEVEL_DBG #if NET_LOG_LEVEL >= LOG_LEVEL_DBG
frag = net_pkt_get_reserve_data_debug(pool, 0, timeout, caller, line); frag = net_pkt_get_reserve_data_debug(pool, timeout, caller, line);
#else #else
frag = net_pkt_get_reserve_data(pool, 0, timeout); frag = net_pkt_get_reserve_data(pool, timeout);
#endif #endif
return frag; return frag;
} }
@ -2151,7 +2127,7 @@ struct net_pkt *net_pkt_clone(struct net_pkt *pkt, s32_t timeout)
return NULL; return NULL;
} }
clone = net_pkt_get_reserve(pkt->slab, 0, timeout); clone = net_pkt_get_reserve(pkt->slab, timeout);
if (!clone) { if (!clone) {
return NULL; return NULL;
} }

View file

@ -192,27 +192,21 @@ static inline void net_hexdump(const char *str,
} }
/* Hexdump from all fragments /* Hexdump from all fragments */
* Set full as true to get also the L2 reserve part printed out
*/
static inline void net_hexdump_frags(const char *str, static inline void net_hexdump_frags(const char *str,
struct net_pkt *pkt, bool full) struct net_pkt *pkt, bool full)
{ {
u8_t reserve = full ? net_pkt_ll_reserve(pkt) : 0;
struct net_buf *frag = pkt->frags; struct net_buf *frag = pkt->frags;
ARG_UNUSED(full);
if (str && str[0]) { if (str && str[0]) {
LOG_DBG("%s", str); LOG_DBG("%s", str);
} }
while (frag) { while (frag) {
LOG_HEXDUMP_DBG(full ? frag->data - reserve : frag->data, LOG_HEXDUMP_DBG(frag->data, frag->len, "");
frag->len + reserve, "");
frag = frag->frags; frag = frag->frags;
if (full && reserve) {
reserve -= net_pkt_ll_reserve(pkt);
}
} }
} }

View file

@ -487,7 +487,7 @@ int net_rpl_dio_send(struct net_if *iface,
u16_t value; u16_t value;
int ret; int ret;
pkt = net_pkt_get_reserve_tx(0, BUF_TIMEOUT); pkt = net_pkt_get_reserve_tx(BUF_TIMEOUT);
if (!pkt) { if (!pkt) {
return -ENOMEM; return -ENOMEM;
} }
@ -762,7 +762,7 @@ int net_rpl_dis_send(struct in6_addr *dst, struct net_if *iface)
dst_addr = dst; dst_addr = dst;
} }
pkt = net_pkt_get_reserve_tx(0, BUF_TIMEOUT); pkt = net_pkt_get_reserve_tx(BUF_TIMEOUT);
if (!pkt) { if (!pkt) {
return -ENOMEM; return -ENOMEM;
} }
@ -3091,7 +3091,7 @@ int net_rpl_dao_send(struct net_if *iface,
return -EINVAL; return -EINVAL;
} }
pkt = net_pkt_get_reserve_tx(0, BUF_TIMEOUT); pkt = net_pkt_get_reserve_tx(BUF_TIMEOUT);
if (!pkt) { if (!pkt) {
return -ENOMEM; return -ENOMEM;
} }
@ -3188,7 +3188,7 @@ static inline int dao_forward(struct net_if *iface,
struct net_pkt *pkt; struct net_pkt *pkt;
int ret; int ret;
pkt = net_pkt_get_reserve_tx(0, BUF_TIMEOUT); pkt = net_pkt_get_reserve_tx(BUF_TIMEOUT);
if (!pkt) { if (!pkt) {
return -ENOMEM; return -ENOMEM;
} }
@ -3229,7 +3229,7 @@ static int dao_ack_send(struct in6_addr *src,
NET_DBG("Sending a DAO ACK with sequence number %d to %s", NET_DBG("Sending a DAO ACK with sequence number %d to %s",
sequence, log_strdup(net_sprint_ipv6_addr(dst))); sequence, log_strdup(net_sprint_ipv6_addr(dst)));
pkt = net_pkt_get_reserve_tx(0, BUF_TIMEOUT); pkt = net_pkt_get_reserve_tx(BUF_TIMEOUT);
if (!pkt) { if (!pkt) {
return -ENOMEM; return -ENOMEM;
} }

View file

@ -200,7 +200,7 @@ static int ipsp_recv(struct bt_l2cap_chan *chan, struct net_buf *buf)
net_buf_frags_len(buf)); net_buf_frags_len(buf));
/* Get packet for bearer / protocol related data */ /* Get packet for bearer / protocol related data */
pkt = net_pkt_get_reserve_rx(0, BUF_TIMEOUT); pkt = net_pkt_get_reserve_rx(BUF_TIMEOUT);
if (!pkt) { if (!pkt) {
return -ENOMEM; return -ENOMEM;
} }
@ -232,7 +232,7 @@ static struct net_buf *ipsp_alloc_buf(struct bt_l2cap_chan *chan)
{ {
NET_DBG("Channel %p requires buffer", chan); NET_DBG("Channel %p requires buffer", chan);
return net_pkt_get_reserve_rx_data(0, K_FOREVER); return net_pkt_get_reserve_rx_data(K_FOREVER);
} }
static struct bt_l2cap_chan_ops ipsp_ops = { static struct bt_l2cap_chan_ops ipsp_ops = {

View file

@ -246,7 +246,7 @@ static inline struct net_pkt *arp_prepare(struct net_if *iface,
} else { } else {
struct net_buf *frag; struct net_buf *frag;
pkt = net_pkt_get_reserve_tx(0, NET_BUF_TIMEOUT); pkt = net_pkt_get_reserve_tx(NET_BUF_TIMEOUT);
if (!pkt) { if (!pkt) {
return NULL; return NULL;
} }
@ -471,7 +471,7 @@ static inline struct net_pkt *arp_prepare_reply(struct net_if *iface,
struct net_arp_hdr *hdr, *query; struct net_arp_hdr *hdr, *query;
struct net_eth_hdr *eth_query; struct net_eth_hdr *eth_query;
pkt = net_pkt_get_reserve_tx(0, NET_BUF_TIMEOUT); pkt = net_pkt_get_reserve_tx(NET_BUF_TIMEOUT);
if (!pkt) { if (!pkt) {
goto fail; goto fail;
} }

View file

@ -146,13 +146,12 @@ static struct net_pkt *setup_gptp_frame(struct net_if *iface)
struct net_pkt *pkt; struct net_pkt *pkt;
struct net_buf *frag; struct net_buf *frag;
pkt = net_pkt_get_reserve_tx(net_if_get_ll_reserve(iface, NULL), pkt = net_pkt_get_reserve_tx(NET_BUF_TIMEOUT);
NET_BUF_TIMEOUT);
if (!pkt) { if (!pkt) {
return NULL; return NULL;
} }
frag = net_pkt_get_reserve_tx_data(0, NET_BUF_TIMEOUT); frag = net_pkt_get_reserve_tx_data(NET_BUF_TIMEOUT);
if (!frag) { if (!frag) {
net_pkt_unref(pkt); net_pkt_unref(pkt);
return NULL; return NULL;

View file

@ -100,9 +100,7 @@ static int lldp_send(struct ethernet_lldp *lldp)
goto out; goto out;
} }
pkt = net_pkt_get_reserve_tx(net_if_get_ll_reserve(lldp->iface, pkt = net_pkt_get_reserve_tx(BUF_ALLOC_TIMEOUT);
NULL),
BUF_ALLOC_TIMEOUT);
if (!pkt) { if (!pkt) {
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;

View file

@ -75,7 +75,7 @@ static inline void ieee802154_acknowledge(struct net_if *iface,
return; return;
} }
pkt = net_pkt_get_reserve_tx(0, BUF_TIMEOUT); pkt = net_pkt_get_reserve_tx(BUF_TIMEOUT);
if (!pkt) { if (!pkt) {
return; return;
} }

View file

@ -819,7 +819,7 @@ ieee802154_create_mac_cmd_frame(struct ieee802154_context *ctx,
struct net_buf *frag; struct net_buf *frag;
u8_t *p_buf; u8_t *p_buf;
pkt = net_pkt_get_reserve_tx(0, BUF_TIMEOUT); pkt = net_pkt_get_reserve_tx(BUF_TIMEOUT);
if (!pkt) { if (!pkt) {
return NULL; return NULL;
} }

View file

@ -104,7 +104,7 @@ void ot_receive_handler(otMessage *aMessage, void *context)
struct net_pkt *pkt; struct net_pkt *pkt;
struct net_buf *prev_buf = NULL; struct net_buf *prev_buf = NULL;
pkt = net_pkt_get_reserve_rx(0, K_NO_WAIT); pkt = net_pkt_get_reserve_rx(K_NO_WAIT);
if (!pkt) { if (!pkt) {
NET_ERR("Failed to reserve net pkt"); NET_ERR("Failed to reserve net pkt");
goto out; goto out;

View file

@ -53,10 +53,10 @@ static u16_t channel;
static void dataInit(void) static void dataInit(void)
{ {
tx_pkt = net_pkt_get_reserve_tx(0, K_NO_WAIT); tx_pkt = net_pkt_get_reserve_tx(K_NO_WAIT);
__ASSERT_NO_MSG(tx_pkt != NULL); __ASSERT_NO_MSG(tx_pkt != NULL);
tx_payload = net_pkt_get_reserve_tx_data(0, K_NO_WAIT); tx_payload = net_pkt_get_reserve_tx_data(K_NO_WAIT);
__ASSERT_NO_MSG(tx_payload != NULL); __ASSERT_NO_MSG(tx_payload != NULL);
net_pkt_frag_insert(tx_pkt, tx_payload); net_pkt_frag_insert(tx_pkt, tx_payload);
@ -381,4 +381,3 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
return OT_ERROR_NONE; return OT_ERROR_NONE;
} }

View file

@ -303,7 +303,7 @@ static void ecm_read_cb(u8_t ep, int size, void *priv)
} }
} }
pkt = net_pkt_get_reserve_rx(0, K_FOREVER); pkt = net_pkt_get_reserve_rx(K_FOREVER);
if (!pkt) { if (!pkt) {
LOG_ERR("no memory for network packet\n"); LOG_ERR("no memory for network packet\n");
goto done; goto done;

View file

@ -173,7 +173,7 @@ static void eem_read_cb(u8_t ep, int size, void *priv)
break; break;
} }
pkt = net_pkt_get_reserve_rx(0, K_FOREVER); pkt = net_pkt_get_reserve_rx(K_FOREVER);
if (!pkt) { if (!pkt) {
LOG_ERR("Unable to alloc pkt\n"); LOG_ERR("Unable to alloc pkt\n");
break; break;

View file

@ -395,7 +395,7 @@ static void rndis_bulk_out(u8_t ep, enum usb_dc_ep_cb_status_code ep_status)
return; return;
} }
pkt = net_pkt_get_reserve_rx(0, K_NO_WAIT); pkt = net_pkt_get_reserve_rx(K_NO_WAIT);
if (!pkt) { if (!pkt) {
/* In a case of low memory skip the whole packet /* In a case of low memory skip the whole packet
* hoping to get buffers for later ones * hoping to get buffers for later ones

View file

@ -312,7 +312,7 @@ static struct net_pkt *create_pkt(struct net_6lo_data *data)
u16_t len; u16_t len;
int remaining; int remaining;
pkt = net_pkt_get_reserve_tx(0, K_FOREVER); pkt = net_pkt_get_reserve_tx(K_FOREVER);
if (!pkt) { if (!pkt) {
return NULL; return NULL;
} }

View file

@ -173,7 +173,7 @@ static inline struct net_pkt *prepare_arp_reply(struct net_if *iface,
struct net_arp_hdr *hdr; struct net_arp_hdr *hdr;
struct net_eth_hdr *eth; struct net_eth_hdr *eth;
pkt = net_pkt_get_reserve_tx(0, K_FOREVER); pkt = net_pkt_get_reserve_tx(K_FOREVER);
if (!pkt) { if (!pkt) {
goto fail; goto fail;
} }
@ -230,7 +230,7 @@ static inline struct net_pkt *prepare_arp_request(struct net_if *iface,
struct net_arp_hdr *hdr, *req_hdr; struct net_arp_hdr *hdr, *req_hdr;
struct net_eth_hdr *eth, *eth_req; struct net_eth_hdr *eth, *eth_req;
pkt = net_pkt_get_reserve_rx(0, K_FOREVER); pkt = net_pkt_get_reserve_rx(K_FOREVER);
if (!pkt) { if (!pkt) {
goto fail; goto fail;
} }
@ -365,7 +365,7 @@ void test_arp(void)
ifaddr->addr_state = NET_ADDR_PREFERRED; ifaddr->addr_state = NET_ADDR_PREFERRED;
/* Application data for testing */ /* Application data for testing */
pkt = net_pkt_get_reserve_tx(0, K_FOREVER); pkt = net_pkt_get_reserve_tx(K_FOREVER);
/**TESTPOINTS: Check if out of memory*/ /**TESTPOINTS: Check if out of memory*/
zassert_not_null(pkt, "Out of mem TX"); zassert_not_null(pkt, "Out of mem TX");
@ -535,7 +535,7 @@ void test_arp(void)
/* The arp request packet is now verified, create an arp reply. /* The arp request packet is now verified, create an arp reply.
* The previous value of pkt is stored in arp table and is not lost. * The previous value of pkt is stored in arp table and is not lost.
*/ */
pkt = net_pkt_get_reserve_rx(0, K_SECONDS(1)); pkt = net_pkt_get_reserve_rx(K_SECONDS(1));
zassert_not_null(pkt, "Out of mem RX reply"); zassert_not_null(pkt, "Out of mem RX reply");
@ -580,7 +580,7 @@ void test_arp(void)
net_pkt_unref(pkt); net_pkt_unref(pkt);
/* Then feed in ARP request */ /* Then feed in ARP request */
pkt = net_pkt_get_reserve_rx(0, K_FOREVER); pkt = net_pkt_get_reserve_rx(K_FOREVER);
/**TESTPOINTS: Check if out of memory*/ /**TESTPOINTS: Check if out of memory*/
zassert_not_null(pkt, zassert_not_null(pkt,
@ -642,7 +642,7 @@ void test_arp(void)
net_arp_foreach(arp_cb, &dst); net_arp_foreach(arp_cb, &dst);
zassert_true(entry_found, "Entry not found"); zassert_true(entry_found, "Entry not found");
pkt = net_pkt_get_reserve_rx(0, K_FOREVER); pkt = net_pkt_get_reserve_rx(K_FOREVER);
zassert_not_null(pkt, "Out of mem RX request"); zassert_not_null(pkt, "Out of mem RX request");

View file

@ -273,7 +273,7 @@ struct net_pkt *prepare_dhcp_offer(struct net_if *iface, u32_t xid)
int bytes, remaining = sizeof(offer), pos = 0; int bytes, remaining = sizeof(offer), pos = 0;
u16_t offset; u16_t offset;
pkt = net_pkt_get_reserve_rx(0, K_FOREVER); pkt = net_pkt_get_reserve_rx(K_FOREVER);
if (!pkt) { if (!pkt) {
return NULL; return NULL;
} }
@ -340,7 +340,7 @@ struct net_pkt *prepare_dhcp_ack(struct net_if *iface, u32_t xid)
int bytes, remaining = sizeof(ack), pos = 0; int bytes, remaining = sizeof(ack), pos = 0;
u16_t offset; u16_t offset;
pkt = net_pkt_get_reserve_rx(0, K_FOREVER); pkt = net_pkt_get_reserve_rx(K_FOREVER);
if (!pkt) { if (!pkt) {
return NULL; return NULL;
} }

View file

@ -101,7 +101,7 @@ void test_icmpv6(void)
net_icmpv6_register_handler(&test_handler1); net_icmpv6_register_handler(&test_handler1);
net_icmpv6_register_handler(&test_handler2); net_icmpv6_register_handler(&test_handler2);
pkt = net_pkt_get_reserve(&pkts_slab, 0, K_SECONDS(1)); pkt = net_pkt_get_reserve(&pkts_slab, K_SECONDS(1));
zassert_true(pkt != NULL, "Could get net_pkt from slab"); zassert_true(pkt != NULL, "Could get net_pkt from slab");
frag = net_buf_alloc(&data_pool, K_SECONDS(1)); frag = net_buf_alloc(&data_pool, K_SECONDS(1));

View file

@ -222,7 +222,7 @@ static struct net_pkt *create_pkt(struct net_fragment_data *data)
u16_t len; u16_t len;
int remaining; int remaining;
pkt = net_pkt_get_reserve_tx(0, K_FOREVER); pkt = net_pkt_get_reserve_tx(K_FOREVER);
if (!pkt) { if (!pkt) {
return NULL; return NULL;
} }
@ -495,7 +495,7 @@ reassemble:
frag = f_pkt->frags; frag = f_pkt->frags;
while (frag) { while (frag) {
rxpkt = net_pkt_get_reserve_rx(0, K_FOREVER); rxpkt = net_pkt_get_reserve_rx(K_FOREVER);
if (!rxpkt) { if (!rxpkt) {
goto end; goto end;
} }

View file

@ -219,7 +219,7 @@ static bool test_ack_reply(struct ieee802154_pkt_test *t)
NET_INFO("- Sending ACK reply to a data packet\n"); NET_INFO("- Sending ACK reply to a data packet\n");
pkt = net_pkt_get_reserve_rx(0, K_FOREVER); pkt = net_pkt_get_reserve_rx(K_FOREVER);
frag = net_pkt_get_frag(pkt, K_FOREVER); frag = net_pkt_get_frag(pkt, K_FOREVER);
memcpy(frag->data, data_pkt, sizeof(data_pkt)); memcpy(frag->data, data_pkt, sizeof(data_pkt));
@ -267,7 +267,7 @@ static bool initialize_test_environment(void)
k_sem_reset(&driver_lock); k_sem_reset(&driver_lock);
current_pkt = net_pkt_get_reserve_rx(0, K_FOREVER); current_pkt = net_pkt_get_reserve_rx(K_FOREVER);
if (!current_pkt) { if (!current_pkt) {
NET_ERR("*** No buffer to allocate\n"); NET_ERR("*** No buffer to allocate\n");
return false; return false;

View file

@ -420,7 +420,7 @@ static bool send_iface(struct net_if *iface, int val, bool expect_fail)
struct net_pkt *pkt; struct net_pkt *pkt;
int ret; int ret;
pkt = net_pkt_get_reserve_tx(0, K_FOREVER); pkt = net_pkt_get_reserve_tx(K_FOREVER);
net_pkt_set_iface(pkt, iface); net_pkt_set_iface(pkt, iface);
net_pkt_append_all(pkt, sizeof(data), data, K_FOREVER); net_pkt_append_all(pkt, sizeof(data), data, K_FOREVER);

View file

@ -446,7 +446,7 @@ static void test_send_ns_extra_options(void)
iface = net_if_get_default(); iface = net_if_get_default();
pkt = net_pkt_get_reserve_tx(0, K_FOREVER); pkt = net_pkt_get_reserve_tx(K_FOREVER);
NET_ASSERT_INFO(pkt, "Out of TX packets"); NET_ASSERT_INFO(pkt, "Out of TX packets");
@ -479,7 +479,7 @@ static void test_send_ns_no_options(void)
iface = net_if_get_default(); iface = net_if_get_default();
pkt = net_pkt_get_reserve_tx(0, K_FOREVER); pkt = net_pkt_get_reserve_tx(K_FOREVER);
NET_ASSERT_INFO(pkt, "Out of TX packets"); NET_ASSERT_INFO(pkt, "Out of TX packets");
@ -605,7 +605,7 @@ static void test_hbho_message(void)
iface = net_if_get_default(); iface = net_if_get_default();
pkt = net_pkt_get_reserve_tx(0, K_FOREVER); pkt = net_pkt_get_reserve_tx(K_FOREVER);
NET_ASSERT_INFO(pkt, "Out of TX packets"); NET_ASSERT_INFO(pkt, "Out of TX packets");
@ -666,7 +666,7 @@ static void test_hbho_message_1(void)
iface = net_if_get_default(); iface = net_if_get_default();
pkt = net_pkt_get_reserve_tx(0, K_FOREVER); pkt = net_pkt_get_reserve_tx(K_FOREVER);
NET_ASSERT_INFO(pkt, "Out of TX packets"); NET_ASSERT_INFO(pkt, "Out of TX packets");
@ -736,7 +736,7 @@ static void test_hbho_message_2(void)
iface = net_if_get_default(); iface = net_if_get_default();
pkt = net_pkt_get_reserve_tx(0, K_FOREVER); pkt = net_pkt_get_reserve_tx(K_FOREVER);
NET_ASSERT_INFO(pkt, "Out of TX packets"); NET_ASSERT_INFO(pkt, "Out of TX packets");
@ -909,7 +909,7 @@ static void test_hbho_message_3(void)
iface = net_if_get_default(); iface = net_if_get_default();
pkt = net_pkt_get_reserve_tx(0, K_FOREVER); pkt = net_pkt_get_reserve_tx(K_FOREVER);
NET_ASSERT_INFO(pkt, "Out of TX packets"); NET_ASSERT_INFO(pkt, "Out of TX packets");
@ -1023,7 +1023,7 @@ static void test_change_ll_addr(void)
iface = net_if_get_default(); iface = net_if_get_default();
pkt = net_pkt_get_reserve_tx(0, K_FOREVER); pkt = net_pkt_get_reserve_tx(K_FOREVER);
NET_ASSERT_INFO(pkt, "Out of TX packets"); NET_ASSERT_INFO(pkt, "Out of TX packets");
@ -1150,8 +1150,7 @@ static enum net_verdict recv_msg(struct in6_addr *src, struct in6_addr *dst)
iface = net_if_get_default(); iface = net_if_get_default();
pkt = net_pkt_get_reserve_tx(net_if_get_ll_reserve(iface, NULL), pkt = net_pkt_get_reserve_tx(K_FOREVER);
K_FOREVER);
NET_ASSERT_INFO(pkt, "Out of TX packets"); NET_ASSERT_INFO(pkt, "Out of TX packets");
@ -1181,8 +1180,7 @@ static int send_msg(struct in6_addr *src, struct in6_addr *dst)
iface = net_if_get_default(); iface = net_if_get_default();
pkt = net_pkt_get_reserve_tx(net_if_get_ll_reserve(iface, NULL), pkt = net_pkt_get_reserve_tx(K_FOREVER);
K_FOREVER);
NET_ASSERT_INFO(pkt, "Out of TX packets"); NET_ASSERT_INFO(pkt, "Out of TX packets");

View file

@ -1224,7 +1224,7 @@ static void test_find_last_ipv6_fragment_udp(void)
struct net_pkt *pkt; struct net_pkt *pkt;
int ret; int ret;
pkt = net_pkt_get_reserve_tx(0, ALLOC_TIMEOUT); pkt = net_pkt_get_reserve_tx(ALLOC_TIMEOUT);
zassert_not_null(pkt, "packet"); zassert_not_null(pkt, "packet");
net_pkt_set_iface(pkt, iface1); net_pkt_set_iface(pkt, iface1);
@ -1261,7 +1261,7 @@ static void test_find_last_ipv6_fragment_hbho_udp(void)
struct net_pkt *pkt; struct net_pkt *pkt;
int ret; int ret;
pkt = net_pkt_get_reserve_tx(0, ALLOC_TIMEOUT); pkt = net_pkt_get_reserve_tx(ALLOC_TIMEOUT);
zassert_not_null(pkt, "packet"); zassert_not_null(pkt, "packet");
net_pkt_set_iface(pkt, iface1); net_pkt_set_iface(pkt, iface1);
@ -1301,7 +1301,7 @@ static void test_find_last_ipv6_fragment_hbho_1(void)
u8_t last_hdr; u8_t last_hdr;
int ret; int ret;
pkt = net_pkt_get_reserve_tx(0, ALLOC_TIMEOUT); pkt = net_pkt_get_reserve_tx(ALLOC_TIMEOUT);
zassert_not_null(pkt, "packet"); zassert_not_null(pkt, "packet");
net_pkt_set_iface(pkt, iface1); net_pkt_set_iface(pkt, iface1);
@ -1343,7 +1343,7 @@ static void test_find_last_ipv6_fragment_hbho_2(void)
u8_t last_hdr; u8_t last_hdr;
int ret; int ret;
pkt = net_pkt_get_reserve_tx(0, ALLOC_TIMEOUT); pkt = net_pkt_get_reserve_tx(ALLOC_TIMEOUT);
zassert_not_null(pkt, "packet"); zassert_not_null(pkt, "packet");
net_pkt_set_iface(pkt, iface1); net_pkt_set_iface(pkt, iface1);
@ -1386,7 +1386,7 @@ static void test_find_last_ipv6_fragment_hbho_3(void)
u8_t last_hdr; u8_t last_hdr;
int ret; int ret;
pkt = net_pkt_get_reserve_tx(0, ALLOC_TIMEOUT); pkt = net_pkt_get_reserve_tx(ALLOC_TIMEOUT);
zassert_not_null(pkt, "packet"); zassert_not_null(pkt, "packet");
net_pkt_set_iface(pkt, iface1); net_pkt_set_iface(pkt, iface1);
@ -1426,7 +1426,7 @@ static void test_find_last_ipv6_fragment_hbho_frag(void)
struct net_pkt *pkt; struct net_pkt *pkt;
int ret; int ret;
pkt = net_pkt_get_reserve_tx(0, ALLOC_TIMEOUT); pkt = net_pkt_get_reserve_tx(ALLOC_TIMEOUT);
zassert_not_null(pkt, "packet"); zassert_not_null(pkt, "packet");
net_pkt_set_iface(pkt, iface1); net_pkt_set_iface(pkt, iface1);
@ -1465,7 +1465,7 @@ static void test_find_last_ipv6_fragment_hbho_frag_1(void)
u8_t last_hdr; u8_t last_hdr;
int ret; int ret;
pkt = net_pkt_get_reserve_tx(0, ALLOC_TIMEOUT); pkt = net_pkt_get_reserve_tx(ALLOC_TIMEOUT);
zassert_not_null(pkt, "packet"); zassert_not_null(pkt, "packet");
net_pkt_set_iface(pkt, iface1); net_pkt_set_iface(pkt, iface1);
@ -1512,7 +1512,7 @@ static void test_send_ipv6_fragment(void)
pkt_data_len = 0U; pkt_data_len = 0U;
pkt = net_pkt_get_reserve_tx(0, ALLOC_TIMEOUT); pkt = net_pkt_get_reserve_tx(ALLOC_TIMEOUT);
zassert_not_null(pkt, "packet"); zassert_not_null(pkt, "packet");
net_pkt_set_iface(pkt, iface1); net_pkt_set_iface(pkt, iface1);
@ -1574,7 +1574,7 @@ static void test_send_ipv6_fragment_large_hbho(void)
large_hbho = true; large_hbho = true;
pkt_data_len = 416U; pkt_data_len = 416U;
pkt = net_pkt_get_reserve_tx(0, ALLOC_TIMEOUT); pkt = net_pkt_get_reserve_tx(ALLOC_TIMEOUT);
zassert_not_null(pkt, "packet"); zassert_not_null(pkt, "packet");
net_pkt_set_iface(pkt, iface1); net_pkt_set_iface(pkt, iface1);

View file

@ -78,7 +78,7 @@ static int test_build_empty_pdu(void)
int result = TC_FAIL; int result = TC_FAIL;
int r; int r;
pkt = net_pkt_get_reserve(&coap_pkt_slab, 0, K_NO_WAIT); pkt = net_pkt_get_reserve(&coap_pkt_slab, K_NO_WAIT);
if (!pkt) { if (!pkt) {
TC_PRINT("Could not get packet from pool\n"); TC_PRINT("Could not get packet from pool\n");
goto done; goto done;
@ -132,7 +132,7 @@ static int test_build_simple_pdu(void)
int result = TC_FAIL; int result = TC_FAIL;
int r; int r;
pkt = net_pkt_get_reserve(&coap_pkt_slab, 0, K_NO_WAIT); pkt = net_pkt_get_reserve(&coap_pkt_slab, K_NO_WAIT);
if (!pkt) { if (!pkt) {
TC_PRINT("Could not get packet from pool\n"); TC_PRINT("Could not get packet from pool\n");
goto done; goto done;
@ -208,7 +208,7 @@ static int test_parse_empty_pdu(void)
int result = TC_FAIL; int result = TC_FAIL;
int r; int r;
pkt = net_pkt_get_reserve(&coap_pkt_slab, 0, K_NO_WAIT); pkt = net_pkt_get_reserve(&coap_pkt_slab, K_NO_WAIT);
if (!pkt) { if (!pkt) {
TC_PRINT("Could not get packet from pool\n"); TC_PRINT("Could not get packet from pool\n");
goto done; goto done;
@ -298,7 +298,7 @@ static int test_parse_empty_pdu_1(void)
int result = TC_FAIL; int result = TC_FAIL;
int r; int r;
pkt = net_pkt_get_reserve(&coap_pkt_slab, 0, K_NO_WAIT); pkt = net_pkt_get_reserve(&coap_pkt_slab, K_NO_WAIT);
if (!pkt) { if (!pkt) {
TC_PRINT("Could not get packet from pool\n"); TC_PRINT("Could not get packet from pool\n");
goto done; goto done;
@ -391,7 +391,7 @@ static int test_parse_simple_pdu(void)
int result = TC_FAIL; int result = TC_FAIL;
int r, count = ARRAY_SIZE(options) - 1; int r, count = ARRAY_SIZE(options) - 1;
pkt = net_pkt_get_reserve(&coap_pkt_slab, 0, K_NO_WAIT); pkt = net_pkt_get_reserve(&coap_pkt_slab, K_NO_WAIT);
if (!pkt) { if (!pkt) {
TC_PRINT("Could not get packet from pool\n"); TC_PRINT("Could not get packet from pool\n");
goto done; goto done;
@ -499,7 +499,7 @@ static int test_retransmit_second_round(void)
int r; int r;
u16_t id; u16_t id;
pkt = net_pkt_get_reserve(&coap_pkt_slab, 0, K_NO_WAIT); pkt = net_pkt_get_reserve(&coap_pkt_slab, K_NO_WAIT);
if (!pkt) { if (!pkt) {
TC_PRINT("Could not get packet from pool\n"); TC_PRINT("Could not get packet from pool\n");
goto done; goto done;
@ -545,7 +545,7 @@ static int test_retransmit_second_round(void)
goto done; goto done;
} }
resp_pkt = net_pkt_get_reserve(&coap_pkt_slab, 0, K_NO_WAIT); resp_pkt = net_pkt_get_reserve(&coap_pkt_slab, K_NO_WAIT);
if (!resp_pkt) { if (!resp_pkt) {
TC_PRINT("Could not get packet from pool\n"); TC_PRINT("Could not get packet from pool\n");
goto done; goto done;
@ -686,7 +686,7 @@ static int server_resource_1_get(struct coap_resource *resource,
coap_register_observer(resource, observer); coap_register_observer(resource, observer);
pkt = net_pkt_get_reserve(&coap_pkt_slab, 0, K_NO_WAIT); pkt = net_pkt_get_reserve(&coap_pkt_slab, K_NO_WAIT);
if (!pkt) { if (!pkt) {
TC_PRINT("Could not get packet from pool\n"); TC_PRINT("Could not get packet from pool\n");
return -ENOMEM; return -ENOMEM;
@ -780,7 +780,7 @@ static int test_observer_server(void)
int result = TC_FAIL; int result = TC_FAIL;
int r; int r;
pkt = net_pkt_get_reserve(&coap_pkt_slab, 0, K_NO_WAIT); pkt = net_pkt_get_reserve(&coap_pkt_slab, K_NO_WAIT);
if (!pkt) { if (!pkt) {
TC_PRINT("Could not get packet from pool\n"); TC_PRINT("Could not get packet from pool\n");
goto done; goto done;
@ -824,7 +824,7 @@ static int test_observer_server(void)
net_pkt_unref(pkt); net_pkt_unref(pkt);
pkt = net_pkt_get_reserve(&coap_pkt_slab, 0, K_NO_WAIT); pkt = net_pkt_get_reserve(&coap_pkt_slab, K_NO_WAIT);
if (!pkt) { if (!pkt) {
TC_PRINT("Could not get packet from pool\n"); TC_PRINT("Could not get packet from pool\n");
goto done; goto done;
@ -904,7 +904,7 @@ static int test_observer_client(void)
int result = TC_FAIL; int result = TC_FAIL;
int r; int r;
pkt = net_pkt_get_reserve(&coap_pkt_slab, 0, K_NO_WAIT); pkt = net_pkt_get_reserve(&coap_pkt_slab, K_NO_WAIT);
if (!pkt) { if (!pkt) {
TC_PRINT("Could not get packet from pool\n"); TC_PRINT("Could not get packet from pool\n");
goto done; goto done;
@ -1030,7 +1030,7 @@ static int test_block_size(void)
int result = TC_FAIL; int result = TC_FAIL;
int r; int r;
pkt = net_pkt_get_reserve(&coap_pkt_slab, 0, K_NO_WAIT); pkt = net_pkt_get_reserve(&coap_pkt_slab, K_NO_WAIT);
if (!pkt) { if (!pkt) {
TC_PRINT("Could not get packet from pool\n"); TC_PRINT("Could not get packet from pool\n");
goto done; goto done;
@ -1118,7 +1118,7 @@ static int test_block_size(void)
/* Suppose that pkt was sent */ /* Suppose that pkt was sent */
net_pkt_unref(pkt); net_pkt_unref(pkt);
pkt = net_pkt_get_reserve(&coap_pkt_slab, 0, K_NO_WAIT); pkt = net_pkt_get_reserve(&coap_pkt_slab, K_NO_WAIT);
if (!pkt) { if (!pkt) {
TC_PRINT("Could not get packet from pool\n"); TC_PRINT("Could not get packet from pool\n");
goto done; goto done;
@ -1211,7 +1211,7 @@ static int test_block_2_size(void)
int result = TC_FAIL; int result = TC_FAIL;
int r; int r;
pkt = net_pkt_get_reserve(&coap_pkt_slab, 0, K_NO_WAIT); pkt = net_pkt_get_reserve(&coap_pkt_slab, K_NO_WAIT);
if (!pkt) { if (!pkt) {
TC_PRINT("Could not get packet from pool\n"); TC_PRINT("Could not get packet from pool\n");
goto done; goto done;
@ -1299,7 +1299,7 @@ static int test_block_2_size(void)
/* Suppose that pkt was sent */ /* Suppose that pkt was sent */
net_pkt_unref(pkt); net_pkt_unref(pkt);
pkt = net_pkt_get_reserve(&coap_pkt_slab, 0, K_NO_WAIT); pkt = net_pkt_get_reserve(&coap_pkt_slab, K_NO_WAIT);
if (!pkt) { if (!pkt) {
TC_PRINT("Could not get packet from pool\n"); TC_PRINT("Could not get packet from pool\n");
goto done; goto done;
@ -1469,7 +1469,7 @@ static int test_parse_malformed_opt(void)
int result = TC_FAIL; int result = TC_FAIL;
int r; int r;
pkt = net_pkt_get_reserve(&coap_pkt_slab, 0, K_NO_WAIT); pkt = net_pkt_get_reserve(&coap_pkt_slab, K_NO_WAIT);
if (!pkt) { if (!pkt) {
TC_PRINT("Could not get packet from pool\n"); TC_PRINT("Could not get packet from pool\n");
goto done; goto done;
@ -1526,7 +1526,7 @@ static int test_parse_malformed_opt_len(void)
int result = TC_FAIL; int result = TC_FAIL;
int r; int r;
pkt = net_pkt_get_reserve(&coap_pkt_slab, 0, K_NO_WAIT); pkt = net_pkt_get_reserve(&coap_pkt_slab, K_NO_WAIT);
if (!pkt) { if (!pkt) {
TC_PRINT("Could not get packet from pool\n"); TC_PRINT("Could not get packet from pool\n");
goto done; goto done;
@ -1583,7 +1583,7 @@ static int test_parse_malformed_opt_ext(void)
int result = TC_FAIL; int result = TC_FAIL;
int r; int r;
pkt = net_pkt_get_reserve(&coap_pkt_slab, 0, K_NO_WAIT); pkt = net_pkt_get_reserve(&coap_pkt_slab, K_NO_WAIT);
if (!pkt) { if (!pkt) {
TC_PRINT("Could not get packet from pool\n"); TC_PRINT("Could not get packet from pool\n");
goto done; goto done;
@ -1640,7 +1640,7 @@ static int test_parse_malformed_opt_len_ext(void)
int result = TC_FAIL; int result = TC_FAIL;
int r; int r;
pkt = net_pkt_get_reserve(&coap_pkt_slab, 0, K_NO_WAIT); pkt = net_pkt_get_reserve(&coap_pkt_slab, K_NO_WAIT);
if (!pkt) { if (!pkt) {
TC_PRINT("Could not get packet from pool\n"); TC_PRINT("Could not get packet from pool\n");
goto done; goto done;
@ -1697,7 +1697,7 @@ static int test_parse_malformed_marker(void)
int result = TC_FAIL; int result = TC_FAIL;
int r; int r;
pkt = net_pkt_get_reserve(&coap_pkt_slab, 0, K_NO_WAIT); pkt = net_pkt_get_reserve(&coap_pkt_slab, K_NO_WAIT);
if (!pkt) { if (!pkt) {
TC_PRINT("Could not get packet from pool\n"); TC_PRINT("Could not get packet from pool\n");
goto done; goto done;

View file

@ -315,7 +315,7 @@ static void send_query(struct net_if *iface)
/* Sent to all MLDv2-capable routers */ /* Sent to all MLDv2-capable routers */
net_ipv6_addr_create(&dst, 0xff02, 0, 0, 0, 0, 0, 0, 0x0016); net_ipv6_addr_create(&dst, 0xff02, 0, 0, 0, 0, 0, 0, 0x0016);
pkt = net_pkt_get_reserve_tx(0, K_FOREVER); pkt = net_pkt_get_reserve_tx(K_FOREVER);
pkt = net_ipv6_create(pkt, pkt = net_ipv6_create(pkt,
&peer_addr, &peer_addr,

View file

@ -73,8 +73,8 @@ static void test_ipv6_multi_frags(void)
int bytes, remaining = strlen(example_data), pos = 0; int bytes, remaining = strlen(example_data), pos = 0;
/* Example of multi fragment scenario with IPv6 */ /* Example of multi fragment scenario with IPv6 */
pkt = net_pkt_get_reserve_rx(0, K_FOREVER); pkt = net_pkt_get_reserve_rx(K_FOREVER);
frag = net_pkt_get_reserve_rx_data(0, K_FOREVER); frag = net_pkt_get_reserve_rx_data(K_FOREVER);
/* Place the IP + UDP header in the first fragment */ /* Place the IP + UDP header in the first fragment */
if (!net_buf_tailroom(frag)) { if (!net_buf_tailroom(frag)) {
@ -102,7 +102,7 @@ static void test_ipv6_multi_frags(void)
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);
/* Put some data to rest of the fragments */ /* Put some data to rest of the fragments */
frag = net_pkt_get_reserve_rx_data(0, K_FOREVER); frag = net_pkt_get_reserve_rx_data(K_FOREVER);
if (net_buf_tailroom(frag) - if (net_buf_tailroom(frag) -
(CONFIG_NET_BUF_DATA_SIZE - 0)) { (CONFIG_NET_BUF_DATA_SIZE - 0)) {
printk("Invalid number of bytes available in the buf, " printk("Invalid number of bytes available in the buf, "
@ -140,8 +140,7 @@ static void test_ipv6_multi_frags(void)
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);
if (remaining > 0) { if (remaining > 0) {
frag = net_pkt_get_reserve_rx_data(0, frag = net_pkt_get_reserve_rx_data(K_FOREVER);
K_FOREVER);
} }
} }
@ -194,8 +193,8 @@ static void test_fragment_copy(void)
size_t orig_len, reserve; size_t orig_len, reserve;
int pos; int pos;
pkt = net_pkt_get_reserve_rx(0, K_FOREVER); pkt = net_pkt_get_reserve_rx(K_FOREVER);
frag = net_pkt_get_reserve_rx_data(0, K_FOREVER); frag = net_pkt_get_reserve_rx_data(K_FOREVER);
/* Place the IP + UDP header in the first fragment */ /* Place the IP + UDP header in the first fragment */
if (net_buf_tailroom(frag)) { if (net_buf_tailroom(frag)) {
@ -239,7 +238,7 @@ static void test_fragment_copy(void)
new_frag = net_pkt_copy_all(pkt, reserve, K_FOREVER); new_frag = net_pkt_copy_all(pkt, reserve, K_FOREVER);
zassert_not_null(new_frag, "Cannot copy fragment list"); zassert_not_null(new_frag, "Cannot copy fragment list");
new_pkt = net_pkt_get_reserve_tx(0, K_FOREVER); new_pkt = net_pkt_get_reserve_tx(K_FOREVER);
new_pkt->frags = net_buf_frag_add(new_pkt->frags, new_frag); new_pkt->frags = net_buf_frag_add(new_pkt->frags, new_frag);
DBG("Total new data len %zd\n", net_pkt_get_len(new_pkt)); DBG("Total new data len %zd\n", net_pkt_get_len(new_pkt));
@ -328,8 +327,8 @@ static void test_pkt_read_append(void)
u16_t fail_pos; u16_t fail_pos;
/* Example of multi fragment read, append and skip APS's */ /* Example of multi fragment read, append and skip APS's */
pkt = net_pkt_get_reserve_rx(0, K_FOREVER); pkt = net_pkt_get_reserve_rx(K_FOREVER);
frag = net_pkt_get_reserve_rx_data(0, K_FOREVER); frag = net_pkt_get_reserve_rx_data(K_FOREVER);
/* Place the IP + UDP header in the first fragment */ /* Place the IP + UDP header in the first fragment */
if (!net_buf_tailroom(frag)) { if (!net_buf_tailroom(frag)) {
@ -357,7 +356,7 @@ static void test_pkt_read_append(void)
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);
/* Put some data to rest of the fragments */ /* Put some data to rest of the fragments */
frag = net_pkt_get_reserve_rx_data(0, K_FOREVER); frag = net_pkt_get_reserve_rx_data(K_FOREVER);
if (net_buf_tailroom(frag) - if (net_buf_tailroom(frag) -
(CONFIG_NET_BUF_DATA_SIZE - 0)) { (CONFIG_NET_BUF_DATA_SIZE - 0)) {
printk("Invalid number of bytes available in the buf, " printk("Invalid number of bytes available in the buf, "
@ -395,8 +394,7 @@ static void test_pkt_read_append(void)
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);
if (remaining > 0) { if (remaining > 0) {
frag = net_pkt_get_reserve_rx_data(0, frag = net_pkt_get_reserve_rx_data(K_FOREVER);
K_FOREVER);
} }
} }
@ -536,9 +534,9 @@ static void test_pkt_read_write_insert(void)
u16_t pos; u16_t pos;
/* Example of multi fragment read, append and skip APS's */ /* Example of multi fragment read, append and skip APS's */
pkt = net_pkt_get_reserve_rx(0, K_FOREVER); pkt = net_pkt_get_reserve_rx(K_FOREVER);
frag = net_pkt_get_reserve_rx_data(0, K_FOREVER); frag = net_pkt_get_reserve_rx_data(K_FOREVER);
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);
/* 1) Offset is with in input fragment. /* 1) Offset is with in input fragment.
@ -576,7 +574,7 @@ static void test_pkt_read_write_insert(void)
net_pkt_unref(pkt); net_pkt_unref(pkt);
pkt = net_pkt_get_reserve_rx(0, K_FOREVER); pkt = net_pkt_get_reserve_rx(K_FOREVER);
/* 3) Offset is in next to next fragment. /* 3) Offset is in next to next fragment.
* Write app data after 2 fragments. (If the offset far away, api will * Write app data after 2 fragments. (If the offset far away, api will
@ -617,9 +615,9 @@ static void test_pkt_read_write_insert(void)
* API should overwrite on first 10 bytes and create extra 10 bytes * API should overwrite on first 10 bytes and create extra 10 bytes
* and write there. * and write there.
*/ */
pkt = net_pkt_get_reserve_rx(0, K_FOREVER); pkt = net_pkt_get_reserve_rx(K_FOREVER);
frag = net_pkt_get_reserve_rx_data(0, K_FOREVER); frag = net_pkt_get_reserve_rx_data(K_FOREVER);
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);
/* Create 10 bytes space. */ /* Create 10 bytes space. */
@ -646,17 +644,17 @@ static void test_pkt_read_write_insert(void)
* bytes and write data. Third fragment 5 bytes overwritten and space * bytes and write data. Third fragment 5 bytes overwritten and space
* for 5 bytes created. * for 5 bytes created.
*/ */
pkt = net_pkt_get_reserve_rx(0, K_FOREVER); pkt = net_pkt_get_reserve_rx(K_FOREVER);
/* First fragment make it fully occupied. */ /* First fragment make it fully occupied. */
frag = net_pkt_get_reserve_rx_data(0, K_FOREVER); frag = net_pkt_get_reserve_rx_data(K_FOREVER);
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);
len = net_buf_tailroom(frag); len = net_buf_tailroom(frag);
net_buf_add(frag, len); net_buf_add(frag, len);
/* 2nd fragment last 10 bytes tailroom, rest occupied */ /* 2nd fragment last 10 bytes tailroom, rest occupied */
frag = net_pkt_get_reserve_rx_data(0, K_FOREVER); frag = net_pkt_get_reserve_rx_data(K_FOREVER);
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);
len = net_buf_tailroom(frag); len = net_buf_tailroom(frag);
@ -666,7 +664,7 @@ static void test_pkt_read_write_insert(void)
read_pos = frag->len - 10; read_pos = frag->len - 10;
/* 3rd fragment, only 5 bytes occupied */ /* 3rd fragment, only 5 bytes occupied */
frag = net_pkt_get_reserve_rx_data(0, K_FOREVER); frag = net_pkt_get_reserve_rx_data(K_FOREVER);
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);
net_buf_add(frag, 5); net_buf_add(frag, 5);
@ -691,10 +689,10 @@ static void test_pkt_read_write_insert(void)
* before first set of app data. * before first set of app data.
*/ */
pkt = net_pkt_get_reserve_rx(0, K_FOREVER); pkt = net_pkt_get_reserve_rx(K_FOREVER);
/* First fragment make it fully occupied. */ /* First fragment make it fully occupied. */
frag = net_pkt_get_reserve_rx_data(0, K_FOREVER); frag = net_pkt_get_reserve_rx_data(K_FOREVER);
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);
frag = net_pkt_write(pkt, frag, NET_IPV6UDPH_LEN, &pos, 10, frag = net_pkt_write(pkt, frag, NET_IPV6UDPH_LEN, &pos, 10,
@ -735,10 +733,10 @@ static void test_pkt_read_write_insert(void)
* before first set of app data. Insertion data is long which will * before first set of app data. Insertion data is long which will
* take two fragments. * take two fragments.
*/ */
pkt = net_pkt_get_reserve_rx(0, K_FOREVER); pkt = net_pkt_get_reserve_rx(K_FOREVER);
/* First fragment make it fully occupied. */ /* First fragment make it fully occupied. */
frag = net_pkt_get_reserve_rx_data(0, K_FOREVER); frag = net_pkt_get_reserve_rx_data(K_FOREVER);
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);
frag = net_pkt_write(pkt, frag, NET_IPV6UDPH_LEN, &pos, 10, frag = net_pkt_write(pkt, frag, NET_IPV6UDPH_LEN, &pos, 10,
@ -824,11 +822,11 @@ static void test_fragment_compact(void)
struct net_buf *frags[FRAG_COUNT], *frag; struct net_buf *frags[FRAG_COUNT], *frag;
int i, bytes, total, count; int i, bytes, total, count;
pkt = net_pkt_get_reserve_rx(0, K_FOREVER); pkt = net_pkt_get_reserve_rx(K_FOREVER);
frag = NULL; frag = NULL;
for (i = 0, total = 0; i < FRAG_COUNT; i++) { for (i = 0, total = 0; i < FRAG_COUNT; i++) {
frags[i] = net_pkt_get_reserve_rx_data(0, K_FOREVER); frags[i] = net_pkt_get_reserve_rx_data(K_FOREVER);
if (frag) { if (frag) {
net_buf_frag_add(frag, frags[i]); net_buf_frag_add(frag, frags[i]);
@ -888,7 +886,7 @@ static void test_fragment_compact(void)
/* Add empty fragment at the end and compact, the last fragment /* Add empty fragment at the end and compact, the last fragment
* should be removed. * should be removed.
*/ */
frag = net_pkt_get_reserve_rx_data(0, K_FOREVER); frag = net_pkt_get_reserve_rx_data(K_FOREVER);
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);
@ -915,11 +913,11 @@ static void test_fragment_compact(void)
/* Add two empty fragments at the end and compact, the last two /* Add two empty fragments at the end and compact, the last two
* fragment should be removed. * fragment should be removed.
*/ */
frag = net_pkt_get_reserve_rx_data(0, K_FOREVER); frag = net_pkt_get_reserve_rx_data(K_FOREVER);
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);
frag = net_pkt_get_reserve_rx_data(0, K_FOREVER); frag = net_pkt_get_reserve_rx_data(K_FOREVER);
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);
@ -946,11 +944,11 @@ static void test_fragment_compact(void)
/* Add empty fragment at the beginning and at the end, and then /* Add empty fragment at the beginning and at the end, and then
* compact, the two fragment should be removed. * compact, the two fragment should be removed.
*/ */
frag = net_pkt_get_reserve_rx_data(0, K_FOREVER); frag = net_pkt_get_reserve_rx_data(K_FOREVER);
net_pkt_frag_insert(pkt, frag); net_pkt_frag_insert(pkt, frag);
frag = net_pkt_get_reserve_rx_data(0, K_FOREVER); frag = net_pkt_get_reserve_rx_data(K_FOREVER);
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);
@ -984,7 +982,7 @@ static void test_fragment_split(void)
struct net_buf *rest; struct net_buf *rest;
int ret; int ret;
pkt = net_pkt_get_reserve_rx(0, K_FOREVER); pkt = net_pkt_get_reserve_rx(K_FOREVER);
ret = net_pkt_append(pkt, 50, (u8_t *) frag_data, K_FOREVER); ret = net_pkt_append(pkt, 50, (u8_t *) frag_data, K_FOREVER);
@ -999,7 +997,7 @@ static void test_fragment_split(void)
net_pkt_unref(pkt); net_pkt_unref(pkt);
net_buf_unref(rest); net_buf_unref(rest);
pkt = net_pkt_get_reserve_rx(0, K_FOREVER); pkt = net_pkt_get_reserve_rx(K_FOREVER);
ret = net_pkt_append(pkt, 100, (u8_t *) frag_data, K_FOREVER); ret = net_pkt_append(pkt, 100, (u8_t *) frag_data, K_FOREVER);
@ -1014,7 +1012,7 @@ static void test_fragment_split(void)
net_pkt_unref(pkt); net_pkt_unref(pkt);
pkt = net_pkt_get_reserve_rx(0, K_FOREVER); pkt = net_pkt_get_reserve_rx(K_FOREVER);
ret = net_pkt_append(pkt, 100, (u8_t *) frag_data, K_FOREVER); ret = net_pkt_append(pkt, 100, (u8_t *) frag_data, K_FOREVER);
@ -1035,7 +1033,7 @@ static void test_fragment_split(void)
net_pkt_unref(pkt); net_pkt_unref(pkt);
net_buf_unref(rest); net_buf_unref(rest);
pkt = net_pkt_get_reserve_rx(0, K_FOREVER); pkt = net_pkt_get_reserve_rx(K_FOREVER);
ret = net_pkt_append(pkt, 350, (u8_t *) frag_data, K_FOREVER); ret = net_pkt_append(pkt, 350, (u8_t *) frag_data, K_FOREVER);
@ -1056,7 +1054,7 @@ static void test_fragment_split(void)
net_pkt_unref(pkt); net_pkt_unref(pkt);
net_buf_unref(rest); net_buf_unref(rest);
pkt = net_pkt_get_reserve_rx(0, K_FOREVER); pkt = net_pkt_get_reserve_rx(K_FOREVER);
ret = net_pkt_append(pkt, 512, (u8_t *) frag_data, K_FOREVER); ret = net_pkt_append(pkt, 512, (u8_t *) frag_data, K_FOREVER);
@ -1106,7 +1104,7 @@ static void test_pkt_pull(void)
u16_t ret; u16_t ret;
int res; int res;
pkt = net_pkt_get_reserve_rx(0, K_FOREVER); pkt = net_pkt_get_reserve_rx(K_FOREVER);
ret = net_pkt_append(pkt, sizeof(pull_test_data), (u8_t *) ret = net_pkt_append(pkt, sizeof(pull_test_data), (u8_t *)
pull_test_data, K_FOREVER); pull_test_data, K_FOREVER);
@ -1147,7 +1145,7 @@ static void test_net_pkt_append_memset(void)
int size = sizeof(read_data); int size = sizeof(read_data);
pkt = net_pkt_get_reserve_rx(0, K_FOREVER); pkt = net_pkt_get_reserve_rx(K_FOREVER);
ret = net_pkt_append_memset(pkt, 50, 0, K_FOREVER); ret = net_pkt_append_memset(pkt, 50, 0, K_FOREVER);
zassert_true(ret == 50, "Failed to append data"); zassert_true(ret == 50, "Failed to append data");

View file

@ -345,7 +345,7 @@ static void _recv_data(struct net_if *iface, struct net_pkt **pkt)
static u8_t data[] = { 't', 'e', 's', 't', '\0' }; static u8_t data[] = { 't', 'e', 's', 't', '\0' };
int ret; int ret;
*pkt = net_pkt_get_reserve_tx(0, K_FOREVER); *pkt = net_pkt_get_reserve_tx(K_FOREVER);
net_pkt_set_iface(*pkt, iface); net_pkt_set_iface(*pkt, iface);
net_pkt_append_all(*pkt, sizeof(data), data, K_FOREVER); net_pkt_append_all(*pkt, sizeof(data), data, K_FOREVER);

View file

@ -432,7 +432,7 @@ static bool send_ipv6_tcp_msg(struct net_if *iface,
struct net_buf *frag; struct net_buf *frag;
int ret; int ret;
pkt = net_pkt_get_reserve_tx(0, K_FOREVER); pkt = net_pkt_get_reserve_tx(K_FOREVER);
frag = net_pkt_get_frag(pkt, K_FOREVER); frag = net_pkt_get_frag(pkt, K_FOREVER);
@ -481,7 +481,7 @@ static bool send_ipv4_tcp_msg(struct net_if *iface,
struct net_buf *frag; struct net_buf *frag;
int ret; int ret;
pkt = net_pkt_get_reserve_tx(0, K_FOREVER); pkt = net_pkt_get_reserve_tx(K_FOREVER);
frag = net_pkt_get_frag(pkt, K_FOREVER); frag = net_pkt_get_frag(pkt, K_FOREVER);
@ -530,7 +530,7 @@ static bool send_ipv6_tcp_long_msg(struct net_if *iface,
struct net_buf *frag; struct net_buf *frag;
int ret; int ret;
pkt = net_pkt_get_reserve_tx(0, K_FOREVER); pkt = net_pkt_get_reserve_tx(K_FOREVER);
frag = net_pkt_get_frag(pkt, K_FOREVER); frag = net_pkt_get_frag(pkt, K_FOREVER);

View file

@ -192,7 +192,7 @@ static void timestamp_setup(void)
timestamp_cb_called = false; timestamp_cb_called = false;
do_timestamp = false; do_timestamp = false;
pkt = net_pkt_get_reserve_tx(0, K_FOREVER); pkt = net_pkt_get_reserve_tx(K_FOREVER);
net_pkt_set_iface(pkt, iface); net_pkt_set_iface(pkt, iface);
/* Make sure that the callback function is called */ /* Make sure that the callback function is called */
@ -239,7 +239,7 @@ static void timestamp_setup_2nd_iface(void)
timestamp_cb_called = false; timestamp_cb_called = false;
do_timestamp = false; do_timestamp = false;
pkt = net_pkt_get_reserve_tx(0, K_FOREVER); pkt = net_pkt_get_reserve_tx(K_FOREVER);
net_pkt_set_iface(pkt, iface); net_pkt_set_iface(pkt, iface);
/* Make sure that the callback function is called */ /* Make sure that the callback function is called */
@ -259,7 +259,7 @@ static void timestamp_setup_all(void)
timestamp_cb_called = false; timestamp_cb_called = false;
do_timestamp = false; do_timestamp = false;
pkt = net_pkt_get_reserve_tx(0, K_FOREVER); pkt = net_pkt_get_reserve_tx(K_FOREVER);
net_pkt_set_iface(pkt, eth_interfaces[0]); net_pkt_set_iface(pkt, eth_interfaces[0]);
/* The callback is called twice because we have two matching callbacks /* The callback is called twice because we have two matching callbacks
@ -289,7 +289,7 @@ static void timestamp_cleanup(void)
timestamp_cb_called = false; timestamp_cb_called = false;
do_timestamp = false; do_timestamp = false;
pkt = net_pkt_get_reserve_tx(0, K_FOREVER); pkt = net_pkt_get_reserve_tx(K_FOREVER);
net_pkt_set_iface(pkt, iface); net_pkt_set_iface(pkt, iface);
/* Make sure that the callback function is not called after unregister /* Make sure that the callback function is not called after unregister

View file

@ -358,7 +358,7 @@ static bool send_ipv6_udp_msg(struct net_if *iface,
struct net_buf *frag; struct net_buf *frag;
int ret; int ret;
pkt = net_pkt_get_reserve_tx(0, K_SECONDS(1)); pkt = net_pkt_get_reserve_tx(K_SECONDS(1));
zassert_not_null(pkt, "Out of mem"); zassert_not_null(pkt, "Out of mem");
frag = net_pkt_get_frag(pkt, K_SECONDS(1)); frag = net_pkt_get_frag(pkt, K_SECONDS(1));
@ -407,7 +407,7 @@ static bool send_ipv6_udp_long_msg(struct net_if *iface,
struct net_buf *frag; struct net_buf *frag;
int ret; int ret;
pkt = net_pkt_get_reserve_tx(0, K_SECONDS(1)); pkt = net_pkt_get_reserve_tx(K_SECONDS(1));
zassert_not_null(pkt, "Out of mem"); zassert_not_null(pkt, "Out of mem");
frag = net_pkt_get_frag(pkt, K_SECONDS(1)); frag = net_pkt_get_frag(pkt, K_SECONDS(1));
@ -456,7 +456,7 @@ static bool send_ipv4_udp_msg(struct net_if *iface,
struct net_buf *frag; struct net_buf *frag;
int ret; int ret;
pkt = net_pkt_get_reserve_tx(0, K_SECONDS(1)); pkt = net_pkt_get_reserve_tx(K_SECONDS(1));
zassert_not_null(pkt, "Out of mem"); zassert_not_null(pkt, "Out of mem");
frag = net_pkt_get_frag(pkt, K_SECONDS(1)); frag = net_pkt_get_frag(pkt, K_SECONDS(1));

View file

@ -275,10 +275,10 @@ void test_utils(void)
int i, chunk, datalen, total = 0; int i, chunk, datalen, total = 0;
/* Packet fits to one fragment */ /* Packet fits to one fragment */
pkt = net_pkt_get_reserve_rx(0, K_SECONDS(1)); pkt = net_pkt_get_reserve_rx(K_SECONDS(1));
zassert_not_null(pkt, "Out of mem"); zassert_not_null(pkt, "Out of mem");
frag = net_pkt_get_reserve_rx_data(0, K_SECONDS(1)); frag = net_pkt_get_reserve_rx_data(K_SECONDS(1));
zassert_not_null(frag, "Out of mem"); zassert_not_null(frag, "Out of mem");
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);
@ -309,10 +309,10 @@ void test_utils(void)
net_pkt_unref(pkt); net_pkt_unref(pkt);
/* Then a case where there will be two fragments */ /* Then a case where there will be two fragments */
pkt = net_pkt_get_reserve_rx(0, K_SECONDS(1)); pkt = net_pkt_get_reserve_rx(K_SECONDS(1));
zassert_not_null(pkt, "Out of mem"); zassert_not_null(pkt, "Out of mem");
frag = net_pkt_get_reserve_rx_data(0, K_SECONDS(1)); frag = net_pkt_get_reserve_rx_data(K_SECONDS(1));
zassert_not_null(frag, "Out of mem"); zassert_not_null(frag, "Out of mem");
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);
@ -327,7 +327,7 @@ void test_utils(void)
frag->data[hdr_len + 2] = 0; frag->data[hdr_len + 2] = 0;
frag->data[hdr_len + 3] = 0; frag->data[hdr_len + 3] = 0;
frag = net_pkt_get_reserve_rx_data(0, K_SECONDS(1)); frag = net_pkt_get_reserve_rx_data(K_SECONDS(1));
zassert_not_null(frag, "Out of mem"); zassert_not_null(frag, "Out of mem");
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);
@ -343,10 +343,10 @@ void test_utils(void)
net_pkt_unref(pkt); net_pkt_unref(pkt);
/* Then a case where there will be two fragments but odd data size */ /* Then a case where there will be two fragments but odd data size */
pkt = net_pkt_get_reserve_rx(0, K_SECONDS(1)); pkt = net_pkt_get_reserve_rx(K_SECONDS(1));
zassert_not_null(pkt, "Out of mem"); zassert_not_null(pkt, "Out of mem");
frag = net_pkt_get_reserve_rx_data(0, K_SECONDS(1)); frag = net_pkt_get_reserve_rx_data(K_SECONDS(1));
zassert_not_null(frag, "Out of mem"); zassert_not_null(frag, "Out of mem");
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);
@ -362,7 +362,7 @@ void test_utils(void)
frag->data[hdr_len + 2] = 0; frag->data[hdr_len + 2] = 0;
frag->data[hdr_len + 3] = 0; frag->data[hdr_len + 3] = 0;
frag = net_pkt_get_reserve_rx_data(0, K_SECONDS(1)); frag = net_pkt_get_reserve_rx_data(K_SECONDS(1));
zassert_not_null(frag, "Out of mem"); zassert_not_null(frag, "Out of mem");
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);
@ -380,10 +380,10 @@ void test_utils(void)
net_pkt_unref(pkt); net_pkt_unref(pkt);
/* Then a case where there will be several fragments */ /* Then a case where there will be several fragments */
pkt = net_pkt_get_reserve_rx(0, K_SECONDS(1)); pkt = net_pkt_get_reserve_rx(K_SECONDS(1));
zassert_not_null(frag, "Out of mem"); zassert_not_null(frag, "Out of mem");
frag = net_pkt_get_reserve_rx_data(0, K_SECONDS(1)); frag = net_pkt_get_reserve_rx_data(K_SECONDS(1));
zassert_not_null(frag, "Out of mem"); zassert_not_null(frag, "Out of mem");
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);
@ -400,7 +400,7 @@ void test_utils(void)
for (i = 0; i < datalen/chunk; i++) { for (i = 0; i < datalen/chunk; i++) {
/* Next fragments will contain the data in odd sizes */ /* Next fragments will contain the data in odd sizes */
frag = net_pkt_get_reserve_rx_data(0, K_SECONDS(1)); frag = net_pkt_get_reserve_rx_data(K_SECONDS(1));
zassert_not_null(frag, "Out of mem"); zassert_not_null(frag, "Out of mem");
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);
@ -421,7 +421,7 @@ void test_utils(void)
} }
} }
if ((datalen - total) > 0) { if ((datalen - total) > 0) {
frag = net_pkt_get_reserve_rx_data(0, K_SECONDS(1)); frag = net_pkt_get_reserve_rx_data(K_SECONDS(1));
zassert_not_null(frag, "Out of mem"); zassert_not_null(frag, "Out of mem");
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);
@ -455,10 +455,10 @@ void test_utils(void)
/* Another packet that fits to one fragment. /* Another packet that fits to one fragment.
*/ */
#if defined(CONFIG_NET_IPV4) #if defined(CONFIG_NET_IPV4)
pkt = net_pkt_get_reserve_rx(0, K_SECONDS(1)); pkt = net_pkt_get_reserve_rx(K_SECONDS(1));
zassert_not_null(pkt, "Out of mem"); zassert_not_null(pkt, "Out of mem");
frag = net_pkt_get_reserve_rx_data(0, K_SECONDS(1)); frag = net_pkt_get_reserve_rx_data(K_SECONDS(1));
zassert_not_null(frag, "Out of mem"); zassert_not_null(frag, "Out of mem");
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);
@ -486,10 +486,10 @@ void test_utils(void)
/* Another packet that fits to one fragment and which has correct /* Another packet that fits to one fragment and which has correct
* checksum. * checksum.
*/ */
pkt = net_pkt_get_reserve_rx(0, K_SECONDS(1)); pkt = net_pkt_get_reserve_rx(K_SECONDS(1));
zassert_not_null(pkt, "Out of mem"); zassert_not_null(pkt, "Out of mem");
frag = net_pkt_get_reserve_rx_data(0, K_SECONDS(1)); frag = net_pkt_get_reserve_rx_data(K_SECONDS(1));
zassert_not_null(frag, "Out of mem"); zassert_not_null(frag, "Out of mem");
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);
@ -1469,10 +1469,10 @@ void test_net_pkt_addr_parse(void)
struct sockaddr_in6 addr; struct sockaddr_in6 addr;
struct ipv6_test_data *data = &ipv6_test_data_set[i]; struct ipv6_test_data *data = &ipv6_test_data_set[i];
pkt = net_pkt_get_reserve_rx(0, K_SECONDS(1)); pkt = net_pkt_get_reserve_rx(K_SECONDS(1));
zassert_not_null(pkt, "Out of mem"); zassert_not_null(pkt, "Out of mem");
frag = net_pkt_get_reserve_rx_data(0, K_SECONDS(1)); frag = net_pkt_get_reserve_rx_data(K_SECONDS(1));
zassert_not_null(frag, "Out of mem"); zassert_not_null(frag, "Out of mem");
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);
@ -1518,10 +1518,10 @@ void test_net_pkt_addr_parse(void)
struct sockaddr_in addr; struct sockaddr_in addr;
struct ipv4_test_data *data = &ipv4_test_data_set[i]; struct ipv4_test_data *data = &ipv4_test_data_set[i];
pkt = net_pkt_get_reserve_rx(0, K_SECONDS(1)); pkt = net_pkt_get_reserve_rx(K_SECONDS(1));
zassert_not_null(pkt, "Out of mem"); zassert_not_null(pkt, "Out of mem");
frag = net_pkt_get_reserve_rx_data(0, K_SECONDS(1)); frag = net_pkt_get_reserve_rx_data(K_SECONDS(1));
zassert_not_null(frag, "Out of mem"); zassert_not_null(frag, "Out of mem");
net_pkt_frag_add(pkt, frag); net_pkt_frag_add(pkt, frag);

View file

@ -421,7 +421,7 @@ static void test_vlan_tci(void)
u8_t priority; u8_t priority;
bool dei; bool dei;
pkt = net_pkt_get_reserve_tx(0, K_FOREVER); pkt = net_pkt_get_reserve_tx(K_FOREVER);
tag = NET_VLAN_TAG_UNSPEC; tag = NET_VLAN_TAG_UNSPEC;
net_pkt_set_vlan_tag(pkt, tag); net_pkt_set_vlan_tag(pkt, tag);