net/hns3: support NEON Tx
[dpdk.git] / drivers / net / hns3 / hns3_rxtx_vec.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2020 Hisilicon Limited.
3  */
4
5 #include <rte_io.h>
6 #include <rte_ethdev_driver.h>
7
8 #include "hns3_ethdev.h"
9 #include "hns3_rxtx.h"
10 #include "hns3_rxtx_vec.h"
11
12 #if defined RTE_ARCH_ARM64
13 #include "hns3_rxtx_vec_neon.h"
14 #endif
15
16 int
17 hns3_tx_check_vec_support(struct rte_eth_dev *dev)
18 {
19         struct rte_eth_txmode *txmode = &dev->data->dev_conf.txmode;
20
21         /* Only support DEV_TX_OFFLOAD_MBUF_FAST_FREE */
22         if (txmode->offloads != DEV_TX_OFFLOAD_MBUF_FAST_FREE)
23                 return -ENOTSUP;
24
25         return 0;
26 }
27
28 uint16_t
29 hns3_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
30 {
31         struct hns3_tx_queue *txq = (struct hns3_tx_queue *)tx_queue;
32         uint16_t nb_tx = 0;
33
34         while (nb_pkts) {
35                 uint16_t ret, new_burst;
36
37                 new_burst = RTE_MIN(nb_pkts, txq->tx_rs_thresh);
38                 ret = hns3_xmit_fixed_burst_vec(tx_queue, &tx_pkts[nb_tx],
39                                                 new_burst);
40                 nb_tx += ret;
41                 nb_pkts -= ret;
42                 if (ret < new_burst)
43                         break;
44         }
45
46         return nb_tx;
47 }