]> git.droids-corp.org - dpdk.git/commitdiff
net/iavf: fix data path selection
authorYiding Zhou <yidingx.zhou@intel.com>
Sat, 7 May 2022 19:52:39 +0000 (03:52 +0800)
committerQi Zhang <qi.z.zhang@intel.com>
Tue, 17 May 2022 00:43:08 +0000 (02:43 +0200)
If PF driver don't support a flex Rx descriptor that required by VF,
legacy descriptor format will be negotiated to configure the hardware
queue.

The patch fixes the issue that an Rx data path that handle flexible
descriptor  (e.g.:
iavf_recv_scattered_pkts_vec_avx512_flex_rxd) is selected while the
actual hardware queues are configured as legacy due to above scenario,
which will cause following coredump.

Fixes: 12b435bf8f2f ("net/iavf: support flex desc metadata extraction")
Cc: stable@dpdk.org
Signed-off-by: Yiding Zhou <yidingx.zhou@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/iavf/iavf_rxtx.c

index 345f6aeebcf5ba63b89d52099b559957bfeff0ed..d3b1a58b2782fc6a4429512970ee2c9a69f43294 100644 (file)
@@ -2899,14 +2899,27 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
        struct iavf_adapter *adapter =
                IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
        struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+       int i;
+       struct iavf_rx_queue *rxq;
+       bool use_flex = true;
+
+       for (i = 0; i < dev->data->nb_rx_queues; i++) {
+               rxq = dev->data->rx_queues[i];
+               if (rxq->rxdid <= IAVF_RXDID_LEGACY_1) {
+                       PMD_DRV_LOG(NOTICE, "request RXDID[%d] in Queue[%d] is legacy, "
+                               "set rx_pkt_burst as legacy for all queues", rxq->rxdid, i);
+                       use_flex = false;
+               } else if (!(vf->supported_rxdid & BIT(rxq->rxdid))) {
+                       PMD_DRV_LOG(NOTICE, "request RXDID[%d] in Queue[%d] is not supported, "
+                               "set rx_pkt_burst as legacy for all queues", rxq->rxdid, i);
+                       use_flex = false;
+               }
+       }
 
 #ifdef RTE_ARCH_X86
-       struct iavf_rx_queue *rxq;
-       int i;
        int check_ret;
        bool use_avx2 = false;
        bool use_avx512 = false;
-       bool use_flex = false;
 
        check_ret = iavf_rx_vec_dev_check(dev);
        if (check_ret >= 0 &&
@@ -2923,10 +2936,6 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
                        use_avx512 = true;
 #endif
 
-               if (vf->vf_res->vf_cap_flags &
-                       VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
-                       use_flex = true;
-
                for (i = 0; i < dev->data->nb_rx_queues; i++) {
                        rxq = dev->data->rx_queues[i];
                        (void)iavf_rxq_vec_setup(rxq);
@@ -3030,7 +3039,7 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
        if (dev->data->scattered_rx) {
                PMD_DRV_LOG(DEBUG, "Using a Scattered Rx callback (port=%d).",
                            dev->data->port_id);
-               if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
+               if (use_flex)
                        dev->rx_pkt_burst = iavf_recv_scattered_pkts_flex_rxd;
                else
                        dev->rx_pkt_burst = iavf_recv_scattered_pkts;
@@ -3041,7 +3050,7 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
        } else {
                PMD_DRV_LOG(DEBUG, "Using Basic Rx callback (port=%d).",
                            dev->data->port_id);
-               if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
+               if (use_flex)
                        dev->rx_pkt_burst = iavf_recv_pkts_flex_rxd;
                else
                        dev->rx_pkt_burst = iavf_recv_pkts;