Skip to content

Commit

Permalink
net/axgbe: save segment data in scattered Rx
Browse files Browse the repository at this point in the history
[ upstream commit 91907ec ]

Saving the current segments of the packet, when the next segment data is
not ready.

Fixes: 965b312 ("net/axgbe: support scattered Rx")

Signed-off-by: Bhagyada Modali <bhagyada.modali@amd.com>
Acked-by: Chandubabu Namburu <chandu@amd.com>
  • Loading branch information
BhagyadaM authored and kevintraynor committed Oct 11, 2022
1 parent 9683271 commit fb442d0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/net/axgbe/axgbe_rxtx.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,11 +417,17 @@ uint16_t eth_axgbe_recv_scattered_pkts(void *rx_queue,
mbuf->data_len = data_len;
mbuf->pkt_len = data_len;

if (rxq->saved_mbuf) {
first_seg = rxq->saved_mbuf;
rxq->saved_mbuf = NULL;
}

if (first_seg != NULL) {
if (rte_pktmbuf_chain(first_seg, mbuf) != 0) {
rte_pktmbuf_free(first_seg);
first_seg = NULL;
rte_pktmbuf_free(mbuf);
rxq->saved_mbuf = NULL;
rxq->errors++;
eop = 0;
break;
Expand Down Expand Up @@ -500,6 +506,10 @@ uint16_t eth_axgbe_recv_scattered_pkts(void *rx_queue,
first_seg = NULL;
}

/* Check if we need to save state before leaving */
if (first_seg != NULL && eop == 0)
rxq->saved_mbuf = first_seg;

/* Save receive context.*/
rxq->pkts += nb_rx;

Expand Down
6 changes: 6 additions & 0 deletions drivers/net/axgbe/axgbe_rxtx.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ struct axgbe_rx_queue {
uint16_t crc_len;
/* address of s/w rx buffers */
struct rte_mbuf **sw_ring;

/* For segemented packets - save the current state
* of packet, if next descriptor is not ready yet
*/
struct rte_mbuf *saved_mbuf;

/* Port private data */
struct axgbe_port *pdata;
/* Number of Rx descriptors in queue */
Expand Down

0 comments on commit fb442d0

Please sign in to comment.