Skip to contentSkip to conversation

Fix inconsistencies in offload masks

PATCH In review Ciara Loftus 3 participants 9 messages Sep 24 – Sep 25 Network drivers

lore
Share & tools
lore
#0 lore raw

cover Fix inconsistencies in offload masks

This series fixes some inconsistencies in the path offload masks and dev_info offload capabilities for the ice, iavf and i40e drivers. The first 3 patches are concerned with fixing the path offload masks. The last 3 patches change how offloads are derived for the dev_info offload capabilities. Instead of defining an explicit list of offloads, reuse the information that is already available in the path offload masks. It should help prevent further inconsistencies in the future.

Ciara Loftus (6):
net/ice: update Rx supported offloads masks net/ice: fix Rx vector path offload masks net/i40e: drop unimplemented UDP TSO from Tx mask net/ice: derive Rx/Tx offload capabilities from path masks net/iavf: derive Rx/Tx offload capabilities from path masks net/i40e: derive Rx/Tx offload capabilities from path masks

 drivers/net/intel/i40e/i40e_ethdev.c | 29 +++---------------------
 drivers/net/intel/i40e/i40e_rxtx.h   |  1 -
 drivers/net/intel/iavf/iavf_ethdev.c | 34 +++++++++-------------------
 drivers/net/intel/ice/ice_ethdev.c   | 32 ++++++--------------------
 drivers/net/intel/ice/ice_rxtx.h     |  6 +++--
 5 files changed, 25 insertions(+), 77 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/6 net/ice: update Rx supported offloads masks

All Rx paths support offloading the outer UDP cksum. Advertise this in the Rx path offload masks and the dev_info Rx offload capabilities.

Fixes 75c6287f250f ("net/ice: fix outer checksum flags")
---
 drivers/net/intel/ice/ice_ethdev.c | 1 +
 drivers/net/intel/ice/ice_rxtx.h   | 2 ++
 2 files changed, 3 insertions(+)
drivers/net/intel/ice/ice_ethdev.c +1 -0
index dfee07c457b..2722f359cb3 100644
@@ -4751,6 +4751,7 @@ ice_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 			RTE_ETH_RX_OFFLOAD_TCP_CKSUM |
 			RTE_ETH_RX_OFFLOAD_QINQ_STRIP |
 			RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM |
+			RTE_ETH_RX_OFFLOAD_OUTER_UDP_CKSUM |
 			RTE_ETH_RX_OFFLOAD_VLAN_EXTEND |
 			RTE_ETH_RX_OFFLOAD_RSS_HASH |
 			RTE_ETH_RX_OFFLOAD_TIMESTAMP |
drivers/net/intel/ice/ice_rxtx.h +2 -0
index cd23f7c56f6..b809c8b0e80 100644
@@ -87,6 +87,7 @@
 			RTE_ETH_RX_OFFLOAD_TCP_CKSUM |		\
 			RTE_ETH_RX_OFFLOAD_QINQ_STRIP |		\
 			RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM |	\
+			RTE_ETH_RX_OFFLOAD_OUTER_UDP_CKSUM |	\
 			RTE_ETH_RX_OFFLOAD_VLAN_EXTEND |	\
 			RTE_ETH_RX_OFFLOAD_RSS_HASH |		\
 			RTE_ETH_RX_OFFLOAD_TIMESTAMP |		\
@@ -100,6 +101,7 @@
 #define ICE_RX_VECTOR_OFFLOAD_OFFLOADS (	\
 		ICE_RX_VECTOR_OFFLOADS |	\
 		RTE_ETH_RX_OFFLOAD_CHECKSUM |	\
+		RTE_ETH_RX_OFFLOAD_OUTER_UDP_CKSUM |	\
 		RTE_ETH_RX_OFFLOAD_VLAN_STRIP |	\
 		RTE_ETH_RX_OFFLOAD_VLAN_FILTER |\
 		RTE_ETH_RX_OFFLOAD_RSS_HASH)
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/6 net/ice: fix Rx vector path offload masks

In reply to Ciara Loftus

The offload RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM was advertised as available on the plain (non-offload) AVX2/AVX512 Rx paths, however only the offload versions of those paths compute checksum status flags. Move the flag to the Rx vector offload path mask where it belongs.

Fixes 872b571787 ("net/ice: use common Rx path selection infrastructure")
---
 drivers/net/intel/ice/ice_rxtx.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/ice/ice_rxtx.h +2 -2
index b809c8b0e80..e58f1fab376 100644
@@ -95,12 +95,12 @@
 /* basic vector paths */
 #define ICE_RX_VECTOR_OFFLOADS (				\
 			RTE_ETH_RX_OFFLOAD_KEEP_CRC |		\
-			RTE_ETH_RX_OFFLOAD_SCATTER |		\
-			RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM)
+			RTE_ETH_RX_OFFLOAD_SCATTER)
 /* vector offload paths */
 #define ICE_RX_VECTOR_OFFLOAD_OFFLOADS (	\
 		ICE_RX_VECTOR_OFFLOADS |	\
 		RTE_ETH_RX_OFFLOAD_CHECKSUM |	\
+		RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM |	\
 		RTE_ETH_RX_OFFLOAD_OUTER_UDP_CKSUM |	\
 		RTE_ETH_RX_OFFLOAD_VLAN_STRIP |	\
 		RTE_ETH_RX_OFFLOAD_VLAN_FILTER |\
Signature · 1 line
2.43.0
#3 lore raw

PATCH 3/6 net/i40e: drop unimplemented UDP TSO from Tx mask

In reply to Ciara Loftus

Commit d9550ce576a7 ("net/intel: create common checksum Tx offload function") added RTE_ETH_TX_OFFLOAD_UDP_TSO to the scalar Tx offload mask when merging i40e's checksum helper with ice's, but UDP TSO was never actually wired up for i40e. i40e_calc_context_desc() does not trigger on RTE_MBUF_F_TX_UDP_SEG, so no context descriptor is built for UDP segmentation, and get_context_desc() only invokes i40e_set_tso_ctx() for RTE_MBUF_F_TX_TCP_SEG, so the TSO fields are never programmed for a UDP-segmented packet either.

Fix this by removing the unimplemented offload from the mask.

Fixes d9550ce576a7 ("net/intel: create common checksum Tx offload function")
---
 drivers/net/intel/i40e/i40e_rxtx.h | 1 -
 1 file changed, 1 deletion(-)
drivers/net/intel/i40e/i40e_rxtx.h +0 -1
index 88d47f261e4..09773420644 100644
@@ -97,7 +97,6 @@ enum i40e_header_split_mode {
 		RTE_ETH_TX_OFFLOAD_SCTP_CKSUM |		\
 		RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM |	\
 		RTE_ETH_TX_OFFLOAD_TCP_TSO |		\
-		RTE_ETH_TX_OFFLOAD_UDP_TSO |		\
 		RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO |	\
 		RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO |	\
 		RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO |	\
Signature · 1 line
2.43.0
#4 lore raw

PATCH 4/6 net/ice: derive Rx/Tx offload capabilities from path masks

In reply to Ciara Loftus

tx_offload_capa was missing RTE_ETH_TX_OFFLOAD_UDP_TSO even though the scalar Tx path supports it. Rather than adding the missing flag to the Tx offload capabilities directly, derive tx_offload_capa from a mask of all of the Tx path offload masks.

While we are here, do the same for the Rx offload capabilities mask, which now derives itself from a mask of all of the Rx path offload masks.

A benefit of this is that if an offload is ever added to a path, it is automatically reflected in the advertised capabilities too, instead of relying on the capabilities masks in dev_info being kept manually in sync. Some overlap will be present when masking the masks but it is kept because relying on one path's offload mask always being a superset of another's is fragile.

Fixes 623ca7a15db4 ("net/ice: enable UDP fragmentation offload")
---
 drivers/net/intel/ice/ice_ethdev.c | 33 +++++++-----------------------
 1 file changed, 7 insertions(+), 26 deletions(-)
drivers/net/intel/ice/ice_ethdev.c +7 -26
index 2722f359cb3..b8e703c6956 100644
@@ -4745,32 +4745,13 @@ ice_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->flow_type_rss_offloads = 0;
 
 	if (!is_safe_mode) {
-		dev_info->rx_offload_capa |=
-			RTE_ETH_RX_OFFLOAD_IPV4_CKSUM |
-			RTE_ETH_RX_OFFLOAD_UDP_CKSUM |
-			RTE_ETH_RX_OFFLOAD_TCP_CKSUM |
-			RTE_ETH_RX_OFFLOAD_QINQ_STRIP |
-			RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM |
-			RTE_ETH_RX_OFFLOAD_OUTER_UDP_CKSUM |
-			RTE_ETH_RX_OFFLOAD_VLAN_EXTEND |
-			RTE_ETH_RX_OFFLOAD_RSS_HASH |
-			RTE_ETH_RX_OFFLOAD_TIMESTAMP |
-			RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT;
-		dev_info->tx_offload_capa |=
-			RTE_ETH_TX_OFFLOAD_QINQ_INSERT |
-			RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |
-			RTE_ETH_TX_OFFLOAD_UDP_CKSUM |
-			RTE_ETH_TX_OFFLOAD_TCP_CKSUM |
-			RTE_ETH_TX_OFFLOAD_SCTP_CKSUM |
-			RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM |
-			RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM |
-			RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO |
-			RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO |
-			RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO |
-			RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO;
-		if (hw->phy_model == ICE_PHY_E830)
-			dev_info->tx_offload_capa |=
-				RTE_ETH_TX_OFFLOAD_SEND_ON_TIMESTAMP;
+		dev_info->rx_offload_capa = ICE_RX_SCALAR_OFFLOADS |
+			ICE_RX_VECTOR_OFFLOADS | ICE_RX_VECTOR_OFFLOAD_OFFLOADS;
+		dev_info->tx_offload_capa = ICE_TX_SCALAR_OFFLOADS |
+			CI_TX_VECTOR_OFFLOADS | CI_TX_VEC_OFFLOAD_PATH_OFFLOADS |
+			CI_TX_VEC_CTX_OFFLOAD_PATH_OFFLOADS;
+		if (hw->phy_model != ICE_PHY_E830)
+			dev_info->tx_offload_capa &= ~RTE_ETH_TX_OFFLOAD_SEND_ON_TIMESTAMP;
 		dev_info->flow_type_rss_offloads |= ICE_RSS_OFFLOAD_ALL;
 	}
 
Signature · 1 line
2.43.0
#5 lore raw

PATCH 5/6 net/iavf: derive Rx/Tx offload capabilities from path masks

In reply to Ciara Loftus

rx_offload_capa was missing RTE_ETH_RX_OFFLOAD_OUTER_UDP_CKSUM even though the scalar Rx path supports it. Rather than adding the missing flag to the Rx offload capabilities directly, derive rx_offload_capa from a mask of all of the Rx path offload masks.

Similarly, tx_offload_capa was missing RTE_ETH_TX_OFFLOAD_UDP_TSO despite the Tx path already supporting and advertising this offload. Derive the tx offload capabilities mask from a mask of all of the Tx path offload masks.

A benefit of this is that if an offload is ever added to a path, it is automatically reflected in the advertised capabilities too, instead of relying on the capabilities masks in dev_info being kept manually in sync. Some overlap will be present when masking the masks but it is kept because relying on one path's offload mask always being a superset of another's is fragile.

Fixes 3b8c645afa06 ("net/iavf: fix outer checksum flags")
Fixes 1e728b01120c ("net/iavf: rework Tx path")
---
 drivers/net/intel/iavf/iavf_ethdev.c | 34 +++++++++-------------------
 1 file changed, 11 insertions(+), 23 deletions(-)
drivers/net/intel/iavf/iavf_ethdev.c +11 -23
index a8daa507bbb..b8ca1a19e3e 100644
@@ -1202,31 +1202,19 @@ iavf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 			RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |
 			RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP;
 	dev_info->rx_offload_capa =
-		RTE_ETH_RX_OFFLOAD_VLAN_STRIP |
-		RTE_ETH_RX_OFFLOAD_QINQ_STRIP |
-		RTE_ETH_RX_OFFLOAD_IPV4_CKSUM |
-		RTE_ETH_RX_OFFLOAD_UDP_CKSUM |
-		RTE_ETH_RX_OFFLOAD_TCP_CKSUM |
-		RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM |
-		RTE_ETH_RX_OFFLOAD_SCATTER |
-		RTE_ETH_RX_OFFLOAD_VLAN_FILTER |
-		RTE_ETH_RX_OFFLOAD_VLAN_EXTEND |
-		RTE_ETH_RX_OFFLOAD_RSS_HASH;
+		(IAVF_RX_SCALAR_OFFLOADS | IAVF_RX_SCALAR_FLEX_OFFLOADS |
+		 IAVF_RX_VECTOR_OFFLOADS | IAVF_RX_VECTOR_OFFLOAD_OFFLOADS |
+		 IAVF_RX_VECTOR_FLEX_OFFLOADS | IAVF_RX_VECTOR_OFFLOAD_FLEX_OFFLOADS) &
+		~(RTE_ETH_RX_OFFLOAD_KEEP_CRC |
+		  RTE_ETH_RX_OFFLOAD_TIMESTAMP |
+		  RTE_ETH_RX_OFFLOAD_SECURITY);
 
 	dev_info->tx_offload_capa =
-		RTE_ETH_TX_OFFLOAD_VLAN_INSERT |
-		RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |
-		RTE_ETH_TX_OFFLOAD_UDP_CKSUM |
-		RTE_ETH_TX_OFFLOAD_TCP_CKSUM |
-		RTE_ETH_TX_OFFLOAD_SCTP_CKSUM |
-		RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM |
-		RTE_ETH_TX_OFFLOAD_TCP_TSO |
-		RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO |
-		RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO |
-		RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO |
-		RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO |
-		RTE_ETH_TX_OFFLOAD_MULTI_SEGS |
-		RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
+		(IAVF_TX_SCALAR_OFFLOADS | CI_TX_VECTOR_OFFLOADS |
+		 CI_TX_VEC_OFFLOAD_PATH_OFFLOADS | CI_TX_VEC_CTX_OFFLOAD_PATH_OFFLOADS) &
+		~(RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM |
+		  RTE_ETH_TX_OFFLOAD_QINQ_INSERT |
+		  RTE_ETH_TX_OFFLOAD_SECURITY);
 
 	/* X710 does not support outer udp checksum */
 	if (adapter->hw.mac.type != IAVF_MAC_XL710)
Signature · 1 line
2.43.0
#6 lore raw

PATCH 6/6 net/i40e: derive Rx/Tx offload capabilities from path masks

In reply to Ciara Loftus

The Rx and Tx offload capability masks duplicated the offload lists already maintained for tracking the offloads enabled on the various scalar and vector Rx and Tx paths. Instead of defining explicit lists for the offload capabilities masks, instead derive the capabilities from the path masks.

A benefit of this is that if an offload is ever added to a path, it is automatically reflected in the advertised capabilities too, instead of relying on the capabilities masks in dev_info being kept manually in sync. Some overlap will be present when masking the masks but it is kept because relying on one path's offload mask always being a superset of another's is fragile.

---
 drivers/net/intel/i40e/i40e_ethdev.c | 29 +++-------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)
drivers/net/intel/i40e/i40e_ethdev.c +3 -26
index defdff0378f..5d6102cae7b 100644
@@ -3865,35 +3865,12 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->max_mtu = dev_info->max_rx_pktlen - I40E_ETH_OVERHEAD;
 	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
 	dev_info->rx_queue_offload_capa = 0;
-	dev_info->rx_offload_capa =
-		RTE_ETH_RX_OFFLOAD_VLAN_STRIP |
-		RTE_ETH_RX_OFFLOAD_QINQ_STRIP |
-		RTE_ETH_RX_OFFLOAD_IPV4_CKSUM |
-		RTE_ETH_RX_OFFLOAD_UDP_CKSUM |
-		RTE_ETH_RX_OFFLOAD_TCP_CKSUM |
-		RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM |
-		RTE_ETH_RX_OFFLOAD_KEEP_CRC |
-		RTE_ETH_RX_OFFLOAD_SCATTER |
-		RTE_ETH_RX_OFFLOAD_VLAN_EXTEND |
-		RTE_ETH_RX_OFFLOAD_VLAN_FILTER |
-		RTE_ETH_RX_OFFLOAD_RSS_HASH;
+	dev_info->rx_offload_capa = I40E_RX_SCALAR_OFFLOADS | I40E_RX_VECTOR_OFFLOADS;
 
 	dev_info->tx_queue_offload_capa = RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
 	dev_info->tx_offload_capa =
-		RTE_ETH_TX_OFFLOAD_VLAN_INSERT |
-		RTE_ETH_TX_OFFLOAD_QINQ_INSERT |
-		RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |
-		RTE_ETH_TX_OFFLOAD_UDP_CKSUM |
-		RTE_ETH_TX_OFFLOAD_TCP_CKSUM |
-		RTE_ETH_TX_OFFLOAD_SCTP_CKSUM |
-		RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM |
-		RTE_ETH_TX_OFFLOAD_TCP_TSO |
-		RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO |
-		RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO |
-		RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO |
-		RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO |
-		RTE_ETH_TX_OFFLOAD_MULTI_SEGS |
-		dev_info->tx_queue_offload_capa;
+		(I40E_TX_SCALAR_OFFLOADS | I40E_TX_VECTOR_OFFLOADS) &
+		~RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM;
 	if (hw->mac.type == I40E_MAC_X722) {
 		dev_info->tx_offload_capa |=
 			RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM;
Signature · 1 line
2.43.0
#7 lore raw
In reply to Ciara Loftus
Quoted 8 lines · Ciara Loftus

This series fixes some inconsistencies in the path offload masks and dev_info offload capabilities for the ice, iavf and i40e drivers. The first 3 patches are concerned with fixing the path offload masks. The last 3 patches change how offloads are derived for the dev_info offload capabilities. Instead of defining an explicit list of offloads, reuse the information that is already available in the path offload masks. It should help prevent further inconsistencies in the future.

Signature · 2 lines
Thanks,
Anatoly
#8 lore raw
Quoted 10 lines · Anatoly
Quoted 8 lines · Ciara Loftus

This series fixes some inconsistencies in the path offload masks and dev_info offload capabilities for the ice, iavf and i40e drivers. The first 3 patches are concerned with fixing the path offload masks. The last 3 patches change how offloads are derived for the dev_info offload capabilities. Instead of defining an explicit list of offloads, reuse the information that is already available in the path offload masks. It should help prevent further inconsistencies in the future.

Quoted 2 lines

Series applied to dpdk-next-net-intel

Thanks,
/Bruce