]> git.proxmox.com Git - ceph.git/blob - ceph/src/dpdk/drivers/net/bnx2x/bnx2x_rxtx.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / dpdk / drivers / net / bnx2x / bnx2x_rxtx.h
1 /*
2 * Copyright (c) 2013-2015 Brocade Communications Systems, Inc.
3 *
4 * Copyright (c) 2015 QLogic Corporation.
5 * All rights reserved.
6 * www.qlogic.com
7 *
8 * See LICENSE.bnx2x_pmd for copyright and licensing details.
9 */
10
11 #ifndef _BNX2X_RXTX_H_
12 #define _BNX2X_RXTX_H_
13
14 #define DEFAULT_TX_FREE_THRESH 512
15 #define RTE_PMD_BNX2X_TX_MAX_BURST 1
16
17 /**
18 * Structure associated with each descriptor of the RX ring of a RX queue.
19 */
20 struct bnx2x_rx_entry {
21 struct rte_mbuf *mbuf; /**< mbuf associated with RX descriptor. */
22 };
23
24 /**
25 * Structure associated with each RX queue.
26 */
27 struct bnx2x_rx_queue {
28 struct rte_mempool *mb_pool; /**< mbuf pool to populate RX ring. */
29 union eth_rx_cqe *cq_ring; /**< RCQ ring virtual address. */
30 uint64_t cq_ring_phys_addr; /**< RCQ ring DMA address. */
31 uint64_t *rx_ring; /**< RX ring virtual address. */
32 uint64_t rx_ring_phys_addr; /**< RX ring DMA address. */
33 struct rte_mbuf **sw_ring; /**< address of RX software ring. */
34 struct rte_mbuf *pkt_first_seg; /**< First segment of current packet. */
35 struct rte_mbuf *pkt_last_seg; /**< Last segment of current packet. */
36 uint16_t nb_cq_pages; /**< number of RCQ pages. */
37 uint16_t nb_rx_desc; /**< number of RX descriptors. */
38 uint16_t nb_rx_pages; /**< number of RX pages. */
39 uint16_t rx_bd_head; /**< Index of current rx bd. */
40 uint16_t rx_bd_tail; /**< Index of last rx bd. */
41 uint16_t rx_cq_head; /**< Index of current rcq bd. */
42 uint16_t rx_cq_tail; /**< Index of last rcq bd. */
43 uint16_t queue_id; /**< RX queue index. */
44 uint8_t port_id; /**< Device port identifier. */
45 struct bnx2x_softc *sc; /**< Ptr to dev_private data. */
46 };
47
48 /**
49 * Structure associated with each TX queue.
50 */
51 struct bnx2x_tx_queue {
52 /** TX ring virtual address. */
53 union eth_tx_bd_types *tx_ring; /**< TX ring virtual address. */
54 uint64_t tx_ring_phys_addr; /**< TX ring DMA address. */
55 struct rte_mbuf **sw_ring; /**< virtual address of SW ring. */
56 uint16_t tx_pkt_tail; /**< Index of current tx pkt. */
57 uint16_t tx_pkt_head; /**< Index of last pkt counted by txeof. */
58 uint16_t tx_bd_tail; /**< Index of current tx bd. */
59 uint16_t tx_bd_head; /**< Index of last bd counted by txeof. */
60 uint16_t nb_tx_desc; /**< number of TX descriptors. */
61 uint16_t tx_free_thresh; /**< minimum TX before freeing. */
62 uint16_t nb_tx_avail; /**< Number of TX descriptors available. */
63 uint16_t nb_tx_pages; /**< number of TX pages */
64 uint16_t queue_id; /**< TX queue index. */
65 uint8_t port_id; /**< Device port identifier. */
66 struct bnx2x_softc *sc; /**< Ptr to dev_private data */
67 };
68
69 int bnx2x_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
70 uint16_t nb_rx_desc, unsigned int socket_id,
71 const struct rte_eth_rxconf *rx_conf,
72 struct rte_mempool *mb_pool);
73
74 int bnx2x_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
75 uint16_t nb_tx_desc, unsigned int socket_id,
76 const struct rte_eth_txconf *tx_conf);
77
78 void bnx2x_dev_rx_queue_release(void *rxq);
79 void bnx2x_dev_tx_queue_release(void *txq);
80 int bnx2x_dev_rx_init(struct rte_eth_dev *dev);
81 void bnx2x_dev_clear_queues(struct rte_eth_dev *dev);
82
83 #endif /* _BNX2X_RXTX_H_ */