1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Aquantia Corporation
5 #ifndef _ATLANTIC_ETHDEV_H_
6 #define _ATLANTIC_ETHDEV_H_
8 #include "rte_ethdev.h"
10 #include "atl_types.h"
11 #include "hw_atl/hw_atl_utils.h"
13 #define ATL_RSS_OFFLOAD_ALL ( \
15 ETH_RSS_NONFRAG_IPV4_TCP | \
16 ETH_RSS_NONFRAG_IPV4_UDP | \
18 ETH_RSS_NONFRAG_IPV6_TCP | \
19 ETH_RSS_NONFRAG_IPV6_UDP | \
21 ETH_RSS_IPV6_TCP_EX | \
24 #define ATL_DEV_PRIVATE_TO_HW(adapter) \
25 (&((struct atl_adapter *)adapter)->hw)
27 #define ATL_DEV_TO_ADAPTER(dev) \
28 ((struct atl_adapter *)(dev)->data->dev_private)
30 #define ATL_DEV_PRIVATE_TO_INTR(adapter) \
31 (&((struct atl_adapter *)adapter)->intr)
33 #define ATL_DEV_PRIVATE_TO_CFG(adapter) \
34 (&((struct atl_adapter *)adapter)->hw_cfg)
36 #define ATL_FLAG_NEED_LINK_UPDATE (uint32_t)(1 << 0)
37 #define ATL_FLAG_MACSEC (uint32_t)(4 << 0)
39 struct atl_interrupt {
45 * Structure to store private data for each driver instance (for each port).
49 struct aq_hw_cfg_s hw_cfg;
50 struct atl_sw_stats sw_stats;
51 struct atl_interrupt intr;
55 * RX/TX function prototypes
57 void atl_rx_queue_release(void *rxq);
58 void atl_tx_queue_release(void *txq);
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);
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);
69 uint32_t atl_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id);
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);
74 int atl_dev_rx_queue_intr_enable(struct rte_eth_dev *eth_dev,
76 int atl_dev_rx_queue_intr_disable(struct rte_eth_dev *eth_dev,
79 int atl_rx_init(struct rte_eth_dev *dev);
80 int atl_tx_init(struct rte_eth_dev *dev);
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);
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);
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);
92 void atl_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
93 struct rte_eth_rxq_info *qinfo);
95 void atl_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
96 struct rte_eth_txq_info *qinfo);
98 uint16_t atl_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
101 uint16_t atl_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
104 uint16_t atl_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
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);
117 bool is_atlantic_supported(struct rte_eth_dev *dev);
119 #endif /* _ATLANTIC_ETHDEV_H_ */