[v4,1/2] net/ice: fix scalar Rx path segment

Message ID 20221111161241.861732-1-mingjinx.ye@intel.com (mailing list archive)
State Not Applicable, archived
Delegated to: Qi Zhang
Headers
Series [v4,1/2] net/ice: fix scalar Rx path segment |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Mingjin Ye Nov. 11, 2022, 4:12 p.m. UTC
  CRC is stripped by the hardware in the scattered Rx path. The last buffer
is invalid if it's packet length is zero.

This patch adds a judgment for the last buffer length to fix this issue,
it would free the mbuf associated to the last one if the last buffer is
empty.

Fixes: 6eac0b7fde95 ("net/ice: support advance Rx/Tx")
Cc: stable@dpdk.org

Signed-off-by: Mingjin Ye <mingjinx.ye@intel.com>
---
 drivers/net/ice/ice_rxtx.c | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Qi Zhang Nov. 11, 2022, 9:03 a.m. UTC | #1
> -----Original Message-----
> From: Ye, MingjinX <mingjinx.ye@intel.com>
> Sent: Saturday, November 12, 2022 12:13 AM
> To: dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; stable@dpdk.org; Zhou, YidingX
> <yidingx.zhou@intel.com>; Ye, MingjinX <mingjinx.ye@intel.com>; Zhang, Qi
> Z <qi.z.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Ferruh Yigit
> <ferruh.yigit@intel.com>; Lu, Wenzhuo <wenzhuo.lu@intel.com>; Li,
> Xiaoyun <xiaoyun.li@intel.com>
> Subject: [PATCH v4 1/2] net/ice: fix scalar Rx path segment
> 
> CRC is stripped by the hardware in the scattered Rx path. The last buffer is
> invalid if it's packet length is zero.
> 
> This patch adds a judgment for the last buffer length to fix this issue, it would
> free the mbuf associated to the last one if the last buffer is empty.
> 
> Fixes: 6eac0b7fde95 ("net/ice: support advance Rx/Tx")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Mingjin Ye <mingjinx.ye@intel.com>

v3 already be applied, no new change on v4, will ignore this patch.
  
Ke Xu Nov. 11, 2022, 9:13 a.m. UTC | #2
> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Friday, November 11, 2022 5:03 PM
> To: Ye, MingjinX <mingjinx.ye@intel.com>; dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; stable@dpdk.org; Zhou, YidingX
> <yidingx.zhou@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Ferruh
> Yigit <ferruh.yigit@intel.com>; Lu, Wenzhuo <wenzhuo.lu@intel.com>; Li,
> Xiaoyun <xiaoyun.li@intel.com>
> Subject: RE: [PATCH v4 1/2] net/ice: fix scalar Rx path segment
> 
> 
> 
> > -----Original Message-----
> > From: Ye, MingjinX <mingjinx.ye@intel.com>
> > Sent: Saturday, November 12, 2022 12:13 AM
> > To: dev@dpdk.org
> > Cc: Yang, Qiming <qiming.yang@intel.com>; stable@dpdk.org; Zhou,
> > YidingX <yidingx.zhou@intel.com>; Ye, MingjinX
> > <mingjinx.ye@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Wu,
> > Jingjing <jingjing.wu@intel.com>; Ferruh Yigit
> > <ferruh.yigit@intel.com>; Lu, Wenzhuo <wenzhuo.lu@intel.com>; Li,
> > Xiaoyun <xiaoyun.li@intel.com>
> > Subject: [PATCH v4 1/2] net/ice: fix scalar Rx path segment
> >
> > CRC is stripped by the hardware in the scattered Rx path. The last
> > buffer is invalid if it's packet length is zero.
> >
> > This patch adds a judgment for the last buffer length to fix this
> > issue, it would free the mbuf associated to the last one if the last buffer is
> empty.
> >
> > Fixes: 6eac0b7fde95 ("net/ice: support advance Rx/Tx")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Mingjin Ye <mingjinx.ye@intel.com>
> 
> v3 already be applied, no new change on v4, will ignore this patch.

Tested with v4 patch, passed.

Tested-by: Ke Xu <ke1.xu@intel.com>
  

Patch

diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index 0a2b0376ac..e6ddd2513d 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -2111,6 +2111,10 @@  ice_recv_scattered_pkts(void *rx_queue,
 			} else
 				rxm->data_len = (uint16_t)(rx_packet_len -
 							   RTE_ETHER_CRC_LEN);
+		} else if (rx_packet_len == 0) {
+			rte_pktmbuf_free_seg(rxm);
+			first_seg->nb_segs--;
+			last_seg->next = NULL;
 		}
 
 		first_seg->port = rxq->port_id;