From f737f211f08951cbe1fe82866d59bc2997cd9130 Mon Sep 17 00:00:00 2001 From: "Chen Jing D(Mark)" Date: Fri, 30 Oct 2015 16:02:58 +0800 Subject: [PATCH] fm10k: add vector Rx condition check Add func fm10k_rx_vec_condition_check to check if Vector RX func can be applied. Signed-off-by: Chen Jing D(Mark) Acked-by: Cunming Liang --- drivers/net/fm10k/fm10k.h | 1 + drivers/net/fm10k/fm10k_rxtx_vec.c | 31 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h index b929ed084c..47a2247a84 100644 --- a/drivers/net/fm10k/fm10k.h +++ b/drivers/net/fm10k/fm10k.h @@ -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 diff --git a/drivers/net/fm10k/fm10k_rxtx_vec.c b/drivers/net/fm10k/fm10k_rxtx_vec.c index 9633f35eba..64036e320c 100644 --- a/drivers/net/fm10k/fm10k_rxtx_vec.c +++ b/drivers/net/fm10k/fm10k_rxtx_vec.c @@ -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) { -- 2.20.1