diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2010-02-24 14:31:04 -0500 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2010-02-24 14:33:45 -0500 |
commit | 109d28152b6e9d5de64cd23e3bc08885ccb3d1ef (patch) | |
tree | b7b8863faa05254781acfb85cc41da3eef467c6b /drivers/net | |
parent | 168cf9af699e87d5a6f44b684583714ecabb8e71 (diff) | |
parent | 60b341b778cc2929df16c0a504c91621b3c6a4ad (diff) |
Merge tag 'v2.6.33' for its firewire changes since last branch point
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/net')
180 files changed, 1868 insertions, 1466 deletions
diff --git a/drivers/net/3c507.c b/drivers/net/3c507.c index fbc231153e55..77cf0901a441 100644 --- a/drivers/net/3c507.c +++ b/drivers/net/3c507.c | |||
@@ -56,6 +56,7 @@ static const char version[] = | |||
56 | #include <linux/errno.h> | 56 | #include <linux/errno.h> |
57 | #include <linux/netdevice.h> | 57 | #include <linux/netdevice.h> |
58 | #include <linux/etherdevice.h> | 58 | #include <linux/etherdevice.h> |
59 | #include <linux/if_ether.h> | ||
59 | #include <linux/skbuff.h> | 60 | #include <linux/skbuff.h> |
60 | #include <linux/slab.h> | 61 | #include <linux/slab.h> |
61 | #include <linux/init.h> | 62 | #include <linux/init.h> |
@@ -734,8 +735,7 @@ static void init_82586_mem(struct net_device *dev) | |||
734 | memcpy_toio(lp->base, init_words + 5, sizeof(init_words) - 10); | 735 | memcpy_toio(lp->base, init_words + 5, sizeof(init_words) - 10); |
735 | 736 | ||
736 | /* Fill in the station address. */ | 737 | /* Fill in the station address. */ |
737 | memcpy_toio(lp->base+SA_OFFSET, dev->dev_addr, | 738 | memcpy_toio(lp->base+SA_OFFSET, dev->dev_addr, ETH_ALEN); |
738 | sizeof(dev->dev_addr)); | ||
739 | 739 | ||
740 | /* The Tx-block list is written as needed. We just set up the values. */ | 740 | /* The Tx-block list is written as needed. We just set up the values. */ |
741 | lp->tx_cmd_link = IDLELOOP + 4; | 741 | lp->tx_cmd_link = IDLELOOP + 4; |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index e58a65391ad2..dd9a09c72dff 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -2346,6 +2346,7 @@ config GELIC_NET | |||
2346 | 2346 | ||
2347 | config GELIC_WIRELESS | 2347 | config GELIC_WIRELESS |
2348 | bool "PS3 Wireless support" | 2348 | bool "PS3 Wireless support" |
2349 | depends on WLAN | ||
2349 | depends on GELIC_NET | 2350 | depends on GELIC_NET |
2350 | select WIRELESS_EXT | 2351 | select WIRELESS_EXT |
2351 | help | 2352 | help |
@@ -2358,6 +2359,7 @@ config GELIC_WIRELESS | |||
2358 | config GELIC_WIRELESS_OLD_PSK_INTERFACE | 2359 | config GELIC_WIRELESS_OLD_PSK_INTERFACE |
2359 | bool "PS3 Wireless private PSK interface (OBSOLETE)" | 2360 | bool "PS3 Wireless private PSK interface (OBSOLETE)" |
2360 | depends on GELIC_WIRELESS | 2361 | depends on GELIC_WIRELESS |
2362 | select WEXT_PRIV | ||
2361 | help | 2363 | help |
2362 | This option retains the obsolete private interface to pass | 2364 | This option retains the obsolete private interface to pass |
2363 | the PSK from user space programs to the driver. The PSK | 2365 | the PSK from user space programs to the driver. The PSK |
diff --git a/drivers/net/arm/Kconfig b/drivers/net/arm/Kconfig index c37ee9e6b67b..39e1c0d39476 100644 --- a/drivers/net/arm/Kconfig +++ b/drivers/net/arm/Kconfig | |||
@@ -68,6 +68,7 @@ config W90P910_ETH | |||
68 | tristate "Nuvoton w90p910 Ethernet support" | 68 | tristate "Nuvoton w90p910 Ethernet support" |
69 | depends on ARM && ARCH_W90X900 | 69 | depends on ARM && ARCH_W90X900 |
70 | select PHYLIB | 70 | select PHYLIB |
71 | select MII | ||
71 | help | 72 | help |
72 | Say Y here if you want to use built-in Ethernet ports | 73 | Say Y here if you want to use built-in Ethernet ports |
73 | on w90p910 processor. | 74 | on w90p910 processor. |
diff --git a/drivers/net/atarilance.c b/drivers/net/atarilance.c index c5721cb38265..cc9ed8643910 100644 --- a/drivers/net/atarilance.c +++ b/drivers/net/atarilance.c | |||
@@ -663,7 +663,7 @@ static int lance_open( struct net_device *dev ) | |||
663 | while (--i > 0) | 663 | while (--i > 0) |
664 | if (DREG & CSR0_IDON) | 664 | if (DREG & CSR0_IDON) |
665 | break; | 665 | break; |
666 | if (i < 0 || (DREG & CSR0_ERR)) { | 666 | if (i <= 0 || (DREG & CSR0_ERR)) { |
667 | DPRINTK( 2, ( "lance_open(): opening %s failed, i=%d, csr0=%04x\n", | 667 | DPRINTK( 2, ( "lance_open(): opening %s failed, i=%d, csr0=%04x\n", |
668 | dev->name, i, DREG )); | 668 | dev->name, i, DREG )); |
669 | DREG = CSR0_STOP; | 669 | DREG = CSR0_STOP; |
diff --git a/drivers/net/atlx/atl2.c b/drivers/net/atlx/atl2.c index c0451d75cdcf..ec52529394ad 100644 --- a/drivers/net/atlx/atl2.c +++ b/drivers/net/atlx/atl2.c | |||
@@ -1959,12 +1959,15 @@ static int atl2_get_eeprom(struct net_device *netdev, | |||
1959 | return -ENOMEM; | 1959 | return -ENOMEM; |
1960 | 1960 | ||
1961 | for (i = first_dword; i < last_dword; i++) { | 1961 | for (i = first_dword; i < last_dword; i++) { |
1962 | if (!atl2_read_eeprom(hw, i*4, &(eeprom_buff[i-first_dword]))) | 1962 | if (!atl2_read_eeprom(hw, i*4, &(eeprom_buff[i-first_dword]))) { |
1963 | return -EIO; | 1963 | ret_val = -EIO; |
1964 | goto free; | ||
1965 | } | ||
1964 | } | 1966 | } |
1965 | 1967 | ||
1966 | memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 3), | 1968 | memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 3), |
1967 | eeprom->len); | 1969 | eeprom->len); |
1970 | free: | ||
1968 | kfree(eeprom_buff); | 1971 | kfree(eeprom_buff); |
1969 | 1972 | ||
1970 | return ret_val; | 1973 | return ret_val; |
diff --git a/drivers/net/ax88796.c b/drivers/net/ax88796.c index 62d9c9cc5671..1dd4403247ca 100644 --- a/drivers/net/ax88796.c +++ b/drivers/net/ax88796.c | |||
@@ -921,7 +921,7 @@ static int ax_probe(struct platform_device *pdev) | |||
921 | size = (res->end - res->start) + 1; | 921 | size = (res->end - res->start) + 1; |
922 | 922 | ||
923 | ax->mem2 = request_mem_region(res->start, size, pdev->name); | 923 | ax->mem2 = request_mem_region(res->start, size, pdev->name); |
924 | if (ax->mem == NULL) { | 924 | if (ax->mem2 == NULL) { |
925 | dev_err(&pdev->dev, "cannot reserve registers\n"); | 925 | dev_err(&pdev->dev, "cannot reserve registers\n"); |
926 | ret = -ENXIO; | 926 | ret = -ENXIO; |
927 | goto exit_mem1; | 927 | goto exit_mem1; |
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h index 9e56014d27ed..5bc74590c73e 100644 --- a/drivers/net/benet/be.h +++ b/drivers/net/benet/be.h | |||
@@ -275,8 +275,14 @@ struct be_adapter { | |||
275 | u32 tx_fc; /* Tx flow control */ | 275 | u32 tx_fc; /* Tx flow control */ |
276 | int link_speed; | 276 | int link_speed; |
277 | u8 port_type; | 277 | u8 port_type; |
278 | u8 transceiver; | ||
279 | u8 generation; /* BladeEngine ASIC generation */ | ||
278 | }; | 280 | }; |
279 | 281 | ||
282 | /* BladeEngine Generation numbers */ | ||
283 | #define BE_GEN2 2 | ||
284 | #define BE_GEN3 3 | ||
285 | |||
280 | extern const struct ethtool_ops be_ethtool_ops; | 286 | extern const struct ethtool_ops be_ethtool_ops; |
281 | 287 | ||
282 | #define drvr_stats(adapter) (&adapter->stats.drvr_stats) | 288 | #define drvr_stats(adapter) (&adapter->stats.drvr_stats) |
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index 1b68bd98dc0c..006cb2efcd22 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c | |||
@@ -286,7 +286,7 @@ static void be_wrb_hdr_prepare(struct be_mcc_wrb *wrb, int payload_len, | |||
286 | MCC_WRB_SGE_CNT_SHIFT; | 286 | MCC_WRB_SGE_CNT_SHIFT; |
287 | wrb->payload_length = payload_len; | 287 | wrb->payload_length = payload_len; |
288 | wrb->tag0 = opcode; | 288 | wrb->tag0 = opcode; |
289 | be_dws_cpu_to_le(wrb, 20); | 289 | be_dws_cpu_to_le(wrb, 8); |
290 | } | 290 | } |
291 | 291 | ||
292 | /* Don't touch the hdr after it's prepared */ | 292 | /* Don't touch the hdr after it's prepared */ |
@@ -296,6 +296,7 @@ static void be_cmd_hdr_prepare(struct be_cmd_req_hdr *req_hdr, | |||
296 | req_hdr->opcode = opcode; | 296 | req_hdr->opcode = opcode; |
297 | req_hdr->subsystem = subsystem; | 297 | req_hdr->subsystem = subsystem; |
298 | req_hdr->request_length = cpu_to_le32(cmd_len - sizeof(*req_hdr)); | 298 | req_hdr->request_length = cpu_to_le32(cmd_len - sizeof(*req_hdr)); |
299 | req_hdr->version = 0; | ||
299 | } | 300 | } |
300 | 301 | ||
301 | static void be_cmd_page_addrs_prepare(struct phys_addr *pages, u32 max_pages, | 302 | static void be_cmd_page_addrs_prepare(struct phys_addr *pages, u32 max_pages, |
@@ -1479,6 +1480,41 @@ err: | |||
1479 | return status; | 1480 | return status; |
1480 | } | 1481 | } |
1481 | 1482 | ||
1483 | int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num, | ||
1484 | u8 loopback_type, u8 enable) | ||
1485 | { | ||
1486 | struct be_mcc_wrb *wrb; | ||
1487 | struct be_cmd_req_set_lmode *req; | ||
1488 | int status; | ||
1489 | |||
1490 | spin_lock_bh(&adapter->mcc_lock); | ||
1491 | |||
1492 | wrb = wrb_from_mccq(adapter); | ||
1493 | if (!wrb) { | ||
1494 | status = -EBUSY; | ||
1495 | goto err; | ||
1496 | } | ||
1497 | |||
1498 | req = embedded_payload(wrb); | ||
1499 | |||
1500 | be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0, | ||
1501 | OPCODE_LOWLEVEL_SET_LOOPBACK_MODE); | ||
1502 | |||
1503 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL, | ||
1504 | OPCODE_LOWLEVEL_SET_LOOPBACK_MODE, | ||
1505 | sizeof(*req)); | ||
1506 | |||
1507 | req->src_port = port_num; | ||
1508 | req->dest_port = port_num; | ||
1509 | req->loopback_type = loopback_type; | ||
1510 | req->loopback_state = enable; | ||
1511 | |||
1512 | status = be_mcc_notify_wait(adapter); | ||
1513 | err: | ||
1514 | spin_unlock_bh(&adapter->mcc_lock); | ||
1515 | return status; | ||
1516 | } | ||
1517 | |||
1482 | int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, | 1518 | int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, |
1483 | u32 loopback_type, u32 pkt_size, u32 num_pkts, u64 pattern) | 1519 | u32 loopback_type, u32 pkt_size, u32 num_pkts, u64 pattern) |
1484 | { | 1520 | { |
@@ -1501,6 +1537,7 @@ int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, | |||
1501 | 1537 | ||
1502 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL, | 1538 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL, |
1503 | OPCODE_LOWLEVEL_LOOPBACK_TEST, sizeof(*req)); | 1539 | OPCODE_LOWLEVEL_LOOPBACK_TEST, sizeof(*req)); |
1540 | req->hdr.timeout = 4; | ||
1504 | 1541 | ||
1505 | req->pattern = cpu_to_le64(pattern); | 1542 | req->pattern = cpu_to_le64(pattern); |
1506 | req->src_port = cpu_to_le32(port_num); | 1543 | req->src_port = cpu_to_le32(port_num); |
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h index 92b87ef156ed..13b33c841083 100644 --- a/drivers/net/benet/be_cmds.h +++ b/drivers/net/benet/be_cmds.h | |||
@@ -155,6 +155,7 @@ struct be_mcc_mailbox { | |||
155 | 155 | ||
156 | #define OPCODE_LOWLEVEL_HOST_DDR_DMA 17 | 156 | #define OPCODE_LOWLEVEL_HOST_DDR_DMA 17 |
157 | #define OPCODE_LOWLEVEL_LOOPBACK_TEST 18 | 157 | #define OPCODE_LOWLEVEL_LOOPBACK_TEST 18 |
158 | #define OPCODE_LOWLEVEL_SET_LOOPBACK_MODE 19 | ||
158 | 159 | ||
159 | struct be_cmd_req_hdr { | 160 | struct be_cmd_req_hdr { |
160 | u8 opcode; /* dword 0 */ | 161 | u8 opcode; /* dword 0 */ |
@@ -163,7 +164,8 @@ struct be_cmd_req_hdr { | |||
163 | u8 domain; /* dword 0 */ | 164 | u8 domain; /* dword 0 */ |
164 | u32 timeout; /* dword 1 */ | 165 | u32 timeout; /* dword 1 */ |
165 | u32 request_length; /* dword 2 */ | 166 | u32 request_length; /* dword 2 */ |
166 | u32 rsvd; /* dword 3 */ | 167 | u8 version; /* dword 3 */ |
168 | u8 rsvd[3]; /* dword 3 */ | ||
167 | }; | 169 | }; |
168 | 170 | ||
169 | #define RESP_HDR_INFO_OPCODE_SHIFT 0 /* bits 0 - 7 */ | 171 | #define RESP_HDR_INFO_OPCODE_SHIFT 0 /* bits 0 - 7 */ |
@@ -821,6 +823,19 @@ struct be_cmd_resp_loopback_test { | |||
821 | u32 ticks_compl; | 823 | u32 ticks_compl; |
822 | }; | 824 | }; |
823 | 825 | ||
826 | struct be_cmd_req_set_lmode { | ||
827 | struct be_cmd_req_hdr hdr; | ||
828 | u8 src_port; | ||
829 | u8 dest_port; | ||
830 | u8 loopback_type; | ||
831 | u8 loopback_state; | ||
832 | }; | ||
833 | |||
834 | struct be_cmd_resp_set_lmode { | ||
835 | struct be_cmd_resp_hdr resp_hdr; | ||
836 | u8 rsvd0[4]; | ||
837 | }; | ||
838 | |||
824 | /********************** DDR DMA test *********************/ | 839 | /********************** DDR DMA test *********************/ |
825 | struct be_cmd_req_ddrdma_test { | 840 | struct be_cmd_req_ddrdma_test { |
826 | struct be_cmd_req_hdr hdr; | 841 | struct be_cmd_req_hdr hdr; |
@@ -912,3 +927,5 @@ extern int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, | |||
912 | u32 num_pkts, u64 pattern); | 927 | u32 num_pkts, u64 pattern); |
913 | extern int be_cmd_ddr_dma_test(struct be_adapter *adapter, u64 pattern, | 928 | extern int be_cmd_ddr_dma_test(struct be_adapter *adapter, u64 pattern, |
914 | u32 byte_cnt, struct be_dma_mem *cmd); | 929 | u32 byte_cnt, struct be_dma_mem *cmd); |
930 | extern int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num, | ||
931 | u8 loopback_type, u8 enable); | ||
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c index 298b92cbd689..5d001c4deac1 100644 --- a/drivers/net/benet/be_ethtool.c +++ b/drivers/net/benet/be_ethtool.c | |||
@@ -118,6 +118,7 @@ static const char et_self_tests[][ETH_GSTRING_LEN] = { | |||
118 | #define BE_MAC_LOOPBACK 0x0 | 118 | #define BE_MAC_LOOPBACK 0x0 |
119 | #define BE_PHY_LOOPBACK 0x1 | 119 | #define BE_PHY_LOOPBACK 0x1 |
120 | #define BE_ONE_PORT_EXT_LOOPBACK 0x2 | 120 | #define BE_ONE_PORT_EXT_LOOPBACK 0x2 |
121 | #define BE_NO_LOOPBACK 0xff | ||
121 | 122 | ||
122 | static void | 123 | static void |
123 | be_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo) | 124 | be_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo) |
@@ -339,28 +340,50 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | |||
339 | 340 | ||
340 | status = be_cmd_read_port_type(adapter, adapter->port_num, | 341 | status = be_cmd_read_port_type(adapter, adapter->port_num, |
341 | &connector); | 342 | &connector); |
342 | switch (connector) { | 343 | if (!status) { |
343 | case 7: | 344 | switch (connector) { |
344 | ecmd->port = PORT_FIBRE; | 345 | case 7: |
345 | break; | 346 | ecmd->port = PORT_FIBRE; |
346 | default: | 347 | ecmd->transceiver = XCVR_EXTERNAL; |
347 | ecmd->port = PORT_TP; | 348 | break; |
348 | break; | 349 | case 0: |
350 | ecmd->port = PORT_TP; | ||
351 | ecmd->transceiver = XCVR_EXTERNAL; | ||
352 | break; | ||
353 | default: | ||
354 | ecmd->port = PORT_TP; | ||
355 | ecmd->transceiver = XCVR_INTERNAL; | ||
356 | break; | ||
357 | } | ||
358 | } else { | ||
359 | ecmd->port = PORT_AUI; | ||
360 | ecmd->transceiver = XCVR_INTERNAL; | ||
349 | } | 361 | } |
350 | 362 | ||
351 | /* Save for future use */ | 363 | /* Save for future use */ |
352 | adapter->link_speed = ecmd->speed; | 364 | adapter->link_speed = ecmd->speed; |
353 | adapter->port_type = ecmd->port; | 365 | adapter->port_type = ecmd->port; |
366 | adapter->transceiver = ecmd->transceiver; | ||
354 | } else { | 367 | } else { |
355 | ecmd->speed = adapter->link_speed; | 368 | ecmd->speed = adapter->link_speed; |
356 | ecmd->port = adapter->port_type; | 369 | ecmd->port = adapter->port_type; |
370 | ecmd->transceiver = adapter->transceiver; | ||
357 | } | 371 | } |
358 | 372 | ||
359 | ecmd->duplex = DUPLEX_FULL; | 373 | ecmd->duplex = DUPLEX_FULL; |
360 | ecmd->autoneg = AUTONEG_DISABLE; | 374 | ecmd->autoneg = AUTONEG_DISABLE; |
361 | ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_TP); | ||
362 | ecmd->phy_address = adapter->port_num; | 375 | ecmd->phy_address = adapter->port_num; |
363 | ecmd->transceiver = XCVR_INTERNAL; | 376 | switch (ecmd->port) { |
377 | case PORT_FIBRE: | ||
378 | ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE); | ||
379 | break; | ||
380 | case PORT_TP: | ||
381 | ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_TP); | ||
382 | break; | ||
383 | case PORT_AUI: | ||
384 | ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_AUI); | ||
385 | break; | ||
386 | } | ||
364 | 387 | ||
365 | return 0; | 388 | return 0; |
366 | } | 389 | } |
@@ -489,6 +512,19 @@ err: | |||
489 | return ret; | 512 | return ret; |
490 | } | 513 | } |
491 | 514 | ||
515 | static u64 be_loopback_test(struct be_adapter *adapter, u8 loopback_type, | ||
516 | u64 *status) | ||
517 | { | ||
518 | be_cmd_set_loopback(adapter, adapter->port_num, | ||
519 | loopback_type, 1); | ||
520 | *status = be_cmd_loopback_test(adapter, adapter->port_num, | ||
521 | loopback_type, 1500, | ||
522 | 2, 0xabc); | ||
523 | be_cmd_set_loopback(adapter, adapter->port_num, | ||
524 | BE_NO_LOOPBACK, 1); | ||
525 | return *status; | ||
526 | } | ||
527 | |||
492 | static void | 528 | static void |
493 | be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data) | 529 | be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data) |
494 | { | 530 | { |
@@ -497,23 +533,18 @@ be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data) | |||
497 | memset(data, 0, sizeof(u64) * ETHTOOL_TESTS_NUM); | 533 | memset(data, 0, sizeof(u64) * ETHTOOL_TESTS_NUM); |
498 | 534 | ||
499 | if (test->flags & ETH_TEST_FL_OFFLINE) { | 535 | if (test->flags & ETH_TEST_FL_OFFLINE) { |
500 | data[0] = be_cmd_loopback_test(adapter, adapter->port_num, | 536 | if (be_loopback_test(adapter, BE_MAC_LOOPBACK, |
501 | BE_MAC_LOOPBACK, 1500, | 537 | &data[0]) != 0) { |
502 | 2, 0xabc); | ||
503 | if (data[0] != 0) | ||
504 | test->flags |= ETH_TEST_FL_FAILED; | 538 | test->flags |= ETH_TEST_FL_FAILED; |
505 | 539 | } | |
506 | data[1] = be_cmd_loopback_test(adapter, adapter->port_num, | 540 | if (be_loopback_test(adapter, BE_PHY_LOOPBACK, |
507 | BE_PHY_LOOPBACK, 1500, | 541 | &data[1]) != 0) { |
508 | 2, 0xabc); | ||
509 | if (data[1] != 0) | ||
510 | test->flags |= ETH_TEST_FL_FAILED; | 542 | test->flags |= ETH_TEST_FL_FAILED; |
511 | 543 | } | |
512 | data[2] = be_cmd_loopback_test(adapter, adapter->port_num, | 544 | if (be_loopback_test(adapter, BE_ONE_PORT_EXT_LOOPBACK, |
513 | BE_ONE_PORT_EXT_LOOPBACK, | 545 | &data[2]) != 0) { |
514 | 1500, 2, 0xabc); | ||
515 | if (data[2] != 0) | ||
516 | test->flags |= ETH_TEST_FL_FAILED; | 546 | test->flags |= ETH_TEST_FL_FAILED; |
547 | } | ||
517 | 548 | ||
518 | data[3] = be_test_ddr_dma(adapter); | 549 | data[3] = be_test_ddr_dma(adapter); |
519 | if (data[3] != 0) | 550 | if (data[3] != 0) |
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index 3a1f7902c16d..626b76c0ebc7 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -910,7 +910,7 @@ static inline struct page *be_alloc_pages(u32 size) | |||
910 | static void be_post_rx_frags(struct be_adapter *adapter) | 910 | static void be_post_rx_frags(struct be_adapter *adapter) |
911 | { | 911 | { |
912 | struct be_rx_page_info *page_info_tbl = adapter->rx_obj.page_info_tbl; | 912 | struct be_rx_page_info *page_info_tbl = adapter->rx_obj.page_info_tbl; |
913 | struct be_rx_page_info *page_info = NULL; | 913 | struct be_rx_page_info *page_info = NULL, *prev_page_info = NULL; |
914 | struct be_queue_info *rxq = &adapter->rx_obj.q; | 914 | struct be_queue_info *rxq = &adapter->rx_obj.q; |
915 | struct page *pagep = NULL; | 915 | struct page *pagep = NULL; |
916 | struct be_eth_rx_d *rxd; | 916 | struct be_eth_rx_d *rxd; |
@@ -941,7 +941,6 @@ static void be_post_rx_frags(struct be_adapter *adapter) | |||
941 | rxd = queue_head_node(rxq); | 941 | rxd = queue_head_node(rxq); |
942 | rxd->fragpa_lo = cpu_to_le32(frag_dmaaddr & 0xFFFFFFFF); | 942 | rxd->fragpa_lo = cpu_to_le32(frag_dmaaddr & 0xFFFFFFFF); |
943 | rxd->fragpa_hi = cpu_to_le32(upper_32_bits(frag_dmaaddr)); | 943 | rxd->fragpa_hi = cpu_to_le32(upper_32_bits(frag_dmaaddr)); |
944 | queue_head_inc(rxq); | ||
945 | 944 | ||
946 | /* Any space left in the current big page for another frag? */ | 945 | /* Any space left in the current big page for another frag? */ |
947 | if ((page_offset + rx_frag_size + rx_frag_size) > | 946 | if ((page_offset + rx_frag_size + rx_frag_size) > |
@@ -949,10 +948,13 @@ static void be_post_rx_frags(struct be_adapter *adapter) | |||
949 | pagep = NULL; | 948 | pagep = NULL; |
950 | page_info->last_page_user = true; | 949 | page_info->last_page_user = true; |
951 | } | 950 | } |
951 | |||
952 | prev_page_info = page_info; | ||
953 | queue_head_inc(rxq); | ||
952 | page_info = &page_info_tbl[rxq->head]; | 954 | page_info = &page_info_tbl[rxq->head]; |
953 | } | 955 | } |
954 | if (pagep) | 956 | if (pagep) |
955 | page_info->last_page_user = true; | 957 | prev_page_info->last_page_user = true; |
956 | 958 | ||
957 | if (posted) { | 959 | if (posted) { |
958 | atomic_add(posted, &rxq->used); | 960 | atomic_add(posted, &rxq->used); |
@@ -1348,7 +1350,7 @@ static irqreturn_t be_intx(int irq, void *dev) | |||
1348 | int isr; | 1350 | int isr; |
1349 | 1351 | ||
1350 | isr = ioread32(adapter->csr + CEV_ISR0_OFFSET + | 1352 | isr = ioread32(adapter->csr + CEV_ISR0_OFFSET + |
1351 | be_pci_func(adapter) * CEV_ISR_SIZE); | 1353 | (adapter->tx_eq.q.id/ 8) * CEV_ISR_SIZE); |
1352 | if (!isr) | 1354 | if (!isr) |
1353 | return IRQ_NONE; | 1355 | return IRQ_NONE; |
1354 | 1356 | ||
@@ -2049,6 +2051,7 @@ static void be_unmap_pci_bars(struct be_adapter *adapter) | |||
2049 | static int be_map_pci_bars(struct be_adapter *adapter) | 2051 | static int be_map_pci_bars(struct be_adapter *adapter) |
2050 | { | 2052 | { |
2051 | u8 __iomem *addr; | 2053 | u8 __iomem *addr; |
2054 | int pcicfg_reg; | ||
2052 | 2055 | ||
2053 | addr = ioremap_nocache(pci_resource_start(adapter->pdev, 2), | 2056 | addr = ioremap_nocache(pci_resource_start(adapter->pdev, 2), |
2054 | pci_resource_len(adapter->pdev, 2)); | 2057 | pci_resource_len(adapter->pdev, 2)); |
@@ -2062,8 +2065,13 @@ static int be_map_pci_bars(struct be_adapter *adapter) | |||
2062 | goto pci_map_err; | 2065 | goto pci_map_err; |
2063 | adapter->db = addr; | 2066 | adapter->db = addr; |
2064 | 2067 | ||
2065 | addr = ioremap_nocache(pci_resource_start(adapter->pdev, 1), | 2068 | if (adapter->generation == BE_GEN2) |
2066 | pci_resource_len(adapter->pdev, 1)); | 2069 | pcicfg_reg = 1; |
2070 | else | ||
2071 | pcicfg_reg = 0; | ||
2072 | |||
2073 | addr = ioremap_nocache(pci_resource_start(adapter->pdev, pcicfg_reg), | ||
2074 | pci_resource_len(adapter->pdev, pcicfg_reg)); | ||
2067 | if (addr == NULL) | 2075 | if (addr == NULL) |
2068 | goto pci_map_err; | 2076 | goto pci_map_err; |
2069 | adapter->pcicfg = addr; | 2077 | adapter->pcicfg = addr; |
@@ -2160,6 +2168,7 @@ static int be_stats_init(struct be_adapter *adapter) | |||
2160 | cmd->va = pci_alloc_consistent(adapter->pdev, cmd->size, &cmd->dma); | 2168 | cmd->va = pci_alloc_consistent(adapter->pdev, cmd->size, &cmd->dma); |
2161 | if (cmd->va == NULL) | 2169 | if (cmd->va == NULL) |
2162 | return -1; | 2170 | return -1; |
2171 | memset(cmd->va, 0, cmd->size); | ||
2163 | return 0; | 2172 | return 0; |
2164 | } | 2173 | } |
2165 | 2174 | ||
@@ -2238,6 +2247,20 @@ static int __devinit be_probe(struct pci_dev *pdev, | |||
2238 | goto rel_reg; | 2247 | goto rel_reg; |
2239 | } | 2248 | } |
2240 | adapter = netdev_priv(netdev); | 2249 | adapter = netdev_priv(netdev); |
2250 | |||
2251 | switch (pdev->device) { | ||
2252 | case BE_DEVICE_ID1: | ||
2253 | case OC_DEVICE_ID1: | ||
2254 | adapter->generation = BE_GEN2; | ||
2255 | break; | ||
2256 | case BE_DEVICE_ID2: | ||
2257 | case OC_DEVICE_ID2: | ||
2258 | adapter->generation = BE_GEN3; | ||
2259 | break; | ||
2260 | default: | ||
2261 | adapter->generation = 0; | ||
2262 | } | ||
2263 | |||
2241 | adapter->pdev = pdev; | 2264 | adapter->pdev = pdev; |
2242 | pci_set_drvdata(pdev, adapter); | 2265 | pci_set_drvdata(pdev, adapter); |
2243 | adapter->netdev = netdev; | 2266 | adapter->netdev = netdev; |
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c index 8ffea3990d07..0b23bc4f56c6 100644 --- a/drivers/net/bfin_mac.c +++ b/drivers/net/bfin_mac.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <asm/dma.h> | 33 | #include <asm/dma.h> |
34 | #include <linux/dma-mapping.h> | 34 | #include <linux/dma-mapping.h> |
35 | 35 | ||
36 | #include <asm/dpmc.h> | ||
36 | #include <asm/blackfin.h> | 37 | #include <asm/blackfin.h> |
37 | #include <asm/cacheflush.h> | 38 | #include <asm/cacheflush.h> |
38 | #include <asm/portmux.h> | 39 | #include <asm/portmux.h> |
@@ -386,8 +387,8 @@ static int mii_probe(struct net_device *dev) | |||
386 | u32 sclk, mdc_div; | 387 | u32 sclk, mdc_div; |
387 | 388 | ||
388 | /* Enable PHY output early */ | 389 | /* Enable PHY output early */ |
389 | if (!(bfin_read_VR_CTL() & PHYCLKOE)) | 390 | if (!(bfin_read_VR_CTL() & CLKBUFOE)) |
390 | bfin_write_VR_CTL(bfin_read_VR_CTL() | PHYCLKOE); | 391 | bfin_write_VR_CTL(bfin_read_VR_CTL() | CLKBUFOE); |
391 | 392 | ||
392 | sclk = get_sclk(); | 393 | sclk = get_sclk(); |
393 | mdc_div = ((sclk / MDC_CLK) / 2) - 1; | 394 | mdc_div = ((sclk / MDC_CLK) / 2) - 1; |
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c index 77ba13520d87..306c2b8165e2 100644 --- a/drivers/net/bnx2x_main.c +++ b/drivers/net/bnx2x_main.c | |||
@@ -7593,6 +7593,8 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
7593 | if (bp->cnic_eth_dev.drv_state & CNIC_DRV_STATE_REGD) { | 7593 | if (bp->cnic_eth_dev.drv_state & CNIC_DRV_STATE_REGD) { |
7594 | bnx2x_set_iscsi_eth_mac_addr(bp, 1); | 7594 | bnx2x_set_iscsi_eth_mac_addr(bp, 1); |
7595 | bp->cnic_flags |= BNX2X_CNIC_FLAG_MAC_SET; | 7595 | bp->cnic_flags |= BNX2X_CNIC_FLAG_MAC_SET; |
7596 | bnx2x_init_sb(bp, bp->cnic_sb, bp->cnic_sb_mapping, | ||
7597 | CNIC_SB_ID(bp)); | ||
7596 | } | 7598 | } |
7597 | mutex_unlock(&bp->cnic_mutex); | 7599 | mutex_unlock(&bp->cnic_mutex); |
7598 | #endif | 7600 | #endif |
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index 0fb7a4964e75..822f586d72af 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c | |||
@@ -1580,7 +1580,7 @@ static void ad_agg_selection_logic(struct aggregator *agg) | |||
1580 | // check if any partner replys | 1580 | // check if any partner replys |
1581 | if (best->is_individual) { | 1581 | if (best->is_individual) { |
1582 | pr_warning("%s: Warning: No 802.3ad response from the link partner for any adapters in the bond\n", | 1582 | pr_warning("%s: Warning: No 802.3ad response from the link partner for any adapters in the bond\n", |
1583 | best->slave->dev->master->name); | 1583 | best->slave ? best->slave->dev->master->name : "NULL"); |
1584 | } | 1584 | } |
1585 | 1585 | ||
1586 | best->is_active = 1; | 1586 | best->is_active = 1; |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 3f0071cfe56b..efa0e41bf3ec 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -3639,7 +3639,7 @@ static int bond_open(struct net_device *bond_dev) | |||
3639 | */ | 3639 | */ |
3640 | if (bond_alb_initialize(bond, (bond->params.mode == BOND_MODE_ALB))) { | 3640 | if (bond_alb_initialize(bond, (bond->params.mode == BOND_MODE_ALB))) { |
3641 | /* something went wrong - fail the open operation */ | 3641 | /* something went wrong - fail the open operation */ |
3642 | return -1; | 3642 | return -ENOMEM; |
3643 | } | 3643 | } |
3644 | 3644 | ||
3645 | INIT_DELAYED_WORK(&bond->alb_work, bond_alb_monitor); | 3645 | INIT_DELAYED_WORK(&bond->alb_work, bond_alb_monitor); |
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c index 9c5a1537939c..1a72ca066a17 100644 --- a/drivers/net/can/mcp251x.c +++ b/drivers/net/can/mcp251x.c | |||
@@ -990,7 +990,7 @@ static int __devinit mcp251x_can_probe(struct spi_device *spi) | |||
990 | goto error_tx_buf; | 990 | goto error_tx_buf; |
991 | } | 991 | } |
992 | priv->spi_rx_buf = kmalloc(SPI_TRANSFER_BUF_LEN, GFP_KERNEL); | 992 | priv->spi_rx_buf = kmalloc(SPI_TRANSFER_BUF_LEN, GFP_KERNEL); |
993 | if (!priv->spi_tx_buf) { | 993 | if (!priv->spi_rx_buf) { |
994 | ret = -ENOMEM; | 994 | ret = -ENOMEM; |
995 | goto error_rx_buf; | 995 | goto error_rx_buf; |
996 | } | 996 | } |
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index af9321617ce4..0e79cef95c0a 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c | |||
@@ -1325,8 +1325,7 @@ net_open(struct net_device *dev) | |||
1325 | write_irq(dev, lp->chip_type, dev->irq); | 1325 | write_irq(dev, lp->chip_type, dev->irq); |
1326 | ret = request_irq(dev->irq, net_interrupt, 0, dev->name, dev); | 1326 | ret = request_irq(dev->irq, net_interrupt, 0, dev->name, dev); |
1327 | if (ret) { | 1327 | if (ret) { |
1328 | if (net_debug) | 1328 | printk(KERN_ERR "cs89x0: request_irq(%d) failed\n", dev->irq); |
1329 | printk(KERN_DEBUG "cs89x0: request_irq(%d) failed\n", dev->irq); | ||
1330 | goto bad_out; | 1329 | goto bad_out; |
1331 | } | 1330 | } |
1332 | } | 1331 | } |
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c index bdbd14727e4b..318a018ca7c5 100644 --- a/drivers/net/cxgb3/sge.c +++ b/drivers/net/cxgb3/sge.c | |||
@@ -2079,6 +2079,7 @@ static void lro_add_page(struct adapter *adap, struct sge_qset *qs, | |||
2079 | struct sge_fl *fl, int len, int complete) | 2079 | struct sge_fl *fl, int len, int complete) |
2080 | { | 2080 | { |
2081 | struct rx_sw_desc *sd = &fl->sdesc[fl->cidx]; | 2081 | struct rx_sw_desc *sd = &fl->sdesc[fl->cidx]; |
2082 | struct port_info *pi = netdev_priv(qs->netdev); | ||
2082 | struct sk_buff *skb = NULL; | 2083 | struct sk_buff *skb = NULL; |
2083 | struct cpl_rx_pkt *cpl; | 2084 | struct cpl_rx_pkt *cpl; |
2084 | struct skb_frag_struct *rx_frag; | 2085 | struct skb_frag_struct *rx_frag; |
@@ -2116,11 +2117,18 @@ static void lro_add_page(struct adapter *adap, struct sge_qset *qs, | |||
2116 | 2117 | ||
2117 | if (!nr_frags) { | 2118 | if (!nr_frags) { |
2118 | offset = 2 + sizeof(struct cpl_rx_pkt); | 2119 | offset = 2 + sizeof(struct cpl_rx_pkt); |
2119 | qs->lro_va = sd->pg_chunk.va + 2; | 2120 | cpl = qs->lro_va = sd->pg_chunk.va + 2; |
2120 | } | ||
2121 | len -= offset; | ||
2122 | 2121 | ||
2123 | prefetch(qs->lro_va); | 2122 | if ((pi->rx_offload & T3_RX_CSUM) && |
2123 | cpl->csum_valid && cpl->csum == htons(0xffff)) { | ||
2124 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
2125 | qs->port_stats[SGE_PSTAT_RX_CSUM_GOOD]++; | ||
2126 | } else | ||
2127 | skb->ip_summed = CHECKSUM_NONE; | ||
2128 | } else | ||
2129 | cpl = qs->lro_va; | ||
2130 | |||
2131 | len -= offset; | ||
2124 | 2132 | ||
2125 | rx_frag += nr_frags; | 2133 | rx_frag += nr_frags; |
2126 | rx_frag->page = sd->pg_chunk.page; | 2134 | rx_frag->page = sd->pg_chunk.page; |
@@ -2136,12 +2144,8 @@ static void lro_add_page(struct adapter *adap, struct sge_qset *qs, | |||
2136 | return; | 2144 | return; |
2137 | 2145 | ||
2138 | skb_record_rx_queue(skb, qs - &adap->sge.qs[0]); | 2146 | skb_record_rx_queue(skb, qs - &adap->sge.qs[0]); |
2139 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
2140 | cpl = qs->lro_va; | ||
2141 | 2147 | ||
2142 | if (unlikely(cpl->vlan_valid)) { | 2148 | if (unlikely(cpl->vlan_valid)) { |
2143 | struct net_device *dev = qs->netdev; | ||
2144 | struct port_info *pi = netdev_priv(dev); | ||
2145 | struct vlan_group *grp = pi->vlan_grp; | 2149 | struct vlan_group *grp = pi->vlan_grp; |
2146 | 2150 | ||
2147 | if (likely(grp != NULL)) { | 2151 | if (likely(grp != NULL)) { |
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index 34e03104c3c1..33c4fe26178c 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c | |||
@@ -2711,6 +2711,8 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) | |||
2711 | SET_ETHTOOL_OPS(ndev, ðtool_ops); | 2711 | SET_ETHTOOL_OPS(ndev, ðtool_ops); |
2712 | netif_napi_add(ndev, &priv->napi, emac_poll, EMAC_POLL_WEIGHT); | 2712 | netif_napi_add(ndev, &priv->napi, emac_poll, EMAC_POLL_WEIGHT); |
2713 | 2713 | ||
2714 | clk_enable(emac_clk); | ||
2715 | |||
2714 | /* register the network device */ | 2716 | /* register the network device */ |
2715 | SET_NETDEV_DEV(ndev, &pdev->dev); | 2717 | SET_NETDEV_DEV(ndev, &pdev->dev); |
2716 | rc = register_netdev(ndev); | 2718 | rc = register_netdev(ndev); |
@@ -2720,7 +2722,6 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) | |||
2720 | goto netdev_reg_err; | 2722 | goto netdev_reg_err; |
2721 | } | 2723 | } |
2722 | 2724 | ||
2723 | clk_enable(emac_clk); | ||
2724 | 2725 | ||
2725 | /* MII/Phy intialisation, mdio bus registration */ | 2726 | /* MII/Phy intialisation, mdio bus registration */ |
2726 | emac_mii = mdiobus_alloc(); | 2727 | emac_mii = mdiobus_alloc(); |
@@ -2760,6 +2761,7 @@ mdiobus_quit: | |||
2760 | 2761 | ||
2761 | netdev_reg_err: | 2762 | netdev_reg_err: |
2762 | mdio_alloc_err: | 2763 | mdio_alloc_err: |
2764 | clk_disable(emac_clk); | ||
2763 | no_irq_res: | 2765 | no_irq_res: |
2764 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 2766 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
2765 | release_mem_region(res->start, res->end - res->start + 1); | 2767 | release_mem_region(res->start, res->end - res->start + 1); |
diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h index 2a567df3ea71..e8932db7ee77 100644 --- a/drivers/net/e1000/e1000.h +++ b/drivers/net/e1000/e1000.h | |||
@@ -326,6 +326,8 @@ struct e1000_adapter { | |||
326 | /* for ioport free */ | 326 | /* for ioport free */ |
327 | int bars; | 327 | int bars; |
328 | int need_ioport; | 328 | int need_ioport; |
329 | |||
330 | bool discarding; | ||
329 | }; | 331 | }; |
330 | 332 | ||
331 | enum e1000_state_t { | 333 | enum e1000_state_t { |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 7e855f9bbd97..765543663a4f 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -1698,18 +1698,6 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter) | |||
1698 | rctl &= ~E1000_RCTL_SZ_4096; | 1698 | rctl &= ~E1000_RCTL_SZ_4096; |
1699 | rctl |= E1000_RCTL_BSEX; | 1699 | rctl |= E1000_RCTL_BSEX; |
1700 | switch (adapter->rx_buffer_len) { | 1700 | switch (adapter->rx_buffer_len) { |
1701 | case E1000_RXBUFFER_256: | ||
1702 | rctl |= E1000_RCTL_SZ_256; | ||
1703 | rctl &= ~E1000_RCTL_BSEX; | ||
1704 | break; | ||
1705 | case E1000_RXBUFFER_512: | ||
1706 | rctl |= E1000_RCTL_SZ_512; | ||
1707 | rctl &= ~E1000_RCTL_BSEX; | ||
1708 | break; | ||
1709 | case E1000_RXBUFFER_1024: | ||
1710 | rctl |= E1000_RCTL_SZ_1024; | ||
1711 | rctl &= ~E1000_RCTL_BSEX; | ||
1712 | break; | ||
1713 | case E1000_RXBUFFER_2048: | 1701 | case E1000_RXBUFFER_2048: |
1714 | default: | 1702 | default: |
1715 | rctl |= E1000_RCTL_SZ_2048; | 1703 | rctl |= E1000_RCTL_SZ_2048; |
@@ -2802,13 +2790,13 @@ static int e1000_tx_map(struct e1000_adapter *adapter, | |||
2802 | dma_error: | 2790 | dma_error: |
2803 | dev_err(&pdev->dev, "TX DMA map failed\n"); | 2791 | dev_err(&pdev->dev, "TX DMA map failed\n"); |
2804 | buffer_info->dma = 0; | 2792 | buffer_info->dma = 0; |
2805 | count--; | 2793 | if (count) |
2806 | |||
2807 | while (count >= 0) { | ||
2808 | count--; | 2794 | count--; |
2809 | i--; | 2795 | |
2810 | if (i < 0) | 2796 | while (count--) { |
2797 | if (i==0) | ||
2811 | i += tx_ring->count; | 2798 | i += tx_ring->count; |
2799 | i--; | ||
2812 | buffer_info = &tx_ring->buffer_info[i]; | 2800 | buffer_info = &tx_ring->buffer_info[i]; |
2813 | e1000_unmap_and_free_tx_resource(adapter, buffer_info); | 2801 | e1000_unmap_and_free_tx_resource(adapter, buffer_info); |
2814 | } | 2802 | } |
@@ -3176,13 +3164,7 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
3176 | * however with the new *_jumbo_rx* routines, jumbo receives will use | 3164 | * however with the new *_jumbo_rx* routines, jumbo receives will use |
3177 | * fragmented skbs */ | 3165 | * fragmented skbs */ |
3178 | 3166 | ||
3179 | if (max_frame <= E1000_RXBUFFER_256) | 3167 | if (max_frame <= E1000_RXBUFFER_2048) |
3180 | adapter->rx_buffer_len = E1000_RXBUFFER_256; | ||
3181 | else if (max_frame <= E1000_RXBUFFER_512) | ||
3182 | adapter->rx_buffer_len = E1000_RXBUFFER_512; | ||
3183 | else if (max_frame <= E1000_RXBUFFER_1024) | ||
3184 | adapter->rx_buffer_len = E1000_RXBUFFER_1024; | ||
3185 | else if (max_frame <= E1000_RXBUFFER_2048) | ||
3186 | adapter->rx_buffer_len = E1000_RXBUFFER_2048; | 3168 | adapter->rx_buffer_len = E1000_RXBUFFER_2048; |
3187 | else | 3169 | else |
3188 | #if (PAGE_SIZE >= E1000_RXBUFFER_16384) | 3170 | #if (PAGE_SIZE >= E1000_RXBUFFER_16384) |
@@ -3850,13 +3832,22 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter, | |||
3850 | 3832 | ||
3851 | length = le16_to_cpu(rx_desc->length); | 3833 | length = le16_to_cpu(rx_desc->length); |
3852 | /* !EOP means multiple descriptors were used to store a single | 3834 | /* !EOP means multiple descriptors were used to store a single |
3853 | * packet, also make sure the frame isn't just CRC only */ | 3835 | * packet, if thats the case we need to toss it. In fact, we |
3854 | if (unlikely(!(status & E1000_RXD_STAT_EOP) || (length <= 4))) { | 3836 | * to toss every packet with the EOP bit clear and the next |
3837 | * frame that _does_ have the EOP bit set, as it is by | ||
3838 | * definition only a frame fragment | ||
3839 | */ | ||
3840 | if (unlikely(!(status & E1000_RXD_STAT_EOP))) | ||
3841 | adapter->discarding = true; | ||
3842 | |||
3843 | if (adapter->discarding) { | ||
3855 | /* All receives must fit into a single buffer */ | 3844 | /* All receives must fit into a single buffer */ |
3856 | E1000_DBG("%s: Receive packet consumed multiple" | 3845 | E1000_DBG("%s: Receive packet consumed multiple" |
3857 | " buffers\n", netdev->name); | 3846 | " buffers\n", netdev->name); |
3858 | /* recycle */ | 3847 | /* recycle */ |
3859 | buffer_info->skb = skb; | 3848 | buffer_info->skb = skb; |
3849 | if (status & E1000_RXD_STAT_EOP) | ||
3850 | adapter->discarding = false; | ||
3860 | goto next_desc; | 3851 | goto next_desc; |
3861 | } | 3852 | } |
3862 | 3853 | ||
@@ -4015,11 +4006,21 @@ check_page: | |||
4015 | } | 4006 | } |
4016 | } | 4007 | } |
4017 | 4008 | ||
4018 | if (!buffer_info->dma) | 4009 | if (!buffer_info->dma) { |
4019 | buffer_info->dma = pci_map_page(pdev, | 4010 | buffer_info->dma = pci_map_page(pdev, |
4020 | buffer_info->page, 0, | 4011 | buffer_info->page, 0, |
4021 | buffer_info->length, | 4012 | buffer_info->length, |
4022 | PCI_DMA_FROMDEVICE); | 4013 | PCI_DMA_FROMDEVICE); |
4014 | if (pci_dma_mapping_error(pdev, buffer_info->dma)) { | ||
4015 | put_page(buffer_info->page); | ||
4016 | dev_kfree_skb(skb); | ||
4017 | buffer_info->page = NULL; | ||
4018 | buffer_info->skb = NULL; | ||
4019 | buffer_info->dma = 0; | ||
4020 | adapter->alloc_rx_buff_failed++; | ||
4021 | break; /* while !buffer_info->skb */ | ||
4022 | } | ||
4023 | } | ||
4023 | 4024 | ||
4024 | rx_desc = E1000_RX_DESC(*rx_ring, i); | 4025 | rx_desc = E1000_RX_DESC(*rx_ring, i); |
4025 | rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma); | 4026 | rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma); |
@@ -4110,6 +4111,13 @@ map_skb: | |||
4110 | skb->data, | 4111 | skb->data, |
4111 | buffer_info->length, | 4112 | buffer_info->length, |
4112 | PCI_DMA_FROMDEVICE); | 4113 | PCI_DMA_FROMDEVICE); |
4114 | if (pci_dma_mapping_error(pdev, buffer_info->dma)) { | ||
4115 | dev_kfree_skb(skb); | ||
4116 | buffer_info->skb = NULL; | ||
4117 | buffer_info->dma = 0; | ||
4118 | adapter->alloc_rx_buff_failed++; | ||
4119 | break; /* while !buffer_info->skb */ | ||
4120 | } | ||
4113 | 4121 | ||
4114 | /* | 4122 | /* |
4115 | * XXX if it was allocated cleanly it will never map to a | 4123 | * XXX if it was allocated cleanly it will never map to a |
diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c index b979464091bb..02d67d047d96 100644 --- a/drivers/net/e1000e/82571.c +++ b/drivers/net/e1000e/82571.c | |||
@@ -237,6 +237,8 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter) | |||
237 | /* Set if manageability features are enabled. */ | 237 | /* Set if manageability features are enabled. */ |
238 | mac->arc_subsystem_valid = (er32(FWSM) & E1000_FWSM_MODE_MASK) | 238 | mac->arc_subsystem_valid = (er32(FWSM) & E1000_FWSM_MODE_MASK) |
239 | ? true : false; | 239 | ? true : false; |
240 | /* Adaptive IFS supported */ | ||
241 | mac->adaptive_ifs = true; | ||
240 | 242 | ||
241 | /* check for link */ | 243 | /* check for link */ |
242 | switch (hw->phy.media_type) { | 244 | switch (hw->phy.media_type) { |
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index cebbd9079d53..d236efaf7478 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h | |||
@@ -421,6 +421,7 @@ struct e1000_info { | |||
421 | /* CRC Stripping defines */ | 421 | /* CRC Stripping defines */ |
422 | #define FLAG2_CRC_STRIPPING (1 << 0) | 422 | #define FLAG2_CRC_STRIPPING (1 << 0) |
423 | #define FLAG2_HAS_PHY_WAKEUP (1 << 1) | 423 | #define FLAG2_HAS_PHY_WAKEUP (1 << 1) |
424 | #define FLAG2_IS_DISCARDING (1 << 2) | ||
424 | 425 | ||
425 | #define E1000_RX_DESC_PS(R, i) \ | 426 | #define E1000_RX_DESC_PS(R, i) \ |
426 | (&(((union e1000_rx_desc_packet_split *)((R).desc))[i])) | 427 | (&(((union e1000_rx_desc_packet_split *)((R).desc))[i])) |
@@ -582,7 +583,6 @@ extern s32 e1000_read_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, | |||
582 | extern s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data); | 583 | extern s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data); |
583 | extern s32 e1000_write_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, | 584 | extern s32 e1000_write_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, |
584 | u16 data); | 585 | u16 data); |
585 | extern s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw, bool slow); | ||
586 | extern s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw); | 586 | extern s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw); |
587 | extern s32 e1000_copper_link_setup_82577(struct e1000_hw *hw); | 587 | extern s32 e1000_copper_link_setup_82577(struct e1000_hw *hw); |
588 | extern s32 e1000_check_polarity_82577(struct e1000_hw *hw); | 588 | extern s32 e1000_check_polarity_82577(struct e1000_hw *hw); |
diff --git a/drivers/net/e1000e/es2lan.c b/drivers/net/e1000e/es2lan.c index 3028f23da891..e2aa3b788564 100644 --- a/drivers/net/e1000e/es2lan.c +++ b/drivers/net/e1000e/es2lan.c | |||
@@ -224,6 +224,8 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_adapter *adapter) | |||
224 | /* Set if manageability features are enabled. */ | 224 | /* Set if manageability features are enabled. */ |
225 | mac->arc_subsystem_valid = (er32(FWSM) & E1000_FWSM_MODE_MASK) | 225 | mac->arc_subsystem_valid = (er32(FWSM) & E1000_FWSM_MODE_MASK) |
226 | ? true : false; | 226 | ? true : false; |
227 | /* Adaptive IFS not supported */ | ||
228 | mac->adaptive_ifs = false; | ||
227 | 229 | ||
228 | /* check for link */ | 230 | /* check for link */ |
229 | switch (hw->phy.media_type) { | 231 | switch (hw->phy.media_type) { |
diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h index 2784cf44a6f3..eccf29b75c41 100644 --- a/drivers/net/e1000e/hw.h +++ b/drivers/net/e1000e/hw.h | |||
@@ -818,6 +818,7 @@ struct e1000_mac_info { | |||
818 | 818 | ||
819 | u8 forced_speed_duplex; | 819 | u8 forced_speed_duplex; |
820 | 820 | ||
821 | bool adaptive_ifs; | ||
821 | bool arc_subsystem_valid; | 822 | bool arc_subsystem_valid; |
822 | bool autoneg; | 823 | bool autoneg; |
823 | bool autoneg_failed; | 824 | bool autoneg_failed; |
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c index 9b09246af064..8b6ecd127889 100644 --- a/drivers/net/e1000e/ich8lan.c +++ b/drivers/net/e1000e/ich8lan.c | |||
@@ -138,6 +138,10 @@ | |||
138 | #define E1000_NVM_K1_CONFIG 0x1B /* NVM K1 Config Word */ | 138 | #define E1000_NVM_K1_CONFIG 0x1B /* NVM K1 Config Word */ |
139 | #define E1000_NVM_K1_ENABLE 0x1 /* NVM Enable K1 bit */ | 139 | #define E1000_NVM_K1_ENABLE 0x1 /* NVM Enable K1 bit */ |
140 | 140 | ||
141 | /* KMRN Mode Control */ | ||
142 | #define HV_KMRN_MODE_CTRL PHY_REG(769, 16) | ||
143 | #define HV_KMRN_MDIO_SLOW 0x0400 | ||
144 | |||
141 | /* ICH GbE Flash Hardware Sequencing Flash Status Register bit breakdown */ | 145 | /* ICH GbE Flash Hardware Sequencing Flash Status Register bit breakdown */ |
142 | /* Offset 04h HSFSTS */ | 146 | /* Offset 04h HSFSTS */ |
143 | union ich8_hws_flash_status { | 147 | union ich8_hws_flash_status { |
@@ -219,6 +223,7 @@ static s32 e1000_set_lplu_state_pchlan(struct e1000_hw *hw, bool active); | |||
219 | static void e1000_power_down_phy_copper_ich8lan(struct e1000_hw *hw); | 223 | static void e1000_power_down_phy_copper_ich8lan(struct e1000_hw *hw); |
220 | static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw); | 224 | static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw); |
221 | static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link); | 225 | static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link); |
226 | static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw); | ||
222 | 227 | ||
223 | static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg) | 228 | static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg) |
224 | { | 229 | { |
@@ -270,7 +275,21 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) | |||
270 | phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; | 275 | phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; |
271 | 276 | ||
272 | phy->id = e1000_phy_unknown; | 277 | phy->id = e1000_phy_unknown; |
273 | e1000e_get_phy_id(hw); | 278 | ret_val = e1000e_get_phy_id(hw); |
279 | if (ret_val) | ||
280 | goto out; | ||
281 | if ((phy->id == 0) || (phy->id == PHY_REVISION_MASK)) { | ||
282 | /* | ||
283 | * In case the PHY needs to be in mdio slow mode (eg. 82577), | ||
284 | * set slow mode and try to get the PHY id again. | ||
285 | */ | ||
286 | ret_val = e1000_set_mdio_slow_mode_hv(hw); | ||
287 | if (ret_val) | ||
288 | goto out; | ||
289 | ret_val = e1000e_get_phy_id(hw); | ||
290 | if (ret_val) | ||
291 | goto out; | ||
292 | } | ||
274 | phy->type = e1000e_get_phy_type_from_id(phy->id); | 293 | phy->type = e1000e_get_phy_type_from_id(phy->id); |
275 | 294 | ||
276 | switch (phy->type) { | 295 | switch (phy->type) { |
@@ -292,6 +311,7 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) | |||
292 | break; | 311 | break; |
293 | } | 312 | } |
294 | 313 | ||
314 | out: | ||
295 | return ret_val; | 315 | return ret_val; |
296 | } | 316 | } |
297 | 317 | ||
@@ -454,6 +474,8 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter) | |||
454 | mac->rar_entry_count--; | 474 | mac->rar_entry_count--; |
455 | /* Set if manageability features are enabled. */ | 475 | /* Set if manageability features are enabled. */ |
456 | mac->arc_subsystem_valid = true; | 476 | mac->arc_subsystem_valid = true; |
477 | /* Adaptive IFS supported */ | ||
478 | mac->adaptive_ifs = true; | ||
457 | 479 | ||
458 | /* LED operations */ | 480 | /* LED operations */ |
459 | switch (mac->type) { | 481 | switch (mac->type) { |
@@ -1074,16 +1096,44 @@ out: | |||
1074 | 1096 | ||
1075 | 1097 | ||
1076 | /** | 1098 | /** |
1099 | * e1000_set_mdio_slow_mode_hv - Set slow MDIO access mode | ||
1100 | * @hw: pointer to the HW structure | ||
1101 | **/ | ||
1102 | static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw) | ||
1103 | { | ||
1104 | s32 ret_val; | ||
1105 | u16 data; | ||
1106 | |||
1107 | ret_val = e1e_rphy(hw, HV_KMRN_MODE_CTRL, &data); | ||
1108 | if (ret_val) | ||
1109 | return ret_val; | ||
1110 | |||
1111 | data |= HV_KMRN_MDIO_SLOW; | ||
1112 | |||
1113 | ret_val = e1e_wphy(hw, HV_KMRN_MODE_CTRL, data); | ||
1114 | |||
1115 | return ret_val; | ||
1116 | } | ||
1117 | |||
1118 | /** | ||
1077 | * e1000_hv_phy_workarounds_ich8lan - A series of Phy workarounds to be | 1119 | * e1000_hv_phy_workarounds_ich8lan - A series of Phy workarounds to be |
1078 | * done after every PHY reset. | 1120 | * done after every PHY reset. |
1079 | **/ | 1121 | **/ |
1080 | static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw) | 1122 | static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw) |
1081 | { | 1123 | { |
1082 | s32 ret_val = 0; | 1124 | s32 ret_val = 0; |
1125 | u16 phy_data; | ||
1083 | 1126 | ||
1084 | if (hw->mac.type != e1000_pchlan) | 1127 | if (hw->mac.type != e1000_pchlan) |
1085 | return ret_val; | 1128 | return ret_val; |
1086 | 1129 | ||
1130 | /* Set MDIO slow mode before any other MDIO access */ | ||
1131 | if (hw->phy.type == e1000_phy_82577) { | ||
1132 | ret_val = e1000_set_mdio_slow_mode_hv(hw); | ||
1133 | if (ret_val) | ||
1134 | goto out; | ||
1135 | } | ||
1136 | |||
1087 | if (((hw->phy.type == e1000_phy_82577) && | 1137 | if (((hw->phy.type == e1000_phy_82577) && |
1088 | ((hw->phy.revision == 1) || (hw->phy.revision == 2))) || | 1138 | ((hw->phy.revision == 1) || (hw->phy.revision == 2))) || |
1089 | ((hw->phy.type == e1000_phy_82578) && (hw->phy.revision == 1))) { | 1139 | ((hw->phy.type == e1000_phy_82578) && (hw->phy.revision == 1))) { |
@@ -1116,16 +1166,32 @@ static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw) | |||
1116 | 1166 | ||
1117 | hw->phy.addr = 1; | 1167 | hw->phy.addr = 1; |
1118 | ret_val = e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, 0); | 1168 | ret_val = e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, 0); |
1169 | hw->phy.ops.release(hw); | ||
1119 | if (ret_val) | 1170 | if (ret_val) |
1120 | goto out; | 1171 | goto out; |
1121 | hw->phy.ops.release(hw); | ||
1122 | 1172 | ||
1123 | /* | 1173 | /* |
1124 | * Configure the K1 Si workaround during phy reset assuming there is | 1174 | * Configure the K1 Si workaround during phy reset assuming there is |
1125 | * link so that it disables K1 if link is in 1Gbps. | 1175 | * link so that it disables K1 if link is in 1Gbps. |
1126 | */ | 1176 | */ |
1127 | ret_val = e1000_k1_gig_workaround_hv(hw, true); | 1177 | ret_val = e1000_k1_gig_workaround_hv(hw, true); |
1178 | if (ret_val) | ||
1179 | goto out; | ||
1128 | 1180 | ||
1181 | /* Workaround for link disconnects on a busy hub in half duplex */ | ||
1182 | ret_val = hw->phy.ops.acquire(hw); | ||
1183 | if (ret_val) | ||
1184 | goto out; | ||
1185 | ret_val = hw->phy.ops.read_reg_locked(hw, | ||
1186 | PHY_REG(BM_PORT_CTRL_PAGE, 17), | ||
1187 | &phy_data); | ||
1188 | if (ret_val) | ||
1189 | goto release; | ||
1190 | ret_val = hw->phy.ops.write_reg_locked(hw, | ||
1191 | PHY_REG(BM_PORT_CTRL_PAGE, 17), | ||
1192 | phy_data & 0x00FF); | ||
1193 | release: | ||
1194 | hw->phy.ops.release(hw); | ||
1129 | out: | 1195 | out: |
1130 | return ret_val; | 1196 | return ret_val; |
1131 | } | 1197 | } |
@@ -1182,6 +1248,7 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw) | |||
1182 | /* Allow time for h/w to get to a quiescent state after reset */ | 1248 | /* Allow time for h/w to get to a quiescent state after reset */ |
1183 | mdelay(10); | 1249 | mdelay(10); |
1184 | 1250 | ||
1251 | /* Perform any necessary post-reset workarounds */ | ||
1185 | if (hw->mac.type == e1000_pchlan) { | 1252 | if (hw->mac.type == e1000_pchlan) { |
1186 | ret_val = e1000_hv_phy_workarounds_ich8lan(hw); | 1253 | ret_val = e1000_hv_phy_workarounds_ich8lan(hw); |
1187 | if (ret_val) | 1254 | if (ret_val) |
@@ -2482,6 +2549,10 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) | |||
2482 | if (!ret_val) | 2549 | if (!ret_val) |
2483 | e1000_release_swflag_ich8lan(hw); | 2550 | e1000_release_swflag_ich8lan(hw); |
2484 | 2551 | ||
2552 | /* Perform any necessary post-reset workarounds */ | ||
2553 | if (hw->mac.type == e1000_pchlan) | ||
2554 | ret_val = e1000_hv_phy_workarounds_ich8lan(hw); | ||
2555 | |||
2485 | if (ctrl & E1000_CTRL_PHY_RST) | 2556 | if (ctrl & E1000_CTRL_PHY_RST) |
2486 | ret_val = hw->phy.ops.get_cfg_done(hw); | 2557 | ret_val = hw->phy.ops.get_cfg_done(hw); |
2487 | 2558 | ||
@@ -2526,9 +2597,6 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) | |||
2526 | kab |= E1000_KABGTXD_BGSQLBIAS; | 2597 | kab |= E1000_KABGTXD_BGSQLBIAS; |
2527 | ew32(KABGTXD, kab); | 2598 | ew32(KABGTXD, kab); |
2528 | 2599 | ||
2529 | if (hw->mac.type == e1000_pchlan) | ||
2530 | ret_val = e1000_hv_phy_workarounds_ich8lan(hw); | ||
2531 | |||
2532 | out: | 2600 | out: |
2533 | return ret_val; | 2601 | return ret_val; |
2534 | } | 2602 | } |
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c index a86c17548c1e..2fa9b36a2c5a 100644 --- a/drivers/net/e1000e/lib.c +++ b/drivers/net/e1000e/lib.c | |||
@@ -125,6 +125,7 @@ void e1000_write_vfta_generic(struct e1000_hw *hw, u32 offset, u32 value) | |||
125 | void e1000e_init_rx_addrs(struct e1000_hw *hw, u16 rar_count) | 125 | void e1000e_init_rx_addrs(struct e1000_hw *hw, u16 rar_count) |
126 | { | 126 | { |
127 | u32 i; | 127 | u32 i; |
128 | u8 mac_addr[ETH_ALEN] = {0}; | ||
128 | 129 | ||
129 | /* Setup the receive address */ | 130 | /* Setup the receive address */ |
130 | e_dbg("Programming MAC Address into RAR[0]\n"); | 131 | e_dbg("Programming MAC Address into RAR[0]\n"); |
@@ -133,12 +134,8 @@ void e1000e_init_rx_addrs(struct e1000_hw *hw, u16 rar_count) | |||
133 | 134 | ||
134 | /* Zero out the other (rar_entry_count - 1) receive addresses */ | 135 | /* Zero out the other (rar_entry_count - 1) receive addresses */ |
135 | e_dbg("Clearing RAR[1-%u]\n", rar_count-1); | 136 | e_dbg("Clearing RAR[1-%u]\n", rar_count-1); |
136 | for (i = 1; i < rar_count; i++) { | 137 | for (i = 1; i < rar_count; i++) |
137 | E1000_WRITE_REG_ARRAY(hw, E1000_RA, (i << 1), 0); | 138 | e1000e_rar_set(hw, mac_addr, i); |
138 | e1e_flush(); | ||
139 | E1000_WRITE_REG_ARRAY(hw, E1000_RA, ((i << 1) + 1), 0); | ||
140 | e1e_flush(); | ||
141 | } | ||
142 | } | 139 | } |
143 | 140 | ||
144 | /** | 141 | /** |
@@ -164,10 +161,19 @@ void e1000e_rar_set(struct e1000_hw *hw, u8 *addr, u32 index) | |||
164 | 161 | ||
165 | rar_high = ((u32) addr[4] | ((u32) addr[5] << 8)); | 162 | rar_high = ((u32) addr[4] | ((u32) addr[5] << 8)); |
166 | 163 | ||
167 | rar_high |= E1000_RAH_AV; | 164 | /* If MAC address zero, no need to set the AV bit */ |
165 | if (rar_low || rar_high) | ||
166 | rar_high |= E1000_RAH_AV; | ||
168 | 167 | ||
169 | E1000_WRITE_REG_ARRAY(hw, E1000_RA, (index << 1), rar_low); | 168 | /* |
170 | E1000_WRITE_REG_ARRAY(hw, E1000_RA, ((index << 1) + 1), rar_high); | 169 | * Some bridges will combine consecutive 32-bit writes into |
170 | * a single burst write, which will malfunction on some parts. | ||
171 | * The flushes avoid this. | ||
172 | */ | ||
173 | ew32(RAL(index), rar_low); | ||
174 | e1e_flush(); | ||
175 | ew32(RAH(index), rar_high); | ||
176 | e1e_flush(); | ||
171 | } | 177 | } |
172 | 178 | ||
173 | /** | 179 | /** |
@@ -1609,6 +1615,11 @@ void e1000e_reset_adaptive(struct e1000_hw *hw) | |||
1609 | { | 1615 | { |
1610 | struct e1000_mac_info *mac = &hw->mac; | 1616 | struct e1000_mac_info *mac = &hw->mac; |
1611 | 1617 | ||
1618 | if (!mac->adaptive_ifs) { | ||
1619 | e_dbg("Not in Adaptive IFS mode!\n"); | ||
1620 | goto out; | ||
1621 | } | ||
1622 | |||
1612 | mac->current_ifs_val = 0; | 1623 | mac->current_ifs_val = 0; |
1613 | mac->ifs_min_val = IFS_MIN; | 1624 | mac->ifs_min_val = IFS_MIN; |
1614 | mac->ifs_max_val = IFS_MAX; | 1625 | mac->ifs_max_val = IFS_MAX; |
@@ -1617,6 +1628,8 @@ void e1000e_reset_adaptive(struct e1000_hw *hw) | |||
1617 | 1628 | ||
1618 | mac->in_ifs_mode = false; | 1629 | mac->in_ifs_mode = false; |
1619 | ew32(AIT, 0); | 1630 | ew32(AIT, 0); |
1631 | out: | ||
1632 | return; | ||
1620 | } | 1633 | } |
1621 | 1634 | ||
1622 | /** | 1635 | /** |
@@ -1630,6 +1643,11 @@ void e1000e_update_adaptive(struct e1000_hw *hw) | |||
1630 | { | 1643 | { |
1631 | struct e1000_mac_info *mac = &hw->mac; | 1644 | struct e1000_mac_info *mac = &hw->mac; |
1632 | 1645 | ||
1646 | if (!mac->adaptive_ifs) { | ||
1647 | e_dbg("Not in Adaptive IFS mode!\n"); | ||
1648 | goto out; | ||
1649 | } | ||
1650 | |||
1633 | if ((mac->collision_delta * mac->ifs_ratio) > mac->tx_packet_delta) { | 1651 | if ((mac->collision_delta * mac->ifs_ratio) > mac->tx_packet_delta) { |
1634 | if (mac->tx_packet_delta > MIN_NUM_XMITS) { | 1652 | if (mac->tx_packet_delta > MIN_NUM_XMITS) { |
1635 | mac->in_ifs_mode = true; | 1653 | mac->in_ifs_mode = true; |
@@ -1650,6 +1668,8 @@ void e1000e_update_adaptive(struct e1000_hw *hw) | |||
1650 | ew32(AIT, 0); | 1668 | ew32(AIT, 0); |
1651 | } | 1669 | } |
1652 | } | 1670 | } |
1671 | out: | ||
1672 | return; | ||
1653 | } | 1673 | } |
1654 | 1674 | ||
1655 | /** | 1675 | /** |
@@ -2287,10 +2307,12 @@ bool e1000e_enable_tx_pkt_filtering(struct e1000_hw *hw) | |||
2287 | s32 ret_val, hdr_csum, csum; | 2307 | s32 ret_val, hdr_csum, csum; |
2288 | u8 i, len; | 2308 | u8 i, len; |
2289 | 2309 | ||
2310 | hw->mac.tx_pkt_filtering = true; | ||
2311 | |||
2290 | /* No manageability, no filtering */ | 2312 | /* No manageability, no filtering */ |
2291 | if (!e1000e_check_mng_mode(hw)) { | 2313 | if (!e1000e_check_mng_mode(hw)) { |
2292 | hw->mac.tx_pkt_filtering = false; | 2314 | hw->mac.tx_pkt_filtering = false; |
2293 | return 0; | 2315 | goto out; |
2294 | } | 2316 | } |
2295 | 2317 | ||
2296 | /* | 2318 | /* |
@@ -2298,9 +2320,9 @@ bool e1000e_enable_tx_pkt_filtering(struct e1000_hw *hw) | |||
2298 | * reason, disable filtering. | 2320 | * reason, disable filtering. |
2299 | */ | 2321 | */ |
2300 | ret_val = e1000_mng_enable_host_if(hw); | 2322 | ret_val = e1000_mng_enable_host_if(hw); |
2301 | if (ret_val != 0) { | 2323 | if (ret_val) { |
2302 | hw->mac.tx_pkt_filtering = false; | 2324 | hw->mac.tx_pkt_filtering = false; |
2303 | return ret_val; | 2325 | goto out; |
2304 | } | 2326 | } |
2305 | 2327 | ||
2306 | /* Read in the header. Length and offset are in dwords. */ | 2328 | /* Read in the header. Length and offset are in dwords. */ |
@@ -2319,17 +2341,17 @@ bool e1000e_enable_tx_pkt_filtering(struct e1000_hw *hw) | |||
2319 | */ | 2341 | */ |
2320 | if ((hdr_csum != csum) || (hdr->signature != E1000_IAMT_SIGNATURE)) { | 2342 | if ((hdr_csum != csum) || (hdr->signature != E1000_IAMT_SIGNATURE)) { |
2321 | hw->mac.tx_pkt_filtering = true; | 2343 | hw->mac.tx_pkt_filtering = true; |
2322 | return 1; | 2344 | goto out; |
2323 | } | 2345 | } |
2324 | 2346 | ||
2325 | /* Cookie area is valid, make the final check for filtering. */ | 2347 | /* Cookie area is valid, make the final check for filtering. */ |
2326 | if (!(hdr->status & E1000_MNG_DHCP_COOKIE_STATUS_PARSING)) { | 2348 | if (!(hdr->status & E1000_MNG_DHCP_COOKIE_STATUS_PARSING)) { |
2327 | hw->mac.tx_pkt_filtering = false; | 2349 | hw->mac.tx_pkt_filtering = false; |
2328 | return 0; | 2350 | goto out; |
2329 | } | 2351 | } |
2330 | 2352 | ||
2331 | hw->mac.tx_pkt_filtering = true; | 2353 | out: |
2332 | return 1; | 2354 | return hw->mac.tx_pkt_filtering; |
2333 | } | 2355 | } |
2334 | 2356 | ||
2335 | /** | 2357 | /** |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 762b697ce731..57f149b75fbe 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -450,13 +450,23 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter, | |||
450 | 450 | ||
451 | length = le16_to_cpu(rx_desc->length); | 451 | length = le16_to_cpu(rx_desc->length); |
452 | 452 | ||
453 | /* !EOP means multiple descriptors were used to store a single | 453 | /* |
454 | * packet, also make sure the frame isn't just CRC only */ | 454 | * !EOP means multiple descriptors were used to store a single |
455 | if (!(status & E1000_RXD_STAT_EOP) || (length <= 4)) { | 455 | * packet, if that's the case we need to toss it. In fact, we |
456 | * need to toss every packet with the EOP bit clear and the | ||
457 | * next frame that _does_ have the EOP bit set, as it is by | ||
458 | * definition only a frame fragment | ||
459 | */ | ||
460 | if (unlikely(!(status & E1000_RXD_STAT_EOP))) | ||
461 | adapter->flags2 |= FLAG2_IS_DISCARDING; | ||
462 | |||
463 | if (adapter->flags2 & FLAG2_IS_DISCARDING) { | ||
456 | /* All receives must fit into a single buffer */ | 464 | /* All receives must fit into a single buffer */ |
457 | e_dbg("Receive packet consumed multiple buffers\n"); | 465 | e_dbg("Receive packet consumed multiple buffers\n"); |
458 | /* recycle */ | 466 | /* recycle */ |
459 | buffer_info->skb = skb; | 467 | buffer_info->skb = skb; |
468 | if (status & E1000_RXD_STAT_EOP) | ||
469 | adapter->flags2 &= ~FLAG2_IS_DISCARDING; | ||
460 | goto next_desc; | 470 | goto next_desc; |
461 | } | 471 | } |
462 | 472 | ||
@@ -745,10 +755,16 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | |||
745 | PCI_DMA_FROMDEVICE); | 755 | PCI_DMA_FROMDEVICE); |
746 | buffer_info->dma = 0; | 756 | buffer_info->dma = 0; |
747 | 757 | ||
748 | if (!(staterr & E1000_RXD_STAT_EOP)) { | 758 | /* see !EOP comment in other rx routine */ |
759 | if (!(staterr & E1000_RXD_STAT_EOP)) | ||
760 | adapter->flags2 |= FLAG2_IS_DISCARDING; | ||
761 | |||
762 | if (adapter->flags2 & FLAG2_IS_DISCARDING) { | ||
749 | e_dbg("Packet Split buffers didn't pick up the full " | 763 | e_dbg("Packet Split buffers didn't pick up the full " |
750 | "packet\n"); | 764 | "packet\n"); |
751 | dev_kfree_skb_irq(skb); | 765 | dev_kfree_skb_irq(skb); |
766 | if (staterr & E1000_RXD_STAT_EOP) | ||
767 | adapter->flags2 &= ~FLAG2_IS_DISCARDING; | ||
752 | goto next_desc; | 768 | goto next_desc; |
753 | } | 769 | } |
754 | 770 | ||
@@ -1118,6 +1134,7 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter) | |||
1118 | 1134 | ||
1119 | rx_ring->next_to_clean = 0; | 1135 | rx_ring->next_to_clean = 0; |
1120 | rx_ring->next_to_use = 0; | 1136 | rx_ring->next_to_use = 0; |
1137 | adapter->flags2 &= ~FLAG2_IS_DISCARDING; | ||
1121 | 1138 | ||
1122 | writel(0, adapter->hw.hw_addr + rx_ring->head); | 1139 | writel(0, adapter->hw.hw_addr + rx_ring->head); |
1123 | writel(0, adapter->hw.hw_addr + rx_ring->tail); | 1140 | writel(0, adapter->hw.hw_addr + rx_ring->tail); |
@@ -2333,18 +2350,6 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter) | |||
2333 | rctl &= ~E1000_RCTL_SZ_4096; | 2350 | rctl &= ~E1000_RCTL_SZ_4096; |
2334 | rctl |= E1000_RCTL_BSEX; | 2351 | rctl |= E1000_RCTL_BSEX; |
2335 | switch (adapter->rx_buffer_len) { | 2352 | switch (adapter->rx_buffer_len) { |
2336 | case 256: | ||
2337 | rctl |= E1000_RCTL_SZ_256; | ||
2338 | rctl &= ~E1000_RCTL_BSEX; | ||
2339 | break; | ||
2340 | case 512: | ||
2341 | rctl |= E1000_RCTL_SZ_512; | ||
2342 | rctl &= ~E1000_RCTL_BSEX; | ||
2343 | break; | ||
2344 | case 1024: | ||
2345 | rctl |= E1000_RCTL_SZ_1024; | ||
2346 | rctl &= ~E1000_RCTL_BSEX; | ||
2347 | break; | ||
2348 | case 2048: | 2353 | case 2048: |
2349 | default: | 2354 | default: |
2350 | rctl |= E1000_RCTL_SZ_2048; | 2355 | rctl |= E1000_RCTL_SZ_2048; |
@@ -3315,24 +3320,24 @@ void e1000e_update_stats(struct e1000_adapter *adapter) | |||
3315 | if ((hw->phy.type == e1000_phy_82578) || | 3320 | if ((hw->phy.type == e1000_phy_82578) || |
3316 | (hw->phy.type == e1000_phy_82577)) { | 3321 | (hw->phy.type == e1000_phy_82577)) { |
3317 | e1e_rphy(hw, HV_SCC_UPPER, &phy_data); | 3322 | e1e_rphy(hw, HV_SCC_UPPER, &phy_data); |
3318 | e1e_rphy(hw, HV_SCC_LOWER, &phy_data); | 3323 | if (!e1e_rphy(hw, HV_SCC_LOWER, &phy_data)) |
3319 | adapter->stats.scc += phy_data; | 3324 | adapter->stats.scc += phy_data; |
3320 | 3325 | ||
3321 | e1e_rphy(hw, HV_ECOL_UPPER, &phy_data); | 3326 | e1e_rphy(hw, HV_ECOL_UPPER, &phy_data); |
3322 | e1e_rphy(hw, HV_ECOL_LOWER, &phy_data); | 3327 | if (!e1e_rphy(hw, HV_ECOL_LOWER, &phy_data)) |
3323 | adapter->stats.ecol += phy_data; | 3328 | adapter->stats.ecol += phy_data; |
3324 | 3329 | ||
3325 | e1e_rphy(hw, HV_MCC_UPPER, &phy_data); | 3330 | e1e_rphy(hw, HV_MCC_UPPER, &phy_data); |
3326 | e1e_rphy(hw, HV_MCC_LOWER, &phy_data); | 3331 | if (!e1e_rphy(hw, HV_MCC_LOWER, &phy_data)) |
3327 | adapter->stats.mcc += phy_data; | 3332 | adapter->stats.mcc += phy_data; |
3328 | 3333 | ||
3329 | e1e_rphy(hw, HV_LATECOL_UPPER, &phy_data); | 3334 | e1e_rphy(hw, HV_LATECOL_UPPER, &phy_data); |
3330 | e1e_rphy(hw, HV_LATECOL_LOWER, &phy_data); | 3335 | if (!e1e_rphy(hw, HV_LATECOL_LOWER, &phy_data)) |
3331 | adapter->stats.latecol += phy_data; | 3336 | adapter->stats.latecol += phy_data; |
3332 | 3337 | ||
3333 | e1e_rphy(hw, HV_DC_UPPER, &phy_data); | 3338 | e1e_rphy(hw, HV_DC_UPPER, &phy_data); |
3334 | e1e_rphy(hw, HV_DC_LOWER, &phy_data); | 3339 | if (!e1e_rphy(hw, HV_DC_LOWER, &phy_data)) |
3335 | adapter->stats.dc += phy_data; | 3340 | adapter->stats.dc += phy_data; |
3336 | } else { | 3341 | } else { |
3337 | adapter->stats.scc += er32(SCC); | 3342 | adapter->stats.scc += er32(SCC); |
3338 | adapter->stats.ecol += er32(ECOL); | 3343 | adapter->stats.ecol += er32(ECOL); |
@@ -3360,8 +3365,8 @@ void e1000e_update_stats(struct e1000_adapter *adapter) | |||
3360 | if ((hw->phy.type == e1000_phy_82578) || | 3365 | if ((hw->phy.type == e1000_phy_82578) || |
3361 | (hw->phy.type == e1000_phy_82577)) { | 3366 | (hw->phy.type == e1000_phy_82577)) { |
3362 | e1e_rphy(hw, HV_COLC_UPPER, &phy_data); | 3367 | e1e_rphy(hw, HV_COLC_UPPER, &phy_data); |
3363 | e1e_rphy(hw, HV_COLC_LOWER, &phy_data); | 3368 | if (!e1e_rphy(hw, HV_COLC_LOWER, &phy_data)) |
3364 | hw->mac.collision_delta = phy_data; | 3369 | hw->mac.collision_delta = phy_data; |
3365 | } else { | 3370 | } else { |
3366 | hw->mac.collision_delta = er32(COLC); | 3371 | hw->mac.collision_delta = er32(COLC); |
3367 | } | 3372 | } |
@@ -3372,8 +3377,8 @@ void e1000e_update_stats(struct e1000_adapter *adapter) | |||
3372 | if ((hw->phy.type == e1000_phy_82578) || | 3377 | if ((hw->phy.type == e1000_phy_82578) || |
3373 | (hw->phy.type == e1000_phy_82577)) { | 3378 | (hw->phy.type == e1000_phy_82577)) { |
3374 | e1e_rphy(hw, HV_TNCRS_UPPER, &phy_data); | 3379 | e1e_rphy(hw, HV_TNCRS_UPPER, &phy_data); |
3375 | e1e_rphy(hw, HV_TNCRS_LOWER, &phy_data); | 3380 | if (!e1e_rphy(hw, HV_TNCRS_LOWER, &phy_data)) |
3376 | adapter->stats.tncrs += phy_data; | 3381 | adapter->stats.tncrs += phy_data; |
3377 | } else { | 3382 | } else { |
3378 | if ((hw->mac.type != e1000_82574) && | 3383 | if ((hw->mac.type != e1000_82574) && |
3379 | (hw->mac.type != e1000_82583)) | 3384 | (hw->mac.type != e1000_82583)) |
@@ -3781,7 +3786,7 @@ static int e1000_tso(struct e1000_adapter *adapter, | |||
3781 | 0, IPPROTO_TCP, 0); | 3786 | 0, IPPROTO_TCP, 0); |
3782 | cmd_length = E1000_TXD_CMD_IP; | 3787 | cmd_length = E1000_TXD_CMD_IP; |
3783 | ipcse = skb_transport_offset(skb) - 1; | 3788 | ipcse = skb_transport_offset(skb) - 1; |
3784 | } else if (skb_shinfo(skb)->gso_type == SKB_GSO_TCPV6) { | 3789 | } else if (skb_is_gso_v6(skb)) { |
3785 | ipv6_hdr(skb)->payload_len = 0; | 3790 | ipv6_hdr(skb)->payload_len = 0; |
3786 | tcp_hdr(skb)->check = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, | 3791 | tcp_hdr(skb)->check = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, |
3787 | &ipv6_hdr(skb)->daddr, | 3792 | &ipv6_hdr(skb)->daddr, |
@@ -3962,13 +3967,13 @@ static int e1000_tx_map(struct e1000_adapter *adapter, | |||
3962 | dma_error: | 3967 | dma_error: |
3963 | dev_err(&pdev->dev, "TX DMA map failed\n"); | 3968 | dev_err(&pdev->dev, "TX DMA map failed\n"); |
3964 | buffer_info->dma = 0; | 3969 | buffer_info->dma = 0; |
3965 | count--; | 3970 | if (count) |
3966 | |||
3967 | while (count >= 0) { | ||
3968 | count--; | 3971 | count--; |
3969 | i--; | 3972 | |
3970 | if (i < 0) | 3973 | while (count--) { |
3974 | if (i==0) | ||
3971 | i += tx_ring->count; | 3975 | i += tx_ring->count; |
3976 | i--; | ||
3972 | buffer_info = &tx_ring->buffer_info[i]; | 3977 | buffer_info = &tx_ring->buffer_info[i]; |
3973 | e1000_put_txbuf(adapter, buffer_info);; | 3978 | e1000_put_txbuf(adapter, buffer_info);; |
3974 | } | 3979 | } |
@@ -4317,13 +4322,7 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
4317 | * fragmented skbs | 4322 | * fragmented skbs |
4318 | */ | 4323 | */ |
4319 | 4324 | ||
4320 | if (max_frame <= 256) | 4325 | if (max_frame <= 2048) |
4321 | adapter->rx_buffer_len = 256; | ||
4322 | else if (max_frame <= 512) | ||
4323 | adapter->rx_buffer_len = 512; | ||
4324 | else if (max_frame <= 1024) | ||
4325 | adapter->rx_buffer_len = 1024; | ||
4326 | else if (max_frame <= 2048) | ||
4327 | adapter->rx_buffer_len = 2048; | 4326 | adapter->rx_buffer_len = 2048; |
4328 | else | 4327 | else |
4329 | adapter->rx_buffer_len = 4096; | 4328 | adapter->rx_buffer_len = 4096; |
@@ -4674,6 +4673,7 @@ static int e1000_resume(struct pci_dev *pdev) | |||
4674 | 4673 | ||
4675 | pci_set_power_state(pdev, PCI_D0); | 4674 | pci_set_power_state(pdev, PCI_D0); |
4676 | pci_restore_state(pdev); | 4675 | pci_restore_state(pdev); |
4676 | pci_save_state(pdev); | ||
4677 | e1000e_disable_l1aspm(pdev); | 4677 | e1000e_disable_l1aspm(pdev); |
4678 | 4678 | ||
4679 | err = pci_enable_device_mem(pdev); | 4679 | err = pci_enable_device_mem(pdev); |
@@ -4825,6 +4825,7 @@ static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev) | |||
4825 | } else { | 4825 | } else { |
4826 | pci_set_master(pdev); | 4826 | pci_set_master(pdev); |
4827 | pci_restore_state(pdev); | 4827 | pci_restore_state(pdev); |
4828 | pci_save_state(pdev); | ||
4828 | 4829 | ||
4829 | pci_enable_wake(pdev, PCI_D3hot, 0); | 4830 | pci_enable_wake(pdev, PCI_D3hot, 0); |
4830 | pci_enable_wake(pdev, PCI_D3cold, 0); | 4831 | pci_enable_wake(pdev, PCI_D3cold, 0); |
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c index 55a2c0acfee7..7f3ceb9dad6a 100644 --- a/drivers/net/e1000e/phy.c +++ b/drivers/net/e1000e/phy.c | |||
@@ -152,32 +152,9 @@ s32 e1000e_get_phy_id(struct e1000_hw *hw) | |||
152 | if (phy->id != 0 && phy->id != PHY_REVISION_MASK) | 152 | if (phy->id != 0 && phy->id != PHY_REVISION_MASK) |
153 | goto out; | 153 | goto out; |
154 | 154 | ||
155 | /* | ||
156 | * If the PHY ID is still unknown, we may have an 82577 | ||
157 | * without link. We will try again after setting Slow MDIC | ||
158 | * mode. No harm in trying again in this case since the PHY | ||
159 | * ID is unknown at this point anyway. | ||
160 | */ | ||
161 | ret_val = phy->ops.acquire(hw); | ||
162 | if (ret_val) | ||
163 | goto out; | ||
164 | ret_val = e1000_set_mdio_slow_mode_hv(hw, true); | ||
165 | if (ret_val) | ||
166 | goto out; | ||
167 | phy->ops.release(hw); | ||
168 | |||
169 | retry_count++; | 155 | retry_count++; |
170 | } | 156 | } |
171 | out: | 157 | out: |
172 | /* Revert to MDIO fast mode, if applicable */ | ||
173 | if (retry_count) { | ||
174 | ret_val = phy->ops.acquire(hw); | ||
175 | if (ret_val) | ||
176 | return ret_val; | ||
177 | ret_val = e1000_set_mdio_slow_mode_hv(hw, false); | ||
178 | phy->ops.release(hw); | ||
179 | } | ||
180 | |||
181 | return ret_val; | 158 | return ret_val; |
182 | } | 159 | } |
183 | 160 | ||
@@ -2791,38 +2768,6 @@ static s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active) | |||
2791 | } | 2768 | } |
2792 | 2769 | ||
2793 | /** | 2770 | /** |
2794 | * e1000_set_mdio_slow_mode_hv - Set slow MDIO access mode | ||
2795 | * @hw: pointer to the HW structure | ||
2796 | * @slow: true for slow mode, false for normal mode | ||
2797 | * | ||
2798 | * Assumes semaphore already acquired. | ||
2799 | **/ | ||
2800 | s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw, bool slow) | ||
2801 | { | ||
2802 | s32 ret_val = 0; | ||
2803 | u16 data = 0; | ||
2804 | |||
2805 | /* Set MDIO mode - page 769, register 16: 0x2580==slow, 0x2180==fast */ | ||
2806 | hw->phy.addr = 1; | ||
2807 | ret_val = e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, | ||
2808 | (BM_PORT_CTRL_PAGE << IGP_PAGE_SHIFT)); | ||
2809 | if (ret_val) | ||
2810 | goto out; | ||
2811 | |||
2812 | ret_val = e1000e_write_phy_reg_mdic(hw, BM_CS_CTRL1, | ||
2813 | (0x2180 | (slow << 10))); | ||
2814 | if (ret_val) | ||
2815 | goto out; | ||
2816 | |||
2817 | /* dummy read when reverting to fast mode - throw away result */ | ||
2818 | if (!slow) | ||
2819 | ret_val = e1000e_read_phy_reg_mdic(hw, BM_CS_CTRL1, &data); | ||
2820 | |||
2821 | out: | ||
2822 | return ret_val; | ||
2823 | } | ||
2824 | |||
2825 | /** | ||
2826 | * __e1000_read_phy_reg_hv - Read HV PHY register | 2771 | * __e1000_read_phy_reg_hv - Read HV PHY register |
2827 | * @hw: pointer to the HW structure | 2772 | * @hw: pointer to the HW structure |
2828 | * @offset: register offset to be read | 2773 | * @offset: register offset to be read |
@@ -2839,7 +2784,6 @@ static s32 __e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data, | |||
2839 | s32 ret_val; | 2784 | s32 ret_val; |
2840 | u16 page = BM_PHY_REG_PAGE(offset); | 2785 | u16 page = BM_PHY_REG_PAGE(offset); |
2841 | u16 reg = BM_PHY_REG_NUM(offset); | 2786 | u16 reg = BM_PHY_REG_NUM(offset); |
2842 | bool in_slow_mode = false; | ||
2843 | 2787 | ||
2844 | if (!locked) { | 2788 | if (!locked) { |
2845 | ret_val = hw->phy.ops.acquire(hw); | 2789 | ret_val = hw->phy.ops.acquire(hw); |
@@ -2847,16 +2791,6 @@ static s32 __e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data, | |||
2847 | return ret_val; | 2791 | return ret_val; |
2848 | } | 2792 | } |
2849 | 2793 | ||
2850 | /* Workaround failure in MDIO access while cable is disconnected */ | ||
2851 | if ((hw->phy.type == e1000_phy_82577) && | ||
2852 | !(er32(STATUS) & E1000_STATUS_LU)) { | ||
2853 | ret_val = e1000_set_mdio_slow_mode_hv(hw, true); | ||
2854 | if (ret_val) | ||
2855 | goto out; | ||
2856 | |||
2857 | in_slow_mode = true; | ||
2858 | } | ||
2859 | |||
2860 | /* Page 800 works differently than the rest so it has its own func */ | 2794 | /* Page 800 works differently than the rest so it has its own func */ |
2861 | if (page == BM_WUC_PAGE) { | 2795 | if (page == BM_WUC_PAGE) { |
2862 | ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, | 2796 | ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, |
@@ -2893,10 +2827,6 @@ static s32 __e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data, | |||
2893 | ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, | 2827 | ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, |
2894 | data); | 2828 | data); |
2895 | out: | 2829 | out: |
2896 | /* Revert to MDIO fast mode, if applicable */ | ||
2897 | if ((hw->phy.type == e1000_phy_82577) && in_slow_mode) | ||
2898 | ret_val |= e1000_set_mdio_slow_mode_hv(hw, false); | ||
2899 | |||
2900 | if (!locked) | 2830 | if (!locked) |
2901 | hw->phy.ops.release(hw); | 2831 | hw->phy.ops.release(hw); |
2902 | 2832 | ||
@@ -2948,7 +2878,6 @@ static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data, | |||
2948 | s32 ret_val; | 2878 | s32 ret_val; |
2949 | u16 page = BM_PHY_REG_PAGE(offset); | 2879 | u16 page = BM_PHY_REG_PAGE(offset); |
2950 | u16 reg = BM_PHY_REG_NUM(offset); | 2880 | u16 reg = BM_PHY_REG_NUM(offset); |
2951 | bool in_slow_mode = false; | ||
2952 | 2881 | ||
2953 | if (!locked) { | 2882 | if (!locked) { |
2954 | ret_val = hw->phy.ops.acquire(hw); | 2883 | ret_val = hw->phy.ops.acquire(hw); |
@@ -2956,16 +2885,6 @@ static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data, | |||
2956 | return ret_val; | 2885 | return ret_val; |
2957 | } | 2886 | } |
2958 | 2887 | ||
2959 | /* Workaround failure in MDIO access while cable is disconnected */ | ||
2960 | if ((hw->phy.type == e1000_phy_82577) && | ||
2961 | !(er32(STATUS) & E1000_STATUS_LU)) { | ||
2962 | ret_val = e1000_set_mdio_slow_mode_hv(hw, true); | ||
2963 | if (ret_val) | ||
2964 | goto out; | ||
2965 | |||
2966 | in_slow_mode = true; | ||
2967 | } | ||
2968 | |||
2969 | /* Page 800 works differently than the rest so it has its own func */ | 2888 | /* Page 800 works differently than the rest so it has its own func */ |
2970 | if (page == BM_WUC_PAGE) { | 2889 | if (page == BM_WUC_PAGE) { |
2971 | ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, | 2890 | ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, |
@@ -3019,10 +2938,6 @@ static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data, | |||
3019 | data); | 2938 | data); |
3020 | 2939 | ||
3021 | out: | 2940 | out: |
3022 | /* Revert to MDIO fast mode, if applicable */ | ||
3023 | if ((hw->phy.type == e1000_phy_82577) && in_slow_mode) | ||
3024 | ret_val |= e1000_set_mdio_slow_mode_hv(hw, false); | ||
3025 | |||
3026 | if (!locked) | 2941 | if (!locked) |
3027 | hw->phy.ops.release(hw); | 2942 | hw->phy.ops.release(hw); |
3028 | 2943 | ||
diff --git a/drivers/net/fsl_pq_mdio.c b/drivers/net/fsl_pq_mdio.c index 25fabb3eedc5..d5160edf2fcf 100644 --- a/drivers/net/fsl_pq_mdio.c +++ b/drivers/net/fsl_pq_mdio.c | |||
@@ -46,6 +46,11 @@ | |||
46 | #include "gianfar.h" | 46 | #include "gianfar.h" |
47 | #include "fsl_pq_mdio.h" | 47 | #include "fsl_pq_mdio.h" |
48 | 48 | ||
49 | struct fsl_pq_mdio_priv { | ||
50 | void __iomem *map; | ||
51 | struct fsl_pq_mdio __iomem *regs; | ||
52 | }; | ||
53 | |||
49 | /* | 54 | /* |
50 | * Write value to the PHY at mii_id at register regnum, | 55 | * Write value to the PHY at mii_id at register regnum, |
51 | * on the bus attached to the local interface, which may be different from the | 56 | * on the bus attached to the local interface, which may be different from the |
@@ -105,7 +110,9 @@ int fsl_pq_local_mdio_read(struct fsl_pq_mdio __iomem *regs, | |||
105 | 110 | ||
106 | static struct fsl_pq_mdio __iomem *fsl_pq_mdio_get_regs(struct mii_bus *bus) | 111 | static struct fsl_pq_mdio __iomem *fsl_pq_mdio_get_regs(struct mii_bus *bus) |
107 | { | 112 | { |
108 | return (void __iomem __force *)bus->priv; | 113 | struct fsl_pq_mdio_priv *priv = bus->priv; |
114 | |||
115 | return priv->regs; | ||
109 | } | 116 | } |
110 | 117 | ||
111 | /* | 118 | /* |
@@ -266,6 +273,7 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev, | |||
266 | { | 273 | { |
267 | struct device_node *np = ofdev->node; | 274 | struct device_node *np = ofdev->node; |
268 | struct device_node *tbi; | 275 | struct device_node *tbi; |
276 | struct fsl_pq_mdio_priv *priv; | ||
269 | struct fsl_pq_mdio __iomem *regs = NULL; | 277 | struct fsl_pq_mdio __iomem *regs = NULL; |
270 | void __iomem *map; | 278 | void __iomem *map; |
271 | u32 __iomem *tbipa; | 279 | u32 __iomem *tbipa; |
@@ -274,14 +282,19 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev, | |||
274 | u64 addr = 0, size = 0; | 282 | u64 addr = 0, size = 0; |
275 | int err = 0; | 283 | int err = 0; |
276 | 284 | ||
285 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | ||
286 | if (!priv) | ||
287 | return -ENOMEM; | ||
288 | |||
277 | new_bus = mdiobus_alloc(); | 289 | new_bus = mdiobus_alloc(); |
278 | if (NULL == new_bus) | 290 | if (NULL == new_bus) |
279 | return -ENOMEM; | 291 | goto err_free_priv; |
280 | 292 | ||
281 | new_bus->name = "Freescale PowerQUICC MII Bus", | 293 | new_bus->name = "Freescale PowerQUICC MII Bus", |
282 | new_bus->read = &fsl_pq_mdio_read, | 294 | new_bus->read = &fsl_pq_mdio_read, |
283 | new_bus->write = &fsl_pq_mdio_write, | 295 | new_bus->write = &fsl_pq_mdio_write, |
284 | new_bus->reset = &fsl_pq_mdio_reset, | 296 | new_bus->reset = &fsl_pq_mdio_reset, |
297 | new_bus->priv = priv; | ||
285 | fsl_pq_mdio_bus_name(new_bus->id, np); | 298 | fsl_pq_mdio_bus_name(new_bus->id, np); |
286 | 299 | ||
287 | /* Set the PHY base address */ | 300 | /* Set the PHY base address */ |
@@ -291,6 +304,7 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev, | |||
291 | err = -ENOMEM; | 304 | err = -ENOMEM; |
292 | goto err_free_bus; | 305 | goto err_free_bus; |
293 | } | 306 | } |
307 | priv->map = map; | ||
294 | 308 | ||
295 | if (of_device_is_compatible(np, "fsl,gianfar-mdio") || | 309 | if (of_device_is_compatible(np, "fsl,gianfar-mdio") || |
296 | of_device_is_compatible(np, "fsl,gianfar-tbi") || | 310 | of_device_is_compatible(np, "fsl,gianfar-tbi") || |
@@ -298,8 +312,7 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev, | |||
298 | of_device_is_compatible(np, "ucc_geth_phy")) | 312 | of_device_is_compatible(np, "ucc_geth_phy")) |
299 | map -= offsetof(struct fsl_pq_mdio, miimcfg); | 313 | map -= offsetof(struct fsl_pq_mdio, miimcfg); |
300 | regs = map; | 314 | regs = map; |
301 | 315 | priv->regs = regs; | |
302 | new_bus->priv = (void __force *)regs; | ||
303 | 316 | ||
304 | new_bus->irq = kcalloc(PHY_MAX_ADDR, sizeof(int), GFP_KERNEL); | 317 | new_bus->irq = kcalloc(PHY_MAX_ADDR, sizeof(int), GFP_KERNEL); |
305 | 318 | ||
@@ -392,10 +405,11 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev, | |||
392 | err_free_irqs: | 405 | err_free_irqs: |
393 | kfree(new_bus->irq); | 406 | kfree(new_bus->irq); |
394 | err_unmap_regs: | 407 | err_unmap_regs: |
395 | iounmap(regs); | 408 | iounmap(priv->map); |
396 | err_free_bus: | 409 | err_free_bus: |
397 | kfree(new_bus); | 410 | kfree(new_bus); |
398 | 411 | err_free_priv: | |
412 | kfree(priv); | ||
399 | return err; | 413 | return err; |
400 | } | 414 | } |
401 | 415 | ||
@@ -404,14 +418,16 @@ static int fsl_pq_mdio_remove(struct of_device *ofdev) | |||
404 | { | 418 | { |
405 | struct device *device = &ofdev->dev; | 419 | struct device *device = &ofdev->dev; |
406 | struct mii_bus *bus = dev_get_drvdata(device); | 420 | struct mii_bus *bus = dev_get_drvdata(device); |
421 | struct fsl_pq_mdio_priv *priv = bus->priv; | ||
407 | 422 | ||
408 | mdiobus_unregister(bus); | 423 | mdiobus_unregister(bus); |
409 | 424 | ||
410 | dev_set_drvdata(device, NULL); | 425 | dev_set_drvdata(device, NULL); |
411 | 426 | ||
412 | iounmap(fsl_pq_mdio_get_regs(bus)); | 427 | iounmap(priv->map); |
413 | bus->priv = NULL; | 428 | bus->priv = NULL; |
414 | mdiobus_free(bus); | 429 | mdiobus_free(bus); |
430 | kfree(priv); | ||
415 | 431 | ||
416 | return 0; | 432 | return 0; |
417 | } | 433 | } |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index e0620d084644..8bd3c9f17532 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -143,7 +143,6 @@ void gfar_start(struct net_device *dev); | |||
143 | static void gfar_clear_exact_match(struct net_device *dev); | 143 | static void gfar_clear_exact_match(struct net_device *dev); |
144 | static void gfar_set_mac_for_addr(struct net_device *dev, int num, u8 *addr); | 144 | static void gfar_set_mac_for_addr(struct net_device *dev, int num, u8 *addr); |
145 | static int gfar_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); | 145 | static int gfar_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); |
146 | u16 gfar_select_queue(struct net_device *dev, struct sk_buff *skb); | ||
147 | 146 | ||
148 | MODULE_AUTHOR("Freescale Semiconductor, Inc"); | 147 | MODULE_AUTHOR("Freescale Semiconductor, Inc"); |
149 | MODULE_DESCRIPTION("Gianfar Ethernet Driver"); | 148 | MODULE_DESCRIPTION("Gianfar Ethernet Driver"); |
@@ -455,7 +454,6 @@ static const struct net_device_ops gfar_netdev_ops = { | |||
455 | .ndo_set_multicast_list = gfar_set_multi, | 454 | .ndo_set_multicast_list = gfar_set_multi, |
456 | .ndo_tx_timeout = gfar_timeout, | 455 | .ndo_tx_timeout = gfar_timeout, |
457 | .ndo_do_ioctl = gfar_ioctl, | 456 | .ndo_do_ioctl = gfar_ioctl, |
458 | .ndo_select_queue = gfar_select_queue, | ||
459 | .ndo_get_stats = gfar_get_stats, | 457 | .ndo_get_stats = gfar_get_stats, |
460 | .ndo_vlan_rx_register = gfar_vlan_rx_register, | 458 | .ndo_vlan_rx_register = gfar_vlan_rx_register, |
461 | .ndo_set_mac_address = eth_mac_addr, | 459 | .ndo_set_mac_address = eth_mac_addr, |
@@ -506,10 +504,6 @@ static inline int gfar_uses_fcb(struct gfar_private *priv) | |||
506 | return priv->vlgrp || priv->rx_csum_enable; | 504 | return priv->vlgrp || priv->rx_csum_enable; |
507 | } | 505 | } |
508 | 506 | ||
509 | u16 gfar_select_queue(struct net_device *dev, struct sk_buff *skb) | ||
510 | { | ||
511 | return skb_get_queue_mapping(skb); | ||
512 | } | ||
513 | static void free_tx_pointers(struct gfar_private *priv) | 507 | static void free_tx_pointers(struct gfar_private *priv) |
514 | { | 508 | { |
515 | int i = 0; | 509 | int i = 0; |
@@ -2470,10 +2464,11 @@ static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb, | |||
2470 | fcb = (struct rxfcb *)skb->data; | 2464 | fcb = (struct rxfcb *)skb->data; |
2471 | 2465 | ||
2472 | /* Remove the FCB from the skb */ | 2466 | /* Remove the FCB from the skb */ |
2473 | skb_set_queue_mapping(skb, fcb->rq); | ||
2474 | /* Remove the padded bytes, if there are any */ | 2467 | /* Remove the padded bytes, if there are any */ |
2475 | if (amount_pull) | 2468 | if (amount_pull) { |
2469 | skb_record_rx_queue(skb, fcb->rq); | ||
2476 | skb_pull(skb, amount_pull); | 2470 | skb_pull(skb, amount_pull); |
2471 | } | ||
2477 | 2472 | ||
2478 | if (priv->rx_csum_enable) | 2473 | if (priv->rx_csum_enable) |
2479 | gfar_rx_checksum(skb, fcb); | 2474 | gfar_rx_checksum(skb, fcb); |
@@ -2554,7 +2549,7 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit) | |||
2554 | /* Remove the FCS from the packet length */ | 2549 | /* Remove the FCS from the packet length */ |
2555 | skb_put(skb, pkt_len); | 2550 | skb_put(skb, pkt_len); |
2556 | rx_queue->stats.rx_bytes += pkt_len; | 2551 | rx_queue->stats.rx_bytes += pkt_len; |
2557 | 2552 | skb_record_rx_queue(skb, rx_queue->qindex); | |
2558 | gfar_process_frame(dev, skb, amount_pull); | 2553 | gfar_process_frame(dev, skb, amount_pull); |
2559 | 2554 | ||
2560 | } else { | 2555 | } else { |
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c index ae5f11c8fc13..bdadf3e23c94 100644 --- a/drivers/net/hamradio/bpqether.c +++ b/drivers/net/hamradio/bpqether.c | |||
@@ -248,6 +248,7 @@ static netdev_tx_t bpq_xmit(struct sk_buff *skb, struct net_device *dev) | |||
248 | { | 248 | { |
249 | unsigned char *ptr; | 249 | unsigned char *ptr; |
250 | struct bpqdev *bpq; | 250 | struct bpqdev *bpq; |
251 | struct net_device *orig_dev; | ||
251 | int size; | 252 | int size; |
252 | 253 | ||
253 | /* | 254 | /* |
@@ -282,8 +283,9 @@ static netdev_tx_t bpq_xmit(struct sk_buff *skb, struct net_device *dev) | |||
282 | 283 | ||
283 | bpq = netdev_priv(dev); | 284 | bpq = netdev_priv(dev); |
284 | 285 | ||
286 | orig_dev = dev; | ||
285 | if ((dev = bpq_get_ether_dev(dev)) == NULL) { | 287 | if ((dev = bpq_get_ether_dev(dev)) == NULL) { |
286 | dev->stats.tx_dropped++; | 288 | orig_dev->stats.tx_dropped++; |
287 | kfree_skb(skb); | 289 | kfree_skb(skb); |
288 | return NETDEV_TX_OK; | 290 | return NETDEV_TX_OK; |
289 | } | 291 | } |
diff --git a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c index 090a6d3af112..052c74091d91 100644 --- a/drivers/net/ibmlana.c +++ b/drivers/net/ibmlana.c | |||
@@ -87,6 +87,7 @@ History: | |||
87 | #include <linux/module.h> | 87 | #include <linux/module.h> |
88 | #include <linux/netdevice.h> | 88 | #include <linux/netdevice.h> |
89 | #include <linux/etherdevice.h> | 89 | #include <linux/etherdevice.h> |
90 | #include <linux/if_ether.h> | ||
90 | #include <linux/skbuff.h> | 91 | #include <linux/skbuff.h> |
91 | #include <linux/bitops.h> | 92 | #include <linux/bitops.h> |
92 | 93 | ||
@@ -988,7 +989,7 @@ static int __devinit ibmlana_init_one(struct device *kdev) | |||
988 | 989 | ||
989 | /* copy out MAC address */ | 990 | /* copy out MAC address */ |
990 | 991 | ||
991 | for (z = 0; z < sizeof(dev->dev_addr); z++) | 992 | for (z = 0; z < ETH_ALEN; z++) |
992 | dev->dev_addr[z] = inb(dev->base_addr + MACADDRPROM + z); | 993 | dev->dev_addr[z] = inb(dev->base_addr + MACADDRPROM + z); |
993 | 994 | ||
994 | /* print config */ | 995 | /* print config */ |
diff --git a/drivers/net/igb/e1000_82575.c b/drivers/net/igb/e1000_82575.c index e8e9e9194a88..c505b50d1fa3 100644 --- a/drivers/net/igb/e1000_82575.c +++ b/drivers/net/igb/e1000_82575.c | |||
@@ -1096,9 +1096,7 @@ static s32 igb_setup_serdes_link_82575(struct e1000_hw *hw) | |||
1096 | hw_dbg("Configuring Autoneg:PCS_LCTL=0x%08X\n", reg); | 1096 | hw_dbg("Configuring Autoneg:PCS_LCTL=0x%08X\n", reg); |
1097 | } else { | 1097 | } else { |
1098 | /* Set PCS register for forced link */ | 1098 | /* Set PCS register for forced link */ |
1099 | reg |= E1000_PCS_LCTL_FSD | /* Force Speed */ | 1099 | reg |= E1000_PCS_LCTL_FSD; /* Force Speed */ |
1100 | E1000_PCS_LCTL_FORCE_LINK | /* Force Link */ | ||
1101 | E1000_PCS_LCTL_FLV_LINK_UP; /* Force link value up */ | ||
1102 | 1100 | ||
1103 | hw_dbg("Configuring Forced Link:PCS_LCTL=0x%08X\n", reg); | 1101 | hw_dbg("Configuring Forced Link:PCS_LCTL=0x%08X\n", reg); |
1104 | } | 1102 | } |
diff --git a/drivers/net/igb/e1000_phy.c b/drivers/net/igb/e1000_phy.c index 5c9d73e9bb8d..3670a66401b8 100644 --- a/drivers/net/igb/e1000_phy.c +++ b/drivers/net/igb/e1000_phy.c | |||
@@ -457,15 +457,6 @@ s32 igb_copper_link_setup_82580(struct e1000_hw *hw) | |||
457 | phy_data |= I82580_CFG_ENABLE_DOWNSHIFT; | 457 | phy_data |= I82580_CFG_ENABLE_DOWNSHIFT; |
458 | 458 | ||
459 | ret_val = phy->ops.write_reg(hw, I82580_CFG_REG, phy_data); | 459 | ret_val = phy->ops.write_reg(hw, I82580_CFG_REG, phy_data); |
460 | if (ret_val) | ||
461 | goto out; | ||
462 | |||
463 | /* Set number of link attempts before downshift */ | ||
464 | ret_val = phy->ops.read_reg(hw, I82580_CTRL_REG, &phy_data); | ||
465 | if (ret_val) | ||
466 | goto out; | ||
467 | phy_data &= ~I82580_CTRL_DOWNSHIFT_MASK; | ||
468 | ret_val = phy->ops.write_reg(hw, I82580_CTRL_REG, phy_data); | ||
469 | 460 | ||
470 | out: | 461 | out: |
471 | return ret_val; | 462 | return ret_val; |
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c index ac9d5272650d..f771a6c08777 100644 --- a/drivers/net/igb/igb_ethtool.c +++ b/drivers/net/igb/igb_ethtool.c | |||
@@ -1795,7 +1795,7 @@ static int igb_wol_exclusion(struct igb_adapter *adapter, | |||
1795 | /* dual port cards only support WoL on port A from now on | 1795 | /* dual port cards only support WoL on port A from now on |
1796 | * unless it was enabled in the eeprom for port B | 1796 | * unless it was enabled in the eeprom for port B |
1797 | * so exclude FUNC_1 ports from having WoL enabled */ | 1797 | * so exclude FUNC_1 ports from having WoL enabled */ |
1798 | if (rd32(E1000_STATUS) & E1000_STATUS_FUNC_1 && | 1798 | if ((rd32(E1000_STATUS) & E1000_STATUS_FUNC_MASK) && |
1799 | !adapter->eeprom_wol) { | 1799 | !adapter->eeprom_wol) { |
1800 | wol->supported = 0; | 1800 | wol->supported = 0; |
1801 | break; | 1801 | break; |
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index 78963a0e128d..c881347cb26d 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -421,6 +421,8 @@ static void igb_assign_vector(struct igb_q_vector *q_vector, int msix_vector) | |||
421 | msixbm = E1000_EICR_RX_QUEUE0 << rx_queue; | 421 | msixbm = E1000_EICR_RX_QUEUE0 << rx_queue; |
422 | if (tx_queue > IGB_N0_QUEUE) | 422 | if (tx_queue > IGB_N0_QUEUE) |
423 | msixbm |= E1000_EICR_TX_QUEUE0 << tx_queue; | 423 | msixbm |= E1000_EICR_TX_QUEUE0 << tx_queue; |
424 | if (!adapter->msix_entries && msix_vector == 0) | ||
425 | msixbm |= E1000_EIMS_OTHER; | ||
424 | array_wr32(E1000_MSIXBM(0), msix_vector, msixbm); | 426 | array_wr32(E1000_MSIXBM(0), msix_vector, msixbm); |
425 | q_vector->eims_value = msixbm; | 427 | q_vector->eims_value = msixbm; |
426 | break; | 428 | break; |
@@ -877,7 +879,6 @@ static int igb_request_irq(struct igb_adapter *adapter) | |||
877 | { | 879 | { |
878 | struct net_device *netdev = adapter->netdev; | 880 | struct net_device *netdev = adapter->netdev; |
879 | struct pci_dev *pdev = adapter->pdev; | 881 | struct pci_dev *pdev = adapter->pdev; |
880 | struct e1000_hw *hw = &adapter->hw; | ||
881 | int err = 0; | 882 | int err = 0; |
882 | 883 | ||
883 | if (adapter->msix_entries) { | 884 | if (adapter->msix_entries) { |
@@ -909,20 +910,7 @@ static int igb_request_irq(struct igb_adapter *adapter) | |||
909 | igb_setup_all_tx_resources(adapter); | 910 | igb_setup_all_tx_resources(adapter); |
910 | igb_setup_all_rx_resources(adapter); | 911 | igb_setup_all_rx_resources(adapter); |
911 | } else { | 912 | } else { |
912 | switch (hw->mac.type) { | 913 | igb_assign_vector(adapter->q_vector[0], 0); |
913 | case e1000_82575: | ||
914 | wr32(E1000_MSIXBM(0), | ||
915 | (E1000_EICR_RX_QUEUE0 | | ||
916 | E1000_EICR_TX_QUEUE0 | | ||
917 | E1000_EIMS_OTHER)); | ||
918 | break; | ||
919 | case e1000_82580: | ||
920 | case e1000_82576: | ||
921 | wr32(E1000_IVAR0, E1000_IVAR_VALID); | ||
922 | break; | ||
923 | default: | ||
924 | break; | ||
925 | } | ||
926 | } | 914 | } |
927 | 915 | ||
928 | if (adapter->flags & IGB_FLAG_HAS_MSI) { | 916 | if (adapter->flags & IGB_FLAG_HAS_MSI) { |
@@ -1140,6 +1128,8 @@ int igb_up(struct igb_adapter *adapter) | |||
1140 | } | 1128 | } |
1141 | if (adapter->msix_entries) | 1129 | if (adapter->msix_entries) |
1142 | igb_configure_msix(adapter); | 1130 | igb_configure_msix(adapter); |
1131 | else | ||
1132 | igb_assign_vector(adapter->q_vector[0], 0); | ||
1143 | 1133 | ||
1144 | /* Clear any pending interrupts. */ | 1134 | /* Clear any pending interrupts. */ |
1145 | rd32(E1000_ICR); | 1135 | rd32(E1000_ICR); |
@@ -1306,13 +1296,8 @@ void igb_reset(struct igb_adapter *adapter) | |||
1306 | hwm = min(((pba << 10) * 9 / 10), | 1296 | hwm = min(((pba << 10) * 9 / 10), |
1307 | ((pba << 10) - 2 * adapter->max_frame_size)); | 1297 | ((pba << 10) - 2 * adapter->max_frame_size)); |
1308 | 1298 | ||
1309 | if (mac->type < e1000_82576) { | 1299 | fc->high_water = hwm & 0xFFF0; /* 16-byte granularity */ |
1310 | fc->high_water = hwm & 0xFFF8; /* 8-byte granularity */ | 1300 | fc->low_water = fc->high_water - 16; |
1311 | fc->low_water = fc->high_water - 8; | ||
1312 | } else { | ||
1313 | fc->high_water = hwm & 0xFFF0; /* 16-byte granularity */ | ||
1314 | fc->low_water = fc->high_water - 16; | ||
1315 | } | ||
1316 | fc->pause_time = 0xFFFF; | 1301 | fc->pause_time = 0xFFFF; |
1317 | fc->send_xon = 1; | 1302 | fc->send_xon = 1; |
1318 | fc->current_mode = fc->requested_mode; | 1303 | fc->current_mode = fc->requested_mode; |
@@ -3427,7 +3412,7 @@ static inline int igb_tso_adv(struct igb_ring *tx_ring, | |||
3427 | iph->daddr, 0, | 3412 | iph->daddr, 0, |
3428 | IPPROTO_TCP, | 3413 | IPPROTO_TCP, |
3429 | 0); | 3414 | 0); |
3430 | } else if (skb_shinfo(skb)->gso_type == SKB_GSO_TCPV6) { | 3415 | } else if (skb_is_gso_v6(skb)) { |
3431 | ipv6_hdr(skb)->payload_len = 0; | 3416 | ipv6_hdr(skb)->payload_len = 0; |
3432 | tcp_hdr(skb)->check = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, | 3417 | tcp_hdr(skb)->check = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, |
3433 | &ipv6_hdr(skb)->daddr, | 3418 | &ipv6_hdr(skb)->daddr, |
@@ -3589,6 +3574,7 @@ static inline int igb_tx_map_adv(struct igb_ring *tx_ring, struct sk_buff *skb, | |||
3589 | for (f = 0; f < skb_shinfo(skb)->nr_frags; f++) { | 3574 | for (f = 0; f < skb_shinfo(skb)->nr_frags; f++) { |
3590 | struct skb_frag_struct *frag; | 3575 | struct skb_frag_struct *frag; |
3591 | 3576 | ||
3577 | count++; | ||
3592 | i++; | 3578 | i++; |
3593 | if (i == tx_ring->count) | 3579 | if (i == tx_ring->count) |
3594 | i = 0; | 3580 | i = 0; |
@@ -3610,7 +3596,6 @@ static inline int igb_tx_map_adv(struct igb_ring *tx_ring, struct sk_buff *skb, | |||
3610 | if (pci_dma_mapping_error(pdev, buffer_info->dma)) | 3596 | if (pci_dma_mapping_error(pdev, buffer_info->dma)) |
3611 | goto dma_error; | 3597 | goto dma_error; |
3612 | 3598 | ||
3613 | count++; | ||
3614 | } | 3599 | } |
3615 | 3600 | ||
3616 | tx_ring->buffer_info[i].skb = skb; | 3601 | tx_ring->buffer_info[i].skb = skb; |
diff --git a/drivers/net/igbvf/netdev.c b/drivers/net/igbvf/netdev.c index e9dd95f136aa..2aa71a766c35 100644 --- a/drivers/net/igbvf/netdev.c +++ b/drivers/net/igbvf/netdev.c | |||
@@ -1963,7 +1963,7 @@ static int igbvf_tso(struct igbvf_adapter *adapter, | |||
1963 | iph->daddr, 0, | 1963 | iph->daddr, 0, |
1964 | IPPROTO_TCP, | 1964 | IPPROTO_TCP, |
1965 | 0); | 1965 | 0); |
1966 | } else if (skb_shinfo(skb)->gso_type == SKB_GSO_TCPV6) { | 1966 | } else if (skb_is_gso_v6(skb)) { |
1967 | ipv6_hdr(skb)->payload_len = 0; | 1967 | ipv6_hdr(skb)->payload_len = 0; |
1968 | tcp_hdr(skb)->check = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, | 1968 | tcp_hdr(skb)->check = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, |
1969 | &ipv6_hdr(skb)->daddr, | 1969 | &ipv6_hdr(skb)->daddr, |
@@ -2117,6 +2117,7 @@ static inline int igbvf_tx_map_adv(struct igbvf_adapter *adapter, | |||
2117 | /* set time_stamp *before* dma to help avoid a possible race */ | 2117 | /* set time_stamp *before* dma to help avoid a possible race */ |
2118 | buffer_info->time_stamp = jiffies; | 2118 | buffer_info->time_stamp = jiffies; |
2119 | buffer_info->next_to_watch = i; | 2119 | buffer_info->next_to_watch = i; |
2120 | buffer_info->mapped_as_page = false; | ||
2120 | buffer_info->dma = pci_map_single(pdev, skb->data, len, | 2121 | buffer_info->dma = pci_map_single(pdev, skb->data, len, |
2121 | PCI_DMA_TODEVICE); | 2122 | PCI_DMA_TODEVICE); |
2122 | if (pci_dma_mapping_error(pdev, buffer_info->dma)) | 2123 | if (pci_dma_mapping_error(pdev, buffer_info->dma)) |
@@ -2126,6 +2127,7 @@ static inline int igbvf_tx_map_adv(struct igbvf_adapter *adapter, | |||
2126 | for (f = 0; f < skb_shinfo(skb)->nr_frags; f++) { | 2127 | for (f = 0; f < skb_shinfo(skb)->nr_frags; f++) { |
2127 | struct skb_frag_struct *frag; | 2128 | struct skb_frag_struct *frag; |
2128 | 2129 | ||
2130 | count++; | ||
2129 | i++; | 2131 | i++; |
2130 | if (i == tx_ring->count) | 2132 | if (i == tx_ring->count) |
2131 | i = 0; | 2133 | i = 0; |
@@ -2146,7 +2148,6 @@ static inline int igbvf_tx_map_adv(struct igbvf_adapter *adapter, | |||
2146 | PCI_DMA_TODEVICE); | 2148 | PCI_DMA_TODEVICE); |
2147 | if (pci_dma_mapping_error(pdev, buffer_info->dma)) | 2149 | if (pci_dma_mapping_error(pdev, buffer_info->dma)) |
2148 | goto dma_error; | 2150 | goto dma_error; |
2149 | count++; | ||
2150 | } | 2151 | } |
2151 | 2152 | ||
2152 | tx_ring->buffer_info[i].skb = skb; | 2153 | tx_ring->buffer_info[i].skb = skb; |
@@ -2163,14 +2164,14 @@ dma_error: | |||
2163 | buffer_info->length = 0; | 2164 | buffer_info->length = 0; |
2164 | buffer_info->next_to_watch = 0; | 2165 | buffer_info->next_to_watch = 0; |
2165 | buffer_info->mapped_as_page = false; | 2166 | buffer_info->mapped_as_page = false; |
2166 | count--; | 2167 | if (count) |
2168 | count--; | ||
2167 | 2169 | ||
2168 | /* clear timestamp and dma mappings for remaining portion of packet */ | 2170 | /* clear timestamp and dma mappings for remaining portion of packet */ |
2169 | while (count >= 0) { | 2171 | while (count--) { |
2170 | count--; | 2172 | if (i==0) |
2171 | i--; | ||
2172 | if (i < 0) | ||
2173 | i += tx_ring->count; | 2173 | i += tx_ring->count; |
2174 | i--; | ||
2174 | buffer_info = &tx_ring->buffer_info[i]; | 2175 | buffer_info = &tx_ring->buffer_info[i]; |
2175 | igbvf_put_txbuf(adapter, buffer_info); | 2176 | igbvf_put_txbuf(adapter, buffer_info); |
2176 | } | 2177 | } |
@@ -2763,7 +2764,8 @@ static int __devinit igbvf_probe(struct pci_dev *pdev, | |||
2763 | err = hw->mac.ops.reset_hw(hw); | 2764 | err = hw->mac.ops.reset_hw(hw); |
2764 | if (err) { | 2765 | if (err) { |
2765 | dev_info(&pdev->dev, | 2766 | dev_info(&pdev->dev, |
2766 | "PF still in reset state, assigning new address\n"); | 2767 | "PF still in reset state, assigning new address." |
2768 | " Is the PF interface up?\n"); | ||
2767 | random_ether_addr(hw->mac.addr); | 2769 | random_ether_addr(hw->mac.addr); |
2768 | } else { | 2770 | } else { |
2769 | err = hw->mac.ops.read_mac_addr(hw); | 2771 | err = hw->mac.ops.read_mac_addr(hw); |
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index bcd0f01d5feb..593d1a4f217c 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c | |||
@@ -1363,13 +1363,13 @@ ixgb_tx_map(struct ixgb_adapter *adapter, struct sk_buff *skb, | |||
1363 | dma_error: | 1363 | dma_error: |
1364 | dev_err(&pdev->dev, "TX DMA map failed\n"); | 1364 | dev_err(&pdev->dev, "TX DMA map failed\n"); |
1365 | buffer_info->dma = 0; | 1365 | buffer_info->dma = 0; |
1366 | count--; | 1366 | if (count) |
1367 | |||
1368 | while (count >= 0) { | ||
1369 | count--; | 1367 | count--; |
1370 | i--; | 1368 | |
1371 | if (i < 0) | 1369 | while (count--) { |
1370 | if (i==0) | ||
1372 | i += tx_ring->count; | 1371 | i += tx_ring->count; |
1372 | i--; | ||
1373 | buffer_info = &tx_ring->buffer_info[i]; | 1373 | buffer_info = &tx_ring->buffer_info[i]; |
1374 | ixgb_unmap_and_free_tx_resource(adapter, buffer_info); | 1374 | ixgb_unmap_and_free_tx_resource(adapter, buffer_info); |
1375 | } | 1375 | } |
diff --git a/drivers/net/ixgbe/Makefile b/drivers/net/ixgbe/Makefile index 21b41f42b61c..bfef0ebcba9a 100644 --- a/drivers/net/ixgbe/Makefile +++ b/drivers/net/ixgbe/Makefile | |||
@@ -1,7 +1,7 @@ | |||
1 | ################################################################################ | 1 | ################################################################################ |
2 | # | 2 | # |
3 | # Intel 10 Gigabit PCI Express Linux driver | 3 | # Intel 10 Gigabit PCI Express Linux driver |
4 | # Copyright(c) 1999 - 2009 Intel Corporation. | 4 | # Copyright(c) 1999 - 2010 Intel Corporation. |
5 | # | 5 | # |
6 | # This program is free software; you can redistribute it and/or modify it | 6 | # This program is free software; you can redistribute it and/or modify it |
7 | # under the terms and conditions of the GNU General Public License, | 7 | # under the terms and conditions of the GNU General Public License, |
diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h index 8da8eb535084..303e7bd39b67 100644 --- a/drivers/net/ixgbe/ixgbe.h +++ b/drivers/net/ixgbe/ixgbe.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 10 Gigabit PCI Express Linux driver | 3 | Intel 10 Gigabit PCI Express Linux driver |
4 | Copyright(c) 1999 - 2009 Intel Corporation. | 4 | Copyright(c) 1999 - 2010 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c index 204177d78cec..35a06b47587b 100644 --- a/drivers/net/ixgbe/ixgbe_82598.c +++ b/drivers/net/ixgbe/ixgbe_82598.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 10 Gigabit PCI Express Linux driver | 3 | Intel 10 Gigabit PCI Express Linux driver |
4 | Copyright(c) 1999 - 2009 Intel Corporation. | 4 | Copyright(c) 1999 - 2010 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
@@ -357,12 +357,34 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num) | |||
357 | u32 fctrl_reg; | 357 | u32 fctrl_reg; |
358 | u32 rmcs_reg; | 358 | u32 rmcs_reg; |
359 | u32 reg; | 359 | u32 reg; |
360 | u32 link_speed = 0; | ||
361 | bool link_up; | ||
360 | 362 | ||
361 | #ifdef CONFIG_DCB | 363 | #ifdef CONFIG_DCB |
362 | if (hw->fc.requested_mode == ixgbe_fc_pfc) | 364 | if (hw->fc.requested_mode == ixgbe_fc_pfc) |
363 | goto out; | 365 | goto out; |
364 | 366 | ||
365 | #endif /* CONFIG_DCB */ | 367 | #endif /* CONFIG_DCB */ |
368 | /* | ||
369 | * On 82598 having Rx FC on causes resets while doing 1G | ||
370 | * so if it's on turn it off once we know link_speed. For | ||
371 | * more details see 82598 Specification update. | ||
372 | */ | ||
373 | hw->mac.ops.check_link(hw, &link_speed, &link_up, false); | ||
374 | if (link_up && link_speed == IXGBE_LINK_SPEED_1GB_FULL) { | ||
375 | switch (hw->fc.requested_mode) { | ||
376 | case ixgbe_fc_full: | ||
377 | hw->fc.requested_mode = ixgbe_fc_tx_pause; | ||
378 | break; | ||
379 | case ixgbe_fc_rx_pause: | ||
380 | hw->fc.requested_mode = ixgbe_fc_none; | ||
381 | break; | ||
382 | default: | ||
383 | /* no change */ | ||
384 | break; | ||
385 | } | ||
386 | } | ||
387 | |||
366 | /* Negotiate the fc mode to use */ | 388 | /* Negotiate the fc mode to use */ |
367 | ret_val = ixgbe_fc_autoneg(hw); | 389 | ret_val = ixgbe_fc_autoneg(hw); |
368 | if (ret_val) | 390 | if (ret_val) |
diff --git a/drivers/net/ixgbe/ixgbe_82599.c b/drivers/net/ixgbe/ixgbe_82599.c index 538340527aa6..b49bd6b9feb7 100644 --- a/drivers/net/ixgbe/ixgbe_82599.c +++ b/drivers/net/ixgbe/ixgbe_82599.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 10 Gigabit PCI Express Linux driver | 3 | Intel 10 Gigabit PCI Express Linux driver |
4 | Copyright(c) 1999 - 2009 Intel Corporation. | 4 | Copyright(c) 1999 - 2010 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c index 688b8ca5da32..21f158f79dd0 100644 --- a/drivers/net/ixgbe/ixgbe_common.c +++ b/drivers/net/ixgbe/ixgbe_common.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 10 Gigabit PCI Express Linux driver | 3 | Intel 10 Gigabit PCI Express Linux driver |
4 | Copyright(c) 1999 - 2009 Intel Corporation. | 4 | Copyright(c) 1999 - 2010 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
diff --git a/drivers/net/ixgbe/ixgbe_common.h b/drivers/net/ixgbe/ixgbe_common.h index 27f3214bed2e..dfff0ffaa502 100644 --- a/drivers/net/ixgbe/ixgbe_common.h +++ b/drivers/net/ixgbe/ixgbe_common.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 10 Gigabit PCI Express Linux driver | 3 | Intel 10 Gigabit PCI Express Linux driver |
4 | Copyright(c) 1999 - 2009 Intel Corporation. | 4 | Copyright(c) 1999 - 2010 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
diff --git a/drivers/net/ixgbe/ixgbe_dcb.c b/drivers/net/ixgbe/ixgbe_dcb.c index a1562287342f..9aea4f04bbd2 100644 --- a/drivers/net/ixgbe/ixgbe_dcb.c +++ b/drivers/net/ixgbe/ixgbe_dcb.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 10 Gigabit PCI Express Linux driver | 3 | Intel 10 Gigabit PCI Express Linux driver |
4 | Copyright(c) 1999 - 2009 Intel Corporation. | 4 | Copyright(c) 1999 - 2010 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
diff --git a/drivers/net/ixgbe/ixgbe_dcb.h b/drivers/net/ixgbe/ixgbe_dcb.h index 64a9fa15c059..5caafd4afbc3 100644 --- a/drivers/net/ixgbe/ixgbe_dcb.h +++ b/drivers/net/ixgbe/ixgbe_dcb.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 10 Gigabit PCI Express Linux driver | 3 | Intel 10 Gigabit PCI Express Linux driver |
4 | Copyright(c) 1999 - 2009 Intel Corporation. | 4 | Copyright(c) 1999 - 2010 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
diff --git a/drivers/net/ixgbe/ixgbe_dcb_82598.c b/drivers/net/ixgbe/ixgbe_dcb_82598.c index f30263898ebc..f0e9279d4669 100644 --- a/drivers/net/ixgbe/ixgbe_dcb_82598.c +++ b/drivers/net/ixgbe/ixgbe_dcb_82598.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 10 Gigabit PCI Express Linux driver | 3 | Intel 10 Gigabit PCI Express Linux driver |
4 | Copyright(c) 1999 - 2009 Intel Corporation. | 4 | Copyright(c) 1999 - 2010 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
diff --git a/drivers/net/ixgbe/ixgbe_dcb_82598.h b/drivers/net/ixgbe/ixgbe_dcb_82598.h index ebbe53c352a7..cc728fa092e2 100644 --- a/drivers/net/ixgbe/ixgbe_dcb_82598.h +++ b/drivers/net/ixgbe/ixgbe_dcb_82598.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 10 Gigabit PCI Express Linux driver | 3 | Intel 10 Gigabit PCI Express Linux driver |
4 | Copyright(c) 1999 - 2009 Intel Corporation. | 4 | Copyright(c) 1999 - 2010 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
diff --git a/drivers/net/ixgbe/ixgbe_dcb_82599.c b/drivers/net/ixgbe/ixgbe_dcb_82599.c index ec8a252636d3..4f7a26ab411e 100644 --- a/drivers/net/ixgbe/ixgbe_dcb_82599.c +++ b/drivers/net/ixgbe/ixgbe_dcb_82599.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 10 Gigabit PCI Express Linux driver | 3 | Intel 10 Gigabit PCI Express Linux driver |
4 | Copyright(c) 1999 - 2009 Intel Corporation. | 4 | Copyright(c) 1999 - 2010 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
diff --git a/drivers/net/ixgbe/ixgbe_dcb_82599.h b/drivers/net/ixgbe/ixgbe_dcb_82599.h index 9e5e2827e4af..0f3f791e1e1d 100644 --- a/drivers/net/ixgbe/ixgbe_dcb_82599.h +++ b/drivers/net/ixgbe/ixgbe_dcb_82599.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 10 Gigabit PCI Express Linux driver | 3 | Intel 10 Gigabit PCI Express Linux driver |
4 | Copyright(c) 1999 - 2009 Intel Corporation. | 4 | Copyright(c) 1999 - 2010 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
diff --git a/drivers/net/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ixgbe/ixgbe_dcb_nl.c index 3c7a79a7d7c6..dd4883f642be 100644 --- a/drivers/net/ixgbe/ixgbe_dcb_nl.c +++ b/drivers/net/ixgbe/ixgbe_dcb_nl.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 10 Gigabit PCI Express Linux driver | 3 | Intel 10 Gigabit PCI Express Linux driver |
4 | Copyright(c) 1999 - 2009 Intel Corporation. | 4 | Copyright(c) 1999 - 2010 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
@@ -223,7 +223,7 @@ static void ixgbe_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int bwg_id, | |||
223 | 223 | ||
224 | if (adapter->temp_dcb_cfg.bw_percentage[0][bwg_id] != | 224 | if (adapter->temp_dcb_cfg.bw_percentage[0][bwg_id] != |
225 | adapter->dcb_cfg.bw_percentage[0][bwg_id]) { | 225 | adapter->dcb_cfg.bw_percentage[0][bwg_id]) { |
226 | adapter->dcb_set_bitmap |= BIT_PG_RX; | 226 | adapter->dcb_set_bitmap |= BIT_PG_TX; |
227 | adapter->dcb_set_bitmap |= BIT_RESETLINK; | 227 | adapter->dcb_set_bitmap |= BIT_RESETLINK; |
228 | } | 228 | } |
229 | } | 229 | } |
@@ -341,6 +341,12 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) | |||
341 | if (!adapter->dcb_set_bitmap) | 341 | if (!adapter->dcb_set_bitmap) |
342 | return DCB_NO_HW_CHG; | 342 | return DCB_NO_HW_CHG; |
343 | 343 | ||
344 | ret = ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg, &adapter->dcb_cfg, | ||
345 | adapter->ring_feature[RING_F_DCB].indices); | ||
346 | |||
347 | if (ret) | ||
348 | return DCB_NO_HW_CHG; | ||
349 | |||
344 | /* | 350 | /* |
345 | * Only take down the adapter if the configuration change | 351 | * Only take down the adapter if the configuration change |
346 | * requires a reset. | 352 | * requires a reset. |
@@ -359,14 +365,6 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) | |||
359 | } | 365 | } |
360 | } | 366 | } |
361 | 367 | ||
362 | ret = ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg, &adapter->dcb_cfg, | ||
363 | adapter->ring_feature[RING_F_DCB].indices); | ||
364 | if (ret) { | ||
365 | if (adapter->dcb_set_bitmap & BIT_RESETLINK) | ||
366 | clear_bit(__IXGBE_RESETTING, &adapter->state); | ||
367 | return DCB_NO_HW_CHG; | ||
368 | } | ||
369 | |||
370 | if (adapter->dcb_cfg.pfc_mode_enable) { | 368 | if (adapter->dcb_cfg.pfc_mode_enable) { |
371 | if ((adapter->hw.mac.type != ixgbe_mac_82598EB) && | 369 | if ((adapter->hw.mac.type != ixgbe_mac_82598EB) && |
372 | (adapter->hw.fc.current_mode != ixgbe_fc_pfc)) | 370 | (adapter->hw.fc.current_mode != ixgbe_fc_pfc)) |
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c index 0bd49d3b9f65..d77961fc75f9 100644 --- a/drivers/net/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ixgbe/ixgbe_ethtool.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 10 Gigabit PCI Express Linux driver | 3 | Intel 10 Gigabit PCI Express Linux driver |
4 | Copyright(c) 1999 - 2009 Intel Corporation. | 4 | Copyright(c) 1999 - 2010 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
diff --git a/drivers/net/ixgbe/ixgbe_fcoe.c b/drivers/net/ixgbe/ixgbe_fcoe.c index da32a108a7b4..e9a20c88c155 100644 --- a/drivers/net/ixgbe/ixgbe_fcoe.c +++ b/drivers/net/ixgbe/ixgbe_fcoe.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 10 Gigabit PCI Express Linux driver | 3 | Intel 10 Gigabit PCI Express Linux driver |
4 | Copyright(c) 1999 - 2009 Intel Corporation. | 4 | Copyright(c) 1999 - 2010 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
diff --git a/drivers/net/ixgbe/ixgbe_fcoe.h b/drivers/net/ixgbe/ixgbe_fcoe.h index de8ff53187da..abf4b2b3f252 100644 --- a/drivers/net/ixgbe/ixgbe_fcoe.h +++ b/drivers/net/ixgbe/ixgbe_fcoe.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 10 Gigabit PCI Express Linux driver | 3 | Intel 10 Gigabit PCI Express Linux driver |
4 | Copyright(c) 1999 - 2009 Intel Corporation. | 4 | Copyright(c) 1999 - 2010 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index bd64387563f0..951b73cf5ca2 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 10 Gigabit PCI Express Linux driver | 3 | Intel 10 Gigabit PCI Express Linux driver |
4 | Copyright(c) 1999 - 2009 Intel Corporation. | 4 | Copyright(c) 1999 - 2010 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
@@ -52,7 +52,7 @@ static const char ixgbe_driver_string[] = | |||
52 | 52 | ||
53 | #define DRV_VERSION "2.0.44-k2" | 53 | #define DRV_VERSION "2.0.44-k2" |
54 | const char ixgbe_driver_version[] = DRV_VERSION; | 54 | const char ixgbe_driver_version[] = DRV_VERSION; |
55 | static char ixgbe_copyright[] = "Copyright (c) 1999-2009 Intel Corporation."; | 55 | static char ixgbe_copyright[] = "Copyright (c) 1999-2010 Intel Corporation."; |
56 | 56 | ||
57 | static const struct ixgbe_info *ixgbe_info_tbl[] = { | 57 | static const struct ixgbe_info *ixgbe_info_tbl[] = { |
58 | [board_82598] = &ixgbe_82598_info, | 58 | [board_82598] = &ixgbe_82598_info, |
@@ -262,10 +262,12 @@ static inline bool ixgbe_tx_is_paused(struct ixgbe_adapter *adapter, | |||
262 | int reg_idx = tx_ring->reg_idx; | 262 | int reg_idx = tx_ring->reg_idx; |
263 | int dcb_i = adapter->ring_feature[RING_F_DCB].indices; | 263 | int dcb_i = adapter->ring_feature[RING_F_DCB].indices; |
264 | 264 | ||
265 | if (adapter->hw.mac.type == ixgbe_mac_82598EB) { | 265 | switch (adapter->hw.mac.type) { |
266 | case ixgbe_mac_82598EB: | ||
266 | tc = reg_idx >> 2; | 267 | tc = reg_idx >> 2; |
267 | txoff = IXGBE_TFCS_TXOFF0; | 268 | txoff = IXGBE_TFCS_TXOFF0; |
268 | } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) { | 269 | break; |
270 | case ixgbe_mac_82599EB: | ||
269 | tc = 0; | 271 | tc = 0; |
270 | txoff = IXGBE_TFCS_TXOFF; | 272 | txoff = IXGBE_TFCS_TXOFF; |
271 | if (dcb_i == 8) { | 273 | if (dcb_i == 8) { |
@@ -284,6 +286,9 @@ static inline bool ixgbe_tx_is_paused(struct ixgbe_adapter *adapter, | |||
284 | tc += (reg_idx - 96) >> 4; | 286 | tc += (reg_idx - 96) >> 4; |
285 | } | 287 | } |
286 | } | 288 | } |
289 | break; | ||
290 | default: | ||
291 | tc = 0; | ||
287 | } | 292 | } |
288 | txoff <<= tc; | 293 | txoff <<= tc; |
289 | } | 294 | } |
@@ -4373,6 +4378,11 @@ static int ixgbe_resume(struct pci_dev *pdev) | |||
4373 | 4378 | ||
4374 | pci_set_power_state(pdev, PCI_D0); | 4379 | pci_set_power_state(pdev, PCI_D0); |
4375 | pci_restore_state(pdev); | 4380 | pci_restore_state(pdev); |
4381 | /* | ||
4382 | * pci_restore_state clears dev->state_saved so call | ||
4383 | * pci_save_state to restore it. | ||
4384 | */ | ||
4385 | pci_save_state(pdev); | ||
4376 | 4386 | ||
4377 | err = pci_enable_device_mem(pdev); | 4387 | err = pci_enable_device_mem(pdev); |
4378 | if (err) { | 4388 | if (err) { |
@@ -4918,7 +4928,7 @@ static int ixgbe_tso(struct ixgbe_adapter *adapter, | |||
4918 | iph->daddr, 0, | 4928 | iph->daddr, 0, |
4919 | IPPROTO_TCP, | 4929 | IPPROTO_TCP, |
4920 | 0); | 4930 | 0); |
4921 | } else if (skb_shinfo(skb)->gso_type == SKB_GSO_TCPV6) { | 4931 | } else if (skb_is_gso_v6(skb)) { |
4922 | ipv6_hdr(skb)->payload_len = 0; | 4932 | ipv6_hdr(skb)->payload_len = 0; |
4923 | tcp_hdr(skb)->check = | 4933 | tcp_hdr(skb)->check = |
4924 | ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, | 4934 | ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, |
@@ -5157,19 +5167,19 @@ dma_error: | |||
5157 | tx_buffer_info->dma = 0; | 5167 | tx_buffer_info->dma = 0; |
5158 | tx_buffer_info->time_stamp = 0; | 5168 | tx_buffer_info->time_stamp = 0; |
5159 | tx_buffer_info->next_to_watch = 0; | 5169 | tx_buffer_info->next_to_watch = 0; |
5160 | count--; | 5170 | if (count) |
5171 | count--; | ||
5161 | 5172 | ||
5162 | /* clear timestamp and dma mappings for remaining portion of packet */ | 5173 | /* clear timestamp and dma mappings for remaining portion of packet */ |
5163 | while (count >= 0) { | 5174 | while (count--) { |
5164 | count--; | 5175 | if (i==0) |
5165 | i--; | ||
5166 | if (i < 0) | ||
5167 | i += tx_ring->count; | 5176 | i += tx_ring->count; |
5177 | i--; | ||
5168 | tx_buffer_info = &tx_ring->tx_buffer_info[i]; | 5178 | tx_buffer_info = &tx_ring->tx_buffer_info[i]; |
5169 | ixgbe_unmap_and_free_tx_resource(adapter, tx_buffer_info); | 5179 | ixgbe_unmap_and_free_tx_resource(adapter, tx_buffer_info); |
5170 | } | 5180 | } |
5171 | 5181 | ||
5172 | return count; | 5182 | return 0; |
5173 | } | 5183 | } |
5174 | 5184 | ||
5175 | static void ixgbe_tx_queue(struct ixgbe_adapter *adapter, | 5185 | static void ixgbe_tx_queue(struct ixgbe_adapter *adapter, |
@@ -5319,8 +5329,11 @@ static u16 ixgbe_select_queue(struct net_device *dev, struct sk_buff *skb) | |||
5319 | struct ixgbe_adapter *adapter = netdev_priv(dev); | 5329 | struct ixgbe_adapter *adapter = netdev_priv(dev); |
5320 | int txq = smp_processor_id(); | 5330 | int txq = smp_processor_id(); |
5321 | 5331 | ||
5322 | if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) | 5332 | if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) { |
5333 | while (unlikely(txq >= dev->real_num_tx_queues)) | ||
5334 | txq -= dev->real_num_tx_queues; | ||
5323 | return txq; | 5335 | return txq; |
5336 | } | ||
5324 | 5337 | ||
5325 | #ifdef IXGBE_FCOE | 5338 | #ifdef IXGBE_FCOE |
5326 | if ((adapter->flags & IXGBE_FLAG_FCOE_ENABLED) && | 5339 | if ((adapter->flags & IXGBE_FLAG_FCOE_ENABLED) && |
@@ -5566,6 +5579,10 @@ static void ixgbe_netpoll(struct net_device *netdev) | |||
5566 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 5579 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
5567 | int i; | 5580 | int i; |
5568 | 5581 | ||
5582 | /* if interface is down do nothing */ | ||
5583 | if (test_bit(__IXGBE_DOWN, &adapter->state)) | ||
5584 | return; | ||
5585 | |||
5569 | adapter->flags |= IXGBE_FLAG_IN_NETPOLL; | 5586 | adapter->flags |= IXGBE_FLAG_IN_NETPOLL; |
5570 | if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) { | 5587 | if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) { |
5571 | int num_q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS; | 5588 | int num_q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS; |
@@ -5746,6 +5763,10 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
5746 | if (err) | 5763 | if (err) |
5747 | goto err_sw_init; | 5764 | goto err_sw_init; |
5748 | 5765 | ||
5766 | /* Make it possible the adapter to be woken up via WOL */ | ||
5767 | if (adapter->hw.mac.type == ixgbe_mac_82599EB) | ||
5768 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_WUS, ~0); | ||
5769 | |||
5749 | /* | 5770 | /* |
5750 | * If there is a fan on this device and it has failed log the | 5771 | * If there is a fan on this device and it has failed log the |
5751 | * failure. | 5772 | * failure. |
diff --git a/drivers/net/ixgbe/ixgbe_phy.c b/drivers/net/ixgbe/ixgbe_phy.c index 9ecad17522c3..1c1efd386956 100644 --- a/drivers/net/ixgbe/ixgbe_phy.c +++ b/drivers/net/ixgbe/ixgbe_phy.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 10 Gigabit PCI Express Linux driver | 3 | Intel 10 Gigabit PCI Express Linux driver |
4 | Copyright(c) 1999 - 2009 Intel Corporation. | 4 | Copyright(c) 1999 - 2010 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
diff --git a/drivers/net/ixgbe/ixgbe_phy.h b/drivers/net/ixgbe/ixgbe_phy.h index 9b700f5bf1ed..9cf5f3b4cc5d 100644 --- a/drivers/net/ixgbe/ixgbe_phy.h +++ b/drivers/net/ixgbe/ixgbe_phy.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 10 Gigabit PCI Express Linux driver | 3 | Intel 10 Gigabit PCI Express Linux driver |
4 | Copyright(c) 1999 - 2009 Intel Corporation. | 4 | Copyright(c) 1999 - 2010 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h index 84650c6ebe03..9eafddfa1b97 100644 --- a/drivers/net/ixgbe/ixgbe_type.h +++ b/drivers/net/ixgbe/ixgbe_type.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 10 Gigabit PCI Express Linux driver | 3 | Intel 10 Gigabit PCI Express Linux driver |
4 | Copyright(c) 1999 - 2009 Intel Corporation. | 4 | Copyright(c) 1999 - 2010 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
diff --git a/drivers/net/ks8851_mll.c b/drivers/net/ks8851_mll.c index c146304d8d6c..c0ceebccaa49 100644 --- a/drivers/net/ks8851_mll.c +++ b/drivers/net/ks8851_mll.c | |||
@@ -854,8 +854,8 @@ static void ks_update_link_status(struct net_device *netdev, struct ks_net *ks) | |||
854 | 854 | ||
855 | static irqreturn_t ks_irq(int irq, void *pw) | 855 | static irqreturn_t ks_irq(int irq, void *pw) |
856 | { | 856 | { |
857 | struct ks_net *ks = pw; | 857 | struct net_device *netdev = pw; |
858 | struct net_device *netdev = ks->netdev; | 858 | struct ks_net *ks = netdev_priv(netdev); |
859 | u16 status; | 859 | u16 status; |
860 | 860 | ||
861 | /*this should be the first in IRQ handler */ | 861 | /*this should be the first in IRQ handler */ |
diff --git a/drivers/net/ll_temac_main.c b/drivers/net/ll_temac_main.c index 336e7c7a9275..a8522bd73ae7 100644 --- a/drivers/net/ll_temac_main.c +++ b/drivers/net/ll_temac_main.c | |||
@@ -134,7 +134,7 @@ static int temac_dma_bd_init(struct net_device *ndev) | |||
134 | struct sk_buff *skb; | 134 | struct sk_buff *skb; |
135 | int i; | 135 | int i; |
136 | 136 | ||
137 | lp->rx_skb = kzalloc(sizeof(struct sk_buff)*RX_BD_NUM, GFP_KERNEL); | 137 | lp->rx_skb = kzalloc(sizeof(*lp->rx_skb) * RX_BD_NUM, GFP_KERNEL); |
138 | /* allocate the tx and rx ring buffer descriptors. */ | 138 | /* allocate the tx and rx ring buffer descriptors. */ |
139 | /* returns a virtual addres and a physical address. */ | 139 | /* returns a virtual addres and a physical address. */ |
140 | lp->tx_bd_v = dma_alloc_coherent(ndev->dev.parent, | 140 | lp->tx_bd_v = dma_alloc_coherent(ndev->dev.parent, |
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c index 291a505fd4fc..3cf56d90d859 100644 --- a/drivers/net/mlx4/main.c +++ b/drivers/net/mlx4/main.c | |||
@@ -1174,7 +1174,7 @@ static int __mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1174 | return 0; | 1174 | return 0; |
1175 | 1175 | ||
1176 | err_port: | 1176 | err_port: |
1177 | for (port = 1; port <= dev->caps.num_ports; port++) | 1177 | for (--port; port >= 1; --port) |
1178 | mlx4_cleanup_port_info(&priv->port[port]); | 1178 | mlx4_cleanup_port_info(&priv->port[port]); |
1179 | 1179 | ||
1180 | mlx4_cleanup_mcg_table(dev); | 1180 | mlx4_cleanup_mcg_table(dev); |
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 1405a170bb43..af67af55efe7 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -656,6 +656,7 @@ static int rxq_refill(struct rx_queue *rxq, int budget) | |||
656 | struct sk_buff *skb; | 656 | struct sk_buff *skb; |
657 | int rx; | 657 | int rx; |
658 | struct rx_desc *rx_desc; | 658 | struct rx_desc *rx_desc; |
659 | int size; | ||
659 | 660 | ||
660 | skb = __skb_dequeue(&mp->rx_recycle); | 661 | skb = __skb_dequeue(&mp->rx_recycle); |
661 | if (skb == NULL) | 662 | if (skb == NULL) |
@@ -678,10 +679,11 @@ static int rxq_refill(struct rx_queue *rxq, int budget) | |||
678 | 679 | ||
679 | rx_desc = rxq->rx_desc_area + rx; | 680 | rx_desc = rxq->rx_desc_area + rx; |
680 | 681 | ||
682 | size = skb->end - skb->data; | ||
681 | rx_desc->buf_ptr = dma_map_single(mp->dev->dev.parent, | 683 | rx_desc->buf_ptr = dma_map_single(mp->dev->dev.parent, |
682 | skb->data, mp->skb_size, | 684 | skb->data, size, |
683 | DMA_FROM_DEVICE); | 685 | DMA_FROM_DEVICE); |
684 | rx_desc->buf_size = mp->skb_size; | 686 | rx_desc->buf_size = size; |
685 | rxq->rx_skb[rx] = skb; | 687 | rxq->rx_skb[rx] = skb; |
686 | wmb(); | 688 | wmb(); |
687 | rx_desc->cmd_sts = BUFFER_OWNED_BY_DMA | RX_ENABLE_INTERRUPT; | 689 | rx_desc->cmd_sts = BUFFER_OWNED_BY_DMA | RX_ENABLE_INTERRUPT; |
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 76cd1f3e9fc8..9bc5bd1d538a 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -53,8 +53,8 @@ | |||
53 | 53 | ||
54 | #define _NETXEN_NIC_LINUX_MAJOR 4 | 54 | #define _NETXEN_NIC_LINUX_MAJOR 4 |
55 | #define _NETXEN_NIC_LINUX_MINOR 0 | 55 | #define _NETXEN_NIC_LINUX_MINOR 0 |
56 | #define _NETXEN_NIC_LINUX_SUBVERSION 65 | 56 | #define _NETXEN_NIC_LINUX_SUBVERSION 72 |
57 | #define NETXEN_NIC_LINUX_VERSIONID "4.0.65" | 57 | #define NETXEN_NIC_LINUX_VERSIONID "4.0.72" |
58 | 58 | ||
59 | #define NETXEN_VERSION_CODE(a, b, c) (((a) << 24) + ((b) << 16) + (c)) | 59 | #define NETXEN_VERSION_CODE(a, b, c) (((a) << 24) + ((b) << 16) + (c)) |
60 | #define _major(v) (((v) >> 24) & 0xff) | 60 | #define _major(v) (((v) >> 24) & 0xff) |
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c index ddd704ae0188..542f408333ff 100644 --- a/drivers/net/netxen/netxen_nic_ethtool.c +++ b/drivers/net/netxen/netxen_nic_ethtool.c | |||
@@ -66,7 +66,7 @@ static const char netxen_nic_gstrings_test[][ETH_GSTRING_LEN] = { | |||
66 | 66 | ||
67 | #define NETXEN_NIC_TEST_LEN ARRAY_SIZE(netxen_nic_gstrings_test) | 67 | #define NETXEN_NIC_TEST_LEN ARRAY_SIZE(netxen_nic_gstrings_test) |
68 | 68 | ||
69 | #define NETXEN_NIC_REGS_COUNT 42 | 69 | #define NETXEN_NIC_REGS_COUNT 30 |
70 | #define NETXEN_NIC_REGS_LEN (NETXEN_NIC_REGS_COUNT * sizeof(__le32)) | 70 | #define NETXEN_NIC_REGS_LEN (NETXEN_NIC_REGS_COUNT * sizeof(__le32)) |
71 | #define NETXEN_MAX_EEPROM_LEN 1024 | 71 | #define NETXEN_MAX_EEPROM_LEN 1024 |
72 | 72 | ||
@@ -312,150 +312,91 @@ static int netxen_nic_get_regs_len(struct net_device *dev) | |||
312 | return NETXEN_NIC_REGS_LEN; | 312 | return NETXEN_NIC_REGS_LEN; |
313 | } | 313 | } |
314 | 314 | ||
315 | struct netxen_niu_regs { | ||
316 | __u32 reg[NETXEN_NIC_REGS_COUNT]; | ||
317 | }; | ||
318 | |||
319 | static struct netxen_niu_regs niu_registers[] = { | ||
320 | { | ||
321 | /* GB Mode */ | ||
322 | { | ||
323 | NETXEN_NIU_GB_SERDES_RESET, | ||
324 | NETXEN_NIU_GB0_MII_MODE, | ||
325 | NETXEN_NIU_GB1_MII_MODE, | ||
326 | NETXEN_NIU_GB2_MII_MODE, | ||
327 | NETXEN_NIU_GB3_MII_MODE, | ||
328 | NETXEN_NIU_GB0_GMII_MODE, | ||
329 | NETXEN_NIU_GB1_GMII_MODE, | ||
330 | NETXEN_NIU_GB2_GMII_MODE, | ||
331 | NETXEN_NIU_GB3_GMII_MODE, | ||
332 | NETXEN_NIU_REMOTE_LOOPBACK, | ||
333 | NETXEN_NIU_GB0_HALF_DUPLEX, | ||
334 | NETXEN_NIU_GB1_HALF_DUPLEX, | ||
335 | NETXEN_NIU_RESET_SYS_FIFOS, | ||
336 | NETXEN_NIU_GB_CRC_DROP, | ||
337 | NETXEN_NIU_GB_DROP_WRONGADDR, | ||
338 | NETXEN_NIU_TEST_MUX_CTL, | ||
339 | |||
340 | NETXEN_NIU_GB_MAC_CONFIG_0(0), | ||
341 | NETXEN_NIU_GB_MAC_CONFIG_1(0), | ||
342 | NETXEN_NIU_GB_HALF_DUPLEX_CTRL(0), | ||
343 | NETXEN_NIU_GB_MAX_FRAME_SIZE(0), | ||
344 | NETXEN_NIU_GB_TEST_REG(0), | ||
345 | NETXEN_NIU_GB_MII_MGMT_CONFIG(0), | ||
346 | NETXEN_NIU_GB_MII_MGMT_COMMAND(0), | ||
347 | NETXEN_NIU_GB_MII_MGMT_ADDR(0), | ||
348 | NETXEN_NIU_GB_MII_MGMT_CTRL(0), | ||
349 | NETXEN_NIU_GB_MII_MGMT_STATUS(0), | ||
350 | NETXEN_NIU_GB_MII_MGMT_INDICATE(0), | ||
351 | NETXEN_NIU_GB_INTERFACE_CTRL(0), | ||
352 | NETXEN_NIU_GB_INTERFACE_STATUS(0), | ||
353 | NETXEN_NIU_GB_STATION_ADDR_0(0), | ||
354 | NETXEN_NIU_GB_STATION_ADDR_1(0), | ||
355 | -1, | ||
356 | } | ||
357 | }, | ||
358 | { | ||
359 | /* XG Mode */ | ||
360 | { | ||
361 | NETXEN_NIU_XG_SINGLE_TERM, | ||
362 | NETXEN_NIU_XG_DRIVE_HI, | ||
363 | NETXEN_NIU_XG_DRIVE_LO, | ||
364 | NETXEN_NIU_XG_DTX, | ||
365 | NETXEN_NIU_XG_DEQ, | ||
366 | NETXEN_NIU_XG_WORD_ALIGN, | ||
367 | NETXEN_NIU_XG_RESET, | ||
368 | NETXEN_NIU_XG_POWER_DOWN, | ||
369 | NETXEN_NIU_XG_RESET_PLL, | ||
370 | NETXEN_NIU_XG_SERDES_LOOPBACK, | ||
371 | NETXEN_NIU_XG_DO_BYTE_ALIGN, | ||
372 | NETXEN_NIU_XG_TX_ENABLE, | ||
373 | NETXEN_NIU_XG_RX_ENABLE, | ||
374 | NETXEN_NIU_XG_STATUS, | ||
375 | NETXEN_NIU_XG_PAUSE_THRESHOLD, | ||
376 | NETXEN_NIU_XGE_CONFIG_0, | ||
377 | NETXEN_NIU_XGE_CONFIG_1, | ||
378 | NETXEN_NIU_XGE_IPG, | ||
379 | NETXEN_NIU_XGE_STATION_ADDR_0_HI, | ||
380 | NETXEN_NIU_XGE_STATION_ADDR_0_1, | ||
381 | NETXEN_NIU_XGE_STATION_ADDR_1_LO, | ||
382 | NETXEN_NIU_XGE_STATUS, | ||
383 | NETXEN_NIU_XGE_MAX_FRAME_SIZE, | ||
384 | NETXEN_NIU_XGE_PAUSE_FRAME_VALUE, | ||
385 | NETXEN_NIU_XGE_TX_BYTE_CNT, | ||
386 | NETXEN_NIU_XGE_TX_FRAME_CNT, | ||
387 | NETXEN_NIU_XGE_RX_BYTE_CNT, | ||
388 | NETXEN_NIU_XGE_RX_FRAME_CNT, | ||
389 | NETXEN_NIU_XGE_AGGR_ERROR_CNT, | ||
390 | NETXEN_NIU_XGE_MULTICAST_FRAME_CNT, | ||
391 | NETXEN_NIU_XGE_UNICAST_FRAME_CNT, | ||
392 | NETXEN_NIU_XGE_CRC_ERROR_CNT, | ||
393 | NETXEN_NIU_XGE_OVERSIZE_FRAME_ERR, | ||
394 | NETXEN_NIU_XGE_UNDERSIZE_FRAME_ERR, | ||
395 | NETXEN_NIU_XGE_LOCAL_ERROR_CNT, | ||
396 | NETXEN_NIU_XGE_REMOTE_ERROR_CNT, | ||
397 | NETXEN_NIU_XGE_CONTROL_CHAR_CNT, | ||
398 | NETXEN_NIU_XGE_PAUSE_FRAME_CNT, | ||
399 | -1, | ||
400 | } | ||
401 | } | ||
402 | }; | ||
403 | |||
404 | static void | 315 | static void |
405 | netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) | 316 | netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) |
406 | { | 317 | { |
407 | struct netxen_adapter *adapter = netdev_priv(dev); | 318 | struct netxen_adapter *adapter = netdev_priv(dev); |
408 | __u32 mode, *regs_buff = p; | 319 | struct netxen_recv_context *recv_ctx = &adapter->recv_ctx; |
409 | int i, window; | 320 | struct nx_host_sds_ring *sds_ring; |
321 | u32 *regs_buff = p; | ||
322 | int ring, i = 0; | ||
323 | int port = adapter->physical_port; | ||
410 | 324 | ||
411 | memset(p, 0, NETXEN_NIC_REGS_LEN); | 325 | memset(p, 0, NETXEN_NIC_REGS_LEN); |
326 | |||
412 | regs->version = (1 << 24) | (adapter->ahw.revision_id << 16) | | 327 | regs->version = (1 << 24) | (adapter->ahw.revision_id << 16) | |
413 | (adapter->pdev)->device; | 328 | (adapter->pdev)->device; |
414 | /* which mode */ | ||
415 | regs_buff[0] = NXRD32(adapter, NETXEN_NIU_MODE); | ||
416 | mode = regs_buff[0]; | ||
417 | |||
418 | /* Common registers to all the modes */ | ||
419 | regs_buff[2] = NXRD32(adapter, NETXEN_NIU_STRAP_VALUE_SAVE_HIGHER); | ||
420 | /* GB/XGB Mode */ | ||
421 | mode = (mode / 2) - 1; | ||
422 | window = 0; | ||
423 | if (mode <= 1) { | ||
424 | for (i = 3; niu_registers[mode].reg[i - 3] != -1; i++) { | ||
425 | /* GB: port specific registers */ | ||
426 | if (mode == 0 && i >= 19) | ||
427 | window = adapter->physical_port * | ||
428 | NETXEN_NIC_PORT_WINDOW; | ||
429 | |||
430 | regs_buff[i] = NXRD32(adapter, | ||
431 | niu_registers[mode].reg[i - 3] + window); | ||
432 | } | ||
433 | 329 | ||
330 | if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC) | ||
331 | return; | ||
332 | |||
333 | regs_buff[i++] = NXRD32(adapter, CRB_CMDPEG_STATE); | ||
334 | regs_buff[i++] = NXRD32(adapter, CRB_RCVPEG_STATE); | ||
335 | regs_buff[i++] = NXRD32(adapter, CRB_FW_CAPABILITIES_1); | ||
336 | regs_buff[i++] = NXRDIO(adapter, adapter->crb_int_state_reg); | ||
337 | regs_buff[i++] = NXRD32(adapter, NX_CRB_DEV_REF_COUNT); | ||
338 | regs_buff[i++] = NXRD32(adapter, NX_CRB_DEV_STATE); | ||
339 | regs_buff[i++] = NXRD32(adapter, NETXEN_PEG_ALIVE_COUNTER); | ||
340 | regs_buff[i++] = NXRD32(adapter, NETXEN_PEG_HALT_STATUS1); | ||
341 | regs_buff[i++] = NXRD32(adapter, NETXEN_PEG_HALT_STATUS2); | ||
342 | |||
343 | regs_buff[i++] = NXRD32(adapter, NETXEN_CRB_PEG_NET_0+0x3c); | ||
344 | regs_buff[i++] = NXRD32(adapter, NETXEN_CRB_PEG_NET_1+0x3c); | ||
345 | regs_buff[i++] = NXRD32(adapter, NETXEN_CRB_PEG_NET_2+0x3c); | ||
346 | regs_buff[i++] = NXRD32(adapter, NETXEN_CRB_PEG_NET_3+0x3c); | ||
347 | |||
348 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { | ||
349 | |||
350 | regs_buff[i++] = NXRD32(adapter, NETXEN_CRB_PEG_NET_4+0x3c); | ||
351 | i += 2; | ||
352 | |||
353 | regs_buff[i++] = NXRD32(adapter, CRB_XG_STATE_P3); | ||
354 | regs_buff[i++] = le32_to_cpu(*(adapter->tx_ring->hw_consumer)); | ||
355 | |||
356 | } else { | ||
357 | i++; | ||
358 | |||
359 | regs_buff[i++] = NXRD32(adapter, | ||
360 | NETXEN_NIU_XGE_CONFIG_0+(0x10000*port)); | ||
361 | regs_buff[i++] = NXRD32(adapter, | ||
362 | NETXEN_NIU_XGE_CONFIG_1+(0x10000*port)); | ||
363 | |||
364 | regs_buff[i++] = NXRD32(adapter, CRB_XG_STATE); | ||
365 | regs_buff[i++] = NXRDIO(adapter, | ||
366 | adapter->tx_ring->crb_cmd_consumer); | ||
367 | } | ||
368 | |||
369 | regs_buff[i++] = NXRDIO(adapter, adapter->tx_ring->crb_cmd_producer); | ||
370 | |||
371 | regs_buff[i++] = NXRDIO(adapter, | ||
372 | recv_ctx->rds_rings[0].crb_rcv_producer); | ||
373 | regs_buff[i++] = NXRDIO(adapter, | ||
374 | recv_ctx->rds_rings[1].crb_rcv_producer); | ||
375 | |||
376 | regs_buff[i++] = adapter->max_sds_rings; | ||
377 | |||
378 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | ||
379 | sds_ring = &(recv_ctx->sds_rings[ring]); | ||
380 | regs_buff[i++] = NXRDIO(adapter, | ||
381 | sds_ring->crb_sts_consumer); | ||
434 | } | 382 | } |
435 | } | 383 | } |
436 | 384 | ||
437 | static u32 netxen_nic_test_link(struct net_device *dev) | 385 | static u32 netxen_nic_test_link(struct net_device *dev) |
438 | { | 386 | { |
439 | struct netxen_adapter *adapter = netdev_priv(dev); | 387 | struct netxen_adapter *adapter = netdev_priv(dev); |
440 | __u32 status; | 388 | u32 val, port; |
441 | int val; | ||
442 | 389 | ||
443 | /* read which mode */ | 390 | port = adapter->physical_port; |
444 | if (adapter->ahw.port_type == NETXEN_NIC_GBE) { | 391 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { |
445 | if (adapter->phy_read && | 392 | val = NXRD32(adapter, CRB_XG_STATE_P3); |
446 | adapter->phy_read(adapter, | 393 | val = XG_LINK_STATE_P3(adapter->ahw.pci_func, val); |
447 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, | 394 | return (val == XG_LINK_UP_P3) ? 0 : 1; |
448 | &status) != 0) | 395 | } else { |
449 | return -EIO; | ||
450 | else { | ||
451 | val = netxen_get_phy_link(status); | ||
452 | return !val; | ||
453 | } | ||
454 | } else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) { | ||
455 | val = NXRD32(adapter, CRB_XG_STATE); | 396 | val = NXRD32(adapter, CRB_XG_STATE); |
397 | val = (val >> port*8) & 0xff; | ||
456 | return (val == XG_LINK_UP) ? 0 : 1; | 398 | return (val == XG_LINK_UP) ? 0 : 1; |
457 | } | 399 | } |
458 | return -EIO; | ||
459 | } | 400 | } |
460 | 401 | ||
461 | static int | 402 | static int |
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index 2e364fee3cbb..85e28e60ecf1 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -345,8 +345,7 @@ netxen_pcie_sem_lock(struct netxen_adapter *adapter, int sem, u32 id_reg) | |||
345 | void | 345 | void |
346 | netxen_pcie_sem_unlock(struct netxen_adapter *adapter, int sem) | 346 | netxen_pcie_sem_unlock(struct netxen_adapter *adapter, int sem) |
347 | { | 347 | { |
348 | int val; | 348 | NXRD32(adapter, NETXEN_PCIE_REG(PCIE_SEM_UNLOCK(sem))); |
349 | val = NXRD32(adapter, NETXEN_PCIE_REG(PCIE_SEM_UNLOCK(sem))); | ||
350 | } | 349 | } |
351 | 350 | ||
352 | int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port) | 351 | int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port) |
@@ -691,6 +690,9 @@ void netxen_p3_nic_set_multi(struct net_device *netdev) | |||
691 | struct list_head *head; | 690 | struct list_head *head; |
692 | nx_mac_list_t *cur; | 691 | nx_mac_list_t *cur; |
693 | 692 | ||
693 | if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC) | ||
694 | return; | ||
695 | |||
694 | list_splice_tail_init(&adapter->mac_list, &del_list); | 696 | list_splice_tail_init(&adapter->mac_list, &del_list); |
695 | 697 | ||
696 | nx_p3_nic_add_mac(adapter, adapter->mac_addr, &del_list); | 698 | nx_p3_nic_add_mac(adapter, adapter->mac_addr, &del_list); |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index 02f8d4b4db63..64cff68d372c 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -184,6 +184,8 @@ skip_rds: | |||
184 | 184 | ||
185 | tx_ring = adapter->tx_ring; | 185 | tx_ring = adapter->tx_ring; |
186 | vfree(tx_ring->cmd_buf_arr); | 186 | vfree(tx_ring->cmd_buf_arr); |
187 | kfree(tx_ring); | ||
188 | adapter->tx_ring = NULL; | ||
187 | } | 189 | } |
188 | 190 | ||
189 | int netxen_alloc_sw_resources(struct netxen_adapter *adapter) | 191 | int netxen_alloc_sw_resources(struct netxen_adapter *adapter) |
@@ -782,7 +784,7 @@ netxen_need_fw_reset(struct netxen_adapter *adapter) | |||
782 | if (NXRD32(adapter, CRB_CMDPEG_STATE) == PHAN_INITIALIZE_FAILED) | 784 | if (NXRD32(adapter, CRB_CMDPEG_STATE) == PHAN_INITIALIZE_FAILED) |
783 | return 1; | 785 | return 1; |
784 | 786 | ||
785 | old_count = count = NXRD32(adapter, NETXEN_PEG_ALIVE_COUNTER); | 787 | old_count = NXRD32(adapter, NETXEN_PEG_ALIVE_COUNTER); |
786 | 788 | ||
787 | for (i = 0; i < 10; i++) { | 789 | for (i = 0; i < 10; i++) { |
788 | 790 | ||
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 6cae26a5bd67..24279e6e55f5 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -340,7 +340,7 @@ netxen_check_hw_init(struct netxen_adapter *adapter, int first_boot) | |||
340 | if (!(first_boot & 0x4)) { | 340 | if (!(first_boot & 0x4)) { |
341 | first_boot |= 0x4; | 341 | first_boot |= 0x4; |
342 | NXWR32(adapter, NETXEN_PCIE_REG(0x4), first_boot); | 342 | NXWR32(adapter, NETXEN_PCIE_REG(0x4), first_boot); |
343 | first_boot = NXRD32(adapter, NETXEN_PCIE_REG(0x4)); | 343 | NXRD32(adapter, NETXEN_PCIE_REG(0x4)); |
344 | } | 344 | } |
345 | 345 | ||
346 | /* This is the first boot after power up */ | 346 | /* This is the first boot after power up */ |
@@ -1898,12 +1898,8 @@ static void netxen_nic_handle_phy_intr(struct netxen_adapter *adapter) | |||
1898 | linkup = (val == XG_LINK_UP_P3); | 1898 | linkup = (val == XG_LINK_UP_P3); |
1899 | } else { | 1899 | } else { |
1900 | val = NXRD32(adapter, CRB_XG_STATE); | 1900 | val = NXRD32(adapter, CRB_XG_STATE); |
1901 | if (adapter->ahw.port_type == NETXEN_NIC_GBE) | 1901 | val = (val >> port*8) & 0xff; |
1902 | linkup = (val >> port) & 1; | 1902 | linkup = (val == XG_LINK_UP); |
1903 | else { | ||
1904 | val = (val >> port*8) & 0xff; | ||
1905 | linkup = (val == XG_LINK_UP); | ||
1906 | } | ||
1907 | } | 1903 | } |
1908 | 1904 | ||
1909 | netxen_advert_link_change(adapter, linkup); | 1905 | netxen_advert_link_change(adapter, linkup); |
@@ -1945,7 +1941,7 @@ static void netxen_tx_timeout_task(struct work_struct *work) | |||
1945 | netif_wake_queue(adapter->netdev); | 1941 | netif_wake_queue(adapter->netdev); |
1946 | 1942 | ||
1947 | clear_bit(__NX_RESETTING, &adapter->state); | 1943 | clear_bit(__NX_RESETTING, &adapter->state); |
1948 | 1944 | return; | |
1949 | } else { | 1945 | } else { |
1950 | clear_bit(__NX_RESETTING, &adapter->state); | 1946 | clear_bit(__NX_RESETTING, &adapter->state); |
1951 | if (!netxen_nic_reset_context(adapter)) { | 1947 | if (!netxen_nic_reset_context(adapter)) { |
@@ -2244,7 +2240,9 @@ netxen_detach_work(struct work_struct *work) | |||
2244 | 2240 | ||
2245 | netxen_nic_down(adapter, netdev); | 2241 | netxen_nic_down(adapter, netdev); |
2246 | 2242 | ||
2243 | rtnl_lock(); | ||
2247 | netxen_nic_detach(adapter); | 2244 | netxen_nic_detach(adapter); |
2245 | rtnl_unlock(); | ||
2248 | 2246 | ||
2249 | status = NXRD32(adapter, NETXEN_PEG_HALT_STATUS1); | 2247 | status = NXRD32(adapter, NETXEN_PEG_HALT_STATUS1); |
2250 | 2248 | ||
diff --git a/drivers/net/niu.c b/drivers/net/niu.c index 8ce58c4c7dd3..2aed2b382c40 100644 --- a/drivers/net/niu.c +++ b/drivers/net/niu.c | |||
@@ -2844,7 +2844,7 @@ static int tcam_wait_bit(struct niu *np, u64 bit) | |||
2844 | break; | 2844 | break; |
2845 | udelay(1); | 2845 | udelay(1); |
2846 | } | 2846 | } |
2847 | if (limit < 0) | 2847 | if (limit <= 0) |
2848 | return -ENODEV; | 2848 | return -ENODEV; |
2849 | 2849 | ||
2850 | return 0; | 2850 | return 0; |
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index 813aca3fc433..7b17404d0858 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c | |||
@@ -717,6 +717,7 @@ static struct pcmcia_device_id fmvj18x_ids[] = { | |||
717 | PCMCIA_PFC_DEVICE_PROD_ID12(0, "NEC", "PK-UG-J001" ,0x18df0ba0 ,0x831b1064), | 717 | PCMCIA_PFC_DEVICE_PROD_ID12(0, "NEC", "PK-UG-J001" ,0x18df0ba0 ,0x831b1064), |
718 | PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0105, 0x0d0a), | 718 | PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0105, 0x0d0a), |
719 | PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0105, 0x0e0a), | 719 | PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0105, 0x0e0a), |
720 | PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0032, 0x0e01), | ||
720 | PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0032, 0x0a05), | 721 | PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0032, 0x0a05), |
721 | PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0032, 0x1101), | 722 | PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0032, 0x1101), |
722 | PCMCIA_DEVICE_NULL, | 723 | PCMCIA_DEVICE_NULL, |
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index 8a5ae3b182ed..12e3233868e9 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c | |||
@@ -1402,7 +1402,6 @@ static void BuildLAF(int *ladrf, int *adr) | |||
1402 | for (i = 0; i < 8; i++) | 1402 | for (i = 0; i < 8; i++) |
1403 | printk(KERN_CONT " %02X", ladrf[i]); | 1403 | printk(KERN_CONT " %02X", ladrf[i]); |
1404 | printk(KERN_CONT "\n"); | 1404 | printk(KERN_CONT "\n"); |
1405 | } | ||
1406 | #endif | 1405 | #endif |
1407 | } /* BuildLAF */ | 1406 | } /* BuildLAF */ |
1408 | 1407 | ||
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 92ed3fbf89a5..776cad2f5715 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
@@ -1741,7 +1741,7 @@ static struct pcmcia_device_id pcnet_ids[] = { | |||
1741 | PCMCIA_MFC_DEVICE_CIS_PROD_ID4(0, "NSC MF LAN/Modem", 0x58fc6056, "cis/DP83903.cis"), | 1741 | PCMCIA_MFC_DEVICE_CIS_PROD_ID4(0, "NSC MF LAN/Modem", 0x58fc6056, "cis/DP83903.cis"), |
1742 | PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0175, 0x0000, "cis/DP83903.cis"), | 1742 | PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0175, 0x0000, "cis/DP83903.cis"), |
1743 | PCMCIA_DEVICE_CIS_MANF_CARD(0xc00f, 0x0002, "cis/LA-PCM.cis"), | 1743 | PCMCIA_DEVICE_CIS_MANF_CARD(0xc00f, 0x0002, "cis/LA-PCM.cis"), |
1744 | PCMCIA_DEVICE_CIS_PROD_ID12("KTI", "PE520 PLUS", 0xad180345, 0x9d58d392, "PE520.cis"), | 1744 | PCMCIA_DEVICE_CIS_PROD_ID12("KTI", "PE520 PLUS", 0xad180345, 0x9d58d392, "cis/PE520.cis"), |
1745 | PCMCIA_DEVICE_CIS_PROD_ID12("NDC", "Ethernet", 0x01c43ae1, 0x00b2e941, "cis/NE2K.cis"), | 1745 | PCMCIA_DEVICE_CIS_PROD_ID12("NDC", "Ethernet", 0x01c43ae1, 0x00b2e941, "cis/NE2K.cis"), |
1746 | PCMCIA_DEVICE_CIS_PROD_ID12("PMX ", "PE-200", 0x34f3f1c8, 0x10b59f8c, "cis/PE-200.cis"), | 1746 | PCMCIA_DEVICE_CIS_PROD_ID12("PMX ", "PE-200", 0x34f3f1c8, 0x10b59f8c, "cis/PE-200.cis"), |
1747 | PCMCIA_DEVICE_CIS_PROD_ID12("TAMARACK", "Ethernet", 0xcf434fba, 0x00b2e941, "cis/tamarack.cis"), | 1747 | PCMCIA_DEVICE_CIS_PROD_ID12("TAMARACK", "Ethernet", 0xcf434fba, 0x00b2e941, "cis/tamarack.cis"), |
@@ -1754,7 +1754,7 @@ MODULE_DEVICE_TABLE(pcmcia, pcnet_ids); | |||
1754 | MODULE_FIRMWARE("cis/PCMLM28.cis"); | 1754 | MODULE_FIRMWARE("cis/PCMLM28.cis"); |
1755 | MODULE_FIRMWARE("cis/DP83903.cis"); | 1755 | MODULE_FIRMWARE("cis/DP83903.cis"); |
1756 | MODULE_FIRMWARE("cis/LA-PCM.cis"); | 1756 | MODULE_FIRMWARE("cis/LA-PCM.cis"); |
1757 | MODULE_FIRMWARE("PE520.cis"); | 1757 | MODULE_FIRMWARE("cis/PE520.cis"); |
1758 | MODULE_FIRMWARE("cis/NE2K.cis"); | 1758 | MODULE_FIRMWARE("cis/NE2K.cis"); |
1759 | MODULE_FIRMWARE("cis/PE-200.cis"); | 1759 | MODULE_FIRMWARE("cis/PE-200.cis"); |
1760 | MODULE_FIRMWARE("cis/tamarack.cis"); | 1760 | MODULE_FIRMWARE("cis/tamarack.cis"); |
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c index dcc67a35e8f2..e154677ff706 100644 --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c | |||
@@ -45,6 +45,7 @@ static const char *const version = | |||
45 | #include <linux/crc32.h> | 45 | #include <linux/crc32.h> |
46 | #include <linux/netdevice.h> | 46 | #include <linux/netdevice.h> |
47 | #include <linux/etherdevice.h> | 47 | #include <linux/etherdevice.h> |
48 | #include <linux/if_ether.h> | ||
48 | #include <linux/skbuff.h> | 49 | #include <linux/skbuff.h> |
49 | #include <linux/spinlock.h> | 50 | #include <linux/spinlock.h> |
50 | #include <linux/moduleparam.h> | 51 | #include <linux/moduleparam.h> |
@@ -1765,7 +1766,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
1765 | 1766 | ||
1766 | /* if the ethernet address is not valid, force to 00:00:00:00:00:00 */ | 1767 | /* if the ethernet address is not valid, force to 00:00:00:00:00:00 */ |
1767 | if (!is_valid_ether_addr(dev->perm_addr)) | 1768 | if (!is_valid_ether_addr(dev->perm_addr)) |
1768 | memset(dev->dev_addr, 0, sizeof(dev->dev_addr)); | 1769 | memset(dev->dev_addr, 0, ETH_ALEN); |
1769 | 1770 | ||
1770 | if (pcnet32_debug & NETIF_MSG_PROBE) { | 1771 | if (pcnet32_debug & NETIF_MSG_PROBE) { |
1771 | printk(" %pM", dev->dev_addr); | 1772 | printk(" %pM", dev->dev_addr); |
diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c index c13cf64095b6..33c4b12a63ba 100644 --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c | |||
@@ -331,8 +331,8 @@ static void bcm54xx_adjust_rxrefclk(struct phy_device *phydev) | |||
331 | bool clk125en = true; | 331 | bool clk125en = true; |
332 | 332 | ||
333 | /* Abort if we are using an untested phy. */ | 333 | /* Abort if we are using an untested phy. */ |
334 | if (BRCM_PHY_MODEL(phydev) != PHY_ID_BCM57780 || | 334 | if (BRCM_PHY_MODEL(phydev) != PHY_ID_BCM57780 && |
335 | BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610 || | 335 | BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610 && |
336 | BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610M) | 336 | BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610M) |
337 | return; | 337 | return; |
338 | 338 | ||
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index bd4e8d72dc08..e17b70291bbc 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c | |||
@@ -264,6 +264,8 @@ static int mdio_bus_match(struct device *dev, struct device_driver *drv) | |||
264 | (phydev->phy_id & phydrv->phy_id_mask)); | 264 | (phydev->phy_id & phydrv->phy_id_mask)); |
265 | } | 265 | } |
266 | 266 | ||
267 | #ifdef CONFIG_PM | ||
268 | |||
267 | static bool mdio_bus_phy_may_suspend(struct phy_device *phydev) | 269 | static bool mdio_bus_phy_may_suspend(struct phy_device *phydev) |
268 | { | 270 | { |
269 | struct device_driver *drv = phydev->dev.driver; | 271 | struct device_driver *drv = phydev->dev.driver; |
@@ -295,34 +297,88 @@ static bool mdio_bus_phy_may_suspend(struct phy_device *phydev) | |||
295 | return true; | 297 | return true; |
296 | } | 298 | } |
297 | 299 | ||
298 | /* Suspend and resume. Copied from platform_suspend and | 300 | static int mdio_bus_suspend(struct device *dev) |
299 | * platform_resume | ||
300 | */ | ||
301 | static int mdio_bus_suspend(struct device * dev, pm_message_t state) | ||
302 | { | 301 | { |
303 | struct phy_driver *phydrv = to_phy_driver(dev->driver); | 302 | struct phy_driver *phydrv = to_phy_driver(dev->driver); |
304 | struct phy_device *phydev = to_phy_device(dev); | 303 | struct phy_device *phydev = to_phy_device(dev); |
305 | 304 | ||
305 | /* | ||
306 | * We must stop the state machine manually, otherwise it stops out of | ||
307 | * control, possibly with the phydev->lock held. Upon resume, netdev | ||
308 | * may call phy routines that try to grab the same lock, and that may | ||
309 | * lead to a deadlock. | ||
310 | */ | ||
311 | if (phydev->attached_dev) | ||
312 | phy_stop_machine(phydev); | ||
313 | |||
306 | if (!mdio_bus_phy_may_suspend(phydev)) | 314 | if (!mdio_bus_phy_may_suspend(phydev)) |
307 | return 0; | 315 | return 0; |
316 | |||
308 | return phydrv->suspend(phydev); | 317 | return phydrv->suspend(phydev); |
309 | } | 318 | } |
310 | 319 | ||
311 | static int mdio_bus_resume(struct device * dev) | 320 | static int mdio_bus_resume(struct device *dev) |
312 | { | 321 | { |
313 | struct phy_driver *phydrv = to_phy_driver(dev->driver); | 322 | struct phy_driver *phydrv = to_phy_driver(dev->driver); |
314 | struct phy_device *phydev = to_phy_device(dev); | 323 | struct phy_device *phydev = to_phy_device(dev); |
324 | int ret; | ||
315 | 325 | ||
316 | if (!mdio_bus_phy_may_suspend(phydev)) | 326 | if (!mdio_bus_phy_may_suspend(phydev)) |
327 | goto no_resume; | ||
328 | |||
329 | ret = phydrv->resume(phydev); | ||
330 | if (ret < 0) | ||
331 | return ret; | ||
332 | |||
333 | no_resume: | ||
334 | if (phydev->attached_dev) | ||
335 | phy_start_machine(phydev, NULL); | ||
336 | |||
337 | return 0; | ||
338 | } | ||
339 | |||
340 | static int mdio_bus_restore(struct device *dev) | ||
341 | { | ||
342 | struct phy_device *phydev = to_phy_device(dev); | ||
343 | struct net_device *netdev = phydev->attached_dev; | ||
344 | int ret; | ||
345 | |||
346 | if (!netdev) | ||
317 | return 0; | 347 | return 0; |
318 | return phydrv->resume(phydev); | 348 | |
349 | ret = phy_init_hw(phydev); | ||
350 | if (ret < 0) | ||
351 | return ret; | ||
352 | |||
353 | /* The PHY needs to renegotiate. */ | ||
354 | phydev->link = 0; | ||
355 | phydev->state = PHY_UP; | ||
356 | |||
357 | phy_start_machine(phydev, NULL); | ||
358 | |||
359 | return 0; | ||
319 | } | 360 | } |
320 | 361 | ||
362 | static struct dev_pm_ops mdio_bus_pm_ops = { | ||
363 | .suspend = mdio_bus_suspend, | ||
364 | .resume = mdio_bus_resume, | ||
365 | .freeze = mdio_bus_suspend, | ||
366 | .thaw = mdio_bus_resume, | ||
367 | .restore = mdio_bus_restore, | ||
368 | }; | ||
369 | |||
370 | #define MDIO_BUS_PM_OPS (&mdio_bus_pm_ops) | ||
371 | |||
372 | #else | ||
373 | |||
374 | #define MDIO_BUS_PM_OPS NULL | ||
375 | |||
376 | #endif /* CONFIG_PM */ | ||
377 | |||
321 | struct bus_type mdio_bus_type = { | 378 | struct bus_type mdio_bus_type = { |
322 | .name = "mdio_bus", | 379 | .name = "mdio_bus", |
323 | .match = mdio_bus_match, | 380 | .match = mdio_bus_match, |
324 | .suspend = mdio_bus_suspend, | 381 | .pm = MDIO_BUS_PM_OPS, |
325 | .resume = mdio_bus_resume, | ||
326 | }; | 382 | }; |
327 | EXPORT_SYMBOL(mdio_bus_type); | 383 | EXPORT_SYMBOL(mdio_bus_type); |
328 | 384 | ||
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index b0e9f9c51721..0295097d6c44 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -410,7 +410,6 @@ EXPORT_SYMBOL(phy_start_aneg); | |||
410 | 410 | ||
411 | 411 | ||
412 | static void phy_change(struct work_struct *work); | 412 | static void phy_change(struct work_struct *work); |
413 | static void phy_state_machine(struct work_struct *work); | ||
414 | 413 | ||
415 | /** | 414 | /** |
416 | * phy_start_machine - start PHY state machine tracking | 415 | * phy_start_machine - start PHY state machine tracking |
@@ -430,7 +429,6 @@ void phy_start_machine(struct phy_device *phydev, | |||
430 | { | 429 | { |
431 | phydev->adjust_state = handler; | 430 | phydev->adjust_state = handler; |
432 | 431 | ||
433 | INIT_DELAYED_WORK(&phydev->state_queue, phy_state_machine); | ||
434 | schedule_delayed_work(&phydev->state_queue, HZ); | 432 | schedule_delayed_work(&phydev->state_queue, HZ); |
435 | } | 433 | } |
436 | 434 | ||
@@ -761,7 +759,7 @@ EXPORT_SYMBOL(phy_start); | |||
761 | * phy_state_machine - Handle the state machine | 759 | * phy_state_machine - Handle the state machine |
762 | * @work: work_struct that describes the work to be done | 760 | * @work: work_struct that describes the work to be done |
763 | */ | 761 | */ |
764 | static void phy_state_machine(struct work_struct *work) | 762 | void phy_state_machine(struct work_struct *work) |
765 | { | 763 | { |
766 | struct delayed_work *dwork = to_delayed_work(work); | 764 | struct delayed_work *dwork = to_delayed_work(work); |
767 | struct phy_device *phydev = | 765 | struct phy_device *phydev = |
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index b10fedd82143..adbc0fded130 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -177,6 +177,7 @@ struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id) | |||
177 | dev->state = PHY_DOWN; | 177 | dev->state = PHY_DOWN; |
178 | 178 | ||
179 | mutex_init(&dev->lock); | 179 | mutex_init(&dev->lock); |
180 | INIT_DELAYED_WORK(&dev->state_queue, phy_state_machine); | ||
180 | 181 | ||
181 | return dev; | 182 | return dev; |
182 | } | 183 | } |
@@ -378,6 +379,20 @@ void phy_disconnect(struct phy_device *phydev) | |||
378 | } | 379 | } |
379 | EXPORT_SYMBOL(phy_disconnect); | 380 | EXPORT_SYMBOL(phy_disconnect); |
380 | 381 | ||
382 | int phy_init_hw(struct phy_device *phydev) | ||
383 | { | ||
384 | int ret; | ||
385 | |||
386 | if (!phydev->drv || !phydev->drv->config_init) | ||
387 | return 0; | ||
388 | |||
389 | ret = phy_scan_fixups(phydev); | ||
390 | if (ret < 0) | ||
391 | return ret; | ||
392 | |||
393 | return phydev->drv->config_init(phydev); | ||
394 | } | ||
395 | |||
381 | /** | 396 | /** |
382 | * phy_attach_direct - attach a network device to a given PHY device pointer | 397 | * phy_attach_direct - attach a network device to a given PHY device pointer |
383 | * @dev: network device to attach | 398 | * @dev: network device to attach |
@@ -425,21 +440,7 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, | |||
425 | /* Do initial configuration here, now that | 440 | /* Do initial configuration here, now that |
426 | * we have certain key parameters | 441 | * we have certain key parameters |
427 | * (dev_flags and interface) */ | 442 | * (dev_flags and interface) */ |
428 | if (phydev->drv->config_init) { | 443 | return phy_init_hw(phydev); |
429 | int err; | ||
430 | |||
431 | err = phy_scan_fixups(phydev); | ||
432 | |||
433 | if (err < 0) | ||
434 | return err; | ||
435 | |||
436 | err = phydev->drv->config_init(phydev); | ||
437 | |||
438 | if (err < 0) | ||
439 | return err; | ||
440 | } | ||
441 | |||
442 | return 0; | ||
443 | } | 444 | } |
444 | EXPORT_SYMBOL(phy_attach_direct); | 445 | EXPORT_SYMBOL(phy_attach_direct); |
445 | 446 | ||
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index 707b391afa02..894a7c84faef 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c | |||
@@ -4119,7 +4119,7 @@ static int __devinit ql_init_device(struct pci_dev *pdev, | |||
4119 | err = pcie_set_readrq(pdev, 4096); | 4119 | err = pcie_set_readrq(pdev, 4096); |
4120 | if (err) { | 4120 | if (err) { |
4121 | dev_err(&pdev->dev, "Set readrq failed.\n"); | 4121 | dev_err(&pdev->dev, "Set readrq failed.\n"); |
4122 | goto err_out; | 4122 | goto err_out1; |
4123 | } | 4123 | } |
4124 | 4124 | ||
4125 | err = pci_request_regions(pdev, DRV_NAME); | 4125 | err = pci_request_regions(pdev, DRV_NAME); |
@@ -4140,7 +4140,7 @@ static int __devinit ql_init_device(struct pci_dev *pdev, | |||
4140 | 4140 | ||
4141 | if (err) { | 4141 | if (err) { |
4142 | dev_err(&pdev->dev, "No usable DMA configuration.\n"); | 4142 | dev_err(&pdev->dev, "No usable DMA configuration.\n"); |
4143 | goto err_out; | 4143 | goto err_out2; |
4144 | } | 4144 | } |
4145 | 4145 | ||
4146 | /* Set PCIe reset type for EEH to fundamental. */ | 4146 | /* Set PCIe reset type for EEH to fundamental. */ |
@@ -4152,7 +4152,7 @@ static int __devinit ql_init_device(struct pci_dev *pdev, | |||
4152 | if (!qdev->reg_base) { | 4152 | if (!qdev->reg_base) { |
4153 | dev_err(&pdev->dev, "Register mapping failed.\n"); | 4153 | dev_err(&pdev->dev, "Register mapping failed.\n"); |
4154 | err = -ENOMEM; | 4154 | err = -ENOMEM; |
4155 | goto err_out; | 4155 | goto err_out2; |
4156 | } | 4156 | } |
4157 | 4157 | ||
4158 | qdev->doorbell_area_size = pci_resource_len(pdev, 3); | 4158 | qdev->doorbell_area_size = pci_resource_len(pdev, 3); |
@@ -4162,14 +4162,14 @@ static int __devinit ql_init_device(struct pci_dev *pdev, | |||
4162 | if (!qdev->doorbell_area) { | 4162 | if (!qdev->doorbell_area) { |
4163 | dev_err(&pdev->dev, "Doorbell register mapping failed.\n"); | 4163 | dev_err(&pdev->dev, "Doorbell register mapping failed.\n"); |
4164 | err = -ENOMEM; | 4164 | err = -ENOMEM; |
4165 | goto err_out; | 4165 | goto err_out2; |
4166 | } | 4166 | } |
4167 | 4167 | ||
4168 | err = ql_get_board_info(qdev); | 4168 | err = ql_get_board_info(qdev); |
4169 | if (err) { | 4169 | if (err) { |
4170 | dev_err(&pdev->dev, "Register access failed.\n"); | 4170 | dev_err(&pdev->dev, "Register access failed.\n"); |
4171 | err = -EIO; | 4171 | err = -EIO; |
4172 | goto err_out; | 4172 | goto err_out2; |
4173 | } | 4173 | } |
4174 | qdev->msg_enable = netif_msg_init(debug, default_msg); | 4174 | qdev->msg_enable = netif_msg_init(debug, default_msg); |
4175 | spin_lock_init(&qdev->hw_lock); | 4175 | spin_lock_init(&qdev->hw_lock); |
@@ -4179,7 +4179,7 @@ static int __devinit ql_init_device(struct pci_dev *pdev, | |||
4179 | err = qdev->nic_ops->get_flash(qdev); | 4179 | err = qdev->nic_ops->get_flash(qdev); |
4180 | if (err) { | 4180 | if (err) { |
4181 | dev_err(&pdev->dev, "Invalid FLASH.\n"); | 4181 | dev_err(&pdev->dev, "Invalid FLASH.\n"); |
4182 | goto err_out; | 4182 | goto err_out2; |
4183 | } | 4183 | } |
4184 | 4184 | ||
4185 | memcpy(ndev->perm_addr, ndev->dev_addr, ndev->addr_len); | 4185 | memcpy(ndev->perm_addr, ndev->dev_addr, ndev->addr_len); |
@@ -4212,8 +4212,9 @@ static int __devinit ql_init_device(struct pci_dev *pdev, | |||
4212 | DRV_NAME, DRV_VERSION); | 4212 | DRV_NAME, DRV_VERSION); |
4213 | } | 4213 | } |
4214 | return 0; | 4214 | return 0; |
4215 | err_out: | 4215 | err_out2: |
4216 | ql_release_all(pdev); | 4216 | ql_release_all(pdev); |
4217 | err_out1: | ||
4217 | pci_disable_device(pdev); | 4218 | pci_disable_device(pdev); |
4218 | return err; | 4219 | return err; |
4219 | } | 4220 | } |
diff --git a/drivers/net/rrunner.c b/drivers/net/rrunner.c index 20a71749154a..1c257098d0a6 100644 --- a/drivers/net/rrunner.c +++ b/drivers/net/rrunner.c | |||
@@ -1293,7 +1293,7 @@ static void rr_dump(struct net_device *dev) | |||
1293 | 1293 | ||
1294 | printk("Error code 0x%x\n", readl(®s->Fail1)); | 1294 | printk("Error code 0x%x\n", readl(®s->Fail1)); |
1295 | 1295 | ||
1296 | index = (((readl(®s->EvtPrd) >> 8) & 0xff ) - 1) % EVT_RING_ENTRIES; | 1296 | index = (((readl(®s->EvtPrd) >> 8) & 0xff) - 1) % TX_RING_ENTRIES; |
1297 | cons = rrpriv->dirty_tx; | 1297 | cons = rrpriv->dirty_tx; |
1298 | printk("TX ring index %i, TX consumer %i\n", | 1298 | printk("TX ring index %i, TX consumer %i\n", |
1299 | index, cons); | 1299 | index, cons); |
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index cc4218667cba..3c4836d0898f 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -3421,7 +3421,7 @@ static int wait_for_cmd_complete(void __iomem *addr, u64 busy_bit, | |||
3421 | break; | 3421 | break; |
3422 | } | 3422 | } |
3423 | } else { | 3423 | } else { |
3424 | if (!(val64 & busy_bit)) { | 3424 | if (val64 & busy_bit) { |
3425 | ret = SUCCESS; | 3425 | ret = SUCCESS; |
3426 | break; | 3426 | break; |
3427 | } | 3427 | } |
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c index f983e3b507cc..46997e177ee3 100644 --- a/drivers/net/sfc/efx.c +++ b/drivers/net/sfc/efx.c | |||
@@ -741,14 +741,14 @@ static int efx_probe_port(struct efx_nic *efx) | |||
741 | 741 | ||
742 | EFX_LOG(efx, "create port\n"); | 742 | EFX_LOG(efx, "create port\n"); |
743 | 743 | ||
744 | if (phy_flash_cfg) | ||
745 | efx->phy_mode = PHY_MODE_SPECIAL; | ||
746 | |||
744 | /* Connect up MAC/PHY operations table */ | 747 | /* Connect up MAC/PHY operations table */ |
745 | rc = efx->type->probe_port(efx); | 748 | rc = efx->type->probe_port(efx); |
746 | if (rc) | 749 | if (rc) |
747 | goto err; | 750 | goto err; |
748 | 751 | ||
749 | if (phy_flash_cfg) | ||
750 | efx->phy_mode = PHY_MODE_SPECIAL; | ||
751 | |||
752 | /* Sanity check MAC address */ | 752 | /* Sanity check MAC address */ |
753 | if (is_valid_ether_addr(efx->mac_address)) { | 753 | if (is_valid_ether_addr(efx->mac_address)) { |
754 | memcpy(efx->net_dev->dev_addr, efx->mac_address, ETH_ALEN); | 754 | memcpy(efx->net_dev->dev_addr, efx->mac_address, ETH_ALEN); |
@@ -2284,6 +2284,7 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev, | |||
2284 | fail2: | 2284 | fail2: |
2285 | efx_fini_struct(efx); | 2285 | efx_fini_struct(efx); |
2286 | fail1: | 2286 | fail1: |
2287 | WARN_ON(rc > 0); | ||
2287 | EFX_LOG(efx, "initialisation failed. rc=%d\n", rc); | 2288 | EFX_LOG(efx, "initialisation failed. rc=%d\n", rc); |
2288 | free_netdev(net_dev); | 2289 | free_netdev(net_dev); |
2289 | return rc; | 2290 | return rc; |
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c index 17afcd26e870..9d009c46e962 100644 --- a/drivers/net/sfc/falcon.c +++ b/drivers/net/sfc/falcon.c | |||
@@ -925,6 +925,7 @@ static int falcon_probe_port(struct efx_nic *efx) | |||
925 | 925 | ||
926 | static void falcon_remove_port(struct efx_nic *efx) | 926 | static void falcon_remove_port(struct efx_nic *efx) |
927 | { | 927 | { |
928 | efx->phy_op->remove(efx); | ||
928 | efx_nic_free_buffer(efx, &efx->stats_buffer); | 929 | efx_nic_free_buffer(efx, &efx->stats_buffer); |
929 | } | 930 | } |
930 | 931 | ||
diff --git a/drivers/net/sfc/falcon_boards.c b/drivers/net/sfc/falcon_boards.c index bf0b96af5334..5712fddd72f2 100644 --- a/drivers/net/sfc/falcon_boards.c +++ b/drivers/net/sfc/falcon_boards.c | |||
@@ -29,6 +29,15 @@ | |||
29 | #define FALCON_BOARD_SFN4111T 0x51 | 29 | #define FALCON_BOARD_SFN4111T 0x51 |
30 | #define FALCON_BOARD_SFN4112F 0x52 | 30 | #define FALCON_BOARD_SFN4112F 0x52 |
31 | 31 | ||
32 | /* Board temperature is about 15°C above ambient when air flow is | ||
33 | * limited. */ | ||
34 | #define FALCON_BOARD_TEMP_BIAS 15 | ||
35 | |||
36 | /* SFC4000 datasheet says: 'The maximum permitted junction temperature | ||
37 | * is 125°C; the thermal design of the environment for the SFC4000 | ||
38 | * should aim to keep this well below 100°C.' */ | ||
39 | #define FALCON_JUNC_TEMP_MAX 90 | ||
40 | |||
32 | /***************************************************************************** | 41 | /***************************************************************************** |
33 | * Support for LM87 sensor chip used on several boards | 42 | * Support for LM87 sensor chip used on several boards |
34 | */ | 43 | */ |
@@ -548,16 +557,16 @@ fail_hwmon: | |||
548 | static u8 sfe4002_lm87_channel = 0x03; /* use AIN not FAN inputs */ | 557 | static u8 sfe4002_lm87_channel = 0x03; /* use AIN not FAN inputs */ |
549 | 558 | ||
550 | static const u8 sfe4002_lm87_regs[] = { | 559 | static const u8 sfe4002_lm87_regs[] = { |
551 | LM87_IN_LIMITS(0, 0x83, 0x91), /* 2.5V: 1.8V +/- 5% */ | 560 | LM87_IN_LIMITS(0, 0x7c, 0x99), /* 2.5V: 1.8V +/- 10% */ |
552 | LM87_IN_LIMITS(1, 0x51, 0x5a), /* Vccp1: 1.2V +/- 5% */ | 561 | LM87_IN_LIMITS(1, 0x4c, 0x5e), /* Vccp1: 1.2V +/- 10% */ |
553 | LM87_IN_LIMITS(2, 0xb6, 0xca), /* 3.3V: 3.3V +/- 5% */ | 562 | LM87_IN_LIMITS(2, 0xac, 0xd4), /* 3.3V: 3.3V +/- 10% */ |
554 | LM87_IN_LIMITS(3, 0xb0, 0xc9), /* 5V: 4.6-5.2V */ | 563 | LM87_IN_LIMITS(3, 0xac, 0xd4), /* 5V: 5.0V +/- 10% */ |
555 | LM87_IN_LIMITS(4, 0xb0, 0xe0), /* 12V: 11-14V */ | 564 | LM87_IN_LIMITS(4, 0xac, 0xe0), /* 12V: 10.8-14V */ |
556 | LM87_IN_LIMITS(5, 0x44, 0x4b), /* Vccp2: 1.0V +/- 5% */ | 565 | LM87_IN_LIMITS(5, 0x3f, 0x4f), /* Vccp2: 1.0V +/- 10% */ |
557 | LM87_AIN_LIMITS(0, 0xa0, 0xb2), /* AIN1: 1.66V +/- 5% */ | 566 | LM87_AIN_LIMITS(0, 0x98, 0xbb), /* AIN1: 1.66V +/- 10% */ |
558 | LM87_AIN_LIMITS(1, 0x91, 0xa1), /* AIN2: 1.5V +/- 5% */ | 567 | LM87_AIN_LIMITS(1, 0x8a, 0xa9), /* AIN2: 1.5V +/- 10% */ |
559 | LM87_TEMP_INT_LIMITS(10, 60), /* board */ | 568 | LM87_TEMP_INT_LIMITS(0, 80 + FALCON_BOARD_TEMP_BIAS), |
560 | LM87_TEMP_EXT1_LIMITS(10, 70), /* Falcon */ | 569 | LM87_TEMP_EXT1_LIMITS(0, FALCON_JUNC_TEMP_MAX), |
561 | 0 | 570 | 0 |
562 | }; | 571 | }; |
563 | 572 | ||
@@ -619,14 +628,14 @@ static int sfe4002_init(struct efx_nic *efx) | |||
619 | static u8 sfn4112f_lm87_channel = 0x03; /* use AIN not FAN inputs */ | 628 | static u8 sfn4112f_lm87_channel = 0x03; /* use AIN not FAN inputs */ |
620 | 629 | ||
621 | static const u8 sfn4112f_lm87_regs[] = { | 630 | static const u8 sfn4112f_lm87_regs[] = { |
622 | LM87_IN_LIMITS(0, 0x83, 0x91), /* 2.5V: 1.8V +/- 5% */ | 631 | LM87_IN_LIMITS(0, 0x7c, 0x99), /* 2.5V: 1.8V +/- 10% */ |
623 | LM87_IN_LIMITS(1, 0x51, 0x5a), /* Vccp1: 1.2V +/- 5% */ | 632 | LM87_IN_LIMITS(1, 0x4c, 0x5e), /* Vccp1: 1.2V +/- 10% */ |
624 | LM87_IN_LIMITS(2, 0xb6, 0xca), /* 3.3V: 3.3V +/- 5% */ | 633 | LM87_IN_LIMITS(2, 0xac, 0xd4), /* 3.3V: 3.3V +/- 10% */ |
625 | LM87_IN_LIMITS(4, 0xb0, 0xe0), /* 12V: 11-14V */ | 634 | LM87_IN_LIMITS(4, 0xac, 0xe0), /* 12V: 10.8-14V */ |
626 | LM87_IN_LIMITS(5, 0x44, 0x4b), /* Vccp2: 1.0V +/- 5% */ | 635 | LM87_IN_LIMITS(5, 0x3f, 0x4f), /* Vccp2: 1.0V +/- 10% */ |
627 | LM87_AIN_LIMITS(1, 0x91, 0xa1), /* AIN2: 1.5V +/- 5% */ | 636 | LM87_AIN_LIMITS(1, 0x8a, 0xa9), /* AIN2: 1.5V +/- 10% */ |
628 | LM87_TEMP_INT_LIMITS(10, 60), /* board */ | 637 | LM87_TEMP_INT_LIMITS(0, 60 + FALCON_BOARD_TEMP_BIAS), |
629 | LM87_TEMP_EXT1_LIMITS(10, 70), /* Falcon */ | 638 | LM87_TEMP_EXT1_LIMITS(0, FALCON_JUNC_TEMP_MAX), |
630 | 0 | 639 | 0 |
631 | }; | 640 | }; |
632 | 641 | ||
diff --git a/drivers/net/sfc/falcon_xmac.c b/drivers/net/sfc/falcon_xmac.c index 3da933f8f079..8ccab2c67a20 100644 --- a/drivers/net/sfc/falcon_xmac.c +++ b/drivers/net/sfc/falcon_xmac.c | |||
@@ -111,16 +111,12 @@ static void falcon_mask_status_intr(struct efx_nic *efx, bool enable) | |||
111 | efx_writeo(efx, ®, FR_AB_XM_MGT_INT_MASK); | 111 | efx_writeo(efx, ®, FR_AB_XM_MGT_INT_MASK); |
112 | } | 112 | } |
113 | 113 | ||
114 | /* Get status of XAUI link */ | 114 | static bool falcon_xgxs_link_ok(struct efx_nic *efx) |
115 | static bool falcon_xaui_link_ok(struct efx_nic *efx) | ||
116 | { | 115 | { |
117 | efx_oword_t reg; | 116 | efx_oword_t reg; |
118 | bool align_done, link_ok = false; | 117 | bool align_done, link_ok = false; |
119 | int sync_status; | 118 | int sync_status; |
120 | 119 | ||
121 | if (LOOPBACK_INTERNAL(efx)) | ||
122 | return true; | ||
123 | |||
124 | /* Read link status */ | 120 | /* Read link status */ |
125 | efx_reado(efx, ®, FR_AB_XX_CORE_STAT); | 121 | efx_reado(efx, ®, FR_AB_XX_CORE_STAT); |
126 | 122 | ||
@@ -135,14 +131,24 @@ static bool falcon_xaui_link_ok(struct efx_nic *efx) | |||
135 | EFX_SET_OWORD_FIELD(reg, FRF_AB_XX_DISPERR, FFE_AB_XX_STAT_ALL_LANES); | 131 | EFX_SET_OWORD_FIELD(reg, FRF_AB_XX_DISPERR, FFE_AB_XX_STAT_ALL_LANES); |
136 | efx_writeo(efx, ®, FR_AB_XX_CORE_STAT); | 132 | efx_writeo(efx, ®, FR_AB_XX_CORE_STAT); |
137 | 133 | ||
138 | /* If the link is up, then check the phy side of the xaui link */ | ||
139 | if (efx->link_state.up && link_ok) | ||
140 | if (efx->mdio.mmds & (1 << MDIO_MMD_PHYXS)) | ||
141 | link_ok = efx_mdio_phyxgxs_lane_sync(efx); | ||
142 | |||
143 | return link_ok; | 134 | return link_ok; |
144 | } | 135 | } |
145 | 136 | ||
137 | static bool falcon_xmac_link_ok(struct efx_nic *efx) | ||
138 | { | ||
139 | /* | ||
140 | * Check MAC's XGXS link status except when using XGMII loopback | ||
141 | * which bypasses the XGXS block. | ||
142 | * If possible, check PHY's XGXS link status except when using | ||
143 | * MAC loopback. | ||
144 | */ | ||
145 | return (efx->loopback_mode == LOOPBACK_XGMII || | ||
146 | falcon_xgxs_link_ok(efx)) && | ||
147 | (!(efx->mdio.mmds & (1 << MDIO_MMD_PHYXS)) || | ||
148 | LOOPBACK_INTERNAL(efx) || | ||
149 | efx_mdio_phyxgxs_lane_sync(efx)); | ||
150 | } | ||
151 | |||
146 | void falcon_reconfigure_xmac_core(struct efx_nic *efx) | 152 | void falcon_reconfigure_xmac_core(struct efx_nic *efx) |
147 | { | 153 | { |
148 | unsigned int max_frame_len; | 154 | unsigned int max_frame_len; |
@@ -245,9 +251,9 @@ static void falcon_reconfigure_xgxs_core(struct efx_nic *efx) | |||
245 | 251 | ||
246 | 252 | ||
247 | /* Try to bring up the Falcon side of the Falcon-Phy XAUI link */ | 253 | /* Try to bring up the Falcon side of the Falcon-Phy XAUI link */ |
248 | static bool falcon_check_xaui_link_up(struct efx_nic *efx, int tries) | 254 | static bool falcon_xmac_link_ok_retry(struct efx_nic *efx, int tries) |
249 | { | 255 | { |
250 | bool mac_up = falcon_xaui_link_ok(efx); | 256 | bool mac_up = falcon_xmac_link_ok(efx); |
251 | 257 | ||
252 | if (LOOPBACK_MASK(efx) & LOOPBACKS_EXTERNAL(efx) & LOOPBACKS_WS || | 258 | if (LOOPBACK_MASK(efx) & LOOPBACKS_EXTERNAL(efx) & LOOPBACKS_WS || |
253 | efx_phy_mode_disabled(efx->phy_mode)) | 259 | efx_phy_mode_disabled(efx->phy_mode)) |
@@ -261,7 +267,7 @@ static bool falcon_check_xaui_link_up(struct efx_nic *efx, int tries) | |||
261 | falcon_reset_xaui(efx); | 267 | falcon_reset_xaui(efx); |
262 | udelay(200); | 268 | udelay(200); |
263 | 269 | ||
264 | mac_up = falcon_xaui_link_ok(efx); | 270 | mac_up = falcon_xmac_link_ok(efx); |
265 | --tries; | 271 | --tries; |
266 | } | 272 | } |
267 | 273 | ||
@@ -272,7 +278,7 @@ static bool falcon_check_xaui_link_up(struct efx_nic *efx, int tries) | |||
272 | 278 | ||
273 | static bool falcon_xmac_check_fault(struct efx_nic *efx) | 279 | static bool falcon_xmac_check_fault(struct efx_nic *efx) |
274 | { | 280 | { |
275 | return !falcon_check_xaui_link_up(efx, 5); | 281 | return !falcon_xmac_link_ok_retry(efx, 5); |
276 | } | 282 | } |
277 | 283 | ||
278 | static int falcon_reconfigure_xmac(struct efx_nic *efx) | 284 | static int falcon_reconfigure_xmac(struct efx_nic *efx) |
@@ -284,7 +290,7 @@ static int falcon_reconfigure_xmac(struct efx_nic *efx) | |||
284 | 290 | ||
285 | falcon_reconfigure_mac_wrapper(efx); | 291 | falcon_reconfigure_mac_wrapper(efx); |
286 | 292 | ||
287 | efx->xmac_poll_required = !falcon_check_xaui_link_up(efx, 5); | 293 | efx->xmac_poll_required = !falcon_xmac_link_ok_retry(efx, 5); |
288 | falcon_mask_status_intr(efx, true); | 294 | falcon_mask_status_intr(efx, true); |
289 | 295 | ||
290 | return 0; | 296 | return 0; |
@@ -357,7 +363,7 @@ void falcon_poll_xmac(struct efx_nic *efx) | |||
357 | return; | 363 | return; |
358 | 364 | ||
359 | falcon_mask_status_intr(efx, false); | 365 | falcon_mask_status_intr(efx, false); |
360 | efx->xmac_poll_required = !falcon_check_xaui_link_up(efx, 1); | 366 | efx->xmac_poll_required = !falcon_xmac_link_ok_retry(efx, 1); |
361 | falcon_mask_status_intr(efx, true); | 367 | falcon_mask_status_intr(efx, true); |
362 | } | 368 | } |
363 | 369 | ||
diff --git a/drivers/net/sfc/mcdi.c b/drivers/net/sfc/mcdi.c index 683353b904c7..f66b3da6ddff 100644 --- a/drivers/net/sfc/mcdi.c +++ b/drivers/net/sfc/mcdi.c | |||
@@ -127,7 +127,7 @@ static int efx_mcdi_poll(struct efx_nic *efx) | |||
127 | efx_dword_t reg; | 127 | efx_dword_t reg; |
128 | 128 | ||
129 | /* Check for a reboot atomically with respect to efx_mcdi_copyout() */ | 129 | /* Check for a reboot atomically with respect to efx_mcdi_copyout() */ |
130 | rc = efx_mcdi_poll_reboot(efx); | 130 | rc = -efx_mcdi_poll_reboot(efx); |
131 | if (rc) | 131 | if (rc) |
132 | goto out; | 132 | goto out; |
133 | 133 | ||
@@ -142,8 +142,9 @@ static int efx_mcdi_poll(struct efx_nic *efx) | |||
142 | if (spins != 0) { | 142 | if (spins != 0) { |
143 | --spins; | 143 | --spins; |
144 | udelay(1); | 144 | udelay(1); |
145 | } else | 145 | } else { |
146 | schedule(); | 146 | schedule_timeout_uninterruptible(1); |
147 | } | ||
147 | 148 | ||
148 | time = get_seconds(); | 149 | time = get_seconds(); |
149 | 150 | ||
@@ -803,7 +804,7 @@ int efx_mcdi_nvram_read(struct efx_nic *efx, unsigned int type, | |||
803 | loff_t offset, u8 *buffer, size_t length) | 804 | loff_t offset, u8 *buffer, size_t length) |
804 | { | 805 | { |
805 | u8 inbuf[MC_CMD_NVRAM_READ_IN_LEN]; | 806 | u8 inbuf[MC_CMD_NVRAM_READ_IN_LEN]; |
806 | u8 outbuf[MC_CMD_NVRAM_READ_OUT_LEN(length)]; | 807 | u8 outbuf[MC_CMD_NVRAM_READ_OUT_LEN(EFX_MCDI_NVRAM_LEN_MAX)]; |
807 | size_t outlen; | 808 | size_t outlen; |
808 | int rc; | 809 | int rc; |
809 | 810 | ||
@@ -827,7 +828,7 @@ fail: | |||
827 | int efx_mcdi_nvram_write(struct efx_nic *efx, unsigned int type, | 828 | int efx_mcdi_nvram_write(struct efx_nic *efx, unsigned int type, |
828 | loff_t offset, const u8 *buffer, size_t length) | 829 | loff_t offset, const u8 *buffer, size_t length) |
829 | { | 830 | { |
830 | u8 inbuf[MC_CMD_NVRAM_WRITE_IN_LEN(length)]; | 831 | u8 inbuf[MC_CMD_NVRAM_WRITE_IN_LEN(EFX_MCDI_NVRAM_LEN_MAX)]; |
831 | int rc; | 832 | int rc; |
832 | 833 | ||
833 | MCDI_SET_DWORD(inbuf, NVRAM_WRITE_IN_TYPE, type); | 834 | MCDI_SET_DWORD(inbuf, NVRAM_WRITE_IN_TYPE, type); |
@@ -837,7 +838,8 @@ int efx_mcdi_nvram_write(struct efx_nic *efx, unsigned int type, | |||
837 | 838 | ||
838 | BUILD_BUG_ON(MC_CMD_NVRAM_WRITE_OUT_LEN != 0); | 839 | BUILD_BUG_ON(MC_CMD_NVRAM_WRITE_OUT_LEN != 0); |
839 | 840 | ||
840 | rc = efx_mcdi_rpc(efx, MC_CMD_NVRAM_WRITE, inbuf, sizeof(inbuf), | 841 | rc = efx_mcdi_rpc(efx, MC_CMD_NVRAM_WRITE, inbuf, |
842 | ALIGN(MC_CMD_NVRAM_WRITE_IN_LEN(length), 4), | ||
841 | NULL, 0, NULL); | 843 | NULL, 0, NULL); |
842 | if (rc) | 844 | if (rc) |
843 | goto fail; | 845 | goto fail; |
diff --git a/drivers/net/sfc/mcdi.h b/drivers/net/sfc/mcdi.h index de916728c2e3..10ce98f4c0fb 100644 --- a/drivers/net/sfc/mcdi.h +++ b/drivers/net/sfc/mcdi.h | |||
@@ -111,6 +111,7 @@ extern int efx_mcdi_nvram_read(struct efx_nic *efx, unsigned int type, | |||
111 | extern int efx_mcdi_nvram_write(struct efx_nic *efx, unsigned int type, | 111 | extern int efx_mcdi_nvram_write(struct efx_nic *efx, unsigned int type, |
112 | loff_t offset, const u8 *buffer, | 112 | loff_t offset, const u8 *buffer, |
113 | size_t length); | 113 | size_t length); |
114 | #define EFX_MCDI_NVRAM_LEN_MAX 128 | ||
114 | extern int efx_mcdi_nvram_erase(struct efx_nic *efx, unsigned int type, | 115 | extern int efx_mcdi_nvram_erase(struct efx_nic *efx, unsigned int type, |
115 | loff_t offset, size_t length); | 116 | loff_t offset, size_t length); |
116 | extern int efx_mcdi_nvram_update_finish(struct efx_nic *efx, | 117 | extern int efx_mcdi_nvram_update_finish(struct efx_nic *efx, |
diff --git a/drivers/net/sfc/mcdi_pcol.h b/drivers/net/sfc/mcdi_pcol.h index 2a85360a46f0..73e71f420624 100644 --- a/drivers/net/sfc/mcdi_pcol.h +++ b/drivers/net/sfc/mcdi_pcol.h | |||
@@ -1090,8 +1090,10 @@ | |||
1090 | #define MC_CMD_MAC_RX_LANES01_DISP_ERR 57 | 1090 | #define MC_CMD_MAC_RX_LANES01_DISP_ERR 57 |
1091 | #define MC_CMD_MAC_RX_LANES23_DISP_ERR 58 | 1091 | #define MC_CMD_MAC_RX_LANES23_DISP_ERR 58 |
1092 | #define MC_CMD_MAC_RX_MATCH_FAULT 59 | 1092 | #define MC_CMD_MAC_RX_MATCH_FAULT 59 |
1093 | #define MC_CMD_GMAC_DMABUF_START 64 | ||
1094 | #define MC_CMD_GMAC_DMABUF_END 95 | ||
1093 | /* Insert new members here. */ | 1095 | /* Insert new members here. */ |
1094 | #define MC_CMD_MAC_GENERATION_END 60 | 1096 | #define MC_CMD_MAC_GENERATION_END 96 |
1095 | #define MC_CMD_MAC_NSTATS (MC_CMD_MAC_GENERATION_END+1) | 1097 | #define MC_CMD_MAC_NSTATS (MC_CMD_MAC_GENERATION_END+1) |
1096 | 1098 | ||
1097 | /* MC_CMD_MAC_STATS: | 1099 | /* MC_CMD_MAC_STATS: |
diff --git a/drivers/net/sfc/mcdi_phy.c b/drivers/net/sfc/mcdi_phy.c index 0e1bcc5a0d52..eb694af7a473 100644 --- a/drivers/net/sfc/mcdi_phy.c +++ b/drivers/net/sfc/mcdi_phy.c | |||
@@ -304,31 +304,47 @@ static u32 mcdi_to_ethtool_media(u32 media) | |||
304 | 304 | ||
305 | static int efx_mcdi_phy_probe(struct efx_nic *efx) | 305 | static int efx_mcdi_phy_probe(struct efx_nic *efx) |
306 | { | 306 | { |
307 | struct efx_mcdi_phy_cfg *phy_cfg; | 307 | struct efx_mcdi_phy_cfg *phy_data; |
308 | u8 outbuf[MC_CMD_GET_LINK_OUT_LEN]; | ||
309 | u32 caps; | ||
308 | int rc; | 310 | int rc; |
309 | 311 | ||
310 | /* TODO: Move phy_data initialisation to | 312 | /* Initialise and populate phy_data */ |
311 | * phy_op->probe/remove, rather than init/fini */ | 313 | phy_data = kzalloc(sizeof(*phy_data), GFP_KERNEL); |
312 | phy_cfg = kzalloc(sizeof(*phy_cfg), GFP_KERNEL); | 314 | if (phy_data == NULL) |
313 | if (phy_cfg == NULL) { | 315 | return -ENOMEM; |
314 | rc = -ENOMEM; | 316 | |
315 | goto fail_alloc; | 317 | rc = efx_mcdi_get_phy_cfg(efx, phy_data); |
316 | } | ||
317 | rc = efx_mcdi_get_phy_cfg(efx, phy_cfg); | ||
318 | if (rc != 0) | 318 | if (rc != 0) |
319 | goto fail; | 319 | goto fail; |
320 | 320 | ||
321 | efx->phy_type = phy_cfg->type; | 321 | /* Read initial link advertisement */ |
322 | BUILD_BUG_ON(MC_CMD_GET_LINK_IN_LEN != 0); | ||
323 | rc = efx_mcdi_rpc(efx, MC_CMD_GET_LINK, NULL, 0, | ||
324 | outbuf, sizeof(outbuf), NULL); | ||
325 | if (rc) | ||
326 | goto fail; | ||
327 | |||
328 | /* Fill out nic state */ | ||
329 | efx->phy_data = phy_data; | ||
330 | efx->phy_type = phy_data->type; | ||
322 | 331 | ||
323 | efx->mdio_bus = phy_cfg->channel; | 332 | efx->mdio_bus = phy_data->channel; |
324 | efx->mdio.prtad = phy_cfg->port; | 333 | efx->mdio.prtad = phy_data->port; |
325 | efx->mdio.mmds = phy_cfg->mmd_mask & ~(1 << MC_CMD_MMD_CLAUSE22); | 334 | efx->mdio.mmds = phy_data->mmd_mask & ~(1 << MC_CMD_MMD_CLAUSE22); |
326 | efx->mdio.mode_support = 0; | 335 | efx->mdio.mode_support = 0; |
327 | if (phy_cfg->mmd_mask & (1 << MC_CMD_MMD_CLAUSE22)) | 336 | if (phy_data->mmd_mask & (1 << MC_CMD_MMD_CLAUSE22)) |
328 | efx->mdio.mode_support |= MDIO_SUPPORTS_C22; | 337 | efx->mdio.mode_support |= MDIO_SUPPORTS_C22; |
329 | if (phy_cfg->mmd_mask & ~(1 << MC_CMD_MMD_CLAUSE22)) | 338 | if (phy_data->mmd_mask & ~(1 << MC_CMD_MMD_CLAUSE22)) |
330 | efx->mdio.mode_support |= MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22; | 339 | efx->mdio.mode_support |= MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22; |
331 | 340 | ||
341 | caps = MCDI_DWORD(outbuf, GET_LINK_OUT_CAP); | ||
342 | if (caps & (1 << MC_CMD_PHY_CAP_AN_LBN)) | ||
343 | efx->link_advertising = | ||
344 | mcdi_to_ethtool_cap(phy_data->media, caps); | ||
345 | else | ||
346 | phy_data->forced_cap = caps; | ||
347 | |||
332 | /* Assert that we can map efx -> mcdi loopback modes */ | 348 | /* Assert that we can map efx -> mcdi loopback modes */ |
333 | BUILD_BUG_ON(LOOPBACK_NONE != MC_CMD_LOOPBACK_NONE); | 349 | BUILD_BUG_ON(LOOPBACK_NONE != MC_CMD_LOOPBACK_NONE); |
334 | BUILD_BUG_ON(LOOPBACK_DATA != MC_CMD_LOOPBACK_DATA); | 350 | BUILD_BUG_ON(LOOPBACK_DATA != MC_CMD_LOOPBACK_DATA); |
@@ -365,46 +381,6 @@ static int efx_mcdi_phy_probe(struct efx_nic *efx) | |||
365 | * but by convention we don't */ | 381 | * but by convention we don't */ |
366 | efx->loopback_modes &= ~(1 << LOOPBACK_NONE); | 382 | efx->loopback_modes &= ~(1 << LOOPBACK_NONE); |
367 | 383 | ||
368 | kfree(phy_cfg); | ||
369 | |||
370 | return 0; | ||
371 | |||
372 | fail: | ||
373 | kfree(phy_cfg); | ||
374 | fail_alloc: | ||
375 | return rc; | ||
376 | } | ||
377 | |||
378 | static int efx_mcdi_phy_init(struct efx_nic *efx) | ||
379 | { | ||
380 | struct efx_mcdi_phy_cfg *phy_data; | ||
381 | u8 outbuf[MC_CMD_GET_LINK_OUT_LEN]; | ||
382 | u32 caps; | ||
383 | int rc; | ||
384 | |||
385 | phy_data = kzalloc(sizeof(*phy_data), GFP_KERNEL); | ||
386 | if (phy_data == NULL) | ||
387 | return -ENOMEM; | ||
388 | |||
389 | rc = efx_mcdi_get_phy_cfg(efx, phy_data); | ||
390 | if (rc != 0) | ||
391 | goto fail; | ||
392 | |||
393 | efx->phy_data = phy_data; | ||
394 | |||
395 | BUILD_BUG_ON(MC_CMD_GET_LINK_IN_LEN != 0); | ||
396 | rc = efx_mcdi_rpc(efx, MC_CMD_GET_LINK, NULL, 0, | ||
397 | outbuf, sizeof(outbuf), NULL); | ||
398 | if (rc) | ||
399 | goto fail; | ||
400 | |||
401 | caps = MCDI_DWORD(outbuf, GET_LINK_OUT_CAP); | ||
402 | if (caps & (1 << MC_CMD_PHY_CAP_AN_LBN)) | ||
403 | efx->link_advertising = | ||
404 | mcdi_to_ethtool_cap(phy_data->media, caps); | ||
405 | else | ||
406 | phy_data->forced_cap = caps; | ||
407 | |||
408 | return 0; | 384 | return 0; |
409 | 385 | ||
410 | fail: | 386 | fail: |
@@ -504,7 +480,7 @@ static bool efx_mcdi_phy_poll(struct efx_nic *efx) | |||
504 | return !efx_link_state_equal(&efx->link_state, &old_state); | 480 | return !efx_link_state_equal(&efx->link_state, &old_state); |
505 | } | 481 | } |
506 | 482 | ||
507 | static void efx_mcdi_phy_fini(struct efx_nic *efx) | 483 | static void efx_mcdi_phy_remove(struct efx_nic *efx) |
508 | { | 484 | { |
509 | struct efx_mcdi_phy_data *phy_data = efx->phy_data; | 485 | struct efx_mcdi_phy_data *phy_data = efx->phy_data; |
510 | 486 | ||
@@ -586,10 +562,11 @@ static int efx_mcdi_phy_set_settings(struct efx_nic *efx, struct ethtool_cmd *ec | |||
586 | 562 | ||
587 | struct efx_phy_operations efx_mcdi_phy_ops = { | 563 | struct efx_phy_operations efx_mcdi_phy_ops = { |
588 | .probe = efx_mcdi_phy_probe, | 564 | .probe = efx_mcdi_phy_probe, |
589 | .init = efx_mcdi_phy_init, | 565 | .init = efx_port_dummy_op_int, |
590 | .reconfigure = efx_mcdi_phy_reconfigure, | 566 | .reconfigure = efx_mcdi_phy_reconfigure, |
591 | .poll = efx_mcdi_phy_poll, | 567 | .poll = efx_mcdi_phy_poll, |
592 | .fini = efx_mcdi_phy_fini, | 568 | .fini = efx_port_dummy_op_void, |
569 | .remove = efx_mcdi_phy_remove, | ||
593 | .get_settings = efx_mcdi_phy_get_settings, | 570 | .get_settings = efx_mcdi_phy_get_settings, |
594 | .set_settings = efx_mcdi_phy_set_settings, | 571 | .set_settings = efx_mcdi_phy_set_settings, |
595 | .run_tests = NULL, | 572 | .run_tests = NULL, |
diff --git a/drivers/net/sfc/mtd.c b/drivers/net/sfc/mtd.c index 3a464529a46b..407bbaddfea6 100644 --- a/drivers/net/sfc/mtd.c +++ b/drivers/net/sfc/mtd.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include "mcdi_pcol.h" | 23 | #include "mcdi_pcol.h" |
24 | 24 | ||
25 | #define EFX_SPI_VERIFY_BUF_LEN 16 | 25 | #define EFX_SPI_VERIFY_BUF_LEN 16 |
26 | #define EFX_MCDI_CHUNK_LEN 128 | ||
27 | 26 | ||
28 | struct efx_mtd_partition { | 27 | struct efx_mtd_partition { |
29 | struct mtd_info mtd; | 28 | struct mtd_info mtd; |
@@ -428,7 +427,7 @@ static int siena_mtd_read(struct mtd_info *mtd, loff_t start, | |||
428 | int rc = 0; | 427 | int rc = 0; |
429 | 428 | ||
430 | while (offset < end) { | 429 | while (offset < end) { |
431 | chunk = min_t(size_t, end - offset, EFX_MCDI_CHUNK_LEN); | 430 | chunk = min_t(size_t, end - offset, EFX_MCDI_NVRAM_LEN_MAX); |
432 | rc = efx_mcdi_nvram_read(efx, part->mcdi.nvram_type, offset, | 431 | rc = efx_mcdi_nvram_read(efx, part->mcdi.nvram_type, offset, |
433 | buffer, chunk); | 432 | buffer, chunk); |
434 | if (rc) | 433 | if (rc) |
@@ -491,7 +490,7 @@ static int siena_mtd_write(struct mtd_info *mtd, loff_t start, | |||
491 | } | 490 | } |
492 | 491 | ||
493 | while (offset < end) { | 492 | while (offset < end) { |
494 | chunk = min_t(size_t, end - offset, EFX_MCDI_CHUNK_LEN); | 493 | chunk = min_t(size_t, end - offset, EFX_MCDI_NVRAM_LEN_MAX); |
495 | rc = efx_mcdi_nvram_write(efx, part->mcdi.nvram_type, offset, | 494 | rc = efx_mcdi_nvram_write(efx, part->mcdi.nvram_type, offset, |
496 | buffer, chunk); | 495 | buffer, chunk); |
497 | if (rc) | 496 | if (rc) |
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h index 34c381f009b7..d5aab5b3fa06 100644 --- a/drivers/net/sfc/net_driver.h +++ b/drivers/net/sfc/net_driver.h | |||
@@ -524,6 +524,7 @@ struct efx_phy_operations { | |||
524 | int (*probe) (struct efx_nic *efx); | 524 | int (*probe) (struct efx_nic *efx); |
525 | int (*init) (struct efx_nic *efx); | 525 | int (*init) (struct efx_nic *efx); |
526 | void (*fini) (struct efx_nic *efx); | 526 | void (*fini) (struct efx_nic *efx); |
527 | void (*remove) (struct efx_nic *efx); | ||
527 | int (*reconfigure) (struct efx_nic *efx); | 528 | int (*reconfigure) (struct efx_nic *efx); |
528 | bool (*poll) (struct efx_nic *efx); | 529 | bool (*poll) (struct efx_nic *efx); |
529 | void (*get_settings) (struct efx_nic *efx, | 530 | void (*get_settings) (struct efx_nic *efx, |
diff --git a/drivers/net/sfc/nic.c b/drivers/net/sfc/nic.c index a577be227862..db44224ed2ca 100644 --- a/drivers/net/sfc/nic.c +++ b/drivers/net/sfc/nic.c | |||
@@ -1576,6 +1576,8 @@ void efx_nic_init_common(struct efx_nic *efx) | |||
1576 | EFX_SET_OWORD_FIELD(temp, FRF_AZ_TX_SOFT_EVT_EN, 1); | 1576 | EFX_SET_OWORD_FIELD(temp, FRF_AZ_TX_SOFT_EVT_EN, 1); |
1577 | /* Prefetch threshold 2 => fetch when descriptor cache half empty */ | 1577 | /* Prefetch threshold 2 => fetch when descriptor cache half empty */ |
1578 | EFX_SET_OWORD_FIELD(temp, FRF_AZ_TX_PREF_THRESHOLD, 2); | 1578 | EFX_SET_OWORD_FIELD(temp, FRF_AZ_TX_PREF_THRESHOLD, 2); |
1579 | /* Disable hardware watchdog which can misfire */ | ||
1580 | EFX_SET_OWORD_FIELD(temp, FRF_AZ_TX_PREF_WD_TMR, 0x3fffff); | ||
1579 | /* Squash TX of packets of 16 bytes or less */ | 1581 | /* Squash TX of packets of 16 bytes or less */ |
1580 | if (efx_nic_rev(efx) >= EFX_REV_FALCON_B0) | 1582 | if (efx_nic_rev(efx) >= EFX_REV_FALCON_B0) |
1581 | EFX_SET_OWORD_FIELD(temp, FRF_BZ_TX_FLUSH_MIN_LEN_EN, 1); | 1583 | EFX_SET_OWORD_FIELD(temp, FRF_BZ_TX_FLUSH_MIN_LEN_EN, 1); |
diff --git a/drivers/net/sfc/qt202x_phy.c b/drivers/net/sfc/qt202x_phy.c index 3800fc791b2f..67eec7a6e487 100644 --- a/drivers/net/sfc/qt202x_phy.c +++ b/drivers/net/sfc/qt202x_phy.c | |||
@@ -33,6 +33,9 @@ | |||
33 | #define PCS_FW_HEARTBEAT_REG 0xd7ee | 33 | #define PCS_FW_HEARTBEAT_REG 0xd7ee |
34 | #define PCS_FW_HEARTB_LBN 0 | 34 | #define PCS_FW_HEARTB_LBN 0 |
35 | #define PCS_FW_HEARTB_WIDTH 8 | 35 | #define PCS_FW_HEARTB_WIDTH 8 |
36 | #define PCS_FW_PRODUCT_CODE_1 0xd7f0 | ||
37 | #define PCS_FW_VERSION_1 0xd7f3 | ||
38 | #define PCS_FW_BUILD_1 0xd7f6 | ||
36 | #define PCS_UC8051_STATUS_REG 0xd7fd | 39 | #define PCS_UC8051_STATUS_REG 0xd7fd |
37 | #define PCS_UC_STATUS_LBN 0 | 40 | #define PCS_UC_STATUS_LBN 0 |
38 | #define PCS_UC_STATUS_WIDTH 8 | 41 | #define PCS_UC_STATUS_WIDTH 8 |
@@ -52,14 +55,24 @@ void falcon_qt202x_set_led(struct efx_nic *p, int led, int mode) | |||
52 | 55 | ||
53 | struct qt202x_phy_data { | 56 | struct qt202x_phy_data { |
54 | enum efx_phy_mode phy_mode; | 57 | enum efx_phy_mode phy_mode; |
58 | bool bug17190_in_bad_state; | ||
59 | unsigned long bug17190_timer; | ||
60 | u32 firmware_ver; | ||
55 | }; | 61 | }; |
56 | 62 | ||
57 | #define QT2022C2_MAX_RESET_TIME 500 | 63 | #define QT2022C2_MAX_RESET_TIME 500 |
58 | #define QT2022C2_RESET_WAIT 10 | 64 | #define QT2022C2_RESET_WAIT 10 |
59 | 65 | ||
60 | static int qt2025c_wait_reset(struct efx_nic *efx) | 66 | #define QT2025C_MAX_HEARTB_TIME (5 * HZ) |
67 | #define QT2025C_HEARTB_WAIT 100 | ||
68 | #define QT2025C_MAX_FWSTART_TIME (25 * HZ / 10) | ||
69 | #define QT2025C_FWSTART_WAIT 100 | ||
70 | |||
71 | #define BUG17190_INTERVAL (2 * HZ) | ||
72 | |||
73 | static int qt2025c_wait_heartbeat(struct efx_nic *efx) | ||
61 | { | 74 | { |
62 | unsigned long timeout = jiffies + 10 * HZ; | 75 | unsigned long timeout = jiffies + QT2025C_MAX_HEARTB_TIME; |
63 | int reg, old_counter = 0; | 76 | int reg, old_counter = 0; |
64 | 77 | ||
65 | /* Wait for firmware heartbeat to start */ | 78 | /* Wait for firmware heartbeat to start */ |
@@ -74,11 +87,25 @@ static int qt2025c_wait_reset(struct efx_nic *efx) | |||
74 | old_counter = counter; | 87 | old_counter = counter; |
75 | else if (counter != old_counter) | 88 | else if (counter != old_counter) |
76 | break; | 89 | break; |
77 | if (time_after(jiffies, timeout)) | 90 | if (time_after(jiffies, timeout)) { |
91 | /* Some cables have EEPROMs that conflict with the | ||
92 | * PHY's on-board EEPROM so it cannot load firmware */ | ||
93 | EFX_ERR(efx, "If an SFP+ direct attach cable is" | ||
94 | " connected, please check that it complies" | ||
95 | " with the SFP+ specification\n"); | ||
78 | return -ETIMEDOUT; | 96 | return -ETIMEDOUT; |
79 | msleep(10); | 97 | } |
98 | msleep(QT2025C_HEARTB_WAIT); | ||
80 | } | 99 | } |
81 | 100 | ||
101 | return 0; | ||
102 | } | ||
103 | |||
104 | static int qt2025c_wait_fw_status_good(struct efx_nic *efx) | ||
105 | { | ||
106 | unsigned long timeout = jiffies + QT2025C_MAX_FWSTART_TIME; | ||
107 | int reg; | ||
108 | |||
82 | /* Wait for firmware status to look good */ | 109 | /* Wait for firmware status to look good */ |
83 | for (;;) { | 110 | for (;;) { |
84 | reg = efx_mdio_read(efx, MDIO_MMD_PCS, PCS_UC8051_STATUS_REG); | 111 | reg = efx_mdio_read(efx, MDIO_MMD_PCS, PCS_UC8051_STATUS_REG); |
@@ -90,7 +117,178 @@ static int qt2025c_wait_reset(struct efx_nic *efx) | |||
90 | break; | 117 | break; |
91 | if (time_after(jiffies, timeout)) | 118 | if (time_after(jiffies, timeout)) |
92 | return -ETIMEDOUT; | 119 | return -ETIMEDOUT; |
120 | msleep(QT2025C_FWSTART_WAIT); | ||
121 | } | ||
122 | |||
123 | return 0; | ||
124 | } | ||
125 | |||
126 | static void qt2025c_restart_firmware(struct efx_nic *efx) | ||
127 | { | ||
128 | /* Restart microcontroller execution of firmware from RAM */ | ||
129 | efx_mdio_write(efx, 3, 0xe854, 0x00c0); | ||
130 | efx_mdio_write(efx, 3, 0xe854, 0x0040); | ||
131 | msleep(50); | ||
132 | } | ||
133 | |||
134 | static int qt2025c_wait_reset(struct efx_nic *efx) | ||
135 | { | ||
136 | int rc; | ||
137 | |||
138 | rc = qt2025c_wait_heartbeat(efx); | ||
139 | if (rc != 0) | ||
140 | return rc; | ||
141 | |||
142 | rc = qt2025c_wait_fw_status_good(efx); | ||
143 | if (rc == -ETIMEDOUT) { | ||
144 | /* Bug 17689: occasionally heartbeat starts but firmware status | ||
145 | * code never progresses beyond 0x00. Try again, once, after | ||
146 | * restarting execution of the firmware image. */ | ||
147 | EFX_LOG(efx, "bashing QT2025C microcontroller\n"); | ||
148 | qt2025c_restart_firmware(efx); | ||
149 | rc = qt2025c_wait_heartbeat(efx); | ||
150 | if (rc != 0) | ||
151 | return rc; | ||
152 | rc = qt2025c_wait_fw_status_good(efx); | ||
153 | } | ||
154 | |||
155 | return rc; | ||
156 | } | ||
157 | |||
158 | static void qt2025c_firmware_id(struct efx_nic *efx) | ||
159 | { | ||
160 | struct qt202x_phy_data *phy_data = efx->phy_data; | ||
161 | u8 firmware_id[9]; | ||
162 | size_t i; | ||
163 | |||
164 | for (i = 0; i < sizeof(firmware_id); i++) | ||
165 | firmware_id[i] = efx_mdio_read(efx, MDIO_MMD_PCS, | ||
166 | PCS_FW_PRODUCT_CODE_1 + i); | ||
167 | EFX_INFO(efx, "QT2025C firmware %xr%d v%d.%d.%d.%d [20%02d-%02d-%02d]\n", | ||
168 | (firmware_id[0] << 8) | firmware_id[1], firmware_id[2], | ||
169 | firmware_id[3] >> 4, firmware_id[3] & 0xf, | ||
170 | firmware_id[4], firmware_id[5], | ||
171 | firmware_id[6], firmware_id[7], firmware_id[8]); | ||
172 | phy_data->firmware_ver = ((firmware_id[3] & 0xf0) << 20) | | ||
173 | ((firmware_id[3] & 0x0f) << 16) | | ||
174 | (firmware_id[4] << 8) | firmware_id[5]; | ||
175 | } | ||
176 | |||
177 | static void qt2025c_bug17190_workaround(struct efx_nic *efx) | ||
178 | { | ||
179 | struct qt202x_phy_data *phy_data = efx->phy_data; | ||
180 | |||
181 | /* The PHY can get stuck in a state where it reports PHY_XS and PMA/PMD | ||
182 | * layers up, but PCS down (no block_lock). If we notice this state | ||
183 | * persisting for a couple of seconds, we switch PMA/PMD loopback | ||
184 | * briefly on and then off again, which is normally sufficient to | ||
185 | * recover it. | ||
186 | */ | ||
187 | if (efx->link_state.up || | ||
188 | !efx_mdio_links_ok(efx, MDIO_DEVS_PMAPMD | MDIO_DEVS_PHYXS)) { | ||
189 | phy_data->bug17190_in_bad_state = false; | ||
190 | return; | ||
191 | } | ||
192 | |||
193 | if (!phy_data->bug17190_in_bad_state) { | ||
194 | phy_data->bug17190_in_bad_state = true; | ||
195 | phy_data->bug17190_timer = jiffies + BUG17190_INTERVAL; | ||
196 | return; | ||
197 | } | ||
198 | |||
199 | if (time_after_eq(jiffies, phy_data->bug17190_timer)) { | ||
200 | EFX_LOG(efx, "bashing QT2025C PMA/PMD\n"); | ||
201 | efx_mdio_set_flag(efx, MDIO_MMD_PMAPMD, MDIO_CTRL1, | ||
202 | MDIO_PMA_CTRL1_LOOPBACK, true); | ||
93 | msleep(100); | 203 | msleep(100); |
204 | efx_mdio_set_flag(efx, MDIO_MMD_PMAPMD, MDIO_CTRL1, | ||
205 | MDIO_PMA_CTRL1_LOOPBACK, false); | ||
206 | phy_data->bug17190_timer = jiffies + BUG17190_INTERVAL; | ||
207 | } | ||
208 | } | ||
209 | |||
210 | static int qt2025c_select_phy_mode(struct efx_nic *efx) | ||
211 | { | ||
212 | struct qt202x_phy_data *phy_data = efx->phy_data; | ||
213 | struct falcon_board *board = falcon_board(efx); | ||
214 | int reg, rc, i; | ||
215 | uint16_t phy_op_mode; | ||
216 | |||
217 | /* Only 2.0.1.0+ PHY firmware supports the more optimal SFP+ | ||
218 | * Self-Configure mode. Don't attempt any switching if we encounter | ||
219 | * older firmware. */ | ||
220 | if (phy_data->firmware_ver < 0x02000100) | ||
221 | return 0; | ||
222 | |||
223 | /* In general we will get optimal behaviour in "SFP+ Self-Configure" | ||
224 | * mode; however, that powers down most of the PHY when no module is | ||
225 | * present, so we must use a different mode (any fixed mode will do) | ||
226 | * to be sure that loopbacks will work. */ | ||
227 | phy_op_mode = (efx->loopback_mode == LOOPBACK_NONE) ? 0x0038 : 0x0020; | ||
228 | |||
229 | /* Only change mode if really necessary */ | ||
230 | reg = efx_mdio_read(efx, 1, 0xc319); | ||
231 | if ((reg & 0x0038) == phy_op_mode) | ||
232 | return 0; | ||
233 | EFX_LOG(efx, "Switching PHY to mode 0x%04x\n", phy_op_mode); | ||
234 | |||
235 | /* This sequence replicates the register writes configured in the boot | ||
236 | * EEPROM (including the differences between board revisions), except | ||
237 | * that the operating mode is changed, and the PHY is prevented from | ||
238 | * unnecessarily reloading the main firmware image again. */ | ||
239 | efx_mdio_write(efx, 1, 0xc300, 0x0000); | ||
240 | /* (Note: this portion of the boot EEPROM sequence, which bit-bashes 9 | ||
241 | * STOPs onto the firmware/module I2C bus to reset it, varies across | ||
242 | * board revisions, as the bus is connected to different GPIO/LED | ||
243 | * outputs on the PHY.) */ | ||
244 | if (board->major == 0 && board->minor < 2) { | ||
245 | efx_mdio_write(efx, 1, 0xc303, 0x4498); | ||
246 | for (i = 0; i < 9; i++) { | ||
247 | efx_mdio_write(efx, 1, 0xc303, 0x4488); | ||
248 | efx_mdio_write(efx, 1, 0xc303, 0x4480); | ||
249 | efx_mdio_write(efx, 1, 0xc303, 0x4490); | ||
250 | efx_mdio_write(efx, 1, 0xc303, 0x4498); | ||
251 | } | ||
252 | } else { | ||
253 | efx_mdio_write(efx, 1, 0xc303, 0x0920); | ||
254 | efx_mdio_write(efx, 1, 0xd008, 0x0004); | ||
255 | for (i = 0; i < 9; i++) { | ||
256 | efx_mdio_write(efx, 1, 0xc303, 0x0900); | ||
257 | efx_mdio_write(efx, 1, 0xd008, 0x0005); | ||
258 | efx_mdio_write(efx, 1, 0xc303, 0x0920); | ||
259 | efx_mdio_write(efx, 1, 0xd008, 0x0004); | ||
260 | } | ||
261 | efx_mdio_write(efx, 1, 0xc303, 0x4900); | ||
262 | } | ||
263 | efx_mdio_write(efx, 1, 0xc303, 0x4900); | ||
264 | efx_mdio_write(efx, 1, 0xc302, 0x0004); | ||
265 | efx_mdio_write(efx, 1, 0xc316, 0x0013); | ||
266 | efx_mdio_write(efx, 1, 0xc318, 0x0054); | ||
267 | efx_mdio_write(efx, 1, 0xc319, phy_op_mode); | ||
268 | efx_mdio_write(efx, 1, 0xc31a, 0x0098); | ||
269 | efx_mdio_write(efx, 3, 0x0026, 0x0e00); | ||
270 | efx_mdio_write(efx, 3, 0x0027, 0x0013); | ||
271 | efx_mdio_write(efx, 3, 0x0028, 0xa528); | ||
272 | efx_mdio_write(efx, 1, 0xd006, 0x000a); | ||
273 | efx_mdio_write(efx, 1, 0xd007, 0x0009); | ||
274 | efx_mdio_write(efx, 1, 0xd008, 0x0004); | ||
275 | /* This additional write is not present in the boot EEPROM. It | ||
276 | * prevents the PHY's internal boot ROM doing another pointless (and | ||
277 | * slow) reload of the firmware image (the microcontroller's code | ||
278 | * memory is not affected by the microcontroller reset). */ | ||
279 | efx_mdio_write(efx, 1, 0xc317, 0x00ff); | ||
280 | efx_mdio_write(efx, 1, 0xc300, 0x0002); | ||
281 | msleep(20); | ||
282 | |||
283 | /* Restart microcontroller execution of firmware from RAM */ | ||
284 | qt2025c_restart_firmware(efx); | ||
285 | |||
286 | /* Wait for the microcontroller to be ready again */ | ||
287 | rc = qt2025c_wait_reset(efx); | ||
288 | if (rc < 0) { | ||
289 | EFX_ERR(efx, "PHY microcontroller reset during mode switch " | ||
290 | "timed out\n"); | ||
291 | return rc; | ||
94 | } | 292 | } |
95 | 293 | ||
96 | return 0; | 294 | return 0; |
@@ -120,15 +318,9 @@ static int qt202x_reset_phy(struct efx_nic *efx) | |||
120 | /* Wait 250ms for the PHY to complete bootup */ | 318 | /* Wait 250ms for the PHY to complete bootup */ |
121 | msleep(250); | 319 | msleep(250); |
122 | 320 | ||
123 | /* Check that all the MMDs we expect are present and responding. We | ||
124 | * expect faults on some if the link is down, but not on the PHY XS */ | ||
125 | rc = efx_mdio_check_mmds(efx, QT202X_REQUIRED_DEVS, MDIO_DEVS_PHYXS); | ||
126 | if (rc < 0) | ||
127 | goto fail; | ||
128 | |||
129 | falcon_board(efx)->type->init_phy(efx); | 321 | falcon_board(efx)->type->init_phy(efx); |
130 | 322 | ||
131 | return rc; | 323 | return 0; |
132 | 324 | ||
133 | fail: | 325 | fail: |
134 | EFX_ERR(efx, "PHY reset timed out\n"); | 326 | EFX_ERR(efx, "PHY reset timed out\n"); |
@@ -137,6 +329,16 @@ static int qt202x_reset_phy(struct efx_nic *efx) | |||
137 | 329 | ||
138 | static int qt202x_phy_probe(struct efx_nic *efx) | 330 | static int qt202x_phy_probe(struct efx_nic *efx) |
139 | { | 331 | { |
332 | struct qt202x_phy_data *phy_data; | ||
333 | |||
334 | phy_data = kzalloc(sizeof(struct qt202x_phy_data), GFP_KERNEL); | ||
335 | if (!phy_data) | ||
336 | return -ENOMEM; | ||
337 | efx->phy_data = phy_data; | ||
338 | phy_data->phy_mode = efx->phy_mode; | ||
339 | phy_data->bug17190_in_bad_state = false; | ||
340 | phy_data->bug17190_timer = 0; | ||
341 | |||
140 | efx->mdio.mmds = QT202X_REQUIRED_DEVS; | 342 | efx->mdio.mmds = QT202X_REQUIRED_DEVS; |
141 | efx->mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22; | 343 | efx->mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22; |
142 | efx->loopback_modes = QT202X_LOOPBACKS | FALCON_XMAC_LOOPBACKS; | 344 | efx->loopback_modes = QT202X_LOOPBACKS | FALCON_XMAC_LOOPBACKS; |
@@ -145,7 +347,6 @@ static int qt202x_phy_probe(struct efx_nic *efx) | |||
145 | 347 | ||
146 | static int qt202x_phy_init(struct efx_nic *efx) | 348 | static int qt202x_phy_init(struct efx_nic *efx) |
147 | { | 349 | { |
148 | struct qt202x_phy_data *phy_data; | ||
149 | u32 devid; | 350 | u32 devid; |
150 | int rc; | 351 | int rc; |
151 | 352 | ||
@@ -155,17 +356,14 @@ static int qt202x_phy_init(struct efx_nic *efx) | |||
155 | return rc; | 356 | return rc; |
156 | } | 357 | } |
157 | 358 | ||
158 | phy_data = kzalloc(sizeof(struct qt202x_phy_data), GFP_KERNEL); | ||
159 | if (!phy_data) | ||
160 | return -ENOMEM; | ||
161 | efx->phy_data = phy_data; | ||
162 | |||
163 | devid = efx_mdio_read_id(efx, MDIO_MMD_PHYXS); | 359 | devid = efx_mdio_read_id(efx, MDIO_MMD_PHYXS); |
164 | EFX_INFO(efx, "PHY ID reg %x (OUI %06x model %02x revision %x)\n", | 360 | EFX_INFO(efx, "PHY ID reg %x (OUI %06x model %02x revision %x)\n", |
165 | devid, efx_mdio_id_oui(devid), efx_mdio_id_model(devid), | 361 | devid, efx_mdio_id_oui(devid), efx_mdio_id_model(devid), |
166 | efx_mdio_id_rev(devid)); | 362 | efx_mdio_id_rev(devid)); |
167 | 363 | ||
168 | phy_data->phy_mode = efx->phy_mode; | 364 | if (efx->phy_type == PHY_TYPE_QT2025C) |
365 | qt2025c_firmware_id(efx); | ||
366 | |||
169 | return 0; | 367 | return 0; |
170 | } | 368 | } |
171 | 369 | ||
@@ -183,6 +381,9 @@ static bool qt202x_phy_poll(struct efx_nic *efx) | |||
183 | efx->link_state.fd = true; | 381 | efx->link_state.fd = true; |
184 | efx->link_state.fc = efx->wanted_fc; | 382 | efx->link_state.fc = efx->wanted_fc; |
185 | 383 | ||
384 | if (efx->phy_type == PHY_TYPE_QT2025C) | ||
385 | qt2025c_bug17190_workaround(efx); | ||
386 | |||
186 | return efx->link_state.up != was_up; | 387 | return efx->link_state.up != was_up; |
187 | } | 388 | } |
188 | 389 | ||
@@ -191,6 +392,10 @@ static int qt202x_phy_reconfigure(struct efx_nic *efx) | |||
191 | struct qt202x_phy_data *phy_data = efx->phy_data; | 392 | struct qt202x_phy_data *phy_data = efx->phy_data; |
192 | 393 | ||
193 | if (efx->phy_type == PHY_TYPE_QT2025C) { | 394 | if (efx->phy_type == PHY_TYPE_QT2025C) { |
395 | int rc = qt2025c_select_phy_mode(efx); | ||
396 | if (rc) | ||
397 | return rc; | ||
398 | |||
194 | /* There are several different register bits which can | 399 | /* There are several different register bits which can |
195 | * disable TX (and save power) on direct-attach cables | 400 | * disable TX (and save power) on direct-attach cables |
196 | * or optical transceivers, varying somewhat between | 401 | * or optical transceivers, varying somewhat between |
@@ -224,7 +429,7 @@ static void qt202x_phy_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecm | |||
224 | mdio45_ethtool_gset(&efx->mdio, ecmd); | 429 | mdio45_ethtool_gset(&efx->mdio, ecmd); |
225 | } | 430 | } |
226 | 431 | ||
227 | static void qt202x_phy_fini(struct efx_nic *efx) | 432 | static void qt202x_phy_remove(struct efx_nic *efx) |
228 | { | 433 | { |
229 | /* Free the context block */ | 434 | /* Free the context block */ |
230 | kfree(efx->phy_data); | 435 | kfree(efx->phy_data); |
@@ -236,7 +441,8 @@ struct efx_phy_operations falcon_qt202x_phy_ops = { | |||
236 | .init = qt202x_phy_init, | 441 | .init = qt202x_phy_init, |
237 | .reconfigure = qt202x_phy_reconfigure, | 442 | .reconfigure = qt202x_phy_reconfigure, |
238 | .poll = qt202x_phy_poll, | 443 | .poll = qt202x_phy_poll, |
239 | .fini = qt202x_phy_fini, | 444 | .fini = efx_port_dummy_op_void, |
445 | .remove = qt202x_phy_remove, | ||
240 | .get_settings = qt202x_phy_get_settings, | 446 | .get_settings = qt202x_phy_get_settings, |
241 | .set_settings = efx_mdio_set_settings, | 447 | .set_settings = efx_mdio_set_settings, |
242 | }; | 448 | }; |
diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c index af3933579790..250c8827b842 100644 --- a/drivers/net/sfc/selftest.c +++ b/drivers/net/sfc/selftest.c | |||
@@ -79,10 +79,14 @@ struct efx_loopback_state { | |||
79 | static int efx_test_mdio(struct efx_nic *efx, struct efx_self_tests *tests) | 79 | static int efx_test_mdio(struct efx_nic *efx, struct efx_self_tests *tests) |
80 | { | 80 | { |
81 | int rc = 0; | 81 | int rc = 0; |
82 | int devad = __ffs(efx->mdio.mmds); | 82 | int devad; |
83 | u16 physid1, physid2; | 83 | u16 physid1, physid2; |
84 | 84 | ||
85 | if (efx->phy_type == PHY_TYPE_NONE) | 85 | if (efx->mdio.mode_support & MDIO_SUPPORTS_C45) |
86 | devad = __ffs(efx->mdio.mmds); | ||
87 | else if (efx->mdio.mode_support & MDIO_SUPPORTS_C22) | ||
88 | devad = MDIO_DEVAD_NONE; | ||
89 | else | ||
86 | return 0; | 90 | return 0; |
87 | 91 | ||
88 | mutex_lock(&efx->mac_lock); | 92 | mutex_lock(&efx->mac_lock); |
diff --git a/drivers/net/sfc/siena.c b/drivers/net/sfc/siena.c index de07a4f031b2..f8c6771e66d8 100644 --- a/drivers/net/sfc/siena.c +++ b/drivers/net/sfc/siena.c | |||
@@ -133,6 +133,7 @@ static int siena_probe_port(struct efx_nic *efx) | |||
133 | 133 | ||
134 | void siena_remove_port(struct efx_nic *efx) | 134 | void siena_remove_port(struct efx_nic *efx) |
135 | { | 135 | { |
136 | efx->phy_op->remove(efx); | ||
136 | efx_nic_free_buffer(efx, &efx->stats_buffer); | 137 | efx_nic_free_buffer(efx, &efx->stats_buffer); |
137 | } | 138 | } |
138 | 139 | ||
diff --git a/drivers/net/sfc/tenxpress.c b/drivers/net/sfc/tenxpress.c index ca11572a49a9..3009c297c135 100644 --- a/drivers/net/sfc/tenxpress.c +++ b/drivers/net/sfc/tenxpress.c | |||
@@ -202,10 +202,14 @@ static ssize_t set_phy_short_reach(struct device *dev, | |||
202 | int rc; | 202 | int rc; |
203 | 203 | ||
204 | rtnl_lock(); | 204 | rtnl_lock(); |
205 | efx_mdio_set_flag(efx, MDIO_MMD_PMAPMD, MDIO_PMA_10GBT_TXPWR, | 205 | if (efx->state != STATE_RUNNING) { |
206 | MDIO_PMA_10GBT_TXPWR_SHORT, | 206 | rc = -EBUSY; |
207 | count != 0 && *buf != '0'); | 207 | } else { |
208 | rc = efx_reconfigure_port(efx); | 208 | efx_mdio_set_flag(efx, MDIO_MMD_PMAPMD, MDIO_PMA_10GBT_TXPWR, |
209 | MDIO_PMA_10GBT_TXPWR_SHORT, | ||
210 | count != 0 && *buf != '0'); | ||
211 | rc = efx_reconfigure_port(efx); | ||
212 | } | ||
209 | rtnl_unlock(); | 213 | rtnl_unlock(); |
210 | 214 | ||
211 | return rc < 0 ? rc : (ssize_t)count; | 215 | return rc < 0 ? rc : (ssize_t)count; |
@@ -298,36 +302,62 @@ static int tenxpress_init(struct efx_nic *efx) | |||
298 | return 0; | 302 | return 0; |
299 | } | 303 | } |
300 | 304 | ||
301 | static int sfx7101_phy_probe(struct efx_nic *efx) | 305 | static int tenxpress_phy_probe(struct efx_nic *efx) |
302 | { | 306 | { |
303 | efx->mdio.mmds = TENXPRESS_REQUIRED_DEVS; | 307 | struct tenxpress_phy_data *phy_data; |
304 | efx->mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22; | 308 | int rc; |
305 | efx->loopback_modes = SFX7101_LOOPBACKS | FALCON_XMAC_LOOPBACKS; | 309 | |
306 | return 0; | 310 | /* Allocate phy private storage */ |
307 | } | 311 | phy_data = kzalloc(sizeof(*phy_data), GFP_KERNEL); |
312 | if (!phy_data) | ||
313 | return -ENOMEM; | ||
314 | efx->phy_data = phy_data; | ||
315 | phy_data->phy_mode = efx->phy_mode; | ||
316 | |||
317 | /* Create any special files */ | ||
318 | if (efx->phy_type == PHY_TYPE_SFT9001B) { | ||
319 | rc = device_create_file(&efx->pci_dev->dev, | ||
320 | &dev_attr_phy_short_reach); | ||
321 | if (rc) | ||
322 | goto fail; | ||
323 | } | ||
324 | |||
325 | if (efx->phy_type == PHY_TYPE_SFX7101) { | ||
326 | efx->mdio.mmds = TENXPRESS_REQUIRED_DEVS; | ||
327 | efx->mdio.mode_support = MDIO_SUPPORTS_C45; | ||
328 | |||
329 | efx->loopback_modes = SFX7101_LOOPBACKS | FALCON_XMAC_LOOPBACKS; | ||
330 | |||
331 | efx->link_advertising = (ADVERTISED_TP | ADVERTISED_Autoneg | | ||
332 | ADVERTISED_10000baseT_Full); | ||
333 | } else { | ||
334 | efx->mdio.mmds = TENXPRESS_REQUIRED_DEVS; | ||
335 | efx->mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22; | ||
336 | |||
337 | efx->loopback_modes = (SFT9001_LOOPBACKS | | ||
338 | FALCON_XMAC_LOOPBACKS | | ||
339 | FALCON_GMAC_LOOPBACKS); | ||
340 | |||
341 | efx->link_advertising = (ADVERTISED_TP | ADVERTISED_Autoneg | | ||
342 | ADVERTISED_10000baseT_Full | | ||
343 | ADVERTISED_1000baseT_Full | | ||
344 | ADVERTISED_100baseT_Full); | ||
345 | } | ||
308 | 346 | ||
309 | static int sft9001_phy_probe(struct efx_nic *efx) | ||
310 | { | ||
311 | efx->mdio.mmds = TENXPRESS_REQUIRED_DEVS; | ||
312 | efx->mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22; | ||
313 | efx->loopback_modes = (SFT9001_LOOPBACKS | FALCON_XMAC_LOOPBACKS | | ||
314 | FALCON_GMAC_LOOPBACKS); | ||
315 | return 0; | 347 | return 0; |
348 | |||
349 | fail: | ||
350 | kfree(efx->phy_data); | ||
351 | efx->phy_data = NULL; | ||
352 | return rc; | ||
316 | } | 353 | } |
317 | 354 | ||
318 | static int tenxpress_phy_init(struct efx_nic *efx) | 355 | static int tenxpress_phy_init(struct efx_nic *efx) |
319 | { | 356 | { |
320 | struct tenxpress_phy_data *phy_data; | 357 | int rc; |
321 | int rc = 0; | ||
322 | 358 | ||
323 | falcon_board(efx)->type->init_phy(efx); | 359 | falcon_board(efx)->type->init_phy(efx); |
324 | 360 | ||
325 | phy_data = kzalloc(sizeof(*phy_data), GFP_KERNEL); | ||
326 | if (!phy_data) | ||
327 | return -ENOMEM; | ||
328 | efx->phy_data = phy_data; | ||
329 | phy_data->phy_mode = efx->phy_mode; | ||
330 | |||
331 | if (!(efx->phy_mode & PHY_MODE_SPECIAL)) { | 361 | if (!(efx->phy_mode & PHY_MODE_SPECIAL)) { |
332 | if (efx->phy_type == PHY_TYPE_SFT9001A) { | 362 | if (efx->phy_type == PHY_TYPE_SFT9001A) { |
333 | int reg; | 363 | int reg; |
@@ -341,44 +371,27 @@ static int tenxpress_phy_init(struct efx_nic *efx) | |||
341 | 371 | ||
342 | rc = efx_mdio_wait_reset_mmds(efx, TENXPRESS_REQUIRED_DEVS); | 372 | rc = efx_mdio_wait_reset_mmds(efx, TENXPRESS_REQUIRED_DEVS); |
343 | if (rc < 0) | 373 | if (rc < 0) |
344 | goto fail; | 374 | return rc; |
345 | 375 | ||
346 | rc = efx_mdio_check_mmds(efx, TENXPRESS_REQUIRED_DEVS, 0); | 376 | rc = efx_mdio_check_mmds(efx, TENXPRESS_REQUIRED_DEVS, 0); |
347 | if (rc < 0) | 377 | if (rc < 0) |
348 | goto fail; | 378 | return rc; |
349 | } | 379 | } |
350 | 380 | ||
351 | rc = tenxpress_init(efx); | 381 | rc = tenxpress_init(efx); |
352 | if (rc < 0) | 382 | if (rc < 0) |
353 | goto fail; | 383 | return rc; |
354 | 384 | ||
355 | /* Initialise advertising flags */ | 385 | /* Reinitialise flow control settings */ |
356 | efx->link_advertising = (ADVERTISED_TP | ADVERTISED_Autoneg | | ||
357 | ADVERTISED_10000baseT_Full); | ||
358 | if (efx->phy_type != PHY_TYPE_SFX7101) | ||
359 | efx->link_advertising |= (ADVERTISED_1000baseT_Full | | ||
360 | ADVERTISED_100baseT_Full); | ||
361 | efx_link_set_wanted_fc(efx, efx->wanted_fc); | 386 | efx_link_set_wanted_fc(efx, efx->wanted_fc); |
362 | efx_mdio_an_reconfigure(efx); | 387 | efx_mdio_an_reconfigure(efx); |
363 | 388 | ||
364 | if (efx->phy_type == PHY_TYPE_SFT9001B) { | ||
365 | rc = device_create_file(&efx->pci_dev->dev, | ||
366 | &dev_attr_phy_short_reach); | ||
367 | if (rc) | ||
368 | goto fail; | ||
369 | } | ||
370 | |||
371 | schedule_timeout_uninterruptible(HZ / 5); /* 200ms */ | 389 | schedule_timeout_uninterruptible(HZ / 5); /* 200ms */ |
372 | 390 | ||
373 | /* Let XGXS and SerDes out of reset */ | 391 | /* Let XGXS and SerDes out of reset */ |
374 | falcon_reset_xaui(efx); | 392 | falcon_reset_xaui(efx); |
375 | 393 | ||
376 | return 0; | 394 | return 0; |
377 | |||
378 | fail: | ||
379 | kfree(efx->phy_data); | ||
380 | efx->phy_data = NULL; | ||
381 | return rc; | ||
382 | } | 395 | } |
383 | 396 | ||
384 | /* Perform a "special software reset" on the PHY. The caller is | 397 | /* Perform a "special software reset" on the PHY. The caller is |
@@ -589,25 +602,26 @@ static bool tenxpress_phy_poll(struct efx_nic *efx) | |||
589 | return !efx_link_state_equal(&efx->link_state, &old_state); | 602 | return !efx_link_state_equal(&efx->link_state, &old_state); |
590 | } | 603 | } |
591 | 604 | ||
592 | static void tenxpress_phy_fini(struct efx_nic *efx) | 605 | static void sfx7101_phy_fini(struct efx_nic *efx) |
593 | { | 606 | { |
594 | int reg; | 607 | int reg; |
595 | 608 | ||
609 | /* Power down the LNPGA */ | ||
610 | reg = (1 << PMA_PMD_LNPGA_POWERDOWN_LBN); | ||
611 | efx_mdio_write(efx, MDIO_MMD_PMAPMD, PMA_PMD_XCONTROL_REG, reg); | ||
612 | |||
613 | /* Waiting here ensures that the board fini, which can turn | ||
614 | * off the power to the PHY, won't get run until the LNPGA | ||
615 | * powerdown has been given long enough to complete. */ | ||
616 | schedule_timeout_uninterruptible(LNPGA_PDOWN_WAIT); /* 200 ms */ | ||
617 | } | ||
618 | |||
619 | static void tenxpress_phy_remove(struct efx_nic *efx) | ||
620 | { | ||
596 | if (efx->phy_type == PHY_TYPE_SFT9001B) | 621 | if (efx->phy_type == PHY_TYPE_SFT9001B) |
597 | device_remove_file(&efx->pci_dev->dev, | 622 | device_remove_file(&efx->pci_dev->dev, |
598 | &dev_attr_phy_short_reach); | 623 | &dev_attr_phy_short_reach); |
599 | 624 | ||
600 | if (efx->phy_type == PHY_TYPE_SFX7101) { | ||
601 | /* Power down the LNPGA */ | ||
602 | reg = (1 << PMA_PMD_LNPGA_POWERDOWN_LBN); | ||
603 | efx_mdio_write(efx, MDIO_MMD_PMAPMD, PMA_PMD_XCONTROL_REG, reg); | ||
604 | |||
605 | /* Waiting here ensures that the board fini, which can turn | ||
606 | * off the power to the PHY, won't get run until the LNPGA | ||
607 | * powerdown has been given long enough to complete. */ | ||
608 | schedule_timeout_uninterruptible(LNPGA_PDOWN_WAIT); /* 200 ms */ | ||
609 | } | ||
610 | |||
611 | kfree(efx->phy_data); | 625 | kfree(efx->phy_data); |
612 | efx->phy_data = NULL; | 626 | efx->phy_data = NULL; |
613 | } | 627 | } |
@@ -819,11 +833,12 @@ static void sft9001_set_npage_adv(struct efx_nic *efx, u32 advertising) | |||
819 | } | 833 | } |
820 | 834 | ||
821 | struct efx_phy_operations falcon_sfx7101_phy_ops = { | 835 | struct efx_phy_operations falcon_sfx7101_phy_ops = { |
822 | .probe = sfx7101_phy_probe, | 836 | .probe = tenxpress_phy_probe, |
823 | .init = tenxpress_phy_init, | 837 | .init = tenxpress_phy_init, |
824 | .reconfigure = tenxpress_phy_reconfigure, | 838 | .reconfigure = tenxpress_phy_reconfigure, |
825 | .poll = tenxpress_phy_poll, | 839 | .poll = tenxpress_phy_poll, |
826 | .fini = tenxpress_phy_fini, | 840 | .fini = sfx7101_phy_fini, |
841 | .remove = tenxpress_phy_remove, | ||
827 | .get_settings = tenxpress_get_settings, | 842 | .get_settings = tenxpress_get_settings, |
828 | .set_settings = tenxpress_set_settings, | 843 | .set_settings = tenxpress_set_settings, |
829 | .set_npage_adv = sfx7101_set_npage_adv, | 844 | .set_npage_adv = sfx7101_set_npage_adv, |
@@ -832,11 +847,12 @@ struct efx_phy_operations falcon_sfx7101_phy_ops = { | |||
832 | }; | 847 | }; |
833 | 848 | ||
834 | struct efx_phy_operations falcon_sft9001_phy_ops = { | 849 | struct efx_phy_operations falcon_sft9001_phy_ops = { |
835 | .probe = sft9001_phy_probe, | 850 | .probe = tenxpress_phy_probe, |
836 | .init = tenxpress_phy_init, | 851 | .init = tenxpress_phy_init, |
837 | .reconfigure = tenxpress_phy_reconfigure, | 852 | .reconfigure = tenxpress_phy_reconfigure, |
838 | .poll = tenxpress_phy_poll, | 853 | .poll = tenxpress_phy_poll, |
839 | .fini = tenxpress_phy_fini, | 854 | .fini = efx_port_dummy_op_void, |
855 | .remove = tenxpress_phy_remove, | ||
840 | .get_settings = tenxpress_get_settings, | 856 | .get_settings = tenxpress_get_settings, |
841 | .set_settings = tenxpress_set_settings, | 857 | .set_settings = tenxpress_set_settings, |
842 | .set_npage_adv = sft9001_set_npage_adv, | 858 | .set_npage_adv = sft9001_set_npage_adv, |
diff --git a/drivers/net/sfc/tx.c b/drivers/net/sfc/tx.c index e669f94e821b..a8b70ef6d817 100644 --- a/drivers/net/sfc/tx.c +++ b/drivers/net/sfc/tx.c | |||
@@ -821,8 +821,6 @@ static void efx_enqueue_unwind(struct efx_tx_queue *tx_queue) | |||
821 | EFX_TXQ_MASK]; | 821 | EFX_TXQ_MASK]; |
822 | efx_tsoh_free(tx_queue, buffer); | 822 | efx_tsoh_free(tx_queue, buffer); |
823 | EFX_BUG_ON_PARANOID(buffer->skb); | 823 | EFX_BUG_ON_PARANOID(buffer->skb); |
824 | buffer->len = 0; | ||
825 | buffer->continuation = true; | ||
826 | if (buffer->unmap_len) { | 824 | if (buffer->unmap_len) { |
827 | unmap_addr = (buffer->dma_addr + buffer->len - | 825 | unmap_addr = (buffer->dma_addr + buffer->len - |
828 | buffer->unmap_len); | 826 | buffer->unmap_len); |
@@ -836,6 +834,8 @@ static void efx_enqueue_unwind(struct efx_tx_queue *tx_queue) | |||
836 | PCI_DMA_TODEVICE); | 834 | PCI_DMA_TODEVICE); |
837 | buffer->unmap_len = 0; | 835 | buffer->unmap_len = 0; |
838 | } | 836 | } |
837 | buffer->len = 0; | ||
838 | buffer->continuation = true; | ||
839 | } | 839 | } |
840 | } | 840 | } |
841 | 841 | ||
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index ca6285016dfd..7402b858cab7 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c | |||
@@ -110,7 +110,7 @@ static void sh_eth_reset(struct net_device *ndev) | |||
110 | mdelay(1); | 110 | mdelay(1); |
111 | cnt--; | 111 | cnt--; |
112 | } | 112 | } |
113 | if (cnt < 0) | 113 | if (cnt == 0) |
114 | printk(KERN_ERR "Device reset fail\n"); | 114 | printk(KERN_ERR "Device reset fail\n"); |
115 | 115 | ||
116 | /* Table Init */ | 116 | /* Table Init */ |
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 1c01b96c9611..67249c3c9f50 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -644,6 +644,7 @@ static void sky2_phy_power_up(struct sky2_hw *hw, unsigned port) | |||
644 | { | 644 | { |
645 | u32 reg1; | 645 | u32 reg1; |
646 | 646 | ||
647 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | ||
647 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); | 648 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); |
648 | reg1 &= ~phy_power[port]; | 649 | reg1 &= ~phy_power[port]; |
649 | 650 | ||
@@ -651,6 +652,7 @@ static void sky2_phy_power_up(struct sky2_hw *hw, unsigned port) | |||
651 | reg1 |= coma_mode[port]; | 652 | reg1 |= coma_mode[port]; |
652 | 653 | ||
653 | sky2_pci_write32(hw, PCI_DEV_REG1, reg1); | 654 | sky2_pci_write32(hw, PCI_DEV_REG1, reg1); |
655 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | ||
654 | sky2_pci_read32(hw, PCI_DEV_REG1); | 656 | sky2_pci_read32(hw, PCI_DEV_REG1); |
655 | 657 | ||
656 | if (hw->chip_id == CHIP_ID_YUKON_FE) | 658 | if (hw->chip_id == CHIP_ID_YUKON_FE) |
@@ -707,9 +709,11 @@ static void sky2_phy_power_down(struct sky2_hw *hw, unsigned port) | |||
707 | gm_phy_write(hw, port, PHY_MARV_CTRL, PHY_CT_PDOWN); | 709 | gm_phy_write(hw, port, PHY_MARV_CTRL, PHY_CT_PDOWN); |
708 | } | 710 | } |
709 | 711 | ||
712 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | ||
710 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); | 713 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); |
711 | reg1 |= phy_power[port]; /* set PHY to PowerDown/COMA Mode */ | 714 | reg1 |= phy_power[port]; /* set PHY to PowerDown/COMA Mode */ |
712 | sky2_pci_write32(hw, PCI_DEV_REG1, reg1); | 715 | sky2_pci_write32(hw, PCI_DEV_REG1, reg1); |
716 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | ||
713 | } | 717 | } |
714 | 718 | ||
715 | /* Force a renegotiation */ | 719 | /* Force a renegotiation */ |
@@ -1021,11 +1025,8 @@ static void sky2_prefetch_init(struct sky2_hw *hw, u32 qaddr, | |||
1021 | static inline struct sky2_tx_le *get_tx_le(struct sky2_port *sky2, u16 *slot) | 1025 | static inline struct sky2_tx_le *get_tx_le(struct sky2_port *sky2, u16 *slot) |
1022 | { | 1026 | { |
1023 | struct sky2_tx_le *le = sky2->tx_le + *slot; | 1027 | struct sky2_tx_le *le = sky2->tx_le + *slot; |
1024 | struct tx_ring_info *re = sky2->tx_ring + *slot; | ||
1025 | 1028 | ||
1026 | *slot = RING_NEXT(*slot, sky2->tx_ring_size); | 1029 | *slot = RING_NEXT(*slot, sky2->tx_ring_size); |
1027 | re->flags = 0; | ||
1028 | re->skb = NULL; | ||
1029 | le->ctrl = 0; | 1030 | le->ctrl = 0; |
1030 | return le; | 1031 | return le; |
1031 | } | 1032 | } |
@@ -1618,8 +1619,7 @@ static unsigned tx_le_req(const struct sk_buff *skb) | |||
1618 | return count; | 1619 | return count; |
1619 | } | 1620 | } |
1620 | 1621 | ||
1621 | static void sky2_tx_unmap(struct pci_dev *pdev, | 1622 | static void sky2_tx_unmap(struct pci_dev *pdev, struct tx_ring_info *re) |
1622 | const struct tx_ring_info *re) | ||
1623 | { | 1623 | { |
1624 | if (re->flags & TX_MAP_SINGLE) | 1624 | if (re->flags & TX_MAP_SINGLE) |
1625 | pci_unmap_single(pdev, pci_unmap_addr(re, mapaddr), | 1625 | pci_unmap_single(pdev, pci_unmap_addr(re, mapaddr), |
@@ -1629,6 +1629,7 @@ static void sky2_tx_unmap(struct pci_dev *pdev, | |||
1629 | pci_unmap_page(pdev, pci_unmap_addr(re, mapaddr), | 1629 | pci_unmap_page(pdev, pci_unmap_addr(re, mapaddr), |
1630 | pci_unmap_len(re, maplen), | 1630 | pci_unmap_len(re, maplen), |
1631 | PCI_DMA_TODEVICE); | 1631 | PCI_DMA_TODEVICE); |
1632 | re->flags = 0; | ||
1632 | } | 1633 | } |
1633 | 1634 | ||
1634 | /* | 1635 | /* |
@@ -1835,6 +1836,7 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done) | |||
1835 | dev->stats.tx_packets++; | 1836 | dev->stats.tx_packets++; |
1836 | dev->stats.tx_bytes += skb->len; | 1837 | dev->stats.tx_bytes += skb->len; |
1837 | 1838 | ||
1839 | re->skb = NULL; | ||
1838 | dev_kfree_skb_any(skb); | 1840 | dev_kfree_skb_any(skb); |
1839 | 1841 | ||
1840 | sky2->tx_next = RING_NEXT(idx, sky2->tx_ring_size); | 1842 | sky2->tx_next = RING_NEXT(idx, sky2->tx_ring_size); |
@@ -1844,7 +1846,8 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done) | |||
1844 | sky2->tx_cons = idx; | 1846 | sky2->tx_cons = idx; |
1845 | smp_mb(); | 1847 | smp_mb(); |
1846 | 1848 | ||
1847 | if (tx_avail(sky2) > MAX_SKB_TX_LE + 4) | 1849 | /* Wake unless it's detached, and called e.g. from sky2_down() */ |
1850 | if (tx_avail(sky2) > MAX_SKB_TX_LE + 4 && netif_device_present(dev)) | ||
1848 | netif_wake_queue(dev); | 1851 | netif_wake_queue(dev); |
1849 | } | 1852 | } |
1850 | 1853 | ||
@@ -2148,7 +2151,9 @@ static void sky2_qlink_intr(struct sky2_hw *hw) | |||
2148 | 2151 | ||
2149 | /* reset PHY Link Detect */ | 2152 | /* reset PHY Link Detect */ |
2150 | phy = sky2_pci_read16(hw, PSM_CONFIG_REG4); | 2153 | phy = sky2_pci_read16(hw, PSM_CONFIG_REG4); |
2154 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | ||
2151 | sky2_pci_write16(hw, PSM_CONFIG_REG4, phy | 1); | 2155 | sky2_pci_write16(hw, PSM_CONFIG_REG4, phy | 1); |
2156 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | ||
2152 | 2157 | ||
2153 | sky2_link_up(sky2); | 2158 | sky2_link_up(sky2); |
2154 | } | 2159 | } |
@@ -2639,6 +2644,7 @@ static void sky2_hw_intr(struct sky2_hw *hw) | |||
2639 | if (status & (Y2_IS_MST_ERR | Y2_IS_IRQ_STAT)) { | 2644 | if (status & (Y2_IS_MST_ERR | Y2_IS_IRQ_STAT)) { |
2640 | u16 pci_err; | 2645 | u16 pci_err; |
2641 | 2646 | ||
2647 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | ||
2642 | pci_err = sky2_pci_read16(hw, PCI_STATUS); | 2648 | pci_err = sky2_pci_read16(hw, PCI_STATUS); |
2643 | if (net_ratelimit()) | 2649 | if (net_ratelimit()) |
2644 | dev_err(&pdev->dev, "PCI hardware error (0x%x)\n", | 2650 | dev_err(&pdev->dev, "PCI hardware error (0x%x)\n", |
@@ -2646,12 +2652,14 @@ static void sky2_hw_intr(struct sky2_hw *hw) | |||
2646 | 2652 | ||
2647 | sky2_pci_write16(hw, PCI_STATUS, | 2653 | sky2_pci_write16(hw, PCI_STATUS, |
2648 | pci_err | PCI_STATUS_ERROR_BITS); | 2654 | pci_err | PCI_STATUS_ERROR_BITS); |
2655 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | ||
2649 | } | 2656 | } |
2650 | 2657 | ||
2651 | if (status & Y2_IS_PCI_EXP) { | 2658 | if (status & Y2_IS_PCI_EXP) { |
2652 | /* PCI-Express uncorrectable Error occurred */ | 2659 | /* PCI-Express uncorrectable Error occurred */ |
2653 | u32 err; | 2660 | u32 err; |
2654 | 2661 | ||
2662 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | ||
2655 | err = sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS); | 2663 | err = sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS); |
2656 | sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS, | 2664 | sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS, |
2657 | 0xfffffffful); | 2665 | 0xfffffffful); |
@@ -2659,6 +2667,7 @@ static void sky2_hw_intr(struct sky2_hw *hw) | |||
2659 | dev_err(&pdev->dev, "PCI Express error (0x%x)\n", err); | 2667 | dev_err(&pdev->dev, "PCI Express error (0x%x)\n", err); |
2660 | 2668 | ||
2661 | sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS); | 2669 | sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS); |
2670 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | ||
2662 | } | 2671 | } |
2663 | 2672 | ||
2664 | if (status & Y2_HWE_L1_MASK) | 2673 | if (status & Y2_HWE_L1_MASK) |
@@ -3037,6 +3046,7 @@ static void sky2_reset(struct sky2_hw *hw) | |||
3037 | } | 3046 | } |
3038 | 3047 | ||
3039 | sky2_power_on(hw); | 3048 | sky2_power_on(hw); |
3049 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | ||
3040 | 3050 | ||
3041 | for (i = 0; i < hw->ports; i++) { | 3051 | for (i = 0; i < hw->ports; i++) { |
3042 | sky2_write8(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_SET); | 3052 | sky2_write8(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_SET); |
@@ -3073,6 +3083,7 @@ static void sky2_reset(struct sky2_hw *hw) | |||
3073 | reg <<= PSM_CONFIG_REG4_TIMER_PHY_LINK_DETECT_BASE; | 3083 | reg <<= PSM_CONFIG_REG4_TIMER_PHY_LINK_DETECT_BASE; |
3074 | 3084 | ||
3075 | /* reset PHY Link Detect */ | 3085 | /* reset PHY Link Detect */ |
3086 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | ||
3076 | sky2_pci_write16(hw, PSM_CONFIG_REG4, | 3087 | sky2_pci_write16(hw, PSM_CONFIG_REG4, |
3077 | reg | PSM_CONFIG_REG4_RST_PHY_LINK_DETECT); | 3088 | reg | PSM_CONFIG_REG4_RST_PHY_LINK_DETECT); |
3078 | sky2_pci_write16(hw, PSM_CONFIG_REG4, reg); | 3089 | sky2_pci_write16(hw, PSM_CONFIG_REG4, reg); |
@@ -3090,6 +3101,7 @@ static void sky2_reset(struct sky2_hw *hw) | |||
3090 | /* restore the PCIe Link Control register */ | 3101 | /* restore the PCIe Link Control register */ |
3091 | sky2_pci_write16(hw, cap + PCI_EXP_LNKCTL, reg); | 3102 | sky2_pci_write16(hw, cap + PCI_EXP_LNKCTL, reg); |
3092 | } | 3103 | } |
3104 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | ||
3093 | 3105 | ||
3094 | /* re-enable PEX PM in PEX PHY debug reg. 8 (clear bit 12) */ | 3106 | /* re-enable PEX PM in PEX PHY debug reg. 8 (clear bit 12) */ |
3095 | sky2_write32(hw, Y2_PEX_PHY_DATA, PEX_DB_ACCESS | (0x08UL << 16)); | 3107 | sky2_write32(hw, Y2_PEX_PHY_DATA, PEX_DB_ACCESS | (0x08UL << 16)); |
@@ -3227,6 +3239,27 @@ static inline u8 sky2_wol_supported(const struct sky2_hw *hw) | |||
3227 | return sky2_is_copper(hw) ? (WAKE_PHY | WAKE_MAGIC) : 0; | 3239 | return sky2_is_copper(hw) ? (WAKE_PHY | WAKE_MAGIC) : 0; |
3228 | } | 3240 | } |
3229 | 3241 | ||
3242 | static void sky2_hw_set_wol(struct sky2_hw *hw) | ||
3243 | { | ||
3244 | int wol = 0; | ||
3245 | int i; | ||
3246 | |||
3247 | for (i = 0; i < hw->ports; i++) { | ||
3248 | struct net_device *dev = hw->dev[i]; | ||
3249 | struct sky2_port *sky2 = netdev_priv(dev); | ||
3250 | |||
3251 | if (sky2->wol) | ||
3252 | wol = 1; | ||
3253 | } | ||
3254 | |||
3255 | if (hw->chip_id == CHIP_ID_YUKON_EC_U || | ||
3256 | hw->chip_id == CHIP_ID_YUKON_EX || | ||
3257 | hw->chip_id == CHIP_ID_YUKON_FE_P) | ||
3258 | sky2_write32(hw, B0_CTST, wol ? Y2_HW_WOL_ON : Y2_HW_WOL_OFF); | ||
3259 | |||
3260 | device_set_wakeup_enable(&hw->pdev->dev, wol); | ||
3261 | } | ||
3262 | |||
3230 | static void sky2_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | 3263 | static void sky2_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) |
3231 | { | 3264 | { |
3232 | const struct sky2_port *sky2 = netdev_priv(dev); | 3265 | const struct sky2_port *sky2 = netdev_priv(dev); |
@@ -3246,13 +3279,7 @@ static int sky2_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
3246 | 3279 | ||
3247 | sky2->wol = wol->wolopts; | 3280 | sky2->wol = wol->wolopts; |
3248 | 3281 | ||
3249 | if (hw->chip_id == CHIP_ID_YUKON_EC_U || | 3282 | sky2_hw_set_wol(hw); |
3250 | hw->chip_id == CHIP_ID_YUKON_EX || | ||
3251 | hw->chip_id == CHIP_ID_YUKON_FE_P) | ||
3252 | sky2_write32(hw, B0_CTST, sky2->wol | ||
3253 | ? Y2_HW_WOL_ON : Y2_HW_WOL_OFF); | ||
3254 | |||
3255 | device_set_wakeup_enable(&hw->pdev->dev, sky2->wol); | ||
3256 | 3283 | ||
3257 | if (!netif_running(dev)) | 3284 | if (!netif_running(dev)) |
3258 | sky2_wol_init(sky2); | 3285 | sky2_wol_init(sky2); |
@@ -4684,6 +4711,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
4684 | INIT_WORK(&hw->restart_work, sky2_restart); | 4711 | INIT_WORK(&hw->restart_work, sky2_restart); |
4685 | 4712 | ||
4686 | pci_set_drvdata(pdev, hw); | 4713 | pci_set_drvdata(pdev, hw); |
4714 | pdev->d3_delay = 150; | ||
4687 | 4715 | ||
4688 | return 0; | 4716 | return 0; |
4689 | 4717 | ||
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c index 95db60adde41..f9521136a869 100644 --- a/drivers/net/starfire.c +++ b/drivers/net/starfire.c | |||
@@ -1063,7 +1063,7 @@ static int netdev_open(struct net_device *dev) | |||
1063 | if (retval) { | 1063 | if (retval) { |
1064 | printk(KERN_ERR "starfire: Failed to load firmware \"%s\"\n", | 1064 | printk(KERN_ERR "starfire: Failed to load firmware \"%s\"\n", |
1065 | FIRMWARE_RX); | 1065 | FIRMWARE_RX); |
1066 | return retval; | 1066 | goto out_init; |
1067 | } | 1067 | } |
1068 | if (fw_rx->size % 4) { | 1068 | if (fw_rx->size % 4) { |
1069 | printk(KERN_ERR "starfire: bogus length %zu in \"%s\"\n", | 1069 | printk(KERN_ERR "starfire: bogus length %zu in \"%s\"\n", |
@@ -1108,6 +1108,9 @@ out_tx: | |||
1108 | release_firmware(fw_tx); | 1108 | release_firmware(fw_tx); |
1109 | out_rx: | 1109 | out_rx: |
1110 | release_firmware(fw_rx); | 1110 | release_firmware(fw_rx); |
1111 | out_init: | ||
1112 | if (retval) | ||
1113 | netdev_close(dev); | ||
1111 | return retval; | 1114 | return retval; |
1112 | } | 1115 | } |
1113 | 1116 | ||
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c index 75a669d48e5e..d71c1976072e 100644 --- a/drivers/net/tc35815.c +++ b/drivers/net/tc35815.c | |||
@@ -1437,7 +1437,6 @@ static int tc35815_do_interrupt(struct net_device *dev, u32 status, int limit) | |||
1437 | /* Transmit complete. */ | 1437 | /* Transmit complete. */ |
1438 | lp->lstats.tx_ints++; | 1438 | lp->lstats.tx_ints++; |
1439 | tc35815_txdone(dev); | 1439 | tc35815_txdone(dev); |
1440 | netif_wake_queue(dev); | ||
1441 | if (ret < 0) | 1440 | if (ret < 0) |
1442 | ret = 0; | 1441 | ret = 0; |
1443 | } | 1442 | } |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 3a74d2168598..7f82b0238e08 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Copyright (C) 2001, 2002, 2003, 2004 David S. Miller (davem@redhat.com) | 4 | * Copyright (C) 2001, 2002, 2003, 2004 David S. Miller (davem@redhat.com) |
5 | * Copyright (C) 2001, 2002, 2003 Jeff Garzik (jgarzik@pobox.com) | 5 | * Copyright (C) 2001, 2002, 2003 Jeff Garzik (jgarzik@pobox.com) |
6 | * Copyright (C) 2004 Sun Microsystems Inc. | 6 | * Copyright (C) 2004 Sun Microsystems Inc. |
7 | * Copyright (C) 2005-2009 Broadcom Corporation. | 7 | * Copyright (C) 2005-2010 Broadcom Corporation. |
8 | * | 8 | * |
9 | * Firmware is: | 9 | * Firmware is: |
10 | * Derived from proprietary unpublished source code, | 10 | * Derived from proprietary unpublished source code, |
@@ -68,8 +68,8 @@ | |||
68 | 68 | ||
69 | #define DRV_MODULE_NAME "tg3" | 69 | #define DRV_MODULE_NAME "tg3" |
70 | #define PFX DRV_MODULE_NAME ": " | 70 | #define PFX DRV_MODULE_NAME ": " |
71 | #define DRV_MODULE_VERSION "3.105" | 71 | #define DRV_MODULE_VERSION "3.106" |
72 | #define DRV_MODULE_RELDATE "December 2, 2009" | 72 | #define DRV_MODULE_RELDATE "January 12, 2010" |
73 | 73 | ||
74 | #define TG3_DEF_MAC_MODE 0 | 74 | #define TG3_DEF_MAC_MODE 0 |
75 | #define TG3_DEF_RX_MODE 0 | 75 | #define TG3_DEF_RX_MODE 0 |
@@ -1037,7 +1037,11 @@ static void tg3_mdio_start(struct tg3 *tp) | |||
1037 | else | 1037 | else |
1038 | tp->phy_addr = 1; | 1038 | tp->phy_addr = 1; |
1039 | 1039 | ||
1040 | is_serdes = tr32(SG_DIG_STATUS) & SG_DIG_IS_SERDES; | 1040 | if (tp->pci_chip_rev_id != CHIPREV_ID_5717_A0) |
1041 | is_serdes = tr32(SG_DIG_STATUS) & SG_DIG_IS_SERDES; | ||
1042 | else | ||
1043 | is_serdes = tr32(TG3_CPMU_PHY_STRAP) & | ||
1044 | TG3_CPMU_PHY_STRAP_IS_SERDES; | ||
1041 | if (is_serdes) | 1045 | if (is_serdes) |
1042 | tp->phy_addr += 7; | 1046 | tp->phy_addr += 7; |
1043 | } else | 1047 | } else |
@@ -4693,8 +4697,9 @@ next_pkt: | |||
4693 | (*post_ptr)++; | 4697 | (*post_ptr)++; |
4694 | 4698 | ||
4695 | if (unlikely(rx_std_posted >= tp->rx_std_max_post)) { | 4699 | if (unlikely(rx_std_posted >= tp->rx_std_max_post)) { |
4696 | u32 idx = *post_ptr % TG3_RX_RING_SIZE; | 4700 | tpr->rx_std_prod_idx = std_prod_idx % TG3_RX_RING_SIZE; |
4697 | tw32_rx_mbox(TG3_RX_STD_PROD_IDX_REG, idx); | 4701 | tw32_rx_mbox(TG3_RX_STD_PROD_IDX_REG, |
4702 | tpr->rx_std_prod_idx); | ||
4698 | work_mask &= ~RXD_OPAQUE_RING_STD; | 4703 | work_mask &= ~RXD_OPAQUE_RING_STD; |
4699 | rx_std_posted = 0; | 4704 | rx_std_posted = 0; |
4700 | } | 4705 | } |
@@ -7742,7 +7747,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
7742 | ((u64) tpr->rx_std_mapping >> 32)); | 7747 | ((u64) tpr->rx_std_mapping >> 32)); |
7743 | tw32(RCVDBDI_STD_BD + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_LOW, | 7748 | tw32(RCVDBDI_STD_BD + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_LOW, |
7744 | ((u64) tpr->rx_std_mapping & 0xffffffff)); | 7749 | ((u64) tpr->rx_std_mapping & 0xffffffff)); |
7745 | if (!(tp->tg3_flags3 & TG3_FLG3_5755_PLUS)) | 7750 | if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5717) |
7746 | tw32(RCVDBDI_STD_BD + TG3_BDINFO_NIC_ADDR, | 7751 | tw32(RCVDBDI_STD_BD + TG3_BDINFO_NIC_ADDR, |
7747 | NIC_SRAM_RX_BUFFER_DESC); | 7752 | NIC_SRAM_RX_BUFFER_DESC); |
7748 | 7753 | ||
@@ -12122,7 +12127,8 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp) | |||
12122 | 12127 | ||
12123 | tp->phy_id = eeprom_phy_id; | 12128 | tp->phy_id = eeprom_phy_id; |
12124 | if (eeprom_phy_serdes) { | 12129 | if (eeprom_phy_serdes) { |
12125 | if (tp->tg3_flags2 & TG3_FLG2_5780_CLASS) | 12130 | if ((tp->tg3_flags2 & TG3_FLG2_5780_CLASS) || |
12131 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) | ||
12126 | tp->tg3_flags2 |= TG3_FLG2_MII_SERDES; | 12132 | tp->tg3_flags2 |= TG3_FLG2_MII_SERDES; |
12127 | else | 12133 | else |
12128 | tp->tg3_flags2 |= TG3_FLG2_PHY_SERDES; | 12134 | tp->tg3_flags2 |= TG3_FLG2_PHY_SERDES; |
@@ -13384,6 +13390,11 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
13384 | if (err) | 13390 | if (err) |
13385 | return err; | 13391 | return err; |
13386 | 13392 | ||
13393 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 && | ||
13394 | (tp->pci_chip_rev_id != CHIPREV_ID_5717_A0 || | ||
13395 | (tp->tg3_flags2 & TG3_FLG2_MII_SERDES))) | ||
13396 | return -ENOTSUPP; | ||
13397 | |||
13387 | /* Initialize data/descriptor byte/word swapping. */ | 13398 | /* Initialize data/descriptor byte/word swapping. */ |
13388 | val = tr32(GRC_MODE); | 13399 | val = tr32(GRC_MODE); |
13389 | val &= GRC_MODE_HOST_STACKUP; | 13400 | val &= GRC_MODE_HOST_STACKUP; |
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index cd30889650f8..8a167912902b 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -4,6 +4,7 @@ | |||
4 | * Copyright (C) 2001, 2002, 2003, 2004 David S. Miller (davem@redhat.com) | 4 | * Copyright (C) 2001, 2002, 2003, 2004 David S. Miller (davem@redhat.com) |
5 | * Copyright (C) 2001 Jeff Garzik (jgarzik@pobox.com) | 5 | * Copyright (C) 2001 Jeff Garzik (jgarzik@pobox.com) |
6 | * Copyright (C) 2004 Sun Microsystems Inc. | 6 | * Copyright (C) 2004 Sun Microsystems Inc. |
7 | * Copyright (C) 2007-2010 Broadcom Corporation. | ||
7 | */ | 8 | */ |
8 | 9 | ||
9 | #ifndef _T3_H | 10 | #ifndef _T3_H |
@@ -1054,6 +1055,8 @@ | |||
1054 | #define CPMU_MUTEX_REQ_DRIVER 0x00001000 | 1055 | #define CPMU_MUTEX_REQ_DRIVER 0x00001000 |
1055 | #define TG3_CPMU_MUTEX_GNT 0x00003660 | 1056 | #define TG3_CPMU_MUTEX_GNT 0x00003660 |
1056 | #define CPMU_MUTEX_GNT_DRIVER 0x00001000 | 1057 | #define CPMU_MUTEX_GNT_DRIVER 0x00001000 |
1058 | #define TG3_CPMU_PHY_STRAP 0x00003664 | ||
1059 | #define TG3_CPMU_PHY_STRAP_IS_SERDES 0x00000020 | ||
1057 | /* 0x3664 --> 0x3800 unused */ | 1060 | /* 0x3664 --> 0x3800 unused */ |
1058 | 1061 | ||
1059 | /* Mbuf cluster free registers */ | 1062 | /* Mbuf cluster free registers */ |
diff --git a/drivers/net/tulip/Kconfig b/drivers/net/tulip/Kconfig index 1cc8cf4425d1..516713fa0a05 100644 --- a/drivers/net/tulip/Kconfig +++ b/drivers/net/tulip/Kconfig | |||
@@ -101,6 +101,10 @@ config TULIP_NAPI_HW_MITIGATION | |||
101 | 101 | ||
102 | If in doubt, say Y. | 102 | If in doubt, say Y. |
103 | 103 | ||
104 | config TULIP_DM910X | ||
105 | def_bool y | ||
106 | depends on TULIP && SPARC | ||
107 | |||
104 | config DE4X5 | 108 | config DE4X5 |
105 | tristate "Generic DECchip & DIGITAL EtherWORKS PCI/EISA" | 109 | tristate "Generic DECchip & DIGITAL EtherWORKS PCI/EISA" |
106 | depends on PCI || EISA | 110 | depends on PCI || EISA |
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c index ad63621913c3..6f44ebf58910 100644 --- a/drivers/net/tulip/dmfe.c +++ b/drivers/net/tulip/dmfe.c | |||
@@ -92,6 +92,10 @@ | |||
92 | #include <asm/uaccess.h> | 92 | #include <asm/uaccess.h> |
93 | #include <asm/irq.h> | 93 | #include <asm/irq.h> |
94 | 94 | ||
95 | #ifdef CONFIG_TULIP_DM910X | ||
96 | #include <linux/of.h> | ||
97 | #endif | ||
98 | |||
95 | 99 | ||
96 | /* Board/System/Debug information/definition ---------------- */ | 100 | /* Board/System/Debug information/definition ---------------- */ |
97 | #define PCI_DM9132_ID 0x91321282 /* Davicom DM9132 ID */ | 101 | #define PCI_DM9132_ID 0x91321282 /* Davicom DM9132 ID */ |
@@ -377,6 +381,23 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev, | |||
377 | if (!printed_version++) | 381 | if (!printed_version++) |
378 | printk(version); | 382 | printk(version); |
379 | 383 | ||
384 | /* | ||
385 | * SPARC on-board DM910x chips should be handled by the main | ||
386 | * tulip driver, except for early DM9100s. | ||
387 | */ | ||
388 | #ifdef CONFIG_TULIP_DM910X | ||
389 | if ((ent->driver_data == PCI_DM9100_ID && pdev->revision >= 0x30) || | ||
390 | ent->driver_data == PCI_DM9102_ID) { | ||
391 | struct device_node *dp = pci_device_to_OF_node(pdev); | ||
392 | |||
393 | if (dp && of_get_property(dp, "local-mac-address", NULL)) { | ||
394 | printk(KERN_INFO DRV_NAME | ||
395 | ": skipping on-board DM910x (use tulip)\n"); | ||
396 | return -ENODEV; | ||
397 | } | ||
398 | } | ||
399 | #endif | ||
400 | |||
380 | /* Init network device */ | 401 | /* Init network device */ |
381 | dev = alloc_etherdev(sizeof(*db)); | 402 | dev = alloc_etherdev(sizeof(*db)); |
382 | if (dev == NULL) | 403 | if (dev == NULL) |
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index 0fa3140d65bf..20696b5d60a5 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c | |||
@@ -196,9 +196,13 @@ struct tulip_chip_table tulip_tbl[] = { | |||
196 | | HAS_NWAY | HAS_PCI_MWI, tulip_timer, tulip_media_task }, | 196 | | HAS_NWAY | HAS_PCI_MWI, tulip_timer, tulip_media_task }, |
197 | 197 | ||
198 | /* DM910X */ | 198 | /* DM910X */ |
199 | #ifdef CONFIG_TULIP_DM910X | ||
199 | { "Davicom DM9102/DM9102A", 128, 0x0001ebef, | 200 | { "Davicom DM9102/DM9102A", 128, 0x0001ebef, |
200 | HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM | HAS_ACPI, | 201 | HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM | HAS_ACPI, |
201 | tulip_timer, tulip_media_task }, | 202 | tulip_timer, tulip_media_task }, |
203 | #else | ||
204 | { NULL }, | ||
205 | #endif | ||
202 | 206 | ||
203 | /* RS7112 */ | 207 | /* RS7112 */ |
204 | { "Conexant LANfinity", 256, 0x0001ebef, | 208 | { "Conexant LANfinity", 256, 0x0001ebef, |
@@ -228,8 +232,10 @@ static struct pci_device_id tulip_pci_tbl[] = { | |||
228 | { 0x1259, 0xa120, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, | 232 | { 0x1259, 0xa120, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, |
229 | { 0x11F6, 0x9881, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMPEX9881 }, | 233 | { 0x11F6, 0x9881, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMPEX9881 }, |
230 | { 0x8086, 0x0039, PCI_ANY_ID, PCI_ANY_ID, 0, 0, I21145 }, | 234 | { 0x8086, 0x0039, PCI_ANY_ID, PCI_ANY_ID, 0, 0, I21145 }, |
235 | #ifdef CONFIG_TULIP_DM910X | ||
231 | { 0x1282, 0x9100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DM910X }, | 236 | { 0x1282, 0x9100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DM910X }, |
232 | { 0x1282, 0x9102, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DM910X }, | 237 | { 0x1282, 0x9102, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DM910X }, |
238 | #endif | ||
233 | { 0x1113, 0x1216, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, | 239 | { 0x1113, 0x1216, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, |
234 | { 0x1113, 0x1217, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MX98715 }, | 240 | { 0x1113, 0x1217, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MX98715 }, |
235 | { 0x1113, 0x9511, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, | 241 | { 0x1113, 0x9511, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, |
@@ -243,6 +249,7 @@ static struct pci_device_id tulip_pci_tbl[] = { | |||
243 | { 0x17B3, 0xAB08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, | 249 | { 0x17B3, 0xAB08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, |
244 | { 0x10b7, 0x9300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, /* 3Com 3CSOHO100B-TX */ | 250 | { 0x10b7, 0x9300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, /* 3Com 3CSOHO100B-TX */ |
245 | { 0x14ea, 0xab08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, /* Planex FNW-3602-TX */ | 251 | { 0x14ea, 0xab08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, /* Planex FNW-3602-TX */ |
252 | { 0x1414, 0x0001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, /* Microsoft MN-120 */ | ||
246 | { 0x1414, 0x0002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, | 253 | { 0x1414, 0x0002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, |
247 | { } /* terminate list */ | 254 | { } /* terminate list */ |
248 | }; | 255 | }; |
@@ -1299,18 +1306,30 @@ static int __devinit tulip_init_one (struct pci_dev *pdev, | |||
1299 | } | 1306 | } |
1300 | 1307 | ||
1301 | /* | 1308 | /* |
1302 | * Early DM9100's need software CRC and the DMFE driver | 1309 | * DM910x chips should be handled by the dmfe driver, except |
1310 | * on-board chips on SPARC systems. Also, early DM9100s need | ||
1311 | * software CRC which only the dmfe driver supports. | ||
1303 | */ | 1312 | */ |
1304 | 1313 | ||
1305 | if (pdev->vendor == 0x1282 && pdev->device == 0x9100) | 1314 | #ifdef CONFIG_TULIP_DM910X |
1306 | { | 1315 | if (chip_idx == DM910X) { |
1307 | /* Read Chip revision */ | 1316 | struct device_node *dp; |
1308 | if (pdev->revision < 0x30) | 1317 | |
1309 | { | 1318 | if (pdev->vendor == 0x1282 && pdev->device == 0x9100 && |
1310 | printk(KERN_ERR PFX "skipping early DM9100 with Crc bug (use dmfe)\n"); | 1319 | pdev->revision < 0x30) { |
1320 | printk(KERN_INFO PFX | ||
1321 | "skipping early DM9100 with Crc bug (use dmfe)\n"); | ||
1322 | return -ENODEV; | ||
1323 | } | ||
1324 | |||
1325 | dp = pci_device_to_OF_node(pdev); | ||
1326 | if (!(dp && of_get_property(dp, "local-mac-address", NULL))) { | ||
1327 | printk(KERN_INFO PFX | ||
1328 | "skipping DM910x expansion card (use dmfe)\n"); | ||
1311 | return -ENODEV; | 1329 | return -ENODEV; |
1312 | } | 1330 | } |
1313 | } | 1331 | } |
1332 | #endif | ||
1314 | 1333 | ||
1315 | /* | 1334 | /* |
1316 | * Looks for early PCI chipsets where people report hangs | 1335 | * Looks for early PCI chipsets where people report hangs |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 01e99f22210e..2834a01bae24 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -849,13 +849,13 @@ static void tun_sock_write_space(struct sock *sk) | |||
849 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) | 849 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) |
850 | wake_up_interruptible_sync(sk->sk_sleep); | 850 | wake_up_interruptible_sync(sk->sk_sleep); |
851 | 851 | ||
852 | tun = container_of(sk, struct tun_sock, sk)->tun; | 852 | tun = tun_sk(sk)->tun; |
853 | kill_fasync(&tun->fasync, SIGIO, POLL_OUT); | 853 | kill_fasync(&tun->fasync, SIGIO, POLL_OUT); |
854 | } | 854 | } |
855 | 855 | ||
856 | static void tun_sock_destruct(struct sock *sk) | 856 | static void tun_sock_destruct(struct sock *sk) |
857 | { | 857 | { |
858 | free_netdev(container_of(sk, struct tun_sock, sk)->tun->dev); | 858 | free_netdev(tun_sk(sk)->tun->dev); |
859 | } | 859 | } |
860 | 860 | ||
861 | static struct proto tun_proto = { | 861 | static struct proto tun_proto = { |
@@ -990,7 +990,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
990 | sk->sk_write_space = tun_sock_write_space; | 990 | sk->sk_write_space = tun_sock_write_space; |
991 | sk->sk_sndbuf = INT_MAX; | 991 | sk->sk_sndbuf = INT_MAX; |
992 | 992 | ||
993 | container_of(sk, struct tun_sock, sk)->tun = tun; | 993 | tun_sk(sk)->tun = tun; |
994 | 994 | ||
995 | security_tun_dev_post_create(sk); | 995 | security_tun_dev_post_create(sk); |
996 | 996 | ||
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index afaf088b72ea..eb8fe7e16c6c 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
@@ -1563,7 +1563,10 @@ static int ugeth_disable(struct ucc_geth_private *ugeth, enum comm_dir mode) | |||
1563 | 1563 | ||
1564 | static void ugeth_quiesce(struct ucc_geth_private *ugeth) | 1564 | static void ugeth_quiesce(struct ucc_geth_private *ugeth) |
1565 | { | 1565 | { |
1566 | /* Wait for and prevent any further xmits. */ | 1566 | /* Prevent any further xmits, plus detach the device. */ |
1567 | netif_device_detach(ugeth->ndev); | ||
1568 | |||
1569 | /* Wait for any current xmits to finish. */ | ||
1567 | netif_tx_disable(ugeth->ndev); | 1570 | netif_tx_disable(ugeth->ndev); |
1568 | 1571 | ||
1569 | /* Disable the interrupt to avoid NAPI rescheduling. */ | 1572 | /* Disable the interrupt to avoid NAPI rescheduling. */ |
@@ -1577,7 +1580,7 @@ static void ugeth_activate(struct ucc_geth_private *ugeth) | |||
1577 | { | 1580 | { |
1578 | napi_enable(&ugeth->napi); | 1581 | napi_enable(&ugeth->napi); |
1579 | enable_irq(ugeth->ug_info->uf_info.irq); | 1582 | enable_irq(ugeth->ug_info->uf_info.irq); |
1580 | netif_tx_wake_all_queues(ugeth->ndev); | 1583 | netif_device_attach(ugeth->ndev); |
1581 | } | 1584 | } |
1582 | 1585 | ||
1583 | /* Called every time the controller might need to be made | 1586 | /* Called every time the controller might need to be made |
@@ -1648,25 +1651,28 @@ static void adjust_link(struct net_device *dev) | |||
1648 | ugeth->oldspeed = phydev->speed; | 1651 | ugeth->oldspeed = phydev->speed; |
1649 | } | 1652 | } |
1650 | 1653 | ||
1651 | /* | ||
1652 | * To change the MAC configuration we need to disable the | ||
1653 | * controller. To do so, we have to either grab ugeth->lock, | ||
1654 | * which is a bad idea since 'graceful stop' commands might | ||
1655 | * take quite a while, or we can quiesce driver's activity. | ||
1656 | */ | ||
1657 | ugeth_quiesce(ugeth); | ||
1658 | ugeth_disable(ugeth, COMM_DIR_RX_AND_TX); | ||
1659 | |||
1660 | out_be32(&ug_regs->maccfg2, tempval); | ||
1661 | out_be32(&uf_regs->upsmr, upsmr); | ||
1662 | |||
1663 | ugeth_enable(ugeth, COMM_DIR_RX_AND_TX); | ||
1664 | ugeth_activate(ugeth); | ||
1665 | |||
1666 | if (!ugeth->oldlink) { | 1654 | if (!ugeth->oldlink) { |
1667 | new_state = 1; | 1655 | new_state = 1; |
1668 | ugeth->oldlink = 1; | 1656 | ugeth->oldlink = 1; |
1669 | } | 1657 | } |
1658 | |||
1659 | if (new_state) { | ||
1660 | /* | ||
1661 | * To change the MAC configuration we need to disable | ||
1662 | * the controller. To do so, we have to either grab | ||
1663 | * ugeth->lock, which is a bad idea since 'graceful | ||
1664 | * stop' commands might take quite a while, or we can | ||
1665 | * quiesce driver's activity. | ||
1666 | */ | ||
1667 | ugeth_quiesce(ugeth); | ||
1668 | ugeth_disable(ugeth, COMM_DIR_RX_AND_TX); | ||
1669 | |||
1670 | out_be32(&ug_regs->maccfg2, tempval); | ||
1671 | out_be32(&uf_regs->upsmr, upsmr); | ||
1672 | |||
1673 | ugeth_enable(ugeth, COMM_DIR_RX_AND_TX); | ||
1674 | ugeth_activate(ugeth); | ||
1675 | } | ||
1670 | } else if (ugeth->oldlink) { | 1676 | } else if (ugeth->oldlink) { |
1671 | new_state = 1; | 1677 | new_state = 1; |
1672 | ugeth->oldlink = 0; | 1678 | ugeth->oldlink = 0; |
@@ -3273,13 +3279,12 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ) | |||
3273 | /* Handle the transmitted buffer and release */ | 3279 | /* Handle the transmitted buffer and release */ |
3274 | /* the BD to be used with the current frame */ | 3280 | /* the BD to be used with the current frame */ |
3275 | 3281 | ||
3276 | if ((bd == ugeth->txBd[txQ]) && (netif_queue_stopped(dev) == 0)) | 3282 | skb = ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]]; |
3283 | if (!skb) | ||
3277 | break; | 3284 | break; |
3278 | 3285 | ||
3279 | dev->stats.tx_packets++; | 3286 | dev->stats.tx_packets++; |
3280 | 3287 | ||
3281 | skb = ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]]; | ||
3282 | |||
3283 | if (skb_queue_len(&ugeth->rx_recycle) < RX_BD_RING_LEN && | 3288 | if (skb_queue_len(&ugeth->rx_recycle) < RX_BD_RING_LEN && |
3284 | skb_recycle_check(skb, | 3289 | skb_recycle_check(skb, |
3285 | ugeth->ug_info->uf_info.max_rx_buf_length + | 3290 | ugeth->ug_info->uf_info.max_rx_buf_length + |
@@ -3601,6 +3606,7 @@ static int ucc_geth_suspend(struct of_device *ofdev, pm_message_t state) | |||
3601 | if (!netif_running(ndev)) | 3606 | if (!netif_running(ndev)) |
3602 | return 0; | 3607 | return 0; |
3603 | 3608 | ||
3609 | netif_device_detach(ndev); | ||
3604 | napi_disable(&ugeth->napi); | 3610 | napi_disable(&ugeth->napi); |
3605 | 3611 | ||
3606 | /* | 3612 | /* |
@@ -3659,7 +3665,7 @@ static int ucc_geth_resume(struct of_device *ofdev) | |||
3659 | phy_start(ugeth->phydev); | 3665 | phy_start(ugeth->phydev); |
3660 | 3666 | ||
3661 | napi_enable(&ugeth->napi); | 3667 | napi_enable(&ugeth->napi); |
3662 | netif_start_queue(ndev); | 3668 | netif_device_attach(ndev); |
3663 | 3669 | ||
3664 | return 0; | 3670 | return 0; |
3665 | } | 3671 | } |
diff --git a/drivers/net/ucc_geth.h b/drivers/net/ucc_geth.h index a007e2acf651..ef1fbeb11c6e 100644 --- a/drivers/net/ucc_geth.h +++ b/drivers/net/ucc_geth.h | |||
@@ -838,13 +838,13 @@ struct ucc_geth_hardware_statistics { | |||
838 | using the maximum is | 838 | using the maximum is |
839 | easier */ | 839 | easier */ |
840 | #define UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT 32 | 840 | #define UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT 32 |
841 | #define UCC_GETH_SCHEDULER_ALIGNMENT 4 /* This is a guess */ | 841 | #define UCC_GETH_SCHEDULER_ALIGNMENT 8 /* This is a guess */ |
842 | #define UCC_GETH_TX_STATISTICS_ALIGNMENT 4 /* This is a guess */ | 842 | #define UCC_GETH_TX_STATISTICS_ALIGNMENT 4 /* This is a guess */ |
843 | #define UCC_GETH_RX_STATISTICS_ALIGNMENT 4 /* This is a guess */ | 843 | #define UCC_GETH_RX_STATISTICS_ALIGNMENT 4 /* This is a guess */ |
844 | #define UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT 64 | 844 | #define UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT 64 |
845 | #define UCC_GETH_RX_BD_QUEUES_ALIGNMENT 8 /* This is a guess */ | 845 | #define UCC_GETH_RX_BD_QUEUES_ALIGNMENT 8 /* This is a guess */ |
846 | #define UCC_GETH_RX_PREFETCHED_BDS_ALIGNMENT 128 /* This is a guess */ | 846 | #define UCC_GETH_RX_PREFETCHED_BDS_ALIGNMENT 128 /* This is a guess */ |
847 | #define UCC_GETH_RX_EXTENDED_FILTERING_GLOBAL_PARAMETERS_ALIGNMENT 4 /* This | 847 | #define UCC_GETH_RX_EXTENDED_FILTERING_GLOBAL_PARAMETERS_ALIGNMENT 8 /* This |
848 | is a | 848 | is a |
849 | guess | 849 | guess |
850 | */ | 850 | */ |
@@ -899,16 +899,17 @@ struct ucc_geth_hardware_statistics { | |||
899 | #define UCC_GETH_UTFS_INIT 512 /* Tx virtual FIFO size | 899 | #define UCC_GETH_UTFS_INIT 512 /* Tx virtual FIFO size |
900 | */ | 900 | */ |
901 | #define UCC_GETH_UTFET_INIT 256 /* 1/2 utfs */ | 901 | #define UCC_GETH_UTFET_INIT 256 /* 1/2 utfs */ |
902 | #define UCC_GETH_UTFTT_INIT 128 | 902 | #define UCC_GETH_UTFTT_INIT 512 |
903 | /* Gigabit Ethernet (1000 Mbps) */ | 903 | /* Gigabit Ethernet (1000 Mbps) */ |
904 | #define UCC_GETH_URFS_GIGA_INIT 4096/*2048*/ /* Rx virtual | 904 | #define UCC_GETH_URFS_GIGA_INIT 4096/*2048*/ /* Rx virtual |
905 | FIFO size */ | 905 | FIFO size */ |
906 | #define UCC_GETH_URFET_GIGA_INIT 2048/*1024*/ /* 1/2 urfs */ | 906 | #define UCC_GETH_URFET_GIGA_INIT 2048/*1024*/ /* 1/2 urfs */ |
907 | #define UCC_GETH_URFSET_GIGA_INIT 3072/*1536*/ /* 3/4 urfs */ | 907 | #define UCC_GETH_URFSET_GIGA_INIT 3072/*1536*/ /* 3/4 urfs */ |
908 | #define UCC_GETH_UTFS_GIGA_INIT 8192/*2048*/ /* Tx virtual | 908 | #define UCC_GETH_UTFS_GIGA_INIT 4096/*2048*/ /* Tx virtual |
909 | FIFO size */ | ||
910 | #define UCC_GETH_UTFET_GIGA_INIT 2048/*1024*/ /* 1/2 utfs */ | ||
911 | #define UCC_GETH_UTFTT_GIGA_INIT 4096/*0x40*/ /* Tx virtual | ||
909 | FIFO size */ | 912 | FIFO size */ |
910 | #define UCC_GETH_UTFET_GIGA_INIT 4096/*1024*/ /* 1/2 utfs */ | ||
911 | #define UCC_GETH_UTFTT_GIGA_INIT 0x400/*0x40*/ /* */ | ||
912 | 913 | ||
913 | #define UCC_GETH_REMODER_INIT 0 /* bits that must be | 914 | #define UCC_GETH_REMODER_INIT 0 /* bits that must be |
914 | set */ | 915 | set */ |
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 21e183a83b99..5f3b9eaeb04f 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c | |||
@@ -419,7 +419,7 @@ static int cdc_manage_power(struct usbnet *dev, int on) | |||
419 | 419 | ||
420 | static const struct driver_info cdc_info = { | 420 | static const struct driver_info cdc_info = { |
421 | .description = "CDC Ethernet Device", | 421 | .description = "CDC Ethernet Device", |
422 | .flags = FLAG_ETHER | FLAG_LINK_INTR, | 422 | .flags = FLAG_ETHER, |
423 | // .check_connect = cdc_check_connect, | 423 | // .check_connect = cdc_check_connect, |
424 | .bind = cdc_bind, | 424 | .bind = cdc_bind, |
425 | .unbind = usbnet_cdc_unbind, | 425 | .unbind = usbnet_cdc_unbind, |
@@ -584,6 +584,11 @@ static const struct usb_device_id products [] = { | |||
584 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | 584 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), |
585 | .driver_info = (unsigned long) &mbm_info, | 585 | .driver_info = (unsigned long) &mbm_info, |
586 | }, { | 586 | }, { |
587 | /* Ericsson C3607w ver 2 */ | ||
588 | USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x190b, USB_CLASS_COMM, | ||
589 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | ||
590 | .driver_info = (unsigned long) &mbm_info, | ||
591 | }, { | ||
587 | /* Toshiba F3507g */ | 592 | /* Toshiba F3507g */ |
588 | USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x130b, USB_CLASS_COMM, | 593 | USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x130b, USB_CLASS_COMM, |
589 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | 594 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), |
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index f78f0903b073..6895f1531238 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
@@ -286,6 +286,7 @@ struct hso_device { | |||
286 | u8 usb_gone; | 286 | u8 usb_gone; |
287 | struct work_struct async_get_intf; | 287 | struct work_struct async_get_intf; |
288 | struct work_struct async_put_intf; | 288 | struct work_struct async_put_intf; |
289 | struct work_struct reset_device; | ||
289 | 290 | ||
290 | struct usb_device *usb; | 291 | struct usb_device *usb; |
291 | struct usb_interface *interface; | 292 | struct usb_interface *interface; |
@@ -332,7 +333,8 @@ static void hso_kick_transmit(struct hso_serial *serial); | |||
332 | /* Helper functions */ | 333 | /* Helper functions */ |
333 | static int hso_mux_submit_intr_urb(struct hso_shared_int *mux_int, | 334 | static int hso_mux_submit_intr_urb(struct hso_shared_int *mux_int, |
334 | struct usb_device *usb, gfp_t gfp); | 335 | struct usb_device *usb, gfp_t gfp); |
335 | static void log_usb_status(int status, const char *function); | 336 | static void handle_usb_error(int status, const char *function, |
337 | struct hso_device *hso_dev); | ||
336 | static struct usb_endpoint_descriptor *hso_get_ep(struct usb_interface *intf, | 338 | static struct usb_endpoint_descriptor *hso_get_ep(struct usb_interface *intf, |
337 | int type, int dir); | 339 | int type, int dir); |
338 | static int hso_get_mux_ports(struct usb_interface *intf, unsigned char *ports); | 340 | static int hso_get_mux_ports(struct usb_interface *intf, unsigned char *ports); |
@@ -350,6 +352,7 @@ static void async_put_intf(struct work_struct *data); | |||
350 | static int hso_put_activity(struct hso_device *hso_dev); | 352 | static int hso_put_activity(struct hso_device *hso_dev); |
351 | static int hso_get_activity(struct hso_device *hso_dev); | 353 | static int hso_get_activity(struct hso_device *hso_dev); |
352 | static void tiocmget_intr_callback(struct urb *urb); | 354 | static void tiocmget_intr_callback(struct urb *urb); |
355 | static void reset_device(struct work_struct *data); | ||
353 | /*****************************************************************************/ | 356 | /*****************************************************************************/ |
354 | /* Helping functions */ | 357 | /* Helping functions */ |
355 | /*****************************************************************************/ | 358 | /*****************************************************************************/ |
@@ -461,10 +464,17 @@ static const struct usb_device_id hso_ids[] = { | |||
461 | {USB_DEVICE(0x0af0, 0x7501)}, /* GTM 382 */ | 464 | {USB_DEVICE(0x0af0, 0x7501)}, /* GTM 382 */ |
462 | {USB_DEVICE(0x0af0, 0x7601)}, /* GE40x */ | 465 | {USB_DEVICE(0x0af0, 0x7601)}, /* GE40x */ |
463 | {USB_DEVICE(0x0af0, 0x7701)}, | 466 | {USB_DEVICE(0x0af0, 0x7701)}, |
467 | {USB_DEVICE(0x0af0, 0x7706)}, | ||
464 | {USB_DEVICE(0x0af0, 0x7801)}, | 468 | {USB_DEVICE(0x0af0, 0x7801)}, |
465 | {USB_DEVICE(0x0af0, 0x7901)}, | 469 | {USB_DEVICE(0x0af0, 0x7901)}, |
470 | {USB_DEVICE(0x0af0, 0x7A01)}, | ||
471 | {USB_DEVICE(0x0af0, 0x7A05)}, | ||
466 | {USB_DEVICE(0x0af0, 0x8200)}, | 472 | {USB_DEVICE(0x0af0, 0x8200)}, |
467 | {USB_DEVICE(0x0af0, 0x8201)}, | 473 | {USB_DEVICE(0x0af0, 0x8201)}, |
474 | {USB_DEVICE(0x0af0, 0x8300)}, | ||
475 | {USB_DEVICE(0x0af0, 0x8302)}, | ||
476 | {USB_DEVICE(0x0af0, 0x8304)}, | ||
477 | {USB_DEVICE(0x0af0, 0x8400)}, | ||
468 | {USB_DEVICE(0x0af0, 0xd035)}, | 478 | {USB_DEVICE(0x0af0, 0xd035)}, |
469 | {USB_DEVICE(0x0af0, 0xd055)}, | 479 | {USB_DEVICE(0x0af0, 0xd055)}, |
470 | {USB_DEVICE(0x0af0, 0xd155)}, | 480 | {USB_DEVICE(0x0af0, 0xd155)}, |
@@ -473,6 +483,8 @@ static const struct usb_device_id hso_ids[] = { | |||
473 | {USB_DEVICE(0x0af0, 0xd157)}, | 483 | {USB_DEVICE(0x0af0, 0xd157)}, |
474 | {USB_DEVICE(0x0af0, 0xd257)}, | 484 | {USB_DEVICE(0x0af0, 0xd257)}, |
475 | {USB_DEVICE(0x0af0, 0xd357)}, | 485 | {USB_DEVICE(0x0af0, 0xd357)}, |
486 | {USB_DEVICE(0x0af0, 0xd058)}, | ||
487 | {USB_DEVICE(0x0af0, 0xc100)}, | ||
476 | {} | 488 | {} |
477 | }; | 489 | }; |
478 | MODULE_DEVICE_TABLE(usb, hso_ids); | 490 | MODULE_DEVICE_TABLE(usb, hso_ids); |
@@ -655,8 +667,8 @@ static void set_serial_by_index(unsigned index, struct hso_serial *serial) | |||
655 | spin_unlock_irqrestore(&serial_table_lock, flags); | 667 | spin_unlock_irqrestore(&serial_table_lock, flags); |
656 | } | 668 | } |
657 | 669 | ||
658 | /* log a meaningful explanation of an USB status */ | 670 | static void handle_usb_error(int status, const char *function, |
659 | static void log_usb_status(int status, const char *function) | 671 | struct hso_device *hso_dev) |
660 | { | 672 | { |
661 | char *explanation; | 673 | char *explanation; |
662 | 674 | ||
@@ -685,10 +697,20 @@ static void log_usb_status(int status, const char *function) | |||
685 | case -EMSGSIZE: | 697 | case -EMSGSIZE: |
686 | explanation = "internal error"; | 698 | explanation = "internal error"; |
687 | break; | 699 | break; |
700 | case -EILSEQ: | ||
701 | case -EPROTO: | ||
702 | case -ETIME: | ||
703 | case -ETIMEDOUT: | ||
704 | explanation = "protocol error"; | ||
705 | if (hso_dev) | ||
706 | schedule_work(&hso_dev->reset_device); | ||
707 | break; | ||
688 | default: | 708 | default: |
689 | explanation = "unknown status"; | 709 | explanation = "unknown status"; |
690 | break; | 710 | break; |
691 | } | 711 | } |
712 | |||
713 | /* log a meaningful explanation of an USB status */ | ||
692 | D1("%s: received USB status - %s (%d)", function, explanation, status); | 714 | D1("%s: received USB status - %s (%d)", function, explanation, status); |
693 | } | 715 | } |
694 | 716 | ||
@@ -762,7 +784,7 @@ static void write_bulk_callback(struct urb *urb) | |||
762 | /* log status, but don't act on it, we don't need to resubmit anything | 784 | /* log status, but don't act on it, we don't need to resubmit anything |
763 | * anyhow */ | 785 | * anyhow */ |
764 | if (status) | 786 | if (status) |
765 | log_usb_status(status, __func__); | 787 | handle_usb_error(status, __func__, odev->parent); |
766 | 788 | ||
767 | hso_put_activity(odev->parent); | 789 | hso_put_activity(odev->parent); |
768 | 790 | ||
@@ -806,7 +828,7 @@ static netdev_tx_t hso_net_start_xmit(struct sk_buff *skb, | |||
806 | result = usb_submit_urb(odev->mux_bulk_tx_urb, GFP_ATOMIC); | 828 | result = usb_submit_urb(odev->mux_bulk_tx_urb, GFP_ATOMIC); |
807 | if (result) { | 829 | if (result) { |
808 | dev_warn(&odev->parent->interface->dev, | 830 | dev_warn(&odev->parent->interface->dev, |
809 | "failed mux_bulk_tx_urb %d", result); | 831 | "failed mux_bulk_tx_urb %d\n", result); |
810 | net->stats.tx_errors++; | 832 | net->stats.tx_errors++; |
811 | netif_start_queue(net); | 833 | netif_start_queue(net); |
812 | } else { | 834 | } else { |
@@ -998,7 +1020,7 @@ static void read_bulk_callback(struct urb *urb) | |||
998 | 1020 | ||
999 | /* is al ok? (Filip: Who's Al ?) */ | 1021 | /* is al ok? (Filip: Who's Al ?) */ |
1000 | if (status) { | 1022 | if (status) { |
1001 | log_usb_status(status, __func__); | 1023 | handle_usb_error(status, __func__, odev->parent); |
1002 | return; | 1024 | return; |
1003 | } | 1025 | } |
1004 | 1026 | ||
@@ -1019,7 +1041,8 @@ static void read_bulk_callback(struct urb *urb) | |||
1019 | if (odev->parent->port_spec & HSO_INFO_CRC_BUG) { | 1041 | if (odev->parent->port_spec & HSO_INFO_CRC_BUG) { |
1020 | u32 rest; | 1042 | u32 rest; |
1021 | u8 crc_check[4] = { 0xDE, 0xAD, 0xBE, 0xEF }; | 1043 | u8 crc_check[4] = { 0xDE, 0xAD, 0xBE, 0xEF }; |
1022 | rest = urb->actual_length % odev->in_endp->wMaxPacketSize; | 1044 | rest = urb->actual_length % |
1045 | le16_to_cpu(odev->in_endp->wMaxPacketSize); | ||
1023 | if (((rest == 5) || (rest == 6)) && | 1046 | if (((rest == 5) || (rest == 6)) && |
1024 | !memcmp(((u8 *) urb->transfer_buffer) + | 1047 | !memcmp(((u8 *) urb->transfer_buffer) + |
1025 | urb->actual_length - 4, crc_check, 4)) { | 1048 | urb->actual_length - 4, crc_check, 4)) { |
@@ -1053,7 +1076,7 @@ static void read_bulk_callback(struct urb *urb) | |||
1053 | result = usb_submit_urb(urb, GFP_ATOMIC); | 1076 | result = usb_submit_urb(urb, GFP_ATOMIC); |
1054 | if (result) | 1077 | if (result) |
1055 | dev_warn(&odev->parent->interface->dev, | 1078 | dev_warn(&odev->parent->interface->dev, |
1056 | "%s failed submit mux_bulk_rx_urb %d", __func__, | 1079 | "%s failed submit mux_bulk_rx_urb %d\n", __func__, |
1057 | result); | 1080 | result); |
1058 | } | 1081 | } |
1059 | 1082 | ||
@@ -1207,7 +1230,7 @@ static void hso_std_serial_read_bulk_callback(struct urb *urb) | |||
1207 | D1("serial == NULL"); | 1230 | D1("serial == NULL"); |
1208 | return; | 1231 | return; |
1209 | } else if (status) { | 1232 | } else if (status) { |
1210 | log_usb_status(status, __func__); | 1233 | handle_usb_error(status, __func__, serial->parent); |
1211 | return; | 1234 | return; |
1212 | } | 1235 | } |
1213 | 1236 | ||
@@ -1225,7 +1248,7 @@ static void hso_std_serial_read_bulk_callback(struct urb *urb) | |||
1225 | u8 crc_check[4] = { 0xDE, 0xAD, 0xBE, 0xEF }; | 1248 | u8 crc_check[4] = { 0xDE, 0xAD, 0xBE, 0xEF }; |
1226 | rest = | 1249 | rest = |
1227 | urb->actual_length % | 1250 | urb->actual_length % |
1228 | serial->in_endp->wMaxPacketSize; | 1251 | le16_to_cpu(serial->in_endp->wMaxPacketSize); |
1229 | if (((rest == 5) || (rest == 6)) && | 1252 | if (((rest == 5) || (rest == 6)) && |
1230 | !memcmp(((u8 *) urb->transfer_buffer) + | 1253 | !memcmp(((u8 *) urb->transfer_buffer) + |
1231 | urb->actual_length - 4, crc_check, 4)) { | 1254 | urb->actual_length - 4, crc_check, 4)) { |
@@ -1513,7 +1536,7 @@ static void tiocmget_intr_callback(struct urb *urb) | |||
1513 | if (!serial) | 1536 | if (!serial) |
1514 | return; | 1537 | return; |
1515 | if (status) { | 1538 | if (status) { |
1516 | log_usb_status(status, __func__); | 1539 | handle_usb_error(status, __func__, serial->parent); |
1517 | return; | 1540 | return; |
1518 | } | 1541 | } |
1519 | tiocmget = serial->tiocmget; | 1542 | tiocmget = serial->tiocmget; |
@@ -1700,6 +1723,10 @@ static int hso_serial_tiocmset(struct tty_struct *tty, struct file *file, | |||
1700 | D1("no tty structures"); | 1723 | D1("no tty structures"); |
1701 | return -EINVAL; | 1724 | return -EINVAL; |
1702 | } | 1725 | } |
1726 | |||
1727 | if ((serial->parent->port_spec & HSO_PORT_MASK) != HSO_PORT_MODEM) | ||
1728 | return -EINVAL; | ||
1729 | |||
1703 | if_num = serial->parent->interface->altsetting->desc.bInterfaceNumber; | 1730 | if_num = serial->parent->interface->altsetting->desc.bInterfaceNumber; |
1704 | 1731 | ||
1705 | spin_lock_irqsave(&serial->serial_lock, flags); | 1732 | spin_lock_irqsave(&serial->serial_lock, flags); |
@@ -1838,7 +1865,7 @@ static int mux_device_request(struct hso_serial *serial, u8 type, u16 port, | |||
1838 | result = usb_submit_urb(ctrl_urb, GFP_ATOMIC); | 1865 | result = usb_submit_urb(ctrl_urb, GFP_ATOMIC); |
1839 | if (result) { | 1866 | if (result) { |
1840 | dev_err(&ctrl_urb->dev->dev, | 1867 | dev_err(&ctrl_urb->dev->dev, |
1841 | "%s failed submit ctrl_urb %d type %d", __func__, | 1868 | "%s failed submit ctrl_urb %d type %d\n", __func__, |
1842 | result, type); | 1869 | result, type); |
1843 | return result; | 1870 | return result; |
1844 | } | 1871 | } |
@@ -1888,7 +1915,7 @@ static void intr_callback(struct urb *urb) | |||
1888 | 1915 | ||
1889 | /* status check */ | 1916 | /* status check */ |
1890 | if (status) { | 1917 | if (status) { |
1891 | log_usb_status(status, __func__); | 1918 | handle_usb_error(status, __func__, NULL); |
1892 | return; | 1919 | return; |
1893 | } | 1920 | } |
1894 | D4("\n--- Got intr callback 0x%02X ---", status); | 1921 | D4("\n--- Got intr callback 0x%02X ---", status); |
@@ -1905,18 +1932,18 @@ static void intr_callback(struct urb *urb) | |||
1905 | if (serial != NULL) { | 1932 | if (serial != NULL) { |
1906 | D1("Pending read interrupt on port %d\n", i); | 1933 | D1("Pending read interrupt on port %d\n", i); |
1907 | spin_lock(&serial->serial_lock); | 1934 | spin_lock(&serial->serial_lock); |
1908 | if (serial->rx_state == RX_IDLE) { | 1935 | if (serial->rx_state == RX_IDLE && |
1936 | serial->open_count > 0) { | ||
1909 | /* Setup and send a ctrl req read on | 1937 | /* Setup and send a ctrl req read on |
1910 | * port i */ | 1938 | * port i */ |
1911 | if (!serial->rx_urb_filled[0]) { | 1939 | if (!serial->rx_urb_filled[0]) { |
1912 | serial->rx_state = RX_SENT; | 1940 | serial->rx_state = RX_SENT; |
1913 | hso_mux_serial_read(serial); | 1941 | hso_mux_serial_read(serial); |
1914 | } else | 1942 | } else |
1915 | serial->rx_state = RX_PENDING; | 1943 | serial->rx_state = RX_PENDING; |
1916 | |||
1917 | } else { | 1944 | } else { |
1918 | D1("Already pending a read on " | 1945 | D1("Already a read pending on " |
1919 | "port %d\n", i); | 1946 | "port %d or port not open\n", i); |
1920 | } | 1947 | } |
1921 | spin_unlock(&serial->serial_lock); | 1948 | spin_unlock(&serial->serial_lock); |
1922 | } | 1949 | } |
@@ -1958,7 +1985,7 @@ static void hso_std_serial_write_bulk_callback(struct urb *urb) | |||
1958 | tty = tty_kref_get(serial->tty); | 1985 | tty = tty_kref_get(serial->tty); |
1959 | spin_unlock(&serial->serial_lock); | 1986 | spin_unlock(&serial->serial_lock); |
1960 | if (status) { | 1987 | if (status) { |
1961 | log_usb_status(status, __func__); | 1988 | handle_usb_error(status, __func__, serial->parent); |
1962 | tty_kref_put(tty); | 1989 | tty_kref_put(tty); |
1963 | return; | 1990 | return; |
1964 | } | 1991 | } |
@@ -2014,7 +2041,7 @@ static void ctrl_callback(struct urb *urb) | |||
2014 | tty = tty_kref_get(serial->tty); | 2041 | tty = tty_kref_get(serial->tty); |
2015 | spin_unlock(&serial->serial_lock); | 2042 | spin_unlock(&serial->serial_lock); |
2016 | if (status) { | 2043 | if (status) { |
2017 | log_usb_status(status, __func__); | 2044 | handle_usb_error(status, __func__, serial->parent); |
2018 | tty_kref_put(tty); | 2045 | tty_kref_put(tty); |
2019 | return; | 2046 | return; |
2020 | } | 2047 | } |
@@ -2358,12 +2385,12 @@ static int hso_serial_common_create(struct hso_serial *serial, int num_urbs, | |||
2358 | serial->tx_data_length = tx_size; | 2385 | serial->tx_data_length = tx_size; |
2359 | serial->tx_data = kzalloc(serial->tx_data_length, GFP_KERNEL); | 2386 | serial->tx_data = kzalloc(serial->tx_data_length, GFP_KERNEL); |
2360 | if (!serial->tx_data) { | 2387 | if (!serial->tx_data) { |
2361 | dev_err(dev, "%s - Out of memory", __func__); | 2388 | dev_err(dev, "%s - Out of memory\n", __func__); |
2362 | goto exit; | 2389 | goto exit; |
2363 | } | 2390 | } |
2364 | serial->tx_buffer = kzalloc(serial->tx_data_length, GFP_KERNEL); | 2391 | serial->tx_buffer = kzalloc(serial->tx_data_length, GFP_KERNEL); |
2365 | if (!serial->tx_buffer) { | 2392 | if (!serial->tx_buffer) { |
2366 | dev_err(dev, "%s - Out of memory", __func__); | 2393 | dev_err(dev, "%s - Out of memory\n", __func__); |
2367 | goto exit; | 2394 | goto exit; |
2368 | } | 2395 | } |
2369 | 2396 | ||
@@ -2391,6 +2418,7 @@ static struct hso_device *hso_create_device(struct usb_interface *intf, | |||
2391 | 2418 | ||
2392 | INIT_WORK(&hso_dev->async_get_intf, async_get_intf); | 2419 | INIT_WORK(&hso_dev->async_get_intf, async_get_intf); |
2393 | INIT_WORK(&hso_dev->async_put_intf, async_put_intf); | 2420 | INIT_WORK(&hso_dev->async_put_intf, async_put_intf); |
2421 | INIT_WORK(&hso_dev->reset_device, reset_device); | ||
2394 | 2422 | ||
2395 | return hso_dev; | 2423 | return hso_dev; |
2396 | } | 2424 | } |
@@ -2831,13 +2859,14 @@ struct hso_shared_int *hso_create_shared_int(struct usb_interface *interface) | |||
2831 | 2859 | ||
2832 | mux->shared_intr_urb = usb_alloc_urb(0, GFP_KERNEL); | 2860 | mux->shared_intr_urb = usb_alloc_urb(0, GFP_KERNEL); |
2833 | if (!mux->shared_intr_urb) { | 2861 | if (!mux->shared_intr_urb) { |
2834 | dev_err(&interface->dev, "Could not allocate intr urb?"); | 2862 | dev_err(&interface->dev, "Could not allocate intr urb?\n"); |
2835 | goto exit; | 2863 | goto exit; |
2836 | } | 2864 | } |
2837 | mux->shared_intr_buf = kzalloc(mux->intr_endp->wMaxPacketSize, | 2865 | mux->shared_intr_buf = |
2838 | GFP_KERNEL); | 2866 | kzalloc(le16_to_cpu(mux->intr_endp->wMaxPacketSize), |
2867 | GFP_KERNEL); | ||
2839 | if (!mux->shared_intr_buf) { | 2868 | if (!mux->shared_intr_buf) { |
2840 | dev_err(&interface->dev, "Could not allocate intr buf?"); | 2869 | dev_err(&interface->dev, "Could not allocate intr buf?\n"); |
2841 | goto exit; | 2870 | goto exit; |
2842 | } | 2871 | } |
2843 | 2872 | ||
@@ -3132,6 +3161,26 @@ out: | |||
3132 | return result; | 3161 | return result; |
3133 | } | 3162 | } |
3134 | 3163 | ||
3164 | static void reset_device(struct work_struct *data) | ||
3165 | { | ||
3166 | struct hso_device *hso_dev = | ||
3167 | container_of(data, struct hso_device, reset_device); | ||
3168 | struct usb_device *usb = hso_dev->usb; | ||
3169 | int result; | ||
3170 | |||
3171 | if (hso_dev->usb_gone) { | ||
3172 | D1("No reset during disconnect\n"); | ||
3173 | } else { | ||
3174 | result = usb_lock_device_for_reset(usb, hso_dev->interface); | ||
3175 | if (result < 0) | ||
3176 | D1("unable to lock device for reset: %d\n", result); | ||
3177 | else { | ||
3178 | usb_reset_device(usb); | ||
3179 | usb_unlock_device(usb); | ||
3180 | } | ||
3181 | } | ||
3182 | } | ||
3183 | |||
3135 | static void hso_serial_ref_free(struct kref *ref) | 3184 | static void hso_serial_ref_free(struct kref *ref) |
3136 | { | 3185 | { |
3137 | struct hso_device *hso_dev = container_of(ref, struct hso_device, ref); | 3186 | struct hso_device *hso_dev = container_of(ref, struct hso_device, ref); |
@@ -3232,13 +3281,13 @@ static int hso_mux_submit_intr_urb(struct hso_shared_int *shared_int, | |||
3232 | usb_rcvintpipe(usb, | 3281 | usb_rcvintpipe(usb, |
3233 | shared_int->intr_endp->bEndpointAddress & 0x7F), | 3282 | shared_int->intr_endp->bEndpointAddress & 0x7F), |
3234 | shared_int->shared_intr_buf, | 3283 | shared_int->shared_intr_buf, |
3235 | shared_int->intr_endp->wMaxPacketSize, | 3284 | 1, |
3236 | intr_callback, shared_int, | 3285 | intr_callback, shared_int, |
3237 | shared_int->intr_endp->bInterval); | 3286 | shared_int->intr_endp->bInterval); |
3238 | 3287 | ||
3239 | result = usb_submit_urb(shared_int->shared_intr_urb, gfp); | 3288 | result = usb_submit_urb(shared_int->shared_intr_urb, gfp); |
3240 | if (result) | 3289 | if (result) |
3241 | dev_warn(&usb->dev, "%s failed mux_intr_urb %d", __func__, | 3290 | dev_warn(&usb->dev, "%s failed mux_intr_urb %d\n", __func__, |
3242 | result); | 3291 | result); |
3243 | 3292 | ||
3244 | return result; | 3293 | return result; |
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c index f14d225404da..fd19db0d2504 100644 --- a/drivers/net/usb/rtl8150.c +++ b/drivers/net/usb/rtl8150.c | |||
@@ -270,7 +270,7 @@ static int read_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 * reg) | |||
270 | get_registers(dev, PHYCNT, 1, data); | 270 | get_registers(dev, PHYCNT, 1, data); |
271 | } while ((data[0] & PHY_GO) && (i++ < MII_TIMEOUT)); | 271 | } while ((data[0] & PHY_GO) && (i++ < MII_TIMEOUT)); |
272 | 272 | ||
273 | if (i < MII_TIMEOUT) { | 273 | if (i <= MII_TIMEOUT) { |
274 | get_registers(dev, PHYDAT, 2, data); | 274 | get_registers(dev, PHYDAT, 2, data); |
275 | *reg = data[0] | (data[1] << 8); | 275 | *reg = data[0] | (data[1] << 8); |
276 | return 0; | 276 | return 0; |
@@ -295,7 +295,7 @@ static int write_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 reg) | |||
295 | get_registers(dev, PHYCNT, 1, data); | 295 | get_registers(dev, PHYCNT, 1, data); |
296 | } while ((data[0] & PHY_GO) && (i++ < MII_TIMEOUT)); | 296 | } while ((data[0] & PHY_GO) && (i++ < MII_TIMEOUT)); |
297 | 297 | ||
298 | if (i < MII_TIMEOUT) | 298 | if (i <= MII_TIMEOUT) |
299 | return 0; | 299 | return 0; |
300 | else | 300 | else |
301 | return 1; | 301 | return 1; |
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index 593e01f64e9b..611b80435955 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c | |||
@@ -102,6 +102,7 @@ static const int multicast_filter_limit = 32; | |||
102 | #include <linux/ethtool.h> | 102 | #include <linux/ethtool.h> |
103 | #include <linux/crc32.h> | 103 | #include <linux/crc32.h> |
104 | #include <linux/bitops.h> | 104 | #include <linux/bitops.h> |
105 | #include <linux/workqueue.h> | ||
105 | #include <asm/processor.h> /* Processor type for cache alignment. */ | 106 | #include <asm/processor.h> /* Processor type for cache alignment. */ |
106 | #include <asm/io.h> | 107 | #include <asm/io.h> |
107 | #include <asm/irq.h> | 108 | #include <asm/irq.h> |
@@ -389,6 +390,7 @@ struct rhine_private { | |||
389 | struct net_device *dev; | 390 | struct net_device *dev; |
390 | struct napi_struct napi; | 391 | struct napi_struct napi; |
391 | spinlock_t lock; | 392 | spinlock_t lock; |
393 | struct work_struct reset_task; | ||
392 | 394 | ||
393 | /* Frequently used values: keep some adjacent for cache effect. */ | 395 | /* Frequently used values: keep some adjacent for cache effect. */ |
394 | u32 quirks; | 396 | u32 quirks; |
@@ -407,6 +409,7 @@ struct rhine_private { | |||
407 | static int mdio_read(struct net_device *dev, int phy_id, int location); | 409 | static int mdio_read(struct net_device *dev, int phy_id, int location); |
408 | static void mdio_write(struct net_device *dev, int phy_id, int location, int value); | 410 | static void mdio_write(struct net_device *dev, int phy_id, int location, int value); |
409 | static int rhine_open(struct net_device *dev); | 411 | static int rhine_open(struct net_device *dev); |
412 | static void rhine_reset_task(struct work_struct *work); | ||
410 | static void rhine_tx_timeout(struct net_device *dev); | 413 | static void rhine_tx_timeout(struct net_device *dev); |
411 | static netdev_tx_t rhine_start_tx(struct sk_buff *skb, | 414 | static netdev_tx_t rhine_start_tx(struct sk_buff *skb, |
412 | struct net_device *dev); | 415 | struct net_device *dev); |
@@ -775,6 +778,8 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
775 | dev->irq = pdev->irq; | 778 | dev->irq = pdev->irq; |
776 | 779 | ||
777 | spin_lock_init(&rp->lock); | 780 | spin_lock_init(&rp->lock); |
781 | INIT_WORK(&rp->reset_task, rhine_reset_task); | ||
782 | |||
778 | rp->mii_if.dev = dev; | 783 | rp->mii_if.dev = dev; |
779 | rp->mii_if.mdio_read = mdio_read; | 784 | rp->mii_if.mdio_read = mdio_read; |
780 | rp->mii_if.mdio_write = mdio_write; | 785 | rp->mii_if.mdio_write = mdio_write; |
@@ -1179,22 +1184,18 @@ static int rhine_open(struct net_device *dev) | |||
1179 | return 0; | 1184 | return 0; |
1180 | } | 1185 | } |
1181 | 1186 | ||
1182 | static void rhine_tx_timeout(struct net_device *dev) | 1187 | static void rhine_reset_task(struct work_struct *work) |
1183 | { | 1188 | { |
1184 | struct rhine_private *rp = netdev_priv(dev); | 1189 | struct rhine_private *rp = container_of(work, struct rhine_private, |
1185 | void __iomem *ioaddr = rp->base; | 1190 | reset_task); |
1186 | 1191 | struct net_device *dev = rp->dev; | |
1187 | printk(KERN_WARNING "%s: Transmit timed out, status %4.4x, PHY status " | ||
1188 | "%4.4x, resetting...\n", | ||
1189 | dev->name, ioread16(ioaddr + IntrStatus), | ||
1190 | mdio_read(dev, rp->mii_if.phy_id, MII_BMSR)); | ||
1191 | 1192 | ||
1192 | /* protect against concurrent rx interrupts */ | 1193 | /* protect against concurrent rx interrupts */ |
1193 | disable_irq(rp->pdev->irq); | 1194 | disable_irq(rp->pdev->irq); |
1194 | 1195 | ||
1195 | napi_disable(&rp->napi); | 1196 | napi_disable(&rp->napi); |
1196 | 1197 | ||
1197 | spin_lock(&rp->lock); | 1198 | spin_lock_bh(&rp->lock); |
1198 | 1199 | ||
1199 | /* clear all descriptors */ | 1200 | /* clear all descriptors */ |
1200 | free_tbufs(dev); | 1201 | free_tbufs(dev); |
@@ -1206,7 +1207,7 @@ static void rhine_tx_timeout(struct net_device *dev) | |||
1206 | rhine_chip_reset(dev); | 1207 | rhine_chip_reset(dev); |
1207 | init_registers(dev); | 1208 | init_registers(dev); |
1208 | 1209 | ||
1209 | spin_unlock(&rp->lock); | 1210 | spin_unlock_bh(&rp->lock); |
1210 | enable_irq(rp->pdev->irq); | 1211 | enable_irq(rp->pdev->irq); |
1211 | 1212 | ||
1212 | dev->trans_start = jiffies; | 1213 | dev->trans_start = jiffies; |
@@ -1214,6 +1215,19 @@ static void rhine_tx_timeout(struct net_device *dev) | |||
1214 | netif_wake_queue(dev); | 1215 | netif_wake_queue(dev); |
1215 | } | 1216 | } |
1216 | 1217 | ||
1218 | static void rhine_tx_timeout(struct net_device *dev) | ||
1219 | { | ||
1220 | struct rhine_private *rp = netdev_priv(dev); | ||
1221 | void __iomem *ioaddr = rp->base; | ||
1222 | |||
1223 | printk(KERN_WARNING "%s: Transmit timed out, status %4.4x, PHY status " | ||
1224 | "%4.4x, resetting...\n", | ||
1225 | dev->name, ioread16(ioaddr + IntrStatus), | ||
1226 | mdio_read(dev, rp->mii_if.phy_id, MII_BMSR)); | ||
1227 | |||
1228 | schedule_work(&rp->reset_task); | ||
1229 | } | ||
1230 | |||
1217 | static netdev_tx_t rhine_start_tx(struct sk_buff *skb, | 1231 | static netdev_tx_t rhine_start_tx(struct sk_buff *skb, |
1218 | struct net_device *dev) | 1232 | struct net_device *dev) |
1219 | { | 1233 | { |
@@ -1830,10 +1844,11 @@ static int rhine_close(struct net_device *dev) | |||
1830 | struct rhine_private *rp = netdev_priv(dev); | 1844 | struct rhine_private *rp = netdev_priv(dev); |
1831 | void __iomem *ioaddr = rp->base; | 1845 | void __iomem *ioaddr = rp->base; |
1832 | 1846 | ||
1833 | spin_lock_irq(&rp->lock); | ||
1834 | |||
1835 | netif_stop_queue(dev); | ||
1836 | napi_disable(&rp->napi); | 1847 | napi_disable(&rp->napi); |
1848 | cancel_work_sync(&rp->reset_task); | ||
1849 | netif_stop_queue(dev); | ||
1850 | |||
1851 | spin_lock_irq(&rp->lock); | ||
1837 | 1852 | ||
1838 | if (debug > 1) | 1853 | if (debug > 1) |
1839 | printk(KERN_DEBUG "%s: Shutting down ethercard, " | 1854 | printk(KERN_DEBUG "%s: Shutting down ethercard, " |
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index 4ceb441f2687..317aa34b21cf 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c | |||
@@ -1877,13 +1877,12 @@ static void velocity_error(struct velocity_info *vptr, int status) | |||
1877 | /** | 1877 | /** |
1878 | * tx_srv - transmit interrupt service | 1878 | * tx_srv - transmit interrupt service |
1879 | * @vptr; Velocity | 1879 | * @vptr; Velocity |
1880 | * @status: | ||
1881 | * | 1880 | * |
1882 | * Scan the queues looking for transmitted packets that | 1881 | * Scan the queues looking for transmitted packets that |
1883 | * we can complete and clean up. Update any statistics as | 1882 | * we can complete and clean up. Update any statistics as |
1884 | * necessary/ | 1883 | * necessary/ |
1885 | */ | 1884 | */ |
1886 | static int velocity_tx_srv(struct velocity_info *vptr, u32 status) | 1885 | static int velocity_tx_srv(struct velocity_info *vptr) |
1887 | { | 1886 | { |
1888 | struct tx_desc *td; | 1887 | struct tx_desc *td; |
1889 | int qnum; | 1888 | int qnum; |
@@ -2090,14 +2089,12 @@ static int velocity_receive_frame(struct velocity_info *vptr, int idx) | |||
2090 | /** | 2089 | /** |
2091 | * velocity_rx_srv - service RX interrupt | 2090 | * velocity_rx_srv - service RX interrupt |
2092 | * @vptr: velocity | 2091 | * @vptr: velocity |
2093 | * @status: adapter status (unused) | ||
2094 | * | 2092 | * |
2095 | * Walk the receive ring of the velocity adapter and remove | 2093 | * Walk the receive ring of the velocity adapter and remove |
2096 | * any received packets from the receive queue. Hand the ring | 2094 | * any received packets from the receive queue. Hand the ring |
2097 | * slots back to the adapter for reuse. | 2095 | * slots back to the adapter for reuse. |
2098 | */ | 2096 | */ |
2099 | static int velocity_rx_srv(struct velocity_info *vptr, int status, | 2097 | static int velocity_rx_srv(struct velocity_info *vptr, int budget_left) |
2100 | int budget_left) | ||
2101 | { | 2098 | { |
2102 | struct net_device_stats *stats = &vptr->dev->stats; | 2099 | struct net_device_stats *stats = &vptr->dev->stats; |
2103 | int rd_curr = vptr->rx.curr; | 2100 | int rd_curr = vptr->rx.curr; |
@@ -2151,32 +2148,24 @@ static int velocity_poll(struct napi_struct *napi, int budget) | |||
2151 | struct velocity_info *vptr = container_of(napi, | 2148 | struct velocity_info *vptr = container_of(napi, |
2152 | struct velocity_info, napi); | 2149 | struct velocity_info, napi); |
2153 | unsigned int rx_done; | 2150 | unsigned int rx_done; |
2154 | u32 isr_status; | 2151 | unsigned long flags; |
2155 | |||
2156 | spin_lock(&vptr->lock); | ||
2157 | isr_status = mac_read_isr(vptr->mac_regs); | ||
2158 | |||
2159 | /* Ack the interrupt */ | ||
2160 | mac_write_isr(vptr->mac_regs, isr_status); | ||
2161 | if (isr_status & (~(ISR_PRXI | ISR_PPRXI | ISR_PTXI | ISR_PPTXI))) | ||
2162 | velocity_error(vptr, isr_status); | ||
2163 | 2152 | ||
2153 | spin_lock_irqsave(&vptr->lock, flags); | ||
2164 | /* | 2154 | /* |
2165 | * Do rx and tx twice for performance (taken from the VIA | 2155 | * Do rx and tx twice for performance (taken from the VIA |
2166 | * out-of-tree driver). | 2156 | * out-of-tree driver). |
2167 | */ | 2157 | */ |
2168 | rx_done = velocity_rx_srv(vptr, isr_status, budget / 2); | 2158 | rx_done = velocity_rx_srv(vptr, budget / 2); |
2169 | velocity_tx_srv(vptr, isr_status); | 2159 | velocity_tx_srv(vptr); |
2170 | rx_done += velocity_rx_srv(vptr, isr_status, budget - rx_done); | 2160 | rx_done += velocity_rx_srv(vptr, budget - rx_done); |
2171 | velocity_tx_srv(vptr, isr_status); | 2161 | velocity_tx_srv(vptr); |
2172 | |||
2173 | spin_unlock(&vptr->lock); | ||
2174 | 2162 | ||
2175 | /* If budget not fully consumed, exit the polling mode */ | 2163 | /* If budget not fully consumed, exit the polling mode */ |
2176 | if (rx_done < budget) { | 2164 | if (rx_done < budget) { |
2177 | napi_complete(napi); | 2165 | napi_complete(napi); |
2178 | mac_enable_int(vptr->mac_regs); | 2166 | mac_enable_int(vptr->mac_regs); |
2179 | } | 2167 | } |
2168 | spin_unlock_irqrestore(&vptr->lock, flags); | ||
2180 | 2169 | ||
2181 | return rx_done; | 2170 | return rx_done; |
2182 | } | 2171 | } |
@@ -2206,10 +2195,17 @@ static irqreturn_t velocity_intr(int irq, void *dev_instance) | |||
2206 | return IRQ_NONE; | 2195 | return IRQ_NONE; |
2207 | } | 2196 | } |
2208 | 2197 | ||
2198 | /* Ack the interrupt */ | ||
2199 | mac_write_isr(vptr->mac_regs, isr_status); | ||
2200 | |||
2209 | if (likely(napi_schedule_prep(&vptr->napi))) { | 2201 | if (likely(napi_schedule_prep(&vptr->napi))) { |
2210 | mac_disable_int(vptr->mac_regs); | 2202 | mac_disable_int(vptr->mac_regs); |
2211 | __napi_schedule(&vptr->napi); | 2203 | __napi_schedule(&vptr->napi); |
2212 | } | 2204 | } |
2205 | |||
2206 | if (isr_status & (~(ISR_PRXI | ISR_PPRXI | ISR_PTXI | ISR_PPTXI))) | ||
2207 | velocity_error(vptr, isr_status); | ||
2208 | |||
2213 | spin_unlock(&vptr->lock); | 2209 | spin_unlock(&vptr->lock); |
2214 | 2210 | ||
2215 | return IRQ_HANDLED; | 2211 | return IRQ_HANDLED; |
@@ -2237,8 +2233,6 @@ static int velocity_open(struct net_device *dev) | |||
2237 | /* Ensure chip is running */ | 2233 | /* Ensure chip is running */ |
2238 | pci_set_power_state(vptr->pdev, PCI_D0); | 2234 | pci_set_power_state(vptr->pdev, PCI_D0); |
2239 | 2235 | ||
2240 | velocity_give_many_rx_descs(vptr); | ||
2241 | |||
2242 | velocity_init_registers(vptr, VELOCITY_INIT_COLD); | 2236 | velocity_init_registers(vptr, VELOCITY_INIT_COLD); |
2243 | 2237 | ||
2244 | ret = request_irq(vptr->pdev->irq, velocity_intr, IRQF_SHARED, | 2238 | ret = request_irq(vptr->pdev->irq, velocity_intr, IRQF_SHARED, |
@@ -2250,6 +2244,8 @@ static int velocity_open(struct net_device *dev) | |||
2250 | goto out; | 2244 | goto out; |
2251 | } | 2245 | } |
2252 | 2246 | ||
2247 | velocity_give_many_rx_descs(vptr); | ||
2248 | |||
2253 | mac_enable_int(vptr->mac_regs); | 2249 | mac_enable_int(vptr->mac_regs); |
2254 | netif_start_queue(dev); | 2250 | netif_start_queue(dev); |
2255 | napi_enable(&vptr->napi); | 2251 | napi_enable(&vptr->napi); |
@@ -2339,10 +2335,10 @@ static int velocity_change_mtu(struct net_device *dev, int new_mtu) | |||
2339 | 2335 | ||
2340 | dev->mtu = new_mtu; | 2336 | dev->mtu = new_mtu; |
2341 | 2337 | ||
2342 | velocity_give_many_rx_descs(vptr); | ||
2343 | |||
2344 | velocity_init_registers(vptr, VELOCITY_INIT_COLD); | 2338 | velocity_init_registers(vptr, VELOCITY_INIT_COLD); |
2345 | 2339 | ||
2340 | velocity_give_many_rx_descs(vptr); | ||
2341 | |||
2346 | mac_enable_int(vptr->mac_regs); | 2342 | mac_enable_int(vptr->mac_regs); |
2347 | netif_start_queue(dev); | 2343 | netif_start_queue(dev); |
2348 | 2344 | ||
@@ -3100,7 +3096,7 @@ static int velocity_resume(struct pci_dev *pdev) | |||
3100 | velocity_init_registers(vptr, VELOCITY_INIT_WOL); | 3096 | velocity_init_registers(vptr, VELOCITY_INIT_WOL); |
3101 | mac_disable_int(vptr->mac_regs); | 3097 | mac_disable_int(vptr->mac_regs); |
3102 | 3098 | ||
3103 | velocity_tx_srv(vptr, 0); | 3099 | velocity_tx_srv(vptr); |
3104 | 3100 | ||
3105 | for (i = 0; i < vptr->tx.numq; i++) { | 3101 | for (i = 0; i < vptr->tx.numq; i++) { |
3106 | if (vptr->tx.used[i]) | 3102 | if (vptr->tx.used[i]) |
@@ -3344,6 +3340,7 @@ static int velocity_set_coalesce(struct net_device *dev, | |||
3344 | { | 3340 | { |
3345 | struct velocity_info *vptr = netdev_priv(dev); | 3341 | struct velocity_info *vptr = netdev_priv(dev); |
3346 | int max_us = 0x3f * 64; | 3342 | int max_us = 0x3f * 64; |
3343 | unsigned long flags; | ||
3347 | 3344 | ||
3348 | /* 6 bits of */ | 3345 | /* 6 bits of */ |
3349 | if (ecmd->tx_coalesce_usecs > max_us) | 3346 | if (ecmd->tx_coalesce_usecs > max_us) |
@@ -3365,6 +3362,7 @@ static int velocity_set_coalesce(struct net_device *dev, | |||
3365 | ecmd->tx_coalesce_usecs); | 3362 | ecmd->tx_coalesce_usecs); |
3366 | 3363 | ||
3367 | /* Setup the interrupt suppression and queue timers */ | 3364 | /* Setup the interrupt suppression and queue timers */ |
3365 | spin_lock_irqsave(&vptr->lock, flags); | ||
3368 | mac_disable_int(vptr->mac_regs); | 3366 | mac_disable_int(vptr->mac_regs); |
3369 | setup_adaptive_interrupts(vptr); | 3367 | setup_adaptive_interrupts(vptr); |
3370 | setup_queue_timers(vptr); | 3368 | setup_queue_timers(vptr); |
@@ -3372,6 +3370,7 @@ static int velocity_set_coalesce(struct net_device *dev, | |||
3372 | mac_write_int_mask(vptr->int_mask, vptr->mac_regs); | 3370 | mac_write_int_mask(vptr->int_mask, vptr->mac_regs); |
3373 | mac_clear_isr(vptr->mac_regs); | 3371 | mac_clear_isr(vptr->mac_regs); |
3374 | mac_enable_int(vptr->mac_regs); | 3372 | mac_enable_int(vptr->mac_regs); |
3373 | spin_unlock_irqrestore(&vptr->lock, flags); | ||
3375 | 3374 | ||
3376 | return 0; | 3375 | return 0; |
3377 | } | 3376 | } |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index c708ecc3cb2e..9ead30bd00c4 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -395,8 +395,7 @@ static void refill_work(struct work_struct *work) | |||
395 | 395 | ||
396 | vi = container_of(work, struct virtnet_info, refill.work); | 396 | vi = container_of(work, struct virtnet_info, refill.work); |
397 | napi_disable(&vi->napi); | 397 | napi_disable(&vi->napi); |
398 | try_fill_recv(vi, GFP_KERNEL); | 398 | still_empty = !try_fill_recv(vi, GFP_KERNEL); |
399 | still_empty = (vi->num == 0); | ||
400 | napi_enable(&vi->napi); | 399 | napi_enable(&vi->napi); |
401 | 400 | ||
402 | /* In theory, this can happen: if we don't get any buffers in | 401 | /* In theory, this can happen: if we don't get any buffers in |
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c index f1c4b2a1e867..b9685e82f7b6 100644 --- a/drivers/net/vxge/vxge-main.c +++ b/drivers/net/vxge/vxge-main.c | |||
@@ -310,7 +310,7 @@ static int vxge_rx_map(void *dtrh, struct vxge_ring *ring) | |||
310 | dma_addr = pci_map_single(ring->pdev, rx_priv->skb_data, | 310 | dma_addr = pci_map_single(ring->pdev, rx_priv->skb_data, |
311 | rx_priv->data_size, PCI_DMA_FROMDEVICE); | 311 | rx_priv->data_size, PCI_DMA_FROMDEVICE); |
312 | 312 | ||
313 | if (dma_addr == 0) { | 313 | if (unlikely(pci_dma_mapping_error(ring->pdev, dma_addr))) { |
314 | ring->stats.pci_map_fail++; | 314 | ring->stats.pci_map_fail++; |
315 | return -EIO; | 315 | return -EIO; |
316 | } | 316 | } |
@@ -4087,21 +4087,21 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
4087 | goto _exit0; | 4087 | goto _exit0; |
4088 | } | 4088 | } |
4089 | 4089 | ||
4090 | if (!pci_set_dma_mask(pdev, 0xffffffffffffffffULL)) { | 4090 | if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { |
4091 | vxge_debug_ll_config(VXGE_TRACE, | 4091 | vxge_debug_ll_config(VXGE_TRACE, |
4092 | "%s : using 64bit DMA", __func__); | 4092 | "%s : using 64bit DMA", __func__); |
4093 | 4093 | ||
4094 | high_dma = 1; | 4094 | high_dma = 1; |
4095 | 4095 | ||
4096 | if (pci_set_consistent_dma_mask(pdev, | 4096 | if (pci_set_consistent_dma_mask(pdev, |
4097 | 0xffffffffffffffffULL)) { | 4097 | DMA_BIT_MASK(64))) { |
4098 | vxge_debug_init(VXGE_ERR, | 4098 | vxge_debug_init(VXGE_ERR, |
4099 | "%s : unable to obtain 64bit DMA for " | 4099 | "%s : unable to obtain 64bit DMA for " |
4100 | "consistent allocations", __func__); | 4100 | "consistent allocations", __func__); |
4101 | ret = -ENOMEM; | 4101 | ret = -ENOMEM; |
4102 | goto _exit1; | 4102 | goto _exit1; |
4103 | } | 4103 | } |
4104 | } else if (!pci_set_dma_mask(pdev, 0xffffffffUL)) { | 4104 | } else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { |
4105 | vxge_debug_ll_config(VXGE_TRACE, | 4105 | vxge_debug_ll_config(VXGE_TRACE, |
4106 | "%s : using 32bit DMA", __func__); | 4106 | "%s : using 32bit DMA", __func__); |
4107 | } else { | 4107 | } else { |
diff --git a/drivers/net/wimax/i2400m/i2400m-usb.h b/drivers/net/wimax/i2400m/i2400m-usb.h index 5cc0f279417e..2d7c96d7e865 100644 --- a/drivers/net/wimax/i2400m/i2400m-usb.h +++ b/drivers/net/wimax/i2400m/i2400m-usb.h | |||
@@ -151,6 +151,7 @@ enum { | |||
151 | 151 | ||
152 | /* Device IDs */ | 152 | /* Device IDs */ |
153 | USB_DEVICE_ID_I6050 = 0x0186, | 153 | USB_DEVICE_ID_I6050 = 0x0186, |
154 | USB_DEVICE_ID_I6050_2 = 0x0188, | ||
154 | }; | 155 | }; |
155 | 156 | ||
156 | 157 | ||
@@ -234,6 +235,7 @@ struct i2400mu { | |||
234 | u8 rx_size_auto_shrink; | 235 | u8 rx_size_auto_shrink; |
235 | 236 | ||
236 | struct dentry *debugfs_dentry; | 237 | struct dentry *debugfs_dentry; |
238 | unsigned i6050:1; /* 1 if this is a 6050 based SKU */ | ||
237 | }; | 239 | }; |
238 | 240 | ||
239 | 241 | ||
diff --git a/drivers/net/wimax/i2400m/usb.c b/drivers/net/wimax/i2400m/usb.c index 3b48681f8a0d..98f4f8c5fb68 100644 --- a/drivers/net/wimax/i2400m/usb.c +++ b/drivers/net/wimax/i2400m/usb.c | |||
@@ -478,7 +478,16 @@ int i2400mu_probe(struct usb_interface *iface, | |||
478 | i2400m->bus_bm_wait_for_ack = i2400mu_bus_bm_wait_for_ack; | 478 | i2400m->bus_bm_wait_for_ack = i2400mu_bus_bm_wait_for_ack; |
479 | i2400m->bus_bm_mac_addr_impaired = 0; | 479 | i2400m->bus_bm_mac_addr_impaired = 0; |
480 | 480 | ||
481 | if (id->idProduct == USB_DEVICE_ID_I6050) { | 481 | switch (id->idProduct) { |
482 | case USB_DEVICE_ID_I6050: | ||
483 | case USB_DEVICE_ID_I6050_2: | ||
484 | i2400mu->i6050 = 1; | ||
485 | break; | ||
486 | default: | ||
487 | break; | ||
488 | } | ||
489 | |||
490 | if (i2400mu->i6050) { | ||
482 | i2400m->bus_fw_names = i2400mu_bus_fw_names_6050; | 491 | i2400m->bus_fw_names = i2400mu_bus_fw_names_6050; |
483 | i2400mu->endpoint_cfg.bulk_out = 0; | 492 | i2400mu->endpoint_cfg.bulk_out = 0; |
484 | i2400mu->endpoint_cfg.notification = 3; | 493 | i2400mu->endpoint_cfg.notification = 3; |
@@ -719,6 +728,7 @@ int i2400mu_post_reset(struct usb_interface *iface) | |||
719 | static | 728 | static |
720 | struct usb_device_id i2400mu_id_table[] = { | 729 | struct usb_device_id i2400mu_id_table[] = { |
721 | { USB_DEVICE(0x8086, USB_DEVICE_ID_I6050) }, | 730 | { USB_DEVICE(0x8086, USB_DEVICE_ID_I6050) }, |
731 | { USB_DEVICE(0x8086, USB_DEVICE_ID_I6050_2) }, | ||
722 | { USB_DEVICE(0x8086, 0x0181) }, | 732 | { USB_DEVICE(0x8086, 0x0181) }, |
723 | { USB_DEVICE(0x8086, 0x1403) }, | 733 | { USB_DEVICE(0x8086, 0x1403) }, |
724 | { USB_DEVICE(0x8086, 0x1405) }, | 734 | { USB_DEVICE(0x8086, 0x1405) }, |
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index a4c086f069b1..e63b7c40d0ee 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -1903,17 +1903,6 @@ accept: | |||
1903 | rxs->noise = sc->ah->ah_noise_floor; | 1903 | rxs->noise = sc->ah->ah_noise_floor; |
1904 | rxs->signal = rxs->noise + rs.rs_rssi; | 1904 | rxs->signal = rxs->noise + rs.rs_rssi; |
1905 | 1905 | ||
1906 | /* An rssi of 35 indicates you should be able use | ||
1907 | * 54 Mbps reliably. A more elaborate scheme can be used | ||
1908 | * here but it requires a map of SNR/throughput for each | ||
1909 | * possible mode used */ | ||
1910 | rxs->qual = rs.rs_rssi * 100 / 35; | ||
1911 | |||
1912 | /* rssi can be more than 35 though, anything above that | ||
1913 | * should be considered at 100% */ | ||
1914 | if (rxs->qual > 100) | ||
1915 | rxs->qual = 100; | ||
1916 | |||
1917 | rxs->antenna = rs.rs_antenna; | 1906 | rxs->antenna = rs.rs_antenna; |
1918 | rxs->rate_idx = ath5k_hw_to_driver_rix(sc, rs.rs_rate); | 1907 | rxs->rate_idx = ath5k_hw_to_driver_rix(sc, rs.rs_rate); |
1919 | rxs->flag |= ath5k_rx_decrypted(sc, ds, skb, &rs); | 1908 | rxs->flag |= ath5k_rx_decrypted(sc, ds, skb, &rs); |
@@ -2381,6 +2370,9 @@ ath5k_init(struct ath5k_softc *sc) | |||
2381 | */ | 2370 | */ |
2382 | ath5k_stop_locked(sc); | 2371 | ath5k_stop_locked(sc); |
2383 | 2372 | ||
2373 | /* Set PHY calibration interval */ | ||
2374 | ah->ah_cal_intval = ath5k_calinterval; | ||
2375 | |||
2384 | /* | 2376 | /* |
2385 | * The basic interface to setting the hardware in a good | 2377 | * The basic interface to setting the hardware in a good |
2386 | * state is ``reset''. On return the hardware is known to | 2378 | * state is ``reset''. On return the hardware is known to |
@@ -2408,10 +2400,6 @@ ath5k_init(struct ath5k_softc *sc) | |||
2408 | 2400 | ||
2409 | /* Set ack to be sent at low bit-rates */ | 2401 | /* Set ack to be sent at low bit-rates */ |
2410 | ath5k_hw_set_ack_bitrate_high(ah, false); | 2402 | ath5k_hw_set_ack_bitrate_high(ah, false); |
2411 | |||
2412 | /* Set PHY calibration inteval */ | ||
2413 | ah->ah_cal_intval = ath5k_calinterval; | ||
2414 | |||
2415 | ret = 0; | 2403 | ret = 0; |
2416 | done: | 2404 | done: |
2417 | mmiowb(); | 2405 | mmiowb(); |
diff --git a/drivers/net/wireless/ath/ath5k/eeprom.c b/drivers/net/wireless/ath/ath5k/eeprom.c index 5d1c8677f180..6a3f4da7fb48 100644 --- a/drivers/net/wireless/ath/ath5k/eeprom.c +++ b/drivers/net/wireless/ath/ath5k/eeprom.c | |||
@@ -97,7 +97,7 @@ ath5k_eeprom_init_header(struct ath5k_hw *ah) | |||
97 | struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; | 97 | struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; |
98 | int ret; | 98 | int ret; |
99 | u16 val; | 99 | u16 val; |
100 | u32 cksum, offset; | 100 | u32 cksum, offset, eep_max = AR5K_EEPROM_INFO_MAX; |
101 | 101 | ||
102 | /* | 102 | /* |
103 | * Read values from EEPROM and store them in the capability structure | 103 | * Read values from EEPROM and store them in the capability structure |
@@ -116,12 +116,38 @@ ath5k_eeprom_init_header(struct ath5k_hw *ah) | |||
116 | * Validate the checksum of the EEPROM date. There are some | 116 | * Validate the checksum of the EEPROM date. There are some |
117 | * devices with invalid EEPROMs. | 117 | * devices with invalid EEPROMs. |
118 | */ | 118 | */ |
119 | for (cksum = 0, offset = 0; offset < AR5K_EEPROM_INFO_MAX; offset++) { | 119 | AR5K_EEPROM_READ(AR5K_EEPROM_SIZE_UPPER, val); |
120 | if (val) { | ||
121 | eep_max = (val & AR5K_EEPROM_SIZE_UPPER_MASK) << | ||
122 | AR5K_EEPROM_SIZE_ENDLOC_SHIFT; | ||
123 | AR5K_EEPROM_READ(AR5K_EEPROM_SIZE_LOWER, val); | ||
124 | eep_max = (eep_max | val) - AR5K_EEPROM_INFO_BASE; | ||
125 | |||
126 | /* | ||
127 | * Fail safe check to prevent stupid loops due | ||
128 | * to busted EEPROMs. XXX: This value is likely too | ||
129 | * big still, waiting on a better value. | ||
130 | */ | ||
131 | if (eep_max > (3 * AR5K_EEPROM_INFO_MAX)) { | ||
132 | ATH5K_ERR(ah->ah_sc, "Invalid max custom EEPROM size: " | ||
133 | "%d (0x%04x) max expected: %d (0x%04x)\n", | ||
134 | eep_max, eep_max, | ||
135 | 3 * AR5K_EEPROM_INFO_MAX, | ||
136 | 3 * AR5K_EEPROM_INFO_MAX); | ||
137 | return -EIO; | ||
138 | } | ||
139 | } | ||
140 | |||
141 | for (cksum = 0, offset = 0; offset < eep_max; offset++) { | ||
120 | AR5K_EEPROM_READ(AR5K_EEPROM_INFO(offset), val); | 142 | AR5K_EEPROM_READ(AR5K_EEPROM_INFO(offset), val); |
121 | cksum ^= val; | 143 | cksum ^= val; |
122 | } | 144 | } |
123 | if (cksum != AR5K_EEPROM_INFO_CKSUM) { | 145 | if (cksum != AR5K_EEPROM_INFO_CKSUM) { |
124 | ATH5K_ERR(ah->ah_sc, "Invalid EEPROM checksum 0x%04x\n", cksum); | 146 | ATH5K_ERR(ah->ah_sc, "Invalid EEPROM " |
147 | "checksum: 0x%04x eep_max: 0x%04x (%s)\n", | ||
148 | cksum, eep_max, | ||
149 | eep_max == AR5K_EEPROM_INFO_MAX ? | ||
150 | "default size" : "custom size"); | ||
125 | return -EIO; | 151 | return -EIO; |
126 | } | 152 | } |
127 | 153 | ||
diff --git a/drivers/net/wireless/ath/ath5k/eeprom.h b/drivers/net/wireless/ath/ath5k/eeprom.h index 0123f3521a0b..473a483bb9c3 100644 --- a/drivers/net/wireless/ath/ath5k/eeprom.h +++ b/drivers/net/wireless/ath/ath5k/eeprom.h | |||
@@ -37,6 +37,14 @@ | |||
37 | #define AR5K_EEPROM_RFKILL_POLARITY_S 1 | 37 | #define AR5K_EEPROM_RFKILL_POLARITY_S 1 |
38 | 38 | ||
39 | #define AR5K_EEPROM_REG_DOMAIN 0x00bf /* EEPROM regdom */ | 39 | #define AR5K_EEPROM_REG_DOMAIN 0x00bf /* EEPROM regdom */ |
40 | |||
41 | /* FLASH(EEPROM) Defines for AR531X chips */ | ||
42 | #define AR5K_EEPROM_SIZE_LOWER 0x1b /* size info -- lower */ | ||
43 | #define AR5K_EEPROM_SIZE_UPPER 0x1c /* size info -- upper */ | ||
44 | #define AR5K_EEPROM_SIZE_UPPER_MASK 0xfff0 | ||
45 | #define AR5K_EEPROM_SIZE_UPPER_SHIFT 4 | ||
46 | #define AR5K_EEPROM_SIZE_ENDLOC_SHIFT 12 | ||
47 | |||
40 | #define AR5K_EEPROM_CHECKSUM 0x00c0 /* EEPROM checksum */ | 48 | #define AR5K_EEPROM_CHECKSUM 0x00c0 /* EEPROM checksum */ |
41 | #define AR5K_EEPROM_INFO_BASE 0x00c0 /* EEPROM header */ | 49 | #define AR5K_EEPROM_INFO_BASE 0x00c0 /* EEPROM header */ |
42 | #define AR5K_EEPROM_INFO_MAX (0x400 - AR5K_EEPROM_INFO_BASE) | 50 | #define AR5K_EEPROM_INFO_MAX (0x400 - AR5K_EEPROM_INFO_BASE) |
diff --git a/drivers/net/wireless/ath/ath9k/Kconfig b/drivers/net/wireless/ath/ath9k/Kconfig index 03a1106ad725..5774cea23a3b 100644 --- a/drivers/net/wireless/ath/ath9k/Kconfig +++ b/drivers/net/wireless/ath/ath9k/Kconfig | |||
@@ -25,7 +25,7 @@ config ATH9K | |||
25 | 25 | ||
26 | config ATH9K_DEBUGFS | 26 | config ATH9K_DEBUGFS |
27 | bool "Atheros ath9k debugging" | 27 | bool "Atheros ath9k debugging" |
28 | depends on ATH9K | 28 | depends on ATH9K && DEBUG_FS |
29 | ---help--- | 29 | ---help--- |
30 | Say Y, if you need access to ath9k's statistics for | 30 | Say Y, if you need access to ath9k's statistics for |
31 | interrupts, rate control, etc. | 31 | interrupts, rate control, etc. |
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index e2cef2ff5d8f..1597a42731ed 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | |||
@@ -33,11 +33,11 @@ struct ath_node; | |||
33 | 33 | ||
34 | /* Macro to expand scalars to 64-bit objects */ | 34 | /* Macro to expand scalars to 64-bit objects */ |
35 | 35 | ||
36 | #define ito64(x) (sizeof(x) == 8) ? \ | 36 | #define ito64(x) (sizeof(x) == 1) ? \ |
37 | (((unsigned long long int)(x)) & (0xff)) : \ | 37 | (((unsigned long long int)(x)) & (0xff)) : \ |
38 | (sizeof(x) == 16) ? \ | 38 | (sizeof(x) == 2) ? \ |
39 | (((unsigned long long int)(x)) & 0xffff) : \ | 39 | (((unsigned long long int)(x)) & 0xffff) : \ |
40 | ((sizeof(x) == 32) ? \ | 40 | ((sizeof(x) == 4) ? \ |
41 | (((unsigned long long int)(x)) & 0xffffffff) : \ | 41 | (((unsigned long long int)(x)) & 0xffffffff) : \ |
42 | (unsigned long long int)(x)) | 42 | (unsigned long long int)(x)) |
43 | 43 | ||
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 2ec61f08cfdb..ae371448b5a0 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -855,12 +855,11 @@ static void ath9k_hw_init_mode_gain_regs(struct ath_hw *ah) | |||
855 | } | 855 | } |
856 | } | 856 | } |
857 | 857 | ||
858 | static void ath9k_hw_init_11a_eeprom_fix(struct ath_hw *ah) | 858 | static void ath9k_hw_init_eeprom_fix(struct ath_hw *ah) |
859 | { | 859 | { |
860 | u32 i, j; | 860 | u32 i, j; |
861 | 861 | ||
862 | if ((ah->hw_version.devid == AR9280_DEVID_PCI) && | 862 | if (ah->hw_version.devid == AR9280_DEVID_PCI) { |
863 | test_bit(ATH9K_MODE_11A, ah->caps.wireless_modes)) { | ||
864 | 863 | ||
865 | /* EEPROM Fixup */ | 864 | /* EEPROM Fixup */ |
866 | for (i = 0; i < ah->iniModes.ia_rows; i++) { | 865 | for (i = 0; i < ah->iniModes.ia_rows; i++) { |
@@ -980,7 +979,7 @@ int ath9k_hw_init(struct ath_hw *ah) | |||
980 | if (r) | 979 | if (r) |
981 | return r; | 980 | return r; |
982 | 981 | ||
983 | ath9k_hw_init_11a_eeprom_fix(ah); | 982 | ath9k_hw_init_eeprom_fix(ah); |
984 | 983 | ||
985 | r = ath9k_hw_init_macaddr(ah); | 984 | r = ath9k_hw_init_macaddr(ah); |
986 | if (r) { | 985 | if (r) { |
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c index 71b84d91dcff..efc420cd42bf 100644 --- a/drivers/net/wireless/ath/ath9k/mac.c +++ b/drivers/net/wireless/ath/ath9k/mac.c | |||
@@ -186,7 +186,7 @@ bool ath9k_hw_stoptxdma(struct ath_hw *ah, u32 q) | |||
186 | wait = wait_time; | 186 | wait = wait_time; |
187 | while (ath9k_hw_numtxpending(ah, q)) { | 187 | while (ath9k_hw_numtxpending(ah, q)) { |
188 | if ((--wait) == 0) { | 188 | if ((--wait) == 0) { |
189 | ath_print(common, ATH_DBG_QUEUE, | 189 | ath_print(common, ATH_DBG_FATAL, |
190 | "Failed to stop TX DMA in 100 " | 190 | "Failed to stop TX DMA in 100 " |
191 | "msec after killing last frame\n"); | 191 | "msec after killing last frame\n"); |
192 | break; | 192 | break; |
diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/ath/ath9k/mac.h index 0c87771383f0..e185479e295e 100644 --- a/drivers/net/wireless/ath/ath9k/mac.h +++ b/drivers/net/wireless/ath/ath9k/mac.h | |||
@@ -77,6 +77,9 @@ | |||
77 | #define ATH9K_TXERR_XTXOP 0x08 | 77 | #define ATH9K_TXERR_XTXOP 0x08 |
78 | #define ATH9K_TXERR_TIMER_EXPIRED 0x10 | 78 | #define ATH9K_TXERR_TIMER_EXPIRED 0x10 |
79 | #define ATH9K_TX_ACKED 0x20 | 79 | #define ATH9K_TX_ACKED 0x20 |
80 | #define ATH9K_TXERR_MASK \ | ||
81 | (ATH9K_TXERR_XRETRY | ATH9K_TXERR_FILT | ATH9K_TXERR_FIFO | \ | ||
82 | ATH9K_TXERR_XTXOP | ATH9K_TXERR_TIMER_EXPIRED) | ||
80 | 83 | ||
81 | #define ATH9K_TX_BA 0x01 | 84 | #define ATH9K_TX_BA 0x01 |
82 | #define ATH9K_TX_PWRMGMT 0x02 | 85 | #define ATH9K_TX_PWRMGMT 0x02 |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index c48743452515..643bea35686f 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -1973,6 +1973,9 @@ int ath_reset(struct ath_softc *sc, bool retry_tx) | |||
1973 | struct ieee80211_hw *hw = sc->hw; | 1973 | struct ieee80211_hw *hw = sc->hw; |
1974 | int r; | 1974 | int r; |
1975 | 1975 | ||
1976 | /* Stop ANI */ | ||
1977 | del_timer_sync(&common->ani.timer); | ||
1978 | |||
1976 | ath9k_hw_set_interrupts(ah, 0); | 1979 | ath9k_hw_set_interrupts(ah, 0); |
1977 | ath_drain_all_txq(sc, retry_tx); | 1980 | ath_drain_all_txq(sc, retry_tx); |
1978 | ath_stoprecv(sc); | 1981 | ath_stoprecv(sc); |
@@ -2014,6 +2017,9 @@ int ath_reset(struct ath_softc *sc, bool retry_tx) | |||
2014 | } | 2017 | } |
2015 | } | 2018 | } |
2016 | 2019 | ||
2020 | /* Start ANI */ | ||
2021 | ath_start_ani(common); | ||
2022 | |||
2017 | return r; | 2023 | return r; |
2018 | } | 2024 | } |
2019 | 2025 | ||
@@ -2508,6 +2514,9 @@ static void ath9k_stop(struct ieee80211_hw *hw) | |||
2508 | return; /* another wiphy still in use */ | 2514 | return; /* another wiphy still in use */ |
2509 | } | 2515 | } |
2510 | 2516 | ||
2517 | /* Ensure HW is awake when we try to shut it down. */ | ||
2518 | ath9k_ps_wakeup(sc); | ||
2519 | |||
2511 | if (ah->btcoex_hw.enabled) { | 2520 | if (ah->btcoex_hw.enabled) { |
2512 | ath9k_hw_btcoex_disable(ah); | 2521 | ath9k_hw_btcoex_disable(ah); |
2513 | if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE) | 2522 | if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE) |
@@ -2528,6 +2537,9 @@ static void ath9k_stop(struct ieee80211_hw *hw) | |||
2528 | /* disable HAL and put h/w to sleep */ | 2537 | /* disable HAL and put h/w to sleep */ |
2529 | ath9k_hw_disable(ah); | 2538 | ath9k_hw_disable(ah); |
2530 | ath9k_hw_configpcipowersave(ah, 1, 1); | 2539 | ath9k_hw_configpcipowersave(ah, 1, 1); |
2540 | ath9k_ps_restore(sc); | ||
2541 | |||
2542 | /* Finally, put the chip in FULL SLEEP mode */ | ||
2531 | ath9k_setpower(sc, ATH9K_PM_FULL_SLEEP); | 2543 | ath9k_setpower(sc, ATH9K_PM_FULL_SLEEP); |
2532 | 2544 | ||
2533 | sc->sc_flags |= SC_OP_INVALID; | 2545 | sc->sc_flags |= SC_OP_INVALID; |
@@ -2641,10 +2653,12 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw, | |||
2641 | if ((sc->sc_ah->opmode == NL80211_IFTYPE_AP) || | 2653 | if ((sc->sc_ah->opmode == NL80211_IFTYPE_AP) || |
2642 | (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) || | 2654 | (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) || |
2643 | (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT)) { | 2655 | (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT)) { |
2656 | ath9k_ps_wakeup(sc); | ||
2644 | ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq); | 2657 | ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq); |
2645 | ath_beacon_return(sc, avp); | 2658 | ath9k_ps_restore(sc); |
2646 | } | 2659 | } |
2647 | 2660 | ||
2661 | ath_beacon_return(sc, avp); | ||
2648 | sc->sc_flags &= ~SC_OP_BEACONS; | 2662 | sc->sc_flags &= ~SC_OP_BEACONS; |
2649 | 2663 | ||
2650 | for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++) { | 2664 | for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++) { |
@@ -3091,15 +3105,21 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw, | |||
3091 | case IEEE80211_AMPDU_RX_STOP: | 3105 | case IEEE80211_AMPDU_RX_STOP: |
3092 | break; | 3106 | break; |
3093 | case IEEE80211_AMPDU_TX_START: | 3107 | case IEEE80211_AMPDU_TX_START: |
3108 | ath9k_ps_wakeup(sc); | ||
3094 | ath_tx_aggr_start(sc, sta, tid, ssn); | 3109 | ath_tx_aggr_start(sc, sta, tid, ssn); |
3095 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); | 3110 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
3111 | ath9k_ps_restore(sc); | ||
3096 | break; | 3112 | break; |
3097 | case IEEE80211_AMPDU_TX_STOP: | 3113 | case IEEE80211_AMPDU_TX_STOP: |
3114 | ath9k_ps_wakeup(sc); | ||
3098 | ath_tx_aggr_stop(sc, sta, tid); | 3115 | ath_tx_aggr_stop(sc, sta, tid); |
3099 | ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); | 3116 | ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
3117 | ath9k_ps_restore(sc); | ||
3100 | break; | 3118 | break; |
3101 | case IEEE80211_AMPDU_TX_OPERATIONAL: | 3119 | case IEEE80211_AMPDU_TX_OPERATIONAL: |
3120 | ath9k_ps_wakeup(sc); | ||
3102 | ath_tx_aggr_resume(sc, sta, tid); | 3121 | ath_tx_aggr_resume(sc, sta, tid); |
3122 | ath9k_ps_restore(sc); | ||
3103 | break; | 3123 | break; |
3104 | default: | 3124 | default: |
3105 | ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL, | 3125 | ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL, |
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c index 5321f735e5a0..f7af5ea54753 100644 --- a/drivers/net/wireless/ath/ath9k/pci.c +++ b/drivers/net/wireless/ath/ath9k/pci.c | |||
@@ -96,7 +96,7 @@ static void ath_pci_bt_coex_prep(struct ath_common *common) | |||
96 | pci_write_config_byte(pdev, ATH_PCIE_CAP_LINK_CTRL, aspm); | 96 | pci_write_config_byte(pdev, ATH_PCIE_CAP_LINK_CTRL, aspm); |
97 | } | 97 | } |
98 | 98 | ||
99 | const static struct ath_bus_ops ath_pci_bus_ops = { | 99 | static const struct ath_bus_ops ath_pci_bus_ops = { |
100 | .read_cachesize = ath_pci_read_cachesize, | 100 | .read_cachesize = ath_pci_read_cachesize, |
101 | .cleanup = ath_pci_cleanup, | 101 | .cleanup = ath_pci_cleanup, |
102 | .eeprom_read = ath_pci_eeprom_read, | 102 | .eeprom_read = ath_pci_eeprom_read, |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 2a11cc57ceea..29bf33692f71 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -1108,11 +1108,11 @@ void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx) | |||
1108 | if (npend) { | 1108 | if (npend) { |
1109 | int r; | 1109 | int r; |
1110 | 1110 | ||
1111 | ath_print(common, ATH_DBG_XMIT, | 1111 | ath_print(common, ATH_DBG_FATAL, |
1112 | "Unable to stop TxDMA. Reset HAL!\n"); | 1112 | "Unable to stop TxDMA. Reset HAL!\n"); |
1113 | 1113 | ||
1114 | spin_lock_bh(&sc->sc_resetlock); | 1114 | spin_lock_bh(&sc->sc_resetlock); |
1115 | r = ath9k_hw_reset(ah, sc->sc_ah->curchan, true); | 1115 | r = ath9k_hw_reset(ah, sc->sc_ah->curchan, false); |
1116 | if (r) | 1116 | if (r) |
1117 | ath_print(common, ATH_DBG_FATAL, | 1117 | ath_print(common, ATH_DBG_FATAL, |
1118 | "Unable to reset hardware; reset status %d\n", | 1118 | "Unable to reset hardware; reset status %d\n", |
@@ -1414,17 +1414,9 @@ static void assign_aggr_tid_seqno(struct sk_buff *skb, | |||
1414 | * For HT capable stations, we save tidno for later use. | 1414 | * For HT capable stations, we save tidno for later use. |
1415 | * We also override seqno set by upper layer with the one | 1415 | * We also override seqno set by upper layer with the one |
1416 | * in tx aggregation state. | 1416 | * in tx aggregation state. |
1417 | * | ||
1418 | * If fragmentation is on, the sequence number is | ||
1419 | * not overridden, since it has been | ||
1420 | * incremented by the fragmentation routine. | ||
1421 | * | ||
1422 | * FIXME: check if the fragmentation threshold exceeds | ||
1423 | * IEEE80211 max. | ||
1424 | */ | 1417 | */ |
1425 | tid = ATH_AN_2_TID(an, bf->bf_tidno); | 1418 | tid = ATH_AN_2_TID(an, bf->bf_tidno); |
1426 | hdr->seq_ctrl = cpu_to_le16(tid->seq_next << | 1419 | hdr->seq_ctrl = cpu_to_le16(tid->seq_next << IEEE80211_SEQ_SEQ_SHIFT); |
1427 | IEEE80211_SEQ_SEQ_SHIFT); | ||
1428 | bf->bf_seqno = tid->seq_next; | 1420 | bf->bf_seqno = tid->seq_next; |
1429 | INCR(tid->seq_next, IEEE80211_SEQ_MAX); | 1421 | INCR(tid->seq_next, IEEE80211_SEQ_MAX); |
1430 | } | 1422 | } |
@@ -1623,7 +1615,7 @@ static int ath_tx_setup_buffer(struct ieee80211_hw *hw, struct ath_buf *bf, | |||
1623 | bf->bf_frmlen -= padsize; | 1615 | bf->bf_frmlen -= padsize; |
1624 | } | 1616 | } |
1625 | 1617 | ||
1626 | if (conf_is_ht(&hw->conf) && !is_pae(skb)) | 1618 | if (conf_is_ht(&hw->conf)) |
1627 | bf->bf_state.bf_type |= BUF_HT; | 1619 | bf->bf_state.bf_type |= BUF_HT; |
1628 | 1620 | ||
1629 | bf->bf_flags = setup_tx_flags(sc, skb, txctl->txq); | 1621 | bf->bf_flags = setup_tx_flags(sc, skb, txctl->txq); |
@@ -1636,7 +1628,8 @@ static int ath_tx_setup_buffer(struct ieee80211_hw *hw, struct ath_buf *bf, | |||
1636 | bf->bf_keyix = ATH9K_TXKEYIX_INVALID; | 1628 | bf->bf_keyix = ATH9K_TXKEYIX_INVALID; |
1637 | } | 1629 | } |
1638 | 1630 | ||
1639 | if (ieee80211_is_data_qos(fc) && (sc->sc_flags & SC_OP_TXAGGR)) | 1631 | if (ieee80211_is_data_qos(fc) && bf_isht(bf) && |
1632 | (sc->sc_flags & SC_OP_TXAGGR)) | ||
1640 | assign_aggr_tid_seqno(skb, bf); | 1633 | assign_aggr_tid_seqno(skb, bf); |
1641 | 1634 | ||
1642 | bf->bf_mpdu = skb; | 1635 | bf->bf_mpdu = skb; |
@@ -1708,7 +1701,7 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf, | |||
1708 | goto tx_done; | 1701 | goto tx_done; |
1709 | } | 1702 | } |
1710 | 1703 | ||
1711 | if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) { | 1704 | if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && !is_pae(skb)) { |
1712 | /* | 1705 | /* |
1713 | * Try aggregation if it's a unicast data frame | 1706 | * Try aggregation if it's a unicast data frame |
1714 | * and the destination is HT capable. | 1707 | * and the destination is HT capable. |
@@ -1780,7 +1773,8 @@ void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1780 | struct ath_wiphy *aphy = hw->priv; | 1773 | struct ath_wiphy *aphy = hw->priv; |
1781 | struct ath_softc *sc = aphy->sc; | 1774 | struct ath_softc *sc = aphy->sc; |
1782 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 1775 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
1783 | int hdrlen, padsize; | 1776 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
1777 | int padpos, padsize; | ||
1784 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 1778 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
1785 | struct ath_tx_control txctl; | 1779 | struct ath_tx_control txctl; |
1786 | 1780 | ||
@@ -1792,7 +1786,6 @@ void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1792 | * BSSes. | 1786 | * BSSes. |
1793 | */ | 1787 | */ |
1794 | if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { | 1788 | if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { |
1795 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | ||
1796 | if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) | 1789 | if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) |
1797 | sc->tx.seq_no += 0x10; | 1790 | sc->tx.seq_no += 0x10; |
1798 | hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); | 1791 | hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); |
@@ -1800,9 +1793,9 @@ void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1800 | } | 1793 | } |
1801 | 1794 | ||
1802 | /* Add the padding after the header if this is not already done */ | 1795 | /* Add the padding after the header if this is not already done */ |
1803 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); | 1796 | padpos = ath9k_cmn_padpos(hdr->frame_control); |
1804 | if (hdrlen & 3) { | 1797 | padsize = padpos & 3; |
1805 | padsize = hdrlen % 4; | 1798 | if (padsize && skb->len>padpos) { |
1806 | if (skb_headroom(skb) < padsize) { | 1799 | if (skb_headroom(skb) < padsize) { |
1807 | ath_print(common, ATH_DBG_XMIT, | 1800 | ath_print(common, ATH_DBG_XMIT, |
1808 | "TX CABQ padding failed\n"); | 1801 | "TX CABQ padding failed\n"); |
@@ -1810,7 +1803,7 @@ void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1810 | return; | 1803 | return; |
1811 | } | 1804 | } |
1812 | skb_push(skb, padsize); | 1805 | skb_push(skb, padsize); |
1813 | memmove(skb->data, skb->data + padsize, hdrlen); | 1806 | memmove(skb->data, skb->data + padsize, padpos); |
1814 | } | 1807 | } |
1815 | 1808 | ||
1816 | txctl.txq = sc->beacon.cabq; | 1809 | txctl.txq = sc->beacon.cabq; |
@@ -1838,7 +1831,8 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, | |||
1838 | struct ieee80211_hw *hw = sc->hw; | 1831 | struct ieee80211_hw *hw = sc->hw; |
1839 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | 1832 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); |
1840 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 1833 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
1841 | int hdrlen, padsize; | 1834 | struct ieee80211_hdr * hdr = (struct ieee80211_hdr *)skb->data; |
1835 | int padpos, padsize; | ||
1842 | 1836 | ||
1843 | ath_print(common, ATH_DBG_XMIT, "TX complete: skb: %p\n", skb); | 1837 | ath_print(common, ATH_DBG_XMIT, "TX complete: skb: %p\n", skb); |
1844 | 1838 | ||
@@ -1853,14 +1847,14 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, | |||
1853 | tx_info->flags |= IEEE80211_TX_STAT_ACK; | 1847 | tx_info->flags |= IEEE80211_TX_STAT_ACK; |
1854 | } | 1848 | } |
1855 | 1849 | ||
1856 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); | 1850 | padpos = ath9k_cmn_padpos(hdr->frame_control); |
1857 | padsize = hdrlen & 3; | 1851 | padsize = padpos & 3; |
1858 | if (padsize && hdrlen >= 24) { | 1852 | if (padsize && skb->len>padpos+padsize) { |
1859 | /* | 1853 | /* |
1860 | * Remove MAC header padding before giving the frame back to | 1854 | * Remove MAC header padding before giving the frame back to |
1861 | * mac80211. | 1855 | * mac80211. |
1862 | */ | 1856 | */ |
1863 | memmove(skb->data + padsize, skb->data, hdrlen); | 1857 | memmove(skb->data + padsize, skb->data, padpos); |
1864 | skb_pull(skb, padsize); | 1858 | skb_pull(skb, padsize); |
1865 | } | 1859 | } |
1866 | 1860 | ||
@@ -2078,7 +2072,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) | |||
2078 | &txq->axq_q, lastbf->list.prev); | 2072 | &txq->axq_q, lastbf->list.prev); |
2079 | 2073 | ||
2080 | txq->axq_depth--; | 2074 | txq->axq_depth--; |
2081 | txok = !(ds->ds_txstat.ts_status & ATH9K_TXERR_FILT); | 2075 | txok = !(ds->ds_txstat.ts_status & ATH9K_TXERR_MASK); |
2082 | txq->axq_tx_inprogress = false; | 2076 | txq->axq_tx_inprogress = false; |
2083 | spin_unlock_bh(&txq->axq_lock); | 2077 | spin_unlock_bh(&txq->axq_lock); |
2084 | 2078 | ||
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index fe3bf9491997..c484cc253892 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h | |||
@@ -115,6 +115,7 @@ | |||
115 | #define B43_MMIO_TSF_2 0x636 /* core rev < 3 only */ | 115 | #define B43_MMIO_TSF_2 0x636 /* core rev < 3 only */ |
116 | #define B43_MMIO_TSF_3 0x638 /* core rev < 3 only */ | 116 | #define B43_MMIO_TSF_3 0x638 /* core rev < 3 only */ |
117 | #define B43_MMIO_RNG 0x65A | 117 | #define B43_MMIO_RNG 0x65A |
118 | #define B43_MMIO_IFSSLOT 0x684 /* Interframe slot time */ | ||
118 | #define B43_MMIO_IFSCTL 0x688 /* Interframe space control */ | 119 | #define B43_MMIO_IFSCTL 0x688 /* Interframe space control */ |
119 | #define B43_MMIO_IFSCTL_USE_EDCF 0x0004 | 120 | #define B43_MMIO_IFSCTL_USE_EDCF 0x0004 |
120 | #define B43_MMIO_POWERUP_DELAY 0x6A8 | 121 | #define B43_MMIO_POWERUP_DELAY 0x6A8 |
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c index 027be275e035..88d1fd02d40a 100644 --- a/drivers/net/wireless/b43/dma.c +++ b/drivers/net/wireless/b43/dma.c | |||
@@ -383,160 +383,44 @@ static inline | |||
383 | } | 383 | } |
384 | } | 384 | } |
385 | 385 | ||
386 | /* Check if a DMA region fits the device constraints. | ||
387 | * Returns true, if the region is OK for usage with this device. */ | ||
388 | static inline bool b43_dma_address_ok(struct b43_dmaring *ring, | ||
389 | dma_addr_t addr, size_t size) | ||
390 | { | ||
391 | switch (ring->type) { | ||
392 | case B43_DMA_30BIT: | ||
393 | if ((u64)addr + size > (1ULL << 30)) | ||
394 | return 0; | ||
395 | break; | ||
396 | case B43_DMA_32BIT: | ||
397 | if ((u64)addr + size > (1ULL << 32)) | ||
398 | return 0; | ||
399 | break; | ||
400 | case B43_DMA_64BIT: | ||
401 | /* Currently we can't have addresses beyond | ||
402 | * 64bit in the kernel. */ | ||
403 | break; | ||
404 | } | ||
405 | return 1; | ||
406 | } | ||
407 | |||
408 | #define is_4k_aligned(addr) (((u64)(addr) & 0x0FFFull) == 0) | ||
409 | #define is_8k_aligned(addr) (((u64)(addr) & 0x1FFFull) == 0) | ||
410 | |||
411 | static void b43_unmap_and_free_ringmem(struct b43_dmaring *ring, void *base, | ||
412 | dma_addr_t dmaaddr, size_t size) | ||
413 | { | ||
414 | ssb_dma_unmap_single(ring->dev->dev, dmaaddr, size, DMA_TO_DEVICE); | ||
415 | free_pages((unsigned long)base, get_order(size)); | ||
416 | } | ||
417 | |||
418 | static void * __b43_get_and_map_ringmem(struct b43_dmaring *ring, | ||
419 | dma_addr_t *dmaaddr, size_t size, | ||
420 | gfp_t gfp_flags) | ||
421 | { | ||
422 | void *base; | ||
423 | |||
424 | base = (void *)__get_free_pages(gfp_flags, get_order(size)); | ||
425 | if (!base) | ||
426 | return NULL; | ||
427 | memset(base, 0, size); | ||
428 | *dmaaddr = ssb_dma_map_single(ring->dev->dev, base, size, | ||
429 | DMA_TO_DEVICE); | ||
430 | if (ssb_dma_mapping_error(ring->dev->dev, *dmaaddr)) { | ||
431 | free_pages((unsigned long)base, get_order(size)); | ||
432 | return NULL; | ||
433 | } | ||
434 | |||
435 | return base; | ||
436 | } | ||
437 | |||
438 | static void * b43_get_and_map_ringmem(struct b43_dmaring *ring, | ||
439 | dma_addr_t *dmaaddr, size_t size) | ||
440 | { | ||
441 | void *base; | ||
442 | |||
443 | base = __b43_get_and_map_ringmem(ring, dmaaddr, size, | ||
444 | GFP_KERNEL); | ||
445 | if (!base) { | ||
446 | b43err(ring->dev->wl, "Failed to allocate or map pages " | ||
447 | "for DMA ringmemory\n"); | ||
448 | return NULL; | ||
449 | } | ||
450 | if (!b43_dma_address_ok(ring, *dmaaddr, size)) { | ||
451 | /* The memory does not fit our device constraints. | ||
452 | * Retry with GFP_DMA set to get lower memory. */ | ||
453 | b43_unmap_and_free_ringmem(ring, base, *dmaaddr, size); | ||
454 | base = __b43_get_and_map_ringmem(ring, dmaaddr, size, | ||
455 | GFP_KERNEL | GFP_DMA); | ||
456 | if (!base) { | ||
457 | b43err(ring->dev->wl, "Failed to allocate or map pages " | ||
458 | "in the GFP_DMA region for DMA ringmemory\n"); | ||
459 | return NULL; | ||
460 | } | ||
461 | if (!b43_dma_address_ok(ring, *dmaaddr, size)) { | ||
462 | b43_unmap_and_free_ringmem(ring, base, *dmaaddr, size); | ||
463 | b43err(ring->dev->wl, "Failed to allocate DMA " | ||
464 | "ringmemory that fits device constraints\n"); | ||
465 | return NULL; | ||
466 | } | ||
467 | } | ||
468 | /* We expect the memory to be 4k aligned, at least. */ | ||
469 | if (B43_WARN_ON(!is_4k_aligned(*dmaaddr))) { | ||
470 | b43_unmap_and_free_ringmem(ring, base, *dmaaddr, size); | ||
471 | return NULL; | ||
472 | } | ||
473 | |||
474 | return base; | ||
475 | } | ||
476 | |||
477 | static int alloc_ringmemory(struct b43_dmaring *ring) | 386 | static int alloc_ringmemory(struct b43_dmaring *ring) |
478 | { | 387 | { |
479 | unsigned int required; | 388 | gfp_t flags = GFP_KERNEL; |
480 | void *base; | 389 | |
481 | dma_addr_t dmaaddr; | 390 | /* The specs call for 4K buffers for 30- and 32-bit DMA with 4K |
482 | 391 | * alignment and 8K buffers for 64-bit DMA with 8K alignment. Testing | |
483 | /* There are several requirements to the descriptor ring memory: | 392 | * has shown that 4K is sufficient for the latter as long as the buffer |
484 | * - The memory region needs to fit the address constraints for the | 393 | * does not cross an 8K boundary. |
485 | * device (same as for frame buffers). | 394 | * |
486 | * - For 30/32bit DMA devices, the descriptor ring must be 4k aligned. | 395 | * For unknown reasons - possibly a hardware error - the BCM4311 rev |
487 | * - For 64bit DMA devices, the descriptor ring must be 8k aligned. | 396 | * 02, which uses 64-bit DMA, needs the ring buffer in very low memory, |
397 | * which accounts for the GFP_DMA flag below. | ||
398 | * | ||
399 | * The flags here must match the flags in free_ringmemory below! | ||
488 | */ | 400 | */ |
489 | |||
490 | if (ring->type == B43_DMA_64BIT) | 401 | if (ring->type == B43_DMA_64BIT) |
491 | required = ring->nr_slots * sizeof(struct b43_dmadesc64); | 402 | flags |= GFP_DMA; |
492 | else | 403 | ring->descbase = ssb_dma_alloc_consistent(ring->dev->dev, |
493 | required = ring->nr_slots * sizeof(struct b43_dmadesc32); | 404 | B43_DMA_RINGMEMSIZE, |
494 | if (B43_WARN_ON(required > 0x1000)) | 405 | &(ring->dmabase), flags); |
406 | if (!ring->descbase) { | ||
407 | b43err(ring->dev->wl, "DMA ringmemory allocation failed\n"); | ||
495 | return -ENOMEM; | 408 | return -ENOMEM; |
496 | |||
497 | ring->alloc_descsize = 0x1000; | ||
498 | base = b43_get_and_map_ringmem(ring, &dmaaddr, ring->alloc_descsize); | ||
499 | if (!base) | ||
500 | return -ENOMEM; | ||
501 | ring->alloc_descbase = base; | ||
502 | ring->alloc_dmabase = dmaaddr; | ||
503 | |||
504 | if ((ring->type != B43_DMA_64BIT) || is_8k_aligned(dmaaddr)) { | ||
505 | /* We're on <=32bit DMA, or we already got 8k aligned memory. | ||
506 | * That's all we need, so we're fine. */ | ||
507 | ring->descbase = base; | ||
508 | ring->dmabase = dmaaddr; | ||
509 | return 0; | ||
510 | } | ||
511 | b43_unmap_and_free_ringmem(ring, base, dmaaddr, ring->alloc_descsize); | ||
512 | |||
513 | /* Ok, we failed at the 8k alignment requirement. | ||
514 | * Try to force-align the memory region now. */ | ||
515 | ring->alloc_descsize = 0x2000; | ||
516 | base = b43_get_and_map_ringmem(ring, &dmaaddr, ring->alloc_descsize); | ||
517 | if (!base) | ||
518 | return -ENOMEM; | ||
519 | ring->alloc_descbase = base; | ||
520 | ring->alloc_dmabase = dmaaddr; | ||
521 | |||
522 | if (is_8k_aligned(dmaaddr)) { | ||
523 | /* We're already 8k aligned. That Ok, too. */ | ||
524 | ring->descbase = base; | ||
525 | ring->dmabase = dmaaddr; | ||
526 | return 0; | ||
527 | } | 409 | } |
528 | /* Force-align it to 8k */ | 410 | memset(ring->descbase, 0, B43_DMA_RINGMEMSIZE); |
529 | ring->descbase = (void *)((u8 *)base + 0x1000); | ||
530 | ring->dmabase = dmaaddr + 0x1000; | ||
531 | B43_WARN_ON(!is_8k_aligned(ring->dmabase)); | ||
532 | 411 | ||
533 | return 0; | 412 | return 0; |
534 | } | 413 | } |
535 | 414 | ||
536 | static void free_ringmemory(struct b43_dmaring *ring) | 415 | static void free_ringmemory(struct b43_dmaring *ring) |
537 | { | 416 | { |
538 | b43_unmap_and_free_ringmem(ring, ring->alloc_descbase, | 417 | gfp_t flags = GFP_KERNEL; |
539 | ring->alloc_dmabase, ring->alloc_descsize); | 418 | |
419 | if (ring->type == B43_DMA_64BIT) | ||
420 | flags |= GFP_DMA; | ||
421 | |||
422 | ssb_dma_free_consistent(ring->dev->dev, B43_DMA_RINGMEMSIZE, | ||
423 | ring->descbase, ring->dmabase, flags); | ||
540 | } | 424 | } |
541 | 425 | ||
542 | /* Reset the RX DMA channel */ | 426 | /* Reset the RX DMA channel */ |
@@ -646,14 +530,29 @@ static bool b43_dma_mapping_error(struct b43_dmaring *ring, | |||
646 | if (unlikely(ssb_dma_mapping_error(ring->dev->dev, addr))) | 530 | if (unlikely(ssb_dma_mapping_error(ring->dev->dev, addr))) |
647 | return 1; | 531 | return 1; |
648 | 532 | ||
649 | if (!b43_dma_address_ok(ring, addr, buffersize)) { | 533 | switch (ring->type) { |
650 | /* We can't support this address. Unmap it again. */ | 534 | case B43_DMA_30BIT: |
651 | unmap_descbuffer(ring, addr, buffersize, dma_to_device); | 535 | if ((u64)addr + buffersize > (1ULL << 30)) |
652 | return 1; | 536 | goto address_error; |
537 | break; | ||
538 | case B43_DMA_32BIT: | ||
539 | if ((u64)addr + buffersize > (1ULL << 32)) | ||
540 | goto address_error; | ||
541 | break; | ||
542 | case B43_DMA_64BIT: | ||
543 | /* Currently we can't have addresses beyond | ||
544 | * 64bit in the kernel. */ | ||
545 | break; | ||
653 | } | 546 | } |
654 | 547 | ||
655 | /* The address is OK. */ | 548 | /* The address is OK. */ |
656 | return 0; | 549 | return 0; |
550 | |||
551 | address_error: | ||
552 | /* We can't support this address. Unmap it again. */ | ||
553 | unmap_descbuffer(ring, addr, buffersize, dma_to_device); | ||
554 | |||
555 | return 1; | ||
657 | } | 556 | } |
658 | 557 | ||
659 | static bool b43_rx_buffer_is_poisoned(struct b43_dmaring *ring, struct sk_buff *skb) | 558 | static bool b43_rx_buffer_is_poisoned(struct b43_dmaring *ring, struct sk_buff *skb) |
@@ -715,9 +614,6 @@ static int setup_rx_descbuffer(struct b43_dmaring *ring, | |||
715 | meta->dmaaddr = dmaaddr; | 614 | meta->dmaaddr = dmaaddr; |
716 | ring->ops->fill_descriptor(ring, desc, dmaaddr, | 615 | ring->ops->fill_descriptor(ring, desc, dmaaddr, |
717 | ring->rx_buffersize, 0, 0, 0); | 616 | ring->rx_buffersize, 0, 0, 0); |
718 | ssb_dma_sync_single_for_device(ring->dev->dev, | ||
719 | ring->alloc_dmabase, | ||
720 | ring->alloc_descsize, DMA_TO_DEVICE); | ||
721 | 617 | ||
722 | return 0; | 618 | return 0; |
723 | } | 619 | } |
@@ -1354,9 +1250,6 @@ static int dma_tx_fragment(struct b43_dmaring *ring, | |||
1354 | } | 1250 | } |
1355 | /* Now transfer the whole frame. */ | 1251 | /* Now transfer the whole frame. */ |
1356 | wmb(); | 1252 | wmb(); |
1357 | ssb_dma_sync_single_for_device(ring->dev->dev, | ||
1358 | ring->alloc_dmabase, | ||
1359 | ring->alloc_descsize, DMA_TO_DEVICE); | ||
1360 | ops->poke_tx(ring, next_slot(ring, slot)); | 1253 | ops->poke_tx(ring, next_slot(ring, slot)); |
1361 | return 0; | 1254 | return 0; |
1362 | 1255 | ||
diff --git a/drivers/net/wireless/b43/dma.h b/drivers/net/wireless/b43/dma.h index e607b392314c..f7ab37c4cdbc 100644 --- a/drivers/net/wireless/b43/dma.h +++ b/drivers/net/wireless/b43/dma.h | |||
@@ -157,6 +157,7 @@ struct b43_dmadesc_generic { | |||
157 | } __attribute__ ((__packed__)); | 157 | } __attribute__ ((__packed__)); |
158 | 158 | ||
159 | /* Misc DMA constants */ | 159 | /* Misc DMA constants */ |
160 | #define B43_DMA_RINGMEMSIZE PAGE_SIZE | ||
160 | #define B43_DMA0_RX_FRAMEOFFSET 30 | 161 | #define B43_DMA0_RX_FRAMEOFFSET 30 |
161 | 162 | ||
162 | /* DMA engine tuning knobs */ | 163 | /* DMA engine tuning knobs */ |
@@ -246,12 +247,6 @@ struct b43_dmaring { | |||
246 | /* The QOS priority assigned to this ring. Only used for TX rings. | 247 | /* The QOS priority assigned to this ring. Only used for TX rings. |
247 | * This is the mac80211 "queue" value. */ | 248 | * This is the mac80211 "queue" value. */ |
248 | u8 queue_prio; | 249 | u8 queue_prio; |
249 | /* Pointers and size of the originally allocated and mapped memory | ||
250 | * region for the descriptor ring. */ | ||
251 | void *alloc_descbase; | ||
252 | dma_addr_t alloc_dmabase; | ||
253 | unsigned int alloc_descsize; | ||
254 | /* Pointer to our wireless device. */ | ||
255 | struct b43_wldev *dev; | 250 | struct b43_wldev *dev; |
256 | #ifdef CONFIG_B43_DEBUG | 251 | #ifdef CONFIG_B43_DEBUG |
257 | /* Maximum number of used slots. */ | 252 | /* Maximum number of used slots. */ |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 4c41cfe44f26..490fb45d1d05 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -628,10 +628,17 @@ static void b43_upload_card_macaddress(struct b43_wldev *dev) | |||
628 | static void b43_set_slot_time(struct b43_wldev *dev, u16 slot_time) | 628 | static void b43_set_slot_time(struct b43_wldev *dev, u16 slot_time) |
629 | { | 629 | { |
630 | /* slot_time is in usec. */ | 630 | /* slot_time is in usec. */ |
631 | if (dev->phy.type != B43_PHYTYPE_G) | 631 | /* This test used to exit for all but a G PHY. */ |
632 | if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) | ||
632 | return; | 633 | return; |
633 | b43_write16(dev, 0x684, 510 + slot_time); | 634 | b43_write16(dev, B43_MMIO_IFSSLOT, 510 + slot_time); |
634 | b43_shm_write16(dev, B43_SHM_SHARED, 0x0010, slot_time); | 635 | /* Shared memory location 0x0010 is the slot time and should be |
636 | * set to slot_time; however, this register is initially 0 and changing | ||
637 | * the value adversely affects the transmit rate for BCM4311 | ||
638 | * devices. Until this behavior is unterstood, delete this step | ||
639 | * | ||
640 | * b43_shm_write16(dev, B43_SHM_SHARED, 0x0010, slot_time); | ||
641 | */ | ||
635 | } | 642 | } |
636 | 643 | ||
637 | static void b43_short_slot_timing_enable(struct b43_wldev *dev) | 644 | static void b43_short_slot_timing_enable(struct b43_wldev *dev) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 7da1dab933d9..234891d8cc10 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -681,19 +681,13 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv, | |||
681 | snr = rx_stats_sig_avg / rx_stats_noise_diff; | 681 | snr = rx_stats_sig_avg / rx_stats_noise_diff; |
682 | rx_status.noise = rx_status.signal - | 682 | rx_status.noise = rx_status.signal - |
683 | iwl3945_calc_db_from_ratio(snr); | 683 | iwl3945_calc_db_from_ratio(snr); |
684 | rx_status.qual = iwl3945_calc_sig_qual(rx_status.signal, | ||
685 | rx_status.noise); | ||
686 | |||
687 | /* If noise info not available, calculate signal quality indicator (%) | ||
688 | * using just the dBm signal level. */ | ||
689 | } else { | 684 | } else { |
690 | rx_status.noise = priv->last_rx_noise; | 685 | rx_status.noise = priv->last_rx_noise; |
691 | rx_status.qual = iwl3945_calc_sig_qual(rx_status.signal, 0); | ||
692 | } | 686 | } |
693 | 687 | ||
694 | 688 | ||
695 | IWL_DEBUG_STATS(priv, "Rssi %d noise %d qual %d sig_avg %d noise_diff %d\n", | 689 | IWL_DEBUG_STATS(priv, "Rssi %d noise %d sig_avg %d noise_diff %d\n", |
696 | rx_status.signal, rx_status.noise, rx_status.qual, | 690 | rx_status.signal, rx_status.noise, |
697 | rx_stats_sig_avg, rx_stats_noise_diff); | 691 | rx_stats_sig_avg, rx_stats_noise_diff); |
698 | 692 | ||
699 | header = (struct ieee80211_hdr *)IWL_RX_DATA(pkt); | 693 | header = (struct ieee80211_hdr *)IWL_RX_DATA(pkt); |
@@ -1835,8 +1829,7 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv) | |||
1835 | rc = -EIO; | 1829 | rc = -EIO; |
1836 | } | 1830 | } |
1837 | 1831 | ||
1838 | priv->alloc_rxb_page--; | 1832 | iwl_free_pages(priv, cmd.reply_page); |
1839 | free_pages(cmd.reply_page, priv->hw_params.rx_page_order); | ||
1840 | 1833 | ||
1841 | return rc; | 1834 | return rc; |
1842 | } | 1835 | } |
@@ -2836,6 +2829,7 @@ static struct iwl_cfg iwl3945_bg_cfg = { | |||
2836 | .use_isr_legacy = true, | 2829 | .use_isr_legacy = true, |
2837 | .ht_greenfield_support = false, | 2830 | .ht_greenfield_support = false, |
2838 | .led_compensation = 64, | 2831 | .led_compensation = 64, |
2832 | .broken_powersave = true, | ||
2839 | }; | 2833 | }; |
2840 | 2834 | ||
2841 | static struct iwl_cfg iwl3945_abg_cfg = { | 2835 | static struct iwl_cfg iwl3945_abg_cfg = { |
@@ -2852,6 +2846,7 @@ static struct iwl_cfg iwl3945_abg_cfg = { | |||
2852 | .use_isr_legacy = true, | 2846 | .use_isr_legacy = true, |
2853 | .ht_greenfield_support = false, | 2847 | .ht_greenfield_support = false, |
2854 | .led_compensation = 64, | 2848 | .led_compensation = 64, |
2849 | .broken_powersave = true, | ||
2855 | }; | 2850 | }; |
2856 | 2851 | ||
2857 | struct pci_device_id iwl3945_hw_card_ids[] = { | 2852 | struct pci_device_id iwl3945_hw_card_ids[] = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index ecc23ec1f6a4..531fa125f5a6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h | |||
@@ -222,7 +222,6 @@ struct iwl3945_ibss_seq { | |||
222 | * | 222 | * |
223 | *****************************************************************************/ | 223 | *****************************************************************************/ |
224 | extern int iwl3945_calc_db_from_ratio(int sig_ratio); | 224 | extern int iwl3945_calc_db_from_ratio(int sig_ratio); |
225 | extern int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm); | ||
226 | extern void iwl3945_rx_replenish(void *data); | 225 | extern void iwl3945_rx_replenish(void *data); |
227 | extern void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq); | 226 | extern void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq); |
228 | extern unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv, | 227 | extern unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 386513b601f5..31462813bac0 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -1204,7 +1204,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel, | |||
1204 | iwl4965_interpolate_chan(priv, channel, &ch_eeprom_info); | 1204 | iwl4965_interpolate_chan(priv, channel, &ch_eeprom_info); |
1205 | 1205 | ||
1206 | /* calculate tx gain adjustment based on power supply voltage */ | 1206 | /* calculate tx gain adjustment based on power supply voltage */ |
1207 | voltage = priv->calib_info->voltage; | 1207 | voltage = le16_to_cpu(priv->calib_info->voltage); |
1208 | init_voltage = (s32)le32_to_cpu(priv->card_alive_init.voltage); | 1208 | init_voltage = (s32)le32_to_cpu(priv->card_alive_init.voltage); |
1209 | voltage_compensation = | 1209 | voltage_compensation = |
1210 | iwl4965_get_voltage_compensation(voltage, init_voltage); | 1210 | iwl4965_get_voltage_compensation(voltage, init_voltage); |
@@ -1961,7 +1961,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv, | |||
1961 | struct ieee80211_tx_info *info; | 1961 | struct ieee80211_tx_info *info; |
1962 | struct iwl4965_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; | 1962 | struct iwl4965_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; |
1963 | u32 status = le32_to_cpu(tx_resp->u.status); | 1963 | u32 status = le32_to_cpu(tx_resp->u.status); |
1964 | int tid = MAX_TID_COUNT; | 1964 | int uninitialized_var(tid); |
1965 | int sta_id; | 1965 | int sta_id; |
1966 | int freed; | 1966 | int freed; |
1967 | u8 *qc = NULL; | 1967 | u8 *qc = NULL; |
@@ -2008,7 +2008,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv, | |||
2008 | IWL_DEBUG_TX_REPLY(priv, "Retry scheduler reclaim scd_ssn " | 2008 | IWL_DEBUG_TX_REPLY(priv, "Retry scheduler reclaim scd_ssn " |
2009 | "%d index %d\n", scd_ssn , index); | 2009 | "%d index %d\n", scd_ssn , index); |
2010 | freed = iwl_tx_queue_reclaim(priv, txq_id, index); | 2010 | freed = iwl_tx_queue_reclaim(priv, txq_id, index); |
2011 | priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; | 2011 | iwl_free_tfds_in_queue(priv, sta_id, tid, freed); |
2012 | 2012 | ||
2013 | if (priv->mac80211_registered && | 2013 | if (priv->mac80211_registered && |
2014 | (iwl_queue_space(&txq->q) > txq->q.low_mark) && | 2014 | (iwl_queue_space(&txq->q) > txq->q.low_mark) && |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h index 4ef6804a455a..bc056e9ab85f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h | |||
@@ -92,11 +92,15 @@ | |||
92 | 92 | ||
93 | static inline s32 iwl_temp_calib_to_offset(struct iwl_priv *priv) | 93 | static inline s32 iwl_temp_calib_to_offset(struct iwl_priv *priv) |
94 | { | 94 | { |
95 | u16 *temp_calib = (u16 *)iwl_eeprom_query_addr(priv, | 95 | u16 temperature, voltage; |
96 | EEPROM_5000_TEMPERATURE); | 96 | __le16 *temp_calib = |
97 | /* offset = temperature - voltage / coef */ | 97 | (__le16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_TEMPERATURE); |
98 | s32 offset = (s32)(temp_calib[0] - temp_calib[1] / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF); | 98 | |
99 | return offset; | 99 | temperature = le16_to_cpu(temp_calib[0]); |
100 | voltage = le16_to_cpu(temp_calib[1]); | ||
101 | |||
102 | /* offset = temp - volt / coeff */ | ||
103 | return (s32)(temperature - voltage / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF); | ||
100 | } | 104 | } |
101 | 105 | ||
102 | /* Fixed (non-configurable) rx data from phy */ | 106 | /* Fixed (non-configurable) rx data from phy */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index e2f8615c8c9b..cffaae772d51 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -333,14 +333,15 @@ static void iwl5000_set_ct_threshold(struct iwl_priv *priv) | |||
333 | static int iwl5000_set_Xtal_calib(struct iwl_priv *priv) | 333 | static int iwl5000_set_Xtal_calib(struct iwl_priv *priv) |
334 | { | 334 | { |
335 | struct iwl_calib_xtal_freq_cmd cmd; | 335 | struct iwl_calib_xtal_freq_cmd cmd; |
336 | u16 *xtal_calib = (u16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_XTAL); | 336 | __le16 *xtal_calib = |
337 | (__le16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_XTAL); | ||
337 | 338 | ||
338 | cmd.hdr.op_code = IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD; | 339 | cmd.hdr.op_code = IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD; |
339 | cmd.hdr.first_group = 0; | 340 | cmd.hdr.first_group = 0; |
340 | cmd.hdr.groups_num = 1; | 341 | cmd.hdr.groups_num = 1; |
341 | cmd.hdr.data_valid = 1; | 342 | cmd.hdr.data_valid = 1; |
342 | cmd.cap_pin1 = (u8)xtal_calib[0]; | 343 | cmd.cap_pin1 = le16_to_cpu(xtal_calib[0]); |
343 | cmd.cap_pin2 = (u8)xtal_calib[1]; | 344 | cmd.cap_pin2 = le16_to_cpu(xtal_calib[1]); |
344 | return iwl_calib_set(&priv->calib_results[IWL_CALIB_XTAL], | 345 | return iwl_calib_set(&priv->calib_results[IWL_CALIB_XTAL], |
345 | (u8 *)&cmd, sizeof(cmd)); | 346 | (u8 *)&cmd, sizeof(cmd)); |
346 | } | 347 | } |
@@ -1124,7 +1125,7 @@ static void iwl5000_rx_reply_tx(struct iwl_priv *priv, | |||
1124 | scd_ssn , index, txq_id, txq->swq_id); | 1125 | scd_ssn , index, txq_id, txq->swq_id); |
1125 | 1126 | ||
1126 | freed = iwl_tx_queue_reclaim(priv, txq_id, index); | 1127 | freed = iwl_tx_queue_reclaim(priv, txq_id, index); |
1127 | priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; | 1128 | iwl_free_tfds_in_queue(priv, sta_id, tid, freed); |
1128 | 1129 | ||
1129 | if (priv->mac80211_registered && | 1130 | if (priv->mac80211_registered && |
1130 | (iwl_queue_space(&txq->q) > txq->q.low_mark) && | 1131 | (iwl_queue_space(&txq->q) > txq->q.low_mark) && |
@@ -1152,16 +1153,14 @@ static void iwl5000_rx_reply_tx(struct iwl_priv *priv, | |||
1152 | tx_resp->failure_frame); | 1153 | tx_resp->failure_frame); |
1153 | 1154 | ||
1154 | freed = iwl_tx_queue_reclaim(priv, txq_id, index); | 1155 | freed = iwl_tx_queue_reclaim(priv, txq_id, index); |
1155 | if (ieee80211_is_data_qos(tx_resp->frame_ctrl)) | 1156 | iwl_free_tfds_in_queue(priv, sta_id, tid, freed); |
1156 | priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; | ||
1157 | 1157 | ||
1158 | if (priv->mac80211_registered && | 1158 | if (priv->mac80211_registered && |
1159 | (iwl_queue_space(&txq->q) > txq->q.low_mark)) | 1159 | (iwl_queue_space(&txq->q) > txq->q.low_mark)) |
1160 | iwl_wake_queue(priv, txq_id); | 1160 | iwl_wake_queue(priv, txq_id); |
1161 | } | 1161 | } |
1162 | 1162 | ||
1163 | if (ieee80211_is_data_qos(tx_resp->frame_ctrl)) | 1163 | iwl_txq_check_empty(priv, sta_id, tid, txq_id); |
1164 | iwl_txq_check_empty(priv, sta_id, tid, txq_id); | ||
1165 | 1164 | ||
1166 | if (iwl_check_bits(status, TX_ABORT_REQUIRED_MSK)) | 1165 | if (iwl_check_bits(status, TX_ABORT_REQUIRED_MSK)) |
1167 | IWL_ERR(priv, "TODO: Implement Tx ABORT REQUIRED!!!\n"); | 1166 | IWL_ERR(priv, "TODO: Implement Tx ABORT REQUIRED!!!\n"); |
@@ -1597,6 +1596,7 @@ struct iwl_cfg iwl5300_agn_cfg = { | |||
1597 | .use_bsm = false, | 1596 | .use_bsm = false, |
1598 | .ht_greenfield_support = true, | 1597 | .ht_greenfield_support = true, |
1599 | .led_compensation = 51, | 1598 | .led_compensation = 51, |
1599 | .use_rts_for_ht = true, /* use rts/cts protection */ | ||
1600 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | 1600 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, |
1601 | .sm_ps_mode = WLAN_HT_CAP_SM_PS_DISABLED, | 1601 | .sm_ps_mode = WLAN_HT_CAP_SM_PS_DISABLED, |
1602 | }; | 1602 | }; |
@@ -1621,6 +1621,7 @@ struct iwl_cfg iwl5100_bgn_cfg = { | |||
1621 | .use_bsm = false, | 1621 | .use_bsm = false, |
1622 | .ht_greenfield_support = true, | 1622 | .ht_greenfield_support = true, |
1623 | .led_compensation = 51, | 1623 | .led_compensation = 51, |
1624 | .use_rts_for_ht = true, /* use rts/cts protection */ | ||
1624 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | 1625 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, |
1625 | }; | 1626 | }; |
1626 | 1627 | ||
@@ -1666,6 +1667,7 @@ struct iwl_cfg iwl5100_agn_cfg = { | |||
1666 | .use_bsm = false, | 1667 | .use_bsm = false, |
1667 | .ht_greenfield_support = true, | 1668 | .ht_greenfield_support = true, |
1668 | .led_compensation = 51, | 1669 | .led_compensation = 51, |
1670 | .use_rts_for_ht = true, /* use rts/cts protection */ | ||
1669 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | 1671 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, |
1670 | .sm_ps_mode = WLAN_HT_CAP_SM_PS_DISABLED, | 1672 | .sm_ps_mode = WLAN_HT_CAP_SM_PS_DISABLED, |
1671 | }; | 1673 | }; |
@@ -1690,6 +1692,7 @@ struct iwl_cfg iwl5350_agn_cfg = { | |||
1690 | .use_bsm = false, | 1692 | .use_bsm = false, |
1691 | .ht_greenfield_support = true, | 1693 | .ht_greenfield_support = true, |
1692 | .led_compensation = 51, | 1694 | .led_compensation = 51, |
1695 | .use_rts_for_ht = true, /* use rts/cts protection */ | ||
1693 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | 1696 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, |
1694 | .sm_ps_mode = WLAN_HT_CAP_SM_PS_DISABLED, | 1697 | .sm_ps_mode = WLAN_HT_CAP_SM_PS_DISABLED, |
1695 | }; | 1698 | }; |
@@ -1714,6 +1717,7 @@ struct iwl_cfg iwl5150_agn_cfg = { | |||
1714 | .use_bsm = false, | 1717 | .use_bsm = false, |
1715 | .ht_greenfield_support = true, | 1718 | .ht_greenfield_support = true, |
1716 | .led_compensation = 51, | 1719 | .led_compensation = 51, |
1720 | .use_rts_for_ht = true, /* use rts/cts protection */ | ||
1717 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | 1721 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, |
1718 | .sm_ps_mode = WLAN_HT_CAP_SM_PS_DISABLED, | 1722 | .sm_ps_mode = WLAN_HT_CAP_SM_PS_DISABLED, |
1719 | }; | 1723 | }; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c index fe511cbf012e..b93e49158196 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c | |||
@@ -150,7 +150,7 @@ static s32 expected_tpt_mimo3_40MHz[4][IWL_RATE_COUNT] = { | |||
150 | }; | 150 | }; |
151 | 151 | ||
152 | /* mbps, mcs */ | 152 | /* mbps, mcs */ |
153 | const static struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = { | 153 | static const struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = { |
154 | { "1", "BPSK DSSS"}, | 154 | { "1", "BPSK DSSS"}, |
155 | { "2", "QPSK DSSS"}, | 155 | { "2", "QPSK DSSS"}, |
156 | {"5.5", "BPSK CCK"}, | 156 | {"5.5", "BPSK CCK"}, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index b8377efb3ba7..1c9866daf815 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -1842,7 +1842,7 @@ void iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log) | |||
1842 | } | 1842 | } |
1843 | 1843 | ||
1844 | #ifdef CONFIG_IWLWIFI_DEBUG | 1844 | #ifdef CONFIG_IWLWIFI_DEBUG |
1845 | if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS)) | 1845 | if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) && !full_log) |
1846 | size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES) | 1846 | size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES) |
1847 | ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size; | 1847 | ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size; |
1848 | #else | 1848 | #else |
@@ -3173,7 +3173,6 @@ static int iwl_init_drv(struct iwl_priv *priv) | |||
3173 | 3173 | ||
3174 | priv->ibss_beacon = NULL; | 3174 | priv->ibss_beacon = NULL; |
3175 | 3175 | ||
3176 | spin_lock_init(&priv->lock); | ||
3177 | spin_lock_init(&priv->sta_lock); | 3176 | spin_lock_init(&priv->sta_lock); |
3178 | spin_lock_init(&priv->hcmd_lock); | 3177 | spin_lock_init(&priv->hcmd_lock); |
3179 | 3178 | ||
@@ -3361,10 +3360,11 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3361 | (unsigned long long) pci_resource_len(pdev, 0)); | 3360 | (unsigned long long) pci_resource_len(pdev, 0)); |
3362 | IWL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base); | 3361 | IWL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base); |
3363 | 3362 | ||
3364 | /* this spin lock will be used in apm_ops.init and EEPROM access | 3363 | /* these spin locks will be used in apm_ops.init and EEPROM access |
3365 | * we should init now | 3364 | * we should init now |
3366 | */ | 3365 | */ |
3367 | spin_lock_init(&priv->reg_lock); | 3366 | spin_lock_init(&priv->reg_lock); |
3367 | spin_lock_init(&priv->lock); | ||
3368 | iwl_hw_detect(priv); | 3368 | iwl_hw_detect(priv); |
3369 | IWL_INFO(priv, "Detected Intel Wireless WiFi Link %s REV=0x%X\n", | 3369 | IWL_INFO(priv, "Detected Intel Wireless WiFi Link %s REV=0x%X\n", |
3370 | priv->cfg->name, priv->hw_rev); | 3370 | priv->cfg->name, priv->hw_rev); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 574d36658702..f36f804804fc 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -2344,6 +2344,21 @@ static void iwl_ht_conf(struct iwl_priv *priv, | |||
2344 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 2344 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
2345 | } | 2345 | } |
2346 | 2346 | ||
2347 | static inline void iwl_set_no_assoc(struct iwl_priv *priv) | ||
2348 | { | ||
2349 | priv->assoc_id = 0; | ||
2350 | iwl_led_disassociate(priv); | ||
2351 | /* | ||
2352 | * inform the ucode that there is no longer an | ||
2353 | * association and that no more packets should be | ||
2354 | * sent | ||
2355 | */ | ||
2356 | priv->staging_rxon.filter_flags &= | ||
2357 | ~RXON_FILTER_ASSOC_MSK; | ||
2358 | priv->staging_rxon.assoc_id = 0; | ||
2359 | iwlcore_commit_rxon(priv); | ||
2360 | } | ||
2361 | |||
2347 | #define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6) | 2362 | #define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6) |
2348 | void iwl_bss_info_changed(struct ieee80211_hw *hw, | 2363 | void iwl_bss_info_changed(struct ieee80211_hw *hw, |
2349 | struct ieee80211_vif *vif, | 2364 | struct ieee80211_vif *vif, |
@@ -2475,20 +2490,8 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, | |||
2475 | IWL_DELAY_NEXT_SCAN_AFTER_ASSOC; | 2490 | IWL_DELAY_NEXT_SCAN_AFTER_ASSOC; |
2476 | if (!iwl_is_rfkill(priv)) | 2491 | if (!iwl_is_rfkill(priv)) |
2477 | priv->cfg->ops->lib->post_associate(priv); | 2492 | priv->cfg->ops->lib->post_associate(priv); |
2478 | } else { | 2493 | } else |
2479 | priv->assoc_id = 0; | 2494 | iwl_set_no_assoc(priv); |
2480 | iwl_led_disassociate(priv); | ||
2481 | |||
2482 | /* | ||
2483 | * inform the ucode that there is no longer an | ||
2484 | * association and that no more packets should be | ||
2485 | * send | ||
2486 | */ | ||
2487 | priv->staging_rxon.filter_flags &= | ||
2488 | ~RXON_FILTER_ASSOC_MSK; | ||
2489 | priv->staging_rxon.assoc_id = 0; | ||
2490 | iwlcore_commit_rxon(priv); | ||
2491 | } | ||
2492 | } | 2495 | } |
2493 | 2496 | ||
2494 | if (changes && iwl_is_associated(priv) && priv->assoc_id) { | 2497 | if (changes && iwl_is_associated(priv) && priv->assoc_id) { |
@@ -2503,12 +2506,14 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, | |||
2503 | } | 2506 | } |
2504 | } | 2507 | } |
2505 | 2508 | ||
2506 | if ((changes & BSS_CHANGED_BEACON_ENABLED) && | 2509 | if (changes & BSS_CHANGED_BEACON_ENABLED) { |
2507 | vif->bss_conf.enable_beacon) { | 2510 | if (vif->bss_conf.enable_beacon) { |
2508 | memcpy(priv->staging_rxon.bssid_addr, | 2511 | memcpy(priv->staging_rxon.bssid_addr, |
2509 | bss_conf->bssid, ETH_ALEN); | 2512 | bss_conf->bssid, ETH_ALEN); |
2510 | memcpy(priv->bssid, bss_conf->bssid, ETH_ALEN); | 2513 | memcpy(priv->bssid, bss_conf->bssid, ETH_ALEN); |
2511 | iwlcore_config_ap(priv); | 2514 | iwlcore_config_ap(priv); |
2515 | } else | ||
2516 | iwl_set_no_assoc(priv); | ||
2512 | } | 2517 | } |
2513 | 2518 | ||
2514 | mutex_unlock(&priv->mutex); | 2519 | mutex_unlock(&priv->mutex); |
@@ -2740,6 +2745,7 @@ int iwl_mac_config(struct ieee80211_hw *hw, u32 changed) | |||
2740 | priv->staging_rxon.flags = 0; | 2745 | priv->staging_rxon.flags = 0; |
2741 | 2746 | ||
2742 | iwl_set_rxon_channel(priv, conf->channel); | 2747 | iwl_set_rxon_channel(priv, conf->channel); |
2748 | iwl_set_rxon_ht(priv, ht_conf); | ||
2743 | 2749 | ||
2744 | iwl_set_flags_for_band(priv, conf->channel->band); | 2750 | iwl_set_flags_for_band(priv, conf->channel->band); |
2745 | spin_unlock_irqrestore(&priv->lock, flags); | 2751 | spin_unlock_irqrestore(&priv->lock, flags); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 27ca859e7453..b69e972671b2 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -446,6 +446,8 @@ void iwl_hw_txq_ctx_free(struct iwl_priv *priv); | |||
446 | int iwl_hw_tx_queue_init(struct iwl_priv *priv, | 446 | int iwl_hw_tx_queue_init(struct iwl_priv *priv, |
447 | struct iwl_tx_queue *txq); | 447 | struct iwl_tx_queue *txq); |
448 | int iwl_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq); | 448 | int iwl_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq); |
449 | void iwl_free_tfds_in_queue(struct iwl_priv *priv, | ||
450 | int sta_id, int tid, int freed); | ||
449 | int iwl_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq, | 451 | int iwl_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq, |
450 | int slots_num, u32 txq_id); | 452 | int slots_num, u32 txq_id); |
451 | void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id); | 453 | void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-csr.h b/drivers/net/wireless/iwlwifi/iwl-csr.h index a7bfae01f19b..1ec8cb4d5eae 100644 --- a/drivers/net/wireless/iwlwifi/iwl-csr.h +++ b/drivers/net/wireless/iwlwifi/iwl-csr.h | |||
@@ -77,8 +77,7 @@ | |||
77 | * The MAC (uCode processor, etc.) does not need to be powered up for accessing | 77 | * The MAC (uCode processor, etc.) does not need to be powered up for accessing |
78 | * the CSR registers. | 78 | * the CSR registers. |
79 | * | 79 | * |
80 | * NOTE: Newer devices using one-time-programmable (OTP) memory | 80 | * NOTE: Device does need to be awake in order to read this memory |
81 | * require device to be awake in order to read this memory | ||
82 | * via CSR_EEPROM and CSR_OTP registers | 81 | * via CSR_EEPROM and CSR_OTP registers |
83 | */ | 82 | */ |
84 | #define CSR_BASE (0x000) | 83 | #define CSR_BASE (0x000) |
@@ -111,9 +110,8 @@ | |||
111 | /* | 110 | /* |
112 | * EEPROM and OTP (one-time-programmable) memory reads | 111 | * EEPROM and OTP (one-time-programmable) memory reads |
113 | * | 112 | * |
114 | * NOTE: For (newer) devices using OTP, device must be awake, initialized via | 113 | * NOTE: Device must be awake, initialized via apm_ops.init(), |
115 | * apm_ops.init() in order to read. Older devices (3945/4965/5000) | 114 | * in order to read. |
116 | * use EEPROM and do not require this. | ||
117 | */ | 115 | */ |
118 | #define CSR_EEPROM_REG (CSR_BASE+0x02c) | 116 | #define CSR_EEPROM_REG (CSR_BASE+0x02c) |
119 | #define CSR_EEPROM_GP (CSR_BASE+0x030) | 117 | #define CSR_EEPROM_GP (CSR_BASE+0x030) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 2673e9a4db92..3822cf53e368 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -711,7 +711,7 @@ extern void iwl_txq_ctx_stop(struct iwl_priv *priv); | |||
711 | extern int iwl_queue_space(const struct iwl_queue *q); | 711 | extern int iwl_queue_space(const struct iwl_queue *q); |
712 | static inline int iwl_queue_used(const struct iwl_queue *q, int i) | 712 | static inline int iwl_queue_used(const struct iwl_queue *q, int i) |
713 | { | 713 | { |
714 | return q->write_ptr > q->read_ptr ? | 714 | return q->write_ptr >= q->read_ptr ? |
715 | (i >= q->read_ptr && i < q->write_ptr) : | 715 | (i >= q->read_ptr && i < q->write_ptr) : |
716 | !(i < q->read_ptr && i >= q->write_ptr); | 716 | !(i < q->read_ptr && i >= q->write_ptr); |
717 | } | 717 | } |
@@ -1168,7 +1168,7 @@ struct iwl_priv { | |||
1168 | u32 last_beacon_time; | 1168 | u32 last_beacon_time; |
1169 | u64 last_tsf; | 1169 | u64 last_tsf; |
1170 | 1170 | ||
1171 | /* eeprom */ | 1171 | /* eeprom -- this is in the card's little endian byte order */ |
1172 | u8 *eeprom; | 1172 | u8 *eeprom; |
1173 | int nvm_device_type; | 1173 | int nvm_device_type; |
1174 | struct iwl_eeprom_calib_info *calib_info; | 1174 | struct iwl_eeprom_calib_info *calib_info; |
@@ -1353,4 +1353,15 @@ static inline int is_channel_ibss(const struct iwl_channel_info *ch) | |||
1353 | return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0; | 1353 | return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0; |
1354 | } | 1354 | } |
1355 | 1355 | ||
1356 | static inline void __iwl_free_pages(struct iwl_priv *priv, struct page *page) | ||
1357 | { | ||
1358 | __free_pages(page, priv->hw_params.rx_page_order); | ||
1359 | priv->alloc_rxb_page--; | ||
1360 | } | ||
1361 | |||
1362 | static inline void iwl_free_pages(struct iwl_priv *priv, unsigned long page) | ||
1363 | { | ||
1364 | free_pages(page, priv->hw_params.rx_page_order); | ||
1365 | priv->alloc_rxb_page--; | ||
1366 | } | ||
1356 | #endif /* __iwl_dev_h__ */ | 1367 | #endif /* __iwl_dev_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-devtrace.c b/drivers/net/wireless/iwlwifi/iwl-devtrace.c index e7d88d1da15d..83cc4e500a96 100644 --- a/drivers/net/wireless/iwlwifi/iwl-devtrace.c +++ b/drivers/net/wireless/iwlwifi/iwl-devtrace.c | |||
@@ -1,3 +1,29 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Copyright(c) 2009 - 2010 Intel Corporation. All rights reserved. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of version 2 of the GNU General Public License as | ||
7 | * published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along with | ||
15 | * this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA | ||
17 | * | ||
18 | * The full GNU General Public License is included in this distribution in the | ||
19 | * file called LICENSE. | ||
20 | * | ||
21 | * Contact Information: | ||
22 | * Intel Linux Wireless <ilw@linux.intel.com> | ||
23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||
24 | * | ||
25 | *****************************************************************************/ | ||
26 | |||
1 | #include <linux/module.h> | 27 | #include <linux/module.h> |
2 | 28 | ||
3 | /* sparse doesn't like tracepoint macros */ | 29 | /* sparse doesn't like tracepoint macros */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-devtrace.h b/drivers/net/wireless/iwlwifi/iwl-devtrace.h index 21361968ab7e..d9c7363b1bbb 100644 --- a/drivers/net/wireless/iwlwifi/iwl-devtrace.h +++ b/drivers/net/wireless/iwlwifi/iwl-devtrace.h | |||
@@ -1,3 +1,29 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Copyright(c) 2009 - 2010 Intel Corporation. All rights reserved. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of version 2 of the GNU General Public License as | ||
7 | * published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along with | ||
15 | * this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA | ||
17 | * | ||
18 | * The full GNU General Public License is included in this distribution in the | ||
19 | * file called LICENSE. | ||
20 | * | ||
21 | * Contact Information: | ||
22 | * Intel Linux Wireless <ilw@linux.intel.com> | ||
23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||
24 | * | ||
25 | *****************************************************************************/ | ||
26 | |||
1 | #if !defined(__IWLWIFI_DEVICE_TRACE) || defined(TRACE_HEADER_MULTI_READ) | 27 | #if !defined(__IWLWIFI_DEVICE_TRACE) || defined(TRACE_HEADER_MULTI_READ) |
2 | #define __IWLWIFI_DEVICE_TRACE | 28 | #define __IWLWIFI_DEVICE_TRACE |
3 | 29 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c index 3946e5c03f81..4a30969689ff 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c | |||
@@ -370,7 +370,7 @@ static int iwl_init_otp_access(struct iwl_priv *priv) | |||
370 | return ret; | 370 | return ret; |
371 | } | 371 | } |
372 | 372 | ||
373 | static int iwl_read_otp_word(struct iwl_priv *priv, u16 addr, u16 *eeprom_data) | 373 | static int iwl_read_otp_word(struct iwl_priv *priv, u16 addr, __le16 *eeprom_data) |
374 | { | 374 | { |
375 | int ret = 0; | 375 | int ret = 0; |
376 | u32 r; | 376 | u32 r; |
@@ -404,7 +404,7 @@ static int iwl_read_otp_word(struct iwl_priv *priv, u16 addr, u16 *eeprom_data) | |||
404 | CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK); | 404 | CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK); |
405 | IWL_ERR(priv, "Correctable OTP ECC error, continue read\n"); | 405 | IWL_ERR(priv, "Correctable OTP ECC error, continue read\n"); |
406 | } | 406 | } |
407 | *eeprom_data = le16_to_cpu((__force __le16)(r >> 16)); | 407 | *eeprom_data = cpu_to_le16(r >> 16); |
408 | return 0; | 408 | return 0; |
409 | } | 409 | } |
410 | 410 | ||
@@ -413,7 +413,8 @@ static int iwl_read_otp_word(struct iwl_priv *priv, u16 addr, u16 *eeprom_data) | |||
413 | */ | 413 | */ |
414 | static bool iwl_is_otp_empty(struct iwl_priv *priv) | 414 | static bool iwl_is_otp_empty(struct iwl_priv *priv) |
415 | { | 415 | { |
416 | u16 next_link_addr = 0, link_value; | 416 | u16 next_link_addr = 0; |
417 | __le16 link_value; | ||
417 | bool is_empty = false; | 418 | bool is_empty = false; |
418 | 419 | ||
419 | /* locate the beginning of OTP link list */ | 420 | /* locate the beginning of OTP link list */ |
@@ -443,7 +444,8 @@ static bool iwl_is_otp_empty(struct iwl_priv *priv) | |||
443 | static int iwl_find_otp_image(struct iwl_priv *priv, | 444 | static int iwl_find_otp_image(struct iwl_priv *priv, |
444 | u16 *validblockaddr) | 445 | u16 *validblockaddr) |
445 | { | 446 | { |
446 | u16 next_link_addr = 0, link_value = 0, valid_addr; | 447 | u16 next_link_addr = 0, valid_addr; |
448 | __le16 link_value = 0; | ||
447 | int usedblocks = 0; | 449 | int usedblocks = 0; |
448 | 450 | ||
449 | /* set addressing mode to absolute to traverse the link list */ | 451 | /* set addressing mode to absolute to traverse the link list */ |
@@ -463,7 +465,7 @@ static int iwl_find_otp_image(struct iwl_priv *priv, | |||
463 | * check for more block on the link list | 465 | * check for more block on the link list |
464 | */ | 466 | */ |
465 | valid_addr = next_link_addr; | 467 | valid_addr = next_link_addr; |
466 | next_link_addr = link_value * sizeof(u16); | 468 | next_link_addr = le16_to_cpu(link_value) * sizeof(u16); |
467 | IWL_DEBUG_INFO(priv, "OTP blocks %d addr 0x%x\n", | 469 | IWL_DEBUG_INFO(priv, "OTP blocks %d addr 0x%x\n", |
468 | usedblocks, next_link_addr); | 470 | usedblocks, next_link_addr); |
469 | if (iwl_read_otp_word(priv, next_link_addr, &link_value)) | 471 | if (iwl_read_otp_word(priv, next_link_addr, &link_value)) |
@@ -497,7 +499,7 @@ static int iwl_find_otp_image(struct iwl_priv *priv, | |||
497 | */ | 499 | */ |
498 | int iwl_eeprom_init(struct iwl_priv *priv) | 500 | int iwl_eeprom_init(struct iwl_priv *priv) |
499 | { | 501 | { |
500 | u16 *e; | 502 | __le16 *e; |
501 | u32 gp = iwl_read32(priv, CSR_EEPROM_GP); | 503 | u32 gp = iwl_read32(priv, CSR_EEPROM_GP); |
502 | int sz; | 504 | int sz; |
503 | int ret; | 505 | int ret; |
@@ -516,12 +518,9 @@ int iwl_eeprom_init(struct iwl_priv *priv) | |||
516 | ret = -ENOMEM; | 518 | ret = -ENOMEM; |
517 | goto alloc_err; | 519 | goto alloc_err; |
518 | } | 520 | } |
519 | e = (u16 *)priv->eeprom; | 521 | e = (__le16 *)priv->eeprom; |
520 | 522 | ||
521 | if (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) { | 523 | priv->cfg->ops->lib->apm_ops.init(priv); |
522 | /* OTP reads require powered-up chip */ | ||
523 | priv->cfg->ops->lib->apm_ops.init(priv); | ||
524 | } | ||
525 | 524 | ||
526 | ret = priv->cfg->ops->lib->eeprom_ops.verify_signature(priv); | 525 | ret = priv->cfg->ops->lib->eeprom_ops.verify_signature(priv); |
527 | if (ret < 0) { | 526 | if (ret < 0) { |
@@ -562,7 +561,7 @@ int iwl_eeprom_init(struct iwl_priv *priv) | |||
562 | } | 561 | } |
563 | for (addr = validblockaddr; addr < validblockaddr + sz; | 562 | for (addr = validblockaddr; addr < validblockaddr + sz; |
564 | addr += sizeof(u16)) { | 563 | addr += sizeof(u16)) { |
565 | u16 eeprom_data; | 564 | __le16 eeprom_data; |
566 | 565 | ||
567 | ret = iwl_read_otp_word(priv, addr, &eeprom_data); | 566 | ret = iwl_read_otp_word(priv, addr, &eeprom_data); |
568 | if (ret) | 567 | if (ret) |
@@ -570,13 +569,6 @@ int iwl_eeprom_init(struct iwl_priv *priv) | |||
570 | e[cache_addr / 2] = eeprom_data; | 569 | e[cache_addr / 2] = eeprom_data; |
571 | cache_addr += sizeof(u16); | 570 | cache_addr += sizeof(u16); |
572 | } | 571 | } |
573 | |||
574 | /* | ||
575 | * Now that OTP reads are complete, reset chip to save | ||
576 | * power until we load uCode during "up". | ||
577 | */ | ||
578 | priv->cfg->ops->lib->apm_ops.stop(priv); | ||
579 | |||
580 | } else { | 572 | } else { |
581 | /* eeprom is an array of 16bit values */ | 573 | /* eeprom is an array of 16bit values */ |
582 | for (addr = 0; addr < sz; addr += sizeof(u16)) { | 574 | for (addr = 0; addr < sz; addr += sizeof(u16)) { |
@@ -594,7 +586,7 @@ int iwl_eeprom_init(struct iwl_priv *priv) | |||
594 | goto done; | 586 | goto done; |
595 | } | 587 | } |
596 | r = _iwl_read_direct32(priv, CSR_EEPROM_REG); | 588 | r = _iwl_read_direct32(priv, CSR_EEPROM_REG); |
597 | e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16)); | 589 | e[addr / 2] = cpu_to_le16(r >> 16); |
598 | } | 590 | } |
599 | } | 591 | } |
600 | ret = 0; | 592 | ret = 0; |
@@ -603,6 +595,8 @@ done: | |||
603 | err: | 595 | err: |
604 | if (ret) | 596 | if (ret) |
605 | iwl_eeprom_free(priv); | 597 | iwl_eeprom_free(priv); |
598 | /* Reset chip to save power until we load uCode during "up". */ | ||
599 | priv->cfg->ops->lib->apm_ops.stop(priv); | ||
606 | alloc_err: | 600 | alloc_err: |
607 | return ret; | 601 | return ret; |
608 | } | 602 | } |
@@ -755,7 +749,8 @@ static int iwl_mod_ht40_chan_info(struct iwl_priv *priv, | |||
755 | ch_info->ht40_eeprom = *eeprom_ch; | 749 | ch_info->ht40_eeprom = *eeprom_ch; |
756 | ch_info->ht40_max_power_avg = eeprom_ch->max_power_avg; | 750 | ch_info->ht40_max_power_avg = eeprom_ch->max_power_avg; |
757 | ch_info->ht40_flags = eeprom_ch->flags; | 751 | ch_info->ht40_flags = eeprom_ch->flags; |
758 | ch_info->ht40_extension_channel &= ~clear_ht40_extension_channel; | 752 | if (eeprom_ch->flags & EEPROM_CHANNEL_VALID) |
753 | ch_info->ht40_extension_channel &= ~clear_ht40_extension_channel; | ||
759 | 754 | ||
760 | return 0; | 755 | return 0; |
761 | } | 756 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h index 5cd2b66bbe45..0cd9c02ee044 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h | |||
@@ -137,7 +137,7 @@ struct iwl_eeprom_channel { | |||
137 | * | 137 | * |
138 | */ | 138 | */ |
139 | struct iwl_eeprom_enhanced_txpwr { | 139 | struct iwl_eeprom_enhanced_txpwr { |
140 | u16 common; | 140 | __le16 common; |
141 | s8 chain_a_max; | 141 | s8 chain_a_max; |
142 | s8 chain_b_max; | 142 | s8 chain_b_max; |
143 | s8 chain_c_max; | 143 | s8 chain_c_max; |
@@ -360,7 +360,7 @@ struct iwl_eeprom_calib_subband_info { | |||
360 | struct iwl_eeprom_calib_info { | 360 | struct iwl_eeprom_calib_info { |
361 | u8 saturation_power24; /* half-dBm (e.g. "34" = 17 dBm) */ | 361 | u8 saturation_power24; /* half-dBm (e.g. "34" = 17 dBm) */ |
362 | u8 saturation_power52; /* half-dBm */ | 362 | u8 saturation_power52; /* half-dBm */ |
363 | s16 voltage; /* signed */ | 363 | __le16 voltage; /* signed */ |
364 | struct iwl_eeprom_calib_subband_info | 364 | struct iwl_eeprom_calib_subband_info |
365 | band_info[EEPROM_TX_POWER_BANDS]; | 365 | band_info[EEPROM_TX_POWER_BANDS]; |
366 | } __attribute__ ((packed)); | 366 | } __attribute__ ((packed)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-hcmd.c index a23165948202..30e9ea6d54ec 100644 --- a/drivers/net/wireless/iwlwifi/iwl-hcmd.c +++ b/drivers/net/wireless/iwlwifi/iwl-hcmd.c | |||
@@ -234,7 +234,7 @@ cancel: | |||
234 | } | 234 | } |
235 | fail: | 235 | fail: |
236 | if (cmd->reply_page) { | 236 | if (cmd->reply_page) { |
237 | free_pages(cmd->reply_page, priv->hw_params.rx_page_order); | 237 | iwl_free_pages(priv, cmd->reply_page); |
238 | cmd->reply_page = 0; | 238 | cmd->reply_page = 0; |
239 | } | 239 | } |
240 | out: | 240 | out: |
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c index 6090bc15a6d5..2dbce85404aa 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c | |||
@@ -345,10 +345,8 @@ void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | |||
345 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, | 345 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, |
346 | PAGE_SIZE << priv->hw_params.rx_page_order, | 346 | PAGE_SIZE << priv->hw_params.rx_page_order, |
347 | PCI_DMA_FROMDEVICE); | 347 | PCI_DMA_FROMDEVICE); |
348 | __free_pages(rxq->pool[i].page, | 348 | __iwl_free_pages(priv, rxq->pool[i].page); |
349 | priv->hw_params.rx_page_order); | ||
350 | rxq->pool[i].page = NULL; | 349 | rxq->pool[i].page = NULL; |
351 | priv->alloc_rxb_page--; | ||
352 | } | 350 | } |
353 | } | 351 | } |
354 | 352 | ||
@@ -416,9 +414,7 @@ void iwl_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | |||
416 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, | 414 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, |
417 | PAGE_SIZE << priv->hw_params.rx_page_order, | 415 | PAGE_SIZE << priv->hw_params.rx_page_order, |
418 | PCI_DMA_FROMDEVICE); | 416 | PCI_DMA_FROMDEVICE); |
419 | priv->alloc_rxb_page--; | 417 | __iwl_free_pages(priv, rxq->pool[i].page); |
420 | __free_pages(rxq->pool[i].page, | ||
421 | priv->hw_params.rx_page_order); | ||
422 | rxq->pool[i].page = NULL; | 418 | rxq->pool[i].page = NULL; |
423 | } | 419 | } |
424 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); | 420 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); |
@@ -654,47 +650,6 @@ void iwl_reply_statistics(struct iwl_priv *priv, | |||
654 | } | 650 | } |
655 | EXPORT_SYMBOL(iwl_reply_statistics); | 651 | EXPORT_SYMBOL(iwl_reply_statistics); |
656 | 652 | ||
657 | #define PERFECT_RSSI (-20) /* dBm */ | ||
658 | #define WORST_RSSI (-95) /* dBm */ | ||
659 | #define RSSI_RANGE (PERFECT_RSSI - WORST_RSSI) | ||
660 | |||
661 | /* Calculate an indication of rx signal quality (a percentage, not dBm!). | ||
662 | * See http://www.ces.clemson.edu/linux/signal_quality.shtml for info | ||
663 | * about formulas used below. */ | ||
664 | static int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm) | ||
665 | { | ||
666 | int sig_qual; | ||
667 | int degradation = PERFECT_RSSI - rssi_dbm; | ||
668 | |||
669 | /* If we get a noise measurement, use signal-to-noise ratio (SNR) | ||
670 | * as indicator; formula is (signal dbm - noise dbm). | ||
671 | * SNR at or above 40 is a great signal (100%). | ||
672 | * Below that, scale to fit SNR of 0 - 40 dB within 0 - 100% indicator. | ||
673 | * Weakest usable signal is usually 10 - 15 dB SNR. */ | ||
674 | if (noise_dbm) { | ||
675 | if (rssi_dbm - noise_dbm >= 40) | ||
676 | return 100; | ||
677 | else if (rssi_dbm < noise_dbm) | ||
678 | return 0; | ||
679 | sig_qual = ((rssi_dbm - noise_dbm) * 5) / 2; | ||
680 | |||
681 | /* Else use just the signal level. | ||
682 | * This formula is a least squares fit of data points collected and | ||
683 | * compared with a reference system that had a percentage (%) display | ||
684 | * for signal quality. */ | ||
685 | } else | ||
686 | sig_qual = (100 * (RSSI_RANGE * RSSI_RANGE) - degradation * | ||
687 | (15 * RSSI_RANGE + 62 * degradation)) / | ||
688 | (RSSI_RANGE * RSSI_RANGE); | ||
689 | |||
690 | if (sig_qual > 100) | ||
691 | sig_qual = 100; | ||
692 | else if (sig_qual < 1) | ||
693 | sig_qual = 0; | ||
694 | |||
695 | return sig_qual; | ||
696 | } | ||
697 | |||
698 | /* Calc max signal level (dBm) among 3 possible receivers */ | 653 | /* Calc max signal level (dBm) among 3 possible receivers */ |
699 | static inline int iwl_calc_rssi(struct iwl_priv *priv, | 654 | static inline int iwl_calc_rssi(struct iwl_priv *priv, |
700 | struct iwl_rx_phy_res *rx_resp) | 655 | struct iwl_rx_phy_res *rx_resp) |
@@ -973,7 +928,10 @@ static void iwl_pass_packet_to_mac80211(struct iwl_priv *priv, | |||
973 | if (ieee80211_is_mgmt(fc) || | 928 | if (ieee80211_is_mgmt(fc) || |
974 | ieee80211_has_protected(fc) || | 929 | ieee80211_has_protected(fc) || |
975 | ieee80211_has_morefrags(fc) || | 930 | ieee80211_has_morefrags(fc) || |
976 | le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) | 931 | le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG || |
932 | (ieee80211_is_data_qos(fc) && | ||
933 | *ieee80211_get_qos_ctl(hdr) & | ||
934 | IEEE80211_QOS_CONTROL_A_MSDU_PRESENT)) | ||
977 | ret = skb_linearize(skb); | 935 | ret = skb_linearize(skb); |
978 | else | 936 | else |
979 | ret = __pskb_pull_tail(skb, min_t(u16, IWL_LINK_HDR_MAX, len)) ? | 937 | ret = __pskb_pull_tail(skb, min_t(u16, IWL_LINK_HDR_MAX, len)) ? |
@@ -1105,11 +1063,8 @@ void iwl_rx_reply_rx(struct iwl_priv *priv, | |||
1105 | if (iwl_is_associated(priv) && | 1063 | if (iwl_is_associated(priv) && |
1106 | !test_bit(STATUS_SCANNING, &priv->status)) { | 1064 | !test_bit(STATUS_SCANNING, &priv->status)) { |
1107 | rx_status.noise = priv->last_rx_noise; | 1065 | rx_status.noise = priv->last_rx_noise; |
1108 | rx_status.qual = iwl_calc_sig_qual(rx_status.signal, | ||
1109 | rx_status.noise); | ||
1110 | } else { | 1066 | } else { |
1111 | rx_status.noise = IWL_NOISE_MEAS_NOT_AVAILABLE; | 1067 | rx_status.noise = IWL_NOISE_MEAS_NOT_AVAILABLE; |
1112 | rx_status.qual = iwl_calc_sig_qual(rx_status.signal, 0); | ||
1113 | } | 1068 | } |
1114 | 1069 | ||
1115 | /* Reset beacon noise level if not associated. */ | 1070 | /* Reset beacon noise level if not associated. */ |
@@ -1122,8 +1077,8 @@ void iwl_rx_reply_rx(struct iwl_priv *priv, | |||
1122 | iwl_dbg_report_frame(priv, phy_res, len, header, 1); | 1077 | iwl_dbg_report_frame(priv, phy_res, len, header, 1); |
1123 | #endif | 1078 | #endif |
1124 | iwl_dbg_log_rx_data_frame(priv, len, header); | 1079 | iwl_dbg_log_rx_data_frame(priv, len, header); |
1125 | IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, noise %d, qual %d, TSF %llu\n", | 1080 | IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, noise %d, TSF %llu\n", |
1126 | rx_status.signal, rx_status.noise, rx_status.qual, | 1081 | rx_status.signal, rx_status.noise, |
1127 | (unsigned long long)rx_status.mactime); | 1082 | (unsigned long long)rx_status.mactime); |
1128 | 1083 | ||
1129 | /* | 1084 | /* |
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c index a2b2b8315ff9..fa1c89ba6459 100644 --- a/drivers/net/wireless/iwlwifi/iwl-scan.c +++ b/drivers/net/wireless/iwlwifi/iwl-scan.c | |||
@@ -144,8 +144,7 @@ static int iwl_send_scan_abort(struct iwl_priv *priv) | |||
144 | clear_bit(STATUS_SCAN_HW, &priv->status); | 144 | clear_bit(STATUS_SCAN_HW, &priv->status); |
145 | } | 145 | } |
146 | 146 | ||
147 | priv->alloc_rxb_page--; | 147 | iwl_free_pages(priv, cmd.reply_page); |
148 | free_pages(cmd.reply_page, priv->hw_params.rx_page_order); | ||
149 | 148 | ||
150 | return ret; | 149 | return ret; |
151 | } | 150 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c index cd6a6901216e..90fbdb25399e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-sta.c | |||
@@ -164,9 +164,7 @@ int iwl_send_add_sta(struct iwl_priv *priv, | |||
164 | break; | 164 | break; |
165 | } | 165 | } |
166 | } | 166 | } |
167 | 167 | iwl_free_pages(priv, cmd.reply_page); | |
168 | priv->alloc_rxb_page--; | ||
169 | free_pages(cmd.reply_page, priv->hw_params.rx_page_order); | ||
170 | 168 | ||
171 | return ret; | 169 | return ret; |
172 | } | 170 | } |
@@ -299,7 +297,7 @@ u8 iwl_add_station(struct iwl_priv *priv, const u8 *addr, bool is_ap, u8 flags, | |||
299 | } | 297 | } |
300 | EXPORT_SYMBOL(iwl_add_station); | 298 | EXPORT_SYMBOL(iwl_add_station); |
301 | 299 | ||
302 | static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, const char *addr) | 300 | static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, const u8 *addr) |
303 | { | 301 | { |
304 | unsigned long flags; | 302 | unsigned long flags; |
305 | u8 sta_id = iwl_find_station(priv, addr); | 303 | u8 sta_id = iwl_find_station(priv, addr); |
@@ -326,7 +324,7 @@ static void iwl_remove_sta_callback(struct iwl_priv *priv, | |||
326 | { | 324 | { |
327 | struct iwl_rem_sta_cmd *rm_sta = | 325 | struct iwl_rem_sta_cmd *rm_sta = |
328 | (struct iwl_rem_sta_cmd *)cmd->cmd.payload; | 326 | (struct iwl_rem_sta_cmd *)cmd->cmd.payload; |
329 | const char *addr = rm_sta->addr; | 327 | const u8 *addr = rm_sta->addr; |
330 | 328 | ||
331 | if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) { | 329 | if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) { |
332 | IWL_ERR(priv, "Bad return from REPLY_REMOVE_STA (0x%08X)\n", | 330 | IWL_ERR(priv, "Bad return from REPLY_REMOVE_STA (0x%08X)\n", |
@@ -391,9 +389,7 @@ static int iwl_send_remove_station(struct iwl_priv *priv, const u8 *addr, | |||
391 | break; | 389 | break; |
392 | } | 390 | } |
393 | } | 391 | } |
394 | 392 | iwl_free_pages(priv, cmd.reply_page); | |
395 | priv->alloc_rxb_page--; | ||
396 | free_pages(cmd.reply_page, priv->hw_params.rx_page_order); | ||
397 | 393 | ||
398 | return ret; | 394 | return ret; |
399 | } | 395 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c index 00da5e152d46..8f4071562857 100644 --- a/drivers/net/wireless/iwlwifi/iwl-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c | |||
@@ -120,6 +120,20 @@ int iwl_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq) | |||
120 | EXPORT_SYMBOL(iwl_txq_update_write_ptr); | 120 | EXPORT_SYMBOL(iwl_txq_update_write_ptr); |
121 | 121 | ||
122 | 122 | ||
123 | void iwl_free_tfds_in_queue(struct iwl_priv *priv, | ||
124 | int sta_id, int tid, int freed) | ||
125 | { | ||
126 | if (priv->stations[sta_id].tid[tid].tfds_in_queue >= freed) | ||
127 | priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; | ||
128 | else { | ||
129 | IWL_ERR(priv, "free more than tfds_in_queue (%u:%d)\n", | ||
130 | priv->stations[sta_id].tid[tid].tfds_in_queue, | ||
131 | freed); | ||
132 | priv->stations[sta_id].tid[tid].tfds_in_queue = 0; | ||
133 | } | ||
134 | } | ||
135 | EXPORT_SYMBOL(iwl_free_tfds_in_queue); | ||
136 | |||
123 | /** | 137 | /** |
124 | * iwl_tx_queue_free - Deallocate DMA queue. | 138 | * iwl_tx_queue_free - Deallocate DMA queue. |
125 | * @txq: Transmit queue to deallocate. | 139 | * @txq: Transmit queue to deallocate. |
@@ -407,13 +421,14 @@ void iwl_hw_txq_ctx_free(struct iwl_priv *priv) | |||
407 | int txq_id; | 421 | int txq_id; |
408 | 422 | ||
409 | /* Tx queues */ | 423 | /* Tx queues */ |
410 | if (priv->txq) | 424 | if (priv->txq) { |
411 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; | 425 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; |
412 | txq_id++) | 426 | txq_id++) |
413 | if (txq_id == IWL_CMD_QUEUE_NUM) | 427 | if (txq_id == IWL_CMD_QUEUE_NUM) |
414 | iwl_cmd_queue_free(priv); | 428 | iwl_cmd_queue_free(priv); |
415 | else | 429 | else |
416 | iwl_tx_queue_free(priv, txq_id); | 430 | iwl_tx_queue_free(priv, txq_id); |
431 | } | ||
417 | iwl_free_dma_ptr(priv, &priv->kw); | 432 | iwl_free_dma_ptr(priv, &priv->kw); |
418 | 433 | ||
419 | iwl_free_dma_ptr(priv, &priv->scd_bc_tbls); | 434 | iwl_free_dma_ptr(priv, &priv->scd_bc_tbls); |
@@ -1130,6 +1145,7 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) | |||
1130 | struct iwl_queue *q = &txq->q; | 1145 | struct iwl_queue *q = &txq->q; |
1131 | struct iwl_tx_info *tx_info; | 1146 | struct iwl_tx_info *tx_info; |
1132 | int nfreed = 0; | 1147 | int nfreed = 0; |
1148 | struct ieee80211_hdr *hdr; | ||
1133 | 1149 | ||
1134 | if ((index >= q->n_bd) || (iwl_queue_used(q, index) == 0)) { | 1150 | if ((index >= q->n_bd) || (iwl_queue_used(q, index) == 0)) { |
1135 | IWL_ERR(priv, "Read index for DMA queue txq id (%d), index %d, " | 1151 | IWL_ERR(priv, "Read index for DMA queue txq id (%d), index %d, " |
@@ -1144,13 +1160,16 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) | |||
1144 | 1160 | ||
1145 | tx_info = &txq->txb[txq->q.read_ptr]; | 1161 | tx_info = &txq->txb[txq->q.read_ptr]; |
1146 | iwl_tx_status(priv, tx_info->skb[0]); | 1162 | iwl_tx_status(priv, tx_info->skb[0]); |
1163 | |||
1164 | hdr = (struct ieee80211_hdr *)tx_info->skb[0]->data; | ||
1165 | if (hdr && ieee80211_is_data_qos(hdr->frame_control)) | ||
1166 | nfreed++; | ||
1147 | tx_info->skb[0] = NULL; | 1167 | tx_info->skb[0] = NULL; |
1148 | 1168 | ||
1149 | if (priv->cfg->ops->lib->txq_inval_byte_cnt_tbl) | 1169 | if (priv->cfg->ops->lib->txq_inval_byte_cnt_tbl) |
1150 | priv->cfg->ops->lib->txq_inval_byte_cnt_tbl(priv, txq); | 1170 | priv->cfg->ops->lib->txq_inval_byte_cnt_tbl(priv, txq); |
1151 | 1171 | ||
1152 | priv->cfg->ops->lib->txq_free_tfd(priv, txq); | 1172 | priv->cfg->ops->lib->txq_free_tfd(priv, txq); |
1153 | nfreed++; | ||
1154 | } | 1173 | } |
1155 | return nfreed; | 1174 | return nfreed; |
1156 | } | 1175 | } |
@@ -1558,7 +1577,7 @@ void iwl_rx_reply_compressed_ba(struct iwl_priv *priv, | |||
1558 | if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff)) { | 1577 | if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff)) { |
1559 | /* calculate mac80211 ampdu sw queue to wake */ | 1578 | /* calculate mac80211 ampdu sw queue to wake */ |
1560 | int freed = iwl_tx_queue_reclaim(priv, scd_flow, index); | 1579 | int freed = iwl_tx_queue_reclaim(priv, scd_flow, index); |
1561 | priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; | 1580 | iwl_free_tfds_in_queue(priv, sta_id, tid, freed); |
1562 | 1581 | ||
1563 | if ((iwl_queue_space(&txq->q) > txq->q.low_mark) && | 1582 | if ((iwl_queue_space(&txq->q) > txq->q.low_mark) && |
1564 | priv->mac80211_registered && | 1583 | priv->mac80211_registered && |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 2a28a1f8b1fe..f8e4e4b18d02 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -548,6 +548,9 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
548 | txq = &priv->txq[txq_id]; | 548 | txq = &priv->txq[txq_id]; |
549 | q = &txq->q; | 549 | q = &txq->q; |
550 | 550 | ||
551 | if ((iwl_queue_space(q) < q->high_mark)) | ||
552 | goto drop; | ||
553 | |||
551 | spin_lock_irqsave(&priv->lock, flags); | 554 | spin_lock_irqsave(&priv->lock, flags); |
552 | 555 | ||
553 | idx = get_cmd_index(q, q->write_ptr, 0); | 556 | idx = get_cmd_index(q, q->write_ptr, 0); |
@@ -812,7 +815,7 @@ static int iwl3945_get_measurement(struct iwl_priv *priv, | |||
812 | break; | 815 | break; |
813 | } | 816 | } |
814 | 817 | ||
815 | free_pages(cmd.reply_page, priv->hw_params.rx_page_order); | 818 | iwl_free_pages(priv, cmd.reply_page); |
816 | 819 | ||
817 | return rc; | 820 | return rc; |
818 | } | 821 | } |
@@ -1198,9 +1201,7 @@ void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | |||
1198 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, | 1201 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, |
1199 | PAGE_SIZE << priv->hw_params.rx_page_order, | 1202 | PAGE_SIZE << priv->hw_params.rx_page_order, |
1200 | PCI_DMA_FROMDEVICE); | 1203 | PCI_DMA_FROMDEVICE); |
1201 | priv->alloc_rxb_page--; | 1204 | __iwl_free_pages(priv, rxq->pool[i].page); |
1202 | __free_pages(rxq->pool[i].page, | ||
1203 | priv->hw_params.rx_page_order); | ||
1204 | rxq->pool[i].page = NULL; | 1205 | rxq->pool[i].page = NULL; |
1205 | } | 1206 | } |
1206 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); | 1207 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); |
@@ -1247,10 +1248,8 @@ static void iwl3945_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rx | |||
1247 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, | 1248 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, |
1248 | PAGE_SIZE << priv->hw_params.rx_page_order, | 1249 | PAGE_SIZE << priv->hw_params.rx_page_order, |
1249 | PCI_DMA_FROMDEVICE); | 1250 | PCI_DMA_FROMDEVICE); |
1250 | __free_pages(rxq->pool[i].page, | 1251 | __iwl_free_pages(priv, rxq->pool[i].page); |
1251 | priv->hw_params.rx_page_order); | ||
1252 | rxq->pool[i].page = NULL; | 1252 | rxq->pool[i].page = NULL; |
1253 | priv->alloc_rxb_page--; | ||
1254 | } | 1253 | } |
1255 | } | 1254 | } |
1256 | 1255 | ||
@@ -1300,47 +1299,6 @@ int iwl3945_calc_db_from_ratio(int sig_ratio) | |||
1300 | return (int)ratio2dB[sig_ratio]; | 1299 | return (int)ratio2dB[sig_ratio]; |
1301 | } | 1300 | } |
1302 | 1301 | ||
1303 | #define PERFECT_RSSI (-20) /* dBm */ | ||
1304 | #define WORST_RSSI (-95) /* dBm */ | ||
1305 | #define RSSI_RANGE (PERFECT_RSSI - WORST_RSSI) | ||
1306 | |||
1307 | /* Calculate an indication of rx signal quality (a percentage, not dBm!). | ||
1308 | * See http://www.ces.clemson.edu/linux/signal_quality.shtml for info | ||
1309 | * about formulas used below. */ | ||
1310 | int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm) | ||
1311 | { | ||
1312 | int sig_qual; | ||
1313 | int degradation = PERFECT_RSSI - rssi_dbm; | ||
1314 | |||
1315 | /* If we get a noise measurement, use signal-to-noise ratio (SNR) | ||
1316 | * as indicator; formula is (signal dbm - noise dbm). | ||
1317 | * SNR at or above 40 is a great signal (100%). | ||
1318 | * Below that, scale to fit SNR of 0 - 40 dB within 0 - 100% indicator. | ||
1319 | * Weakest usable signal is usually 10 - 15 dB SNR. */ | ||
1320 | if (noise_dbm) { | ||
1321 | if (rssi_dbm - noise_dbm >= 40) | ||
1322 | return 100; | ||
1323 | else if (rssi_dbm < noise_dbm) | ||
1324 | return 0; | ||
1325 | sig_qual = ((rssi_dbm - noise_dbm) * 5) / 2; | ||
1326 | |||
1327 | /* Else use just the signal level. | ||
1328 | * This formula is a least squares fit of data points collected and | ||
1329 | * compared with a reference system that had a percentage (%) display | ||
1330 | * for signal quality. */ | ||
1331 | } else | ||
1332 | sig_qual = (100 * (RSSI_RANGE * RSSI_RANGE) - degradation * | ||
1333 | (15 * RSSI_RANGE + 62 * degradation)) / | ||
1334 | (RSSI_RANGE * RSSI_RANGE); | ||
1335 | |||
1336 | if (sig_qual > 100) | ||
1337 | sig_qual = 100; | ||
1338 | else if (sig_qual < 1) | ||
1339 | sig_qual = 0; | ||
1340 | |||
1341 | return sig_qual; | ||
1342 | } | ||
1343 | |||
1344 | /** | 1302 | /** |
1345 | * iwl3945_rx_handle - Main entry function for receiving responses from uCode | 1303 | * iwl3945_rx_handle - Main entry function for receiving responses from uCode |
1346 | * | 1304 | * |
@@ -1688,7 +1646,7 @@ void iwl3945_dump_nic_event_log(struct iwl_priv *priv, bool full_log) | |||
1688 | } | 1646 | } |
1689 | 1647 | ||
1690 | #ifdef CONFIG_IWLWIFI_DEBUG | 1648 | #ifdef CONFIG_IWLWIFI_DEBUG |
1691 | if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS)) | 1649 | if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) && !full_log) |
1692 | size = (size > DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES) | 1650 | size = (size > DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES) |
1693 | ? DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES : size; | 1651 | ? DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES : size; |
1694 | #else | 1652 | #else |
@@ -3867,7 +3825,6 @@ static int iwl3945_init_drv(struct iwl_priv *priv) | |||
3867 | priv->retry_rate = 1; | 3825 | priv->retry_rate = 1; |
3868 | priv->ibss_beacon = NULL; | 3826 | priv->ibss_beacon = NULL; |
3869 | 3827 | ||
3870 | spin_lock_init(&priv->lock); | ||
3871 | spin_lock_init(&priv->sta_lock); | 3828 | spin_lock_init(&priv->sta_lock); |
3872 | spin_lock_init(&priv->hcmd_lock); | 3829 | spin_lock_init(&priv->hcmd_lock); |
3873 | 3830 | ||
@@ -3936,9 +3893,11 @@ static int iwl3945_setup_mac(struct iwl_priv *priv) | |||
3936 | /* Tell mac80211 our characteristics */ | 3893 | /* Tell mac80211 our characteristics */ |
3937 | hw->flags = IEEE80211_HW_SIGNAL_DBM | | 3894 | hw->flags = IEEE80211_HW_SIGNAL_DBM | |
3938 | IEEE80211_HW_NOISE_DBM | | 3895 | IEEE80211_HW_NOISE_DBM | |
3939 | IEEE80211_HW_SPECTRUM_MGMT | | 3896 | IEEE80211_HW_SPECTRUM_MGMT; |
3940 | IEEE80211_HW_SUPPORTS_PS | | 3897 | |
3941 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS; | 3898 | if (!priv->cfg->broken_powersave) |
3899 | hw->flags |= IEEE80211_HW_SUPPORTS_PS | | ||
3900 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS; | ||
3942 | 3901 | ||
3943 | hw->wiphy->interface_modes = | 3902 | hw->wiphy->interface_modes = |
3944 | BIT(NL80211_IFTYPE_STATION) | | 3903 | BIT(NL80211_IFTYPE_STATION) | |
@@ -4057,10 +4016,11 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
4057 | * PCI Tx retries from interfering with C3 CPU state */ | 4016 | * PCI Tx retries from interfering with C3 CPU state */ |
4058 | pci_write_config_byte(pdev, 0x41, 0x00); | 4017 | pci_write_config_byte(pdev, 0x41, 0x00); |
4059 | 4018 | ||
4060 | /* this spin lock will be used in apm_ops.init and EEPROM access | 4019 | /* these spin locks will be used in apm_ops.init and EEPROM access |
4061 | * we should init now | 4020 | * we should init now |
4062 | */ | 4021 | */ |
4063 | spin_lock_init(&priv->reg_lock); | 4022 | spin_lock_init(&priv->reg_lock); |
4023 | spin_lock_init(&priv->lock); | ||
4064 | 4024 | ||
4065 | /*********************** | 4025 | /*********************** |
4066 | * 4. Read EEPROM | 4026 | * 4. Read EEPROM |
diff --git a/drivers/net/wireless/iwmc3200wifi/commands.c b/drivers/net/wireless/iwmc3200wifi/commands.c index 777584d76a88..1e41ad0fcad5 100644 --- a/drivers/net/wireless/iwmc3200wifi/commands.c +++ b/drivers/net/wireless/iwmc3200wifi/commands.c | |||
@@ -973,6 +973,10 @@ int iwm_send_pmkid_update(struct iwm_priv *iwm, | |||
973 | 973 | ||
974 | memset(&update, 0, sizeof(struct iwm_umac_pmkid_update)); | 974 | memset(&update, 0, sizeof(struct iwm_umac_pmkid_update)); |
975 | 975 | ||
976 | update.hdr.oid = UMAC_WIFI_IF_CMD_PMKID_UPDATE; | ||
977 | update.hdr.buf_size = cpu_to_le16(sizeof(struct iwm_umac_pmkid_update) - | ||
978 | sizeof(struct iwm_umac_wifi_if)); | ||
979 | |||
976 | update.command = cpu_to_le32(command); | 980 | update.command = cpu_to_le32(command); |
977 | if (pmksa->bssid) | 981 | if (pmksa->bssid) |
978 | memcpy(&update.bssid, pmksa->bssid, ETH_ALEN); | 982 | memcpy(&update.bssid, pmksa->bssid, ETH_ALEN); |
diff --git a/drivers/net/wireless/iwmc3200wifi/commands.h b/drivers/net/wireless/iwmc3200wifi/commands.h index 06af0552cd75..3dfd9f0e9003 100644 --- a/drivers/net/wireless/iwmc3200wifi/commands.h +++ b/drivers/net/wireless/iwmc3200wifi/commands.h | |||
@@ -463,6 +463,7 @@ struct iwm_umac_cmd_stop_resume_tx { | |||
463 | #define IWM_CMD_PMKID_FLUSH 3 | 463 | #define IWM_CMD_PMKID_FLUSH 3 |
464 | 464 | ||
465 | struct iwm_umac_pmkid_update { | 465 | struct iwm_umac_pmkid_update { |
466 | struct iwm_umac_wifi_if hdr; | ||
466 | __le32 command; | 467 | __le32 command; |
467 | u8 bssid[ETH_ALEN]; | 468 | u8 bssid[ETH_ALEN]; |
468 | __le16 reserved; | 469 | __le16 reserved; |
diff --git a/drivers/net/wireless/iwmc3200wifi/iwm.h b/drivers/net/wireless/iwmc3200wifi/iwm.h index 5a26bb05a33a..842811142bef 100644 --- a/drivers/net/wireless/iwmc3200wifi/iwm.h +++ b/drivers/net/wireless/iwmc3200wifi/iwm.h | |||
@@ -268,7 +268,7 @@ struct iwm_priv { | |||
268 | 268 | ||
269 | struct sk_buff_head rx_list; | 269 | struct sk_buff_head rx_list; |
270 | struct list_head rx_tickets; | 270 | struct list_head rx_tickets; |
271 | struct list_head rx_packets[IWM_RX_ID_HASH]; | 271 | struct list_head rx_packets[IWM_RX_ID_HASH + 1]; |
272 | struct workqueue_struct *rx_wq; | 272 | struct workqueue_struct *rx_wq; |
273 | struct work_struct rx_worker; | 273 | struct work_struct rx_worker; |
274 | 274 | ||
@@ -349,7 +349,7 @@ int iwm_up(struct iwm_priv *iwm); | |||
349 | int iwm_down(struct iwm_priv *iwm); | 349 | int iwm_down(struct iwm_priv *iwm); |
350 | 350 | ||
351 | /* TX API */ | 351 | /* TX API */ |
352 | u16 iwm_tid_to_queue(u16 tid); | 352 | int iwm_tid_to_queue(u16 tid); |
353 | void iwm_tx_credit_inc(struct iwm_priv *iwm, int id, int total_freed_pages); | 353 | void iwm_tx_credit_inc(struct iwm_priv *iwm, int id, int total_freed_pages); |
354 | void iwm_tx_worker(struct work_struct *work); | 354 | void iwm_tx_worker(struct work_struct *work); |
355 | int iwm_xmit_frame(struct sk_buff *skb, struct net_device *netdev); | 355 | int iwm_xmit_frame(struct sk_buff *skb, struct net_device *netdev); |
diff --git a/drivers/net/wireless/iwmc3200wifi/netdev.c b/drivers/net/wireless/iwmc3200wifi/netdev.c index e4f0f8705f65..c4c0d23c63ec 100644 --- a/drivers/net/wireless/iwmc3200wifi/netdev.c +++ b/drivers/net/wireless/iwmc3200wifi/netdev.c | |||
@@ -76,7 +76,7 @@ static int iwm_stop(struct net_device *ndev) | |||
76 | */ | 76 | */ |
77 | static const u16 iwm_1d_to_queue[8] = { 1, 0, 0, 1, 2, 2, 3, 3 }; | 77 | static const u16 iwm_1d_to_queue[8] = { 1, 0, 0, 1, 2, 2, 3, 3 }; |
78 | 78 | ||
79 | u16 iwm_tid_to_queue(u16 tid) | 79 | int iwm_tid_to_queue(u16 tid) |
80 | { | 80 | { |
81 | if (tid > IWM_UMAC_TID_NR - 2) | 81 | if (tid > IWM_UMAC_TID_NR - 2) |
82 | return -EINVAL; | 82 | return -EINVAL; |
diff --git a/drivers/net/wireless/iwmc3200wifi/rx.c b/drivers/net/wireless/iwmc3200wifi/rx.c index 1c57c1f72cba..f727b4a83196 100644 --- a/drivers/net/wireless/iwmc3200wifi/rx.c +++ b/drivers/net/wireless/iwmc3200wifi/rx.c | |||
@@ -794,7 +794,7 @@ static int iwm_mlme_update_bss_table(struct iwm_priv *iwm, u8 *buf, | |||
794 | } | 794 | } |
795 | 795 | ||
796 | bss->bss = kzalloc(bss_len, GFP_KERNEL); | 796 | bss->bss = kzalloc(bss_len, GFP_KERNEL); |
797 | if (!bss) { | 797 | if (!bss->bss) { |
798 | kfree(bss); | 798 | kfree(bss); |
799 | IWM_ERR(iwm, "Couldn't allocate bss\n"); | 799 | IWM_ERR(iwm, "Couldn't allocate bss\n"); |
800 | return -ENOMEM; | 800 | return -ENOMEM; |
@@ -1126,7 +1126,7 @@ static int iwm_ntf_stop_resume_tx(struct iwm_priv *iwm, u8 *buf, | |||
1126 | 1126 | ||
1127 | if (!stop) { | 1127 | if (!stop) { |
1128 | struct iwm_tx_queue *txq; | 1128 | struct iwm_tx_queue *txq; |
1129 | u16 queue = iwm_tid_to_queue(bit); | 1129 | int queue = iwm_tid_to_queue(bit); |
1130 | 1130 | ||
1131 | if (queue < 0) | 1131 | if (queue < 0) |
1132 | continue; | 1132 | continue; |
diff --git a/drivers/net/wireless/libertas/mesh.c b/drivers/net/wireless/libertas/mesh.c index 2f91c9b808af..92b7a357a5e4 100644 --- a/drivers/net/wireless/libertas/mesh.c +++ b/drivers/net/wireless/libertas/mesh.c | |||
@@ -2,6 +2,7 @@ | |||
2 | #include <linux/delay.h> | 2 | #include <linux/delay.h> |
3 | #include <linux/etherdevice.h> | 3 | #include <linux/etherdevice.h> |
4 | #include <linux/netdevice.h> | 4 | #include <linux/netdevice.h> |
5 | #include <linux/if_ether.h> | ||
5 | #include <linux/if_arp.h> | 6 | #include <linux/if_arp.h> |
6 | #include <linux/kthread.h> | 7 | #include <linux/kthread.h> |
7 | #include <linux/kfifo.h> | 8 | #include <linux/kfifo.h> |
@@ -351,8 +352,7 @@ int lbs_add_mesh(struct lbs_private *priv) | |||
351 | 352 | ||
352 | mesh_dev->netdev_ops = &mesh_netdev_ops; | 353 | mesh_dev->netdev_ops = &mesh_netdev_ops; |
353 | mesh_dev->ethtool_ops = &lbs_ethtool_ops; | 354 | mesh_dev->ethtool_ops = &lbs_ethtool_ops; |
354 | memcpy(mesh_dev->dev_addr, priv->dev->dev_addr, | 355 | memcpy(mesh_dev->dev_addr, priv->dev->dev_addr, ETH_ALEN); |
355 | sizeof(priv->dev->dev_addr)); | ||
356 | 356 | ||
357 | SET_NETDEV_DEV(priv->mesh_dev, priv->dev->dev.parent); | 357 | SET_NETDEV_DEV(priv->mesh_dev, priv->dev->dev.parent); |
358 | 358 | ||
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index c6a6c042b82f..b0b1c7841500 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c | |||
@@ -567,11 +567,8 @@ int lbs_scan_networks(struct lbs_private *priv, int full_scan) | |||
567 | chan_count = lbs_scan_create_channel_list(priv, chan_list); | 567 | chan_count = lbs_scan_create_channel_list(priv, chan_list); |
568 | 568 | ||
569 | netif_stop_queue(priv->dev); | 569 | netif_stop_queue(priv->dev); |
570 | netif_carrier_off(priv->dev); | 570 | if (priv->mesh_dev) |
571 | if (priv->mesh_dev) { | ||
572 | netif_stop_queue(priv->mesh_dev); | 571 | netif_stop_queue(priv->mesh_dev); |
573 | netif_carrier_off(priv->mesh_dev); | ||
574 | } | ||
575 | 572 | ||
576 | /* Prepare to continue an interrupted scan */ | 573 | /* Prepare to continue an interrupted scan */ |
577 | lbs_deb_scan("chan_count %d, scan_channel %d\n", | 574 | lbs_deb_scan("chan_count %d, scan_channel %d\n", |
@@ -635,16 +632,13 @@ out2: | |||
635 | priv->scan_channel = 0; | 632 | priv->scan_channel = 0; |
636 | 633 | ||
637 | out: | 634 | out: |
638 | if (priv->connect_status == LBS_CONNECTED) { | 635 | if (priv->connect_status == LBS_CONNECTED && !priv->tx_pending_len) |
639 | netif_carrier_on(priv->dev); | 636 | netif_wake_queue(priv->dev); |
640 | if (!priv->tx_pending_len) | 637 | |
641 | netif_wake_queue(priv->dev); | 638 | if (priv->mesh_dev && (priv->mesh_connect_status == LBS_CONNECTED) && |
642 | } | 639 | !priv->tx_pending_len) |
643 | if (priv->mesh_dev && (priv->mesh_connect_status == LBS_CONNECTED)) { | 640 | netif_wake_queue(priv->mesh_dev); |
644 | netif_carrier_on(priv->mesh_dev); | 641 | |
645 | if (!priv->tx_pending_len) | ||
646 | netif_wake_queue(priv->mesh_dev); | ||
647 | } | ||
648 | kfree(chan_list); | 642 | kfree(chan_list); |
649 | 643 | ||
650 | lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret); | 644 | lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret); |
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index a8eb9e1fcf36..4b1aab593a84 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c | |||
@@ -2025,10 +2025,8 @@ static int lbs_get_essid(struct net_device *dev, struct iw_request_info *info, | |||
2025 | if (priv->connect_status == LBS_CONNECTED) { | 2025 | if (priv->connect_status == LBS_CONNECTED) { |
2026 | memcpy(extra, priv->curbssparams.ssid, | 2026 | memcpy(extra, priv->curbssparams.ssid, |
2027 | priv->curbssparams.ssid_len); | 2027 | priv->curbssparams.ssid_len); |
2028 | extra[priv->curbssparams.ssid_len] = '\0'; | ||
2029 | } else { | 2028 | } else { |
2030 | memset(extra, 0, 32); | 2029 | memset(extra, 0, 32); |
2031 | extra[priv->curbssparams.ssid_len] = '\0'; | ||
2032 | } | 2030 | } |
2033 | /* | 2031 | /* |
2034 | * If none, we may want to get the one that was set | 2032 | * If none, we may want to get the one that was set |
diff --git a/drivers/net/wireless/libertas_tf/main.c b/drivers/net/wireless/libertas_tf/main.c index 019431d2f8a9..26a1abd5bb03 100644 --- a/drivers/net/wireless/libertas_tf/main.c +++ b/drivers/net/wireless/libertas_tf/main.c | |||
@@ -495,7 +495,6 @@ int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb) | |||
495 | stats.band = IEEE80211_BAND_2GHZ; | 495 | stats.band = IEEE80211_BAND_2GHZ; |
496 | stats.signal = prxpd->snr; | 496 | stats.signal = prxpd->snr; |
497 | stats.noise = prxpd->nf; | 497 | stats.noise = prxpd->nf; |
498 | stats.qual = prxpd->snr - prxpd->nf; | ||
499 | /* Marvell rate index has a hole at value 4 */ | 498 | /* Marvell rate index has a hole at value 4 */ |
500 | if (prxpd->rx_rate > 4) | 499 | if (prxpd->rx_rate > 4) |
501 | --prxpd->rx_rate; | 500 | --prxpd->rx_rate; |
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c index 59d49159cf2a..59f92105b0c2 100644 --- a/drivers/net/wireless/mwl8k.c +++ b/drivers/net/wireless/mwl8k.c | |||
@@ -3157,8 +3157,10 @@ static void mwl8k_configure_filter(struct ieee80211_hw *hw, | |||
3157 | /* Clear unsupported feature flags */ | 3157 | /* Clear unsupported feature flags */ |
3158 | *total_flags &= FIF_ALLMULTI | FIF_BCN_PRBRESP_PROMISC; | 3158 | *total_flags &= FIF_ALLMULTI | FIF_BCN_PRBRESP_PROMISC; |
3159 | 3159 | ||
3160 | if (mwl8k_fw_lock(hw)) | 3160 | if (mwl8k_fw_lock(hw)) { |
3161 | kfree(cmd); | ||
3161 | return; | 3162 | return; |
3163 | } | ||
3162 | 3164 | ||
3163 | if (priv->sniffer_enabled) { | 3165 | if (priv->sniffer_enabled) { |
3164 | mwl8k_enable_sniffer(hw, 0); | 3166 | mwl8k_enable_sniffer(hw, 0); |
diff --git a/drivers/net/wireless/orinoco/wext.c b/drivers/net/wireless/orinoco/wext.c index 7698fdd6a3a2..31ca241f7753 100644 --- a/drivers/net/wireless/orinoco/wext.c +++ b/drivers/net/wireless/orinoco/wext.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #define MAX_RID_LEN 1024 | 23 | #define MAX_RID_LEN 1024 |
24 | 24 | ||
25 | /* Helper routine to record keys | 25 | /* Helper routine to record keys |
26 | * Do not call from interrupt context */ | 26 | * It is called under orinoco_lock so it may not sleep */ |
27 | static int orinoco_set_key(struct orinoco_private *priv, int index, | 27 | static int orinoco_set_key(struct orinoco_private *priv, int index, |
28 | enum orinoco_alg alg, const u8 *key, int key_len, | 28 | enum orinoco_alg alg, const u8 *key, int key_len, |
29 | const u8 *seq, int seq_len) | 29 | const u8 *seq, int seq_len) |
@@ -32,14 +32,14 @@ static int orinoco_set_key(struct orinoco_private *priv, int index, | |||
32 | kzfree(priv->keys[index].seq); | 32 | kzfree(priv->keys[index].seq); |
33 | 33 | ||
34 | if (key_len) { | 34 | if (key_len) { |
35 | priv->keys[index].key = kzalloc(key_len, GFP_KERNEL); | 35 | priv->keys[index].key = kzalloc(key_len, GFP_ATOMIC); |
36 | if (!priv->keys[index].key) | 36 | if (!priv->keys[index].key) |
37 | goto nomem; | 37 | goto nomem; |
38 | } else | 38 | } else |
39 | priv->keys[index].key = NULL; | 39 | priv->keys[index].key = NULL; |
40 | 40 | ||
41 | if (seq_len) { | 41 | if (seq_len) { |
42 | priv->keys[index].seq = kzalloc(seq_len, GFP_KERNEL); | 42 | priv->keys[index].seq = kzalloc(seq_len, GFP_ATOMIC); |
43 | if (!priv->keys[index].seq) | 43 | if (!priv->keys[index].seq) |
44 | goto free_key; | 44 | goto free_key; |
45 | } else | 45 | } else |
diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c index a15962a19b2a..a72f7c2577de 100644 --- a/drivers/net/wireless/p54/p54pci.c +++ b/drivers/net/wireless/p54/p54pci.c | |||
@@ -197,6 +197,14 @@ static void p54p_check_rx_ring(struct ieee80211_hw *dev, u32 *index, | |||
197 | i %= ring_limit; | 197 | i %= ring_limit; |
198 | continue; | 198 | continue; |
199 | } | 199 | } |
200 | |||
201 | if (unlikely(len > priv->common.rx_mtu)) { | ||
202 | if (net_ratelimit()) | ||
203 | dev_err(&priv->pdev->dev, "rx'd frame size " | ||
204 | "exceeds length threshold.\n"); | ||
205 | |||
206 | len = priv->common.rx_mtu; | ||
207 | } | ||
200 | skb_put(skb, len); | 208 | skb_put(skb, len); |
201 | 209 | ||
202 | if (p54_rx(dev, skb)) { | 210 | if (p54_rx(dev, skb)) { |
diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h index c5fe867665e6..1a7eae357fef 100644 --- a/drivers/net/wireless/rt2x00/rt2800.h +++ b/drivers/net/wireless/rt2x00/rt2800.h | |||
@@ -1323,7 +1323,7 @@ | |||
1323 | #define PAIRWISE_KEY_ENTRY(__idx) \ | 1323 | #define PAIRWISE_KEY_ENTRY(__idx) \ |
1324 | ( PAIRWISE_KEY_TABLE_BASE + ((__idx) * sizeof(struct hw_key_entry)) ) | 1324 | ( PAIRWISE_KEY_TABLE_BASE + ((__idx) * sizeof(struct hw_key_entry)) ) |
1325 | #define MAC_IVEIV_ENTRY(__idx) \ | 1325 | #define MAC_IVEIV_ENTRY(__idx) \ |
1326 | ( MAC_IVEIV_TABLE_BASE + ((__idx) & sizeof(struct mac_iveiv_entry)) ) | 1326 | ( MAC_IVEIV_TABLE_BASE + ((__idx) * sizeof(struct mac_iveiv_entry)) ) |
1327 | #define MAC_WCID_ATTR_ENTRY(__idx) \ | 1327 | #define MAC_WCID_ATTR_ENTRY(__idx) \ |
1328 | ( MAC_WCID_ATTRIBUTE_BASE + ((__idx) * sizeof(u32)) ) | 1328 | ( MAC_WCID_ATTRIBUTE_BASE + ((__idx) * sizeof(u32)) ) |
1329 | #define SHARED_KEY_ENTRY(__idx) \ | 1329 | #define SHARED_KEY_ENTRY(__idx) \ |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index eb1e1d00bec3..9deae41cb784 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <linux/module.h> | 37 | #include <linux/module.h> |
38 | 38 | ||
39 | #include "rt2x00.h" | 39 | #include "rt2x00.h" |
40 | #ifdef CONFIG_RT2800USB | 40 | #if defined(CONFIG_RT2800USB) || defined(CONFIG_RT2800USB_MODULE) |
41 | #include "rt2x00usb.h" | 41 | #include "rt2x00usb.h" |
42 | #endif | 42 | #endif |
43 | #include "rt2800lib.h" | 43 | #include "rt2800lib.h" |
@@ -340,7 +340,7 @@ static int rt2800_blink_set(struct led_classdev *led_cdev, | |||
340 | rt2x00_set_field32(®, LED_CFG_OFF_PERIOD, *delay_off); | 340 | rt2x00_set_field32(®, LED_CFG_OFF_PERIOD, *delay_off); |
341 | rt2x00_set_field32(®, LED_CFG_SLOW_BLINK_PERIOD, 3); | 341 | rt2x00_set_field32(®, LED_CFG_SLOW_BLINK_PERIOD, 3); |
342 | rt2x00_set_field32(®, LED_CFG_R_LED_MODE, 3); | 342 | rt2x00_set_field32(®, LED_CFG_R_LED_MODE, 3); |
343 | rt2x00_set_field32(®, LED_CFG_G_LED_MODE, 12); | 343 | rt2x00_set_field32(®, LED_CFG_G_LED_MODE, 3); |
344 | rt2x00_set_field32(®, LED_CFG_Y_LED_MODE, 3); | 344 | rt2x00_set_field32(®, LED_CFG_Y_LED_MODE, 3); |
345 | rt2x00_set_field32(®, LED_CFG_LED_POLAR, 1); | 345 | rt2x00_set_field32(®, LED_CFG_LED_POLAR, 1); |
346 | rt2800_register_write(led->rt2x00dev, LED_CFG, reg); | 346 | rt2800_register_write(led->rt2x00dev, LED_CFG, reg); |
@@ -1121,7 +1121,7 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) | |||
1121 | 1121 | ||
1122 | if (rt2x00_intf_is_usb(rt2x00dev)) { | 1122 | if (rt2x00_intf_is_usb(rt2x00dev)) { |
1123 | rt2800_register_write(rt2x00dev, USB_DMA_CFG, 0x00000000); | 1123 | rt2800_register_write(rt2x00dev, USB_DMA_CFG, 0x00000000); |
1124 | #ifdef CONFIG_RT2800USB | 1124 | #if defined(CONFIG_RT2800USB) || defined(CONFIG_RT2800USB_MODULE) |
1125 | rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, 0, | 1125 | rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, 0, |
1126 | USB_MODE_RESET, REGISTER_TIMEOUT); | 1126 | USB_MODE_RESET, REGISTER_TIMEOUT); |
1127 | #endif | 1127 | #endif |
@@ -2022,6 +2022,12 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2022 | u16 eeprom; | 2022 | u16 eeprom; |
2023 | 2023 | ||
2024 | /* | 2024 | /* |
2025 | * Disable powersaving as default on PCI devices. | ||
2026 | */ | ||
2027 | if (rt2x00_intf_is_pci(rt2x00dev)) | ||
2028 | rt2x00dev->hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | ||
2029 | |||
2030 | /* | ||
2025 | * Initialize all hw fields. | 2031 | * Initialize all hw fields. |
2026 | */ | 2032 | */ |
2027 | rt2x00dev->hw->flags = | 2033 | rt2x00dev->hw->flags = |
@@ -2074,8 +2080,7 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2074 | IEEE80211_HT_CAP_SGI_20 | | 2080 | IEEE80211_HT_CAP_SGI_20 | |
2075 | IEEE80211_HT_CAP_SGI_40 | | 2081 | IEEE80211_HT_CAP_SGI_40 | |
2076 | IEEE80211_HT_CAP_TX_STBC | | 2082 | IEEE80211_HT_CAP_TX_STBC | |
2077 | IEEE80211_HT_CAP_RX_STBC | | 2083 | IEEE80211_HT_CAP_RX_STBC; |
2078 | IEEE80211_HT_CAP_PSMP_SUPPORT; | ||
2079 | spec->ht.ampdu_factor = 3; | 2084 | spec->ht.ampdu_factor = 3; |
2080 | spec->ht.ampdu_density = 4; | 2085 | spec->ht.ampdu_density = 4; |
2081 | spec->ht.mcs.tx_params = | 2086 | spec->ht.mcs.tx_params = |
@@ -2140,8 +2145,8 @@ static void rt2800_get_tkip_seq(struct ieee80211_hw *hw, u8 hw_key_idx, | |||
2140 | rt2800_register_multiread(rt2x00dev, offset, | 2145 | rt2800_register_multiread(rt2x00dev, offset, |
2141 | &iveiv_entry, sizeof(iveiv_entry)); | 2146 | &iveiv_entry, sizeof(iveiv_entry)); |
2142 | 2147 | ||
2143 | memcpy(&iveiv_entry.iv[0], iv16, sizeof(iv16)); | 2148 | memcpy(iv16, &iveiv_entry.iv[0], sizeof(*iv16)); |
2144 | memcpy(&iveiv_entry.iv[4], iv32, sizeof(iv32)); | 2149 | memcpy(iv32, &iveiv_entry.iv[4], sizeof(*iv32)); |
2145 | } | 2150 | } |
2146 | 2151 | ||
2147 | static int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u32 value) | 2152 | static int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u32 value) |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index af85d18cdbe7..ab95346cf6a3 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -922,6 +922,7 @@ static struct usb_device_id rt2800usb_device_table[] = { | |||
922 | { USB_DEVICE(0x1737, 0x0070), USB_DEVICE_DATA(&rt2800usb_ops) }, | 922 | { USB_DEVICE(0x1737, 0x0070), USB_DEVICE_DATA(&rt2800usb_ops) }, |
923 | { USB_DEVICE(0x1737, 0x0071), USB_DEVICE_DATA(&rt2800usb_ops) }, | 923 | { USB_DEVICE(0x1737, 0x0071), USB_DEVICE_DATA(&rt2800usb_ops) }, |
924 | { USB_DEVICE(0x1737, 0x0077), USB_DEVICE_DATA(&rt2800usb_ops) }, | 924 | { USB_DEVICE(0x1737, 0x0077), USB_DEVICE_DATA(&rt2800usb_ops) }, |
925 | { USB_DEVICE(0x1737, 0x0079), USB_DEVICE_DATA(&rt2800usb_ops) }, | ||
925 | /* Logitec */ | 926 | /* Logitec */ |
926 | { USB_DEVICE(0x0789, 0x0162), USB_DEVICE_DATA(&rt2800usb_ops) }, | 927 | { USB_DEVICE(0x0789, 0x0162), USB_DEVICE_DATA(&rt2800usb_ops) }, |
927 | { USB_DEVICE(0x0789, 0x0163), USB_DEVICE_DATA(&rt2800usb_ops) }, | 928 | { USB_DEVICE(0x0789, 0x0163), USB_DEVICE_DATA(&rt2800usb_ops) }, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 4d841c07c970..dcfc8c25d1a7 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -113,6 +113,12 @@ | |||
113 | ( ((unsigned long)((__skb)->data + (__header))) & 3 ) | 113 | ( ((unsigned long)((__skb)->data + (__header))) & 3 ) |
114 | 114 | ||
115 | /* | 115 | /* |
116 | * Constants for extra TX headroom for alignment purposes. | ||
117 | */ | ||
118 | #define RT2X00_ALIGN_SIZE 4 /* Only whole frame needs alignment */ | ||
119 | #define RT2X00_L2PAD_SIZE 8 /* Both header & payload need alignment */ | ||
120 | |||
121 | /* | ||
116 | * Standard timing and size defines. | 122 | * Standard timing and size defines. |
117 | * These values should follow the ieee80211 specifications. | 123 | * These values should follow the ieee80211 specifications. |
118 | */ | 124 | */ |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 06c43ca39bf8..265e66dba552 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -686,7 +686,17 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
686 | /* | 686 | /* |
687 | * Initialize extra TX headroom required. | 687 | * Initialize extra TX headroom required. |
688 | */ | 688 | */ |
689 | rt2x00dev->hw->extra_tx_headroom = rt2x00dev->ops->extra_tx_headroom; | 689 | rt2x00dev->hw->extra_tx_headroom = |
690 | max_t(unsigned int, IEEE80211_TX_STATUS_HEADROOM, | ||
691 | rt2x00dev->ops->extra_tx_headroom); | ||
692 | |||
693 | /* | ||
694 | * Take TX headroom required for alignment into account. | ||
695 | */ | ||
696 | if (test_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags)) | ||
697 | rt2x00dev->hw->extra_tx_headroom += RT2X00_L2PAD_SIZE; | ||
698 | else if (test_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags)) | ||
699 | rt2x00dev->hw->extra_tx_headroom += RT2X00_ALIGN_SIZE; | ||
690 | 700 | ||
691 | /* | 701 | /* |
692 | * Register HW. | 702 | * Register HW. |
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index 239afc7a9c0b..9915a09141ef 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c | |||
@@ -104,7 +104,7 @@ void rt2x00queue_map_txskb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb) | |||
104 | * is also mapped to the DMA so it can be used for transfering | 104 | * is also mapped to the DMA so it can be used for transfering |
105 | * additional descriptor information to the hardware. | 105 | * additional descriptor information to the hardware. |
106 | */ | 106 | */ |
107 | skb_push(skb, rt2x00dev->hw->extra_tx_headroom); | 107 | skb_push(skb, rt2x00dev->ops->extra_tx_headroom); |
108 | 108 | ||
109 | skbdesc->skb_dma = | 109 | skbdesc->skb_dma = |
110 | dma_map_single(rt2x00dev->dev, skb->data, skb->len, DMA_TO_DEVICE); | 110 | dma_map_single(rt2x00dev->dev, skb->data, skb->len, DMA_TO_DEVICE); |
@@ -112,7 +112,7 @@ void rt2x00queue_map_txskb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb) | |||
112 | /* | 112 | /* |
113 | * Restore data pointer to original location again. | 113 | * Restore data pointer to original location again. |
114 | */ | 114 | */ |
115 | skb_pull(skb, rt2x00dev->hw->extra_tx_headroom); | 115 | skb_pull(skb, rt2x00dev->ops->extra_tx_headroom); |
116 | 116 | ||
117 | skbdesc->flags |= SKBDESC_DMA_MAPPED_TX; | 117 | skbdesc->flags |= SKBDESC_DMA_MAPPED_TX; |
118 | } | 118 | } |
@@ -134,7 +134,7 @@ void rt2x00queue_unmap_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb) | |||
134 | * by the driver, but it was actually mapped to DMA. | 134 | * by the driver, but it was actually mapped to DMA. |
135 | */ | 135 | */ |
136 | dma_unmap_single(rt2x00dev->dev, skbdesc->skb_dma, | 136 | dma_unmap_single(rt2x00dev->dev, skbdesc->skb_dma, |
137 | skb->len + rt2x00dev->hw->extra_tx_headroom, | 137 | skb->len + rt2x00dev->ops->extra_tx_headroom, |
138 | DMA_TO_DEVICE); | 138 | DMA_TO_DEVICE); |
139 | skbdesc->flags &= ~SKBDESC_DMA_MAPPED_TX; | 139 | skbdesc->flags &= ~SKBDESC_DMA_MAPPED_TX; |
140 | } | 140 | } |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index 687e17dc2e9f..0ca589306d71 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -2539,6 +2539,11 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2539 | unsigned int i; | 2539 | unsigned int i; |
2540 | 2540 | ||
2541 | /* | 2541 | /* |
2542 | * Disable powersaving as default. | ||
2543 | */ | ||
2544 | rt2x00dev->hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | ||
2545 | |||
2546 | /* | ||
2542 | * Initialize all hw fields. | 2547 | * Initialize all hw fields. |
2543 | */ | 2548 | */ |
2544 | rt2x00dev->hw->flags = | 2549 | rt2x00dev->hw->flags = |
diff --git a/drivers/net/wireless/rtl818x/rtl8180_dev.c b/drivers/net/wireless/rtl818x/rtl8180_dev.c index a1a3dd15c664..8a40a1439984 100644 --- a/drivers/net/wireless/rtl818x/rtl8180_dev.c +++ b/drivers/net/wireless/rtl818x/rtl8180_dev.c | |||
@@ -132,7 +132,6 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev) | |||
132 | 132 | ||
133 | rx_status.antenna = (flags2 >> 15) & 1; | 133 | rx_status.antenna = (flags2 >> 15) & 1; |
134 | /* TODO: improve signal/rssi reporting */ | 134 | /* TODO: improve signal/rssi reporting */ |
135 | rx_status.qual = flags2 & 0xFF; | ||
136 | rx_status.signal = (flags2 >> 8) & 0x7F; | 135 | rx_status.signal = (flags2 >> 8) & 0x7F; |
137 | /* XXX: is this correct? */ | 136 | /* XXX: is this correct? */ |
138 | rx_status.rate_idx = (flags >> 20) & 0xF; | 137 | rx_status.rate_idx = (flags >> 20) & 0xF; |
diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c index bc5726dd5fe4..7ba3052b0708 100644 --- a/drivers/net/wireless/rtl818x/rtl8187_dev.c +++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c | |||
@@ -65,6 +65,7 @@ static struct usb_device_id rtl8187_table[] __devinitdata = { | |||
65 | /* Sitecom */ | 65 | /* Sitecom */ |
66 | {USB_DEVICE(0x0df6, 0x000d), .driver_info = DEVICE_RTL8187}, | 66 | {USB_DEVICE(0x0df6, 0x000d), .driver_info = DEVICE_RTL8187}, |
67 | {USB_DEVICE(0x0df6, 0x0028), .driver_info = DEVICE_RTL8187B}, | 67 | {USB_DEVICE(0x0df6, 0x0028), .driver_info = DEVICE_RTL8187B}, |
68 | {USB_DEVICE(0x0df6, 0x0029), .driver_info = DEVICE_RTL8187B}, | ||
68 | /* Sphairon Access Systems GmbH */ | 69 | /* Sphairon Access Systems GmbH */ |
69 | {USB_DEVICE(0x114B, 0x0150), .driver_info = DEVICE_RTL8187}, | 70 | {USB_DEVICE(0x114B, 0x0150), .driver_info = DEVICE_RTL8187}, |
70 | /* Dick Smith Electronics */ | 71 | /* Dick Smith Electronics */ |
diff --git a/drivers/net/wireless/wl12xx/wl1251_boot.c b/drivers/net/wireless/wl12xx/wl1251_boot.c index 2e733e7bdfd4..28a808674080 100644 --- a/drivers/net/wireless/wl12xx/wl1251_boot.c +++ b/drivers/net/wireless/wl12xx/wl1251_boot.c | |||
@@ -256,7 +256,7 @@ int wl1251_boot_run_firmware(struct wl1251 *wl) | |||
256 | } | 256 | } |
257 | } | 257 | } |
258 | 258 | ||
259 | if (loop >= INIT_LOOP) { | 259 | if (loop > INIT_LOOP) { |
260 | wl1251_error("timeout waiting for the hardware to " | 260 | wl1251_error("timeout waiting for the hardware to " |
261 | "complete initialization"); | 261 | "complete initialization"); |
262 | return -EIO; | 262 | return -EIO; |
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c index 886a9bc39cc1..c3385b3d246c 100644 --- a/drivers/net/wireless/wl12xx/wl1271_cmd.c +++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c | |||
@@ -777,7 +777,7 @@ out: | |||
777 | return ret; | 777 | return ret; |
778 | } | 778 | } |
779 | 779 | ||
780 | static int wl1271_build_basic_rates(char *rates, u8 band) | 780 | static int wl1271_build_basic_rates(u8 *rates, u8 band) |
781 | { | 781 | { |
782 | u8 index = 0; | 782 | u8 index = 0; |
783 | 783 | ||
@@ -804,7 +804,7 @@ static int wl1271_build_basic_rates(char *rates, u8 band) | |||
804 | return index; | 804 | return index; |
805 | } | 805 | } |
806 | 806 | ||
807 | static int wl1271_build_extended_rates(char *rates, u8 band) | 807 | static int wl1271_build_extended_rates(u8 *rates, u8 band) |
808 | { | 808 | { |
809 | u8 index = 0; | 809 | u8 index = 0; |
810 | 810 | ||
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c index dfa1b9bc22c8..7ca95c414fa8 100644 --- a/drivers/net/wireless/zd1211rw/zd_chip.c +++ b/drivers/net/wireless/zd1211rw/zd_chip.c | |||
@@ -1325,151 +1325,11 @@ int zd_chip_set_basic_rates(struct zd_chip *chip, u16 cr_rates) | |||
1325 | return r; | 1325 | return r; |
1326 | } | 1326 | } |
1327 | 1327 | ||
1328 | static int ofdm_qual_db(u8 status_quality, u8 zd_rate, unsigned int size) | ||
1329 | { | ||
1330 | static const u16 constants[] = { | ||
1331 | 715, 655, 585, 540, 470, 410, 360, 315, | ||
1332 | 270, 235, 205, 175, 150, 125, 105, 85, | ||
1333 | 65, 50, 40, 25, 15 | ||
1334 | }; | ||
1335 | |||
1336 | int i; | ||
1337 | u32 x; | ||
1338 | |||
1339 | /* It seems that their quality parameter is somehow per signal | ||
1340 | * and is now transferred per bit. | ||
1341 | */ | ||
1342 | switch (zd_rate) { | ||
1343 | case ZD_OFDM_RATE_6M: | ||
1344 | case ZD_OFDM_RATE_12M: | ||
1345 | case ZD_OFDM_RATE_24M: | ||
1346 | size *= 2; | ||
1347 | break; | ||
1348 | case ZD_OFDM_RATE_9M: | ||
1349 | case ZD_OFDM_RATE_18M: | ||
1350 | case ZD_OFDM_RATE_36M: | ||
1351 | case ZD_OFDM_RATE_54M: | ||
1352 | size *= 4; | ||
1353 | size /= 3; | ||
1354 | break; | ||
1355 | case ZD_OFDM_RATE_48M: | ||
1356 | size *= 3; | ||
1357 | size /= 2; | ||
1358 | break; | ||
1359 | default: | ||
1360 | return -EINVAL; | ||
1361 | } | ||
1362 | |||
1363 | x = (10000 * status_quality)/size; | ||
1364 | for (i = 0; i < ARRAY_SIZE(constants); i++) { | ||
1365 | if (x > constants[i]) | ||
1366 | break; | ||
1367 | } | ||
1368 | |||
1369 | switch (zd_rate) { | ||
1370 | case ZD_OFDM_RATE_6M: | ||
1371 | case ZD_OFDM_RATE_9M: | ||
1372 | i += 3; | ||
1373 | break; | ||
1374 | case ZD_OFDM_RATE_12M: | ||
1375 | case ZD_OFDM_RATE_18M: | ||
1376 | i += 5; | ||
1377 | break; | ||
1378 | case ZD_OFDM_RATE_24M: | ||
1379 | case ZD_OFDM_RATE_36M: | ||
1380 | i += 9; | ||
1381 | break; | ||
1382 | case ZD_OFDM_RATE_48M: | ||
1383 | case ZD_OFDM_RATE_54M: | ||
1384 | i += 15; | ||
1385 | break; | ||
1386 | default: | ||
1387 | return -EINVAL; | ||
1388 | } | ||
1389 | |||
1390 | return i; | ||
1391 | } | ||
1392 | |||
1393 | static int ofdm_qual_percent(u8 status_quality, u8 zd_rate, unsigned int size) | ||
1394 | { | ||
1395 | int r; | ||
1396 | |||
1397 | r = ofdm_qual_db(status_quality, zd_rate, size); | ||
1398 | ZD_ASSERT(r >= 0); | ||
1399 | if (r < 0) | ||
1400 | r = 0; | ||
1401 | |||
1402 | r = (r * 100)/29; | ||
1403 | return r <= 100 ? r : 100; | ||
1404 | } | ||
1405 | |||
1406 | static unsigned int log10times100(unsigned int x) | ||
1407 | { | ||
1408 | static const u8 log10[] = { | ||
1409 | 0, | ||
1410 | 0, 30, 47, 60, 69, 77, 84, 90, 95, 100, | ||
1411 | 104, 107, 111, 114, 117, 120, 123, 125, 127, 130, | ||
1412 | 132, 134, 136, 138, 139, 141, 143, 144, 146, 147, | ||
1413 | 149, 150, 151, 153, 154, 155, 156, 157, 159, 160, | ||
1414 | 161, 162, 163, 164, 165, 166, 167, 168, 169, 169, | ||
1415 | 170, 171, 172, 173, 174, 174, 175, 176, 177, 177, | ||
1416 | 178, 179, 179, 180, 181, 181, 182, 183, 183, 184, | ||
1417 | 185, 185, 186, 186, 187, 188, 188, 189, 189, 190, | ||
1418 | 190, 191, 191, 192, 192, 193, 193, 194, 194, 195, | ||
1419 | 195, 196, 196, 197, 197, 198, 198, 199, 199, 200, | ||
1420 | 200, 200, 201, 201, 202, 202, 202, 203, 203, 204, | ||
1421 | 204, 204, 205, 205, 206, 206, 206, 207, 207, 207, | ||
1422 | 208, 208, 208, 209, 209, 210, 210, 210, 211, 211, | ||
1423 | 211, 212, 212, 212, 213, 213, 213, 213, 214, 214, | ||
1424 | 214, 215, 215, 215, 216, 216, 216, 217, 217, 217, | ||
1425 | 217, 218, 218, 218, 219, 219, 219, 219, 220, 220, | ||
1426 | 220, 220, 221, 221, 221, 222, 222, 222, 222, 223, | ||
1427 | 223, 223, 223, 224, 224, 224, 224, | ||
1428 | }; | ||
1429 | |||
1430 | return x < ARRAY_SIZE(log10) ? log10[x] : 225; | ||
1431 | } | ||
1432 | |||
1433 | enum { | ||
1434 | MAX_CCK_EVM_DB = 45, | ||
1435 | }; | ||
1436 | |||
1437 | static int cck_evm_db(u8 status_quality) | ||
1438 | { | ||
1439 | return (20 * log10times100(status_quality)) / 100; | ||
1440 | } | ||
1441 | |||
1442 | static int cck_snr_db(u8 status_quality) | ||
1443 | { | ||
1444 | int r = MAX_CCK_EVM_DB - cck_evm_db(status_quality); | ||
1445 | ZD_ASSERT(r >= 0); | ||
1446 | return r; | ||
1447 | } | ||
1448 | |||
1449 | static int cck_qual_percent(u8 status_quality) | ||
1450 | { | ||
1451 | int r; | ||
1452 | |||
1453 | r = cck_snr_db(status_quality); | ||
1454 | r = (100*r)/17; | ||
1455 | return r <= 100 ? r : 100; | ||
1456 | } | ||
1457 | |||
1458 | static inline u8 zd_rate_from_ofdm_plcp_header(const void *rx_frame) | 1328 | static inline u8 zd_rate_from_ofdm_plcp_header(const void *rx_frame) |
1459 | { | 1329 | { |
1460 | return ZD_OFDM | zd_ofdm_plcp_header_rate(rx_frame); | 1330 | return ZD_OFDM | zd_ofdm_plcp_header_rate(rx_frame); |
1461 | } | 1331 | } |
1462 | 1332 | ||
1463 | u8 zd_rx_qual_percent(const void *rx_frame, unsigned int size, | ||
1464 | const struct rx_status *status) | ||
1465 | { | ||
1466 | return (status->frame_status&ZD_RX_OFDM) ? | ||
1467 | ofdm_qual_percent(status->signal_quality_ofdm, | ||
1468 | zd_rate_from_ofdm_plcp_header(rx_frame), | ||
1469 | size) : | ||
1470 | cck_qual_percent(status->signal_quality_cck); | ||
1471 | } | ||
1472 | |||
1473 | /** | 1333 | /** |
1474 | * zd_rx_rate - report zd-rate | 1334 | * zd_rx_rate - report zd-rate |
1475 | * @rx_frame - received frame | 1335 | * @rx_frame - received frame |
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.h b/drivers/net/wireless/zd1211rw/zd_chip.h index 9fd8f3508d66..f8bbf7d302ae 100644 --- a/drivers/net/wireless/zd1211rw/zd_chip.h +++ b/drivers/net/wireless/zd1211rw/zd_chip.h | |||
@@ -929,9 +929,6 @@ static inline int zd_get_beacon_interval(struct zd_chip *chip, u32 *interval) | |||
929 | 929 | ||
930 | struct rx_status; | 930 | struct rx_status; |
931 | 931 | ||
932 | u8 zd_rx_qual_percent(const void *rx_frame, unsigned int size, | ||
933 | const struct rx_status *status); | ||
934 | |||
935 | u8 zd_rx_rate(const void *rx_frame, const struct rx_status *status); | 932 | u8 zd_rx_rate(const void *rx_frame, const struct rx_status *status); |
936 | 933 | ||
937 | struct zd_mc_hash { | 934 | struct zd_mc_hash { |
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index cf51e8f8174b..f14deb0c8514 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zd1211rw/zd_mac.c | |||
@@ -828,9 +828,6 @@ int zd_mac_rx(struct ieee80211_hw *hw, const u8 *buffer, unsigned int length) | |||
828 | stats.freq = zd_channels[_zd_chip_get_channel(&mac->chip) - 1].center_freq; | 828 | stats.freq = zd_channels[_zd_chip_get_channel(&mac->chip) - 1].center_freq; |
829 | stats.band = IEEE80211_BAND_2GHZ; | 829 | stats.band = IEEE80211_BAND_2GHZ; |
830 | stats.signal = status->signal_strength; | 830 | stats.signal = status->signal_strength; |
831 | stats.qual = zd_rx_qual_percent(buffer, | ||
832 | length - sizeof(struct rx_status), | ||
833 | status); | ||
834 | 831 | ||
835 | rate = zd_rx_rate(buffer, status); | 832 | rate = zd_rx_rate(buffer, status); |
836 | 833 | ||
@@ -990,12 +987,13 @@ static void zd_op_configure_filter(struct ieee80211_hw *hw, | |||
990 | changed_flags &= SUPPORTED_FIF_FLAGS; | 987 | changed_flags &= SUPPORTED_FIF_FLAGS; |
991 | *new_flags &= SUPPORTED_FIF_FLAGS; | 988 | *new_flags &= SUPPORTED_FIF_FLAGS; |
992 | 989 | ||
993 | /* changed_flags is always populated but this driver | 990 | /* |
994 | * doesn't support all FIF flags so its possible we don't | 991 | * If multicast parameter (as returned by zd_op_prepare_multicast) |
995 | * need to do anything */ | 992 | * has changed, no bit in changed_flags is set. To handle this |
996 | if (!changed_flags) | 993 | * situation, we do not return if changed_flags is 0. If we do so, |
997 | return; | 994 | * we will have some issue with IPv6 which uses multicast for link |
998 | 995 | * layer address resolution. | |
996 | */ | ||
999 | if (*new_flags & (FIF_PROMISC_IN_BSS | FIF_ALLMULTI)) | 997 | if (*new_flags & (FIF_PROMISC_IN_BSS | FIF_ALLMULTI)) |
1000 | zd_mc_add_all(&hash); | 998 | zd_mc_add_all(&hash); |
1001 | 999 | ||
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c index ac19ecd19cfe..72d3e437e190 100644 --- a/drivers/net/wireless/zd1211rw/zd_usb.c +++ b/drivers/net/wireless/zd1211rw/zd_usb.c | |||
@@ -62,6 +62,7 @@ static struct usb_device_id usb_ids[] = { | |||
62 | { USB_DEVICE(0x6891, 0xa727), .driver_info = DEVICE_ZD1211 }, | 62 | { USB_DEVICE(0x6891, 0xa727), .driver_info = DEVICE_ZD1211 }, |
63 | /* ZD1211B */ | 63 | /* ZD1211B */ |
64 | { USB_DEVICE(0x0053, 0x5301), .driver_info = DEVICE_ZD1211B }, | 64 | { USB_DEVICE(0x0053, 0x5301), .driver_info = DEVICE_ZD1211B }, |
65 | { USB_DEVICE(0x0409, 0x0248), .driver_info = DEVICE_ZD1211B }, | ||
65 | { USB_DEVICE(0x0411, 0x00da), .driver_info = DEVICE_ZD1211B }, | 66 | { USB_DEVICE(0x0411, 0x00da), .driver_info = DEVICE_ZD1211B }, |
66 | { USB_DEVICE(0x0471, 0x1236), .driver_info = DEVICE_ZD1211B }, | 67 | { USB_DEVICE(0x0471, 0x1236), .driver_info = DEVICE_ZD1211B }, |
67 | { USB_DEVICE(0x0471, 0x1237), .driver_info = DEVICE_ZD1211B }, | 68 | { USB_DEVICE(0x0471, 0x1237), .driver_info = DEVICE_ZD1211B }, |