[v2,1/4] net/axgbe: fix scattered Rx

Message ID 20220901124948.97063-1-bhagyada.modali@amd.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series [v2,1/4] net/axgbe: fix scattered Rx |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Bhagyada Modali Sept. 1, 2022, 12:49 p.m. UTC
  Error check needs to be done only for last segment of Jumbo packet.
Freed first_seg and reset eop to 0 in error case

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

Signed-off-by: Bhagyada Modali <bhagyada.modali@amd.com>
---
v2:
* removed the extra paranthesis
* initialised the variables
* updated the commit logs
---
 drivers/net/axgbe/axgbe_rxtx.c | 35 +++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 15 deletions(-)
  

Comments

Ferruh Yigit Sept. 1, 2022, 3:03 p.m. UTC | #1
On 9/1/2022 1:49 PM, Bhagyada Modali wrote:
> Error check needs to be done only for last segment of Jumbo packet.
> Freed first_seg and reset eop to 0 in error case
> 
> Fixes: 965b3127d425 ("net/axgbe: support scattered Rx")
> 
> Signed-off-by: Bhagyada Modali <bhagyada.modali@amd.com>
> ---
> v2:
> * removed the extra paranthesis
> * initialised the variables
> * updated the commit logs

Patchset looks good to me, only stable tag (Cc: stable@dpdk.org) is 
missing which can be added while merging.

Will wait maintainer ack to proceed.
  

Patch

diff --git a/drivers/net/axgbe/axgbe_rxtx.c b/drivers/net/axgbe/axgbe_rxtx.c
index f38bb64fab..89ed6fd74a 100644
--- a/drivers/net/axgbe/axgbe_rxtx.c
+++ b/drivers/net/axgbe/axgbe_rxtx.c
@@ -343,8 +343,8 @@  uint16_t eth_axgbe_recv_scattered_pkts(void *rx_queue,
 	uint64_t old_dirty = rxq->dirty;
 	struct rte_mbuf *first_seg = NULL;
 	struct rte_mbuf *mbuf, *tmbuf;
-	unsigned int err, etlt;
-	uint32_t error_status;
+	unsigned int err = 0, etlt;
+	uint32_t error_status = 0;
 	uint16_t idx, pidx, data_len = 0, pkt_len = 0;
 	uint64_t offloads;
 
@@ -381,19 +381,6 @@  uint16_t eth_axgbe_recv_scattered_pkts(void *rx_queue,
 		}
 
 		mbuf = rxq->sw_ring[idx];
-		/* Check for any errors and free mbuf*/
-		err = AXGMAC_GET_BITS_LE(desc->write.desc3,
-					 RX_NORMAL_DESC3, ES);
-		error_status = 0;
-		if (unlikely(err)) {
-			error_status = desc->write.desc3 & AXGBE_ERR_STATUS;
-			if ((error_status != AXGBE_L3_CSUM_ERR)
-					&& (error_status != AXGBE_L4_CSUM_ERR)) {
-				rxq->errors++;
-				rte_pktmbuf_free(mbuf);
-				goto err_set;
-			}
-		}
 		rte_prefetch1(rte_pktmbuf_mtod(mbuf, void *));
 
 		if (!AXGMAC_GET_BITS_LE(desc->write.desc3,
@@ -406,6 +393,24 @@  uint16_t eth_axgbe_recv_scattered_pkts(void *rx_queue,
 			pkt_len = AXGMAC_GET_BITS_LE(desc->write.desc3,
 					RX_NORMAL_DESC3, PL);
 			data_len = pkt_len - rxq->crc_len;
+			/* Check for any errors and free mbuf*/
+			err = AXGMAC_GET_BITS_LE(desc->write.desc3,
+					RX_NORMAL_DESC3, ES);
+			error_status = 0;
+			if (unlikely(err)) {
+				error_status = desc->write.desc3 &
+					AXGBE_ERR_STATUS;
+				if (error_status != AXGBE_L3_CSUM_ERR &&
+						error_status != AXGBE_L4_CSUM_ERR) {
+					rxq->errors++;
+					rte_pktmbuf_free(mbuf);
+					rte_pktmbuf_free(first_seg);
+					first_seg = NULL;
+					eop = 0;
+					goto err_set;
+				}
+			}
+
 		}
 
 		if (first_seg != NULL) {