diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2008-10-28 05:44:22 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-01-06 21:52:10 (GMT) |
commit | 4bd43f507c7e2f225f58235226a8381fd6bbff1a (patch) | |
tree | a603a8ecc7fbb98ad06a1eda170532f301df01b3 /drivers/staging/otus/wrap_buf.c | |
parent | e543c241412f5f68d6948968f1a6c2cbb5fad7ff (diff) | |
download | linux-fsl-qoriq-4bd43f507c7e2f225f58235226a8381fd6bbff1a.tar.xz |
Staging: add otus Atheros wireless network driver
Initial dump of the otus USB wireless network driver.
It builds properly, but a lot of work needs to be done cleaning
it up before it can be merged into the wireless driver tree.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/otus/wrap_buf.c')
-rw-r--r-- | drivers/staging/otus/wrap_buf.c | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/drivers/staging/otus/wrap_buf.c b/drivers/staging/otus/wrap_buf.c new file mode 100644 index 0000000..62496a0 --- /dev/null +++ b/drivers/staging/otus/wrap_buf.c @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2007-2008 Atheros Communications Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ +/* */ +/* Module Name : wrap_buf.c */ +/* */ +/* Abstract */ +/* This module contains wrapper functions for buffer management */ +/* */ +/* NOTES */ +/* Platform dependent. */ +/* */ +/************************************************************************/ + +#include "oal_dt.h" +#include "usbdrv.h" + + +#include <linux/netlink.h> + +#if WIRELESS_EXT > 12 +#include <net/iw_handler.h> +#endif + + + +/* Called to allocate buffer, must return a continue buffer space */ +zbuf_t* zfwBufAllocate(zdev_t* dev, u16_t len) +{ + zbuf_t* buf; + + /* Allocate SKB for packet*/ + buf = dev_alloc_skb(len); + + return buf; +} + + +/* Called to free buffer, replace below 3 functions */ +void zfwBufFree(zdev_t* dev, zbuf_t* buf, u16_t status) +{ + dev_kfree_skb_any(buf); +} + +/* Called to adjust buffer size and head pointer */ +u16_t zfwBufRemoveHead(zdev_t* dev, zbuf_t* buf, u16_t size) +{ + //zm_assert(buf->len > size); + + buf->data += size; + buf->len -= size; + return 0; +} + + + + +/* return tail if head==NULL, called to chain multiple buffer together */ +/* Used to chain Rx buffer to form a frame. if the prepared Rx buffer */ +/* is greater than an ethernet frame(1518+32 byte), then this function */ +/* will only be called with head=NULL. */ +u16_t zfwBufChain(zdev_t* dev, zbuf_t** head, zbuf_t* tail) +{ + + *head = tail; + return 0; +} + + +/* Called when doing infra-bss forwarding */ +u16_t zfwBufCopy(zdev_t* dev, zbuf_t* dst, zbuf_t* src) +{ + memcpy(dst->data, src->data, src->len); + dst->tail = dst->data; + skb_put(dst, src->len); + return 0; +} + + +/* Called to adjust buffer size and tail pointer */ +u16_t zfwBufSetSize(zdev_t* dev, zbuf_t* buf, u16_t size) +{ +#ifdef NET_SKBUFF_DATA_USES_OFFSET + buf->tail = 0; + buf->len = 0; +#else + buf->tail = buf->data; + buf->len = 0; +#endif + + skb_put(buf, size); + return 0; +} + +u16_t zfwBufGetSize(zdev_t* dev, zbuf_t* buf) +{ + return buf->len; +} + +void zfwCopyBufContext(zdev_t* dev, zbuf_t* source, zbuf_t* dst) +{ +} |