net/mlx5: fix flow age event triggering
[dpdk.git] / drivers / net / hns3 / hns3_rxtx_vec.c
index 2bc4372..dc1e1ae 100644 (file)
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2020 Hisilicon Limited.
+ * Copyright(c) 2020-2021 HiSilicon Limited.
  */
 
 #include <rte_io.h>
@@ -18,6 +18,10 @@ hns3_tx_check_vec_support(struct rte_eth_dev *dev)
 {
        struct rte_eth_txmode *txmode = &dev->data->dev_conf.txmode;
 
+       struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+       if (hns3_dev_ptp_supported(hw))
+               return -ENOTSUP;
+
        /* Only support DEV_TX_OFFLOAD_MBUF_FAST_FREE */
        if (txmode->offloads != DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                return -ENOTSUP;
@@ -143,6 +147,28 @@ hns3_rxq_vec_setup_rearm_data(struct hns3_rx_queue *rxq)
        mb_def.port = rxq->port_id;
        rte_mbuf_refcnt_set(&mb_def, 1);
 
+       /* compile-time verifies the rearm_data first 8bytes */
+       RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_off) <
+                        offsetof(struct rte_mbuf, rearm_data));
+       RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, refcnt) <
+                        offsetof(struct rte_mbuf, rearm_data));
+       RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, refcnt) <
+                        offsetof(struct rte_mbuf, rearm_data));
+       RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, nb_segs) <
+                        offsetof(struct rte_mbuf, rearm_data));
+       RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, port) <
+                        offsetof(struct rte_mbuf, rearm_data));
+       RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_off) -
+                        offsetof(struct rte_mbuf, rearm_data) > 6);
+       RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, refcnt) -
+                        offsetof(struct rte_mbuf, rearm_data) > 6);
+       RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, refcnt) -
+                        offsetof(struct rte_mbuf, rearm_data) > 6);
+       RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, nb_segs) -
+                        offsetof(struct rte_mbuf, rearm_data) > 6);
+       RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, port) -
+                        offsetof(struct rte_mbuf, rearm_data) > 6);
+
        /* prevent compiler reordering: rearm_data covers previous fields */
        rte_compiler_barrier();
        p = (uintptr_t)&mb_def.rearm_data;
@@ -167,7 +193,6 @@ hns3_rxq_vec_setup(struct hns3_rx_queue *rxq)
        memset(rxq->offset_table, 0, sizeof(rxq->offset_table));
 }
 
-#ifndef RTE_LIBRTE_IEEE1588
 static int
 hns3_rxq_vec_check(struct hns3_rx_queue *rxq, void *arg)
 {
@@ -183,17 +208,19 @@ hns3_rxq_vec_check(struct hns3_rx_queue *rxq, void *arg)
        RTE_SET_USED(arg);
        return 0;
 }
-#endif
 
 int
 hns3_rx_check_vec_support(struct rte_eth_dev *dev)
 {
-#ifndef RTE_LIBRTE_IEEE1588
        struct rte_fdir_conf *fconf = &dev->data->dev_conf.fdir_conf;
        struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
        uint64_t offloads_mask = DEV_RX_OFFLOAD_TCP_LRO |
                                 DEV_RX_OFFLOAD_VLAN;
 
+       struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+       if (hns3_dev_ptp_supported(hw))
+               return -ENOTSUP;
+
        if (dev->data->scattered_rx)
                return -ENOTSUP;
 
@@ -207,8 +234,4 @@ hns3_rx_check_vec_support(struct rte_eth_dev *dev)
                return -ENOTSUP;
 
        return 0;
-#else
-       RTE_SET_USED(dev);
-       return -ENOTSUP;
-#endif
 }