2 * @ingroup adf_net_public
3 * @file adf_net_types.h
4 * This file defines types used in the networking stack abstraction.
7 #ifndef _ADF_NET_TYPES_H
8 #define _ADF_NET_TYPES_H
13 * @brief These control/get info from the device
15 #define ADF_NET_CMD(_x) \
16 ADF_NET_CMD_GET_##_x, \
20 * @brief Get/Set commands from anet to adf_drv
23 ADF_NET_CMD(LINK_INFO),
24 ADF_NET_CMD(POLL_INFO),
25 ADF_NET_CMD(CKSUM_INFO),
26 ADF_NET_CMD(RING_INFO),
27 ADF_NET_CMD(MAC_ADDR),
29 ADF_NET_CMD_GET_DMA_INFO,
30 ADF_NET_CMD_GET_OFFLOAD_CAP,
31 ADF_NET_CMD_GET_STATS,
34 ADF_NET_CMD_SET_MCAST,
35 ADF_NET_CMD_GET_MCAST_CAP
41 * @brief Indicates what features are supported by the interface.
43 #define ADF_NET_LINK_SUPP_10baseT_Half (1 << 0)
44 #define ADF_NET_LINK_SUPP_10baseT_Full (1 << 1)
45 #define ADF_NET_LINK_SUPP_100baseT_Half (1 << 2)
46 #define ADF_NET_LINK_SUPP_100baseT_Full (1 << 3)
47 #define ADF_NET_LINK_SUPP_1000baseT_Half (1 << 4)
48 #define ADF_NET_LINK_SUPP_1000baseT_Full (1 << 5)
49 #define ADF_NET_LINK_SUPP_Autoneg (1 << 6)
50 #define ADF_NET_LINK_SUPP_Pause (1 << 7)
51 #define ADF_NET_LINK_SUPP_Asym_Pause (1 << 8)
53 #define ADF_NET_LINK_SUPP_100 (ADF_NET_LINK_SUPP_10baseT_Half | \
54 ADF_NET_LINK_SUPP_10baseT_Full | \
55 ADF_NET_LINK_SUPP_100baseT_Half | \
56 ADF_NET_LINK_SUPP_100baseT_Full)
58 #define ADF_NET_LINK_SUPP_1000 (ADF_NET_LINK_SUPP_100 | \
59 ADF_NET_LINK_SUPP_1000baseT_Full)
62 * @brief Indicates what features are advertised by the interface.
64 #define ADF_NET_LINK_ADV_10baseT_Half (1 << 0)
65 #define ADF_NET_LINK_ADV_10baseT_Full (1 << 1)
66 #define ADF_NET_LINK_ADV_100baseT_Half (1 << 2)
67 #define ADF_NET_LINK_ADV_100baseT_Full (1 << 3)
68 #define ADF_NET_LINK_ADV_1000baseT_Half (1 << 4)
69 #define ADF_NET_LINK_ADV_1000baseT_Full (1 << 5)
70 #define ADF_NET_LINK_ADV_Autoneg (1 << 6)
71 #define ADF_NET_LINK_ADV_Pause (1 << 7)
72 #define ADF_NET_LINK_ADV_Asym_Pause (1 << 8)
74 #define ADF_NET_LINK_ADV_100 (ADF_NET_LINK_ADV_10baseT_Half | \
75 ADF_NET_LINK_ADV_10baseT_Full | \
76 ADF_NET_LINK_ADV_100baseT_Half | \
77 ADF_NET_LINK_ADV_100baseT_Full)
79 #define ADF_NET_LINK_ADV_1000 (ADF_NET_LINK_ADV_100 | \
80 ADF_NET_LINK_ADV_1000baseT_Full)
83 * @brief The forced/current speed/duplex/autoneg
85 #define ADF_NET_LINK_SPEED_10 10
86 #define ADF_NET_LINK_SPEED_100 100
87 #define ADF_NET_LINK_SPEED_1000 1000
89 #define ADF_NET_LINK_DUPLEX_HALF 0x00
90 #define ADF_NET_LINK_DUPLEX_FULL 0x01
92 #define ADF_NET_LINK_AUTONEG_DISABLE 0x00
93 #define ADF_NET_LINK_AUTONEG_ENABLE 0x01
95 #define ADF_NET_MAC_ADDR_MAX_LEN 6
96 #define ADF_NET_IF_NAME_SIZE 64
97 #define ADF_NET_ETH_LEN ADF_NET_MAC_ADDR_MAX_LEN
98 #define ADF_NET_MAX_MCAST_ADDR 128
101 * @brief link info capability/parameters for the device
102 * Note the flags below
105 a_uint32_t supported; /*RO Features this if supports*/
106 a_uint32_t advertized; /*Features this interface advertizes*/
107 a_int16_t speed; /*Force speed 10M, 100M, gigE*/
108 a_int8_t duplex; /*duplex full or half*/
109 a_uint8_t autoneg; /*Enabled/disable autoneg*/
110 }adf_net_cmd_link_info_t;
112 typedef struct adf_net_ethaddr{
113 a_uint8_t addr[ADF_NET_ETH_LEN];
116 a_uint8_t ether_dhost[ADF_NET_ETH_LEN]; /* destination eth addr */
117 a_uint8_t ether_shost[ADF_NET_ETH_LEN]; /* source ether addr */
118 a_uint16_t ether_type; /* packet type ID field */
122 #if defined (ADF_LITTLE_ENDIAN_MACHINE)
125 #elif defined (ADF_BIG_ENDIAN_MACHINE)
126 a_uint8_t ip_version:4,
135 a_uint16_t ip_frag_off;
141 /*The options start here. */
147 typedef struct adf_net_vlanhdr{
149 #if defined (ADF_LITTLE_ENDIAN_MACHINE)
150 a_uint16_t vid:12; /* Vlan id*/
151 a_uint8_t cfi:1; /* reserved for CFI, don't use*/
152 a_uint8_t prio:3; /* Priority*/
153 #elif defined (ADF_BIG_ENDIAN_MACHINE)
154 a_uint8_t prio:3; /* Priority*/
155 a_uint8_t cfi:1; /* reserved for CFI, don't use*/
156 a_uint16_t vid:12; /* Vlan id*/
162 typedef struct adf_net_vid{
163 #if defined (ADF_LITTLE_ENDIAN_MACHINE)
166 #elif defined (ADF_BIG_ENDIAN_MACHINE)
176 * @brief Command for setting ring paramters.
179 a_uint32_t rx_bufsize; /*Ro field. For shim's that maintain a pool*/
182 }adf_net_cmd_ring_info_t;
185 * @brief Whether the interface is polled or not. If so, the polling bias (number of
186 * packets it wants to process per invocation
191 }adf_net_cmd_poll_info_t;
194 * @brief Basic device info
197 a_uint8_t if_name[ADF_NET_IF_NAME_SIZE];
198 a_uint8_t dev_addr[ADF_NET_MAC_ADDR_MAX_LEN];
201 typedef struct adf_dma_info {
202 adf_os_dma_mask_t dma_mask;
203 a_uint32_t sg_nsegs; /**< scatter segments */
204 }adf_net_cmd_dma_info_t;
207 * @brief Defines the TX and RX checksumming capabilities/state of the device
208 * The actual checksum handling happens on an adf_nbuf
209 * If offload capability command not supported, all offloads are assumed to be
213 ADF_NET_CKSUM_NONE, /*Cannot do any checksum*/
214 ADF_NET_CKSUM_TCP_UDP_IPv4, /*tcp/udp on ipv4 with pseudo hdr*/
215 ADF_NET_CKSUM_TCP_UDP_IPv6, /*tcp/udp on ipv6*/
216 }adf_net_cksum_type_t;
219 adf_net_cksum_type_t tx_cksum;
220 adf_net_cksum_type_t rx_cksum;
221 }adf_net_cksum_info_t;
223 typedef adf_net_cksum_info_t adf_net_cmd_cksum_info_t; /*XXX needed?*/
226 * @brief Command for set/unset vid
228 typedef a_uint16_t adf_net_cmd_vid_t ; /*get/set vlan id*/
232 ADF_NET_TSO_IPV4, /**< for tsp ipv4 only*/
233 ADF_NET_TSO_ALL, /**< ip4 & ipv6*/
237 * @brief Command for getting offloading capabilities of a device
240 adf_net_cksum_info_t cksum_cap;
241 adf_net_tso_type_t tso;
242 a_uint8_t vlan_supported;
243 }adf_net_cmd_offload_cap_t;
246 * @brief Command for getting general stats from a device
249 a_uint32_t tx_packets; /**< total packets transmitted*/
250 a_uint32_t rx_packets; /**< total packets recieved*/
251 a_uint32_t tx_bytes; /**< total bytes transmitted*/
252 a_uint32_t rx_bytes; /**< total bytes recieved*/
253 a_uint32_t tx_dropped; /**< total tx dropped because of lack of buffers*/
254 a_uint32_t rx_dropped; /**< total rx dropped because of lack of buffers*/
255 a_uint32_t rx_errors; /**< bad packet recieved*/
256 a_uint32_t tx_errors; /**< transmisison problems*/
257 }adf_net_cmd_stats_t;
259 typedef enum adf_net_cmd_mcast_cap{
262 }adf_net_cmd_mcast_cap_t;
264 typedef struct adf_net_cmd_mcaddr{
265 a_uint32_t nelem; /**< No. of mcast addresses*/
266 adf_net_ethaddr_t mcast[ADF_NET_MAX_MCAST_ADDR];
267 }adf_net_cmd_mcaddr_t;
270 adf_net_cmd_link_info_t link_info;
271 adf_net_cmd_poll_info_t poll_info;
272 adf_net_cmd_cksum_info_t cksum_info;
273 adf_net_cmd_ring_info_t ring_info;
274 adf_net_cmd_dma_info_t dma_info;
275 adf_net_cmd_vid_t vid;
276 adf_net_cmd_offload_cap_t offload_cap;
277 adf_net_cmd_stats_t stats;
278 adf_net_cmd_mcaddr_t mcast_info;
279 adf_net_cmd_mcast_cap_t mcast_cap;
283 * @brief For polled devices, adf_drv responds with one of the following status in
288 ADF_NET_POLL_NOT_DONE,
290 }adf_net_poll_resp_t;
293 * @brief For recieve checksum API
296 ADF_NBUF_RX_CKSUM_NONE, /*device failed to ckecksum*/
297 ADF_NBUF_RX_CKSUM_HW, /*checksum successful and value returned*/
298 ADF_NBUF_RX_CKSUM_UNNECESSARY, /*cksum successful, no value*/
299 }adf_nbuf_rx_cksum_type_t;
302 adf_nbuf_rx_cksum_type_t result;
304 }adf_nbuf_rx_cksum_t;
307 * @brief For TCP large Segment Offload
310 adf_net_tso_type_t type;
316 * @brief Wireless events
317 * ADF_IEEE80211_ASSOC = station associate (bss mode)
318 * ADF_IEEE80211_REASSOC = station re-associate (bss mode)
319 * ADF_IEEE80211_DISASSOC = station disassociate (bss mode)
320 * ADF_IEEE80211_JOIN = station join (ap mode)
321 * ADF_IEEE80211_LEAVE = station leave (ap mode)
322 * ADF_IEEE80211_SCAN = scan complete, results available
323 * ADF_IEEE80211_REPLAY = sequence counter replay detected
324 * ADF_IEEE80211_MICHAEL = Michael MIC failure detected
325 * ADF_IEEE80211_REJOIN = station re-associate (ap mode)
326 * ADF_CUSTOM_PUSH_BUTTON =
328 typedef enum adf_net_wireless_events{
329 ADF_IEEE80211_ASSOC = __ADF_IEEE80211_ASSOC,
330 ADF_IEEE80211_REASSOC = __ADF_IEEE80211_REASSOC,
331 ADF_IEEE80211_DISASSOC = __ADF_IEEE80211_DISASSOC,
332 ADF_IEEE80211_JOIN = __ADF_IEEE80211_JOIN,
333 ADF_IEEE80211_LEAVE = __ADF_IEEE80211_LEAVE,
334 ADF_IEEE80211_SCAN = __ADF_IEEE80211_SCAN,
335 ADF_IEEE80211_REPLAY = __ADF_IEEE80211_REPLAY,
336 ADF_IEEE80211_MICHAEL = __ADF_IEEE80211_MICHAEL,
337 ADF_IEEE80211_REJOIN = __ADF_IEEE80211_REJOIN,
338 ADF_CUSTOM_PUSH_BUTTON = __ADF_CUSTOM_PUSH_BUTTON
339 }adf_net_wireless_event_t;
341 #endif /*_ADF_NET_TYPES_H*/