net/ice: support Rx scatter SSE vector
authorWenzhuo Lu <wenzhuo.lu@intel.com>
Tue, 26 Mar 2019 06:16:47 +0000 (14:16 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 29 Mar 2019 16:25:31 +0000 (17:25 +0100)
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/ice/ice_rxtx.c
drivers/net/ice/ice_rxtx.h
drivers/net/ice/ice_rxtx_vec_sse.c

index 1c6121f..748954f 100644 (file)
@@ -1504,7 +1504,8 @@ ice_dev_supported_ptypes_get(struct rte_eth_dev *dev)
                return ptypes;
 
 #ifdef RTE_ARCH_X86
-       if (dev->rx_pkt_burst == ice_recv_pkts_vec)
+       if (dev->rx_pkt_burst == ice_recv_pkts_vec ||
+           dev->rx_pkt_burst == ice_recv_scattered_pkts_vec)
                return ptypes;
 #endif
 
@@ -2248,9 +2249,16 @@ ice_set_rx_function(struct rte_eth_dev *dev)
                        rxq = dev->data->rx_queues[i];
                        (void)ice_rxq_vec_setup(rxq);
                }
-               PMD_DRV_LOG(DEBUG, "Using Vector Rx (port %d).",
-                           dev->data->port_id);
-               dev->rx_pkt_burst = ice_recv_pkts_vec;
+               if (dev->data->scattered_rx) {
+                       PMD_DRV_LOG(DEBUG,
+                                   "Using Vector Scattered Rx (port %d).",
+                                   dev->data->port_id);
+                       dev->rx_pkt_burst = ice_recv_scattered_pkts_vec;
+               } else {
+                       PMD_DRV_LOG(DEBUG, "Using Vector Rx (port %d).",
+                                   dev->data->port_id);
+                       dev->rx_pkt_burst = ice_recv_pkts_vec;
+               }
 
                return;
        }
index 656ca0d..6ef0a84 100644 (file)
@@ -173,4 +173,6 @@ int ice_rx_vec_dev_check(struct rte_eth_dev *dev);
 int ice_rxq_vec_setup(struct ice_rx_queue *rxq);
 uint16_t ice_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
                           uint16_t nb_pkts);
+uint16_t ice_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
+                                    uint16_t nb_pkts);
 #endif /* _ICE_RXTX_H_ */
index ec31e36..c49c344 100644 (file)
@@ -473,6 +473,47 @@ ice_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
        return _ice_recv_raw_pkts_vec(rx_queue, rx_pkts, nb_pkts, NULL);
 }
 
+/* vPMD receive routine that reassembles scattered packets
+ * Notice:
+ * - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet
+ * - nb_pkts > ICE_VPMD_RX_BURST, only scan ICE_VPMD_RX_BURST
+ *   numbers of DD bits
+ */
+uint16_t
+ice_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
+                           uint16_t nb_pkts)
+{
+       struct ice_rx_queue *rxq = rx_queue;
+       uint8_t split_flags[ICE_VPMD_RX_BURST] = {0};
+
+       /* get some new buffers */
+       uint16_t nb_bufs = _ice_recv_raw_pkts_vec(rxq, rx_pkts, nb_pkts,
+                                                 split_flags);
+       if (nb_bufs == 0)
+               return 0;
+
+       /* happy day case, full burst + no packets to be joined */
+       const uint64_t *split_fl64 = (uint64_t *)split_flags;
+
+       if (!rxq->pkt_first_seg &&
+           split_fl64[0] == 0 && split_fl64[1] == 0 &&
+           split_fl64[2] == 0 && split_fl64[3] == 0)
+               return nb_bufs;
+
+       /* reassemble any packets that need reassembly*/
+       unsigned int i = 0;
+
+       if (!rxq->pkt_first_seg) {
+               /* find the first split flag, and only reassemble then*/
+               while (i < nb_bufs && !split_flags[i])
+                       i++;
+               if (i == nb_bufs)
+                       return nb_bufs;
+       }
+       return i + ice_rx_reassemble_packets(rxq, &rx_pkts[i], nb_bufs - i,
+                                            &split_flags[i]);
+}
+
 int __attribute__((cold))
 ice_rxq_vec_setup(struct ice_rx_queue *rxq)
 {