projects
/
open-ath9k-htc-firmware.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #106 from olerem/clean-2016.10.15
[open-ath9k-htc-firmware.git]
/
target_firmware
/
magpie_fw_dev
/
target
/
inc
/
magpie
/
adf_nbuf_pvt.h
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 8c5f4063213d963ef0ea52c1b17d086fce49bb1e..9e21e17af164be445b44ee103a4d495df20e934d 100755
(executable)
--- 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
*/
/*
* (c) Copyright Atheros Communications
- * FreeBSD specific prototypes
+ * FreeBSD specific prototypes
*/
#ifndef _ADF_NBUF_PVT_H
#define _ADF_NBUF_PVT_H
*/
#ifndef _ADF_NBUF_PVT_H
#define _ADF_NBUF_PVT_H
@@
-45,7
+45,7
@@
//#include <adf_nbuf_api.h>
#define __ADF_NBUF_NULL NULL
//#include <adf_nbuf_api.h>
#define __ADF_NBUF_NULL NULL
-#define __ADF_NBUF_CTX_BUF
+#define __ADF_NBUF_CTX_BUF
typedef VBUF * __adf_nbuf_t;
typedef VBUF * __adf_nbuf_t;
@@
-54,101
+54,101
@@
typedef VBUF * __adf_nbuf_t;
*/
typedef struct __adf_nbuf_qhead {
VBUF *head;
*/
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;
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_
__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);
__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);
__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
__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_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,
__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);
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_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_copy(__adf_nbuf_t src);
-__adf_nbuf_t
+__adf_nbuf_t
__adf_nbuf_unshare(__adf_nbuf_t src);
__adf_nbuf_unshare(__adf_nbuf_t src);
-void
+void
__adf_nbuf_frag_info(__adf_nbuf_t buf, adf_os_sglist_t *sg);
#ifndef _ROM_
__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
__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 buf);
-
-__adf_nbuf_t
+
+__adf_nbuf_t
__adf_nbuf_queue_remove(__adf_nbuf_qhead_t *qhead);
__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);
a_uint8_t **where);
-
-void
+
+void
__adf_nbuf_set_rx_cksum(__adf_nbuf_t buf, adf_nbuf_rx_cksum_t *cksum);
__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);
__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
__adf_nbuf_dmamap_info(__adf_os_dma_map_t bmap, adf_os_dmamap_info_t *sg);
/**
* @brief return the last mbuf
- *
+ *
* @param m0
* @param m0
- *
+ *
* @return struct mbuf*
*/
#ifndef _ROM_
* @return struct mbuf*
*/
#ifndef _ROM_
-VDESC *
+VDESC *
__adf_nbuf_last(VBUF *buf);
#endif
/**
* @brief num bytes in the head
__adf_nbuf_last(VBUF *buf);
#endif
/**
* @brief num bytes in the head
- *
+ *
* @param adf_nbuf
* @param adf_nbuf
- *
+ *
* @return num of bytes available
*/
#ifndef _ROM_
* @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
/**
* @brief num of bytes available in the tail excluding the priv
* portion
- *
+ *
* @param adf_nbuf
* @param adf_nbuf
- *
+ *
* @return num of bytes
*/
#ifndef _ROM_
* @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
__adf_nbuf_tailroom(__adf_nbuf_t buf);
#endif
/**
* @brief get the entire packet length
- *
+ *
* @param adf_nbuf
* @param adf_nbuf
- *
+ *
* @return total length of packet (sum of all frag lengths)
* @return total length of packet (sum of all frag lengths)
- */
+ */
#ifndef _ROM_
a_uint32_t
__adf_nbuf_len(__adf_nbuf_t buf);
#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)
/**
* @brief Clone the nbuf (will not create writeable copies)
- *
+ *
* @param adf_nbuf
* @param adf_nbuf
- *
+ *
* @return Read-only copy of the nbuf (including clusters)
*/
* @return Read-only copy of the nbuf (including clusters)
*/
-__adf_nbuf_t
+__adf_nbuf_t
__adf_nbuf_clone(__adf_nbuf_t src);
void
__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
/*
* @brief check if the mbuf is cloned or not
- *
+ *
* @param buf
* @param buf
- *
+ *
* @return a_bool_t
*/
a_bool_t
* @return a_bool_t
*/
a_bool_t
@@
-210,7
+210,7
@@
__adf_nbuf_is_cloned(__adf_nbuf_t buf);
*/
#ifndef _ROM_
void
*/
#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
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
*/
* @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
__adf_nbuf_queue_init(__adf_nbuf_qhead_t *qhead);
/**
* @brief return the length of queue
* @param adf_qhead
- *
+ *
* @return length
* @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
__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_
* @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
__adf_nbuf_queue_first(__adf_nbuf_queue_t *qhead);
/**
* @brief return the next packet from packet chain
- *
+ *
* @param buf (packet)
* @param buf (packet)
- *
+ *
* @return (NULL if no packets are there)
*/
* @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
__adf_nbuf_queue_next(__adf_nbuf_t buf);
#endif
/**
* @brief check if the queue is empty or not
- *
+ *
* @param qhead
* @param qhead
- *
+ *
* @return a_bool_t
*/
* @return a_bool_t
*/
-a_bool_t
+a_bool_t
__adf_nbuf_is_queue_empty(__adf_nbuf_qhead_t *qhead);
__adf_nbuf_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
* @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;
a_uint32_t *len)
{
VDESC *desc = buf->desc_list;
-
+
*addr = desc->buf_addr + desc->data_offset;
*addr = desc->buf_addr + desc->data_offset;
- *len = desc->data_size;
+ *len = desc->data_size;
}
/**
* @brief return the last mbuf
}
/**
* @brief return the last mbuf
- *
+ *
* @param m0
* @param m0
- *
+ *
* @return struct mbuf*
*/
* @return struct mbuf*
*/
-static inline VDESC *
+static inline VDESC *
__adf_nbuf_last(VBUF *buf)
{
VDESC *desc = buf->desc_list;
__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;
}
//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
return desc;
}
/**
* @brief num bytes in the head
- *
+ *
* @param adf_nbuf
* @param adf_nbuf
- *
+ *
* @return num of bytes available
*/
static inline a_uint32_t
* @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
/**
* @brief num of bytes available in the tail excluding the priv
* portion
- *
+ *
* @param adf_nbuf
* @param adf_nbuf
- *
+ *
* @return num of bytes
*/
* @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);
__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
return last_desc->buf_size - last_desc->data_offset - last_desc->data_size;
}
/**
* @brief get the entire packet length
- *
+ *
* @param adf_nbuf
* @param adf_nbuf
- *
+ *
* @return total length of packet (sum of all frag lengths)
* @return total length of packet (sum of all frag lengths)
- */
+ */
static inline a_uint32_t
__adf_nbuf_len(__adf_nbuf_t buf)
{
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
}
/**
* @brief put data in the head
- *
+ *
* @param buf
* @param len (how much data to put)
* @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.
*/
* @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)
{
__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;
VDESC *desc = buf->desc_list;
-
+
desc->data_offset -= len;
desc->data_size += len;
buf->buf_length += len;
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
* @brief add data in the end of tail
- *
+ *
* @param buf
* @param len (how much data to put)
* @param buf
* @param len (how much data to put)
- *
+ *
* @return previous tail (data+len),NULL if the len is more than
* space available
*/
* @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);
{
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;
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
return tail;
}
/**
* @brief strip data from head
- *
+ *
* @param adf_nbuf
* @param len (how much data to rip)
* @param adf_nbuf
* @param len (how much data to rip)
- *
+ *
* @return new data pointer
*/
* @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;
__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;
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
return ptr;
}
/**
* @brief retrieve the priv space pointer from nbuf
- *
+ *
* @param buf (nbuf to attach the priv space)
* @param buf (nbuf to attach the priv space)
- *
+ *
* @return uint8_t* ( pointer to the data )
*/
static inline a_uint8_t *
* @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
/**
* @brief returns the first guy in the Q
* @param qhead
- *
+ *
* @return (NULL if the Q is empty)
*/
* @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
__adf_nbuf_queue_first(__adf_nbuf_queue_t *qhead)
{
return qhead->head;
}
/**
* @brief return the next packet from packet chain
- *
+ *
* @param buf (packet)
* @param buf (packet)
- *
+ *
* @return (NULL if no packets are there)
*/
* @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;
__adf_nbuf_queue_next(__adf_nbuf_t buf)
{
return buf->next_buf;