diff mbox

[dpdk-dev] net/i40e: fix setting RSS in i40e_recv_scattered_pkts

Message ID 1469529969-31925-1-git-send-email-dumitru.ceara@gmail.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

dumitru.ceara@gmail.com July 26, 2016, 10:46 a.m. UTC
From: Dumitru Ceara <dumitru.ceara@gmail.com>

The driver is incorrectly setting the RSS field in the last mbuf in
the packet chain instead of the first. Moreover, the last mbuf might
have already been freed if it only contained the Ethernet CRC.

Also, fix the call to i40e_rxd_build_fdir to store the fdir flags in
the first mbuf of the chain instead of the last.

Signed-off-by: Dumitru Ceara <dumitru.ceara@gmail.com>
---
 drivers/net/i40e/i40e_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ananyev, Konstantin July 26, 2016, 12:11 p.m. UTC | #1
> -----Original Message-----
> From: dumitru.ceara@gmail.com [mailto:dumitru.ceara@gmail.com]
> Sent: Tuesday, July 26, 2016 11:46 AM
> To: dev@dpdk.org
> Cc: Xing, Beilei <beilei.xing@intel.com>; Zhang, Helin <helin.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; Dumitru Ceara <dumitru.ceara@gmail.com>
> Subject: [PATCH] net/i40e: fix setting RSS in i40e_recv_scattered_pkts
> 
> From: Dumitru Ceara <dumitru.ceara@gmail.com>
> 
> The driver is incorrectly setting the RSS field in the last mbuf in the packet chain instead of the first. Moreover, the last mbuf might have
> already been freed if it only contained the Ethernet CRC.
> 
> Also, fix the call to i40e_rxd_build_fdir to store the fdir flags in the first mbuf of the chain instead of the last.
> 
> Signed-off-by: Dumitru Ceara <dumitru.ceara@gmail.com>
> ---
>  drivers/net/i40e/i40e_rxtx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index d3cfb98..554d167 100644
> --- a/drivers/net/i40e/i40e_rxtx.c
> +++ b/drivers/net/i40e/i40e_rxtx.c
> @@ -1436,10 +1436,10 @@ i40e_recv_scattered_pkts(void *rx_queue,
>  			i40e_rxd_pkt_type_mapping((uint8_t)((qword1 &
>  			I40E_RXD_QW1_PTYPE_MASK) >> I40E_RXD_QW1_PTYPE_SHIFT));
>  		if (pkt_flags & PKT_RX_RSS_HASH)
> -			rxm->hash.rss =
> +			first_seg->hash.rss =
>  				rte_le_to_cpu_32(rxd.wb.qword0.hi_dword.rss);
>  		if (pkt_flags & PKT_RX_FDIR)
> -			pkt_flags |= i40e_rxd_build_fdir(&rxd, rxm);
> +			pkt_flags |= i40e_rxd_build_fdir(&rxd, first_seg);
> 
>  #ifdef RTE_LIBRTE_IEEE1588
>  		pkt_flags |= i40e_get_iee15888_flags(first_seg, qword1);
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> 1.9.1
Thomas Monjalon July 28, 2016, 1:48 p.m. UTC | #2
> > From: Dumitru Ceara <dumitru.ceara@gmail.com>
> > 
> > The driver is incorrectly setting the RSS field in the last mbuf in the packet chain instead of the first. Moreover, the last mbuf might have
> > already been freed if it only contained the Ethernet CRC.
> > 
> > Also, fix the call to i40e_rxd_build_fdir to store the fdir flags in the first mbuf of the chain instead of the last.
> > 
> > Signed-off-by: Dumitru Ceara <dumitru.ceara@gmail.com>
> 
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

Fixes: 4861cde46116 ("i40e: new poll mode driver")
Fixes: 5a21d9715f81 ("i40e: report flow director matching")

Title reworded: net/i40e: fix metadata in first mbuf of scattered Rx

Applied, thanks
diff mbox

Patch

diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index d3cfb98..554d167 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -1436,10 +1436,10 @@  i40e_recv_scattered_pkts(void *rx_queue,
 			i40e_rxd_pkt_type_mapping((uint8_t)((qword1 &
 			I40E_RXD_QW1_PTYPE_MASK) >> I40E_RXD_QW1_PTYPE_SHIFT));
 		if (pkt_flags & PKT_RX_RSS_HASH)
-			rxm->hash.rss =
+			first_seg->hash.rss =
 				rte_le_to_cpu_32(rxd.wb.qword0.hi_dword.rss);
 		if (pkt_flags & PKT_RX_FDIR)
-			pkt_flags |= i40e_rxd_build_fdir(&rxd, rxm);
+			pkt_flags |= i40e_rxd_build_fdir(&rxd, first_seg);
 
 #ifdef RTE_LIBRTE_IEEE1588
 		pkt_flags |= i40e_get_iee15888_flags(first_seg, qword1);