aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ehea/ehea.h2
-rw-r--r--drivers/net/ehea/ehea_main.c8
-rw-r--r--drivers/net/ehea/ehea_phyp.c10
-rw-r--r--drivers/net/ehea/ehea_phyp.h3
-rw-r--r--drivers/net/ehea/ehea_qmr.c42
-rw-r--r--drivers/net/ehea/ehea_qmr.h5
-rw-r--r--drivers/net/netxen/netxen_nic.h1
-rw-r--r--drivers/net/netxen/netxen_nic_ethtool.c9
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c2
-rw-r--r--drivers/net/netxen/netxen_nic_init.c12
-rw-r--r--drivers/net/netxen/netxen_nic_main.c3
-rw-r--r--drivers/net/netxen/netxen_nic_niu.c2
-rw-r--r--drivers/net/phy/phy_device.c4
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx.h1
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_dma.c171
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_main.c25
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_wx.c28
-rw-r--r--drivers/net/wireless/ipw2100.c16
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.c44
-rw-r--r--drivers/net/wireless/zd1211rw/zd_usb.c12
-rw-r--r--net/core/net-sysfs.c4
-rw-r--r--net/ieee80211/ieee80211_tx.c3
22 files changed, 301 insertions, 106 deletions
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 272e1ec51aa2..42295d61ecd8 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -39,7 +39,7 @@
39#include <asm/io.h> 39#include <asm/io.h>
40 40
41#define DRV_NAME "ehea" 41#define DRV_NAME "ehea"
42#define DRV_VERSION "EHEA_0045" 42#define DRV_VERSION "EHEA_0046"
43 43
44#define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \ 44#define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \
45 | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) 45 | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR)
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 9de2d38a5321..1ef3846a5ea0 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -76,7 +76,7 @@ void ehea_dump(void *adr, int len, char *msg) {
76 int x; 76 int x;
77 unsigned char *deb = adr; 77 unsigned char *deb = adr;
78 for (x = 0; x < len; x += 16) { 78 for (x = 0; x < len; x += 16) {
79 printk(DRV_NAME "%s adr=%p ofs=%04x %016lx %016lx\n", msg, 79 printk(DRV_NAME " %s adr=%p ofs=%04x %016lx %016lx\n", msg,
80 deb, x, *((u64*)&deb[0]), *((u64*)&deb[8])); 80 deb, x, *((u64*)&deb[0]), *((u64*)&deb[8]));
81 deb += 16; 81 deb += 16;
82 } 82 }
@@ -555,6 +555,7 @@ static irqreturn_t ehea_qp_aff_irq_handler(int irq, void *param)
555{ 555{
556 struct ehea_port *port = param; 556 struct ehea_port *port = param;
557 struct ehea_eqe *eqe; 557 struct ehea_eqe *eqe;
558 struct ehea_qp *qp;
558 u32 qp_token; 559 u32 qp_token;
559 560
560 eqe = ehea_poll_eq(port->qp_eq); 561 eqe = ehea_poll_eq(port->qp_eq);
@@ -563,9 +564,14 @@ static irqreturn_t ehea_qp_aff_irq_handler(int irq, void *param)
563 qp_token = EHEA_BMASK_GET(EHEA_EQE_QP_TOKEN, eqe->entry); 564 qp_token = EHEA_BMASK_GET(EHEA_EQE_QP_TOKEN, eqe->entry);
564 ehea_error("QP aff_err: entry=0x%lx, token=0x%x", 565 ehea_error("QP aff_err: entry=0x%lx, token=0x%x",
565 eqe->entry, qp_token); 566 eqe->entry, qp_token);
567
568 qp = port->port_res[qp_token].qp;
569 ehea_error_data(port->adapter, qp->fw_handle);
566 eqe = ehea_poll_eq(port->qp_eq); 570 eqe = ehea_poll_eq(port->qp_eq);
567 } 571 }
568 572
573 queue_work(port->adapter->ehea_wq, &port->reset_task);
574
569 return IRQ_HANDLED; 575 return IRQ_HANDLED;
570} 576}
571 577
diff --git a/drivers/net/ehea/ehea_phyp.c b/drivers/net/ehea/ehea_phyp.c
index 37716e05e808..bc3c00547264 100644
--- a/drivers/net/ehea/ehea_phyp.c
+++ b/drivers/net/ehea/ehea_phyp.c
@@ -612,3 +612,13 @@ u64 ehea_h_reset_events(const u64 adapter_handle, const u64 neq_handle,
612 event_mask, /* R6 */ 612 event_mask, /* R6 */
613 0, 0, 0, 0); /* R7-R12 */ 613 0, 0, 0, 0); /* R7-R12 */
614} 614}
615
616u64 ehea_h_error_data(const u64 adapter_handle, const u64 ressource_handle,
617 void *rblock)
618{
619 return ehea_plpar_hcall_norets(H_ERROR_DATA,
620 adapter_handle, /* R4 */
621 ressource_handle, /* R5 */
622 virt_to_abs(rblock), /* R6 */
623 0, 0, 0, 0); /* R7-R12 */
624}
diff --git a/drivers/net/ehea/ehea_phyp.h b/drivers/net/ehea/ehea_phyp.h
index 919f94b75933..90acddb068a1 100644
--- a/drivers/net/ehea/ehea_phyp.h
+++ b/drivers/net/ehea/ehea_phyp.h
@@ -454,4 +454,7 @@ u64 ehea_h_reg_dereg_bcmc(const u64 adapter_handle, const u16 port_num,
454u64 ehea_h_reset_events(const u64 adapter_handle, const u64 neq_handle, 454u64 ehea_h_reset_events(const u64 adapter_handle, const u64 neq_handle,
455 const u64 event_mask); 455 const u64 event_mask);
456 456
457u64 ehea_h_error_data(const u64 adapter_handle, const u64 ressource_handle,
458 void *rblock);
459
457#endif /* __EHEA_PHYP_H__ */ 460#endif /* __EHEA_PHYP_H__ */
diff --git a/drivers/net/ehea/ehea_qmr.c b/drivers/net/ehea/ehea_qmr.c
index f143e13b229d..96ff3b679996 100644
--- a/drivers/net/ehea/ehea_qmr.c
+++ b/drivers/net/ehea/ehea_qmr.c
@@ -486,6 +486,7 @@ int ehea_destroy_qp(struct ehea_qp *qp)
486 if (!qp) 486 if (!qp)
487 return 0; 487 return 0;
488 488
489 ehea_h_disable_and_get_hea(qp->adapter->handle, qp->fw_handle);
489 hret = ehea_h_free_resource(qp->adapter->handle, qp->fw_handle); 490 hret = ehea_h_free_resource(qp->adapter->handle, qp->fw_handle);
490 if (hret != H_SUCCESS) { 491 if (hret != H_SUCCESS) {
491 ehea_error("destroy_qp failed"); 492 ehea_error("destroy_qp failed");
@@ -581,4 +582,45 @@ out:
581 return ret; 582 return ret;
582} 583}
583 584
585void print_error_data(u64 *data)
586{
587 int length;
588 u64 type = EHEA_BMASK_GET(ERROR_DATA_TYPE, data[2]);
589 u64 resource = data[1];
590
591 length = EHEA_BMASK_GET(ERROR_DATA_LENGTH, data[0]);
592
593 if (length > EHEA_PAGESIZE)
594 length = EHEA_PAGESIZE;
595
596 if (type == 0x8) /* Queue Pair */
597 ehea_error("QP (resource=%lX) state: AER=0x%lX, AERR=0x%lX, "
598 "port=%lX", resource, data[6], data[12], data[22]);
599
600 ehea_dump(data, length, "error data");
601}
602
603void ehea_error_data(struct ehea_adapter *adapter, u64 res_handle)
604{
605 unsigned long ret;
606 u64 *rblock;
607
608 rblock = kzalloc(PAGE_SIZE, GFP_KERNEL);
609 if (!rblock) {
610 ehea_error("Cannot allocate rblock memory.");
611 return;
612 }
584 613
614 ret = ehea_h_error_data(adapter->handle,
615 res_handle,
616 rblock);
617
618 if (ret == H_R_STATE)
619 ehea_error("No error data is available: %lX.", res_handle);
620 else if (ret == H_SUCCESS)
621 print_error_data(rblock);
622 else
623 ehea_error("Error data could not be fetched: %lX", res_handle);
624
625 kfree(rblock);
626}
diff --git a/drivers/net/ehea/ehea_qmr.h b/drivers/net/ehea/ehea_qmr.h
index 7efdc96919ca..1ff60983504d 100644
--- a/drivers/net/ehea/ehea_qmr.h
+++ b/drivers/net/ehea/ehea_qmr.h
@@ -180,6 +180,9 @@ struct ehea_eqe {
180 u64 entry; 180 u64 entry;
181}; 181};
182 182
183#define ERROR_DATA_LENGTH EHEA_BMASK_IBM(52,63)
184#define ERROR_DATA_TYPE EHEA_BMASK_IBM(0,7)
185
183static inline void *hw_qeit_calc(struct hw_queue *queue, u64 q_offset) 186static inline void *hw_qeit_calc(struct hw_queue *queue, u64 q_offset)
184{ 187{
185 struct ehea_page *current_page; 188 struct ehea_page *current_page;
@@ -355,4 +358,6 @@ int ehea_destroy_qp(struct ehea_qp *qp);
355 358
356int ehea_reg_mr_adapter(struct ehea_adapter *adapter); 359int ehea_reg_mr_adapter(struct ehea_adapter *adapter);
357 360
361void ehea_error_data(struct ehea_adapter *adapter, u64 res_handle);
362
358#endif /* __EHEA_QMR_H__ */ 363#endif /* __EHEA_QMR_H__ */
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 3f3896e98879..e021a30abd8d 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -1040,6 +1040,7 @@ int netxen_flash_unlock(struct netxen_adapter *adapter);
1040int netxen_backup_crbinit(struct netxen_adapter *adapter); 1040int netxen_backup_crbinit(struct netxen_adapter *adapter);
1041int netxen_flash_erase_secondary(struct netxen_adapter *adapter); 1041int netxen_flash_erase_secondary(struct netxen_adapter *adapter);
1042int netxen_flash_erase_primary(struct netxen_adapter *adapter); 1042int netxen_flash_erase_primary(struct netxen_adapter *adapter);
1043void netxen_halt_pegs(struct netxen_adapter *adapter);
1043 1044
1044int netxen_rom_fast_write(struct netxen_adapter *adapter, int addr, int data); 1045int netxen_rom_fast_write(struct netxen_adapter *adapter, int addr, int data);
1045int netxen_rom_se(struct netxen_adapter *adapter, int addr); 1046int netxen_rom_se(struct netxen_adapter *adapter, int addr);
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index cc0efe213e01..6252e9a87278 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -402,7 +402,7 @@ netxen_nic_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
402 wol->wolopts = 0; 402 wol->wolopts = 0;
403} 403}
404 404
405static u32 netxen_nic_get_link(struct net_device *dev) 405static u32 netxen_nic_test_link(struct net_device *dev)
406{ 406{
407 struct netxen_port *port = netdev_priv(dev); 407 struct netxen_port *port = netdev_priv(dev);
408 struct netxen_adapter *adapter = port->adapter; 408 struct netxen_adapter *adapter = port->adapter;
@@ -459,6 +459,7 @@ netxen_nic_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
459 int ret; 459 int ret;
460 460
461 if (flash_start == 0) { 461 if (flash_start == 0) {
462 netxen_halt_pegs(adapter);
462 ret = netxen_flash_unlock(adapter); 463 ret = netxen_flash_unlock(adapter);
463 if (ret < 0) { 464 if (ret < 0) {
464 printk(KERN_ERR "%s: Flash unlock failed.\n", 465 printk(KERN_ERR "%s: Flash unlock failed.\n",
@@ -712,7 +713,7 @@ netxen_nic_diag_test(struct net_device *dev, struct ethtool_test *eth_test,
712{ 713{
713 if (eth_test->flags == ETH_TEST_FL_OFFLINE) { /* offline tests */ 714 if (eth_test->flags == ETH_TEST_FL_OFFLINE) { /* offline tests */
714 /* link test */ 715 /* link test */
715 if (!(data[4] = (u64) netxen_nic_get_link(dev))) 716 if (!(data[4] = (u64) netxen_nic_test_link(dev)))
716 eth_test->flags |= ETH_TEST_FL_FAILED; 717 eth_test->flags |= ETH_TEST_FL_FAILED;
717 718
718 if (netif_running(dev)) 719 if (netif_running(dev))
@@ -727,7 +728,7 @@ netxen_nic_diag_test(struct net_device *dev, struct ethtool_test *eth_test,
727 dev->open(dev); 728 dev->open(dev);
728 } else { /* online tests */ 729 } else { /* online tests */
729 /* link test */ 730 /* link test */
730 if (!(data[4] = (u64) netxen_nic_get_link(dev))) 731 if (!(data[4] = (u64) netxen_nic_test_link(dev)))
731 eth_test->flags |= ETH_TEST_FL_FAILED; 732 eth_test->flags |= ETH_TEST_FL_FAILED;
732 733
733 /* other tests pass by default */ 734 /* other tests pass by default */
@@ -783,7 +784,7 @@ struct ethtool_ops netxen_nic_ethtool_ops = {
783 .get_regs_len = netxen_nic_get_regs_len, 784 .get_regs_len = netxen_nic_get_regs_len,
784 .get_regs = netxen_nic_get_regs, 785 .get_regs = netxen_nic_get_regs,
785 .get_wol = netxen_nic_get_wol, 786 .get_wol = netxen_nic_get_wol,
786 .get_link = netxen_nic_get_link, 787 .get_link = ethtool_op_get_link,
787 .get_eeprom_len = netxen_nic_get_eeprom_len, 788 .get_eeprom_len = netxen_nic_get_eeprom_len,
788 .get_eeprom = netxen_nic_get_eeprom, 789 .get_eeprom = netxen_nic_get_eeprom,
789 .set_eeprom = netxen_nic_set_eeprom, 790 .set_eeprom = netxen_nic_set_eeprom,
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index f263232f499f..7195af3e8f3d 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -420,6 +420,7 @@ static int netxen_get_flash_block(struct netxen_adapter *adapter, int base,
420 for (i = 0; i < size / sizeof(u32); i++) { 420 for (i = 0; i < size / sizeof(u32); i++) {
421 if (netxen_rom_fast_read(adapter, addr, ptr32) == -1) 421 if (netxen_rom_fast_read(adapter, addr, ptr32) == -1)
422 return -1; 422 return -1;
423 *ptr32 = cpu_to_le32(*ptr32);
423 ptr32++; 424 ptr32++;
424 addr += sizeof(u32); 425 addr += sizeof(u32);
425 } 426 }
@@ -428,6 +429,7 @@ static int netxen_get_flash_block(struct netxen_adapter *adapter, int base,
428 429
429 if (netxen_rom_fast_read(adapter, addr, &local) == -1) 430 if (netxen_rom_fast_read(adapter, addr, &local) == -1)
430 return -1; 431 return -1;
432 local = cpu_to_le32(local);
431 memcpy(ptr32, &local, (char *)buf + size - (char *)ptr32); 433 memcpy(ptr32, &local, (char *)buf + size - (char *)ptr32);
432 } 434 }
433 435
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index f7bb8c90537c..2f324366784d 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -717,6 +717,14 @@ netxen_flash_erase_primary(struct netxen_adapter *adapter)
717 return ret; 717 return ret;
718} 718}
719 719
720void netxen_halt_pegs(struct netxen_adapter *adapter)
721{
722 netxen_crb_writelit_adapter(adapter, NETXEN_CRB_PEG_NET_0 + 0x3c, 1);
723 netxen_crb_writelit_adapter(adapter, NETXEN_CRB_PEG_NET_1 + 0x3c, 1);
724 netxen_crb_writelit_adapter(adapter, NETXEN_CRB_PEG_NET_2 + 0x3c, 1);
725 netxen_crb_writelit_adapter(adapter, NETXEN_CRB_PEG_NET_3 + 0x3c, 1);
726}
727
720int netxen_flash_unlock(struct netxen_adapter *adapter) 728int netxen_flash_unlock(struct netxen_adapter *adapter)
721{ 729{
722 int ret = 0; 730 int ret = 0;
@@ -1246,7 +1254,7 @@ int netxen_process_cmd_ring(unsigned long data)
1246 * the netdev which is associated with that device. 1254 * the netdev which is associated with that device.
1247 */ 1255 */
1248 1256
1249 consumer = *(adapter->cmd_consumer); 1257 consumer = le32_to_cpu(*(adapter->cmd_consumer));
1250 if (last_consumer == consumer) { /* Ring is empty */ 1258 if (last_consumer == consumer) { /* Ring is empty */
1251 DPRINTK(INFO, "last_consumer %d == consumer %d\n", 1259 DPRINTK(INFO, "last_consumer %d == consumer %d\n",
1252 last_consumer, consumer); 1260 last_consumer, consumer);
@@ -1340,7 +1348,7 @@ int netxen_process_cmd_ring(unsigned long data)
1340 if (adapter->last_cmd_consumer == consumer && 1348 if (adapter->last_cmd_consumer == consumer &&
1341 (((adapter->cmd_producer + 1) % 1349 (((adapter->cmd_producer + 1) %
1342 adapter->max_tx_desc_count) == adapter->last_cmd_consumer)) { 1350 adapter->max_tx_desc_count) == adapter->last_cmd_consumer)) {
1343 consumer = *(adapter->cmd_consumer); 1351 consumer = le32_to_cpu(*(adapter->cmd_consumer));
1344 } 1352 }
1345 done = (adapter->last_cmd_consumer == consumer); 1353 done = (adapter->last_cmd_consumer == consumer);
1346 1354
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 69c1b9d23a1a..c2da7ec0248a 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -434,12 +434,13 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
434 adapter->port_count++; 434 adapter->port_count++;
435 adapter->port[i] = port; 435 adapter->port[i] = port;
436 } 436 }
437 437#ifndef CONFIG_PPC64
438 writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); 438 writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
439 netxen_pinit_from_rom(adapter, 0); 439 netxen_pinit_from_rom(adapter, 0);
440 udelay(500); 440 udelay(500);
441 netxen_load_firmware(adapter); 441 netxen_load_firmware(adapter);
442 netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); 442 netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
443#endif
443 /* 444 /*
444 * delay a while to ensure that the Pegs are up & running. 445 * delay a while to ensure that the Pegs are up & running.
445 * Otherwise, we might see some flaky behaviour. 446 * Otherwise, we might see some flaky behaviour.
diff --git a/drivers/net/netxen/netxen_nic_niu.c b/drivers/net/netxen/netxen_nic_niu.c
index 40d7003a371c..d5d95074e569 100644
--- a/drivers/net/netxen/netxen_nic_niu.c
+++ b/drivers/net/netxen/netxen_nic_niu.c
@@ -458,7 +458,7 @@ int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port)
458 458
459int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port) 459int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port)
460{ 460{
461 long reg = 0, ret = 0; 461 u32 reg = 0, ret = 0;
462 462
463 if (adapter->ahw.boardcfg.board_type == NETXEN_BRDTYPE_P2_SB31_10G_IMEZ) { 463 if (adapter->ahw.boardcfg.board_type == NETXEN_BRDTYPE_P2_SB31_10G_IMEZ) {
464 netxen_crb_writelit_adapter(adapter, 464 netxen_crb_writelit_adapter(adapter,
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index a4d7529ef415..deda210c844e 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -139,7 +139,7 @@ void phy_prepare_link(struct phy_device *phydev,
139 */ 139 */
140struct phy_device * phy_connect(struct net_device *dev, const char *phy_id, 140struct phy_device * phy_connect(struct net_device *dev, const char *phy_id,
141 void (*handler)(struct net_device *), u32 flags, 141 void (*handler)(struct net_device *), u32 flags,
142 u32 interface) 142 phy_interface_t interface)
143{ 143{
144 struct phy_device *phydev; 144 struct phy_device *phydev;
145 145
@@ -188,7 +188,7 @@ static int phy_compare_id(struct device *dev, void *data)
188} 188}
189 189
190struct phy_device *phy_attach(struct net_device *dev, 190struct phy_device *phy_attach(struct net_device *dev,
191 const char *phy_id, u32 flags, u32 interface) 191 const char *phy_id, u32 flags, phy_interface_t interface)
192{ 192{
193 struct bus_type *bus = &mdio_bus_type; 193 struct bus_type *bus = &mdio_bus_type;
194 struct phy_device *phydev; 194 struct phy_device *phydev;
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx.h b/drivers/net/wireless/bcm43xx/bcm43xx.h
index 3a064def162e..0e790efae683 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx.h
+++ b/drivers/net/wireless/bcm43xx/bcm43xx.h
@@ -771,6 +771,7 @@ struct bcm43xx_private {
771 * This is currently always BCM43xx_BUSTYPE_PCI 771 * This is currently always BCM43xx_BUSTYPE_PCI
772 */ 772 */
773 u8 bustype; 773 u8 bustype;
774 u64 dma_mask;
774 775
775 u16 board_vendor; 776 u16 board_vendor;
776 u16 board_type; 777 u16 board_type;
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_dma.c b/drivers/net/wireless/bcm43xx/bcm43xx_dma.c
index 978ed099e285..6e0dc76400e5 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_dma.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_dma.c
@@ -145,16 +145,14 @@ dma_addr_t map_descbuffer(struct bcm43xx_dmaring *ring,
145 int tx) 145 int tx)
146{ 146{
147 dma_addr_t dmaaddr; 147 dma_addr_t dmaaddr;
148 int direction = PCI_DMA_FROMDEVICE;
148 149
149 if (tx) { 150 if (tx)
150 dmaaddr = dma_map_single(&ring->bcm->pci_dev->dev, 151 direction = PCI_DMA_TODEVICE;
151 buf, len, 152
152 DMA_TO_DEVICE); 153 dmaaddr = pci_map_single(ring->bcm->pci_dev,
153 } else {
154 dmaaddr = dma_map_single(&ring->bcm->pci_dev->dev,
155 buf, len, 154 buf, len,
156 DMA_FROM_DEVICE); 155 direction);
157 }
158 156
159 return dmaaddr; 157 return dmaaddr;
160} 158}
@@ -166,13 +164,13 @@ void unmap_descbuffer(struct bcm43xx_dmaring *ring,
166 int tx) 164 int tx)
167{ 165{
168 if (tx) { 166 if (tx) {
169 dma_unmap_single(&ring->bcm->pci_dev->dev, 167 pci_unmap_single(ring->bcm->pci_dev,
170 addr, len, 168 addr, len,
171 DMA_TO_DEVICE); 169 PCI_DMA_TODEVICE);
172 } else { 170 } else {
173 dma_unmap_single(&ring->bcm->pci_dev->dev, 171 pci_unmap_single(ring->bcm->pci_dev,
174 addr, len, 172 addr, len,
175 DMA_FROM_DEVICE); 173 PCI_DMA_FROMDEVICE);
176 } 174 }
177} 175}
178 176
@@ -183,8 +181,8 @@ void sync_descbuffer_for_cpu(struct bcm43xx_dmaring *ring,
183{ 181{
184 assert(!ring->tx); 182 assert(!ring->tx);
185 183
186 dma_sync_single_for_cpu(&ring->bcm->pci_dev->dev, 184 pci_dma_sync_single_for_cpu(ring->bcm->pci_dev,
187 addr, len, DMA_FROM_DEVICE); 185 addr, len, PCI_DMA_FROMDEVICE);
188} 186}
189 187
190static inline 188static inline
@@ -194,8 +192,8 @@ void sync_descbuffer_for_device(struct bcm43xx_dmaring *ring,
194{ 192{
195 assert(!ring->tx); 193 assert(!ring->tx);
196 194
197 dma_sync_single_for_device(&ring->bcm->pci_dev->dev, 195 pci_dma_sync_single_for_cpu(ring->bcm->pci_dev,
198 addr, len, DMA_FROM_DEVICE); 196 addr, len, PCI_DMA_TODEVICE);
199} 197}
200 198
201/* Unmap and free a descriptor buffer. */ 199/* Unmap and free a descriptor buffer. */
@@ -214,17 +212,53 @@ void free_descriptor_buffer(struct bcm43xx_dmaring *ring,
214 212
215static int alloc_ringmemory(struct bcm43xx_dmaring *ring) 213static int alloc_ringmemory(struct bcm43xx_dmaring *ring)
216{ 214{
217 struct device *dev = &(ring->bcm->pci_dev->dev); 215 ring->descbase = pci_alloc_consistent(ring->bcm->pci_dev, BCM43xx_DMA_RINGMEMSIZE,
218 216 &(ring->dmabase));
219 ring->descbase = dma_alloc_coherent(dev, BCM43xx_DMA_RINGMEMSIZE,
220 &(ring->dmabase), GFP_KERNEL);
221 if (!ring->descbase) { 217 if (!ring->descbase) {
222 printk(KERN_ERR PFX "DMA ringmemory allocation failed\n"); 218 /* Allocation may have failed due to pci_alloc_consistent
223 return -ENOMEM; 219 insisting on use of GFP_DMA, which is more restrictive
220 than necessary... */
221 struct dma_desc *rx_ring;
222 dma_addr_t rx_ring_dma;
223
224 rx_ring = kzalloc(BCM43xx_DMA_RINGMEMSIZE, GFP_KERNEL);
225 if (!rx_ring)
226 goto out_err;
227
228 rx_ring_dma = pci_map_single(ring->bcm->pci_dev, rx_ring,
229 BCM43xx_DMA_RINGMEMSIZE,
230 PCI_DMA_BIDIRECTIONAL);
231
232 if (pci_dma_mapping_error(rx_ring_dma) ||
233 rx_ring_dma + BCM43xx_DMA_RINGMEMSIZE > ring->bcm->dma_mask) {
234 /* Sigh... */
235 if (!pci_dma_mapping_error(rx_ring_dma))
236 pci_unmap_single(ring->bcm->pci_dev,
237 rx_ring_dma, BCM43xx_DMA_RINGMEMSIZE,
238 PCI_DMA_BIDIRECTIONAL);
239 rx_ring_dma = pci_map_single(ring->bcm->pci_dev,
240 rx_ring, BCM43xx_DMA_RINGMEMSIZE,
241 PCI_DMA_BIDIRECTIONAL);
242 if (pci_dma_mapping_error(rx_ring_dma) ||
243 rx_ring_dma + BCM43xx_DMA_RINGMEMSIZE > ring->bcm->dma_mask) {
244 assert(0);
245 if (!pci_dma_mapping_error(rx_ring_dma))
246 pci_unmap_single(ring->bcm->pci_dev,
247 rx_ring_dma, BCM43xx_DMA_RINGMEMSIZE,
248 PCI_DMA_BIDIRECTIONAL);
249 goto out_err;
250 }
251 }
252
253 ring->descbase = rx_ring;
254 ring->dmabase = rx_ring_dma;
224 } 255 }
225 memset(ring->descbase, 0, BCM43xx_DMA_RINGMEMSIZE); 256 memset(ring->descbase, 0, BCM43xx_DMA_RINGMEMSIZE);
226 257
227 return 0; 258 return 0;
259out_err:
260 printk(KERN_ERR PFX "DMA ringmemory allocation failed\n");
261 return -ENOMEM;
228} 262}
229 263
230static void free_ringmemory(struct bcm43xx_dmaring *ring) 264static void free_ringmemory(struct bcm43xx_dmaring *ring)
@@ -407,6 +441,29 @@ static int setup_rx_descbuffer(struct bcm43xx_dmaring *ring,
407 if (unlikely(!skb)) 441 if (unlikely(!skb))
408 return -ENOMEM; 442 return -ENOMEM;
409 dmaaddr = map_descbuffer(ring, skb->data, ring->rx_buffersize, 0); 443 dmaaddr = map_descbuffer(ring, skb->data, ring->rx_buffersize, 0);
444 /* This hardware bug work-around adapted from the b44 driver.
445 The chip may be unable to do PCI DMA to/from anything above 1GB */
446 if (pci_dma_mapping_error(dmaaddr) ||
447 dmaaddr + ring->rx_buffersize > ring->bcm->dma_mask) {
448 /* This one has 30-bit addressing... */
449 if (!pci_dma_mapping_error(dmaaddr))
450 pci_unmap_single(ring->bcm->pci_dev,
451 dmaaddr, ring->rx_buffersize,
452 PCI_DMA_FROMDEVICE);
453 dev_kfree_skb_any(skb);
454 skb = __dev_alloc_skb(ring->rx_buffersize,GFP_DMA);
455 if (skb == NULL)
456 return -ENOMEM;
457 dmaaddr = pci_map_single(ring->bcm->pci_dev,
458 skb->data, ring->rx_buffersize,
459 PCI_DMA_FROMDEVICE);
460 if (pci_dma_mapping_error(dmaaddr) ||
461 dmaaddr + ring->rx_buffersize > ring->bcm->dma_mask) {
462 assert(0);
463 dev_kfree_skb_any(skb);
464 return -ENOMEM;
465 }
466 }
410 meta->skb = skb; 467 meta->skb = skb;
411 meta->dmaaddr = dmaaddr; 468 meta->dmaaddr = dmaaddr;
412 skb->dev = ring->bcm->net_dev; 469 skb->dev = ring->bcm->net_dev;
@@ -636,8 +693,10 @@ struct bcm43xx_dmaring * bcm43xx_setup_dmaring(struct bcm43xx_private *bcm,
636 err = dmacontroller_setup(ring); 693 err = dmacontroller_setup(ring);
637 if (err) 694 if (err)
638 goto err_free_ringmemory; 695 goto err_free_ringmemory;
696 return ring;
639 697
640out: 698out:
699 printk(KERN_ERR PFX "Error in bcm43xx_setup_dmaring\n");
641 return ring; 700 return ring;
642 701
643err_free_ringmemory: 702err_free_ringmemory:
@@ -705,30 +764,16 @@ int bcm43xx_dma_init(struct bcm43xx_private *bcm)
705 struct bcm43xx_dmaring *ring; 764 struct bcm43xx_dmaring *ring;
706 int err = -ENOMEM; 765 int err = -ENOMEM;
707 int dma64 = 0; 766 int dma64 = 0;
708 u64 mask = bcm43xx_get_supported_dma_mask(bcm);
709 int nobits;
710 767
711 if (mask == DMA_64BIT_MASK) { 768 bcm->dma_mask = bcm43xx_get_supported_dma_mask(bcm);
769 if (bcm->dma_mask == DMA_64BIT_MASK)
712 dma64 = 1; 770 dma64 = 1;
713 nobits = 64; 771 err = pci_set_dma_mask(bcm->pci_dev, bcm->dma_mask);
714 } else if (mask == DMA_32BIT_MASK) 772 if (err)
715 nobits = 32; 773 goto no_dma;
716 else 774 err = pci_set_consistent_dma_mask(bcm->pci_dev, bcm->dma_mask);
717 nobits = 30; 775 if (err)
718 err = pci_set_dma_mask(bcm->pci_dev, mask); 776 goto no_dma;
719 err |= pci_set_consistent_dma_mask(bcm->pci_dev, mask);
720 if (err) {
721#ifdef CONFIG_BCM43XX_PIO
722 printk(KERN_WARNING PFX "DMA not supported on this device."
723 " Falling back to PIO.\n");
724 bcm->__using_pio = 1;
725 return -ENOSYS;
726#else
727 printk(KERN_ERR PFX "FATAL: DMA not supported and PIO not configured. "
728 "Please recompile the driver with PIO support.\n");
729 return -ENODEV;
730#endif /* CONFIG_BCM43XX_PIO */
731 }
732 777
733 /* setup TX DMA channels. */ 778 /* setup TX DMA channels. */
734 ring = bcm43xx_setup_dmaring(bcm, 0, 1, dma64); 779 ring = bcm43xx_setup_dmaring(bcm, 0, 1, dma64);
@@ -774,7 +819,9 @@ int bcm43xx_dma_init(struct bcm43xx_private *bcm)
774 dma->rx_ring3 = ring; 819 dma->rx_ring3 = ring;
775 } 820 }
776 821
777 dprintk(KERN_INFO PFX "%d-bit DMA initialized\n", nobits); 822 dprintk(KERN_INFO PFX "%d-bit DMA initialized\n",
823 (bcm->dma_mask == DMA_64BIT_MASK) ? 64 :
824 (bcm->dma_mask == DMA_32BIT_MASK) ? 32 : 30);
778 err = 0; 825 err = 0;
779out: 826out:
780 return err; 827 return err;
@@ -800,7 +847,17 @@ err_destroy_tx1:
800err_destroy_tx0: 847err_destroy_tx0:
801 bcm43xx_destroy_dmaring(dma->tx_ring0); 848 bcm43xx_destroy_dmaring(dma->tx_ring0);
802 dma->tx_ring0 = NULL; 849 dma->tx_ring0 = NULL;
803 goto out; 850no_dma:
851#ifdef CONFIG_BCM43XX_PIO
852 printk(KERN_WARNING PFX "DMA not supported on this device."
853 " Falling back to PIO.\n");
854 bcm->__using_pio = 1;
855 return -ENOSYS;
856#else
857 printk(KERN_ERR PFX "FATAL: DMA not supported and PIO not configured. "
858 "Please recompile the driver with PIO support.\n");
859 return -ENODEV;
860#endif /* CONFIG_BCM43XX_PIO */
804} 861}
805 862
806/* Generate a cookie for the TX header. */ 863/* Generate a cookie for the TX header. */
@@ -905,6 +962,7 @@ static void dma_tx_fragment(struct bcm43xx_dmaring *ring,
905 struct bcm43xx_dmadesc_generic *desc; 962 struct bcm43xx_dmadesc_generic *desc;
906 struct bcm43xx_dmadesc_meta *meta; 963 struct bcm43xx_dmadesc_meta *meta;
907 dma_addr_t dmaaddr; 964 dma_addr_t dmaaddr;
965 struct sk_buff *bounce_skb;
908 966
909 assert(skb_shinfo(skb)->nr_frags == 0); 967 assert(skb_shinfo(skb)->nr_frags == 0);
910 968
@@ -924,9 +982,28 @@ static void dma_tx_fragment(struct bcm43xx_dmaring *ring,
924 skb->len - sizeof(struct bcm43xx_txhdr), 982 skb->len - sizeof(struct bcm43xx_txhdr),
925 (cur_frag == 0), 983 (cur_frag == 0),
926 generate_cookie(ring, slot)); 984 generate_cookie(ring, slot));
985 dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1);
986 if (dma_mapping_error(dmaaddr) || dmaaddr + skb->len > ring->bcm->dma_mask) {
987 /* chip cannot handle DMA to/from > 1GB, use bounce buffer (copied from b44 driver) */
988 if (!dma_mapping_error(dmaaddr))
989 unmap_descbuffer(ring, dmaaddr, skb->len, 1);
990 bounce_skb = __dev_alloc_skb(skb->len, GFP_ATOMIC|GFP_DMA);
991 if (!bounce_skb)
992 return;
993 dmaaddr = map_descbuffer(ring, bounce_skb->data, bounce_skb->len, 1);
994 if (dma_mapping_error(dmaaddr) || dmaaddr + skb->len > ring->bcm->dma_mask) {
995 if (!dma_mapping_error(dmaaddr))
996 unmap_descbuffer(ring, dmaaddr, skb->len, 1);
997 dev_kfree_skb_any(bounce_skb);
998 assert(0);
999 return;
1000 }
1001 memcpy(skb_put(bounce_skb, skb->len), skb->data, skb->len);
1002 dev_kfree_skb_any(skb);
1003 skb = bounce_skb;
1004 }
927 1005
928 meta->skb = skb; 1006 meta->skb = skb;
929 dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1);
930 meta->dmaaddr = dmaaddr; 1007 meta->dmaaddr = dmaaddr;
931 1008
932 fill_descriptor(ring, desc, dmaaddr, 1009 fill_descriptor(ring, desc, dmaaddr,
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
index 23aaf1ed8541..2e400aacc436 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
@@ -95,13 +95,9 @@ static int modparam_noleds;
95module_param_named(noleds, modparam_noleds, int, 0444); 95module_param_named(noleds, modparam_noleds, int, 0444);
96MODULE_PARM_DESC(noleds, "Turn off all LED activity"); 96MODULE_PARM_DESC(noleds, "Turn off all LED activity");
97 97
98#ifdef CONFIG_BCM43XX_DEBUG
99static char modparam_fwpostfix[64]; 98static char modparam_fwpostfix[64];
100module_param_string(fwpostfix, modparam_fwpostfix, 64, 0444); 99module_param_string(fwpostfix, modparam_fwpostfix, 64, 0444);
101MODULE_PARM_DESC(fwpostfix, "Postfix for .fw files. Useful for debugging."); 100MODULE_PARM_DESC(fwpostfix, "Postfix for .fw files. Useful for using multiple firmware image versions.");
102#else
103# define modparam_fwpostfix ""
104#endif /* CONFIG_BCM43XX_DEBUG*/
105 101
106 102
107/* If you want to debug with just a single device, enable this, 103/* If you want to debug with just a single device, enable this,
@@ -2983,8 +2979,10 @@ static int bcm43xx_chipset_attach(struct bcm43xx_private *bcm)
2983 err = bcm43xx_pctl_set_crystal(bcm, 1); 2979 err = bcm43xx_pctl_set_crystal(bcm, 1);
2984 if (err) 2980 if (err)
2985 goto out; 2981 goto out;
2986 bcm43xx_pci_read_config16(bcm, PCI_STATUS, &pci_status); 2982 err = bcm43xx_pci_read_config16(bcm, PCI_STATUS, &pci_status);
2987 bcm43xx_pci_write_config16(bcm, PCI_STATUS, pci_status & ~PCI_STATUS_SIG_TARGET_ABORT); 2983 if (err)
2984 goto out;
2985 err = bcm43xx_pci_write_config16(bcm, PCI_STATUS, pci_status & ~PCI_STATUS_SIG_TARGET_ABORT);
2988 2986
2989out: 2987out:
2990 return err; 2988 return err;
@@ -3796,12 +3794,18 @@ static int bcm43xx_attach_board(struct bcm43xx_private *bcm)
3796 } 3794 }
3797 net_dev->base_addr = (unsigned long)bcm->mmio_addr; 3795 net_dev->base_addr = (unsigned long)bcm->mmio_addr;
3798 3796
3799 bcm43xx_pci_read_config16(bcm, PCI_SUBSYSTEM_VENDOR_ID, 3797 err = bcm43xx_pci_read_config16(bcm, PCI_SUBSYSTEM_VENDOR_ID,
3800 &bcm->board_vendor); 3798 &bcm->board_vendor);
3801 bcm43xx_pci_read_config16(bcm, PCI_SUBSYSTEM_ID, 3799 if (err)
3800 goto err_iounmap;
3801 err = bcm43xx_pci_read_config16(bcm, PCI_SUBSYSTEM_ID,
3802 &bcm->board_type); 3802 &bcm->board_type);
3803 bcm43xx_pci_read_config16(bcm, PCI_REVISION_ID, 3803 if (err)
3804 goto err_iounmap;
3805 err = bcm43xx_pci_read_config16(bcm, PCI_REVISION_ID,
3804 &bcm->board_revision); 3806 &bcm->board_revision);
3807 if (err)
3808 goto err_iounmap;
3805 3809
3806 err = bcm43xx_chipset_attach(bcm); 3810 err = bcm43xx_chipset_attach(bcm);
3807 if (err) 3811 if (err)
@@ -3892,6 +3896,7 @@ err_pci_release:
3892 pci_release_regions(pci_dev); 3896 pci_release_regions(pci_dev);
3893err_pci_disable: 3897err_pci_disable:
3894 pci_disable_device(pci_dev); 3898 pci_disable_device(pci_dev);
3899 printk(KERN_ERR PFX "Unable to attach board\n");
3895 goto out; 3900 goto out;
3896} 3901}
3897 3902
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
index a659442b9c15..6961be682c9d 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
@@ -261,22 +261,22 @@ static int bcm43xx_wx_get_rangeparams(struct net_device *net_dev,
261 if (phy->type == BCM43xx_PHYTYPE_A || 261 if (phy->type == BCM43xx_PHYTYPE_A ||
262 phy->type == BCM43xx_PHYTYPE_G) { 262 phy->type == BCM43xx_PHYTYPE_G) {
263 range->num_bitrates = 8; 263 range->num_bitrates = 8;
264 range->bitrate[i++] = IEEE80211_OFDM_RATE_6MB; 264 range->bitrate[i++] = IEEE80211_OFDM_RATE_6MB * 500000;
265 range->bitrate[i++] = IEEE80211_OFDM_RATE_9MB; 265 range->bitrate[i++] = IEEE80211_OFDM_RATE_9MB * 500000;
266 range->bitrate[i++] = IEEE80211_OFDM_RATE_12MB; 266 range->bitrate[i++] = IEEE80211_OFDM_RATE_12MB * 500000;
267 range->bitrate[i++] = IEEE80211_OFDM_RATE_18MB; 267 range->bitrate[i++] = IEEE80211_OFDM_RATE_18MB * 500000;
268 range->bitrate[i++] = IEEE80211_OFDM_RATE_24MB; 268 range->bitrate[i++] = IEEE80211_OFDM_RATE_24MB * 500000;
269 range->bitrate[i++] = IEEE80211_OFDM_RATE_36MB; 269 range->bitrate[i++] = IEEE80211_OFDM_RATE_36MB * 500000;
270 range->bitrate[i++] = IEEE80211_OFDM_RATE_48MB; 270 range->bitrate[i++] = IEEE80211_OFDM_RATE_48MB * 500000;
271 range->bitrate[i++] = IEEE80211_OFDM_RATE_54MB; 271 range->bitrate[i++] = IEEE80211_OFDM_RATE_54MB * 500000;
272 } 272 }
273 if (phy->type == BCM43xx_PHYTYPE_B || 273 if (phy->type == BCM43xx_PHYTYPE_B ||
274 phy->type == BCM43xx_PHYTYPE_G) { 274 phy->type == BCM43xx_PHYTYPE_G) {
275 range->num_bitrates += 4; 275 range->num_bitrates += 4;
276 range->bitrate[i++] = IEEE80211_CCK_RATE_1MB; 276 range->bitrate[i++] = IEEE80211_CCK_RATE_1MB * 500000;
277 range->bitrate[i++] = IEEE80211_CCK_RATE_2MB; 277 range->bitrate[i++] = IEEE80211_CCK_RATE_2MB * 500000;
278 range->bitrate[i++] = IEEE80211_CCK_RATE_5MB; 278 range->bitrate[i++] = IEEE80211_CCK_RATE_5MB * 500000;
279 range->bitrate[i++] = IEEE80211_CCK_RATE_11MB; 279 range->bitrate[i++] = IEEE80211_CCK_RATE_11MB * 500000;
280 } 280 }
281 281
282 geo = ieee80211_get_geo(bcm->ieee); 282 geo = ieee80211_get_geo(bcm->ieee);
@@ -286,7 +286,7 @@ static int bcm43xx_wx_get_rangeparams(struct net_device *net_dev,
286 if (j == IW_MAX_FREQUENCIES) 286 if (j == IW_MAX_FREQUENCIES)
287 break; 287 break;
288 range->freq[j].i = j + 1; 288 range->freq[j].i = j + 1;
289 range->freq[j].m = geo->a[i].freq;//FIXME? 289 range->freq[j].m = geo->a[i].freq * 100000;
290 range->freq[j].e = 1; 290 range->freq[j].e = 1;
291 j++; 291 j++;
292 } 292 }
@@ -294,7 +294,7 @@ static int bcm43xx_wx_get_rangeparams(struct net_device *net_dev,
294 if (j == IW_MAX_FREQUENCIES) 294 if (j == IW_MAX_FREQUENCIES)
295 break; 295 break;
296 range->freq[j].i = j + 1; 296 range->freq[j].i = j + 1;
297 range->freq[j].m = geo->bg[i].freq;//FIXME? 297 range->freq[j].m = geo->bg[i].freq * 100000;
298 range->freq[j].e = 1; 298 range->freq[j].e = 1;
299 j++; 299 j++;
300 } 300 }
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c
index b85857a84870..d0639a45cd2c 100644
--- a/drivers/net/wireless/ipw2100.c
+++ b/drivers/net/wireless/ipw2100.c
@@ -175,7 +175,7 @@ that only one external action is invoked at a time.
175 175
176/* Debugging stuff */ 176/* Debugging stuff */
177#ifdef CONFIG_IPW2100_DEBUG 177#ifdef CONFIG_IPW2100_DEBUG
178#define CONFIG_IPW2100_RX_DEBUG /* Reception debugging */ 178#define IPW2100_RX_DEBUG /* Reception debugging */
179#endif 179#endif
180 180
181MODULE_DESCRIPTION(DRV_DESCRIPTION); 181MODULE_DESCRIPTION(DRV_DESCRIPTION);
@@ -2239,7 +2239,7 @@ static void ipw2100_snapshot_free(struct ipw2100_priv *priv)
2239 priv->snapshot[0] = NULL; 2239 priv->snapshot[0] = NULL;
2240} 2240}
2241 2241
2242#ifdef CONFIG_IPW2100_DEBUG_C3 2242#ifdef IPW2100_DEBUG_C3
2243static int ipw2100_snapshot_alloc(struct ipw2100_priv *priv) 2243static int ipw2100_snapshot_alloc(struct ipw2100_priv *priv)
2244{ 2244{
2245 int i; 2245 int i;
@@ -2314,13 +2314,13 @@ static u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 * in_buf,
2314 * The size of the constructed ethernet 2314 * The size of the constructed ethernet
2315 * 2315 *
2316 */ 2316 */
2317#ifdef CONFIG_IPW2100_RX_DEBUG 2317#ifdef IPW2100_RX_DEBUG
2318static u8 packet_data[IPW_RX_NIC_BUFFER_LENGTH]; 2318static u8 packet_data[IPW_RX_NIC_BUFFER_LENGTH];
2319#endif 2319#endif
2320 2320
2321static void ipw2100_corruption_detected(struct ipw2100_priv *priv, int i) 2321static void ipw2100_corruption_detected(struct ipw2100_priv *priv, int i)
2322{ 2322{
2323#ifdef CONFIG_IPW2100_DEBUG_C3 2323#ifdef IPW2100_DEBUG_C3
2324 struct ipw2100_status *status = &priv->status_queue.drv[i]; 2324 struct ipw2100_status *status = &priv->status_queue.drv[i];
2325 u32 match, reg; 2325 u32 match, reg;
2326 int j; 2326 int j;
@@ -2342,7 +2342,7 @@ static void ipw2100_corruption_detected(struct ipw2100_priv *priv, int i)
2342 } 2342 }
2343#endif 2343#endif
2344 2344
2345#ifdef CONFIG_IPW2100_DEBUG_C3 2345#ifdef IPW2100_DEBUG_C3
2346 /* Halt the fimrware so we can get a good image */ 2346 /* Halt the fimrware so we can get a good image */
2347 write_register(priv->net_dev, IPW_REG_RESET_REG, 2347 write_register(priv->net_dev, IPW_REG_RESET_REG,
2348 IPW_AUX_HOST_RESET_REG_STOP_MASTER); 2348 IPW_AUX_HOST_RESET_REG_STOP_MASTER);
@@ -2413,7 +2413,7 @@ static void isr_rx(struct ipw2100_priv *priv, int i,
2413 2413
2414 skb_put(packet->skb, status->frame_size); 2414 skb_put(packet->skb, status->frame_size);
2415 2415
2416#ifdef CONFIG_IPW2100_RX_DEBUG 2416#ifdef IPW2100_RX_DEBUG
2417 /* Make a copy of the frame so we can dump it to the logs if 2417 /* Make a copy of the frame so we can dump it to the logs if
2418 * ieee80211_rx fails */ 2418 * ieee80211_rx fails */
2419 memcpy(packet_data, packet->skb->data, 2419 memcpy(packet_data, packet->skb->data,
@@ -2421,7 +2421,7 @@ static void isr_rx(struct ipw2100_priv *priv, int i,
2421#endif 2421#endif
2422 2422
2423 if (!ieee80211_rx(priv->ieee, packet->skb, stats)) { 2423 if (!ieee80211_rx(priv->ieee, packet->skb, stats)) {
2424#ifdef CONFIG_IPW2100_RX_DEBUG 2424#ifdef IPW2100_RX_DEBUG
2425 IPW_DEBUG_DROP("%s: Non consumed packet:\n", 2425 IPW_DEBUG_DROP("%s: Non consumed packet:\n",
2426 priv->net_dev->name); 2426 priv->net_dev->name);
2427 printk_buf(IPW_DL_DROP, packet_data, status->frame_size); 2427 printk_buf(IPW_DL_DROP, packet_data, status->frame_size);
@@ -4912,7 +4912,7 @@ static int ipw2100_set_power_mode(struct ipw2100_priv *priv, int power_level)
4912 else 4912 else
4913 priv->power_mode = IPW_POWER_ENABLED | power_level; 4913 priv->power_mode = IPW_POWER_ENABLED | power_level;
4914 4914
4915#ifdef CONFIG_IPW2100_TX_POWER 4915#ifdef IPW2100_TX_POWER
4916 if (priv->port_type == IBSS && priv->adhoc_power != DFTL_IBSS_TX_POWER) { 4916 if (priv->port_type == IBSS && priv->adhoc_power != DFTL_IBSS_TX_POWER) {
4917 /* Set beacon interval */ 4917 /* Set beacon interval */
4918 cmd.host_command = TX_POWER_INDEX; 4918 cmd.host_command = TX_POWER_INDEX;
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index a08524191b5d..4c5f78eac349 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -156,7 +156,7 @@ void zd_mac_clear(struct zd_mac *mac)
156static int reset_mode(struct zd_mac *mac) 156static int reset_mode(struct zd_mac *mac)
157{ 157{
158 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac); 158 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
159 struct zd_ioreq32 ioreqs[3] = { 159 struct zd_ioreq32 ioreqs[] = {
160 { CR_RX_FILTER, STA_RX_FILTER }, 160 { CR_RX_FILTER, STA_RX_FILTER },
161 { CR_SNIFFER_ON, 0U }, 161 { CR_SNIFFER_ON, 0U },
162 }; 162 };
@@ -164,10 +164,9 @@ static int reset_mode(struct zd_mac *mac)
164 if (ieee->iw_mode == IW_MODE_MONITOR) { 164 if (ieee->iw_mode == IW_MODE_MONITOR) {
165 ioreqs[0].value = 0xffffffff; 165 ioreqs[0].value = 0xffffffff;
166 ioreqs[1].value = 0x1; 166 ioreqs[1].value = 0x1;
167 ioreqs[2].value = ENC_SNIFFER;
168 } 167 }
169 168
170 return zd_iowrite32a(&mac->chip, ioreqs, 3); 169 return zd_iowrite32a(&mac->chip, ioreqs, ARRAY_SIZE(ioreqs));
171} 170}
172 171
173int zd_mac_open(struct net_device *netdev) 172int zd_mac_open(struct net_device *netdev)
@@ -904,16 +903,21 @@ static int fill_ctrlset(struct zd_mac *mac,
904static int zd_mac_tx(struct zd_mac *mac, struct ieee80211_txb *txb, int pri) 903static int zd_mac_tx(struct zd_mac *mac, struct ieee80211_txb *txb, int pri)
905{ 904{
906 int i, r; 905 int i, r;
906 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
907 907
908 for (i = 0; i < txb->nr_frags; i++) { 908 for (i = 0; i < txb->nr_frags; i++) {
909 struct sk_buff *skb = txb->fragments[i]; 909 struct sk_buff *skb = txb->fragments[i];
910 910
911 r = fill_ctrlset(mac, txb, i); 911 r = fill_ctrlset(mac, txb, i);
912 if (r) 912 if (r) {
913 ieee->stats.tx_dropped++;
913 return r; 914 return r;
915 }
914 r = zd_usb_tx(&mac->chip.usb, skb->data, skb->len); 916 r = zd_usb_tx(&mac->chip.usb, skb->data, skb->len);
915 if (r) 917 if (r) {
918 ieee->stats.tx_dropped++;
916 return r; 919 return r;
920 }
917 } 921 }
918 922
919 /* FIXME: shouldn't this be handled by the upper layers? */ 923 /* FIXME: shouldn't this be handled by the upper layers? */
@@ -1063,9 +1067,23 @@ static int fill_rx_stats(struct ieee80211_rx_stats *stats,
1063 1067
1064 *pstatus = status = zd_tail(buffer, length, sizeof(struct rx_status)); 1068 *pstatus = status = zd_tail(buffer, length, sizeof(struct rx_status));
1065 if (status->frame_status & ZD_RX_ERROR) { 1069 if (status->frame_status & ZD_RX_ERROR) {
1066 /* FIXME: update? */ 1070 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
1071 ieee->stats.rx_errors++;
1072 if (status->frame_status & ZD_RX_TIMEOUT_ERROR)
1073 ieee->stats.rx_missed_errors++;
1074 else if (status->frame_status & ZD_RX_FIFO_OVERRUN_ERROR)
1075 ieee->stats.rx_fifo_errors++;
1076 else if (status->frame_status & ZD_RX_DECRYPTION_ERROR)
1077 ieee->ieee_stats.rx_discards_undecryptable++;
1078 else if (status->frame_status & ZD_RX_CRC32_ERROR) {
1079 ieee->stats.rx_crc_errors++;
1080 ieee->ieee_stats.rx_fcs_errors++;
1081 }
1082 else if (status->frame_status & ZD_RX_CRC16_ERROR)
1083 ieee->stats.rx_crc_errors++;
1067 return -EINVAL; 1084 return -EINVAL;
1068 } 1085 }
1086
1069 memset(stats, 0, sizeof(struct ieee80211_rx_stats)); 1087 memset(stats, 0, sizeof(struct ieee80211_rx_stats));
1070 stats->len = length - (ZD_PLCP_HEADER_SIZE + IEEE80211_FCS_LEN + 1088 stats->len = length - (ZD_PLCP_HEADER_SIZE + IEEE80211_FCS_LEN +
1071 + sizeof(struct rx_status)); 1089 + sizeof(struct rx_status));
@@ -1094,14 +1112,16 @@ static void zd_mac_rx(struct zd_mac *mac, struct sk_buff *skb)
1094 if (skb->len < ZD_PLCP_HEADER_SIZE + IEEE80211_1ADDR_LEN + 1112 if (skb->len < ZD_PLCP_HEADER_SIZE + IEEE80211_1ADDR_LEN +
1095 IEEE80211_FCS_LEN + sizeof(struct rx_status)) 1113 IEEE80211_FCS_LEN + sizeof(struct rx_status))
1096 { 1114 {
1097 dev_dbg_f(zd_mac_dev(mac), "Packet with length %u to small.\n", 1115 ieee->stats.rx_errors++;
1098 skb->len); 1116 ieee->stats.rx_length_errors++;
1099 goto free_skb; 1117 goto free_skb;
1100 } 1118 }
1101 1119
1102 r = fill_rx_stats(&stats, &status, mac, skb->data, skb->len); 1120 r = fill_rx_stats(&stats, &status, mac, skb->data, skb->len);
1103 if (r) { 1121 if (r) {
1104 /* Only packets with rx errors are included here. */ 1122 /* Only packets with rx errors are included here.
1123 * The error stats have already been set in fill_rx_stats.
1124 */
1105 goto free_skb; 1125 goto free_skb;
1106 } 1126 }
1107 1127
@@ -1114,8 +1134,10 @@ static void zd_mac_rx(struct zd_mac *mac, struct sk_buff *skb)
1114 1134
1115 r = filter_rx(ieee, skb->data, skb->len, &stats); 1135 r = filter_rx(ieee, skb->data, skb->len, &stats);
1116 if (r <= 0) { 1136 if (r <= 0) {
1117 if (r < 0) 1137 if (r < 0) {
1138 ieee->stats.rx_errors++;
1118 dev_dbg_f(zd_mac_dev(mac), "Error in packet.\n"); 1139 dev_dbg_f(zd_mac_dev(mac), "Error in packet.\n");
1140 }
1119 goto free_skb; 1141 goto free_skb;
1120 } 1142 }
1121 1143
@@ -1146,7 +1168,9 @@ int zd_mac_rx_irq(struct zd_mac *mac, const u8 *buffer, unsigned int length)
1146 1168
1147 skb = dev_alloc_skb(sizeof(struct zd_rt_hdr) + length); 1169 skb = dev_alloc_skb(sizeof(struct zd_rt_hdr) + length);
1148 if (!skb) { 1170 if (!skb) {
1171 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
1149 dev_warn(zd_mac_dev(mac), "Could not allocate skb.\n"); 1172 dev_warn(zd_mac_dev(mac), "Could not allocate skb.\n");
1173 ieee->stats.rx_dropped++;
1150 return -ENOMEM; 1174 return -ENOMEM;
1151 } 1175 }
1152 skb_reserve(skb, sizeof(struct zd_rt_hdr)); 1176 skb_reserve(skb, sizeof(struct zd_rt_hdr));
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c
index 75ef55624d7f..aac8a1c5ba08 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -313,6 +313,12 @@ out:
313 313
314static inline void handle_retry_failed_int(struct urb *urb) 314static inline void handle_retry_failed_int(struct urb *urb)
315{ 315{
316 struct zd_usb *usb = urb->context;
317 struct zd_mac *mac = zd_usb_to_mac(usb);
318 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
319
320 ieee->stats.tx_errors++;
321 ieee->ieee_stats.tx_retry_limit_exceeded++;
316 dev_dbg_f(urb_dev(urb), "retry failed interrupt\n"); 322 dev_dbg_f(urb_dev(urb), "retry failed interrupt\n");
317} 323}
318 324
@@ -487,6 +493,9 @@ static void handle_rx_packet(struct zd_usb *usb, const u8 *buffer,
487 493
488 if (length < sizeof(struct rx_length_info)) { 494 if (length < sizeof(struct rx_length_info)) {
489 /* It's not a complete packet anyhow. */ 495 /* It's not a complete packet anyhow. */
496 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
497 ieee->stats.rx_errors++;
498 ieee->stats.rx_length_errors++;
490 return; 499 return;
491 } 500 }
492 length_info = (struct rx_length_info *) 501 length_info = (struct rx_length_info *)
@@ -923,6 +932,8 @@ static int probe(struct usb_interface *intf, const struct usb_device_id *id)
923 goto error; 932 goto error;
924 } 933 }
925 934
935 usb_reset_device(interface_to_usbdev(intf));
936
926 netdev = zd_netdev_alloc(intf); 937 netdev = zd_netdev_alloc(intf);
927 if (netdev == NULL) { 938 if (netdev == NULL) {
928 r = -ENOMEM; 939 r = -ENOMEM;
@@ -1024,6 +1035,7 @@ static int __init usb_init(void)
1024 1035
1025 r = usb_register(&driver); 1036 r = usb_register(&driver);
1026 if (r) { 1037 if (r) {
1038 destroy_workqueue(zd_workqueue);
1027 printk(KERN_ERR "%s usb_register() failed. Error number %d\n", 1039 printk(KERN_ERR "%s usb_register() failed. Error number %d\n",
1028 driver.name, r); 1040 driver.name, r);
1029 return r; 1041 return r;
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 6189dc03108d..4cbb1290a6a3 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -340,7 +340,7 @@ static struct attribute_group netstat_group = {
340 .attrs = netstat_attrs, 340 .attrs = netstat_attrs,
341}; 341};
342 342
343#ifdef WIRELESS_EXT 343#ifdef CONFIG_WIRELESS_EXT
344/* helper function that does all the locking etc for wireless stats */ 344/* helper function that does all the locking etc for wireless stats */
345static ssize_t wireless_show(struct device *d, char *buf, 345static ssize_t wireless_show(struct device *d, char *buf,
346 ssize_t (*format)(const struct iw_statistics *, 346 ssize_t (*format)(const struct iw_statistics *,
@@ -473,7 +473,7 @@ int netdev_register_sysfs(struct net_device *net)
473 if (net->get_stats) 473 if (net->get_stats)
474 *groups++ = &netstat_group; 474 *groups++ = &netstat_group;
475 475
476#ifdef WIRELESS_EXT 476#ifdef CONFIG_WIRELESS_EXT
477 if (net->wireless_handlers && net->wireless_handlers->get_wireless_stats) 477 if (net->wireless_handlers && net->wireless_handlers->get_wireless_stats)
478 *groups++ = &wireless_group; 478 *groups++ = &wireless_group;
479#endif 479#endif
diff --git a/net/ieee80211/ieee80211_tx.c b/net/ieee80211/ieee80211_tx.c
index c55949e5c58a..0292d6348e12 100644
--- a/net/ieee80211/ieee80211_tx.c
+++ b/net/ieee80211/ieee80211_tx.c
@@ -502,9 +502,6 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
502 if (host_encrypt) 502 if (host_encrypt)
503 ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len); 503 ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len);
504 else if (host_build_iv) { 504 else if (host_build_iv) {
505 struct ieee80211_crypt_data *crypt;
506
507 crypt = ieee->crypt[ieee->tx_keyidx];
508 atomic_inc(&crypt->refcnt); 505 atomic_inc(&crypt->refcnt);
509 if (crypt->ops->build_iv) 506 if (crypt->ops->build_iv)
510 crypt->ops->build_iv(skb_frag, hdr_len, 507 crypt->ops->build_iv(skb_frag, hdr_len,