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: a2b79a93515e ("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 | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/net/sxe2/sxe2_ethdev.c b/drivers/net/sxe2/sxe2_ethdev.c
index e85e34aa1a..7a11a93dff 100644
--- a/drivers/net/sxe2/sxe2_ethdev.c
+++ b/drivers/net/sxe2/sxe2_ethdev.c
@@ -804,15 +804,11 @@ 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;
 
        dev_info->tx_offload_capa =
                RTE_ETH_TX_OFFLOAD_VLAN_INSERT |
-               RTE_ETH_TX_OFFLOAD_QINQ_INSERT |
                RTE_ETH_TX_OFFLOAD_MULTI_SEGS |
                RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE |
                RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |
@@ -855,14 +851,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;
@@ -934,7 +938,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,
@@ -972,6 +976,7 @@ sxe2_buffer_split_supported_hdr_ptypes_get(struct 
rte_eth_dev *dev __rte_unused,
 
                RTE_PTYPE_UNKNOWN
        };
+       *no_of_elements = RTE_DIM(ptypes) - 1;
 
        return ptypes;
 }
-- 
2.52.0

Reply via email to