net/hns3: list supported ptypes for advanced Rx descriptor
authorChengwen Feng <fengchengwen@huawei.com>
Tue, 13 Apr 2021 11:50:10 +0000 (19:50 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 14 Apr 2021 17:45:27 +0000 (19:45 +0200)
Kunpeng 930 supports RXD advanced layout. If enabled the layout, the
hardware will report packet type by 8-bit PTYPE filed in the Rx
descriptor, and the supported ptypes are different from original
scheme. So this patch adds supported list for RXD advanced layout.

Fixes: fb5e90694022 ("net/hns3: support Rx descriptor advanced layout")

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
drivers/net/hns3/hns3_rxtx.c

index 87d2df7..bc3640d 100644 (file)
@@ -1991,12 +1991,45 @@ hns3_dev_supported_ptypes_get(struct rte_eth_dev *dev)
                RTE_PTYPE_TUNNEL_NVGRE,
                RTE_PTYPE_UNKNOWN
        };
+       static const uint32_t adv_layout_ptypes[] = {
+               RTE_PTYPE_L2_ETHER,
+               RTE_PTYPE_L2_ETHER_TIMESYNC,
+               RTE_PTYPE_L2_ETHER_LLDP,
+               RTE_PTYPE_L2_ETHER_ARP,
+               RTE_PTYPE_L3_IPV4_EXT_UNKNOWN,
+               RTE_PTYPE_L3_IPV6_EXT_UNKNOWN,
+               RTE_PTYPE_L4_FRAG,
+               RTE_PTYPE_L4_NONFRAG,
+               RTE_PTYPE_L4_UDP,
+               RTE_PTYPE_L4_TCP,
+               RTE_PTYPE_L4_SCTP,
+               RTE_PTYPE_L4_IGMP,
+               RTE_PTYPE_L4_ICMP,
+               RTE_PTYPE_TUNNEL_GRE,
+               RTE_PTYPE_TUNNEL_GRENAT,
+               RTE_PTYPE_INNER_L2_ETHER,
+               RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN,
+               RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN,
+               RTE_PTYPE_INNER_L4_FRAG,
+               RTE_PTYPE_INNER_L4_ICMP,
+               RTE_PTYPE_INNER_L4_NONFRAG,
+               RTE_PTYPE_INNER_L4_UDP,
+               RTE_PTYPE_INNER_L4_TCP,
+               RTE_PTYPE_INNER_L4_SCTP,
+               RTE_PTYPE_INNER_L4_ICMP,
+               RTE_PTYPE_UNKNOWN
+       };
+       struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
        if (dev->rx_pkt_burst == hns3_recv_pkts ||
            dev->rx_pkt_burst == hns3_recv_scattered_pkts ||
            dev->rx_pkt_burst == hns3_recv_pkts_vec ||
-           dev->rx_pkt_burst == hns3_recv_pkts_vec_sve)
-               return ptypes;
+           dev->rx_pkt_burst == hns3_recv_pkts_vec_sve) {
+               if (hns3_dev_rxd_adv_layout_supported(hw))
+                       return adv_layout_ptypes;
+               else
+                       return ptypes;
+       }
 
        return NULL;
 }