first public release
[dpdk.git] / lib / librte_pmd_igb / e1000_ethdev.h
1 /*-
2  *   BSD LICENSE
3  * 
4  *   Copyright(c) 2010-2012 Intel Corporation. All rights reserved.
5  *   All rights reserved.
6  * 
7  *   Redistribution and use in source and binary forms, with or without 
8  *   modification, are permitted provided that the following conditions 
9  *   are met:
10  * 
11  *     * Redistributions of source code must retain the above copyright 
12  *       notice, this list of conditions and the following disclaimer.
13  *     * Redistributions in binary form must reproduce the above copyright 
14  *       notice, this list of conditions and the following disclaimer in 
15  *       the documentation and/or other materials provided with the 
16  *       distribution.
17  *     * Neither the name of Intel Corporation nor the names of its 
18  *       contributors may be used to endorse or promote products derived 
19  *       from this software without specific prior written permission.
20  * 
21  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
22  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
23  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
24  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
25  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
26  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
27  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
28  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
29  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
30  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
31  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  * 
33  *  version: DPDK.L.1.2.3-3
34  */
35
36 #ifndef _E1000_ETHDEV_H_
37 #define _E1000_ETHDEV_H_
38
39 /* need update link, bit flag */
40 #define E1000_FLAG_NEED_LINK_UPDATE (uint32_t)(1 << 0)
41
42 /*
43  * Defines that were not part of e1000_hw.h as they are not used by the FreeBSD
44  * driver.
45  */
46 #define E1000_ADVTXD_POPTS_TXSM     0x00000200 /* L4 Checksum offload request */
47 #define E1000_ADVTXD_POPTS_IXSM     0x00000100 /* IP Checksum offload request */
48 #define E1000_ADVTXD_TUCMD_L4T_RSV  0x00001800 /* L4 Packet TYPE of Reserved */
49 #define E1000_RXD_STAT_TMST         0x10000    /* Timestamped Packet indication */
50 #define E1000_RXD_ERR_CKSUM_BIT     29 
51 #define E1000_RXD_ERR_CKSUM_MSK     3
52 #define E1000_ADVTXD_MACLEN_SHIFT   9          /* Bit shift for l2_len */
53
54 #define E1000_VFTA_SIZE 128
55
56 /* structure for interrupt relative data */
57 struct e1000_interrupt {
58         uint32_t flags;
59 };
60
61 /* local vfta copy */
62 struct e1000_vfta {
63         uint32_t vfta[E1000_VFTA_SIZE];
64 };
65
66 /*
67  * Structure to store private data for each driver instance (for each port).
68  */
69 struct e1000_adapter {
70         struct e1000_hw         hw;
71         struct e1000_hw_stats   stats;
72         struct e1000_interrupt  intr;
73         struct e1000_vfta       shadow_vfta;
74 };
75
76 #define E1000_DEV_PRIVATE_TO_HW(adapter) \
77         (&((struct e1000_adapter *)adapter)->hw)
78
79 #define E1000_DEV_PRIVATE_TO_STATS(adapter) \
80         (&((struct e1000_adapter *)adapter)->stats)
81
82 #define E1000_DEV_PRIVATE_TO_INTR(adapter) \
83         (&((struct e1000_adapter *)adapter)->intr)
84
85 #define E1000_DEV_PRIVATE_TO_VFTA(adapter) \
86         (&((struct e1000_adapter *)adapter)->shadow_vfta)
87
88 /*
89  * RX/TX function prototypes
90  */
91 int igb_dev_tx_queue_alloc(struct rte_eth_dev *dev, uint16_t nb_queues);
92 int igb_dev_rx_queue_alloc(struct rte_eth_dev *dev, uint16_t nb_queues);
93 void igb_dev_clear_queues(struct rte_eth_dev *dev);
94
95 int eth_igb_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
96                 uint16_t nb_rx_desc, unsigned int socket_id,
97                 const struct rte_eth_rxconf *rx_conf,
98                 struct rte_mempool *mb_pool);
99
100 int eth_igb_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
101                 uint16_t nb_tx_desc, unsigned int socket_id,
102                 const struct rte_eth_txconf *tx_conf);
103
104 int eth_igb_rx_init(struct rte_eth_dev *dev);
105
106 void eth_igb_tx_init(struct rte_eth_dev *dev);
107
108 uint16_t eth_igb_xmit_pkts(struct igb_tx_queue *txq, struct rte_mbuf **tx_pkts,
109                 uint16_t nb_pkts);
110
111 uint16_t eth_igb_recv_pkts(struct igb_rx_queue *rxq, struct rte_mbuf **rx_pkts,
112                 uint16_t nb_pkts);
113
114 uint16_t eth_igb_recv_scattered_pkts(struct igb_rx_queue *rxq,
115                 struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
116
117 #endif /* _E1000_ETHDEV_H_ */