2 * Copyright (c) 2007-2008 Atheros Communications Inc.
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 /* Module Name : wrap_pkt.c */
20 /* This module contains wrapper functions for packet handling */
23 /* Platform dependent. */
25 /************************************************************************/
30 #include <linux/netlink.h>
31 #include <net/iw_handler.h>
34 /* extern struct zsWdsStruct wds[ZM_WDS_PORT_NUMBER]; */
35 extern struct zsVapStruct vap[ZM_VAP_PORT_NUMBER];
39 void zfLnxRecv80211(zdev_t *dev, zbuf_t *buf, struct zsAdditionInfo *addInfo)
45 struct usbdrv_private *macp = dev->ml_priv;
47 /* frameCtrl = zmw_buf_readb(dev, buf, 0); */
48 frameCtrl = *(u8_t *)((u8_t *)buf->data);
49 frameType = frameCtrl & 0xf;
50 frameSubtype = frameCtrl & 0xf0;
52 if ((frameType == 0x0) && (macp->forwardMgmt)) {
53 switch (frameSubtype) {
58 skb1 = skb_copy(buf, GFP_ATOMIC);
61 skb_reset_mac_header(skb1);
62 skb1->ip_summed = CHECKSUM_NONE;
63 skb1->pkt_type = PACKET_OTHERHOST;
65 skb1->protocol = __constant_htons(0x0019);
74 zfiRecv80211(dev, buf, addInfo);
78 #define ZM_AVOID_UDP_LARGE_PACKET_FAIL
79 void zfLnxRecvEth(zdev_t *dev, zbuf_t *buf, u16_t port)
81 struct usbdrv_private *macp = dev->ml_priv;
82 #ifdef ZM_AVOID_UDP_LARGE_PACKET_FAIL
85 /* new_buf = dev_alloc_skb(2048); */
86 new_buf = dev_alloc_skb(buf->len);
88 skb_reset_tail_pointer(new_buf);
90 skb_put(new_buf, buf->len);
91 memcpy(new_buf->data, buf->data, buf->len);
94 dev_kfree_skb_any(buf);
98 new_buf->protocol = eth_type_trans(new_buf, dev);
101 if (vap[0].dev != NULL) {
102 new_buf->dev = vap[0].dev;
103 new_buf->protocol = eth_type_trans(new_buf, vap[0].dev);
106 new_buf->protocol = eth_type_trans(new_buf, dev);
110 new_buf->ip_summed = CHECKSUM_NONE;
111 dev->last_rx = jiffies;
113 switch (netif_rx(new_buf))
117 buf->protocol = eth_type_trans(buf, dev);
120 if (vap[0].dev != NULL) {
121 buf->dev = vap[0].dev;
122 buf->protocol = eth_type_trans(buf, vap[0].dev);
125 buf->protocol = eth_type_trans(buf, dev);
129 buf->ip_summed = CHECKSUM_NONE;
130 dev->last_rx = jiffies;
132 switch (netif_rx(buf))
138 macp->drv_stats.net_stats.rx_packets++;
139 macp->drv_stats.net_stats.rx_bytes += buf->len;
146 /* Leave an empty line below to remove warning message on some compiler */