net/hns3: extract common code to its own file
[dpdk.git] / drivers / net / hns3 / hns3_common.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2021 HiSilicon Limited
3  */
4
5 #ifndef _HNS3_COMMON_H_
6 #define _HNS3_COMMON_H_
7
8 #include <sys/time.h>
9
10 #include "hns3_ethdev.h"
11
12 enum {
13         HNS3_IO_FUNC_HINT_NONE = 0,
14         HNS3_IO_FUNC_HINT_VEC,
15         HNS3_IO_FUNC_HINT_SVE,
16         HNS3_IO_FUNC_HINT_SIMPLE,
17         HNS3_IO_FUNC_HINT_COMMON
18 };
19
20 #define HNS3_DEVARG_RX_FUNC_HINT        "rx_func_hint"
21 #define HNS3_DEVARG_TX_FUNC_HINT        "tx_func_hint"
22
23 #define HNS3_DEVARG_DEV_CAPS_MASK       "dev_caps_mask"
24
25 #define HNS3_DEVARG_MBX_TIME_LIMIT_MS   "mbx_time_limit_ms"
26
27 #define MSEC_PER_SEC              1000L
28 #define USEC_PER_MSEC             1000L
29
30 void hns3_clock_gettime(struct timeval *tv);
31 uint64_t hns3_clock_calctime_ms(struct timeval *tv);
32 uint64_t hns3_clock_gettime_ms(void);
33
34 void hns3_parse_devargs(struct rte_eth_dev *dev);
35
36 int hns3_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del);
37 int hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del);
38 int hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
39                       __rte_unused uint32_t idx, __rte_unused uint32_t pool);
40
41 void hns3_remove_mac_addr(struct rte_eth_dev *dev, uint32_t idx);
42 int hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev,
43                               struct rte_ether_addr *mc_addr_set,
44                               uint32_t nb_mc_addr);
45 void hns3_ether_format_addr(char *buf, uint16_t size,
46                             const struct rte_ether_addr *ether_addr);
47
48 #endif /* _HNS3_COMMON_H_ */