X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=target_firmware%2Fmagpie_fw_dev%2Ftarget%2Finc%2Fadf_nbuf.h;h=8217326a057ecb64fa1c6df19a60c21fcc55e489;hb=4e416a7e642dfeabfd5b7c6ab393c47784d097c9;hp=5ef7d7f131ffe6060090ed8b0936a1de7d5d24b5;hpb=8804cc94e3b66550797279f540b960d18a78421f;p=open-ath9k-htc-firmware.git diff --git a/target_firmware/magpie_fw_dev/target/inc/adf_nbuf.h b/target_firmware/magpie_fw_dev/target/inc/adf_nbuf.h index 5ef7d7f..8217326 100755 --- a/target_firmware/magpie_fw_dev/target/inc/adf_nbuf.h +++ b/target_firmware/magpie_fw_dev/target/inc/adf_nbuf.h @@ -1,14 +1,46 @@ -/* (c) Copyright 2002 - 2008 Atheros Communications Inc. */ - +/* + * Copyright (c) 2013 Qualcomm Atheros, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted (subject to the limitations in the + * disclaimer below) provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Qualcomm Atheros nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE + * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT + * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ /** * @defgroup adf_nbuf_public network buffer API - */ + */ /** * @ingroup adf_nbuf_public * @file adf_nbuf.h * This file defines the network buffer abstraction. - */ + */ #ifndef _ADF_NBUF_H #define _ADF_NBUF_H @@ -43,10 +75,10 @@ typedef __adf_nbuf_queue_t adf_nbuf_queue_t; * - need space in adf_drv's software descriptor * - are typically created during adf_drv_create * - need to be created before any API(adf_nbuf_map) that uses them - * + * * @param[in] osdev os device * @param[out] dmap map handle - * + * * @return status of the operation */ static inline a_status_t @@ -59,7 +91,7 @@ adf_nbuf_dmamap_create(adf_os_device_t osdev, /** * @brief Delete a dmap map - * + * * @param[in] osdev os device * @param[in] dmap */ @@ -81,9 +113,9 @@ adf_nbuf_dmamap_destroy(adf_os_device_t osdev, adf_os_dma_map_t dmap) * @return status of the operation */ static inline a_status_t -adf_nbuf_map(adf_os_device_t osdev, - adf_os_dma_map_t bmap, - adf_nbuf_t buf, +adf_nbuf_map(adf_os_device_t osdev, + adf_os_dma_map_t bmap, + adf_nbuf_t buf, adf_os_dma_dir_t dir) { return __adf_nbuf_map(osdev, bmap, buf, dir); @@ -98,8 +130,8 @@ adf_nbuf_map(adf_os_device_t osdev, * @param[in] dir DMA direction */ static inline void -adf_nbuf_unmap(adf_os_device_t osdev, - adf_os_dma_map_t bmap, +adf_nbuf_unmap(adf_os_device_t osdev, + adf_os_dma_map_t bmap, adf_os_dma_dir_t dir) { __adf_nbuf_unmap(osdev, bmap, dir); @@ -107,7 +139,7 @@ adf_nbuf_unmap(adf_os_device_t osdev, /** * @brief returns information about the mapped buf - * + * * @param[in] bmap map handle * @param[out] sg map info */ @@ -130,14 +162,14 @@ adf_nbuf_dmamap_info(adf_os_dma_map_t bmap, adf_os_dmamap_info_t *sg) * The nbuf created is guarenteed to have only 1 physical segment * * @param[in] hdl platform device object - * @param[in] size data buffer size for this adf_nbuf including max header + * @param[in] size data buffer size for this adf_nbuf including max header * size * @param[in] reserve headroom to start with. * @param[in] align alignment for the start buffer. * * @return The new adf_nbuf instance or NULL if there's not enough memory. */ -static inline adf_nbuf_t +static inline adf_nbuf_t adf_nbuf_alloc(adf_os_size_t size, int reserve, int align) @@ -163,10 +195,10 @@ adf_nbuf_free(adf_nbuf_t buf) * buf. Note that this can allocate a new buffer, or * change geometry of the orignial buffer. The new buffer * is returned in the (new_buf). - * + * * @param[in] buf (older buffer) * @param[in] headroom - * + * * @return newly allocated buffer */ static inline adf_nbuf_t @@ -179,10 +211,10 @@ adf_nbuf_realloc_headroom(adf_nbuf_t buf, a_uint32_t headroom) /** * @brief expand the tailroom to the new tailroom, but the buffer * remains the same - * + * * @param[in] buf buffer * @param[in] tailroom new tailroom - * + * * @return expanded buffer or NULL on failure */ static inline adf_nbuf_t @@ -200,11 +232,11 @@ adf_nbuf_realloc_tailroom(adf_nbuf_t buf, a_uint32_t tailroom) * having an extra API is that some OS do this in more * optimized way, rather than calling realloc (head/tail) * back to back. - * + * * @param[in] buf buffer - * @param[in] headroom new headroom + * @param[in] headroom new headroom * @param[in] tailroom new tailroom - * + * * @return expanded buffer */ static inline adf_nbuf_t @@ -221,9 +253,9 @@ adf_nbuf_expand(adf_nbuf_t buf, a_uint32_t headroom, a_uint32_t tailroom) * effect, it also "linearizes" a buffer (which is * perhaps why you'll use it mostly). It creates a * writeable copy. - * + * * @param[in] buf source nbuf to copy from - * + * * @return the new nbuf */ static inline adf_nbuf_t @@ -236,10 +268,10 @@ adf_nbuf_copy(adf_nbuf_t buf) /** * @brief link two nbufs, the new buf is piggybacked into the * older one. - * + * * @param[in] dst buffer to piggyback into * @param[in] src buffer to put - * + * * @return status of the call */ static inline void @@ -251,12 +283,12 @@ adf_nbuf_cat(adf_nbuf_t dst,adf_nbuf_t src) /** * @brief clone the nbuf (copy is readonly) - * + * * @param[in] buf nbuf to clone from - * + * * @return cloned buffer */ -static inline adf_nbuf_t +static inline adf_nbuf_t adf_nbuf_clone(adf_nbuf_t buf) { return(__adf_nbuf_clone(buf)); @@ -269,12 +301,12 @@ adf_nbuf_clone(adf_nbuf_t buf) * other users.If the nbuf is a clone then this function * creates a new copy of the data. If the buffer is not * a clone the original buffer is returned. - * + * * @param[in] buf source nbuf to create a writable copy from - * + * * @return new buffer which is writeable */ -static inline adf_nbuf_t +static inline adf_nbuf_t adf_nbuf_unshare(adf_nbuf_t buf) { return(__adf_nbuf_unshare(buf)); @@ -290,9 +322,9 @@ adf_nbuf_unshare(adf_nbuf_t buf) /** * @brief return the amount of headroom int the current nbuf - * + * * @param[in] buf buffer - * + * * @return amount of head room */ static inline a_uint32_t @@ -304,10 +336,10 @@ adf_nbuf_headroom(adf_nbuf_t buf) /** * @brief return the amount of tail space available - * + * * @param[in] buf buffer - * - * @return amount of tail room + * + * @return amount of tail room */ static inline a_uint32_t adf_nbuf_tailroom(adf_nbuf_t buf) @@ -365,7 +397,7 @@ adf_nbuf_pull_head(adf_nbuf_t buf, adf_os_size_t size) /** - * + * * @brief trim data out from the end * * @param[in] buf buf instance @@ -395,9 +427,9 @@ adf_nbuf_len(adf_nbuf_t buf) /** * @brief test whether the nbuf is cloned or not - * + * * @param[in] buf buffer - * + * * @return TRUE if it is cloned, else FALSE */ static inline a_bool_t @@ -414,19 +446,19 @@ adf_nbuf_is_cloned(adf_nbuf_t buf) /** * @brief return the frag pointer & length of the frag - * + * * @param[in] buf buffer * @param[out] sg this will return all the frags of the nbuf - * + * */ -static inline void -adf_nbuf_frag_info(adf_nbuf_t buf, adf_os_sglist_t *sg) +static inline void +adf_nbuf_frag_info(adf_nbuf_t buf, adf_os_sglist_t *sg) { __adf_nbuf_frag_info(buf, sg); } /** * @brief return the data pointer & length of the header - * + * * @param[in] buf nbuf * @param[out] addr data pointer * @param[out] len length of the data @@ -443,9 +475,9 @@ adf_nbuf_peek_header(adf_nbuf_t buf, a_uint8_t **addr, a_uint32_t *len) /** * @brief get the priv pointer from the nbuf'f private space - * + * * @param[in] buf - * + * * @return data pointer to typecast into your priv structure */ static inline a_uint8_t * @@ -501,9 +533,9 @@ adf_nbuf_queue_remove(adf_nbuf_queue_t *head) /** * @brief get the length of the queue - * + * * @param[in] head buf queue head - * + * * @return length of the queue */ static inline a_uint32_t @@ -515,12 +547,12 @@ adf_nbuf_queue_len(adf_nbuf_queue_t *head) /** * @brief get the first guy/packet in the queue - * + * * @param[in] head buf queue head - * + * * @return first buffer in queue */ -static inline adf_nbuf_t +static inline adf_nbuf_t adf_nbuf_queue_first(adf_nbuf_queue_t *head) { return (__adf_nbuf_queue_first(head)); @@ -530,9 +562,9 @@ adf_nbuf_queue_first(adf_nbuf_queue_t *head) /** * @brief get the next guy/packet of the given buffer (or * packet) - * + * * @param[in] buf buffer - * + * * @return next buffer/packet */ static inline adf_nbuf_t @@ -544,7 +576,7 @@ adf_nbuf_queue_next(adf_nbuf_t buf) /** * @brief Check if the buf queue is empty - * + * * @param[in] nbq buf queue handle * * @return TRUE if queue is empty @@ -566,7 +598,7 @@ adf_nbuf_is_queue_empty(adf_nbuf_queue_t * nbq) /** * @brief Gets the tx checksumming to be performed on this buf - * + * * @param[in] buf buffer * @param[out] hdr_off the (tcp) header start * @param[out] where the checksum offset @@ -581,7 +613,7 @@ adf_nbuf_tx_cksum_info(adf_nbuf_t buf, a_uint8_t **hdr_off, a_uint8_t **where) /** * @brief Drivers that support hw checksumming use this to * indicate checksum info to the stack. - * + * * @param[in] buf buffer * @param[in] cksum checksum */ @@ -595,7 +627,7 @@ adf_nbuf_set_rx_cksum(adf_nbuf_t buf, adf_nbuf_rx_cksum_t *cksum) /** * @brief Drivers that are capable of TCP Large segment offload * use this to get the offload info out of an buf. - * + * * @param[in] buf buffer * @param[out] tso offload info */ @@ -615,16 +647,16 @@ adf_nbuf_set_vlan_info(adf_nbuf_t buf, adf_net_vlan_tag_t vlan_tag) /** * @brief This function extracts the vid & priority from an * nbuf - * - * + * + * * @param[in] hdl net handle * @param[in] buf buffer * @param[in] vlan vlan header - * + * * @return status of the operation */ static inline a_status_t -adf_nbuf_get_vlan_info(adf_net_handle_t hdl, adf_nbuf_t buf, +adf_nbuf_get_vlan_info(adf_net_handle_t hdl, adf_nbuf_t buf, adf_net_vlanhdr_t *vlan) { return __adf_nbuf_get_vlan_info(hdl, buf, vlan);