Skip to content

Commit

Permalink
net/nfp: fix Rx descriptor DMA address
Browse files Browse the repository at this point in the history
[ upstream commit 0c48f5a ]

When receiving a packet that is larger than the mbuf size, the Rx
function will break the receive loop and sent a free list descriptor
with random DMA address.

Fix this by moving the increment of the free list descriptor counter
to after the packet size have been checked and acted on.

Fixes: bb340f5 ("net/nfp: fix memory leak in Rx")

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
  • Loading branch information
hechaoyong authored and kevintraynor committed Nov 23, 2022
1 parent 24d7600 commit 631e68c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/net/nfp/nfp_rxtx.c
Expand Up @@ -345,8 +345,6 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
break;
}

nb_hold++;

/*
* Grab the mbuf and refill the descriptor with the
* previously allocated mbuf
Expand Down Expand Up @@ -417,6 +415,7 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
rxds->fld.dd = 0;
rxds->fld.dma_addr_hi = (dma_addr >> 32) & 0xff;
rxds->fld.dma_addr_lo = dma_addr & 0xffffffff;
nb_hold++;

rxq->rd_p++;
if (unlikely(rxq->rd_p == rxq->rx_count)) /* wrapping?*/
Expand Down

0 comments on commit 631e68c

Please sign in to comment.