net: Switch usage of net_pkt_get_reserve to net_pkt_alloc

Some places were still using the old allocator. Using the new one does
not change any behavior. This will help to remove the useless data_len
attribute in net_pkt which legacy allocator was still setting.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2019-03-14 09:02:26 +01:00 committed by Kumar Gala
commit cf322c44db
6 changed files with 10 additions and 12 deletions

View file

@ -1120,7 +1120,7 @@ static struct net_pkt *frame_get(struct gmac_queue *queue)
return NULL;
}
rx_frame = net_pkt_get_reserve_rx(K_NO_WAIT);
rx_frame = net_pkt_rx_alloc(K_NO_WAIT);
/* Process a frame */
tail = rx_desc_list->tail;

View file

@ -127,7 +127,7 @@ static u8_t *upipe_rx(u8_t *buf, size_t *off)
if (upipe->rx_len == upipe->rx_off) {
struct net_buf *frag;
pkt = net_pkt_get_reserve_rx(K_NO_WAIT);
pkt = net_pkt_rx_alloc(K_NO_WAIT);
if (!pkt) {
LOG_DBG("No pkt available");
goto flush;

View file

@ -52,13 +52,13 @@ static u16_t channel;
static void dataInit(void)
{
tx_pkt = net_pkt_get_reserve_tx(K_NO_WAIT);
tx_pkt = net_pkt_alloc(K_NO_WAIT);
__ASSERT_NO_MSG(tx_pkt != NULL);
tx_payload = net_pkt_get_reserve_tx_data(K_NO_WAIT);
__ASSERT_NO_MSG(tx_payload != NULL);
net_pkt_frag_insert(tx_pkt, tx_payload);
net_pkt_append_buffer(tx_pkt, tx_payload);
sTransmitFrame.mPsdu = tx_payload->data;
}

View file

@ -308,12 +308,11 @@ static struct net_pkt *create_pkt(struct net_6lo_data *data)
u16_t len;
int remaining;
pkt = net_pkt_get_reserve_tx(K_FOREVER);
pkt = net_pkt_alloc_on_iface(net_if_get_default(), K_FOREVER);
if (!pkt) {
return NULL;
}
net_pkt_set_iface(pkt, net_if_get_default());
net_pkt_set_ip_hdr_len(pkt, NET_IPV6H_LEN);
net_pkt_lladdr_src(pkt)->addr = src_mac;

View file

@ -236,12 +236,11 @@ static struct net_pkt *create_pkt(struct net_fragment_data *data)
u16_t len;
int remaining;
pkt = net_pkt_get_reserve_tx(K_FOREVER);
pkt = net_pkt_alloc_on_iface(net_if_get_default(), K_FOREVER);
if (!pkt) {
return NULL;
}
net_pkt_set_iface(pkt, net_if_get_default());
net_pkt_set_ip_hdr_len(pkt, NET_IPV6H_LEN);
buf = net_pkt_get_frag(pkt, K_FOREVER);
@ -470,7 +469,7 @@ static bool test_fragment(struct net_fragment_data *data)
goto reassemble;
}
f_pkt = net_pkt_get_reserve_tx(K_FOREVER);
f_pkt = net_pkt_alloc(K_FOREVER);
if (!f_pkt) {
goto end;
}
@ -509,7 +508,7 @@ reassemble:
buf = f_pkt->buffer;
while (buf) {
rxpkt = net_pkt_get_reserve_rx(K_FOREVER);
rxpkt = net_pkt_rx_alloc(K_FOREVER);
if (!rxpkt) {
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");
pkt = net_pkt_get_reserve_rx(K_FOREVER);
pkt = net_pkt_rx_alloc(K_FOREVER);
frag = net_pkt_get_frag(pkt, K_FOREVER);
memcpy(frag->data, data_pkt, sizeof(data_pkt));
@ -267,7 +267,7 @@ static bool initialize_test_environment(void)
k_sem_reset(&driver_lock);
current_pkt = net_pkt_get_reserve_rx(K_FOREVER);
current_pkt = net_pkt_rx_alloc(K_FOREVER);
if (!current_pkt) {
NET_ERR("*** No buffer to allocate\n");
return false;