aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-05-08 05:48:30 -0400
committerDavid S. Miller <davem@davemloft.net>2009-05-08 05:48:30 -0400
commit22f6dacdfcfdc792d068e9c41234808860498d04 (patch)
tree281a7d476f256ea3e2f800177ba685b169cc0540 /drivers/net
parent928f308f556f4943e50c5064b546f47bce301f02 (diff)
parent9b05126baa146fc3f41360164141d4e1b3ea93c4 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: include/net/tcp.h
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/bnx2.c6
-rw-r--r--drivers/net/bonding/bond_alb.c12
-rw-r--r--drivers/net/e1000/e1000_main.c2
-rw-r--r--drivers/net/ehea/ehea.h2
-rw-r--r--drivers/net/ehea/ehea_main.c31
-rw-r--r--drivers/net/igb/igb_main.c12
-rw-r--r--drivers/net/usb/Kconfig14
-rw-r--r--drivers/net/usb/Makefile1
-rw-r--r--drivers/net/usb/cdc_eem.c381
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c21
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c1
11 files changed, 439 insertions, 44 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index d47839184a06..b0cb29d4cc01 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -54,8 +54,8 @@
54 54
55#define DRV_MODULE_NAME "bnx2" 55#define DRV_MODULE_NAME "bnx2"
56#define PFX DRV_MODULE_NAME ": " 56#define PFX DRV_MODULE_NAME ": "
57#define DRV_MODULE_VERSION "2.0.0" 57#define DRV_MODULE_VERSION "2.0.1"
58#define DRV_MODULE_RELDATE "April 2, 2009" 58#define DRV_MODULE_RELDATE "May 6, 2009"
59#define FW_MIPS_FILE_06 "bnx2/bnx2-mips-06-4.6.16.fw" 59#define FW_MIPS_FILE_06 "bnx2/bnx2-mips-06-4.6.16.fw"
60#define FW_RV2P_FILE_06 "bnx2/bnx2-rv2p-06-4.6.16.fw" 60#define FW_RV2P_FILE_06 "bnx2/bnx2-rv2p-06-4.6.16.fw"
61#define FW_MIPS_FILE_09 "bnx2/bnx2-mips-09-4.6.17.fw" 61#define FW_MIPS_FILE_09 "bnx2/bnx2-mips-09-4.6.17.fw"
@@ -2600,6 +2600,7 @@ bnx2_get_hw_tx_cons(struct bnx2_napi *bnapi)
2600 /* Tell compiler that status block fields can change. */ 2600 /* Tell compiler that status block fields can change. */
2601 barrier(); 2601 barrier();
2602 cons = *bnapi->hw_tx_cons_ptr; 2602 cons = *bnapi->hw_tx_cons_ptr;
2603 barrier();
2603 if (unlikely((cons & MAX_TX_DESC_CNT) == MAX_TX_DESC_CNT)) 2604 if (unlikely((cons & MAX_TX_DESC_CNT) == MAX_TX_DESC_CNT))
2604 cons++; 2605 cons++;
2605 return cons; 2606 return cons;
@@ -2879,6 +2880,7 @@ bnx2_get_hw_rx_cons(struct bnx2_napi *bnapi)
2879 /* Tell compiler that status block fields can change. */ 2880 /* Tell compiler that status block fields can change. */
2880 barrier(); 2881 barrier();
2881 cons = *bnapi->hw_rx_cons_ptr; 2882 cons = *bnapi->hw_rx_cons_ptr;
2883 barrier();
2882 if (unlikely((cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT)) 2884 if (unlikely((cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT))
2883 cons++; 2885 cons++;
2884 return cons; 2886 return cons;
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 553a89919778..46d312bedfb8 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -1706,10 +1706,8 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
1706 * Called with RTNL 1706 * Called with RTNL
1707 */ 1707 */
1708int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr) 1708int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr)
1709 __releases(&bond->curr_slave_lock)
1710 __releases(&bond->lock)
1711 __acquires(&bond->lock) 1709 __acquires(&bond->lock)
1712 __acquires(&bond->curr_slave_lock) 1710 __releases(&bond->lock)
1713{ 1711{
1714 struct bonding *bond = netdev_priv(bond_dev); 1712 struct bonding *bond = netdev_priv(bond_dev);
1715 struct sockaddr *sa = addr; 1713 struct sockaddr *sa = addr;
@@ -1745,9 +1743,6 @@ int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr)
1745 } 1743 }
1746 } 1744 }
1747 1745
1748 write_unlock_bh(&bond->curr_slave_lock);
1749 read_unlock(&bond->lock);
1750
1751 if (swap_slave) { 1746 if (swap_slave) {
1752 alb_swap_mac_addr(bond, swap_slave, bond->curr_active_slave); 1747 alb_swap_mac_addr(bond, swap_slave, bond->curr_active_slave);
1753 alb_fasten_mac_swap(bond, swap_slave, bond->curr_active_slave); 1748 alb_fasten_mac_swap(bond, swap_slave, bond->curr_active_slave);
@@ -1755,16 +1750,15 @@ int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr)
1755 alb_set_slave_mac_addr(bond->curr_active_slave, bond_dev->dev_addr, 1750 alb_set_slave_mac_addr(bond->curr_active_slave, bond_dev->dev_addr,
1756 bond->alb_info.rlb_enabled); 1751 bond->alb_info.rlb_enabled);
1757 1752
1753 read_lock(&bond->lock);
1758 alb_send_learning_packets(bond->curr_active_slave, bond_dev->dev_addr); 1754 alb_send_learning_packets(bond->curr_active_slave, bond_dev->dev_addr);
1759 if (bond->alb_info.rlb_enabled) { 1755 if (bond->alb_info.rlb_enabled) {
1760 /* inform clients mac address has changed */ 1756 /* inform clients mac address has changed */
1761 rlb_req_update_slave_clients(bond, bond->curr_active_slave); 1757 rlb_req_update_slave_clients(bond, bond->curr_active_slave);
1762 } 1758 }
1759 read_unlock(&bond->lock);
1763 } 1760 }
1764 1761
1765 read_lock(&bond->lock);
1766 write_lock_bh(&bond->curr_slave_lock);
1767
1768 return 0; 1762 return 0;
1769} 1763}
1770 1764
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index b455dca0901e..9a32d0c73cb3 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3741,7 +3741,7 @@ static irqreturn_t e1000_intr(int irq, void *data)
3741 struct e1000_hw *hw = &adapter->hw; 3741 struct e1000_hw *hw = &adapter->hw;
3742 u32 rctl, icr = er32(ICR); 3742 u32 rctl, icr = er32(ICR);
3743 3743
3744 if (unlikely((!icr) || test_bit(__E1000_RESETTING, &adapter->flags))) 3744 if (unlikely((!icr) || test_bit(__E1000_DOWN, &adapter->flags)))
3745 return IRQ_NONE; /* Not our interrupt */ 3745 return IRQ_NONE; /* Not our interrupt */
3746 3746
3747 /* IMS will not auto-mask if INT_ASSERTED is not set, and if it is 3747 /* IMS will not auto-mask if INT_ASSERTED is not set, and if it is
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 6e317caf429c..16a41389575a 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -40,7 +40,7 @@
40#include <asm/io.h> 40#include <asm/io.h>
41 41
42#define DRV_NAME "ehea" 42#define DRV_NAME "ehea"
43#define DRV_VERSION "EHEA_0100" 43#define DRV_VERSION "EHEA_0101"
44 44
45/* eHEA capability flags */ 45/* eHEA capability flags */
46#define DLPAR_PORT_ADD_REM 1 46#define DLPAR_PORT_ADD_REM 1
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 37a190d85fcd..147c4b088fb3 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -545,14 +545,17 @@ static inline struct sk_buff *get_skb_by_index(struct sk_buff **skb_array,
545 x &= (arr_len - 1); 545 x &= (arr_len - 1);
546 546
547 pref = skb_array[x]; 547 pref = skb_array[x];
548 prefetchw(pref); 548 if (pref) {
549 prefetchw(pref + EHEA_CACHE_LINE); 549 prefetchw(pref);
550 550 prefetchw(pref + EHEA_CACHE_LINE);
551 pref = (skb_array[x]->data); 551
552 prefetch(pref); 552 pref = (skb_array[x]->data);
553 prefetch(pref + EHEA_CACHE_LINE); 553 prefetch(pref);
554 prefetch(pref + EHEA_CACHE_LINE * 2); 554 prefetch(pref + EHEA_CACHE_LINE);
555 prefetch(pref + EHEA_CACHE_LINE * 3); 555 prefetch(pref + EHEA_CACHE_LINE * 2);
556 prefetch(pref + EHEA_CACHE_LINE * 3);
557 }
558
556 skb = skb_array[skb_index]; 559 skb = skb_array[skb_index];
557 skb_array[skb_index] = NULL; 560 skb_array[skb_index] = NULL;
558 return skb; 561 return skb;
@@ -569,12 +572,14 @@ static inline struct sk_buff *get_skb_by_index_ll(struct sk_buff **skb_array,
569 x &= (arr_len - 1); 572 x &= (arr_len - 1);
570 573
571 pref = skb_array[x]; 574 pref = skb_array[x];
572 prefetchw(pref); 575 if (pref) {
573 prefetchw(pref + EHEA_CACHE_LINE); 576 prefetchw(pref);
577 prefetchw(pref + EHEA_CACHE_LINE);
574 578
575 pref = (skb_array[x]->data); 579 pref = (skb_array[x]->data);
576 prefetchw(pref); 580 prefetchw(pref);
577 prefetchw(pref + EHEA_CACHE_LINE); 581 prefetchw(pref + EHEA_CACHE_LINE);
582 }
578 583
579 skb = skb_array[wqe_index]; 584 skb = skb_array[wqe_index];
580 skb_array[wqe_index] = NULL; 585 skb_array[wqe_index] = NULL;
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 8784c051707e..ffd731539997 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -2010,7 +2010,7 @@ static void igb_setup_rctl(struct igb_adapter *adapter)
2010 struct e1000_hw *hw = &adapter->hw; 2010 struct e1000_hw *hw = &adapter->hw;
2011 u32 rctl; 2011 u32 rctl;
2012 u32 srrctl = 0; 2012 u32 srrctl = 0;
2013 int i, j; 2013 int i;
2014 2014
2015 rctl = rd32(E1000_RCTL); 2015 rctl = rd32(E1000_RCTL);
2016 2016
@@ -2075,8 +2075,6 @@ static void igb_setup_rctl(struct igb_adapter *adapter)
2075 if (adapter->vfs_allocated_count) { 2075 if (adapter->vfs_allocated_count) {
2076 u32 vmolr; 2076 u32 vmolr;
2077 2077
2078 j = adapter->rx_ring[0].reg_idx;
2079
2080 /* set all queue drop enable bits */ 2078 /* set all queue drop enable bits */
2081 wr32(E1000_QDE, ALL_QUEUES); 2079 wr32(E1000_QDE, ALL_QUEUES);
2082 srrctl |= E1000_SRRCTL_DROP_EN; 2080 srrctl |= E1000_SRRCTL_DROP_EN;
@@ -2084,16 +2082,16 @@ static void igb_setup_rctl(struct igb_adapter *adapter)
2084 /* disable queue 0 to prevent tail write w/o re-config */ 2082 /* disable queue 0 to prevent tail write w/o re-config */
2085 wr32(E1000_RXDCTL(0), 0); 2083 wr32(E1000_RXDCTL(0), 0);
2086 2084
2087 vmolr = rd32(E1000_VMOLR(j)); 2085 vmolr = rd32(E1000_VMOLR(adapter->vfs_allocated_count));
2088 if (rctl & E1000_RCTL_LPE) 2086 if (rctl & E1000_RCTL_LPE)
2089 vmolr |= E1000_VMOLR_LPE; 2087 vmolr |= E1000_VMOLR_LPE;
2090 if (adapter->num_rx_queues > 0) 2088 if (adapter->num_rx_queues > 1)
2091 vmolr |= E1000_VMOLR_RSSE; 2089 vmolr |= E1000_VMOLR_RSSE;
2092 wr32(E1000_VMOLR(j), vmolr); 2090 wr32(E1000_VMOLR(adapter->vfs_allocated_count), vmolr);
2093 } 2091 }
2094 2092
2095 for (i = 0; i < adapter->num_rx_queues; i++) { 2093 for (i = 0; i < adapter->num_rx_queues; i++) {
2096 j = adapter->rx_ring[i].reg_idx; 2094 int j = adapter->rx_ring[i].reg_idx;
2097 wr32(E1000_SRRCTL(j), srrctl); 2095 wr32(E1000_SRRCTL(j), srrctl);
2098 } 2096 }
2099 2097
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index e00b5b1f6743..3717569828bf 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -180,6 +180,20 @@ config USB_NET_CDCETHER
180 IEEE 802 "local assignment" bit is set in the address, a "usbX" 180 IEEE 802 "local assignment" bit is set in the address, a "usbX"
181 name is used instead. 181 name is used instead.
182 182
183config USB_NET_CDC_EEM
184 tristate "CDC EEM support"
185 depends on USB_USBNET && EXPERIMENTAL
186 help
187 This option supports devices conforming to the Communication Device
188 Class (CDC) Ethernet Emulation Model, a specification that's easy to
189 implement in device firmware. The CDC EEM specifications are available
190 from <http://www.usb.org/>.
191
192 This driver creates an interface named "ethX", where X depends on
193 what other networking devices you have in use. However, if the
194 IEEE 802 "local assignment" bit is set in the address, a "usbX"
195 name is used instead.
196
183config USB_NET_DM9601 197config USB_NET_DM9601
184 tristate "Davicom DM9601 based USB 1.1 10/100 ethernet devices" 198 tristate "Davicom DM9601 based USB 1.1 10/100 ethernet devices"
185 depends on USB_USBNET 199 depends on USB_USBNET
diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile
index f4402a06e52c..b870b0b1cbe0 100644
--- a/drivers/net/usb/Makefile
+++ b/drivers/net/usb/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_USB_RTL8150) += rtl8150.o
9obj-$(CONFIG_USB_HSO) += hso.o 9obj-$(CONFIG_USB_HSO) += hso.o
10obj-$(CONFIG_USB_NET_AX8817X) += asix.o 10obj-$(CONFIG_USB_NET_AX8817X) += asix.o
11obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o 11obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o
12obj-$(CONFIG_USB_NET_CDC_EEM) += cdc_eem.o
12obj-$(CONFIG_USB_NET_DM9601) += dm9601.o 13obj-$(CONFIG_USB_NET_DM9601) += dm9601.o
13obj-$(CONFIG_USB_NET_SMSC95XX) += smsc95xx.o 14obj-$(CONFIG_USB_NET_SMSC95XX) += smsc95xx.o
14obj-$(CONFIG_USB_NET_GL620A) += gl620a.o 15obj-$(CONFIG_USB_NET_GL620A) += gl620a.o
diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c
new file mode 100644
index 000000000000..80e01778dd3b
--- /dev/null
+++ b/drivers/net/usb/cdc_eem.c
@@ -0,0 +1,381 @@
1/*
2 * USB CDC EEM network interface driver
3 * Copyright (C) 2009 Oberthur Technologies
4 * by Omar Laazimani, Olivier Condemine
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/module.h>
22#include <linux/init.h>
23#include <linux/netdevice.h>
24#include <linux/etherdevice.h>
25#include <linux/ctype.h>
26#include <linux/ethtool.h>
27#include <linux/workqueue.h>
28#include <linux/mii.h>
29#include <linux/usb.h>
30#include <linux/crc32.h>
31#include <linux/usb/cdc.h>
32#include <linux/usb/usbnet.h>
33
34
35/*
36 * This driver is an implementation of the CDC "Ethernet Emulation
37 * Model" (EEM) specification, which encapsulates Ethernet frames
38 * for transport over USB using a simpler USB device model than the
39 * previous CDC "Ethernet Control Model" (ECM, or "CDC Ethernet").
40 *
41 * For details, see www.usb.org/developers/devclass_docs/CDC_EEM10.pdf
42 *
43 * This version has been tested with GIGAntIC WuaoW SIM Smart Card on 2.6.24,
44 * 2.6.27 and 2.6.30rc2 kernel.
45 * It has also been validated on Openmoko Om 2008.12 (based on 2.6.24 kernel).
46 * build on 23-April-2009
47 */
48
49#define EEM_HEAD 2 /* 2 byte header */
50
51/*-------------------------------------------------------------------------*/
52
53static void eem_linkcmd_complete(struct urb *urb)
54{
55 dev_kfree_skb(urb->context);
56 usb_free_urb(urb);
57}
58
59static void eem_linkcmd(struct usbnet *dev, struct sk_buff *skb)
60{
61 struct urb *urb;
62 int status;
63
64 urb = usb_alloc_urb(0, GFP_ATOMIC);
65 if (!urb)
66 goto fail;
67
68 usb_fill_bulk_urb(urb, dev->udev, dev->out,
69 skb->data, skb->len, eem_linkcmd_complete, skb);
70
71 status = usb_submit_urb(urb, GFP_ATOMIC);
72 if (status) {
73 usb_free_urb(urb);
74fail:
75 dev_kfree_skb(skb);
76 devwarn(dev, "link cmd failure\n");
77 return;
78 }
79}
80
81static int eem_bind(struct usbnet *dev, struct usb_interface *intf)
82{
83 int status = 0;
84
85 status = usbnet_get_endpoints(dev, intf);
86 if (status < 0) {
87 usb_set_intfdata(intf, NULL);
88 usb_driver_release_interface(driver_of(intf), intf);
89 return status;
90 }
91
92 /* no jumbogram (16K) support for now */
93
94 dev->net->hard_header_len += EEM_HEAD + ETH_FCS_LEN;
95
96 return 0;
97}
98
99/*
100 * EEM permits packing multiple Ethernet frames into USB transfers
101 * (a "bundle"), but for TX we don't try to do that.
102 */
103static struct sk_buff *eem_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
104 gfp_t flags)
105{
106 struct sk_buff *skb2 = NULL;
107 u16 len = skb->len;
108 u32 crc = 0;
109 int padlen = 0;
110
111 /* When ((len + EEM_HEAD + ETH_FCS_LEN) % dev->maxpacket) is
112 * zero, stick two bytes of zero length EEM packet on the end.
113 * Else the framework would add invalid single byte padding,
114 * since it can't know whether ZLPs will be handled right by
115 * all the relevant hardware and software.
116 */
117 if (!((len + EEM_HEAD + ETH_FCS_LEN) % dev->maxpacket))
118 padlen += 2;
119
120 if (!skb_cloned(skb)) {
121 int headroom = skb_headroom(skb);
122 int tailroom = skb_tailroom(skb);
123
124 if ((tailroom >= ETH_FCS_LEN + padlen)
125 && (headroom >= EEM_HEAD))
126 goto done;
127
128 if ((headroom + tailroom)
129 > (EEM_HEAD + ETH_FCS_LEN + padlen)) {
130 skb->data = memmove(skb->head +
131 EEM_HEAD,
132 skb->data,
133 skb->len);
134 skb_set_tail_pointer(skb, len);
135 goto done;
136 }
137 }
138
139 skb2 = skb_copy_expand(skb, EEM_HEAD, ETH_FCS_LEN + padlen, flags);
140 if (!skb2)
141 return NULL;
142
143 dev_kfree_skb_any(skb);
144 skb = skb2;
145
146done:
147 /* we don't use the "no Ethernet CRC" option */
148 crc = crc32_le(~0, skb->data, skb->len);
149 crc = ~crc;
150
151 put_unaligned_le32(crc, skb_put(skb, 4));
152
153 /* EEM packet header format:
154 * b0..13: length of ethernet frame
155 * b14: bmCRC (1 == valid Ethernet CRC)
156 * b15: bmType (0 == data)
157 */
158 len = skb->len;
159 put_unaligned_le16(BIT(14) | len, skb_push(skb, 2));
160
161 /* Bundle a zero length EEM packet if needed */
162 if (padlen)
163 put_unaligned_le16(0, skb_put(skb, 2));
164
165 return skb;
166}
167
168static int eem_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
169{
170 /*
171 * Our task here is to strip off framing, leaving skb with one
172 * data frame for the usbnet framework code to process. But we
173 * may have received multiple EEM payloads, or command payloads.
174 * So we must process _everything_ as if it's a header, except
175 * maybe the last data payload
176 *
177 * REVISIT the framework needs updating so that when we consume
178 * all payloads (the last or only message was a command, or a
179 * zero length EEM packet) that is not accounted as an rx_error.
180 */
181 do {
182 struct sk_buff *skb2 = NULL;
183 u16 header;
184 u16 len = 0;
185
186 /* incomplete EEM header? */
187 if (skb->len < EEM_HEAD)
188 return 0;
189
190 /*
191 * EEM packet header format:
192 * b0..14: EEM type dependant (Data or Command)
193 * b15: bmType
194 */
195 header = get_unaligned_le16(skb->data);
196 skb_pull(skb, EEM_HEAD);
197
198 /*
199 * The bmType bit helps to denote when EEM
200 * packet is data or command :
201 * bmType = 0 : EEM data payload
202 * bmType = 1 : EEM (link) command
203 */
204 if (header & BIT(15)) {
205 u16 bmEEMCmd;
206
207 /*
208 * EEM (link) command packet:
209 * b0..10: bmEEMCmdParam
210 * b11..13: bmEEMCmd
211 * b14: bmReserved (must be 0)
212 * b15: 1 (EEM command)
213 */
214 if (header & BIT(14)) {
215 devdbg(dev, "reserved command %04x\n", header);
216 continue;
217 }
218
219 bmEEMCmd = (header >> 11) & 0x7;
220 switch (bmEEMCmd) {
221
222 /* Responding to echo requests is mandatory. */
223 case 0: /* Echo command */
224 len = header & 0x7FF;
225
226 /* bogus command? */
227 if (skb->len < len)
228 return 0;
229
230 skb2 = skb_clone(skb, GFP_ATOMIC);
231 if (unlikely(!skb2))
232 goto next;
233 skb_trim(skb2, len);
234 put_unaligned_le16(BIT(15) | (1 << 11) | len,
235 skb_push(skb2, 2));
236 eem_linkcmd(dev, skb2);
237 break;
238
239 /*
240 * Host may choose to ignore hints.
241 * - suspend: peripheral ready to suspend
242 * - response: suggest N millisec polling
243 * - response complete: suggest N sec polling
244 */
245 case 2: /* Suspend hint */
246 case 3: /* Response hint */
247 case 4: /* Response complete hint */
248 continue;
249
250 /*
251 * Hosts should never receive host-to-peripheral
252 * or reserved command codes; or responses to an
253 * echo command we didn't send.
254 */
255 case 1: /* Echo response */
256 case 5: /* Tickle */
257 default: /* reserved */
258 devwarn(dev, "unexpected link command %d\n",
259 bmEEMCmd);
260 continue;
261 }
262
263 } else {
264 u32 crc, crc2;
265 int is_last;
266
267 /* zero length EEM packet? */
268 if (header == 0)
269 continue;
270
271 /*
272 * EEM data packet header :
273 * b0..13: length of ethernet frame
274 * b14: bmCRC
275 * b15: 0 (EEM data)
276 */
277 len = header & 0x3FFF;
278
279 /* bogus EEM payload? */
280 if (skb->len < len)
281 return 0;
282
283 /* bogus ethernet frame? */
284 if (len < (ETH_HLEN + ETH_FCS_LEN))
285 goto next;
286
287 /*
288 * Treat the last payload differently: framework
289 * code expects our "fixup" to have stripped off
290 * headers, so "skb" is a data packet (or error).
291 * Else if it's not the last payload, keep "skb"
292 * for further processing.
293 */
294 is_last = (len == skb->len);
295 if (is_last)
296 skb2 = skb;
297 else {
298 skb2 = skb_clone(skb, GFP_ATOMIC);
299 if (unlikely(!skb2))
300 return 0;
301 }
302
303 crc = get_unaligned_le32(skb2->data
304 + len - ETH_FCS_LEN);
305 skb_trim(skb2, len - ETH_FCS_LEN);
306
307 /*
308 * The bmCRC helps to denote when the CRC field in
309 * the Ethernet frame contains a calculated CRC:
310 * bmCRC = 1 : CRC is calculated
311 * bmCRC = 0 : CRC = 0xDEADBEEF
312 */
313 if (header & BIT(14))
314 crc2 = ~crc32_le(~0, skb2->data, len);
315 else
316 crc2 = 0xdeadbeef;
317
318 if (is_last)
319 return crc == crc2;
320
321 if (unlikely(crc != crc2)) {
322 dev->stats.rx_errors++;
323 dev_kfree_skb_any(skb2);
324 } else
325 usbnet_skb_return(dev, skb2);
326 }
327
328next:
329 skb_pull(skb, len);
330 } while (skb->len);
331
332 return 1;
333}
334
335static const struct driver_info eem_info = {
336 .description = "CDC EEM Device",
337 .flags = FLAG_ETHER,
338 .bind = eem_bind,
339 .rx_fixup = eem_rx_fixup,
340 .tx_fixup = eem_tx_fixup,
341};
342
343/*-------------------------------------------------------------------------*/
344
345static const struct usb_device_id products[] = {
346{
347 USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_EEM,
348 USB_CDC_PROTO_EEM),
349 .driver_info = (unsigned long) &eem_info,
350},
351{
352 /* EMPTY == end of list */
353},
354};
355MODULE_DEVICE_TABLE(usb, products);
356
357static struct usb_driver eem_driver = {
358 .name = "cdc_eem",
359 .id_table = products,
360 .probe = usbnet_probe,
361 .disconnect = usbnet_disconnect,
362 .suspend = usbnet_suspend,
363 .resume = usbnet_resume,
364};
365
366
367static int __init eem_init(void)
368{
369 return usb_register(&eem_driver);
370}
371module_init(eem_init);
372
373static void __exit eem_exit(void)
374{
375 usb_deregister(&eem_driver);
376}
377module_exit(eem_exit);
378
379MODULE_AUTHOR("Omar Laazimani <omar.oberthur@gmail.com>");
380MODULE_DESCRIPTION("USB CDC EEM");
381MODULE_LICENSE("GPL");
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index 17a4dd2be1f2..0072ea2c5361 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -719,6 +719,14 @@ static int iwl_set_tkip_dynamic_key_info(struct iwl_priv *priv,
719{ 719{
720 unsigned long flags; 720 unsigned long flags;
721 int ret = 0; 721 int ret = 0;
722 __le16 key_flags = 0;
723
724 key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK);
725 key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
726 key_flags &= ~STA_KEY_FLG_INVALID;
727
728 if (sta_id == priv->hw_params.bcast_sta_id)
729 key_flags |= STA_KEY_MULTICAST_MSK;
722 730
723 keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 731 keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
724 keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; 732 keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
@@ -738,6 +746,9 @@ static int iwl_set_tkip_dynamic_key_info(struct iwl_priv *priv,
738 WARN(priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET, 746 WARN(priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET,
739 "no space for a new key"); 747 "no space for a new key");
740 748
749 priv->stations[sta_id].sta.key.key_flags = key_flags;
750
751
741 /* This copy is acutally not needed: we get the key with each TX */ 752 /* This copy is acutally not needed: we get the key with each TX */
742 memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key, 16); 753 memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key, 16);
743 754
@@ -754,9 +765,7 @@ void iwl_update_tkip_key(struct iwl_priv *priv,
754{ 765{
755 u8 sta_id = IWL_INVALID_STATION; 766 u8 sta_id = IWL_INVALID_STATION;
756 unsigned long flags; 767 unsigned long flags;
757 __le16 key_flags = 0;
758 int i; 768 int i;
759 DECLARE_MAC_BUF(mac);
760 769
761 sta_id = priv->cfg->ops->smgmt->find_station(priv, addr); 770 sta_id = priv->cfg->ops->smgmt->find_station(priv, addr);
762 if (sta_id == IWL_INVALID_STATION) { 771 if (sta_id == IWL_INVALID_STATION) {
@@ -771,16 +780,8 @@ void iwl_update_tkip_key(struct iwl_priv *priv,
771 return; 780 return;
772 } 781 }
773 782
774 key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK);
775 key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
776 key_flags &= ~STA_KEY_FLG_INVALID;
777
778 if (sta_id == priv->hw_params.bcast_sta_id)
779 key_flags |= STA_KEY_MULTICAST_MSK;
780
781 spin_lock_irqsave(&priv->sta_lock, flags); 783 spin_lock_irqsave(&priv->sta_lock, flags);
782 784
783 priv->stations[sta_id].sta.key.key_flags = key_flags;
784 priv->stations[sta_id].sta.key.tkip_rx_tsc_byte2 = (u8) iv32; 785 priv->stations[sta_id].sta.key.tkip_rx_tsc_byte2 = (u8) iv32;
785 786
786 for (i = 0; i < 5; i++) 787 for (i = 0; i < 5; i++)
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index a782292ed435..6b42ea2a1f1d 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -1462,7 +1462,6 @@ static void iwl3945_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rx
1462 rxq->bd = NULL; 1462 rxq->bd = NULL;
1463 rxq->rb_stts = NULL; 1463 rxq->rb_stts = NULL;
1464} 1464}
1465EXPORT_SYMBOL(iwl3945_rx_queue_free);
1466 1465
1467 1466
1468/* Convert linear signal-to-noise ratio into dB */ 1467/* Convert linear signal-to-noise ratio into dB */