net/ice/base: allow tool access to manageability register
[dpdk.git] / drivers / net / ice / ice_rxtx.c
index c6aa326..5d7ab4f 100644 (file)
@@ -27,6 +27,18 @@ uint64_t rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask;
 uint64_t rte_net_ice_dynflag_proto_xtr_tcp_mask;
 uint64_t rte_net_ice_dynflag_proto_xtr_ip_offset_mask;
 
+static int
+ice_monitor_callback(const uint64_t value,
+               const uint64_t arg[RTE_POWER_MONITOR_OPAQUE_SZ] __rte_unused)
+{
+       const uint64_t m = rte_cpu_to_le_16(1 << ICE_RX_FLEX_DESC_STATUS0_DD_S);
+       /*
+        * we expect the DD bit to be set to 1 if this descriptor was already
+        * written to.
+        */
+       return (value & m) == m ? -1 : 0;
+}
+
 int
 ice_get_monitor_addr(void *rx_queue, struct rte_power_monitor_cond *pmc)
 {
@@ -39,12 +51,8 @@ ice_get_monitor_addr(void *rx_queue, struct rte_power_monitor_cond *pmc)
        /* watch for changes in status bit */
        pmc->addr = &rxdp->wb.status_error0;
 
-       /*
-        * we expect the DD bit to be set to 1 if this descriptor was already
-        * written to.
-        */
-       pmc->val = rte_cpu_to_le_16(1 << ICE_RX_FLEX_DESC_STATUS0_DD_S);
-       pmc->mask = rte_cpu_to_le_16(1 << ICE_RX_FLEX_DESC_STATUS0_DD_S);
+       /* comparison callback */
+       pmc->fn = ice_monitor_callback;
 
        /* register is 16-bit */
        pmc->size = sizeof(uint16_t);
@@ -1995,7 +2003,9 @@ ice_dev_supported_ptypes_get(struct rte_eth_dev *dev)
            dev->rx_pkt_burst == ice_recv_scattered_pkts_vec_avx512_offload ||
 #endif
            dev->rx_pkt_burst == ice_recv_pkts_vec_avx2 ||
-           dev->rx_pkt_burst == ice_recv_scattered_pkts_vec_avx2)
+           dev->rx_pkt_burst == ice_recv_pkts_vec_avx2_offload ||
+           dev->rx_pkt_burst == ice_recv_scattered_pkts_vec_avx2 ||
+           dev->rx_pkt_burst == ice_recv_scattered_pkts_vec_avx2_offload)
                return ptypes;
 #endif
 
@@ -3052,7 +3062,7 @@ ice_set_rx_function(struct rte_eth_dev *dev)
 #ifdef RTE_ARCH_X86
        struct ice_rx_queue *rxq;
        int i;
-       int rx_check_ret = 0;
+       int rx_check_ret = -1;
 
        if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
                ad->rx_use_avx512 = false;
@@ -3107,14 +3117,25 @@ ice_set_rx_function(struct rte_eth_dev *dev)
                                                ice_recv_scattered_pkts_vec_avx512;
                                }
 #endif
+                       } else if (ad->rx_use_avx2) {
+                               if (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH) {
+                                       PMD_DRV_LOG(NOTICE,
+                                                   "Using AVX2 OFFLOAD Vector Scattered Rx (port %d).",
+                                                   dev->data->port_id);
+                                       dev->rx_pkt_burst =
+                                               ice_recv_scattered_pkts_vec_avx2_offload;
+                               } else {
+                                       PMD_DRV_LOG(NOTICE,
+                                                   "Using AVX2 Vector Scattered Rx (port %d).",
+                                                   dev->data->port_id);
+                                       dev->rx_pkt_burst =
+                                               ice_recv_scattered_pkts_vec_avx2;
+                               }
                        } else {
                                PMD_DRV_LOG(DEBUG,
-                                       "Using %sVector Scattered Rx (port %d).",
-                                       ad->rx_use_avx2 ? "avx2 " : "",
+                                       "Using Vector Scattered Rx (port %d).",
                                        dev->data->port_id);
-                               dev->rx_pkt_burst = ad->rx_use_avx2 ?
-                                       ice_recv_scattered_pkts_vec_avx2 :
-                                       ice_recv_scattered_pkts_vec;
+                               dev->rx_pkt_burst = ice_recv_scattered_pkts_vec;
                        }
                } else {
                        if (ad->rx_use_avx512) {
@@ -3133,14 +3154,25 @@ ice_set_rx_function(struct rte_eth_dev *dev)
                                                ice_recv_pkts_vec_avx512;
                                }
 #endif
+                       } else if (ad->rx_use_avx2) {
+                               if (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH) {
+                                       PMD_DRV_LOG(NOTICE,
+                                                   "Using AVX2 OFFLOAD Vector Rx (port %d).",
+                                                   dev->data->port_id);
+                                       dev->rx_pkt_burst =
+                                               ice_recv_pkts_vec_avx2_offload;
+                               } else {
+                                       PMD_DRV_LOG(NOTICE,
+                                                   "Using AVX2 Vector Rx (port %d).",
+                                                   dev->data->port_id);
+                                       dev->rx_pkt_burst =
+                                               ice_recv_pkts_vec_avx2;
+                               }
                        } else {
                                PMD_DRV_LOG(DEBUG,
-                                       "Using %sVector Rx (port %d).",
-                                       ad->rx_use_avx2 ? "avx2 " : "",
+                                       "Using Vector Rx (port %d).",
                                        dev->data->port_id);
-                               dev->rx_pkt_burst = ad->rx_use_avx2 ?
-                                       ice_recv_pkts_vec_avx2 :
-                                       ice_recv_pkts_vec;
+                               dev->rx_pkt_burst = ice_recv_pkts_vec;
                        }
                }
                return;
@@ -3185,7 +3217,9 @@ static const struct {
        { ice_recv_pkts_vec_avx512_offload,   "Offload Vector AVX512" },
 #endif
        { ice_recv_scattered_pkts_vec_avx2, "Vector AVX2 Scattered" },
+       { ice_recv_scattered_pkts_vec_avx2_offload, "Offload Vector AVX2 Scattered" },
        { ice_recv_pkts_vec_avx2,           "Vector AVX2" },
+       { ice_recv_pkts_vec_avx2_offload,   "Offload Vector AVX2" },
        { ice_recv_scattered_pkts_vec,      "Vector SSE Scattered" },
        { ice_recv_pkts_vec,                "Vector SSE" },
 #endif