fm10k: add vector Rx condition check
authorChen Jing D(Mark) <jing.d.chen@intel.com>
Fri, 30 Oct 2015 08:02:58 +0000 (16:02 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 2 Nov 2015 09:00:01 +0000 (10:00 +0100)
Add func fm10k_rx_vec_condition_check to check if Vector RX
func can be applied.

Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
Acked-by: Cunming Liang <cunming.liang@intel.com>
drivers/net/fm10k/fm10k.h
drivers/net/fm10k/fm10k_rxtx_vec.c

index b929ed0..47a2247 100644 (file)
@@ -332,5 +332,6 @@ uint16_t fm10k_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
        uint16_t nb_pkts);
 
 int fm10k_rxq_vec_setup(struct fm10k_rx_queue *rxq);
+int fm10k_rx_vec_condition_check(struct rte_eth_dev *);
 uint16_t fm10k_recv_pkts_vec(void *, struct rte_mbuf **, uint16_t);
 #endif
index 9633f35..64036e3 100644 (file)
@@ -171,6 +171,37 @@ fm10k_desc_to_pktype_v(__m128i descs[4], struct rte_mbuf **rx_pkts)
 #define fm10k_desc_to_pktype_v(desc, rx_pkts) do {} while (0)
 #endif
 
+int __attribute__((cold))
+fm10k_rx_vec_condition_check(struct rte_eth_dev *dev)
+{
+#ifndef RTE_LIBRTE_IEEE1588
+       struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
+       struct rte_fdir_conf *fconf = &dev->data->dev_conf.fdir_conf;
+
+#ifndef RTE_FM10K_RX_OLFLAGS_ENABLE
+       /* whithout rx ol_flags, no VP flag report */
+       if (rxmode->hw_vlan_extend != 0)
+               return -1;
+#endif
+
+       /* no fdir support */
+       if (fconf->mode != RTE_FDIR_MODE_NONE)
+               return -1;
+
+       /* - no csum error report support
+        * - no header split support
+        */
+       if (rxmode->hw_ip_checksum == 1 ||
+           rxmode->header_split == 1)
+               return -1;
+
+       return 0;
+#else
+       RTE_SET_USED(dev);
+       return -1;
+#endif
+}
+
 int __attribute__((cold))
 fm10k_rxq_vec_setup(struct fm10k_rx_queue *rxq)
 {