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 #define HNS3_CONVERT_TO_DECIMAL 10 13 #define HNS3_CONVERT_TO_HEXADECIMAL 16 14 15 enum { 16 HNS3_IO_FUNC_HINT_NONE = 0, 17 HNS3_IO_FUNC_HINT_VEC, 18 HNS3_IO_FUNC_HINT_SVE, 19 HNS3_IO_FUNC_HINT_SIMPLE, 20 HNS3_IO_FUNC_HINT_COMMON 21 }; 22 23 #define HNS3_DEVARG_RX_FUNC_HINT "rx_func_hint" 24 #define HNS3_DEVARG_TX_FUNC_HINT "tx_func_hint" 25 26 #define HNS3_DEVARG_DEV_CAPS_MASK "dev_caps_mask" 27 28 #define HNS3_DEVARG_MBX_TIME_LIMIT_MS "mbx_time_limit_ms" 29 30 #define MSEC_PER_SEC 1000L 31 #define USEC_PER_MSEC 1000L 32 33 int hns3_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version, 34 size_t fw_size); 35 int hns3_dev_infos_get(struct rte_eth_dev *eth_dev, 36 struct rte_eth_dev_info *info); 37 38 void hns3_clock_gettime(struct timeval *tv); 39 uint64_t hns3_clock_calctime_ms(struct timeval *tv); 40 uint64_t hns3_clock_gettime_ms(void); 41 42 void hns3_parse_devargs(struct rte_eth_dev *dev); 43 44 int hns3_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del); 45 int hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del); 46 int hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, 47 __rte_unused uint32_t idx, __rte_unused uint32_t pool); 48 49 void hns3_remove_mac_addr(struct rte_eth_dev *dev, uint32_t idx); 50 int hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev, 51 struct rte_ether_addr *mc_addr_set, 52 uint32_t nb_mc_addr); 53 void hns3_ether_format_addr(char *buf, uint16_t size, 54 const struct rte_ether_addr *ether_addr); 55 int hns3_init_mac_addrs(struct rte_eth_dev *dev); 56 57 int hns3_init_ring_with_vector(struct hns3_hw *hw); 58 int hns3_map_rx_interrupt(struct rte_eth_dev *dev); 59 void hns3_unmap_rx_interrupt(struct rte_eth_dev *dev); 60 int hns3_restore_rx_interrupt(struct hns3_hw *hw); 61 62 int hns3_get_pci_revision_id(struct hns3_hw *hw, uint8_t *revision_id); 63 64 #endif /* _HNS3_COMMON_H_ */ 65