From: Jie Liu <[email protected]>

Make the QINQ offload capabilities conditional on the port VLAN
setting: only advertise RTE_ETH_TX_OFFLOAD_QINQ_INSERT,
RTE_ETH_RX_OFFLOAD_QINQ_STRIP and RTE_ETH_RX_OFFLOAD_VLAN_FILTER
when no port VLAN is configured. Advertise RTE_ETH_RX_OFFLOAD_RSS_HASH
unconditionally and report the buffer split supported header ptypes
count in sxe2_buffer_split_supported_hdr_ptypes_get().

Fixes: a2b79a9351 ("net/sxe2: support L2 filtering and MAC config")
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Jie Liu <[email protected]>
---
 drivers/net/sxe2/sxe2_ethdev.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/net/sxe2/sxe2_ethdev.c b/drivers/net/sxe2/sxe2_ethdev.c
index e85dee6b2c..a8e16cdd0a 100644
--- a/drivers/net/sxe2/sxe2_ethdev.c
+++ b/drivers/net/sxe2/sxe2_ethdev.c
@@ -804,11 +804,9 @@ static int32_t sxe2_dev_infos_get(struct rte_eth_dev *dev,
                RTE_ETH_RX_OFFLOAD_SCTP_CKSUM |
                RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM |
                RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT |
-#ifndef RTE_LIBRTE_SXE2_16BYTE_RX_DESC
-               RTE_ETH_RX_OFFLOAD_QINQ_STRIP |
-#endif
                RTE_ETH_RX_OFFLOAD_VLAN_EXTEND |
-               RTE_ETH_RX_OFFLOAD_TCP_LRO;
+               RTE_ETH_RX_OFFLOAD_TCP_LRO |
+               RTE_ETH_RX_OFFLOAD_RSS_HASH;
 
        dev_info->tx_offload_capa =
                RTE_ETH_TX_OFFLOAD_VLAN_INSERT |
@@ -855,14 +853,22 @@ static int32_t sxe2_dev_infos_get(struct rte_eth_dev *dev,
                RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO;
 
 
-       if (adapter->cap_flags & SXE2_DEV_CAPS_OFFLOAD_PTP)
-               dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_TIMESTAMP;
-
        if (sxe2_ipsec_supported(adapter)) {
                dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_SECURITY;
                dev_info->tx_offload_capa |= RTE_ETH_TX_OFFLOAD_SECURITY;
        }
 
+       if (adapter->cap_flags & SXE2_DEV_CAPS_OFFLOAD_PTP)
+               dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_TIMESTAMP;
+
+       if (!sxe2_dev_port_vlan_check(dev)) {
+               dev_info->tx_offload_capa |= RTE_ETH_TX_OFFLOAD_QINQ_INSERT;
+#ifndef RTE_LIBRTE_SXE2_16BYTE_RX_DESC
+               dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_QINQ_STRIP;
+#endif
+               dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_VLAN_FILTER;
+       }
+
        if (adapter->cap_flags & SXE2_DEV_CAPS_OFFLOAD_RSS) {
                dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
                dev_info->flow_type_rss_offloads  |= SXE2_RSS_HF_SUPPORT_ALL;
@@ -936,7 +942,7 @@ static int32_t sxe2_dev_infos_get(struct rte_eth_dev *dev,
 
 static const uint32_t *
 sxe2_buffer_split_supported_hdr_ptypes_get(struct rte_eth_dev *dev 
__rte_unused,
-                                          size_t *no_of_elements __rte_unused)
+                                          size_t *no_of_elements)
 {
        static const uint32_t ptypes[] = {
                RTE_PTYPE_L2_ETHER,
@@ -974,6 +980,7 @@ sxe2_buffer_split_supported_hdr_ptypes_get(struct 
rte_eth_dev *dev __rte_unused,
 
                RTE_PTYPE_UNKNOWN
        };
+       *no_of_elements = RTE_DIM(ptypes);
 
        return ptypes;
 }
-- 
2.52.0

Reply via email to