1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2018 Aquantia Corporation 3 */ 4 5 #ifndef _ATLANTIC_ETHDEV_H_ 6 #define _ATLANTIC_ETHDEV_H_ 7 #include <rte_errno.h> 8 #include "rte_ethdev.h" 9 10 #include "atl_types.h" 11 #include "hw_atl/hw_atl_utils.h" 12 13 #define ATL_RSS_OFFLOAD_ALL ( \ 14 RTE_ETH_RSS_IPV4 | \ 15 RTE_ETH_RSS_NONFRAG_IPV4_TCP | \ 16 RTE_ETH_RSS_NONFRAG_IPV4_UDP | \ 17 RTE_ETH_RSS_IPV6 | \ 18 RTE_ETH_RSS_NONFRAG_IPV6_TCP | \ 19 RTE_ETH_RSS_NONFRAG_IPV6_UDP | \ 20 RTE_ETH_RSS_IPV6_EX | \ 21 RTE_ETH_RSS_IPV6_TCP_EX | \ 22 RTE_ETH_RSS_IPV6_UDP_EX) 23 24 #define ATL_DEV_PRIVATE_TO_HW(adapter) \ 25 (&((struct atl_adapter *)adapter)->hw) 26 27 #define ATL_DEV_TO_ADAPTER(dev) \ 28 ((struct atl_adapter *)(dev)->data->dev_private) 29 30 #define ATL_DEV_PRIVATE_TO_INTR(adapter) \ 31 (&((struct atl_adapter *)adapter)->intr) 32 33 #define ATL_DEV_PRIVATE_TO_CFG(adapter) \ 34 (&((struct atl_adapter *)adapter)->hw_cfg) 35 36 #define ATL_FLAG_NEED_LINK_UPDATE (uint32_t)(1 << 0) 37 #define ATL_FLAG_MACSEC (uint32_t)(4 << 0) 38 39 struct atl_interrupt { 40 uint32_t flags; 41 uint32_t mask; 42 }; 43 44 /* 45 * Structure to store private data for each driver instance (for each port). 46 */ 47 struct atl_adapter { 48 struct aq_hw_s hw; 49 struct aq_hw_cfg_s hw_cfg; 50 struct atl_sw_stats sw_stats; 51 struct atl_interrupt intr; 52 }; 53 54 /* 55 * RX/TX function prototypes 56 */ 57 void atl_rx_queue_release(struct rte_eth_dev *dev, uint16_t rx_queue_id); 58 void atl_tx_queue_release(struct rte_eth_dev *dev, uint16_t tx_queue_id); 59 60 int atl_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id, 61 uint16_t nb_rx_desc, unsigned int socket_id, 62 const struct rte_eth_rxconf *rx_conf, 63 struct rte_mempool *mb_pool); 64 65 int atl_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id, 66 uint16_t nb_tx_desc, unsigned int socket_id, 67 const struct rte_eth_txconf *tx_conf); 68 69 uint32_t atl_rx_queue_count(void *rx_queue); 70 71 int atl_dev_rx_descriptor_status(void *rx_queue, uint16_t offset); 72 int atl_dev_tx_descriptor_status(void *tx_queue, uint16_t offset); 73 74 int atl_dev_rx_queue_intr_enable(struct rte_eth_dev *eth_dev, 75 uint16_t queue_id); 76 int atl_dev_rx_queue_intr_disable(struct rte_eth_dev *eth_dev, 77 uint16_t queue_id); 78 79 int atl_rx_init(struct rte_eth_dev *dev); 80 int atl_tx_init(struct rte_eth_dev *dev); 81 82 int atl_start_queues(struct rte_eth_dev *dev); 83 int atl_stop_queues(struct rte_eth_dev *dev); 84 void atl_free_queues(struct rte_eth_dev *dev); 85 86 int atl_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id); 87 int atl_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id); 88 89 int atl_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id); 90 int atl_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id); 91 92 void atl_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, 93 struct rte_eth_rxq_info *qinfo); 94 95 void atl_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, 96 struct rte_eth_txq_info *qinfo); 97 98 uint16_t atl_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, 99 uint16_t nb_pkts); 100 101 uint16_t atl_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, 102 uint16_t nb_pkts); 103 104 uint16_t atl_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, 105 uint16_t nb_pkts); 106 107 int atl_macsec_enable(struct rte_eth_dev *dev, uint8_t encr, uint8_t repl_prot); 108 int atl_macsec_disable(struct rte_eth_dev *dev); 109 int atl_macsec_config_txsc(struct rte_eth_dev *dev, uint8_t *mac); 110 int atl_macsec_config_rxsc(struct rte_eth_dev *dev, 111 uint8_t *mac, uint16_t pi); 112 int atl_macsec_select_txsa(struct rte_eth_dev *dev, uint8_t idx, 113 uint8_t an, uint32_t pn, uint8_t *key); 114 int atl_macsec_select_rxsa(struct rte_eth_dev *dev, uint8_t idx, 115 uint8_t an, uint32_t pn, uint8_t *key); 116 117 bool is_atlantic_supported(struct rte_eth_dev *dev); 118 119 #endif /* _ATLANTIC_ETHDEV_H_ */ 120