2 * (c) Copyright Atheros Communications
3 * FreeBSD specific prototypes
5 #ifndef _ADF_NBUF_PVT_H
6 #define _ADF_NBUF_PVT_H
9 //#include <Magpie_api.h>
11 //#include <adf_nbuf_api.h>
13 #define __ADF_NBUF_NULL NULL
14 #define __ADF_NBUF_CTX_BUF
16 typedef VBUF * __adf_nbuf_t;
21 typedef struct __adf_nbuf_qhead {
27 typedef __adf_nbuf_qhead_t __adf_nbuf_queue_t;
30 __adf_nbuf_alloc(adf_os_size_t size,
31 a_uint32_t reserve, a_uint32_t align);
34 __adf_nbuf_free(__adf_nbuf_t buf);
37 __adf_nbuf_push_head(__adf_nbuf_t buf, adf_os_size_t size);
40 __adf_nbuf_pull_head(__adf_nbuf_t buf, adf_os_size_t size);
43 __adf_nbuf_put_tail(__adf_nbuf_t buf, adf_os_size_t size);
46 __adf_nbuf_trim_tail(__adf_nbuf_t buf, adf_os_size_t size);
49 __adf_nbuf_realloc_headroom(__adf_nbuf_t buf,
53 __adf_nbuf_realloc_tailroom(__adf_nbuf_t buf,
57 __adf_nbuf_expand(__adf_nbuf_t buf,
58 a_uint32_t headroom, a_uint32_t tailroom);
61 __adf_nbuf_copy(__adf_nbuf_t src);
64 __adf_nbuf_unshare(__adf_nbuf_t src);
67 __adf_nbuf_frag_info(__adf_nbuf_t buf, adf_os_sglist_t *sg);
70 __adf_nbuf_get_priv(__adf_nbuf_t buf);
72 __adf_nbuf_queue_add(__adf_nbuf_qhead_t *qhead,
76 __adf_nbuf_queue_remove(__adf_nbuf_qhead_t *qhead);
79 __adf_nbuf_tx_cksum_info(__adf_nbuf_t buf,
84 __adf_nbuf_set_rx_cksum(__adf_nbuf_t buf, adf_nbuf_rx_cksum_t *cksum);
86 __adf_nbuf_get_tso_info(__adf_nbuf_t buf, adf_nbuf_tso_t *tso);
89 __adf_nbuf_get_vlan_info(adf_net_handle_t hdl,
91 adf_net_vlanhdr_t *vlan);
94 __adf_nbuf_dmamap_info(__adf_os_dma_map_t bmap, adf_os_dmamap_info_t *sg);
97 * @brief return the last mbuf
101 * @return struct mbuf*
104 __adf_nbuf_last(VBUF *buf);
107 * @brief num bytes in the head
111 * @return num of bytes available
114 __adf_nbuf_headroom(__adf_nbuf_t buf);
117 * @brief num of bytes available in the tail excluding the priv
122 * @return num of bytes
126 __adf_nbuf_tailroom(__adf_nbuf_t buf);
129 * @brief get the entire packet length
133 * @return total length of packet (sum of all frag lengths)
136 __adf_nbuf_len(__adf_nbuf_t buf);
139 * @brief Clone the nbuf (will not create writeable copies)
143 * @return Read-only copy of the nbuf (including clusters)
146 __adf_nbuf_clone(__adf_nbuf_t src);
149 __adf_nbuf_cat(__adf_nbuf_t dst, __adf_nbuf_t src);
153 * @brief check if the mbuf is cloned or not
160 __adf_nbuf_is_cloned(__adf_nbuf_t buf);
163 * @brief This will return the header's addr & m_len
166 __adf_nbuf_peek_header(__adf_nbuf_t buf, a_uint8_t **addr,
170 * @brief init the queue
174 __adf_nbuf_queue_init(__adf_nbuf_qhead_t *qhead);
177 * @brief return the length of queue
184 __adf_nbuf_queue_len(__adf_nbuf_qhead_t *qhead);
187 * @brief returns the first guy in the Q
190 * @return (NULL if the Q is empty)
193 __adf_nbuf_queue_first(__adf_nbuf_queue_t *qhead);
196 * @brief return the next packet from packet chain
198 * @param buf (packet)
200 * @return (NULL if no packets are there)
203 __adf_nbuf_queue_next(__adf_nbuf_t buf);
206 * @brief check if the queue is empty or not
213 __adf_nbuf_is_queue_empty(__adf_nbuf_qhead_t *qhead);
216 __adf_nbuf_create_frm_frag(__adf_nbuf_queue_t *head);
218 __adf_nbuf_split_to_frag(__adf_nbuf_t buf, __adf_nbuf_queue_t *qhead);
220 a_status_t __adf_nbuf_dmamap_create(__adf_os_device_t osdev,
221 __adf_os_dma_map_t *dmap);
223 void __adf_nbuf_dmamap_destroy(__adf_os_device_t osdev,
224 __adf_os_dma_map_t dmap);
226 a_status_t __adf_nbuf_map(__adf_os_device_t osdev, __adf_os_dma_map_t dmap,
227 __adf_nbuf_t buf, adf_os_dma_dir_t dir);
228 void __adf_nbuf_unmap(__adf_os_device_t osdev, __adf_os_dma_map_t dmap,
229 adf_os_dma_dir_t dir);