aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-19 10:52:45 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-19 10:52:45 -0500
commit07ce198a1eb3431d04a6d59ea9fb7b71f21e33b1 (patch)
treefe6e6208bdcdfb7bbb0c81923efcb75bf73a299b /drivers/net
parent4bc87e62775052aac0be7574d5f84ff06f61c6b4 (diff)
parenta442585952f137bd4cdb1f2f3166e4157d383b82 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (60 commits) [NIU]: Bump driver version and release date. [NIU]: Fix BMAC alternate MAC address indexing. net: fix kernel-doc warnings in header files [IPV6]: Use BUG_ON instead of if + BUG in fib6_del_route. [IPV6]: dst_entry leak in ip4ip6_err. (resend) bluetooth: do not move child device other than rfcomm bluetooth: put hci dev after del conn [NET]: Elminate spurious print_mac() calls. [BLUETOOTH] hci_sysfs.c: Kill build warning. [NET]: Remove MAC_FMT net/8021q/vlan_dev.c: Use print_mac. [XFRM]: Fix ordering issue in xfrm_dst_hash_transfer(). [BLUETOOTH] net/bluetooth/hci_core.c: Use time_* macros [IPV6]: Fix hardcoded removing of old module code [NETLABEL]: Move some initialization code into __init section. [NETLABEL]: Shrink the genl-ops registration code. [AX25] ax25_out: check skb for NULL in ax25_kick() [TCP]: Fix tcp_v4_send_synack() comment [IPV4]: fix alignment of IP-Config output Documentation: fix tcp.txt ...
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/e1000/e1000_ethtool.c2
-rw-r--r--drivers/net/e1000/e1000_main.c8
-rw-r--r--drivers/net/e1000e/netdev.c34
-rw-r--r--drivers/net/gianfar.c4
-rw-r--r--drivers/net/gianfar_mii.c4
-rw-r--r--drivers/net/hamradio/mkiss.c5
-rw-r--r--drivers/net/igb/igb_ethtool.c2
-rw-r--r--drivers/net/igb/igb_main.c28
-rw-r--r--drivers/net/ixgb/ixgb_ethtool.c2
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c41
-rw-r--r--drivers/net/niu.c11
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c12
-rw-r--r--drivers/net/tsi108_eth.c72
-rw-r--r--drivers/net/wireless/ath5k/base.c4
-rw-r--r--drivers/net/wireless/ath5k/hw.c34
-rw-r--r--drivers/net/wireless/b43/b43.h6
-rw-r--r--drivers/net/wireless/b43/main.c40
-rw-r--r--drivers/net/wireless/b43legacy/b43legacy.h4
-rw-r--r--drivers/net/wireless/b43legacy/dma.c167
-rw-r--r--drivers/net/wireless/b43legacy/dma.h33
-rw-r--r--drivers/net/wireless/b43legacy/main.c41
-rw-r--r--drivers/net/wireless/ipw2200.c45
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c19
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c17
-rw-r--r--drivers/net/wireless/rndis_wlan.c14
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c2
-rw-r--r--drivers/net/wireless/wavelan.h6
27 files changed, 409 insertions, 248 deletions
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index d876787ce336..85e66f4c7886 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -50,7 +50,7 @@ struct e1000_stats {
50 int stat_offset; 50 int stat_offset;
51}; 51};
52 52
53#define E1000_STAT(m) sizeof(((struct e1000_adapter *)0)->m), \ 53#define E1000_STAT(m) FIELD_SIZEOF(struct e1000_adapter, m), \
54 offsetof(struct e1000_adapter, m) 54 offsetof(struct e1000_adapter, m)
55static const struct e1000_stats e1000_gstrings_stats[] = { 55static const struct e1000_stats e1000_gstrings_stats[] = {
56 { "rx_packets", E1000_STAT(stats.gprc) }, 56 { "rx_packets", E1000_STAT(stats.gprc) },
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index d4ee8ec34b56..0991648c53dc 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -1195,6 +1195,14 @@ e1000_probe(struct pci_dev *pdev,
1195 1195
1196 printk("%s\n", print_mac(mac, netdev->dev_addr)); 1196 printk("%s\n", print_mac(mac, netdev->dev_addr));
1197 1197
1198 if (adapter->hw.bus_type == e1000_bus_type_pci_express) {
1199 DPRINTK(PROBE, WARNING, "This device (id %04x:%04x) will no "
1200 "longer be supported by this driver in the future.\n",
1201 pdev->vendor, pdev->device);
1202 DPRINTK(PROBE, WARNING, "please use the \"e1000e\" "
1203 "driver instead.\n");
1204 }
1205
1198 /* reset the hardware with the new settings */ 1206 /* reset the hardware with the new settings */
1199 e1000_reset(adapter); 1207 e1000_reset(adapter);
1200 1208
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index f58f017ee47a..3031d6d16247 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -1055,23 +1055,6 @@ static void e1000_release_hw_control(struct e1000_adapter *adapter)
1055 } 1055 }
1056} 1056}
1057 1057
1058static void e1000_release_manageability(struct e1000_adapter *adapter)
1059{
1060 if (adapter->flags & FLAG_MNG_PT_ENABLED) {
1061 struct e1000_hw *hw = &adapter->hw;
1062
1063 u32 manc = er32(MANC);
1064
1065 /* re-enable hardware interception of ARP */
1066 manc |= E1000_MANC_ARP_EN;
1067 manc &= ~E1000_MANC_EN_MNG2HOST;
1068
1069 /* don't explicitly have to mess with MANC2H since
1070 * MANC has an enable disable that gates MANC2H */
1071 ew32(MANC, manc);
1072 }
1073}
1074
1075/** 1058/**
1076 * @e1000_alloc_ring - allocate memory for a ring structure 1059 * @e1000_alloc_ring - allocate memory for a ring structure
1077 **/ 1060 **/
@@ -1561,9 +1544,6 @@ static void e1000_init_manageability(struct e1000_adapter *adapter)
1561 1544
1562 manc = er32(MANC); 1545 manc = er32(MANC);
1563 1546
1564 /* disable hardware interception of ARP */
1565 manc &= ~(E1000_MANC_ARP_EN);
1566
1567 /* enable receiving management packets to the host. this will probably 1547 /* enable receiving management packets to the host. this will probably
1568 * generate destination unreachable messages from the host OS, but 1548 * generate destination unreachable messages from the host OS, but
1569 * the packets will be handled on SMBUS */ 1549 * the packets will be handled on SMBUS */
@@ -1690,6 +1670,9 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
1690 else 1670 else
1691 rctl |= E1000_RCTL_LPE; 1671 rctl |= E1000_RCTL_LPE;
1692 1672
1673 /* Enable hardware CRC frame stripping */
1674 rctl |= E1000_RCTL_SECRC;
1675
1693 /* Setup buffer sizes */ 1676 /* Setup buffer sizes */
1694 rctl &= ~E1000_RCTL_SZ_4096; 1677 rctl &= ~E1000_RCTL_SZ_4096;
1695 rctl |= E1000_RCTL_BSEX; 1678 rctl |= E1000_RCTL_BSEX;
@@ -1755,9 +1738,6 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
1755 1738
1756 /* Enable Packet split descriptors */ 1739 /* Enable Packet split descriptors */
1757 rctl |= E1000_RCTL_DTYP_PS; 1740 rctl |= E1000_RCTL_DTYP_PS;
1758
1759 /* Enable hardware CRC frame stripping */
1760 rctl |= E1000_RCTL_SECRC;
1761 1741
1762 psrctl |= adapter->rx_ps_bsize0 >> 1742 psrctl |= adapter->rx_ps_bsize0 >>
1763 E1000_PSRCTL_BSIZE0_SHIFT; 1743 E1000_PSRCTL_BSIZE0_SHIFT;
@@ -2008,7 +1988,7 @@ static void e1000_power_down_phy(struct e1000_adapter *adapter)
2008 u16 mii_reg; 1988 u16 mii_reg;
2009 1989
2010 /* WoL is enabled */ 1990 /* WoL is enabled */
2011 if (!adapter->wol) 1991 if (adapter->wol)
2012 return; 1992 return;
2013 1993
2014 /* non-copper PHY? */ 1994 /* non-copper PHY? */
@@ -2140,8 +2120,6 @@ void e1000e_reset(struct e1000_adapter *adapter)
2140 phy_data &= ~IGP02E1000_PM_SPD; 2120 phy_data &= ~IGP02E1000_PM_SPD;
2141 e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, phy_data); 2121 e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, phy_data);
2142 } 2122 }
2143
2144 e1000_release_manageability(adapter);
2145} 2123}
2146 2124
2147int e1000e_up(struct e1000_adapter *adapter) 2125int e1000e_up(struct e1000_adapter *adapter)
@@ -3487,8 +3465,6 @@ static int e1000_suspend(struct pci_dev *pdev, pm_message_t state)
3487 pci_enable_wake(pdev, PCI_D3cold, 0); 3465 pci_enable_wake(pdev, PCI_D3cold, 0);
3488 } 3466 }
3489 3467
3490 e1000_release_manageability(adapter);
3491
3492 /* make sure adapter isn't asleep if manageability is enabled */ 3468 /* make sure adapter isn't asleep if manageability is enabled */
3493 if (adapter->flags & FLAG_MNG_PT_ENABLED) { 3469 if (adapter->flags & FLAG_MNG_PT_ENABLED) {
3494 pci_enable_wake(pdev, PCI_D3hot, 1); 3470 pci_enable_wake(pdev, PCI_D3hot, 1);
@@ -4054,8 +4030,6 @@ static void __devexit e1000_remove(struct pci_dev *pdev)
4054 4030
4055 flush_scheduled_work(); 4031 flush_scheduled_work();
4056 4032
4057 e1000_release_manageability(adapter);
4058
4059 /* Release control of h/w to f/w. If f/w is AMT enabled, this 4033 /* Release control of h/w to f/w. If f/w is AMT enabled, this
4060 * would have already happened in close and is redundant. */ 4034 * would have already happened in close and is redundant. */
4061 e1000_release_hw_control(adapter); 4035 e1000_release_hw_control(adapter);
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 0431e9ed0fac..4244fc282f21 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -130,8 +130,8 @@ static void free_skb_resources(struct gfar_private *priv);
130static void gfar_set_multi(struct net_device *dev); 130static void gfar_set_multi(struct net_device *dev);
131static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr); 131static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr);
132static void gfar_configure_serdes(struct net_device *dev); 132static void gfar_configure_serdes(struct net_device *dev);
133extern int gfar_local_mdio_write(struct gfar_mii *regs, int mii_id, int regnum, u16 value); 133extern int gfar_local_mdio_write(struct gfar_mii __iomem *regs, int mii_id, int regnum, u16 value);
134extern int gfar_local_mdio_read(struct gfar_mii *regs, int mii_id, int regnum); 134extern int gfar_local_mdio_read(struct gfar_mii __iomem *regs, int mii_id, int regnum);
135#ifdef CONFIG_GFAR_NAPI 135#ifdef CONFIG_GFAR_NAPI
136static int gfar_poll(struct napi_struct *napi, int budget); 136static int gfar_poll(struct napi_struct *napi, int budget);
137#endif 137#endif
diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c
index 6a647d95e6ea..24327629bf03 100644
--- a/drivers/net/gianfar_mii.c
+++ b/drivers/net/gianfar_mii.c
@@ -51,7 +51,7 @@
51 * the local mdio pins, which may not be the same as system mdio bus, used for 51 * the local mdio pins, which may not be the same as system mdio bus, used for
52 * controlling the external PHYs, for example. 52 * controlling the external PHYs, for example.
53 */ 53 */
54int gfar_local_mdio_write(struct gfar_mii *regs, int mii_id, 54int gfar_local_mdio_write(struct gfar_mii __iomem *regs, int mii_id,
55 int regnum, u16 value) 55 int regnum, u16 value)
56{ 56{
57 /* Set the PHY address and the register address we want to write */ 57 /* Set the PHY address and the register address we want to write */
@@ -77,7 +77,7 @@ int gfar_local_mdio_write(struct gfar_mii *regs, int mii_id,
77 * and are always tied to the local mdio pins, which may not be the 77 * and are always tied to the local mdio pins, which may not be the
78 * same as system mdio bus, used for controlling the external PHYs, for eg. 78 * same as system mdio bus, used for controlling the external PHYs, for eg.
79 */ 79 */
80int gfar_local_mdio_read(struct gfar_mii *regs, int mii_id, int regnum) 80int gfar_local_mdio_read(struct gfar_mii __iomem *regs, int mii_id, int regnum)
81 81
82{ 82{
83 u16 value; 83 u16 value;
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index cfcd15af501e..30c9b3b0d131 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -289,7 +289,6 @@ static void ax_bump(struct mkiss *ax)
289 *ax->rbuff &= ~0x20; 289 *ax->rbuff &= ~0x20;
290 } 290 }
291 } 291 }
292 spin_unlock_bh(&ax->buflock);
293 292
294 count = ax->rcount; 293 count = ax->rcount;
295 294
@@ -297,17 +296,17 @@ static void ax_bump(struct mkiss *ax)
297 printk(KERN_ERR "mkiss: %s: memory squeeze, dropping packet.\n", 296 printk(KERN_ERR "mkiss: %s: memory squeeze, dropping packet.\n",
298 ax->dev->name); 297 ax->dev->name);
299 ax->stats.rx_dropped++; 298 ax->stats.rx_dropped++;
299 spin_unlock_bh(&ax->buflock);
300 return; 300 return;
301 } 301 }
302 302
303 spin_lock_bh(&ax->buflock);
304 memcpy(skb_put(skb,count), ax->rbuff, count); 303 memcpy(skb_put(skb,count), ax->rbuff, count);
305 spin_unlock_bh(&ax->buflock);
306 skb->protocol = ax25_type_trans(skb, ax->dev); 304 skb->protocol = ax25_type_trans(skb, ax->dev);
307 netif_rx(skb); 305 netif_rx(skb);
308 ax->dev->last_rx = jiffies; 306 ax->dev->last_rx = jiffies;
309 ax->stats.rx_packets++; 307 ax->stats.rx_packets++;
310 ax->stats.rx_bytes += count; 308 ax->stats.rx_bytes += count;
309 spin_unlock_bh(&ax->buflock);
311} 310}
312 311
313static void kiss_unesc(struct mkiss *ax, unsigned char s) 312static void kiss_unesc(struct mkiss *ax, unsigned char s)
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c
index f69721e4eaa1..0447f9bcd27a 100644
--- a/drivers/net/igb/igb_ethtool.c
+++ b/drivers/net/igb/igb_ethtool.c
@@ -43,7 +43,7 @@ struct igb_stats {
43 int stat_offset; 43 int stat_offset;
44}; 44};
45 45
46#define IGB_STAT(m) sizeof(((struct igb_adapter *)0)->m), \ 46#define IGB_STAT(m) FIELD_SIZEOF(struct igb_adapter, m), \
47 offsetof(struct igb_adapter, m) 47 offsetof(struct igb_adapter, m)
48static const struct igb_stats igb_gstrings_stats[] = { 48static const struct igb_stats igb_gstrings_stats[] = {
49 { "rx_packets", IGB_STAT(stats.gprc) }, 49 { "rx_packets", IGB_STAT(stats.gprc) },
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index d4eb8e2d8720..bff280eff5e3 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -606,9 +606,6 @@ static void igb_init_manageability(struct igb_adapter *adapter)
606 u32 manc2h = rd32(E1000_MANC2H); 606 u32 manc2h = rd32(E1000_MANC2H);
607 u32 manc = rd32(E1000_MANC); 607 u32 manc = rd32(E1000_MANC);
608 608
609 /* disable hardware interception of ARP */
610 manc &= ~(E1000_MANC_ARP_EN);
611
612 /* enable receiving management packets to the host */ 609 /* enable receiving management packets to the host */
613 /* this will probably generate destination unreachable messages 610 /* this will probably generate destination unreachable messages
614 * from the host OS, but the packets will be handled on SMBUS */ 611 * from the host OS, but the packets will be handled on SMBUS */
@@ -623,25 +620,6 @@ static void igb_init_manageability(struct igb_adapter *adapter)
623 } 620 }
624} 621}
625 622
626static void igb_release_manageability(struct igb_adapter *adapter)
627{
628 struct e1000_hw *hw = &adapter->hw;
629
630 if (adapter->en_mng_pt) {
631 u32 manc = rd32(E1000_MANC);
632
633 /* re-enable hardware interception of ARP */
634 manc |= E1000_MANC_ARP_EN;
635 manc &= ~E1000_MANC_EN_MNG2HOST;
636
637 /* don't explicitly have to mess with MANC2H since
638 * MANC has an enable disable that gates MANC2H */
639
640 /* XXX stop the hardware watchdog ? */
641 wr32(E1000_MANC, manc);
642 }
643}
644
645/** 623/**
646 * igb_configure - configure the hardware for RX and TX 624 * igb_configure - configure the hardware for RX and TX
647 * @adapter: private board structure 625 * @adapter: private board structure
@@ -844,7 +822,6 @@ void igb_reset(struct igb_adapter *adapter)
844 822
845 igb_reset_adaptive(&adapter->hw); 823 igb_reset_adaptive(&adapter->hw);
846 adapter->hw.phy.ops.get_phy_info(&adapter->hw); 824 adapter->hw.phy.ops.get_phy_info(&adapter->hw);
847 igb_release_manageability(adapter);
848} 825}
849 826
850/** 827/**
@@ -1178,9 +1155,6 @@ static void __devexit igb_remove(struct pci_dev *pdev)
1178 1155
1179 flush_scheduled_work(); 1156 flush_scheduled_work();
1180 1157
1181
1182 igb_release_manageability(adapter);
1183
1184 /* Release control of h/w to f/w. If f/w is AMT enabled, this 1158 /* Release control of h/w to f/w. If f/w is AMT enabled, this
1185 * would have already happened in close and is redundant. */ 1159 * would have already happened in close and is redundant. */
1186 igb_release_hw_control(adapter); 1160 igb_release_hw_control(adapter);
@@ -3955,8 +3929,6 @@ static int igb_suspend(struct pci_dev *pdev, pm_message_t state)
3955 pci_enable_wake(pdev, PCI_D3cold, 0); 3929 pci_enable_wake(pdev, PCI_D3cold, 0);
3956 } 3930 }
3957 3931
3958 igb_release_manageability(adapter);
3959
3960 /* make sure adapter isn't asleep if manageability is enabled */ 3932 /* make sure adapter isn't asleep if manageability is enabled */
3961 if (adapter->en_mng_pt) { 3933 if (adapter->en_mng_pt) {
3962 pci_enable_wake(pdev, PCI_D3hot, 1); 3934 pci_enable_wake(pdev, PCI_D3hot, 1);
diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index a267dd862520..53a9fd086f96 100644
--- a/drivers/net/ixgb/ixgb_ethtool.c
+++ b/drivers/net/ixgb/ixgb_ethtool.c
@@ -49,7 +49,7 @@ struct ixgb_stats {
49 int stat_offset; 49 int stat_offset;
50}; 50};
51 51
52#define IXGB_STAT(m) sizeof(((struct ixgb_adapter *)0)->m), \ 52#define IXGB_STAT(m) FIELD_SIZEOF(struct ixgb_adapter, m), \
53 offsetof(struct ixgb_adapter, m) 53 offsetof(struct ixgb_adapter, m)
54static struct ixgb_stats ixgb_gstrings_stats[] = { 54static struct ixgb_stats ixgb_gstrings_stats[] = {
55 {"rx_packets", IXGB_STAT(net_stats.rx_packets)}, 55 {"rx_packets", IXGB_STAT(net_stats.rx_packets)},
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index ead49e54f31b..23d0a4afe0e1 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -220,7 +220,6 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_adapter *adapter,
220 tx_ring->stats.bytes += tx_buffer_info->length; 220 tx_ring->stats.bytes += tx_buffer_info->length;
221 if (cleaned) { 221 if (cleaned) {
222 struct sk_buff *skb = tx_buffer_info->skb; 222 struct sk_buff *skb = tx_buffer_info->skb;
223#ifdef NETIF_F_TSO
224 unsigned int segs, bytecount; 223 unsigned int segs, bytecount;
225 segs = skb_shinfo(skb)->gso_segs ?: 1; 224 segs = skb_shinfo(skb)->gso_segs ?: 1;
226 /* multiply data chunks by size of headers */ 225 /* multiply data chunks by size of headers */
@@ -228,10 +227,6 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_adapter *adapter,
228 skb->len; 227 skb->len;
229 total_tx_packets += segs; 228 total_tx_packets += segs;
230 total_tx_bytes += bytecount; 229 total_tx_bytes += bytecount;
231#else
232 total_tx_packets++;
233 total_tx_bytes += skb->len;
234#endif
235 } 230 }
236 ixgbe_unmap_and_free_tx_resource(adapter, 231 ixgbe_unmap_and_free_tx_resource(adapter,
237 tx_buffer_info); 232 tx_buffer_info);
@@ -1942,6 +1937,10 @@ static int ixgbe_open(struct net_device *netdev)
1942 int err; 1937 int err;
1943 u32 num_rx_queues = adapter->num_rx_queues; 1938 u32 num_rx_queues = adapter->num_rx_queues;
1944 1939
1940 /* disallow open during test */
1941 if (test_bit(__IXGBE_TESTING, &adapter->state))
1942 return -EBUSY;
1943
1945try_intr_reinit: 1944try_intr_reinit:
1946 /* allocate transmit descriptors */ 1945 /* allocate transmit descriptors */
1947 err = ixgbe_setup_all_tx_resources(adapter); 1946 err = ixgbe_setup_all_tx_resources(adapter);
@@ -2278,11 +2277,29 @@ static bool ixgbe_tx_csum(struct ixgbe_adapter *adapter,
2278 IXGBE_ADVTXD_DTYP_CTXT); 2277 IXGBE_ADVTXD_DTYP_CTXT);
2279 2278
2280 if (skb->ip_summed == CHECKSUM_PARTIAL) { 2279 if (skb->ip_summed == CHECKSUM_PARTIAL) {
2281 if (skb->protocol == htons(ETH_P_IP)) 2280 switch (skb->protocol) {
2281 case __constant_htons(ETH_P_IP):
2282 type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_IPV4; 2282 type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_IPV4;
2283 if (ip_hdr(skb)->protocol == IPPROTO_TCP)
2284 type_tucmd_mlhl |=
2285 IXGBE_ADVTXD_TUCMD_L4T_TCP;
2286 break;
2287
2288 case __constant_htons(ETH_P_IPV6):
2289 /* XXX what about other V6 headers?? */
2290 if (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP)
2291 type_tucmd_mlhl |=
2292 IXGBE_ADVTXD_TUCMD_L4T_TCP;
2293 break;
2283 2294
2284 if (skb->sk->sk_protocol == IPPROTO_TCP) 2295 default:
2285 type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_TCP; 2296 if (unlikely(net_ratelimit())) {
2297 DPRINTK(PROBE, WARNING,
2298 "partial checksum but proto=%x!\n",
2299 skb->protocol);
2300 }
2301 break;
2302 }
2286 } 2303 }
2287 2304
2288 context_desc->type_tucmd_mlhl = cpu_to_le32(type_tucmd_mlhl); 2305 context_desc->type_tucmd_mlhl = cpu_to_le32(type_tucmd_mlhl);
@@ -2778,6 +2795,14 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
2778 hw->mac.type, hw->phy.type, 2795 hw->mac.type, hw->phy.type,
2779 (part_num >> 8), (part_num & 0xff)); 2796 (part_num >> 8), (part_num & 0xff));
2780 2797
2798 if (link_width <= IXGBE_PCI_LINK_WIDTH_4) {
2799 dev_warn(&pdev->dev, "PCI-Express bandwidth available for "
2800 "this card is not sufficient for optimal "
2801 "performance.\n");
2802 dev_warn(&pdev->dev, "For optimal performance a x8 "
2803 "PCI-Express slot is required.\n");
2804 }
2805
2781 /* reset the hardware with the new settings */ 2806 /* reset the hardware with the new settings */
2782 ixgbe_start_hw(hw); 2807 ixgbe_start_hw(hw);
2783 2808
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 2fe14b0c5c67..e98ce1e4965b 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -33,8 +33,8 @@
33 33
34#define DRV_MODULE_NAME "niu" 34#define DRV_MODULE_NAME "niu"
35#define PFX DRV_MODULE_NAME ": " 35#define PFX DRV_MODULE_NAME ": "
36#define DRV_MODULE_VERSION "0.6" 36#define DRV_MODULE_VERSION "0.7"
37#define DRV_MODULE_RELDATE "January 5, 2008" 37#define DRV_MODULE_RELDATE "February 18, 2008"
38 38
39static char version[] __devinitdata = 39static char version[] __devinitdata =
40 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; 40 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
@@ -5147,7 +5147,12 @@ static void niu_set_rx_mode(struct net_device *dev)
5147 index++; 5147 index++;
5148 } 5148 }
5149 } else { 5149 } else {
5150 for (i = 0; i < niu_num_alt_addr(np); i++) { 5150 int alt_start;
5151 if (np->flags & NIU_FLAGS_XMAC)
5152 alt_start = 0;
5153 else
5154 alt_start = 1;
5155 for (i = alt_start; i < niu_num_alt_addr(np); i++) {
5151 err = niu_enable_alt_mac(np, i, 0); 5156 err = niu_enable_alt_mac(np, i, 0);
5152 if (err) 5157 if (err)
5153 printk(KERN_WARNING PFX "%s: Error %d " 5158 printk(KERN_WARNING PFX "%s: Error %d "
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index f18eca9831e8..250eb1954c34 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -559,8 +559,16 @@ static int mhz_setup(struct pcmcia_device *link)
559 559
560 /* Read the station address from the CIS. It is stored as the last 560 /* Read the station address from the CIS. It is stored as the last
561 (fourth) string in the Version 1 Version/ID tuple. */ 561 (fourth) string in the Version 1 Version/ID tuple. */
562 if (link->prod_id[3]) { 562 tuple->DesiredTuple = CISTPL_VERS_1;
563 station_addr = link->prod_id[3]; 563 if (first_tuple(link, tuple, parse) != CS_SUCCESS) {
564 rc = -1;
565 goto free_cfg_mem;
566 }
567 /* Ugh -- the EM1144 card has two VERS_1 tuples!?! */
568 if (next_tuple(link, tuple, parse) != CS_SUCCESS)
569 first_tuple(link, tuple, parse);
570 if (parse->version_1.ns > 3) {
571 station_addr = parse->version_1.str + parse->version_1.ofs[3];
564 if (cvt_ascii_address(dev, station_addr) == 0) { 572 if (cvt_ascii_address(dev, station_addr) == 0) {
565 rc = 0; 573 rc = 0;
566 goto free_cfg_mem; 574 goto free_cfg_mem;
diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c
index 35d15e850075..6f33f84d37b0 100644
--- a/drivers/net/tsi108_eth.c
+++ b/drivers/net/tsi108_eth.c
@@ -36,6 +36,7 @@
36#include <linux/net.h> 36#include <linux/net.h>
37#include <linux/netdevice.h> 37#include <linux/netdevice.h>
38#include <linux/etherdevice.h> 38#include <linux/etherdevice.h>
39#include <linux/ethtool.h>
39#include <linux/skbuff.h> 40#include <linux/skbuff.h>
40#include <linux/slab.h> 41#include <linux/slab.h>
41#include <linux/spinlock.h> 42#include <linux/spinlock.h>
@@ -297,18 +298,11 @@ static void tsi108_check_phy(struct net_device *dev)
297 u32 speed; 298 u32 speed;
298 unsigned long flags; 299 unsigned long flags;
299 300
300 /* Do a dummy read, as for some reason the first read
301 * after a link becomes up returns link down, even if
302 * it's been a while since the link came up.
303 */
304
305 spin_lock_irqsave(&phy_lock, flags); 301 spin_lock_irqsave(&phy_lock, flags);
306 302
307 if (!data->phy_ok) 303 if (!data->phy_ok)
308 goto out; 304 goto out;
309 305
310 tsi108_read_mii(data, MII_BMSR);
311
312 duplex = mii_check_media(&data->mii_if, netif_msg_link(data), data->init_media); 306 duplex = mii_check_media(&data->mii_if, netif_msg_link(data), data->init_media);
313 data->init_media = 0; 307 data->init_media = 0;
314 308
@@ -345,22 +339,21 @@ static void tsi108_check_phy(struct net_device *dev)
345 339
346 TSI_WRITE(TSI108_MAC_CFG2, mac_cfg2_reg); 340 TSI_WRITE(TSI108_MAC_CFG2, mac_cfg2_reg);
347 TSI_WRITE(TSI108_EC_PORTCTRL, portctrl_reg); 341 TSI_WRITE(TSI108_EC_PORTCTRL, portctrl_reg);
342 }
348 343
349 if (data->link_up == 0) { 344 if (data->link_up == 0) {
350 /* The manual says it can take 3-4 usecs for the speed change 345 /* The manual says it can take 3-4 usecs for the speed change
351 * to take effect. 346 * to take effect.
352 */ 347 */
353 udelay(5); 348 udelay(5);
354 349
355 spin_lock(&data->txlock); 350 spin_lock(&data->txlock);
356 if (is_valid_ether_addr(dev->dev_addr) && data->txfree) 351 if (is_valid_ether_addr(dev->dev_addr) && data->txfree)
357 netif_wake_queue(dev); 352 netif_wake_queue(dev);
358 353
359 data->link_up = 1; 354 data->link_up = 1;
360 spin_unlock(&data->txlock); 355 spin_unlock(&data->txlock);
361 }
362 } 356 }
363
364 } else { 357 } else {
365 if (data->link_up == 1) { 358 if (data->link_up == 1) {
366 netif_stop_queue(dev); 359 netif_stop_queue(dev);
@@ -1274,12 +1267,11 @@ static void tsi108_init_phy(struct net_device *dev)
1274 * PHY_STAT register before the link up status bit is set. 1267 * PHY_STAT register before the link up status bit is set.
1275 */ 1268 */
1276 1269
1277 data->link_up = 1; 1270 data->link_up = 0;
1278 1271
1279 while (!((phyval = tsi108_read_mii(data, MII_BMSR)) & 1272 while (!((phyval = tsi108_read_mii(data, MII_BMSR)) &
1280 BMSR_LSTATUS)) { 1273 BMSR_LSTATUS)) {
1281 if (i++ > (MII_READ_DELAY / 10)) { 1274 if (i++ > (MII_READ_DELAY / 10)) {
1282 data->link_up = 0;
1283 break; 1275 break;
1284 } 1276 }
1285 spin_unlock_irqrestore(&phy_lock, flags); 1277 spin_unlock_irqrestore(&phy_lock, flags);
@@ -1287,6 +1279,7 @@ static void tsi108_init_phy(struct net_device *dev)
1287 spin_lock_irqsave(&phy_lock, flags); 1279 spin_lock_irqsave(&phy_lock, flags);
1288 } 1280 }
1289 1281
1282 data->mii_if.supports_gmii = mii_check_gmii_support(&data->mii_if);
1290 printk(KERN_DEBUG "PHY_STAT reg contains %08x\n", phyval); 1283 printk(KERN_DEBUG "PHY_STAT reg contains %08x\n", phyval);
1291 data->phy_ok = 1; 1284 data->phy_ok = 1;
1292 data->init_media = 1; 1285 data->init_media = 1;
@@ -1527,12 +1520,46 @@ static void tsi108_init_mac(struct net_device *dev)
1527 TSI_WRITE(TSI108_EC_INTMASK, ~0); 1520 TSI_WRITE(TSI108_EC_INTMASK, ~0);
1528} 1521}
1529 1522
1523static int tsi108_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
1524{
1525 struct tsi108_prv_data *data = netdev_priv(dev);
1526 unsigned long flags;
1527 int rc;
1528
1529 spin_lock_irqsave(&data->txlock, flags);
1530 rc = mii_ethtool_gset(&data->mii_if, cmd);
1531 spin_unlock_irqrestore(&data->txlock, flags);
1532
1533 return rc;
1534}
1535
1536static int tsi108_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
1537{
1538 struct tsi108_prv_data *data = netdev_priv(dev);
1539 unsigned long flags;
1540 int rc;
1541
1542 spin_lock_irqsave(&data->txlock, flags);
1543 rc = mii_ethtool_sset(&data->mii_if, cmd);
1544 spin_unlock_irqrestore(&data->txlock, flags);
1545
1546 return rc;
1547}
1548
1530static int tsi108_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 1549static int tsi108_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1531{ 1550{
1532 struct tsi108_prv_data *data = netdev_priv(dev); 1551 struct tsi108_prv_data *data = netdev_priv(dev);
1552 if (!netif_running(dev))
1553 return -EINVAL;
1533 return generic_mii_ioctl(&data->mii_if, if_mii(rq), cmd, NULL); 1554 return generic_mii_ioctl(&data->mii_if, if_mii(rq), cmd, NULL);
1534} 1555}
1535 1556
1557static const struct ethtool_ops tsi108_ethtool_ops = {
1558 .get_link = ethtool_op_get_link,
1559 .get_settings = tsi108_get_settings,
1560 .set_settings = tsi108_set_settings,
1561};
1562
1536static int 1563static int
1537tsi108_init_one(struct platform_device *pdev) 1564tsi108_init_one(struct platform_device *pdev)
1538{ 1565{
@@ -1584,7 +1611,6 @@ tsi108_init_one(struct platform_device *pdev)
1584 data->mii_if.phy_id = einfo->phy; 1611 data->mii_if.phy_id = einfo->phy;
1585 data->mii_if.phy_id_mask = 0x1f; 1612 data->mii_if.phy_id_mask = 0x1f;
1586 data->mii_if.reg_num_mask = 0x1f; 1613 data->mii_if.reg_num_mask = 0x1f;
1587 data->mii_if.supports_gmii = mii_check_gmii_support(&data->mii_if);
1588 1614
1589 data->phy = einfo->phy; 1615 data->phy = einfo->phy;
1590 data->phy_type = einfo->phy_type; 1616 data->phy_type = einfo->phy_type;
@@ -1598,6 +1624,7 @@ tsi108_init_one(struct platform_device *pdev)
1598 dev->get_stats = tsi108_get_stats; 1624 dev->get_stats = tsi108_get_stats;
1599 netif_napi_add(dev, &data->napi, tsi108_poll, 64); 1625 netif_napi_add(dev, &data->napi, tsi108_poll, 64);
1600 dev->do_ioctl = tsi108_do_ioctl; 1626 dev->do_ioctl = tsi108_do_ioctl;
1627 dev->ethtool_ops = &tsi108_ethtool_ops;
1601 1628
1602 /* Apparently, the Linux networking code won't use scatter-gather 1629 /* Apparently, the Linux networking code won't use scatter-gather
1603 * if the hardware doesn't do checksums. However, it's faster 1630 * if the hardware doesn't do checksums. However, it's faster
@@ -1629,6 +1656,7 @@ tsi108_init_one(struct platform_device *pdev)
1629 goto register_fail; 1656 goto register_fail;
1630 } 1657 }
1631 1658
1659 platform_set_drvdata(pdev, dev);
1632 printk(KERN_INFO "%s: Tsi108 Gigabit Ethernet, MAC: %s\n", 1660 printk(KERN_INFO "%s: Tsi108 Gigabit Ethernet, MAC: %s\n",
1633 dev->name, print_mac(mac, dev->dev_addr)); 1661 dev->name, print_mac(mac, dev->dev_addr));
1634#ifdef DEBUG 1662#ifdef DEBUG
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index ddc87149fe31..dfdaec020739 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -1256,7 +1256,7 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
1256 if (ctl->flags & IEEE80211_TXCTL_NO_ACK) 1256 if (ctl->flags & IEEE80211_TXCTL_NO_ACK)
1257 flags |= AR5K_TXDESC_NOACK; 1257 flags |= AR5K_TXDESC_NOACK;
1258 1258
1259 pktlen = skb->len + FCS_LEN; 1259 pktlen = skb->len;
1260 1260
1261 if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) { 1261 if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) {
1262 keyidx = ctl->key_idx; 1262 keyidx = ctl->key_idx;
@@ -1952,7 +1952,7 @@ ath5k_beacon_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
1952 } 1952 }
1953 1953
1954 ds->ds_data = bf->skbaddr; 1954 ds->ds_data = bf->skbaddr;
1955 ret = ah->ah_setup_tx_desc(ah, ds, skb->len + FCS_LEN, 1955 ret = ah->ah_setup_tx_desc(ah, ds, skb->len,
1956 ieee80211_get_hdrlen_from_skb(skb), 1956 ieee80211_get_hdrlen_from_skb(skb),
1957 AR5K_PKT_TYPE_BEACON, (ctl->power_level * 2), ctl->tx_rate, 1, 1957 AR5K_PKT_TYPE_BEACON, (ctl->power_level * 2), ctl->tx_rate, 1,
1958 AR5K_TXKEYIX_INVALID, antenna, flags, 0, 0); 1958 AR5K_TXKEYIX_INVALID, antenna, flags, 0, 0);
diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c
index 3a4bf4035a23..1ab57aa6e4dc 100644
--- a/drivers/net/wireless/ath5k/hw.c
+++ b/drivers/net/wireless/ath5k/hw.c
@@ -3506,7 +3506,7 @@ ath5k_hw_setup_2word_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
3506{ 3506{
3507 u32 frame_type; 3507 u32 frame_type;
3508 struct ath5k_hw_2w_tx_desc *tx_desc; 3508 struct ath5k_hw_2w_tx_desc *tx_desc;
3509 unsigned int buff_len; 3509 unsigned int frame_len;
3510 3510
3511 tx_desc = (struct ath5k_hw_2w_tx_desc *)&desc->ds_ctl0; 3511 tx_desc = (struct ath5k_hw_2w_tx_desc *)&desc->ds_ctl0;
3512 3512
@@ -3537,22 +3537,25 @@ ath5k_hw_setup_2word_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
3537 /* Setup control descriptor */ 3537 /* Setup control descriptor */
3538 3538
3539 /* Verify and set frame length */ 3539 /* Verify and set frame length */
3540 if (pkt_len & ~AR5K_2W_TX_DESC_CTL0_FRAME_LEN) 3540
3541 /* remove padding we might have added before */
3542 frame_len = pkt_len - (hdr_len & 3) + FCS_LEN;
3543
3544 if (frame_len & ~AR5K_2W_TX_DESC_CTL0_FRAME_LEN)
3541 return -EINVAL; 3545 return -EINVAL;
3542 3546
3543 tx_desc->tx_control_0 = pkt_len & AR5K_2W_TX_DESC_CTL0_FRAME_LEN; 3547 tx_desc->tx_control_0 = frame_len & AR5K_2W_TX_DESC_CTL0_FRAME_LEN;
3544 3548
3545 /* Verify and set buffer length */ 3549 /* Verify and set buffer length */
3546 buff_len = pkt_len - FCS_LEN;
3547 3550
3548 /* NB: beacon's BufLen must be a multiple of 4 bytes */ 3551 /* NB: beacon's BufLen must be a multiple of 4 bytes */
3549 if(type == AR5K_PKT_TYPE_BEACON) 3552 if(type == AR5K_PKT_TYPE_BEACON)
3550 buff_len = roundup(buff_len, 4); 3553 pkt_len = roundup(pkt_len, 4);
3551 3554
3552 if (buff_len & ~AR5K_2W_TX_DESC_CTL1_BUF_LEN) 3555 if (pkt_len & ~AR5K_2W_TX_DESC_CTL1_BUF_LEN)
3553 return -EINVAL; 3556 return -EINVAL;
3554 3557
3555 tx_desc->tx_control_1 = buff_len & AR5K_2W_TX_DESC_CTL1_BUF_LEN; 3558 tx_desc->tx_control_1 = pkt_len & AR5K_2W_TX_DESC_CTL1_BUF_LEN;
3556 3559
3557 /* 3560 /*
3558 * Verify and set header length 3561 * Verify and set header length
@@ -3634,7 +3637,7 @@ static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah,
3634{ 3637{
3635 struct ath5k_hw_4w_tx_desc *tx_desc; 3638 struct ath5k_hw_4w_tx_desc *tx_desc;
3636 struct ath5k_hw_tx_status *tx_status; 3639 struct ath5k_hw_tx_status *tx_status;
3637 unsigned int buff_len; 3640 unsigned int frame_len;
3638 3641
3639 ATH5K_TRACE(ah->ah_sc); 3642 ATH5K_TRACE(ah->ah_sc);
3640 tx_desc = (struct ath5k_hw_4w_tx_desc *)&desc->ds_ctl0; 3643 tx_desc = (struct ath5k_hw_4w_tx_desc *)&desc->ds_ctl0;
@@ -3669,22 +3672,25 @@ static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah,
3669 /* Setup control descriptor */ 3672 /* Setup control descriptor */
3670 3673
3671 /* Verify and set frame length */ 3674 /* Verify and set frame length */
3672 if (pkt_len & ~AR5K_4W_TX_DESC_CTL0_FRAME_LEN) 3675
3676 /* remove padding we might have added before */
3677 frame_len = pkt_len - (hdr_len & 3) + FCS_LEN;
3678
3679 if (frame_len & ~AR5K_4W_TX_DESC_CTL0_FRAME_LEN)
3673 return -EINVAL; 3680 return -EINVAL;
3674 3681
3675 tx_desc->tx_control_0 = pkt_len & AR5K_4W_TX_DESC_CTL0_FRAME_LEN; 3682 tx_desc->tx_control_0 = frame_len & AR5K_4W_TX_DESC_CTL0_FRAME_LEN;
3676 3683
3677 /* Verify and set buffer length */ 3684 /* Verify and set buffer length */
3678 buff_len = pkt_len - FCS_LEN;
3679 3685
3680 /* NB: beacon's BufLen must be a multiple of 4 bytes */ 3686 /* NB: beacon's BufLen must be a multiple of 4 bytes */
3681 if(type == AR5K_PKT_TYPE_BEACON) 3687 if(type == AR5K_PKT_TYPE_BEACON)
3682 buff_len = roundup(buff_len, 4); 3688 pkt_len = roundup(pkt_len, 4);
3683 3689
3684 if (buff_len & ~AR5K_4W_TX_DESC_CTL1_BUF_LEN) 3690 if (pkt_len & ~AR5K_4W_TX_DESC_CTL1_BUF_LEN)
3685 return -EINVAL; 3691 return -EINVAL;
3686 3692
3687 tx_desc->tx_control_1 = buff_len & AR5K_4W_TX_DESC_CTL1_BUF_LEN; 3693 tx_desc->tx_control_1 = pkt_len & AR5K_4W_TX_DESC_CTL1_BUF_LEN;
3688 3694
3689 tx_desc->tx_control_0 |= 3695 tx_desc->tx_control_0 |=
3690 AR5K_REG_SM(tx_power, AR5K_4W_TX_DESC_CTL0_XMIT_POWER) | 3696 AR5K_REG_SM(tx_power, AR5K_4W_TX_DESC_CTL0_XMIT_POWER) |
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index 08a011f0834a..f13346ba9dd2 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -14,6 +14,12 @@
14#include "lo.h" 14#include "lo.h"
15#include "phy.h" 15#include "phy.h"
16 16
17
18/* The unique identifier of the firmware that's officially supported by
19 * this driver version. */
20#define B43_SUPPORTED_FIRMWARE_ID "FW13"
21
22
17#ifdef CONFIG_B43_DEBUG 23#ifdef CONFIG_B43_DEBUG
18# define B43_DEBUG 1 24# define B43_DEBUG 1
19#else 25#else
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index ef65c41af00f..51dfce16178a 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -58,6 +58,8 @@ MODULE_AUTHOR("Stefano Brivio");
58MODULE_AUTHOR("Michael Buesch"); 58MODULE_AUTHOR("Michael Buesch");
59MODULE_LICENSE("GPL"); 59MODULE_LICENSE("GPL");
60 60
61MODULE_FIRMWARE(B43_SUPPORTED_FIRMWARE_ID);
62
61 63
62static int modparam_bad_frames_preempt; 64static int modparam_bad_frames_preempt;
63module_param_named(bad_frames_preempt, modparam_bad_frames_preempt, int, 0444); 65module_param_named(bad_frames_preempt, modparam_bad_frames_preempt, int, 0444);
@@ -1859,11 +1861,11 @@ static int b43_upload_microcode(struct b43_wldev *dev)
1859 err = -EOPNOTSUPP; 1861 err = -EOPNOTSUPP;
1860 goto error; 1862 goto error;
1861 } 1863 }
1862 b43dbg(dev->wl, "Loading firmware version %u.%u " 1864 b43info(dev->wl, "Loading firmware version %u.%u "
1863 "(20%.2i-%.2i-%.2i %.2i:%.2i:%.2i)\n", 1865 "(20%.2i-%.2i-%.2i %.2i:%.2i:%.2i)\n",
1864 fwrev, fwpatch, 1866 fwrev, fwpatch,
1865 (fwdate >> 12) & 0xF, (fwdate >> 8) & 0xF, fwdate & 0xFF, 1867 (fwdate >> 12) & 0xF, (fwdate >> 8) & 0xF, fwdate & 0xFF,
1866 (fwtime >> 11) & 0x1F, (fwtime >> 5) & 0x3F, fwtime & 0x1F); 1868 (fwtime >> 11) & 0x1F, (fwtime >> 5) & 0x3F, fwtime & 0x1F);
1867 1869
1868 dev->fw.rev = fwrev; 1870 dev->fw.rev = fwrev;
1869 dev->fw.patch = fwpatch; 1871 dev->fw.patch = fwpatch;
@@ -4200,6 +4202,33 @@ static struct ssb_driver b43_ssb_driver = {
4200 .resume = b43_resume, 4202 .resume = b43_resume,
4201}; 4203};
4202 4204
4205static void b43_print_driverinfo(void)
4206{
4207 const char *feat_pci = "", *feat_pcmcia = "", *feat_nphy = "",
4208 *feat_leds = "", *feat_rfkill = "";
4209
4210#ifdef CONFIG_B43_PCI_AUTOSELECT
4211 feat_pci = "P";
4212#endif
4213#ifdef CONFIG_B43_PCMCIA
4214 feat_pcmcia = "M";
4215#endif
4216#ifdef CONFIG_B43_NPHY
4217 feat_nphy = "N";
4218#endif
4219#ifdef CONFIG_B43_LEDS
4220 feat_leds = "L";
4221#endif
4222#ifdef CONFIG_B43_RFKILL
4223 feat_rfkill = "R";
4224#endif
4225 printk(KERN_INFO "Broadcom 43xx driver loaded "
4226 "[ Features: %s%s%s%s%s, Firmware-ID: "
4227 B43_SUPPORTED_FIRMWARE_ID " ]\n",
4228 feat_pci, feat_pcmcia, feat_nphy,
4229 feat_leds, feat_rfkill);
4230}
4231
4203static int __init b43_init(void) 4232static int __init b43_init(void)
4204{ 4233{
4205 int err; 4234 int err;
@@ -4211,6 +4240,7 @@ static int __init b43_init(void)
4211 err = ssb_driver_register(&b43_ssb_driver); 4240 err = ssb_driver_register(&b43_ssb_driver);
4212 if (err) 4241 if (err)
4213 goto err_pcmcia_exit; 4242 goto err_pcmcia_exit;
4243 b43_print_driverinfo();
4214 4244
4215 return err; 4245 return err;
4216 4246
diff --git a/drivers/net/wireless/b43legacy/b43legacy.h b/drivers/net/wireless/b43legacy/b43legacy.h
index c80edd2b9044..93d45b71799a 100644
--- a/drivers/net/wireless/b43legacy/b43legacy.h
+++ b/drivers/net/wireless/b43legacy/b43legacy.h
@@ -23,6 +23,10 @@
23#include "phy.h" 23#include "phy.h"
24 24
25 25
26/* The unique identifier of the firmware that's officially supported by this
27 * driver version. */
28#define B43legacy_SUPPORTED_FIRMWARE_ID "FW10"
29
26#define B43legacy_IRQWAIT_MAX_RETRIES 20 30#define B43legacy_IRQWAIT_MAX_RETRIES 20
27 31
28#define B43legacy_RX_MAX_SSI 60 /* best guess at max ssi */ 32#define B43legacy_RX_MAX_SSI 60 /* best guess at max ssi */
diff --git a/drivers/net/wireless/b43legacy/dma.c b/drivers/net/wireless/b43legacy/dma.c
index 6e08405e8026..e87b427d5e43 100644
--- a/drivers/net/wireless/b43legacy/dma.c
+++ b/drivers/net/wireless/b43legacy/dma.c
@@ -354,7 +354,8 @@ return 0;
354} 354}
355 355
356 356
357u16 b43legacy_dmacontroller_base(int dma64bit, int controller_idx) 357static u16 b43legacy_dmacontroller_base(enum b43legacy_dmatype type,
358 int controller_idx)
358{ 359{
359 static const u16 map64[] = { 360 static const u16 map64[] = {
360 B43legacy_MMIO_DMA64_BASE0, 361 B43legacy_MMIO_DMA64_BASE0,
@@ -373,7 +374,7 @@ u16 b43legacy_dmacontroller_base(int dma64bit, int controller_idx)
373 B43legacy_MMIO_DMA32_BASE5, 374 B43legacy_MMIO_DMA32_BASE5,
374 }; 375 };
375 376
376 if (dma64bit) { 377 if (type == B43legacy_DMA_64BIT) {
377 B43legacy_WARN_ON(!(controller_idx >= 0 && 378 B43legacy_WARN_ON(!(controller_idx >= 0 &&
378 controller_idx < ARRAY_SIZE(map64))); 379 controller_idx < ARRAY_SIZE(map64)));
379 return map64[controller_idx]; 380 return map64[controller_idx];
@@ -480,8 +481,9 @@ static void free_ringmemory(struct b43legacy_dmaring *ring)
480} 481}
481 482
482/* Reset the RX DMA channel */ 483/* Reset the RX DMA channel */
483int b43legacy_dmacontroller_rx_reset(struct b43legacy_wldev *dev, 484static int b43legacy_dmacontroller_rx_reset(struct b43legacy_wldev *dev,
484 u16 mmio_base, int dma64) 485 u16 mmio_base,
486 enum b43legacy_dmatype type)
485{ 487{
486 int i; 488 int i;
487 u32 value; 489 u32 value;
@@ -489,13 +491,14 @@ int b43legacy_dmacontroller_rx_reset(struct b43legacy_wldev *dev,
489 491
490 might_sleep(); 492 might_sleep();
491 493
492 offset = dma64 ? B43legacy_DMA64_RXCTL : B43legacy_DMA32_RXCTL; 494 offset = (type == B43legacy_DMA_64BIT) ?
495 B43legacy_DMA64_RXCTL : B43legacy_DMA32_RXCTL;
493 b43legacy_write32(dev, mmio_base + offset, 0); 496 b43legacy_write32(dev, mmio_base + offset, 0);
494 for (i = 0; i < 10; i++) { 497 for (i = 0; i < 10; i++) {
495 offset = dma64 ? B43legacy_DMA64_RXSTATUS : 498 offset = (type == B43legacy_DMA_64BIT) ?
496 B43legacy_DMA32_RXSTATUS; 499 B43legacy_DMA64_RXSTATUS : B43legacy_DMA32_RXSTATUS;
497 value = b43legacy_read32(dev, mmio_base + offset); 500 value = b43legacy_read32(dev, mmio_base + offset);
498 if (dma64) { 501 if (type == B43legacy_DMA_64BIT) {
499 value &= B43legacy_DMA64_RXSTAT; 502 value &= B43legacy_DMA64_RXSTAT;
500 if (value == B43legacy_DMA64_RXSTAT_DISABLED) { 503 if (value == B43legacy_DMA64_RXSTAT_DISABLED) {
501 i = -1; 504 i = -1;
@@ -519,8 +522,9 @@ int b43legacy_dmacontroller_rx_reset(struct b43legacy_wldev *dev,
519} 522}
520 523
521/* Reset the RX DMA channel */ 524/* Reset the RX DMA channel */
522int b43legacy_dmacontroller_tx_reset(struct b43legacy_wldev *dev, 525static int b43legacy_dmacontroller_tx_reset(struct b43legacy_wldev *dev,
523 u16 mmio_base, int dma64) 526 u16 mmio_base,
527 enum b43legacy_dmatype type)
524{ 528{
525 int i; 529 int i;
526 u32 value; 530 u32 value;
@@ -529,10 +533,10 @@ int b43legacy_dmacontroller_tx_reset(struct b43legacy_wldev *dev,
529 might_sleep(); 533 might_sleep();
530 534
531 for (i = 0; i < 10; i++) { 535 for (i = 0; i < 10; i++) {
532 offset = dma64 ? B43legacy_DMA64_TXSTATUS : 536 offset = (type == B43legacy_DMA_64BIT) ?
533 B43legacy_DMA32_TXSTATUS; 537 B43legacy_DMA64_TXSTATUS : B43legacy_DMA32_TXSTATUS;
534 value = b43legacy_read32(dev, mmio_base + offset); 538 value = b43legacy_read32(dev, mmio_base + offset);
535 if (dma64) { 539 if (type == B43legacy_DMA_64BIT) {
536 value &= B43legacy_DMA64_TXSTAT; 540 value &= B43legacy_DMA64_TXSTAT;
537 if (value == B43legacy_DMA64_TXSTAT_DISABLED || 541 if (value == B43legacy_DMA64_TXSTAT_DISABLED ||
538 value == B43legacy_DMA64_TXSTAT_IDLEWAIT || 542 value == B43legacy_DMA64_TXSTAT_IDLEWAIT ||
@@ -547,13 +551,14 @@ int b43legacy_dmacontroller_tx_reset(struct b43legacy_wldev *dev,
547 } 551 }
548 msleep(1); 552 msleep(1);
549 } 553 }
550 offset = dma64 ? B43legacy_DMA64_TXCTL : B43legacy_DMA32_TXCTL; 554 offset = (type == B43legacy_DMA_64BIT) ? B43legacy_DMA64_TXCTL :
555 B43legacy_DMA32_TXCTL;
551 b43legacy_write32(dev, mmio_base + offset, 0); 556 b43legacy_write32(dev, mmio_base + offset, 0);
552 for (i = 0; i < 10; i++) { 557 for (i = 0; i < 10; i++) {
553 offset = dma64 ? B43legacy_DMA64_TXSTATUS : 558 offset = (type == B43legacy_DMA_64BIT) ?
554 B43legacy_DMA32_TXSTATUS; 559 B43legacy_DMA64_TXSTATUS : B43legacy_DMA32_TXSTATUS;
555 value = b43legacy_read32(dev, mmio_base + offset); 560 value = b43legacy_read32(dev, mmio_base + offset);
556 if (dma64) { 561 if (type == B43legacy_DMA_64BIT) {
557 value &= B43legacy_DMA64_TXSTAT; 562 value &= B43legacy_DMA64_TXSTAT;
558 if (value == B43legacy_DMA64_TXSTAT_DISABLED) { 563 if (value == B43legacy_DMA64_TXSTAT_DISABLED) {
559 i = -1; 564 i = -1;
@@ -578,6 +583,32 @@ int b43legacy_dmacontroller_tx_reset(struct b43legacy_wldev *dev,
578 return 0; 583 return 0;
579} 584}
580 585
586/* Check if a DMA mapping address is invalid. */
587static bool b43legacy_dma_mapping_error(struct b43legacy_dmaring *ring,
588 dma_addr_t addr,
589 size_t buffersize)
590{
591 if (unlikely(dma_mapping_error(addr)))
592 return 1;
593
594 switch (ring->type) {
595 case B43legacy_DMA_30BIT:
596 if ((u64)addr + buffersize > (1ULL << 30))
597 return 1;
598 break;
599 case B43legacy_DMA_32BIT:
600 if ((u64)addr + buffersize > (1ULL << 32))
601 return 1;
602 break;
603 case B43legacy_DMA_64BIT:
604 /* Currently we can't have addresses beyond 64 bits in the kernel. */
605 break;
606 }
607
608 /* The address is OK. */
609 return 0;
610}
611
581static int setup_rx_descbuffer(struct b43legacy_dmaring *ring, 612static int setup_rx_descbuffer(struct b43legacy_dmaring *ring,
582 struct b43legacy_dmadesc_generic *desc, 613 struct b43legacy_dmadesc_generic *desc,
583 struct b43legacy_dmadesc_meta *meta, 614 struct b43legacy_dmadesc_meta *meta,
@@ -595,7 +626,7 @@ static int setup_rx_descbuffer(struct b43legacy_dmaring *ring,
595 return -ENOMEM; 626 return -ENOMEM;
596 dmaaddr = map_descbuffer(ring, skb->data, 627 dmaaddr = map_descbuffer(ring, skb->data,
597 ring->rx_buffersize, 0); 628 ring->rx_buffersize, 0);
598 if (dma_mapping_error(dmaaddr)) { 629 if (b43legacy_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize)) {
599 /* ugh. try to realloc in zone_dma */ 630 /* ugh. try to realloc in zone_dma */
600 gfp_flags |= GFP_DMA; 631 gfp_flags |= GFP_DMA;
601 632
@@ -608,7 +639,7 @@ static int setup_rx_descbuffer(struct b43legacy_dmaring *ring,
608 ring->rx_buffersize, 0); 639 ring->rx_buffersize, 0);
609 } 640 }
610 641
611 if (dma_mapping_error(dmaaddr)) { 642 if (b43legacy_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize)) {
612 dev_kfree_skb_any(skb); 643 dev_kfree_skb_any(skb);
613 return -EIO; 644 return -EIO;
614 } 645 }
@@ -674,7 +705,7 @@ static int dmacontroller_setup(struct b43legacy_dmaring *ring)
674 u32 trans = ssb_dma_translation(ring->dev->dev); 705 u32 trans = ssb_dma_translation(ring->dev->dev);
675 706
676 if (ring->tx) { 707 if (ring->tx) {
677 if (ring->dma64) { 708 if (ring->type == B43legacy_DMA_64BIT) {
678 u64 ringbase = (u64)(ring->dmabase); 709 u64 ringbase = (u64)(ring->dmabase);
679 710
680 addrext = ((ringbase >> 32) & SSB_DMA_TRANSLATION_MASK) 711 addrext = ((ringbase >> 32) & SSB_DMA_TRANSLATION_MASK)
@@ -709,7 +740,7 @@ static int dmacontroller_setup(struct b43legacy_dmaring *ring)
709 err = alloc_initial_descbuffers(ring); 740 err = alloc_initial_descbuffers(ring);
710 if (err) 741 if (err)
711 goto out; 742 goto out;
712 if (ring->dma64) { 743 if (ring->type == B43legacy_DMA_64BIT) {
713 u64 ringbase = (u64)(ring->dmabase); 744 u64 ringbase = (u64)(ring->dmabase);
714 745
715 addrext = ((ringbase >> 32) & SSB_DMA_TRANSLATION_MASK) 746 addrext = ((ringbase >> 32) & SSB_DMA_TRANSLATION_MASK)
@@ -760,16 +791,16 @@ static void dmacontroller_cleanup(struct b43legacy_dmaring *ring)
760{ 791{
761 if (ring->tx) { 792 if (ring->tx) {
762 b43legacy_dmacontroller_tx_reset(ring->dev, ring->mmio_base, 793 b43legacy_dmacontroller_tx_reset(ring->dev, ring->mmio_base,
763 ring->dma64); 794 ring->type);
764 if (ring->dma64) { 795 if (ring->type == B43legacy_DMA_64BIT) {
765 b43legacy_dma_write(ring, B43legacy_DMA64_TXRINGLO, 0); 796 b43legacy_dma_write(ring, B43legacy_DMA64_TXRINGLO, 0);
766 b43legacy_dma_write(ring, B43legacy_DMA64_TXRINGHI, 0); 797 b43legacy_dma_write(ring, B43legacy_DMA64_TXRINGHI, 0);
767 } else 798 } else
768 b43legacy_dma_write(ring, B43legacy_DMA32_TXRING, 0); 799 b43legacy_dma_write(ring, B43legacy_DMA32_TXRING, 0);
769 } else { 800 } else {
770 b43legacy_dmacontroller_rx_reset(ring->dev, ring->mmio_base, 801 b43legacy_dmacontroller_rx_reset(ring->dev, ring->mmio_base,
771 ring->dma64); 802 ring->type);
772 if (ring->dma64) { 803 if (ring->type == B43legacy_DMA_64BIT) {
773 b43legacy_dma_write(ring, B43legacy_DMA64_RXRINGLO, 0); 804 b43legacy_dma_write(ring, B43legacy_DMA64_RXRINGLO, 0);
774 b43legacy_dma_write(ring, B43legacy_DMA64_RXRINGHI, 0); 805 b43legacy_dma_write(ring, B43legacy_DMA64_RXRINGHI, 0);
775 } else 806 } else
@@ -824,11 +855,10 @@ static u64 supported_dma_mask(struct b43legacy_wldev *dev)
824 855
825/* Main initialization function. */ 856/* Main initialization function. */
826static 857static
827struct b43legacy_dmaring *b43legacy_setup_dmaring( 858struct b43legacy_dmaring *b43legacy_setup_dmaring(struct b43legacy_wldev *dev,
828 struct b43legacy_wldev *dev, 859 int controller_index,
829 int controller_index, 860 int for_tx,
830 int for_tx, 861 enum b43legacy_dmatype type)
831 int dma64)
832{ 862{
833 struct b43legacy_dmaring *ring; 863 struct b43legacy_dmaring *ring;
834 int err; 864 int err;
@@ -838,6 +868,7 @@ struct b43legacy_dmaring *b43legacy_setup_dmaring(
838 ring = kzalloc(sizeof(*ring), GFP_KERNEL); 868 ring = kzalloc(sizeof(*ring), GFP_KERNEL);
839 if (!ring) 869 if (!ring)
840 goto out; 870 goto out;
871 ring->type = type;
841 872
842 nr_slots = B43legacy_RXRING_SLOTS; 873 nr_slots = B43legacy_RXRING_SLOTS;
843 if (for_tx) 874 if (for_tx)
@@ -855,12 +886,12 @@ struct b43legacy_dmaring *b43legacy_setup_dmaring(
855 goto err_kfree_meta; 886 goto err_kfree_meta;
856 887
857 /* test for ability to dma to txhdr_cache */ 888 /* test for ability to dma to txhdr_cache */
858 dma_test = dma_map_single(dev->dev->dev, 889 dma_test = dma_map_single(dev->dev->dev, ring->txhdr_cache,
859 ring->txhdr_cache, 890 sizeof(struct b43legacy_txhdr_fw3),
860 sizeof(struct b43legacy_txhdr_fw3), 891 DMA_TO_DEVICE);
861 DMA_TO_DEVICE);
862 892
863 if (dma_mapping_error(dma_test)) { 893 if (b43legacy_dma_mapping_error(ring, dma_test,
894 sizeof(struct b43legacy_txhdr_fw3))) {
864 /* ugh realloc */ 895 /* ugh realloc */
865 kfree(ring->txhdr_cache); 896 kfree(ring->txhdr_cache);
866 ring->txhdr_cache = kcalloc(nr_slots, 897 ring->txhdr_cache = kcalloc(nr_slots,
@@ -874,7 +905,8 @@ struct b43legacy_dmaring *b43legacy_setup_dmaring(
874 sizeof(struct b43legacy_txhdr_fw3), 905 sizeof(struct b43legacy_txhdr_fw3),
875 DMA_TO_DEVICE); 906 DMA_TO_DEVICE);
876 907
877 if (dma_mapping_error(dma_test)) 908 if (b43legacy_dma_mapping_error(ring, dma_test,
909 sizeof(struct b43legacy_txhdr_fw3)))
878 goto err_kfree_txhdr_cache; 910 goto err_kfree_txhdr_cache;
879 } 911 }
880 912
@@ -885,11 +917,9 @@ struct b43legacy_dmaring *b43legacy_setup_dmaring(
885 917
886 ring->dev = dev; 918 ring->dev = dev;
887 ring->nr_slots = nr_slots; 919 ring->nr_slots = nr_slots;
888 ring->mmio_base = b43legacy_dmacontroller_base(dma64, 920 ring->mmio_base = b43legacy_dmacontroller_base(type, controller_index);
889 controller_index);
890 ring->index = controller_index; 921 ring->index = controller_index;
891 ring->dma64 = !!dma64; 922 if (type == B43legacy_DMA_64BIT)
892 if (dma64)
893 ring->ops = &dma64_ops; 923 ring->ops = &dma64_ops;
894 else 924 else
895 ring->ops = &dma32_ops; 925 ring->ops = &dma32_ops;
@@ -939,10 +969,10 @@ static void b43legacy_destroy_dmaring(struct b43legacy_dmaring *ring)
939 if (!ring) 969 if (!ring)
940 return; 970 return;
941 971
942 b43legacydbg(ring->dev->wl, "DMA-%s 0x%04X (%s) max used slots:" 972 b43legacydbg(ring->dev->wl, "DMA-%u 0x%04X (%s) max used slots:"
943 " %d/%d\n", (ring->dma64) ? "64" : "32", ring->mmio_base, 973 " %d/%d\n", (unsigned int)(ring->type), ring->mmio_base,
944 (ring->tx) ? "TX" : "RX", 974 (ring->tx) ? "TX" : "RX", ring->max_used_slots,
945 ring->max_used_slots, ring->nr_slots); 975 ring->nr_slots);
946 /* Device IRQs are disabled prior entering this function, 976 /* Device IRQs are disabled prior entering this function,
947 * so no need to take care of concurrency with rx handler stuff. 977 * so no need to take care of concurrency with rx handler stuff.
948 */ 978 */
@@ -988,11 +1018,22 @@ int b43legacy_dma_init(struct b43legacy_wldev *dev)
988 struct b43legacy_dmaring *ring; 1018 struct b43legacy_dmaring *ring;
989 int err; 1019 int err;
990 u64 dmamask; 1020 u64 dmamask;
991 int dma64 = 0; 1021 enum b43legacy_dmatype type;
992 1022
993 dmamask = supported_dma_mask(dev); 1023 dmamask = supported_dma_mask(dev);
994 if (dmamask == DMA_64BIT_MASK) 1024 switch (dmamask) {
995 dma64 = 1; 1025 default:
1026 B43legacy_WARN_ON(1);
1027 case DMA_30BIT_MASK:
1028 type = B43legacy_DMA_30BIT;
1029 break;
1030 case DMA_32BIT_MASK:
1031 type = B43legacy_DMA_32BIT;
1032 break;
1033 case DMA_64BIT_MASK:
1034 type = B43legacy_DMA_64BIT;
1035 break;
1036 }
996 1037
997 err = ssb_dma_set_mask(dev->dev, dmamask); 1038 err = ssb_dma_set_mask(dev->dev, dmamask);
998 if (err) { 1039 if (err) {
@@ -1010,52 +1051,50 @@ int b43legacy_dma_init(struct b43legacy_wldev *dev)
1010 1051
1011 err = -ENOMEM; 1052 err = -ENOMEM;
1012 /* setup TX DMA channels. */ 1053 /* setup TX DMA channels. */
1013 ring = b43legacy_setup_dmaring(dev, 0, 1, dma64); 1054 ring = b43legacy_setup_dmaring(dev, 0, 1, type);
1014 if (!ring) 1055 if (!ring)
1015 goto out; 1056 goto out;
1016 dma->tx_ring0 = ring; 1057 dma->tx_ring0 = ring;
1017 1058
1018 ring = b43legacy_setup_dmaring(dev, 1, 1, dma64); 1059 ring = b43legacy_setup_dmaring(dev, 1, 1, type);
1019 if (!ring) 1060 if (!ring)
1020 goto err_destroy_tx0; 1061 goto err_destroy_tx0;
1021 dma->tx_ring1 = ring; 1062 dma->tx_ring1 = ring;
1022 1063
1023 ring = b43legacy_setup_dmaring(dev, 2, 1, dma64); 1064 ring = b43legacy_setup_dmaring(dev, 2, 1, type);
1024 if (!ring) 1065 if (!ring)
1025 goto err_destroy_tx1; 1066 goto err_destroy_tx1;
1026 dma->tx_ring2 = ring; 1067 dma->tx_ring2 = ring;
1027 1068
1028 ring = b43legacy_setup_dmaring(dev, 3, 1, dma64); 1069 ring = b43legacy_setup_dmaring(dev, 3, 1, type);
1029 if (!ring) 1070 if (!ring)
1030 goto err_destroy_tx2; 1071 goto err_destroy_tx2;
1031 dma->tx_ring3 = ring; 1072 dma->tx_ring3 = ring;
1032 1073
1033 ring = b43legacy_setup_dmaring(dev, 4, 1, dma64); 1074 ring = b43legacy_setup_dmaring(dev, 4, 1, type);
1034 if (!ring) 1075 if (!ring)
1035 goto err_destroy_tx3; 1076 goto err_destroy_tx3;
1036 dma->tx_ring4 = ring; 1077 dma->tx_ring4 = ring;
1037 1078
1038 ring = b43legacy_setup_dmaring(dev, 5, 1, dma64); 1079 ring = b43legacy_setup_dmaring(dev, 5, 1, type);
1039 if (!ring) 1080 if (!ring)
1040 goto err_destroy_tx4; 1081 goto err_destroy_tx4;
1041 dma->tx_ring5 = ring; 1082 dma->tx_ring5 = ring;
1042 1083
1043 /* setup RX DMA channels. */ 1084 /* setup RX DMA channels. */
1044 ring = b43legacy_setup_dmaring(dev, 0, 0, dma64); 1085 ring = b43legacy_setup_dmaring(dev, 0, 0, type);
1045 if (!ring) 1086 if (!ring)
1046 goto err_destroy_tx5; 1087 goto err_destroy_tx5;
1047 dma->rx_ring0 = ring; 1088 dma->rx_ring0 = ring;
1048 1089
1049 if (dev->dev->id.revision < 5) { 1090 if (dev->dev->id.revision < 5) {
1050 ring = b43legacy_setup_dmaring(dev, 3, 0, dma64); 1091 ring = b43legacy_setup_dmaring(dev, 3, 0, type);
1051 if (!ring) 1092 if (!ring)
1052 goto err_destroy_rx0; 1093 goto err_destroy_rx0;
1053 dma->rx_ring3 = ring; 1094 dma->rx_ring3 = ring;
1054 } 1095 }
1055 1096
1056 b43legacydbg(dev->wl, "%d-bit DMA initialized\n", 1097 b43legacydbg(dev->wl, "%u-bit DMA initialized\n", (unsigned int)type);
1057 (dmamask == DMA_64BIT_MASK) ? 64 :
1058 (dmamask == DMA_32BIT_MASK) ? 32 : 30);
1059 err = 0; 1098 err = 0;
1060out: 1099out:
1061 return err; 1100 return err;
@@ -1194,9 +1233,13 @@ static int dma_tx_fragment(struct b43legacy_dmaring *ring,
1194 } 1233 }
1195 1234
1196 meta_hdr->dmaaddr = map_descbuffer(ring, (unsigned char *)header, 1235 meta_hdr->dmaaddr = map_descbuffer(ring, (unsigned char *)header,
1197 sizeof(struct b43legacy_txhdr_fw3), 1); 1236 sizeof(struct b43legacy_txhdr_fw3), 1);
1198 if (dma_mapping_error(meta_hdr->dmaaddr)) 1237 if (b43legacy_dma_mapping_error(ring, meta_hdr->dmaaddr,
1238 sizeof(struct b43legacy_txhdr_fw3))) {
1239 ring->current_slot = old_top_slot;
1240 ring->used_slots = old_used_slots;
1199 return -EIO; 1241 return -EIO;
1242 }
1200 ops->fill_descriptor(ring, desc, meta_hdr->dmaaddr, 1243 ops->fill_descriptor(ring, desc, meta_hdr->dmaaddr,
1201 sizeof(struct b43legacy_txhdr_fw3), 1, 0, 0); 1244 sizeof(struct b43legacy_txhdr_fw3), 1, 0, 0);
1202 1245
@@ -1211,7 +1254,7 @@ static int dma_tx_fragment(struct b43legacy_dmaring *ring,
1211 1254
1212 meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1); 1255 meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1);
1213 /* create a bounce buffer in zone_dma on mapping failure. */ 1256 /* create a bounce buffer in zone_dma on mapping failure. */
1214 if (dma_mapping_error(meta->dmaaddr)) { 1257 if (b43legacy_dma_mapping_error(ring, meta->dmaaddr, skb->len)) {
1215 bounce_skb = __dev_alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA); 1258 bounce_skb = __dev_alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA);
1216 if (!bounce_skb) { 1259 if (!bounce_skb) {
1217 ring->current_slot = old_top_slot; 1260 ring->current_slot = old_top_slot;
@@ -1225,7 +1268,7 @@ static int dma_tx_fragment(struct b43legacy_dmaring *ring,
1225 skb = bounce_skb; 1268 skb = bounce_skb;
1226 meta->skb = skb; 1269 meta->skb = skb;
1227 meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1); 1270 meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1);
1228 if (dma_mapping_error(meta->dmaaddr)) { 1271 if (b43legacy_dma_mapping_error(ring, meta->dmaaddr, skb->len)) {
1229 ring->current_slot = old_top_slot; 1272 ring->current_slot = old_top_slot;
1230 ring->used_slots = old_used_slots; 1273 ring->used_slots = old_used_slots;
1231 err = -EIO; 1274 err = -EIO;
diff --git a/drivers/net/wireless/b43legacy/dma.h b/drivers/net/wireless/b43legacy/dma.h
index 26f6ab08de75..2dd488c5be2d 100644
--- a/drivers/net/wireless/b43legacy/dma.h
+++ b/drivers/net/wireless/b43legacy/dma.h
@@ -218,6 +218,12 @@ struct b43legacy_dma_ops {
218 void (*set_current_rxslot)(struct b43legacy_dmaring *ring, int slot); 218 void (*set_current_rxslot)(struct b43legacy_dmaring *ring, int slot);
219}; 219};
220 220
221enum b43legacy_dmatype {
222 B43legacy_DMA_30BIT = 30,
223 B43legacy_DMA_32BIT = 32,
224 B43legacy_DMA_64BIT = 64,
225};
226
221struct b43legacy_dmaring { 227struct b43legacy_dmaring {
222 /* Lowlevel DMA ops. */ 228 /* Lowlevel DMA ops. */
223 const struct b43legacy_dma_ops *ops; 229 const struct b43legacy_dma_ops *ops;
@@ -250,8 +256,8 @@ struct b43legacy_dmaring {
250 int index; 256 int index;
251 /* Boolean. Is this a TX ring? */ 257 /* Boolean. Is this a TX ring? */
252 bool tx; 258 bool tx;
253 /* Boolean. 64bit DMA if true, 32bit DMA otherwise. */ 259 /* The type of DMA engine used. */
254 bool dma64; 260 enum b43legacy_dmatype type;
255 /* Boolean. Is this ring stopped at ieee80211 level? */ 261 /* Boolean. Is this ring stopped at ieee80211 level? */
256 bool stopped; 262 bool stopped;
257 /* Lock, only used for TX. */ 263 /* Lock, only used for TX. */
@@ -284,15 +290,6 @@ void b43legacy_dma_write(struct b43legacy_dmaring *ring,
284int b43legacy_dma_init(struct b43legacy_wldev *dev); 290int b43legacy_dma_init(struct b43legacy_wldev *dev);
285void b43legacy_dma_free(struct b43legacy_wldev *dev); 291void b43legacy_dma_free(struct b43legacy_wldev *dev);
286 292
287int b43legacy_dmacontroller_rx_reset(struct b43legacy_wldev *dev,
288 u16 dmacontroller_mmio_base,
289 int dma64);
290int b43legacy_dmacontroller_tx_reset(struct b43legacy_wldev *dev,
291 u16 dmacontroller_mmio_base,
292 int dma64);
293
294u16 b43legacy_dmacontroller_base(int dma64bit, int dmacontroller_idx);
295
296void b43legacy_dma_tx_suspend(struct b43legacy_wldev *dev); 293void b43legacy_dma_tx_suspend(struct b43legacy_wldev *dev);
297void b43legacy_dma_tx_resume(struct b43legacy_wldev *dev); 294void b43legacy_dma_tx_resume(struct b43legacy_wldev *dev);
298 295
@@ -320,20 +317,6 @@ void b43legacy_dma_free(struct b43legacy_wldev *dev)
320{ 317{
321} 318}
322static inline 319static inline
323int b43legacy_dmacontroller_rx_reset(struct b43legacy_wldev *dev,
324 u16 dmacontroller_mmio_base,
325 int dma64)
326{
327 return 0;
328}
329static inline
330int b43legacy_dmacontroller_tx_reset(struct b43legacy_wldev *dev,
331 u16 dmacontroller_mmio_base,
332 int dma64)
333{
334 return 0;
335}
336static inline
337void b43legacy_dma_get_tx_stats(struct b43legacy_wldev *dev, 320void b43legacy_dma_get_tx_stats(struct b43legacy_wldev *dev,
338 struct ieee80211_tx_queue_stats *stats) 321 struct ieee80211_tx_queue_stats *stats)
339{ 322{
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index 53f7f2e97615..c39de422e220 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -3,7 +3,7 @@
3 * Broadcom B43legacy wireless driver 3 * Broadcom B43legacy wireless driver
4 * 4 *
5 * Copyright (c) 2005 Martin Langer <martin-langer@gmx.de> 5 * Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>
6 * Copyright (c) 2005-2007 Stefano Brivio <stefano.brivio@polimi.it> 6 * Copyright (c) 2005-2008 Stefano Brivio <stefano.brivio@polimi.it>
7 * Copyright (c) 2005, 2006 Michael Buesch <mb@bu3sch.de> 7 * Copyright (c) 2005, 2006 Michael Buesch <mb@bu3sch.de>
8 * Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org> 8 * Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org>
9 * Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch> 9 * Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
@@ -60,6 +60,8 @@ MODULE_AUTHOR("Stefano Brivio");
60MODULE_AUTHOR("Michael Buesch"); 60MODULE_AUTHOR("Michael Buesch");
61MODULE_LICENSE("GPL"); 61MODULE_LICENSE("GPL");
62 62
63MODULE_FIRMWARE(B43legacy_SUPPORTED_FIRMWARE_ID);
64
63#if defined(CONFIG_B43LEGACY_DMA) && defined(CONFIG_B43LEGACY_PIO) 65#if defined(CONFIG_B43LEGACY_DMA) && defined(CONFIG_B43LEGACY_PIO)
64static int modparam_pio; 66static int modparam_pio;
65module_param_named(pio, modparam_pio, int, 0444); 67module_param_named(pio, modparam_pio, int, 0444);
@@ -1640,10 +1642,11 @@ static int b43legacy_upload_microcode(struct b43legacy_wldev *dev)
1640 err = -EOPNOTSUPP; 1642 err = -EOPNOTSUPP;
1641 goto error; 1643 goto error;
1642 } 1644 }
1643 b43legacydbg(dev->wl, "Loading firmware version 0x%X, patch level %u " 1645 b43legacyinfo(dev->wl, "Loading firmware version 0x%X, patch level %u "
1644 "(20%.2i-%.2i-%.2i %.2i:%.2i:%.2i)\n", fwrev, fwpatch, 1646 "(20%.2i-%.2i-%.2i %.2i:%.2i:%.2i)\n", fwrev, fwpatch,
1645 (fwdate >> 12) & 0xF, (fwdate >> 8) & 0xF, fwdate & 0xFF, 1647 (fwdate >> 12) & 0xF, (fwdate >> 8) & 0xF, fwdate & 0xFF,
1646 (fwtime >> 11) & 0x1F, (fwtime >> 5) & 0x3F, fwtime & 0x1F); 1648 (fwtime >> 11) & 0x1F, (fwtime >> 5) & 0x3F,
1649 fwtime & 0x1F);
1647 1650
1648 dev->fw.rev = fwrev; 1651 dev->fw.rev = fwrev;
1649 dev->fw.patch = fwpatch; 1652 dev->fw.patch = fwpatch;
@@ -3806,6 +3809,32 @@ static struct ssb_driver b43legacy_ssb_driver = {
3806 .resume = b43legacy_resume, 3809 .resume = b43legacy_resume,
3807}; 3810};
3808 3811
3812static void b43legacy_print_driverinfo(void)
3813{
3814 const char *feat_pci = "", *feat_leds = "", *feat_rfkill = "",
3815 *feat_pio = "", *feat_dma = "";
3816
3817#ifdef CONFIG_B43LEGACY_PCI_AUTOSELECT
3818 feat_pci = "P";
3819#endif
3820#ifdef CONFIG_B43LEGACY_LEDS
3821 feat_leds = "L";
3822#endif
3823#ifdef CONFIG_B43LEGACY_RFKILL
3824 feat_rfkill = "R";
3825#endif
3826#ifdef CONFIG_B43LEGACY_PIO
3827 feat_pio = "I";
3828#endif
3829#ifdef CONFIG_B43LEGACY_DMA
3830 feat_dma = "D";
3831#endif
3832 printk(KERN_INFO "Broadcom 43xx driver loaded "
3833 "[ Features: %s%s%s%s%s, Firmware-ID: "
3834 B43legacy_SUPPORTED_FIRMWARE_ID " ]\n",
3835 feat_pci, feat_leds, feat_rfkill, feat_pio, feat_dma);
3836}
3837
3809static int __init b43legacy_init(void) 3838static int __init b43legacy_init(void)
3810{ 3839{
3811 int err; 3840 int err;
@@ -3816,6 +3845,8 @@ static int __init b43legacy_init(void)
3816 if (err) 3845 if (err)
3817 goto err_dfs_exit; 3846 goto err_dfs_exit;
3818 3847
3848 b43legacy_print_driverinfo();
3849
3819 return err; 3850 return err;
3820 3851
3821err_dfs_exit: 3852err_dfs_exit:
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 3e6ad7b92c83..a56d9fc6354f 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -3365,7 +3365,6 @@ static void ipw_rx_queue_reset(struct ipw_priv *priv,
3365 /* Set us so that we have processed and used all buffers, but have 3365 /* Set us so that we have processed and used all buffers, but have
3366 * not restocked the Rx queue with fresh buffers */ 3366 * not restocked the Rx queue with fresh buffers */
3367 rxq->read = rxq->write = 0; 3367 rxq->read = rxq->write = 0;
3368 rxq->processed = RX_QUEUE_SIZE - 1;
3369 rxq->free_count = 0; 3368 rxq->free_count = 0;
3370 spin_unlock_irqrestore(&rxq->lock, flags); 3369 spin_unlock_irqrestore(&rxq->lock, flags);
3371} 3370}
@@ -3607,7 +3606,22 @@ static int ipw_load(struct ipw_priv *priv)
3607 * Driver allocates buffers of this size for Rx 3606 * Driver allocates buffers of this size for Rx
3608 */ 3607 */
3609 3608
3610static inline int ipw_queue_space(const struct clx2_queue *q) 3609/**
3610 * ipw_rx_queue_space - Return number of free slots available in queue.
3611 */
3612static int ipw_rx_queue_space(const struct ipw_rx_queue *q)
3613{
3614 int s = q->read - q->write;
3615 if (s <= 0)
3616 s += RX_QUEUE_SIZE;
3617 /* keep some buffer to not confuse full and empty queue */
3618 s -= 2;
3619 if (s < 0)
3620 s = 0;
3621 return s;
3622}
3623
3624static inline int ipw_tx_queue_space(const struct clx2_queue *q)
3611{ 3625{
3612 int s = q->last_used - q->first_empty; 3626 int s = q->last_used - q->first_empty;
3613 if (s <= 0) 3627 if (s <= 0)
@@ -4947,7 +4961,7 @@ static int ipw_queue_tx_reclaim(struct ipw_priv *priv,
4947 priv->tx_packets++; 4961 priv->tx_packets++;
4948 } 4962 }
4949 done: 4963 done:
4950 if ((ipw_queue_space(q) > q->low_mark) && 4964 if ((ipw_tx_queue_space(q) > q->low_mark) &&
4951 (qindex >= 0) && 4965 (qindex >= 0) &&
4952 (priv->status & STATUS_ASSOCIATED) && netif_running(priv->net_dev)) 4966 (priv->status & STATUS_ASSOCIATED) && netif_running(priv->net_dev))
4953 netif_wake_queue(priv->net_dev); 4967 netif_wake_queue(priv->net_dev);
@@ -4965,7 +4979,7 @@ static int ipw_queue_tx_hcmd(struct ipw_priv *priv, int hcmd, void *buf,
4965 struct clx2_queue *q = &txq->q; 4979 struct clx2_queue *q = &txq->q;
4966 struct tfd_frame *tfd; 4980 struct tfd_frame *tfd;
4967 4981
4968 if (ipw_queue_space(q) < (sync ? 1 : 2)) { 4982 if (ipw_tx_queue_space(q) < (sync ? 1 : 2)) {
4969 IPW_ERROR("No space for Tx\n"); 4983 IPW_ERROR("No space for Tx\n");
4970 return -EBUSY; 4984 return -EBUSY;
4971 } 4985 }
@@ -5070,7 +5084,7 @@ static void ipw_rx_queue_restock(struct ipw_priv *priv)
5070 5084
5071 spin_lock_irqsave(&rxq->lock, flags); 5085 spin_lock_irqsave(&rxq->lock, flags);
5072 write = rxq->write; 5086 write = rxq->write;
5073 while ((rxq->write != rxq->processed) && (rxq->free_count)) { 5087 while ((ipw_rx_queue_space(rxq) > 0) && (rxq->free_count)) {
5074 element = rxq->rx_free.next; 5088 element = rxq->rx_free.next;
5075 rxb = list_entry(element, struct ipw_rx_mem_buffer, list); 5089 rxb = list_entry(element, struct ipw_rx_mem_buffer, list);
5076 list_del(element); 5090 list_del(element);
@@ -5187,7 +5201,6 @@ static struct ipw_rx_queue *ipw_rx_queue_alloc(struct ipw_priv *priv)
5187 /* Set us so that we have processed and used all buffers, but have 5201 /* Set us so that we have processed and used all buffers, but have
5188 * not restocked the Rx queue with fresh buffers */ 5202 * not restocked the Rx queue with fresh buffers */
5189 rxq->read = rxq->write = 0; 5203 rxq->read = rxq->write = 0;
5190 rxq->processed = RX_QUEUE_SIZE - 1;
5191 rxq->free_count = 0; 5204 rxq->free_count = 0;
5192 5205
5193 return rxq; 5206 return rxq;
@@ -8223,13 +8236,17 @@ static void ipw_rx(struct ipw_priv *priv)
8223 struct ieee80211_hdr_4addr *header; 8236 struct ieee80211_hdr_4addr *header;
8224 u32 r, w, i; 8237 u32 r, w, i;
8225 u8 network_packet; 8238 u8 network_packet;
8239 u8 fill_rx = 0;
8226 DECLARE_MAC_BUF(mac); 8240 DECLARE_MAC_BUF(mac);
8227 DECLARE_MAC_BUF(mac2); 8241 DECLARE_MAC_BUF(mac2);
8228 DECLARE_MAC_BUF(mac3); 8242 DECLARE_MAC_BUF(mac3);
8229 8243
8230 r = ipw_read32(priv, IPW_RX_READ_INDEX); 8244 r = ipw_read32(priv, IPW_RX_READ_INDEX);
8231 w = ipw_read32(priv, IPW_RX_WRITE_INDEX); 8245 w = ipw_read32(priv, IPW_RX_WRITE_INDEX);
8232 i = (priv->rxq->processed + 1) % RX_QUEUE_SIZE; 8246 i = priv->rxq->read;
8247
8248 if (ipw_rx_queue_space (priv->rxq) > (RX_QUEUE_SIZE / 2))
8249 fill_rx = 1;
8233 8250
8234 while (i != r) { 8251 while (i != r) {
8235 rxb = priv->rxq->queue[i]; 8252 rxb = priv->rxq->queue[i];
@@ -8404,11 +8421,17 @@ static void ipw_rx(struct ipw_priv *priv)
8404 list_add_tail(&rxb->list, &priv->rxq->rx_used); 8421 list_add_tail(&rxb->list, &priv->rxq->rx_used);
8405 8422
8406 i = (i + 1) % RX_QUEUE_SIZE; 8423 i = (i + 1) % RX_QUEUE_SIZE;
8424
8425 /* If there are a lot of unsued frames, restock the Rx queue
8426 * so the ucode won't assert */
8427 if (fill_rx) {
8428 priv->rxq->read = i;
8429 ipw_rx_queue_replenish(priv);
8430 }
8407 } 8431 }
8408 8432
8409 /* Backtrack one entry */ 8433 /* Backtrack one entry */
8410 priv->rxq->processed = (i ? i : RX_QUEUE_SIZE) - 1; 8434 priv->rxq->read = i;
8411
8412 ipw_rx_queue_restock(priv); 8435 ipw_rx_queue_restock(priv);
8413} 8436}
8414 8437
@@ -10336,7 +10359,7 @@ static int ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb,
10336 q->first_empty = ipw_queue_inc_wrap(q->first_empty, q->n_bd); 10359 q->first_empty = ipw_queue_inc_wrap(q->first_empty, q->n_bd);
10337 ipw_write32(priv, q->reg_w, q->first_empty); 10360 ipw_write32(priv, q->reg_w, q->first_empty);
10338 10361
10339 if (ipw_queue_space(q) < q->high_mark) 10362 if (ipw_tx_queue_space(q) < q->high_mark)
10340 netif_stop_queue(priv->net_dev); 10363 netif_stop_queue(priv->net_dev);
10341 10364
10342 return NETDEV_TX_OK; 10365 return NETDEV_TX_OK;
@@ -10357,7 +10380,7 @@ static int ipw_net_is_queue_full(struct net_device *dev, int pri)
10357 struct clx2_tx_queue *txq = &priv->txq[0]; 10380 struct clx2_tx_queue *txq = &priv->txq[0];
10358#endif /* CONFIG_IPW2200_QOS */ 10381#endif /* CONFIG_IPW2200_QOS */
10359 10382
10360 if (ipw_queue_space(&txq->q) < txq->q.high_mark) 10383 if (ipw_tx_queue_space(&txq->q) < txq->q.high_mark)
10361 return 1; 10384 return 1;
10362 10385
10363 return 0; 10386 return 0;
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 5ee1ad69898b..40b71bc2c4a4 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -687,6 +687,12 @@ static int iwl3945_enqueue_hcmd(struct iwl3945_priv *priv, struct iwl3945_host_c
687 BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) && 687 BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) &&
688 !(cmd->meta.flags & CMD_SIZE_HUGE)); 688 !(cmd->meta.flags & CMD_SIZE_HUGE));
689 689
690
691 if (iwl3945_is_rfkill(priv)) {
692 IWL_DEBUG_INFO("Not sending command - RF KILL");
693 return -EIO;
694 }
695
690 if (iwl3945_queue_space(q) < ((cmd->meta.flags & CMD_ASYNC) ? 2 : 1)) { 696 if (iwl3945_queue_space(q) < ((cmd->meta.flags & CMD_ASYNC) ? 2 : 1)) {
691 IWL_ERROR("No space for Tx\n"); 697 IWL_ERROR("No space for Tx\n");
692 return -ENOSPC; 698 return -ENOSPC;
@@ -1580,7 +1586,7 @@ static inline int iwl3945_eeprom_acquire_semaphore(struct iwl3945_priv *priv)
1580 */ 1586 */
1581int iwl3945_eeprom_init(struct iwl3945_priv *priv) 1587int iwl3945_eeprom_init(struct iwl3945_priv *priv)
1582{ 1588{
1583 __le16 *e = (__le16 *)&priv->eeprom; 1589 u16 *e = (u16 *)&priv->eeprom;
1584 u32 gp = iwl3945_read32(priv, CSR_EEPROM_GP); 1590 u32 gp = iwl3945_read32(priv, CSR_EEPROM_GP);
1585 u32 r; 1591 u32 r;
1586 int sz = sizeof(priv->eeprom); 1592 int sz = sizeof(priv->eeprom);
@@ -1623,7 +1629,7 @@ int iwl3945_eeprom_init(struct iwl3945_priv *priv)
1623 IWL_ERROR("Time out reading EEPROM[%d]", addr); 1629 IWL_ERROR("Time out reading EEPROM[%d]", addr);
1624 return -ETIMEDOUT; 1630 return -ETIMEDOUT;
1625 } 1631 }
1626 e[addr / 2] = cpu_to_le16(r >> 16); 1632 e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16));
1627 } 1633 }
1628 1634
1629 return 0; 1635 return 0;
@@ -2806,7 +2812,8 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv,
2806#endif 2812#endif
2807 2813
2808 /* drop all data frame if we are not associated */ 2814 /* drop all data frame if we are not associated */
2809 if ((!iwl3945_is_associated(priv) || !priv->assoc_id) && 2815 if ((!iwl3945_is_associated(priv) ||
2816 ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && !priv->assoc_id)) &&
2810 ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) { 2817 ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) {
2811 IWL_DEBUG_DROP("Dropping - !iwl3945_is_associated\n"); 2818 IWL_DEBUG_DROP("Dropping - !iwl3945_is_associated\n");
2812 goto drop_unlock; 2819 goto drop_unlock;
@@ -4281,7 +4288,7 @@ static void iwl3945_rx_handle(struct iwl3945_priv *priv)
4281 int reclaim; 4288 int reclaim;
4282 unsigned long flags; 4289 unsigned long flags;
4283 u8 fill_rx = 0; 4290 u8 fill_rx = 0;
4284 u32 count = 0; 4291 u32 count = 8;
4285 4292
4286 /* uCode's read index (stored in shared DRAM) indicates the last Rx 4293 /* uCode's read index (stored in shared DRAM) indicates the last Rx
4287 * buffer that the driver may process (last buffer filled by ucode). */ 4294 * buffer that the driver may process (last buffer filled by ucode). */
@@ -6256,6 +6263,8 @@ static void __iwl3945_down(struct iwl3945_priv *priv)
6256 STATUS_RF_KILL_HW | 6263 STATUS_RF_KILL_HW |
6257 test_bit(STATUS_RF_KILL_SW, &priv->status) << 6264 test_bit(STATUS_RF_KILL_SW, &priv->status) <<
6258 STATUS_RF_KILL_SW | 6265 STATUS_RF_KILL_SW |
6266 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
6267 STATUS_GEO_CONFIGURED |
6259 test_bit(STATUS_IN_SUSPEND, &priv->status) << 6268 test_bit(STATUS_IN_SUSPEND, &priv->status) <<
6260 STATUS_IN_SUSPEND; 6269 STATUS_IN_SUSPEND;
6261 goto exit; 6270 goto exit;
@@ -6267,6 +6276,8 @@ static void __iwl3945_down(struct iwl3945_priv *priv)
6267 STATUS_RF_KILL_HW | 6276 STATUS_RF_KILL_HW |
6268 test_bit(STATUS_RF_KILL_SW, &priv->status) << 6277 test_bit(STATUS_RF_KILL_SW, &priv->status) <<
6269 STATUS_RF_KILL_SW | 6278 STATUS_RF_KILL_SW |
6279 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
6280 STATUS_GEO_CONFIGURED |
6270 test_bit(STATUS_IN_SUSPEND, &priv->status) << 6281 test_bit(STATUS_IN_SUSPEND, &priv->status) <<
6271 STATUS_IN_SUSPEND | 6282 STATUS_IN_SUSPEND |
6272 test_bit(STATUS_FW_ERROR, &priv->status) << 6283 test_bit(STATUS_FW_ERROR, &priv->status) <<
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index f423241b9567..a23d4798653b 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -692,6 +692,11 @@ static int iwl4965_enqueue_hcmd(struct iwl4965_priv *priv, struct iwl4965_host_c
692 BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) && 692 BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) &&
693 !(cmd->meta.flags & CMD_SIZE_HUGE)); 693 !(cmd->meta.flags & CMD_SIZE_HUGE));
694 694
695 if (iwl4965_is_rfkill(priv)) {
696 IWL_DEBUG_INFO("Not sending command - RF KILL");
697 return -EIO;
698 }
699
695 if (iwl4965_queue_space(q) < ((cmd->meta.flags & CMD_ASYNC) ? 2 : 1)) { 700 if (iwl4965_queue_space(q) < ((cmd->meta.flags & CMD_ASYNC) ? 2 : 1)) {
696 IWL_ERROR("No space for Tx\n"); 701 IWL_ERROR("No space for Tx\n");
697 return -ENOSPC; 702 return -ENOSPC;
@@ -1654,7 +1659,7 @@ static inline void iwl4965_eeprom_release_semaphore(struct iwl4965_priv *priv)
1654 */ 1659 */
1655int iwl4965_eeprom_init(struct iwl4965_priv *priv) 1660int iwl4965_eeprom_init(struct iwl4965_priv *priv)
1656{ 1661{
1657 __le16 *e = (__le16 *)&priv->eeprom; 1662 u16 *e = (u16 *)&priv->eeprom;
1658 u32 gp = iwl4965_read32(priv, CSR_EEPROM_GP); 1663 u32 gp = iwl4965_read32(priv, CSR_EEPROM_GP);
1659 u32 r; 1664 u32 r;
1660 int sz = sizeof(priv->eeprom); 1665 int sz = sizeof(priv->eeprom);
@@ -1698,7 +1703,7 @@ int iwl4965_eeprom_init(struct iwl4965_priv *priv)
1698 rc = -ETIMEDOUT; 1703 rc = -ETIMEDOUT;
1699 goto done; 1704 goto done;
1700 } 1705 }
1701 e[addr / 2] = cpu_to_le16(r >> 16); 1706 e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16));
1702 } 1707 }
1703 rc = 0; 1708 rc = 0;
1704 1709
@@ -2935,7 +2940,7 @@ static int iwl4965_tx_skb(struct iwl4965_priv *priv,
2935 /* drop all data frame if we are not associated */ 2940 /* drop all data frame if we are not associated */
2936 if (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) && 2941 if (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) &&
2937 (!iwl4965_is_associated(priv) || 2942 (!iwl4965_is_associated(priv) ||
2938 !priv->assoc_id || 2943 ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && !priv->assoc_id) ||
2939 !priv->assoc_station_added)) { 2944 !priv->assoc_station_added)) {
2940 IWL_DEBUG_DROP("Dropping - !iwl4965_is_associated\n"); 2945 IWL_DEBUG_DROP("Dropping - !iwl4965_is_associated\n");
2941 goto drop_unlock; 2946 goto drop_unlock;
@@ -4664,7 +4669,7 @@ static void iwl4965_rx_handle(struct iwl4965_priv *priv)
4664 int reclaim; 4669 int reclaim;
4665 unsigned long flags; 4670 unsigned long flags;
4666 u8 fill_rx = 0; 4671 u8 fill_rx = 0;
4667 u32 count = 0; 4672 u32 count = 8;
4668 4673
4669 /* uCode's read index (stored in shared DRAM) indicates the last Rx 4674 /* uCode's read index (stored in shared DRAM) indicates the last Rx
4670 * buffer that the driver may process (last buffer filled by ucode). */ 4675 * buffer that the driver may process (last buffer filled by ucode). */
@@ -6680,6 +6685,8 @@ static void __iwl4965_down(struct iwl4965_priv *priv)
6680 STATUS_RF_KILL_HW | 6685 STATUS_RF_KILL_HW |
6681 test_bit(STATUS_RF_KILL_SW, &priv->status) << 6686 test_bit(STATUS_RF_KILL_SW, &priv->status) <<
6682 STATUS_RF_KILL_SW | 6687 STATUS_RF_KILL_SW |
6688 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
6689 STATUS_GEO_CONFIGURED |
6683 test_bit(STATUS_IN_SUSPEND, &priv->status) << 6690 test_bit(STATUS_IN_SUSPEND, &priv->status) <<
6684 STATUS_IN_SUSPEND; 6691 STATUS_IN_SUSPEND;
6685 goto exit; 6692 goto exit;
@@ -6691,6 +6698,8 @@ static void __iwl4965_down(struct iwl4965_priv *priv)
6691 STATUS_RF_KILL_HW | 6698 STATUS_RF_KILL_HW |
6692 test_bit(STATUS_RF_KILL_SW, &priv->status) << 6699 test_bit(STATUS_RF_KILL_SW, &priv->status) <<
6693 STATUS_RF_KILL_SW | 6700 STATUS_RF_KILL_SW |
6701 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
6702 STATUS_GEO_CONFIGURED |
6694 test_bit(STATUS_IN_SUSPEND, &priv->status) << 6703 test_bit(STATUS_IN_SUSPEND, &priv->status) <<
6695 STATUS_IN_SUSPEND | 6704 STATUS_IN_SUSPEND |
6696 test_bit(STATUS_FW_ERROR, &priv->status) << 6705 test_bit(STATUS_FW_ERROR, &priv->status) <<
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index d3ecf89abd93..8ce2ddf8024f 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -2300,7 +2300,7 @@ static void rndis_update_wireless_stats(struct work_struct *work)
2300 struct usbnet *usbdev = priv->usbdev; 2300 struct usbnet *usbdev = priv->usbdev;
2301 struct iw_statistics iwstats; 2301 struct iw_statistics iwstats;
2302 __le32 rssi, tmp; 2302 __le32 rssi, tmp;
2303 int len, ret, bitrate, j; 2303 int len, ret, j;
2304 unsigned long flags; 2304 unsigned long flags;
2305 int update_jiffies = STATS_UPDATE_JIFFIES; 2305 int update_jiffies = STATS_UPDATE_JIFFIES;
2306 void *buf; 2306 void *buf;
@@ -2352,14 +2352,10 @@ static void rndis_update_wireless_stats(struct work_struct *work)
2352 if (ret == 0) 2352 if (ret == 0)
2353 iwstats.discard.misc += le32_to_cpu(tmp); 2353 iwstats.discard.misc += le32_to_cpu(tmp);
2354 2354
2355 /* Workaround transfer stalls on poor quality links. */ 2355 /* Workaround transfer stalls on poor quality links.
2356 len = sizeof(tmp); 2356 * TODO: find right way to fix these stalls (as stalls do not happen
2357 ret = rndis_query_oid(usbdev, OID_GEN_LINK_SPEED, &tmp, &len); 2357 * with ndiswrapper/windows driver). */
2358 if (ret == 0) { 2358 if (iwstats.qual.qual <= 25) {
2359 bitrate = le32_to_cpu(tmp) * 100;
2360 if (bitrate > 11000000)
2361 goto end;
2362
2363 /* Decrease stats worker interval to catch stalls. 2359 /* Decrease stats worker interval to catch stalls.
2364 * faster. Faster than 400-500ms causes packet loss, 2360 * faster. Faster than 400-500ms causes packet loss,
2365 * Slower doesn't catch stalls fast enough. 2361 * Slower doesn't catch stalls fast enough.
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 86ded4066f5b..4ca9730e5e92 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -1839,11 +1839,11 @@ static struct usb_device_id rt2500usb_device_table[] = {
1839 /* Hercules */ 1839 /* Hercules */
1840 { USB_DEVICE(0x06f8, 0xe000), USB_DEVICE_DATA(&rt2500usb_ops) }, 1840 { USB_DEVICE(0x06f8, 0xe000), USB_DEVICE_DATA(&rt2500usb_ops) },
1841 /* Melco */ 1841 /* Melco */
1842 { USB_DEVICE(0x0411, 0x005e), USB_DEVICE_DATA(&rt2500usb_ops) },
1842 { USB_DEVICE(0x0411, 0x0066), USB_DEVICE_DATA(&rt2500usb_ops) }, 1843 { USB_DEVICE(0x0411, 0x0066), USB_DEVICE_DATA(&rt2500usb_ops) },
1843 { USB_DEVICE(0x0411, 0x0067), USB_DEVICE_DATA(&rt2500usb_ops) }, 1844 { USB_DEVICE(0x0411, 0x0067), USB_DEVICE_DATA(&rt2500usb_ops) },
1844 { USB_DEVICE(0x0411, 0x008b), USB_DEVICE_DATA(&rt2500usb_ops) }, 1845 { USB_DEVICE(0x0411, 0x008b), USB_DEVICE_DATA(&rt2500usb_ops) },
1845 { USB_DEVICE(0x0411, 0x0097), USB_DEVICE_DATA(&rt2500usb_ops) }, 1846 { USB_DEVICE(0x0411, 0x0097), USB_DEVICE_DATA(&rt2500usb_ops) },
1846
1847 /* MSI */ 1847 /* MSI */
1848 { USB_DEVICE(0x0db0, 0x6861), USB_DEVICE_DATA(&rt2500usb_ops) }, 1848 { USB_DEVICE(0x0db0, 0x6861), USB_DEVICE_DATA(&rt2500usb_ops) },
1849 { USB_DEVICE(0x0db0, 0x6865), USB_DEVICE_DATA(&rt2500usb_ops) }, 1849 { USB_DEVICE(0x0db0, 0x6865), USB_DEVICE_DATA(&rt2500usb_ops) },
diff --git a/drivers/net/wireless/wavelan.h b/drivers/net/wireless/wavelan.h
index 27172cde5a39..9ab360558ffd 100644
--- a/drivers/net/wireless/wavelan.h
+++ b/drivers/net/wireless/wavelan.h
@@ -85,7 +85,7 @@ union hacs_u
85#define HASR_MMC_INTR 0x0002 /* Interrupt request from MMC */ 85#define HASR_MMC_INTR 0x0002 /* Interrupt request from MMC */
86#define HASR_MMC_BUSY 0x0004 /* MMC busy indication */ 86#define HASR_MMC_BUSY 0x0004 /* MMC busy indication */
87#define HASR_PSA_BUSY 0x0008 /* LAN parameter storage area busy */ 87#define HASR_PSA_BUSY 0x0008 /* LAN parameter storage area busy */
88}; 88} __attribute__ ((packed));
89 89
90typedef struct ha_t ha_t; 90typedef struct ha_t ha_t;
91struct ha_t 91struct ha_t
@@ -292,7 +292,7 @@ struct mmw_t
292#define MMW_EXT_ANT_INTERNAL 0x00 /* Internal antenna */ 292#define MMW_EXT_ANT_INTERNAL 0x00 /* Internal antenna */
293#define MMW_EXT_ANT_EXTERNAL 0x03 /* External antenna */ 293#define MMW_EXT_ANT_EXTERNAL 0x03 /* External antenna */
294#define MMW_EXT_ANT_IQ_TEST 0x1C /* IQ test pattern (set to 0) */ 294#define MMW_EXT_ANT_IQ_TEST 0x1C /* IQ test pattern (set to 0) */
295}; 295} __attribute__ ((packed));
296 296
297#define MMW_SIZE 37 297#define MMW_SIZE 37
298 298
@@ -347,7 +347,7 @@ struct mmr_t
347 unsigned char mmr_unused4[1]; /* unused */ 347 unsigned char mmr_unused4[1]; /* unused */
348 unsigned char mmr_fee_data_l; /* Read data from EEPROM (low) */ 348 unsigned char mmr_fee_data_l; /* Read data from EEPROM (low) */
349 unsigned char mmr_fee_data_h; /* Read data from EEPROM (high) */ 349 unsigned char mmr_fee_data_h; /* Read data from EEPROM (high) */
350}; 350} __attribute__ ((packed));
351 351
352#define MMR_SIZE 36 352#define MMR_SIZE 36
353 353