X-Git-Url: https://jxself.org/git/?p=open-ath9k-htc-firmware.git;a=blobdiff_plain;f=target_firmware%2Fmagpie_fw_dev%2Ftarget%2Finc%2Fmagpie%2Fadf_nbuf_pvt.h;h=9e21e17af164be445b44ee103a4d495df20e934d;hp=8c5f4063213d963ef0ea52c1b17d086fce49bb1e;hb=6f2219c1ab25d1dfbb5d2de6508212a27f9d7e9c;hpb=7f95fac61c96c91198ad65198c2fa30dfc936286 diff --git a/target_firmware/magpie_fw_dev/target/inc/magpie/adf_nbuf_pvt.h b/target_firmware/magpie_fw_dev/target/inc/magpie/adf_nbuf_pvt.h index 8c5f406..9e21e17 100755 --- a/target_firmware/magpie_fw_dev/target/inc/magpie/adf_nbuf_pvt.h +++ b/target_firmware/magpie_fw_dev/target/inc/magpie/adf_nbuf_pvt.h @@ -34,7 +34,7 @@ */ /* * (c) Copyright Atheros Communications - * FreeBSD specific prototypes + * FreeBSD specific prototypes */ #ifndef _ADF_NBUF_PVT_H #define _ADF_NBUF_PVT_H @@ -45,7 +45,7 @@ //#include #define __ADF_NBUF_NULL NULL -#define __ADF_NBUF_CTX_BUF +#define __ADF_NBUF_CTX_BUF typedef VBUF * __adf_nbuf_t; @@ -54,101 +54,101 @@ typedef VBUF * __adf_nbuf_t; */ typedef struct __adf_nbuf_qhead { VBUF *head; - VBUF *tail; + VBUF *tail; a_uint32_t qlen; }__adf_nbuf_qhead_t; typedef __adf_nbuf_qhead_t __adf_nbuf_queue_t; -__adf_nbuf_t -__adf_nbuf_alloc(adf_os_size_t size, - a_uint32_t reserve, a_uint32_t align); +__adf_nbuf_t +__adf_nbuf_alloc(adf_os_size_t size, + a_uint32_t reserve, a_uint32_t align); -void +void __adf_nbuf_free(__adf_nbuf_t buf); #ifndef _ROM_ -a_uint8_t * +a_uint8_t * __adf_nbuf_push_head(__adf_nbuf_t buf, adf_os_size_t size); - -a_uint8_t * + +a_uint8_t * __adf_nbuf_pull_head(__adf_nbuf_t buf, adf_os_size_t size); -a_uint8_t * +a_uint8_t * __adf_nbuf_put_tail(__adf_nbuf_t buf, adf_os_size_t size); #endif -void +void __adf_nbuf_trim_tail(__adf_nbuf_t buf, adf_os_size_t size); -__adf_nbuf_t +__adf_nbuf_t __adf_nbuf_realloc_headroom(__adf_nbuf_t buf, - a_uint32_t headroom); - -__adf_nbuf_t -__adf_nbuf_realloc_tailroom(__adf_nbuf_t buf, + a_uint32_t headroom); + +__adf_nbuf_t +__adf_nbuf_realloc_tailroom(__adf_nbuf_t buf, a_uint32_t tailroom); - -__adf_nbuf_t + +__adf_nbuf_t __adf_nbuf_expand(__adf_nbuf_t buf, a_uint32_t headroom, a_uint32_t tailroom); - -__adf_nbuf_t + +__adf_nbuf_t __adf_nbuf_copy(__adf_nbuf_t src); -__adf_nbuf_t +__adf_nbuf_t __adf_nbuf_unshare(__adf_nbuf_t src); -void +void __adf_nbuf_frag_info(__adf_nbuf_t buf, adf_os_sglist_t *sg); #ifndef _ROM_ -a_uint8_t * +a_uint8_t * __adf_nbuf_get_priv(__adf_nbuf_t buf); #endif -void -__adf_nbuf_queue_add(__adf_nbuf_qhead_t *qhead, +void +__adf_nbuf_queue_add(__adf_nbuf_qhead_t *qhead, __adf_nbuf_t buf); - -__adf_nbuf_t + +__adf_nbuf_t __adf_nbuf_queue_remove(__adf_nbuf_qhead_t *qhead); -a_uint32_t -__adf_nbuf_tx_cksum_info(__adf_nbuf_t buf, - a_uint8_t **hdr_off, +a_uint32_t +__adf_nbuf_tx_cksum_info(__adf_nbuf_t buf, + a_uint8_t **hdr_off, a_uint8_t **where); - -void + +void __adf_nbuf_set_rx_cksum(__adf_nbuf_t buf, adf_nbuf_rx_cksum_t *cksum); -void +void __adf_nbuf_get_tso_info(__adf_nbuf_t buf, adf_nbuf_tso_t *tso); -a_status_t -__adf_nbuf_get_vlan_info(adf_net_handle_t hdl, - __adf_nbuf_t buf, - adf_net_vlanhdr_t *vlan); - -void +a_status_t +__adf_nbuf_get_vlan_info(adf_net_handle_t hdl, + __adf_nbuf_t buf, + adf_net_vlanhdr_t *vlan); + +void __adf_nbuf_dmamap_info(__adf_os_dma_map_t bmap, adf_os_dmamap_info_t *sg); /** * @brief return the last mbuf - * + * * @param m0 - * + * * @return struct mbuf* */ #ifndef _ROM_ -VDESC * +VDESC * __adf_nbuf_last(VBUF *buf); #endif /** * @brief num bytes in the head - * + * * @param adf_nbuf - * + * * @return num of bytes available */ #ifndef _ROM_ @@ -159,23 +159,23 @@ __adf_nbuf_headroom(__adf_nbuf_t buf); /** * @brief num of bytes available in the tail excluding the priv * portion - * + * * @param adf_nbuf - * + * * @return num of bytes */ #ifndef _ROM_ -a_uint32_t +a_uint32_t __adf_nbuf_tailroom(__adf_nbuf_t buf); #endif /** * @brief get the entire packet length - * + * * @param adf_nbuf - * + * * @return total length of packet (sum of all frag lengths) - */ + */ #ifndef _ROM_ a_uint32_t __adf_nbuf_len(__adf_nbuf_t buf); @@ -183,12 +183,12 @@ __adf_nbuf_len(__adf_nbuf_t buf); /** * @brief Clone the nbuf (will not create writeable copies) - * + * * @param adf_nbuf - * + * * @return Read-only copy of the nbuf (including clusters) */ -__adf_nbuf_t +__adf_nbuf_t __adf_nbuf_clone(__adf_nbuf_t src); void @@ -197,9 +197,9 @@ __adf_nbuf_cat(__adf_nbuf_t dst, __adf_nbuf_t src); /* * @brief check if the mbuf is cloned or not - * + * * @param buf - * + * * @return a_bool_t */ a_bool_t @@ -210,7 +210,7 @@ __adf_nbuf_is_cloned(__adf_nbuf_t buf); */ #ifndef _ROM_ void -__adf_nbuf_peek_header(__adf_nbuf_t buf, a_uint8_t **addr, +__adf_nbuf_peek_header(__adf_nbuf_t buf, a_uint8_t **addr, a_uint32_t *len); #endif @@ -218,48 +218,48 @@ __adf_nbuf_peek_header(__adf_nbuf_t buf, a_uint8_t **addr, * @brief init the queue * @param qhead */ -void +void __adf_nbuf_queue_init(__adf_nbuf_qhead_t *qhead); /** * @brief return the length of queue * @param adf_qhead - * + * * @return length - * + * */ -a_uint32_t +a_uint32_t __adf_nbuf_queue_len(__adf_nbuf_qhead_t *qhead); /** * @brief returns the first guy in the Q * @param qhead - * + * * @return (NULL if the Q is empty) */ #ifndef _ROM_ -__adf_nbuf_t +__adf_nbuf_t __adf_nbuf_queue_first(__adf_nbuf_queue_t *qhead); /** * @brief return the next packet from packet chain - * + * * @param buf (packet) - * + * * @return (NULL if no packets are there) */ -__adf_nbuf_t +__adf_nbuf_t __adf_nbuf_queue_next(__adf_nbuf_t buf); #endif /** * @brief check if the queue is empty or not - * + * * @param qhead - * + * * @return a_bool_t */ -a_bool_t +a_bool_t __adf_nbuf_is_queue_empty(__adf_nbuf_qhead_t *qhead); __adf_nbuf_t @@ -273,42 +273,42 @@ __adf_nbuf_split_to_frag(__adf_nbuf_t buf, __adf_nbuf_queue_t *qhead); * @brief This will return the header's addr & m_len */ static inline void -__adf_nbuf_peek_header(__adf_nbuf_t buf, a_uint8_t **addr, +__adf_nbuf_peek_header(__adf_nbuf_t buf, a_uint8_t **addr, a_uint32_t *len) { VDESC *desc = buf->desc_list; - + *addr = desc->buf_addr + desc->data_offset; - *len = desc->data_size; + *len = desc->data_size; } /** * @brief return the last mbuf - * + * * @param m0 - * + * * @return struct mbuf* */ -static inline VDESC * +static inline VDESC * __adf_nbuf_last(VBUF *buf) { VDESC *desc = buf->desc_list; - + //for(; desc->next_desc != NULL; desc = desc->next_desc) // ; while(desc->next_desc != NULL) { desc = desc->next_desc; } - + return desc; } /** * @brief num bytes in the head - * + * * @param adf_nbuf - * + * * @return num of bytes available */ static inline a_uint32_t @@ -320,48 +320,48 @@ __adf_nbuf_headroom(__adf_nbuf_t buf) /** * @brief num of bytes available in the tail excluding the priv * portion - * + * * @param adf_nbuf - * + * * @return num of bytes */ -static inline a_uint32_t +static inline a_uint32_t __adf_nbuf_tailroom(__adf_nbuf_t buf) { VDESC *last_desc = __adf_nbuf_last(buf); - + return last_desc->buf_size - last_desc->data_offset - last_desc->data_size; } /** * @brief get the entire packet length - * + * * @param adf_nbuf - * + * * @return total length of packet (sum of all frag lengths) - */ + */ static inline a_uint32_t __adf_nbuf_len(__adf_nbuf_t buf) { - return buf->buf_length; + return buf->buf_length; } /** * @brief put data in the head - * + * * @param buf * @param len (how much data to put) - * + * * @return new data pointer ,NULL if the len is more than the * space available in the head frag. */ -static inline a_uint8_t * +static inline a_uint8_t * __adf_nbuf_push_head(__adf_nbuf_t buf, adf_os_size_t len) { - a_uint8_t *ptr = NULL; + a_uint8_t *ptr = NULL; VDESC *desc = buf->desc_list; - + desc->data_offset -= len; desc->data_size += len; buf->buf_length += len; @@ -370,12 +370,12 @@ __adf_nbuf_push_head(__adf_nbuf_t buf, adf_os_size_t len) } /** - * + * * @brief add data in the end of tail - * + * * @param buf * @param len (how much data to put) - * + * * @return previous tail (data+len),NULL if the len is more than * space available */ @@ -384,41 +384,41 @@ __adf_nbuf_put_tail(__adf_nbuf_t buf, adf_os_size_t len) { a_uint8_t *tail = NULL; VDESC *last_desc = __adf_nbuf_last(buf); - + tail = last_desc->buf_addr + last_desc->data_offset + last_desc->data_size; last_desc->data_size += len; buf->buf_length += len; - + return tail; } /** * @brief strip data from head - * + * * @param adf_nbuf * @param len (how much data to rip) - * + * * @return new data pointer */ -static inline a_uint8_t * +static inline a_uint8_t * __adf_nbuf_pull_head(__adf_nbuf_t buf, adf_os_size_t len) { a_uint8_t *ptr = NULL; VDESC *desc = buf->desc_list; - + desc->data_offset += len; desc->data_size -= len; buf->buf_length -= len; ptr = desc->buf_addr + desc->data_offset; - + return ptr; } /** * @brief retrieve the priv space pointer from nbuf - * + * * @param buf (nbuf to attach the priv space) - * + * * @return uint8_t* ( pointer to the data ) */ static inline a_uint8_t * @@ -432,22 +432,22 @@ __adf_nbuf_get_priv(__adf_nbuf_t buf) /** * @brief returns the first guy in the Q * @param qhead - * + * * @return (NULL if the Q is empty) */ -static inline __adf_nbuf_t +static inline __adf_nbuf_t __adf_nbuf_queue_first(__adf_nbuf_queue_t *qhead) { return qhead->head; } /** * @brief return the next packet from packet chain - * + * * @param buf (packet) - * + * * @return (NULL if no packets are there) */ -static inline __adf_nbuf_t +static inline __adf_nbuf_t __adf_nbuf_queue_next(__adf_nbuf_t buf) { return buf->next_buf;