diff options
author | merge <null@invalid> | 2009-01-22 13:55:32 +0000 |
---|---|---|
committer | Andy Green <agreen@octopus.localdomain> | 2009-01-22 13:55:32 +0000 |
commit | aa6f5ffbdba45aa8e19e5048648fc6c7b25376d3 (patch) | |
tree | fbb786d0ac6f8a774fd834e9ce951197e60fbffa /drivers/staging/otus/wrap_buf.c | |
parent | f2d78193eae5dccd3d588d2c8ea0866efc368332 (diff) |
MERGE-via-pending-tracking-hist-MERGE-via-stable-tracking-MERGE-via-mokopatches-tracking-fix-stray-endmenu-patch-1232632040-1232632141
pending-tracking-hist top was MERGE-via-stable-tracking-MERGE-via-mokopatches-tracking-fix-stray-endmenu-patch-1232632040-1232632141 / fdf777a63bcb59e0dfd78bfe2c6242e01f6d4eb9 ... parent commitmessage:
From: merge <null@invalid>
MERGE-via-stable-tracking-hist-MERGE-via-mokopatches-tracking-fix-stray-endmenu-patch-1232632040
stable-tracking-hist top was MERGE-via-mokopatches-tracking-fix-stray-endmenu-patch-1232632040 / 90463bfd2d5a3c8b52f6e6d71024a00e052b0ced ... parent commitmessage:
From: merge <null@invalid>
MERGE-via-mokopatches-tracking-hist-fix-stray-endmenu-patch
mokopatches-tracking-hist top was fix-stray-endmenu-patch / 3630e0be570de8057e7f8d2fe501ed353cdf34e6 ... parent commitmessage:
From: Andy Green <andy@openmoko.com>
fix-stray-endmenu.patch
Signed-off-by: Andy Green <andy@openmoko.com>
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 00000000000..62496a0f8e3 --- /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) +{ +} |