net/atlantic: add link status and interrupt management
[dpdk.git] / drivers / net / atlantic / atl_ethdev.h
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_DEV_PRIVATE_TO_HW(adapter) \
14         (&((struct atl_adapter *)adapter)->hw)
15
16 #define ATL_DEV_TO_ADAPTER(dev) \
17         ((struct atl_adapter *)(dev)->data->dev_private)
18
19 #define ATL_DEV_PRIVATE_TO_INTR(adapter) \
20         (&((struct atl_adapter *)adapter)->intr)
21
22 #define ATL_FLAG_NEED_LINK_UPDATE (uint32_t)(1 << 0)
23 #define ATL_FLAG_NEED_LINK_CONFIG (uint32_t)(4 << 0)
24
25 struct atl_interrupt {
26         uint32_t flags;
27         uint32_t mask;
28 };
29
30 /*
31  * Structure to store private data for each driver instance (for each port).
32  */
33 struct atl_adapter {
34         struct aq_hw_s             hw;
35         struct aq_hw_cfg_s         hw_cfg;
36         struct atl_interrupt       intr;
37 };
38
39 /*
40  * RX/TX function prototypes
41  */
42 void atl_rx_queue_release(void *rxq);
43 void atl_tx_queue_release(void *txq);
44
45 int atl_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
46                 uint16_t nb_rx_desc, unsigned int socket_id,
47                 const struct rte_eth_rxconf *rx_conf,
48                 struct rte_mempool *mb_pool);
49
50 int atl_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
51                 uint16_t nb_tx_desc, unsigned int socket_id,
52                 const struct rte_eth_txconf *tx_conf);
53
54 int atl_dev_rx_queue_intr_enable(struct rte_eth_dev *eth_dev,
55                                  uint16_t queue_id);
56 int atl_dev_rx_queue_intr_disable(struct rte_eth_dev *eth_dev,
57                                   uint16_t queue_id);
58
59 int atl_rx_init(struct rte_eth_dev *dev);
60 int atl_tx_init(struct rte_eth_dev *dev);
61
62 int atl_start_queues(struct rte_eth_dev *dev);
63 int atl_stop_queues(struct rte_eth_dev *dev);
64 void atl_free_queues(struct rte_eth_dev *dev);
65
66 int atl_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
67 int atl_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
68
69 int atl_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
70 int atl_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
71
72 uint16_t atl_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
73                 uint16_t nb_pkts);
74
75 uint16_t atl_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
76                 uint16_t nb_pkts);
77
78 uint16_t atl_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
79                 uint16_t nb_pkts);
80
81 #endif /* _ATLANTIC_ETHDEV_H_ */