diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-03-01 02:55:20 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-03-01 02:55:20 -0500 |
commit | 35858adbfca13678af99fb31618ef4428d6dedb0 (patch) | |
tree | 3336feaa61324486945816cb52c347733e7c0821 /drivers/net | |
parent | 197d4db752e67160d79fed09968c2140376a80a3 (diff) | |
parent | 4b70858ba8d4537daf782defebe5f2ff80ccef2b (diff) |
Merge branch 'next' into for-linus
Diffstat (limited to 'drivers/net')
183 files changed, 3474 insertions, 2103 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/3c59x.c b/drivers/net/3c59x.c index 78b7167a8ce3..39db0e96815d 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c | |||
@@ -837,7 +837,7 @@ static int vortex_resume(struct device *dev) | |||
837 | return 0; | 837 | return 0; |
838 | } | 838 | } |
839 | 839 | ||
840 | static struct dev_pm_ops vortex_pm_ops = { | 840 | static const struct dev_pm_ops vortex_pm_ops = { |
841 | .suspend = vortex_suspend, | 841 | .suspend = vortex_suspend, |
842 | .resume = vortex_resume, | 842 | .resume = vortex_resume, |
843 | .freeze = vortex_suspend, | 843 | .freeze = vortex_suspend, |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index a5be9ac6405c..dd9a09c72dff 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -1953,6 +1953,8 @@ config BCM63XX_ENET | |||
1953 | 1953 | ||
1954 | source "drivers/net/fs_enet/Kconfig" | 1954 | source "drivers/net/fs_enet/Kconfig" |
1955 | 1955 | ||
1956 | source "drivers/net/octeon/Kconfig" | ||
1957 | |||
1956 | endif # NET_ETHERNET | 1958 | endif # NET_ETHERNET |
1957 | 1959 | ||
1958 | # | 1960 | # |
@@ -2344,6 +2346,7 @@ config GELIC_NET | |||
2344 | 2346 | ||
2345 | config GELIC_WIRELESS | 2347 | config GELIC_WIRELESS |
2346 | bool "PS3 Wireless support" | 2348 | bool "PS3 Wireless support" |
2349 | depends on WLAN | ||
2347 | depends on GELIC_NET | 2350 | depends on GELIC_NET |
2348 | select WIRELESS_EXT | 2351 | select WIRELESS_EXT |
2349 | help | 2352 | help |
@@ -2356,6 +2359,7 @@ config GELIC_WIRELESS | |||
2356 | config GELIC_WIRELESS_OLD_PSK_INTERFACE | 2359 | config GELIC_WIRELESS_OLD_PSK_INTERFACE |
2357 | bool "PS3 Wireless private PSK interface (OBSOLETE)" | 2360 | bool "PS3 Wireless private PSK interface (OBSOLETE)" |
2358 | depends on GELIC_WIRELESS | 2361 | depends on GELIC_WIRELESS |
2362 | select WEXT_PRIV | ||
2359 | help | 2363 | help |
2360 | This option retains the obsolete private interface to pass | 2364 | This option retains the obsolete private interface to pass |
2361 | 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/Makefile b/drivers/net/Makefile index 246323d7f161..ad1346dd9da9 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile | |||
@@ -285,3 +285,5 @@ obj-$(CONFIG_VIRTIO_NET) += virtio_net.o | |||
285 | obj-$(CONFIG_SFC) += sfc/ | 285 | obj-$(CONFIG_SFC) += sfc/ |
286 | 286 | ||
287 | obj-$(CONFIG_WIMAX) += wimax/ | 287 | obj-$(CONFIG_WIMAX) += wimax/ |
288 | |||
289 | obj-$(CONFIG_OCTEON_MGMT_ETHERNET) += octeon/ | ||
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/bcm63xx_enet.c b/drivers/net/bcm63xx_enet.c index 1f6c5486d715..0bd47d32ec42 100644 --- a/drivers/net/bcm63xx_enet.c +++ b/drivers/net/bcm63xx_enet.c | |||
@@ -1245,9 +1245,15 @@ static void bcm_enet_get_drvinfo(struct net_device *netdev, | |||
1245 | drvinfo->n_stats = BCM_ENET_STATS_LEN; | 1245 | drvinfo->n_stats = BCM_ENET_STATS_LEN; |
1246 | } | 1246 | } |
1247 | 1247 | ||
1248 | static int bcm_enet_get_stats_count(struct net_device *netdev) | 1248 | static int bcm_enet_get_sset_count(struct net_device *netdev, |
1249 | int string_set) | ||
1249 | { | 1250 | { |
1250 | return BCM_ENET_STATS_LEN; | 1251 | switch (string_set) { |
1252 | case ETH_SS_STATS: | ||
1253 | return BCM_ENET_STATS_LEN; | ||
1254 | default: | ||
1255 | return -EINVAL; | ||
1256 | } | ||
1251 | } | 1257 | } |
1252 | 1258 | ||
1253 | static void bcm_enet_get_strings(struct net_device *netdev, | 1259 | static void bcm_enet_get_strings(struct net_device *netdev, |
@@ -1473,7 +1479,7 @@ static int bcm_enet_set_pauseparam(struct net_device *dev, | |||
1473 | 1479 | ||
1474 | static struct ethtool_ops bcm_enet_ethtool_ops = { | 1480 | static struct ethtool_ops bcm_enet_ethtool_ops = { |
1475 | .get_strings = bcm_enet_get_strings, | 1481 | .get_strings = bcm_enet_get_strings, |
1476 | .get_stats_count = bcm_enet_get_stats_count, | 1482 | .get_sset_count = bcm_enet_get_sset_count, |
1477 | .get_ethtool_stats = bcm_enet_get_ethtool_stats, | 1483 | .get_ethtool_stats = bcm_enet_get_ethtool_stats, |
1478 | .get_settings = bcm_enet_get_settings, | 1484 | .get_settings = bcm_enet_get_settings, |
1479 | .set_settings = bcm_enet_set_settings, | 1485 | .set_settings = bcm_enet_set_settings, |
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h index 9e56014d27ed..9fd8e5ecd5d7 100644 --- a/drivers/net/benet/be.h +++ b/drivers/net/benet/be.h | |||
@@ -275,6 +275,7 @@ 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; | ||
278 | }; | 279 | }; |
279 | 280 | ||
280 | extern const struct ethtool_ops be_ethtool_ops; | 281 | extern const struct ethtool_ops be_ethtool_ops; |
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index 1b68bd98dc0c..102ade134165 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c | |||
@@ -1479,6 +1479,41 @@ err: | |||
1479 | return status; | 1479 | return status; |
1480 | } | 1480 | } |
1481 | 1481 | ||
1482 | int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num, | ||
1483 | u8 loopback_type, u8 enable) | ||
1484 | { | ||
1485 | struct be_mcc_wrb *wrb; | ||
1486 | struct be_cmd_req_set_lmode *req; | ||
1487 | int status; | ||
1488 | |||
1489 | spin_lock_bh(&adapter->mcc_lock); | ||
1490 | |||
1491 | wrb = wrb_from_mccq(adapter); | ||
1492 | if (!wrb) { | ||
1493 | status = -EBUSY; | ||
1494 | goto err; | ||
1495 | } | ||
1496 | |||
1497 | req = embedded_payload(wrb); | ||
1498 | |||
1499 | be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0, | ||
1500 | OPCODE_LOWLEVEL_SET_LOOPBACK_MODE); | ||
1501 | |||
1502 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL, | ||
1503 | OPCODE_LOWLEVEL_SET_LOOPBACK_MODE, | ||
1504 | sizeof(*req)); | ||
1505 | |||
1506 | req->src_port = port_num; | ||
1507 | req->dest_port = port_num; | ||
1508 | req->loopback_type = loopback_type; | ||
1509 | req->loopback_state = enable; | ||
1510 | |||
1511 | status = be_mcc_notify_wait(adapter); | ||
1512 | err: | ||
1513 | spin_unlock_bh(&adapter->mcc_lock); | ||
1514 | return status; | ||
1515 | } | ||
1516 | |||
1482 | int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, | 1517 | int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, |
1483 | u32 loopback_type, u32 pkt_size, u32 num_pkts, u64 pattern) | 1518 | u32 loopback_type, u32 pkt_size, u32 num_pkts, u64 pattern) |
1484 | { | 1519 | { |
@@ -1501,6 +1536,7 @@ int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, | |||
1501 | 1536 | ||
1502 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL, | 1537 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL, |
1503 | OPCODE_LOWLEVEL_LOOPBACK_TEST, sizeof(*req)); | 1538 | OPCODE_LOWLEVEL_LOOPBACK_TEST, sizeof(*req)); |
1539 | req->hdr.timeout = 4; | ||
1504 | 1540 | ||
1505 | req->pattern = cpu_to_le64(pattern); | 1541 | req->pattern = cpu_to_le64(pattern); |
1506 | req->src_port = cpu_to_le32(port_num); | 1542 | 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..c002b8391b4d 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 */ |
@@ -821,6 +822,19 @@ struct be_cmd_resp_loopback_test { | |||
821 | u32 ticks_compl; | 822 | u32 ticks_compl; |
822 | }; | 823 | }; |
823 | 824 | ||
825 | struct be_cmd_req_set_lmode { | ||
826 | struct be_cmd_req_hdr hdr; | ||
827 | u8 src_port; | ||
828 | u8 dest_port; | ||
829 | u8 loopback_type; | ||
830 | u8 loopback_state; | ||
831 | }; | ||
832 | |||
833 | struct be_cmd_resp_set_lmode { | ||
834 | struct be_cmd_resp_hdr resp_hdr; | ||
835 | u8 rsvd0[4]; | ||
836 | }; | ||
837 | |||
824 | /********************** DDR DMA test *********************/ | 838 | /********************** DDR DMA test *********************/ |
825 | struct be_cmd_req_ddrdma_test { | 839 | struct be_cmd_req_ddrdma_test { |
826 | struct be_cmd_req_hdr hdr; | 840 | struct be_cmd_req_hdr hdr; |
@@ -912,3 +926,5 @@ extern int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, | |||
912 | u32 num_pkts, u64 pattern); | 926 | u32 num_pkts, u64 pattern); |
913 | extern int be_cmd_ddr_dma_test(struct be_adapter *adapter, u64 pattern, | 927 | extern int be_cmd_ddr_dma_test(struct be_adapter *adapter, u64 pattern, |
914 | u32 byte_cnt, struct be_dma_mem *cmd); | 928 | u32 byte_cnt, struct be_dma_mem *cmd); |
929 | extern int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num, | ||
930 | 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/bnx2.c b/drivers/net/bnx2.c index 4bfc80812926..65df1de447e4 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -653,12 +653,20 @@ static void | |||
653 | bnx2_netif_stop(struct bnx2 *bp) | 653 | bnx2_netif_stop(struct bnx2 *bp) |
654 | { | 654 | { |
655 | bnx2_cnic_stop(bp); | 655 | bnx2_cnic_stop(bp); |
656 | bnx2_disable_int_sync(bp); | ||
657 | if (netif_running(bp->dev)) { | 656 | if (netif_running(bp->dev)) { |
657 | int i; | ||
658 | |||
658 | bnx2_napi_disable(bp); | 659 | bnx2_napi_disable(bp); |
659 | netif_tx_disable(bp->dev); | 660 | netif_tx_disable(bp->dev); |
660 | bp->dev->trans_start = jiffies; /* prevent tx timeout */ | 661 | /* prevent tx timeout */ |
662 | for (i = 0; i < bp->dev->num_tx_queues; i++) { | ||
663 | struct netdev_queue *txq; | ||
664 | |||
665 | txq = netdev_get_tx_queue(bp->dev, i); | ||
666 | txq->trans_start = jiffies; | ||
667 | } | ||
661 | } | 668 | } |
669 | bnx2_disable_int_sync(bp); | ||
662 | } | 670 | } |
663 | 671 | ||
664 | static void | 672 | static void |
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 d69e6838f21e..822f586d72af 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c | |||
@@ -20,6 +20,8 @@ | |||
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
24 | |||
23 | #include <linux/skbuff.h> | 25 | #include <linux/skbuff.h> |
24 | #include <linux/if_ether.h> | 26 | #include <linux/if_ether.h> |
25 | #include <linux/netdevice.h> | 27 | #include <linux/netdevice.h> |
@@ -352,7 +354,8 @@ static u16 __get_link_speed(struct port *port) | |||
352 | } | 354 | } |
353 | } | 355 | } |
354 | 356 | ||
355 | pr_debug("Port %d Received link speed %d update from adapter\n", port->actor_port_number, speed); | 357 | pr_debug("Port %d Received link speed %d update from adapter\n", |
358 | port->actor_port_number, speed); | ||
356 | return speed; | 359 | return speed; |
357 | } | 360 | } |
358 | 361 | ||
@@ -378,12 +381,14 @@ static u8 __get_duplex(struct port *port) | |||
378 | switch (slave->duplex) { | 381 | switch (slave->duplex) { |
379 | case DUPLEX_FULL: | 382 | case DUPLEX_FULL: |
380 | retval=0x1; | 383 | retval=0x1; |
381 | pr_debug("Port %d Received status full duplex update from adapter\n", port->actor_port_number); | 384 | pr_debug("Port %d Received status full duplex update from adapter\n", |
385 | port->actor_port_number); | ||
382 | break; | 386 | break; |
383 | case DUPLEX_HALF: | 387 | case DUPLEX_HALF: |
384 | default: | 388 | default: |
385 | retval=0x0; | 389 | retval=0x0; |
386 | pr_debug("Port %d Received status NOT full duplex update from adapter\n", port->actor_port_number); | 390 | pr_debug("Port %d Received status NOT full duplex update from adapter\n", |
391 | port->actor_port_number); | ||
387 | break; | 392 | break; |
388 | } | 393 | } |
389 | } | 394 | } |
@@ -980,7 +985,9 @@ static void ad_mux_machine(struct port *port) | |||
980 | 985 | ||
981 | // check if the state machine was changed | 986 | // check if the state machine was changed |
982 | if (port->sm_mux_state != last_state) { | 987 | if (port->sm_mux_state != last_state) { |
983 | pr_debug("Mux Machine: Port=%d, Last State=%d, Curr State=%d\n", port->actor_port_number, last_state, port->sm_mux_state); | 988 | pr_debug("Mux Machine: Port=%d, Last State=%d, Curr State=%d\n", |
989 | port->actor_port_number, last_state, | ||
990 | port->sm_mux_state); | ||
984 | switch (port->sm_mux_state) { | 991 | switch (port->sm_mux_state) { |
985 | case AD_MUX_DETACHED: | 992 | case AD_MUX_DETACHED: |
986 | __detach_bond_from_agg(port); | 993 | __detach_bond_from_agg(port); |
@@ -1079,7 +1086,9 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port) | |||
1079 | 1086 | ||
1080 | // check if the State machine was changed or new lacpdu arrived | 1087 | // check if the State machine was changed or new lacpdu arrived |
1081 | if ((port->sm_rx_state != last_state) || (lacpdu)) { | 1088 | if ((port->sm_rx_state != last_state) || (lacpdu)) { |
1082 | pr_debug("Rx Machine: Port=%d, Last State=%d, Curr State=%d\n", port->actor_port_number, last_state, port->sm_rx_state); | 1089 | pr_debug("Rx Machine: Port=%d, Last State=%d, Curr State=%d\n", |
1090 | port->actor_port_number, last_state, | ||
1091 | port->sm_rx_state); | ||
1083 | switch (port->sm_rx_state) { | 1092 | switch (port->sm_rx_state) { |
1084 | case AD_RX_INITIALIZE: | 1093 | case AD_RX_INITIALIZE: |
1085 | if (!(port->actor_oper_port_key & AD_DUPLEX_KEY_BITS)) { | 1094 | if (!(port->actor_oper_port_key & AD_DUPLEX_KEY_BITS)) { |
@@ -1126,9 +1135,8 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port) | |||
1126 | // detect loopback situation | 1135 | // detect loopback situation |
1127 | if (!MAC_ADDRESS_COMPARE(&(lacpdu->actor_system), &(port->actor_system))) { | 1136 | if (!MAC_ADDRESS_COMPARE(&(lacpdu->actor_system), &(port->actor_system))) { |
1128 | // INFO_RECEIVED_LOOPBACK_FRAMES | 1137 | // INFO_RECEIVED_LOOPBACK_FRAMES |
1129 | pr_err(DRV_NAME ": %s: An illegal loopback occurred on " | 1138 | pr_err("%s: An illegal loopback occurred on adapter (%s).\n" |
1130 | "adapter (%s). Check the configuration to verify that all " | 1139 | "Check the configuration to verify that all adapters are connected to 802.3ad compliant switch ports\n", |
1131 | "Adapters are connected to 802.3ad compliant switch ports\n", | ||
1132 | port->slave->dev->master->name, port->slave->dev->name); | 1140 | port->slave->dev->master->name, port->slave->dev->name); |
1133 | __release_rx_machine_lock(port); | 1141 | __release_rx_machine_lock(port); |
1134 | return; | 1142 | return; |
@@ -1166,7 +1174,8 @@ static void ad_tx_machine(struct port *port) | |||
1166 | __update_lacpdu_from_port(port); | 1174 | __update_lacpdu_from_port(port); |
1167 | 1175 | ||
1168 | if (ad_lacpdu_send(port) >= 0) { | 1176 | if (ad_lacpdu_send(port) >= 0) { |
1169 | pr_debug("Sent LACPDU on port %d\n", port->actor_port_number); | 1177 | pr_debug("Sent LACPDU on port %d\n", |
1178 | port->actor_port_number); | ||
1170 | 1179 | ||
1171 | /* mark ntt as false, so it will not be sent again until | 1180 | /* mark ntt as false, so it will not be sent again until |
1172 | demanded */ | 1181 | demanded */ |
@@ -1241,7 +1250,9 @@ static void ad_periodic_machine(struct port *port) | |||
1241 | 1250 | ||
1242 | // check if the state machine was changed | 1251 | // check if the state machine was changed |
1243 | if (port->sm_periodic_state != last_state) { | 1252 | if (port->sm_periodic_state != last_state) { |
1244 | pr_debug("Periodic Machine: Port=%d, Last State=%d, Curr State=%d\n", port->actor_port_number, last_state, port->sm_periodic_state); | 1253 | pr_debug("Periodic Machine: Port=%d, Last State=%d, Curr State=%d\n", |
1254 | port->actor_port_number, last_state, | ||
1255 | port->sm_periodic_state); | ||
1245 | switch (port->sm_periodic_state) { | 1256 | switch (port->sm_periodic_state) { |
1246 | case AD_NO_PERIODIC: | 1257 | case AD_NO_PERIODIC: |
1247 | port->sm_periodic_timer_counter = 0; // zero timer | 1258 | port->sm_periodic_timer_counter = 0; // zero timer |
@@ -1298,7 +1309,9 @@ static void ad_port_selection_logic(struct port *port) | |||
1298 | port->next_port_in_aggregator=NULL; | 1309 | port->next_port_in_aggregator=NULL; |
1299 | port->actor_port_aggregator_identifier=0; | 1310 | port->actor_port_aggregator_identifier=0; |
1300 | 1311 | ||
1301 | pr_debug("Port %d left LAG %d\n", port->actor_port_number, temp_aggregator->aggregator_identifier); | 1312 | pr_debug("Port %d left LAG %d\n", |
1313 | port->actor_port_number, | ||
1314 | temp_aggregator->aggregator_identifier); | ||
1302 | // if the aggregator is empty, clear its parameters, and set it ready to be attached | 1315 | // if the aggregator is empty, clear its parameters, and set it ready to be attached |
1303 | if (!temp_aggregator->lag_ports) { | 1316 | if (!temp_aggregator->lag_ports) { |
1304 | ad_clear_agg(temp_aggregator); | 1317 | ad_clear_agg(temp_aggregator); |
@@ -1307,9 +1320,7 @@ static void ad_port_selection_logic(struct port *port) | |||
1307 | } | 1320 | } |
1308 | } | 1321 | } |
1309 | if (!curr_port) { // meaning: the port was related to an aggregator but was not on the aggregator port list | 1322 | if (!curr_port) { // meaning: the port was related to an aggregator but was not on the aggregator port list |
1310 | pr_warning(DRV_NAME ": %s: Warning: Port %d (on %s) " | 1323 | pr_warning("%s: Warning: Port %d (on %s) was related to aggregator %d but was not on its port list\n", |
1311 | "was related to aggregator %d but was not " | ||
1312 | "on its port list\n", | ||
1313 | port->slave->dev->master->name, | 1324 | port->slave->dev->master->name, |
1314 | port->actor_port_number, | 1325 | port->actor_port_number, |
1315 | port->slave->dev->name, | 1326 | port->slave->dev->name, |
@@ -1343,7 +1354,9 @@ static void ad_port_selection_logic(struct port *port) | |||
1343 | port->next_port_in_aggregator=aggregator->lag_ports; | 1354 | port->next_port_in_aggregator=aggregator->lag_ports; |
1344 | port->aggregator->num_of_ports++; | 1355 | port->aggregator->num_of_ports++; |
1345 | aggregator->lag_ports=port; | 1356 | aggregator->lag_ports=port; |
1346 | pr_debug("Port %d joined LAG %d(existing LAG)\n", port->actor_port_number, port->aggregator->aggregator_identifier); | 1357 | pr_debug("Port %d joined LAG %d(existing LAG)\n", |
1358 | port->actor_port_number, | ||
1359 | port->aggregator->aggregator_identifier); | ||
1347 | 1360 | ||
1348 | // mark this port as selected | 1361 | // mark this port as selected |
1349 | port->sm_vars |= AD_PORT_SELECTED; | 1362 | port->sm_vars |= AD_PORT_SELECTED; |
@@ -1380,10 +1393,11 @@ static void ad_port_selection_logic(struct port *port) | |||
1380 | // mark this port as selected | 1393 | // mark this port as selected |
1381 | port->sm_vars |= AD_PORT_SELECTED; | 1394 | port->sm_vars |= AD_PORT_SELECTED; |
1382 | 1395 | ||
1383 | pr_debug("Port %d joined LAG %d(new LAG)\n", port->actor_port_number, port->aggregator->aggregator_identifier); | 1396 | pr_debug("Port %d joined LAG %d(new LAG)\n", |
1397 | port->actor_port_number, | ||
1398 | port->aggregator->aggregator_identifier); | ||
1384 | } else { | 1399 | } else { |
1385 | pr_err(DRV_NAME ": %s: Port %d (on %s) did not find " | 1400 | pr_err("%s: Port %d (on %s) did not find a suitable aggregator\n", |
1386 | "a suitable aggregator\n", | ||
1387 | port->slave->dev->master->name, | 1401 | port->slave->dev->master->name, |
1388 | port->actor_port_number, port->slave->dev->name); | 1402 | port->actor_port_number, port->slave->dev->name); |
1389 | } | 1403 | } |
@@ -1460,8 +1474,7 @@ static struct aggregator *ad_agg_selection_test(struct aggregator *best, | |||
1460 | break; | 1474 | break; |
1461 | 1475 | ||
1462 | default: | 1476 | default: |
1463 | pr_warning(DRV_NAME | 1477 | pr_warning("%s: Impossible agg select mode %d\n", |
1464 | ": %s: Impossible agg select mode %d\n", | ||
1465 | curr->slave->dev->master->name, | 1478 | curr->slave->dev->master->name, |
1466 | __get_agg_selection_mode(curr->lag_ports)); | 1479 | __get_agg_selection_mode(curr->lag_ports)); |
1467 | break; | 1480 | break; |
@@ -1546,40 +1559,38 @@ static void ad_agg_selection_logic(struct aggregator *agg) | |||
1546 | // if there is new best aggregator, activate it | 1559 | // if there is new best aggregator, activate it |
1547 | if (best) { | 1560 | if (best) { |
1548 | pr_debug("best Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n", | 1561 | pr_debug("best Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n", |
1549 | best->aggregator_identifier, best->num_of_ports, | 1562 | best->aggregator_identifier, best->num_of_ports, |
1550 | best->actor_oper_aggregator_key, | 1563 | best->actor_oper_aggregator_key, |
1551 | best->partner_oper_aggregator_key, | 1564 | best->partner_oper_aggregator_key, |
1552 | best->is_individual, best->is_active); | 1565 | best->is_individual, best->is_active); |
1553 | pr_debug("best ports %p slave %p %s\n", | 1566 | pr_debug("best ports %p slave %p %s\n", |
1554 | best->lag_ports, best->slave, | 1567 | best->lag_ports, best->slave, |
1555 | best->slave ? best->slave->dev->name : "NULL"); | 1568 | best->slave ? best->slave->dev->name : "NULL"); |
1556 | 1569 | ||
1557 | for (agg = __get_first_agg(best->lag_ports); agg; | 1570 | for (agg = __get_first_agg(best->lag_ports); agg; |
1558 | agg = __get_next_agg(agg)) { | 1571 | agg = __get_next_agg(agg)) { |
1559 | 1572 | ||
1560 | pr_debug("Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n", | 1573 | pr_debug("Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n", |
1561 | agg->aggregator_identifier, agg->num_of_ports, | 1574 | agg->aggregator_identifier, agg->num_of_ports, |
1562 | agg->actor_oper_aggregator_key, | 1575 | agg->actor_oper_aggregator_key, |
1563 | agg->partner_oper_aggregator_key, | 1576 | agg->partner_oper_aggregator_key, |
1564 | agg->is_individual, agg->is_active); | 1577 | agg->is_individual, agg->is_active); |
1565 | } | 1578 | } |
1566 | 1579 | ||
1567 | // check if any partner replys | 1580 | // check if any partner replys |
1568 | if (best->is_individual) { | 1581 | if (best->is_individual) { |
1569 | pr_warning(DRV_NAME ": %s: Warning: No 802.3ad" | 1582 | pr_warning("%s: Warning: No 802.3ad response from the link partner for any adapters in the bond\n", |
1570 | " response from the link partner for any" | 1583 | best->slave ? best->slave->dev->master->name : "NULL"); |
1571 | " adapters in the bond\n", | ||
1572 | best->slave->dev->master->name); | ||
1573 | } | 1584 | } |
1574 | 1585 | ||
1575 | best->is_active = 1; | 1586 | best->is_active = 1; |
1576 | pr_debug("LAG %d chosen as the active LAG\n", | 1587 | pr_debug("LAG %d chosen as the active LAG\n", |
1577 | best->aggregator_identifier); | 1588 | best->aggregator_identifier); |
1578 | pr_debug("Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n", | 1589 | pr_debug("Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n", |
1579 | best->aggregator_identifier, best->num_of_ports, | 1590 | best->aggregator_identifier, best->num_of_ports, |
1580 | best->actor_oper_aggregator_key, | 1591 | best->actor_oper_aggregator_key, |
1581 | best->partner_oper_aggregator_key, | 1592 | best->partner_oper_aggregator_key, |
1582 | best->is_individual, best->is_active); | 1593 | best->is_individual, best->is_active); |
1583 | 1594 | ||
1584 | // disable the ports that were related to the former active_aggregator | 1595 | // disable the ports that were related to the former active_aggregator |
1585 | if (active) { | 1596 | if (active) { |
@@ -1633,7 +1644,8 @@ static void ad_clear_agg(struct aggregator *aggregator) | |||
1633 | aggregator->lag_ports = NULL; | 1644 | aggregator->lag_ports = NULL; |
1634 | aggregator->is_active = 0; | 1645 | aggregator->is_active = 0; |
1635 | aggregator->num_of_ports = 0; | 1646 | aggregator->num_of_ports = 0; |
1636 | pr_debug("LAG %d was cleared\n", aggregator->aggregator_identifier); | 1647 | pr_debug("LAG %d was cleared\n", |
1648 | aggregator->aggregator_identifier); | ||
1637 | } | 1649 | } |
1638 | } | 1650 | } |
1639 | 1651 | ||
@@ -1728,7 +1740,9 @@ static void ad_initialize_port(struct port *port, int lacp_fast) | |||
1728 | static void ad_enable_collecting_distributing(struct port *port) | 1740 | static void ad_enable_collecting_distributing(struct port *port) |
1729 | { | 1741 | { |
1730 | if (port->aggregator->is_active) { | 1742 | if (port->aggregator->is_active) { |
1731 | pr_debug("Enabling port %d(LAG %d)\n", port->actor_port_number, port->aggregator->aggregator_identifier); | 1743 | pr_debug("Enabling port %d(LAG %d)\n", |
1744 | port->actor_port_number, | ||
1745 | port->aggregator->aggregator_identifier); | ||
1732 | __enable_port(port); | 1746 | __enable_port(port); |
1733 | } | 1747 | } |
1734 | } | 1748 | } |
@@ -1741,7 +1755,9 @@ static void ad_enable_collecting_distributing(struct port *port) | |||
1741 | static void ad_disable_collecting_distributing(struct port *port) | 1755 | static void ad_disable_collecting_distributing(struct port *port) |
1742 | { | 1756 | { |
1743 | if (port->aggregator && MAC_ADDRESS_COMPARE(&(port->aggregator->partner_system), &(null_mac_addr))) { | 1757 | if (port->aggregator && MAC_ADDRESS_COMPARE(&(port->aggregator->partner_system), &(null_mac_addr))) { |
1744 | pr_debug("Disabling port %d(LAG %d)\n", port->actor_port_number, port->aggregator->aggregator_identifier); | 1758 | pr_debug("Disabling port %d(LAG %d)\n", |
1759 | port->actor_port_number, | ||
1760 | port->aggregator->aggregator_identifier); | ||
1745 | __disable_port(port); | 1761 | __disable_port(port); |
1746 | } | 1762 | } |
1747 | } | 1763 | } |
@@ -1779,7 +1795,8 @@ static void ad_marker_info_send(struct port *port) | |||
1779 | 1795 | ||
1780 | // send the marker information | 1796 | // send the marker information |
1781 | if (ad_marker_send(port, &marker) >= 0) { | 1797 | if (ad_marker_send(port, &marker) >= 0) { |
1782 | pr_debug("Sent Marker Information on port %d\n", port->actor_port_number); | 1798 | pr_debug("Sent Marker Information on port %d\n", |
1799 | port->actor_port_number); | ||
1783 | } | 1800 | } |
1784 | } | 1801 | } |
1785 | #endif | 1802 | #endif |
@@ -1803,7 +1820,8 @@ static void ad_marker_info_received(struct bond_marker *marker_info, | |||
1803 | // send the marker response | 1820 | // send the marker response |
1804 | 1821 | ||
1805 | if (ad_marker_send(port, &marker) >= 0) { | 1822 | if (ad_marker_send(port, &marker) >= 0) { |
1806 | pr_debug("Sent Marker Response on port %d\n", port->actor_port_number); | 1823 | pr_debug("Sent Marker Response on port %d\n", |
1824 | port->actor_port_number); | ||
1807 | } | 1825 | } |
1808 | } | 1826 | } |
1809 | 1827 | ||
@@ -1889,8 +1907,7 @@ int bond_3ad_bind_slave(struct slave *slave) | |||
1889 | struct aggregator *aggregator; | 1907 | struct aggregator *aggregator; |
1890 | 1908 | ||
1891 | if (bond == NULL) { | 1909 | if (bond == NULL) { |
1892 | pr_err(DRV_NAME ": %s: The slave %s is not attached to " | 1910 | pr_err("%s: The slave %s is not attached to its bond\n", |
1893 | "its bond\n", | ||
1894 | slave->dev->master->name, slave->dev->name); | 1911 | slave->dev->master->name, slave->dev->name); |
1895 | return -1; | 1912 | return -1; |
1896 | } | 1913 | } |
@@ -1966,13 +1983,13 @@ void bond_3ad_unbind_slave(struct slave *slave) | |||
1966 | 1983 | ||
1967 | // if slave is null, the whole port is not initialized | 1984 | // if slave is null, the whole port is not initialized |
1968 | if (!port->slave) { | 1985 | if (!port->slave) { |
1969 | pr_warning(DRV_NAME ": Warning: %s: Trying to " | 1986 | pr_warning("Warning: %s: Trying to unbind an uninitialized port on %s\n", |
1970 | "unbind an uninitialized port on %s\n", | ||
1971 | slave->dev->master->name, slave->dev->name); | 1987 | slave->dev->master->name, slave->dev->name); |
1972 | return; | 1988 | return; |
1973 | } | 1989 | } |
1974 | 1990 | ||
1975 | pr_debug("Unbinding Link Aggregation Group %d\n", aggregator->aggregator_identifier); | 1991 | pr_debug("Unbinding Link Aggregation Group %d\n", |
1992 | aggregator->aggregator_identifier); | ||
1976 | 1993 | ||
1977 | /* Tell the partner that this port is not suitable for aggregation */ | 1994 | /* Tell the partner that this port is not suitable for aggregation */ |
1978 | port->actor_oper_port_state &= ~AD_STATE_AGGREGATION; | 1995 | port->actor_oper_port_state &= ~AD_STATE_AGGREGATION; |
@@ -1996,10 +2013,12 @@ void bond_3ad_unbind_slave(struct slave *slave) | |||
1996 | // if new aggregator found, copy the aggregator's parameters | 2013 | // if new aggregator found, copy the aggregator's parameters |
1997 | // and connect the related lag_ports to the new aggregator | 2014 | // and connect the related lag_ports to the new aggregator |
1998 | if ((new_aggregator) && ((!new_aggregator->lag_ports) || ((new_aggregator->lag_ports == port) && !new_aggregator->lag_ports->next_port_in_aggregator))) { | 2015 | if ((new_aggregator) && ((!new_aggregator->lag_ports) || ((new_aggregator->lag_ports == port) && !new_aggregator->lag_ports->next_port_in_aggregator))) { |
1999 | pr_debug("Some port(s) related to LAG %d - replaceing with LAG %d\n", aggregator->aggregator_identifier, new_aggregator->aggregator_identifier); | 2016 | pr_debug("Some port(s) related to LAG %d - replaceing with LAG %d\n", |
2017 | aggregator->aggregator_identifier, | ||
2018 | new_aggregator->aggregator_identifier); | ||
2000 | 2019 | ||
2001 | if ((new_aggregator->lag_ports == port) && new_aggregator->is_active) { | 2020 | if ((new_aggregator->lag_ports == port) && new_aggregator->is_active) { |
2002 | pr_info(DRV_NAME ": %s: Removing an active aggregator\n", | 2021 | pr_info("%s: Removing an active aggregator\n", |
2003 | aggregator->slave->dev->master->name); | 2022 | aggregator->slave->dev->master->name); |
2004 | // select new active aggregator | 2023 | // select new active aggregator |
2005 | select_new_active_agg = 1; | 2024 | select_new_active_agg = 1; |
@@ -2030,8 +2049,7 @@ void bond_3ad_unbind_slave(struct slave *slave) | |||
2030 | ad_agg_selection_logic(__get_first_agg(port)); | 2049 | ad_agg_selection_logic(__get_first_agg(port)); |
2031 | } | 2050 | } |
2032 | } else { | 2051 | } else { |
2033 | pr_warning(DRV_NAME ": %s: Warning: unbinding aggregator, " | 2052 | pr_warning("%s: Warning: unbinding aggregator, and could not find a new aggregator for its ports\n", |
2034 | "and could not find a new aggregator for its ports\n", | ||
2035 | slave->dev->master->name); | 2053 | slave->dev->master->name); |
2036 | } | 2054 | } |
2037 | } else { // in case that the only port related to this aggregator is the one we want to remove | 2055 | } else { // in case that the only port related to this aggregator is the one we want to remove |
@@ -2039,7 +2057,7 @@ void bond_3ad_unbind_slave(struct slave *slave) | |||
2039 | // clear the aggregator | 2057 | // clear the aggregator |
2040 | ad_clear_agg(aggregator); | 2058 | ad_clear_agg(aggregator); |
2041 | if (select_new_active_agg) { | 2059 | if (select_new_active_agg) { |
2042 | pr_info(DRV_NAME ": %s: Removing an active aggregator\n", | 2060 | pr_info("%s: Removing an active aggregator\n", |
2043 | slave->dev->master->name); | 2061 | slave->dev->master->name); |
2044 | // select new active aggregator | 2062 | // select new active aggregator |
2045 | ad_agg_selection_logic(__get_first_agg(port)); | 2063 | ad_agg_selection_logic(__get_first_agg(port)); |
@@ -2066,7 +2084,7 @@ void bond_3ad_unbind_slave(struct slave *slave) | |||
2066 | // clear the aggregator | 2084 | // clear the aggregator |
2067 | ad_clear_agg(temp_aggregator); | 2085 | ad_clear_agg(temp_aggregator); |
2068 | if (select_new_active_agg) { | 2086 | if (select_new_active_agg) { |
2069 | pr_info(DRV_NAME ": %s: Removing an active aggregator\n", | 2087 | pr_info("%s: Removing an active aggregator\n", |
2070 | slave->dev->master->name); | 2088 | slave->dev->master->name); |
2071 | // select new active aggregator | 2089 | // select new active aggregator |
2072 | ad_agg_selection_logic(__get_first_agg(port)); | 2090 | ad_agg_selection_logic(__get_first_agg(port)); |
@@ -2115,8 +2133,8 @@ void bond_3ad_state_machine_handler(struct work_struct *work) | |||
2115 | // select the active aggregator for the bond | 2133 | // select the active aggregator for the bond |
2116 | if ((port = __get_first_port(bond))) { | 2134 | if ((port = __get_first_port(bond))) { |
2117 | if (!port->slave) { | 2135 | if (!port->slave) { |
2118 | pr_warning(DRV_NAME ": %s: Warning: bond's first port is " | 2136 | pr_warning("%s: Warning: bond's first port is uninitialized\n", |
2119 | "uninitialized\n", bond->dev->name); | 2137 | bond->dev->name); |
2120 | goto re_arm; | 2138 | goto re_arm; |
2121 | } | 2139 | } |
2122 | 2140 | ||
@@ -2129,8 +2147,8 @@ void bond_3ad_state_machine_handler(struct work_struct *work) | |||
2129 | // for each port run the state machines | 2147 | // for each port run the state machines |
2130 | for (port = __get_first_port(bond); port; port = __get_next_port(port)) { | 2148 | for (port = __get_first_port(bond); port; port = __get_next_port(port)) { |
2131 | if (!port->slave) { | 2149 | if (!port->slave) { |
2132 | pr_warning(DRV_NAME ": %s: Warning: Found an uninitialized " | 2150 | pr_warning("%s: Warning: Found an uninitialized port\n", |
2133 | "port\n", bond->dev->name); | 2151 | bond->dev->name); |
2134 | goto re_arm; | 2152 | goto re_arm; |
2135 | } | 2153 | } |
2136 | 2154 | ||
@@ -2171,15 +2189,15 @@ static void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u | |||
2171 | port = &(SLAVE_AD_INFO(slave).port); | 2189 | port = &(SLAVE_AD_INFO(slave).port); |
2172 | 2190 | ||
2173 | if (!port->slave) { | 2191 | if (!port->slave) { |
2174 | pr_warning(DRV_NAME ": %s: Warning: port of slave %s " | 2192 | pr_warning("%s: Warning: port of slave %s is uninitialized\n", |
2175 | "is uninitialized\n", | ||
2176 | slave->dev->name, slave->dev->master->name); | 2193 | slave->dev->name, slave->dev->master->name); |
2177 | return; | 2194 | return; |
2178 | } | 2195 | } |
2179 | 2196 | ||
2180 | switch (lacpdu->subtype) { | 2197 | switch (lacpdu->subtype) { |
2181 | case AD_TYPE_LACPDU: | 2198 | case AD_TYPE_LACPDU: |
2182 | pr_debug("Received LACPDU on port %d\n", port->actor_port_number); | 2199 | pr_debug("Received LACPDU on port %d\n", |
2200 | port->actor_port_number); | ||
2183 | ad_rx_machine(lacpdu, port); | 2201 | ad_rx_machine(lacpdu, port); |
2184 | break; | 2202 | break; |
2185 | 2203 | ||
@@ -2188,17 +2206,20 @@ static void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u | |||
2188 | 2206 | ||
2189 | switch (((struct bond_marker *)lacpdu)->tlv_type) { | 2207 | switch (((struct bond_marker *)lacpdu)->tlv_type) { |
2190 | case AD_MARKER_INFORMATION_SUBTYPE: | 2208 | case AD_MARKER_INFORMATION_SUBTYPE: |
2191 | pr_debug("Received Marker Information on port %d\n", port->actor_port_number); | 2209 | pr_debug("Received Marker Information on port %d\n", |
2210 | port->actor_port_number); | ||
2192 | ad_marker_info_received((struct bond_marker *)lacpdu, port); | 2211 | ad_marker_info_received((struct bond_marker *)lacpdu, port); |
2193 | break; | 2212 | break; |
2194 | 2213 | ||
2195 | case AD_MARKER_RESPONSE_SUBTYPE: | 2214 | case AD_MARKER_RESPONSE_SUBTYPE: |
2196 | pr_debug("Received Marker Response on port %d\n", port->actor_port_number); | 2215 | pr_debug("Received Marker Response on port %d\n", |
2216 | port->actor_port_number); | ||
2197 | ad_marker_response_received((struct bond_marker *)lacpdu, port); | 2217 | ad_marker_response_received((struct bond_marker *)lacpdu, port); |
2198 | break; | 2218 | break; |
2199 | 2219 | ||
2200 | default: | 2220 | default: |
2201 | pr_debug("Received an unknown Marker subtype on slot %d\n", port->actor_port_number); | 2221 | pr_debug("Received an unknown Marker subtype on slot %d\n", |
2222 | port->actor_port_number); | ||
2202 | } | 2223 | } |
2203 | } | 2224 | } |
2204 | } | 2225 | } |
@@ -2218,8 +2239,7 @@ void bond_3ad_adapter_speed_changed(struct slave *slave) | |||
2218 | 2239 | ||
2219 | // if slave is null, the whole port is not initialized | 2240 | // if slave is null, the whole port is not initialized |
2220 | if (!port->slave) { | 2241 | if (!port->slave) { |
2221 | pr_warning(DRV_NAME ": Warning: %s: speed " | 2242 | pr_warning("Warning: %s: speed changed for uninitialized port on %s\n", |
2222 | "changed for uninitialized port on %s\n", | ||
2223 | slave->dev->master->name, slave->dev->name); | 2243 | slave->dev->master->name, slave->dev->name); |
2224 | return; | 2244 | return; |
2225 | } | 2245 | } |
@@ -2246,8 +2266,7 @@ void bond_3ad_adapter_duplex_changed(struct slave *slave) | |||
2246 | 2266 | ||
2247 | // if slave is null, the whole port is not initialized | 2267 | // if slave is null, the whole port is not initialized |
2248 | if (!port->slave) { | 2268 | if (!port->slave) { |
2249 | pr_warning(DRV_NAME ": %s: Warning: duplex changed " | 2269 | pr_warning("%s: Warning: duplex changed for uninitialized port on %s\n", |
2250 | "for uninitialized port on %s\n", | ||
2251 | slave->dev->master->name, slave->dev->name); | 2270 | slave->dev->master->name, slave->dev->name); |
2252 | return; | 2271 | return; |
2253 | } | 2272 | } |
@@ -2275,8 +2294,7 @@ void bond_3ad_handle_link_change(struct slave *slave, char link) | |||
2275 | 2294 | ||
2276 | // if slave is null, the whole port is not initialized | 2295 | // if slave is null, the whole port is not initialized |
2277 | if (!port->slave) { | 2296 | if (!port->slave) { |
2278 | pr_warning(DRV_NAME ": Warning: %s: link status changed for " | 2297 | pr_warning("Warning: %s: link status changed for uninitialized port on %s\n", |
2279 | "uninitialized port on %s\n", | ||
2280 | slave->dev->master->name, slave->dev->name); | 2298 | slave->dev->master->name, slave->dev->name); |
2281 | return; | 2299 | return; |
2282 | } | 2300 | } |
@@ -2381,8 +2399,8 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev) | |||
2381 | } | 2399 | } |
2382 | 2400 | ||
2383 | if (bond_3ad_get_active_agg_info(bond, &ad_info)) { | 2401 | if (bond_3ad_get_active_agg_info(bond, &ad_info)) { |
2384 | pr_debug(DRV_NAME ": %s: Error: " | 2402 | pr_debug("%s: Error: bond_3ad_get_active_agg_info failed\n", |
2385 | "bond_3ad_get_active_agg_info failed\n", dev->name); | 2403 | dev->name); |
2386 | goto out; | 2404 | goto out; |
2387 | } | 2405 | } |
2388 | 2406 | ||
@@ -2391,8 +2409,7 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev) | |||
2391 | 2409 | ||
2392 | if (slaves_in_agg == 0) { | 2410 | if (slaves_in_agg == 0) { |
2393 | /*the aggregator is empty*/ | 2411 | /*the aggregator is empty*/ |
2394 | pr_debug(DRV_NAME ": %s: Error: active aggregator is empty\n", | 2412 | pr_debug("%s: Error: active aggregator is empty\n", dev->name); |
2395 | dev->name); | ||
2396 | goto out; | 2413 | goto out; |
2397 | } | 2414 | } |
2398 | 2415 | ||
@@ -2410,8 +2427,8 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev) | |||
2410 | } | 2427 | } |
2411 | 2428 | ||
2412 | if (slave_agg_no >= 0) { | 2429 | if (slave_agg_no >= 0) { |
2413 | pr_err(DRV_NAME ": %s: Error: Couldn't find a slave to tx on " | 2430 | pr_err("%s: Error: Couldn't find a slave to tx on for aggregator ID %d\n", |
2414 | "for aggregator ID %d\n", dev->name, agg_id); | 2431 | dev->name, agg_id); |
2415 | goto out; | 2432 | goto out; |
2416 | } | 2433 | } |
2417 | 2434 | ||
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 00ab51ef3129..40fdc41446cc 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
@@ -20,6 +20,8 @@ | |||
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
24 | |||
23 | #include <linux/skbuff.h> | 25 | #include <linux/skbuff.h> |
24 | #include <linux/netdevice.h> | 26 | #include <linux/netdevice.h> |
25 | #include <linux/etherdevice.h> | 27 | #include <linux/etherdevice.h> |
@@ -201,8 +203,7 @@ static int tlb_initialize(struct bonding *bond) | |||
201 | 203 | ||
202 | new_hashtbl = kzalloc(size, GFP_KERNEL); | 204 | new_hashtbl = kzalloc(size, GFP_KERNEL); |
203 | if (!new_hashtbl) { | 205 | if (!new_hashtbl) { |
204 | pr_err(DRV_NAME | 206 | pr_err("%s: Error: Failed to allocate TLB hash table\n", |
205 | ": %s: Error: Failed to allocate TLB hash table\n", | ||
206 | bond->dev->name); | 207 | bond->dev->name); |
207 | return -1; | 208 | return -1; |
208 | } | 209 | } |
@@ -514,8 +515,7 @@ static void rlb_update_client(struct rlb_client_info *client_info) | |||
514 | client_info->slave->dev->dev_addr, | 515 | client_info->slave->dev->dev_addr, |
515 | client_info->mac_dst); | 516 | client_info->mac_dst); |
516 | if (!skb) { | 517 | if (!skb) { |
517 | pr_err(DRV_NAME | 518 | pr_err("%s: Error: failed to create an ARP packet\n", |
518 | ": %s: Error: failed to create an ARP packet\n", | ||
519 | client_info->slave->dev->master->name); | 519 | client_info->slave->dev->master->name); |
520 | continue; | 520 | continue; |
521 | } | 521 | } |
@@ -525,8 +525,7 @@ static void rlb_update_client(struct rlb_client_info *client_info) | |||
525 | if (client_info->tag) { | 525 | if (client_info->tag) { |
526 | skb = vlan_put_tag(skb, client_info->vlan_id); | 526 | skb = vlan_put_tag(skb, client_info->vlan_id); |
527 | if (!skb) { | 527 | if (!skb) { |
528 | pr_err(DRV_NAME | 528 | pr_err("%s: Error: failed to insert VLAN tag\n", |
529 | ": %s: Error: failed to insert VLAN tag\n", | ||
530 | client_info->slave->dev->master->name); | 529 | client_info->slave->dev->master->name); |
531 | continue; | 530 | continue; |
532 | } | 531 | } |
@@ -609,9 +608,7 @@ static void rlb_req_update_subnet_clients(struct bonding *bond, __be32 src_ip) | |||
609 | client_info = &(bond_info->rx_hashtbl[hash_index]); | 608 | client_info = &(bond_info->rx_hashtbl[hash_index]); |
610 | 609 | ||
611 | if (!client_info->slave) { | 610 | if (!client_info->slave) { |
612 | pr_err(DRV_NAME | 611 | pr_err("%s: Error: found a client with no channel in the client's hash table\n", |
613 | ": %s: Error: found a client with no channel in " | ||
614 | "the client's hash table\n", | ||
615 | bond->dev->name); | 612 | bond->dev->name); |
616 | continue; | 613 | continue; |
617 | } | 614 | } |
@@ -806,8 +803,7 @@ static int rlb_initialize(struct bonding *bond) | |||
806 | 803 | ||
807 | new_hashtbl = kmalloc(size, GFP_KERNEL); | 804 | new_hashtbl = kmalloc(size, GFP_KERNEL); |
808 | if (!new_hashtbl) { | 805 | if (!new_hashtbl) { |
809 | pr_err(DRV_NAME | 806 | pr_err("%s: Error: Failed to allocate RLB hash table\n", |
810 | ": %s: Error: Failed to allocate RLB hash table\n", | ||
811 | bond->dev->name); | 807 | bond->dev->name); |
812 | return -1; | 808 | return -1; |
813 | } | 809 | } |
@@ -928,8 +924,7 @@ static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[]) | |||
928 | 924 | ||
929 | skb = vlan_put_tag(skb, vlan->vlan_id); | 925 | skb = vlan_put_tag(skb, vlan->vlan_id); |
930 | if (!skb) { | 926 | if (!skb) { |
931 | pr_err(DRV_NAME | 927 | pr_err("%s: Error: failed to insert VLAN tag\n", |
932 | ": %s: Error: failed to insert VLAN tag\n", | ||
933 | bond->dev->name); | 928 | bond->dev->name); |
934 | continue; | 929 | continue; |
935 | } | 930 | } |
@@ -958,11 +953,8 @@ static int alb_set_slave_mac_addr(struct slave *slave, u8 addr[], int hw) | |||
958 | memcpy(s_addr.sa_data, addr, dev->addr_len); | 953 | memcpy(s_addr.sa_data, addr, dev->addr_len); |
959 | s_addr.sa_family = dev->type; | 954 | s_addr.sa_family = dev->type; |
960 | if (dev_set_mac_address(dev, &s_addr)) { | 955 | if (dev_set_mac_address(dev, &s_addr)) { |
961 | pr_err(DRV_NAME | 956 | pr_err("%s: Error: dev_set_mac_address of dev %s failed!\n" |
962 | ": %s: Error: dev_set_mac_address of dev %s failed! ALB " | 957 | "ALB mode requires that the base driver support setting the hw address also when the network device's interface is open\n", |
963 | "mode requires that the base driver support setting " | ||
964 | "the hw address also when the network device's " | ||
965 | "interface is open\n", | ||
966 | dev->master->name, dev->name); | 958 | dev->master->name, dev->name); |
967 | return -EOPNOTSUPP; | 959 | return -EOPNOTSUPP; |
968 | } | 960 | } |
@@ -1169,18 +1161,12 @@ static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slav | |||
1169 | alb_set_slave_mac_addr(slave, free_mac_slave->perm_hwaddr, | 1161 | alb_set_slave_mac_addr(slave, free_mac_slave->perm_hwaddr, |
1170 | bond->alb_info.rlb_enabled); | 1162 | bond->alb_info.rlb_enabled); |
1171 | 1163 | ||
1172 | pr_warning(DRV_NAME | 1164 | pr_warning("%s: Warning: the hw address of slave %s is in use by the bond; giving it the hw address of %s\n", |
1173 | ": %s: Warning: the hw address of slave %s is " | ||
1174 | "in use by the bond; giving it the hw address " | ||
1175 | "of %s\n", | ||
1176 | bond->dev->name, slave->dev->name, | 1165 | bond->dev->name, slave->dev->name, |
1177 | free_mac_slave->dev->name); | 1166 | free_mac_slave->dev->name); |
1178 | 1167 | ||
1179 | } else if (has_bond_addr) { | 1168 | } else if (has_bond_addr) { |
1180 | pr_err(DRV_NAME | 1169 | pr_err("%s: Error: the hw address of slave %s is in use by the bond; couldn't find a slave with a free hw address to give it (this should not have happened)\n", |
1181 | ": %s: Error: the hw address of slave %s is in use by the " | ||
1182 | "bond; couldn't find a slave with a free hw address to " | ||
1183 | "give it (this should not have happened)\n", | ||
1184 | bond->dev->name, slave->dev->name); | 1170 | bond->dev->name, slave->dev->name); |
1185 | return -EFAULT; | 1171 | return -EFAULT; |
1186 | } | 1172 | } |
diff --git a/drivers/net/bonding/bond_ipv6.c b/drivers/net/bonding/bond_ipv6.c index b72e1dc8cf8f..6dd64cf3cb76 100644 --- a/drivers/net/bonding/bond_ipv6.c +++ b/drivers/net/bonding/bond_ipv6.c | |||
@@ -20,6 +20,8 @@ | |||
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
24 | |||
23 | #include <linux/types.h> | 25 | #include <linux/types.h> |
24 | #include <linux/if_vlan.h> | 26 | #include <linux/if_vlan.h> |
25 | #include <net/ipv6.h> | 27 | #include <net/ipv6.h> |
@@ -74,20 +76,20 @@ static void bond_na_send(struct net_device *slave_dev, | |||
74 | addrconf_addr_solict_mult(daddr, &mcaddr); | 76 | addrconf_addr_solict_mult(daddr, &mcaddr); |
75 | 77 | ||
76 | pr_debug("ipv6 na on slave %s: dest %pI6, src %pI6\n", | 78 | pr_debug("ipv6 na on slave %s: dest %pI6, src %pI6\n", |
77 | slave_dev->name, &mcaddr, daddr); | 79 | slave_dev->name, &mcaddr, daddr); |
78 | 80 | ||
79 | skb = ndisc_build_skb(slave_dev, &mcaddr, daddr, &icmp6h, daddr, | 81 | skb = ndisc_build_skb(slave_dev, &mcaddr, daddr, &icmp6h, daddr, |
80 | ND_OPT_TARGET_LL_ADDR); | 82 | ND_OPT_TARGET_LL_ADDR); |
81 | 83 | ||
82 | if (!skb) { | 84 | if (!skb) { |
83 | pr_err(DRV_NAME ": NA packet allocation failed\n"); | 85 | pr_err("NA packet allocation failed\n"); |
84 | return; | 86 | return; |
85 | } | 87 | } |
86 | 88 | ||
87 | if (vlan_id) { | 89 | if (vlan_id) { |
88 | skb = vlan_put_tag(skb, vlan_id); | 90 | skb = vlan_put_tag(skb, vlan_id); |
89 | if (!skb) { | 91 | if (!skb) { |
90 | pr_err(DRV_NAME ": failed to insert VLAN tag\n"); | 92 | pr_err("failed to insert VLAN tag\n"); |
91 | return; | 93 | return; |
92 | } | 94 | } |
93 | } | 95 | } |
@@ -109,8 +111,8 @@ void bond_send_unsolicited_na(struct bonding *bond) | |||
109 | struct inet6_dev *idev; | 111 | struct inet6_dev *idev; |
110 | int is_router; | 112 | int is_router; |
111 | 113 | ||
112 | pr_debug("bond_send_unsol_na: bond %s slave %s\n", bond->dev->name, | 114 | pr_debug("%s: bond %s slave %s\n", bond->dev->name, |
113 | slave ? slave->dev->name : "NULL"); | 115 | __func__, slave ? slave->dev->name : "NULL"); |
114 | 116 | ||
115 | if (!slave || !bond->send_unsol_na || | 117 | if (!slave || !bond->send_unsol_na || |
116 | test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state)) | 118 | test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state)) |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index af9b9c4eb496..3f0071cfe56b 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -31,6 +31,8 @@ | |||
31 | * | 31 | * |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
35 | |||
34 | #include <linux/kernel.h> | 36 | #include <linux/kernel.h> |
35 | #include <linux/module.h> | 37 | #include <linux/module.h> |
36 | #include <linux/types.h> | 38 | #include <linux/types.h> |
@@ -260,7 +262,7 @@ static int bond_add_vlan(struct bonding *bond, unsigned short vlan_id) | |||
260 | struct vlan_entry *vlan; | 262 | struct vlan_entry *vlan; |
261 | 263 | ||
262 | pr_debug("bond: %s, vlan id %d\n", | 264 | pr_debug("bond: %s, vlan id %d\n", |
263 | (bond ? bond->dev->name : "None"), vlan_id); | 265 | (bond ? bond->dev->name : "None"), vlan_id); |
264 | 266 | ||
265 | vlan = kzalloc(sizeof(struct vlan_entry), GFP_KERNEL); | 267 | vlan = kzalloc(sizeof(struct vlan_entry), GFP_KERNEL); |
266 | if (!vlan) | 268 | if (!vlan) |
@@ -303,8 +305,8 @@ static int bond_del_vlan(struct bonding *bond, unsigned short vlan_id) | |||
303 | if (bond_is_lb(bond)) | 305 | if (bond_is_lb(bond)) |
304 | bond_alb_clear_vlan(bond, vlan_id); | 306 | bond_alb_clear_vlan(bond, vlan_id); |
305 | 307 | ||
306 | pr_debug("removed VLAN ID %d from bond %s\n", vlan_id, | 308 | pr_debug("removed VLAN ID %d from bond %s\n", |
307 | bond->dev->name); | 309 | vlan_id, bond->dev->name); |
308 | 310 | ||
309 | kfree(vlan); | 311 | kfree(vlan); |
310 | 312 | ||
@@ -323,8 +325,8 @@ static int bond_del_vlan(struct bonding *bond, unsigned short vlan_id) | |||
323 | } | 325 | } |
324 | } | 326 | } |
325 | 327 | ||
326 | pr_debug("couldn't find VLAN ID %d in bond %s\n", vlan_id, | 328 | pr_debug("couldn't find VLAN ID %d in bond %s\n", |
327 | bond->dev->name); | 329 | vlan_id, bond->dev->name); |
328 | 330 | ||
329 | out: | 331 | out: |
330 | write_unlock_bh(&bond->lock); | 332 | write_unlock_bh(&bond->lock); |
@@ -348,7 +350,7 @@ static int bond_has_challenged_slaves(struct bonding *bond) | |||
348 | bond_for_each_slave(bond, slave, i) { | 350 | bond_for_each_slave(bond, slave, i) { |
349 | if (slave->dev->features & NETIF_F_VLAN_CHALLENGED) { | 351 | if (slave->dev->features & NETIF_F_VLAN_CHALLENGED) { |
350 | pr_debug("found VLAN challenged slave - %s\n", | 352 | pr_debug("found VLAN challenged slave - %s\n", |
351 | slave->dev->name); | 353 | slave->dev->name); |
352 | return 1; | 354 | return 1; |
353 | } | 355 | } |
354 | } | 356 | } |
@@ -499,8 +501,7 @@ static void bond_vlan_rx_add_vid(struct net_device *bond_dev, uint16_t vid) | |||
499 | 501 | ||
500 | res = bond_add_vlan(bond, vid); | 502 | res = bond_add_vlan(bond, vid); |
501 | if (res) { | 503 | if (res) { |
502 | pr_err(DRV_NAME | 504 | pr_err("%s: Error: Failed to add vlan id %d\n", |
503 | ": %s: Error: Failed to add vlan id %d\n", | ||
504 | bond_dev->name, vid); | 505 | bond_dev->name, vid); |
505 | } | 506 | } |
506 | } | 507 | } |
@@ -534,8 +535,7 @@ static void bond_vlan_rx_kill_vid(struct net_device *bond_dev, uint16_t vid) | |||
534 | 535 | ||
535 | res = bond_del_vlan(bond, vid); | 536 | res = bond_del_vlan(bond, vid); |
536 | if (res) { | 537 | if (res) { |
537 | pr_err(DRV_NAME | 538 | pr_err("%s: Error: Failed to remove vlan id %d\n", |
538 | ": %s: Error: Failed to remove vlan id %d\n", | ||
539 | bond_dev->name, vid); | 539 | bond_dev->name, vid); |
540 | } | 540 | } |
541 | } | 541 | } |
@@ -1053,8 +1053,7 @@ static void bond_do_fail_over_mac(struct bonding *bond, | |||
1053 | 1053 | ||
1054 | rv = dev_set_mac_address(new_active->dev, &saddr); | 1054 | rv = dev_set_mac_address(new_active->dev, &saddr); |
1055 | if (rv) { | 1055 | if (rv) { |
1056 | pr_err(DRV_NAME | 1056 | pr_err("%s: Error %d setting MAC of slave %s\n", |
1057 | ": %s: Error %d setting MAC of slave %s\n", | ||
1058 | bond->dev->name, -rv, new_active->dev->name); | 1057 | bond->dev->name, -rv, new_active->dev->name); |
1059 | goto out; | 1058 | goto out; |
1060 | } | 1059 | } |
@@ -1067,16 +1066,14 @@ static void bond_do_fail_over_mac(struct bonding *bond, | |||
1067 | 1066 | ||
1068 | rv = dev_set_mac_address(old_active->dev, &saddr); | 1067 | rv = dev_set_mac_address(old_active->dev, &saddr); |
1069 | if (rv) | 1068 | if (rv) |
1070 | pr_err(DRV_NAME | 1069 | pr_err("%s: Error %d setting MAC of slave %s\n", |
1071 | ": %s: Error %d setting MAC of slave %s\n", | ||
1072 | bond->dev->name, -rv, new_active->dev->name); | 1070 | bond->dev->name, -rv, new_active->dev->name); |
1073 | out: | 1071 | out: |
1074 | read_lock(&bond->lock); | 1072 | read_lock(&bond->lock); |
1075 | write_lock_bh(&bond->curr_slave_lock); | 1073 | write_lock_bh(&bond->curr_slave_lock); |
1076 | break; | 1074 | break; |
1077 | default: | 1075 | default: |
1078 | pr_err(DRV_NAME | 1076 | pr_err("%s: bond_do_fail_over_mac impossible: bad policy %d\n", |
1079 | ": %s: bond_do_fail_over_mac impossible: bad policy %d\n", | ||
1080 | bond->dev->name, bond->params.fail_over_mac); | 1077 | bond->dev->name, bond->params.fail_over_mac); |
1081 | break; | 1078 | break; |
1082 | } | 1079 | } |
@@ -1178,11 +1175,9 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) | |||
1178 | 1175 | ||
1179 | if (new_active->link == BOND_LINK_BACK) { | 1176 | if (new_active->link == BOND_LINK_BACK) { |
1180 | if (USES_PRIMARY(bond->params.mode)) { | 1177 | if (USES_PRIMARY(bond->params.mode)) { |
1181 | pr_info(DRV_NAME | 1178 | pr_info("%s: making interface %s the new active one %d ms earlier.\n", |
1182 | ": %s: making interface %s the new " | 1179 | bond->dev->name, new_active->dev->name, |
1183 | "active one %d ms earlier.\n", | 1180 | (bond->params.updelay - new_active->delay) * bond->params.miimon); |
1184 | bond->dev->name, new_active->dev->name, | ||
1185 | (bond->params.updelay - new_active->delay) * bond->params.miimon); | ||
1186 | } | 1181 | } |
1187 | 1182 | ||
1188 | new_active->delay = 0; | 1183 | new_active->delay = 0; |
@@ -1195,10 +1190,8 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) | |||
1195 | bond_alb_handle_link_change(bond, new_active, BOND_LINK_UP); | 1190 | bond_alb_handle_link_change(bond, new_active, BOND_LINK_UP); |
1196 | } else { | 1191 | } else { |
1197 | if (USES_PRIMARY(bond->params.mode)) { | 1192 | if (USES_PRIMARY(bond->params.mode)) { |
1198 | pr_info(DRV_NAME | 1193 | pr_info("%s: making interface %s the new active one.\n", |
1199 | ": %s: making interface %s the new " | 1194 | bond->dev->name, new_active->dev->name); |
1200 | "active one.\n", | ||
1201 | bond->dev->name, new_active->dev->name); | ||
1202 | } | 1195 | } |
1203 | } | 1196 | } |
1204 | } | 1197 | } |
@@ -1268,13 +1261,11 @@ void bond_select_active_slave(struct bonding *bond) | |||
1268 | return; | 1261 | return; |
1269 | 1262 | ||
1270 | if (netif_carrier_ok(bond->dev)) { | 1263 | if (netif_carrier_ok(bond->dev)) { |
1271 | pr_info(DRV_NAME | 1264 | pr_info("%s: first active interface up!\n", |
1272 | ": %s: first active interface up!\n", | 1265 | bond->dev->name); |
1273 | bond->dev->name); | ||
1274 | } else { | 1266 | } else { |
1275 | pr_info(DRV_NAME ": %s: " | 1267 | pr_info("%s: now running without any active interface !\n", |
1276 | "now running without any active interface !\n", | 1268 | bond->dev->name); |
1277 | bond->dev->name); | ||
1278 | } | 1269 | } |
1279 | } | 1270 | } |
1280 | } | 1271 | } |
@@ -1423,16 +1414,14 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1423 | 1414 | ||
1424 | if (!bond->params.use_carrier && slave_dev->ethtool_ops == NULL && | 1415 | if (!bond->params.use_carrier && slave_dev->ethtool_ops == NULL && |
1425 | slave_ops->ndo_do_ioctl == NULL) { | 1416 | slave_ops->ndo_do_ioctl == NULL) { |
1426 | pr_warning(DRV_NAME | 1417 | pr_warning("%s: Warning: no link monitoring support for %s\n", |
1427 | ": %s: Warning: no link monitoring support for %s\n", | 1418 | bond_dev->name, slave_dev->name); |
1428 | bond_dev->name, slave_dev->name); | ||
1429 | } | 1419 | } |
1430 | 1420 | ||
1431 | /* bond must be initialized by bond_open() before enslaving */ | 1421 | /* bond must be initialized by bond_open() before enslaving */ |
1432 | if (!(bond_dev->flags & IFF_UP)) { | 1422 | if (!(bond_dev->flags & IFF_UP)) { |
1433 | pr_warning(DRV_NAME | 1423 | pr_warning("%s: master_dev is not up in bond_enslave\n", |
1434 | " %s: master_dev is not up in bond_enslave\n", | 1424 | bond_dev->name); |
1435 | bond_dev->name); | ||
1436 | } | 1425 | } |
1437 | 1426 | ||
1438 | /* already enslaved */ | 1427 | /* already enslaved */ |
@@ -1446,19 +1435,13 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1446 | if (slave_dev->features & NETIF_F_VLAN_CHALLENGED) { | 1435 | if (slave_dev->features & NETIF_F_VLAN_CHALLENGED) { |
1447 | pr_debug("%s: NETIF_F_VLAN_CHALLENGED\n", slave_dev->name); | 1436 | pr_debug("%s: NETIF_F_VLAN_CHALLENGED\n", slave_dev->name); |
1448 | if (!list_empty(&bond->vlan_list)) { | 1437 | if (!list_empty(&bond->vlan_list)) { |
1449 | pr_err(DRV_NAME | 1438 | pr_err("%s: Error: cannot enslave VLAN challenged slave %s on VLAN enabled bond %s\n", |
1450 | ": %s: Error: cannot enslave VLAN " | 1439 | bond_dev->name, slave_dev->name, bond_dev->name); |
1451 | "challenged slave %s on VLAN enabled " | ||
1452 | "bond %s\n", bond_dev->name, slave_dev->name, | ||
1453 | bond_dev->name); | ||
1454 | return -EPERM; | 1440 | return -EPERM; |
1455 | } else { | 1441 | } else { |
1456 | pr_warning(DRV_NAME | 1442 | pr_warning("%s: Warning: enslaved VLAN challenged slave %s. Adding VLANs will be blocked as long as %s is part of bond %s\n", |
1457 | ": %s: Warning: enslaved VLAN challenged " | 1443 | bond_dev->name, slave_dev->name, |
1458 | "slave %s. Adding VLANs will be blocked as " | 1444 | slave_dev->name, bond_dev->name); |
1459 | "long as %s is part of bond %s\n", | ||
1460 | bond_dev->name, slave_dev->name, slave_dev->name, | ||
1461 | bond_dev->name); | ||
1462 | bond_dev->features |= NETIF_F_VLAN_CHALLENGED; | 1445 | bond_dev->features |= NETIF_F_VLAN_CHALLENGED; |
1463 | } | 1446 | } |
1464 | } else { | 1447 | } else { |
@@ -1478,8 +1461,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1478 | * enslaving it; the old ifenslave will not. | 1461 | * enslaving it; the old ifenslave will not. |
1479 | */ | 1462 | */ |
1480 | if ((slave_dev->flags & IFF_UP)) { | 1463 | if ((slave_dev->flags & IFF_UP)) { |
1481 | pr_err(DRV_NAME ": %s is up. " | 1464 | pr_err("%s is up. This may be due to an out of date ifenslave.\n", |
1482 | "This may be due to an out of date ifenslave.\n", | ||
1483 | slave_dev->name); | 1465 | slave_dev->name); |
1484 | res = -EPERM; | 1466 | res = -EPERM; |
1485 | goto err_undo_flags; | 1467 | goto err_undo_flags; |
@@ -1495,7 +1477,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1495 | if (bond->slave_cnt == 0) { | 1477 | if (bond->slave_cnt == 0) { |
1496 | if (bond_dev->type != slave_dev->type) { | 1478 | if (bond_dev->type != slave_dev->type) { |
1497 | pr_debug("%s: change device type from %d to %d\n", | 1479 | pr_debug("%s: change device type from %d to %d\n", |
1498 | bond_dev->name, bond_dev->type, slave_dev->type); | 1480 | bond_dev->name, |
1481 | bond_dev->type, slave_dev->type); | ||
1499 | 1482 | ||
1500 | netdev_bonding_change(bond_dev, NETDEV_BONDING_OLDTYPE); | 1483 | netdev_bonding_change(bond_dev, NETDEV_BONDING_OLDTYPE); |
1501 | 1484 | ||
@@ -1507,28 +1490,21 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1507 | netdev_bonding_change(bond_dev, NETDEV_BONDING_NEWTYPE); | 1490 | netdev_bonding_change(bond_dev, NETDEV_BONDING_NEWTYPE); |
1508 | } | 1491 | } |
1509 | } else if (bond_dev->type != slave_dev->type) { | 1492 | } else if (bond_dev->type != slave_dev->type) { |
1510 | pr_err(DRV_NAME ": %s ether type (%d) is different " | 1493 | pr_err("%s ether type (%d) is different from other slaves (%d), can not enslave it.\n", |
1511 | "from other slaves (%d), can not enslave it.\n", | 1494 | slave_dev->name, |
1512 | slave_dev->name, | 1495 | slave_dev->type, bond_dev->type); |
1513 | slave_dev->type, bond_dev->type); | 1496 | res = -EINVAL; |
1514 | res = -EINVAL; | 1497 | goto err_undo_flags; |
1515 | goto err_undo_flags; | ||
1516 | } | 1498 | } |
1517 | 1499 | ||
1518 | if (slave_ops->ndo_set_mac_address == NULL) { | 1500 | if (slave_ops->ndo_set_mac_address == NULL) { |
1519 | if (bond->slave_cnt == 0) { | 1501 | if (bond->slave_cnt == 0) { |
1520 | pr_warning(DRV_NAME | 1502 | pr_warning("%s: Warning: The first slave device specified does not support setting the MAC address. Setting fail_over_mac to active.", |
1521 | ": %s: Warning: The first slave device " | 1503 | bond_dev->name); |
1522 | "specified does not support setting the MAC " | ||
1523 | "address. Setting fail_over_mac to active.", | ||
1524 | bond_dev->name); | ||
1525 | bond->params.fail_over_mac = BOND_FOM_ACTIVE; | 1504 | bond->params.fail_over_mac = BOND_FOM_ACTIVE; |
1526 | } else if (bond->params.fail_over_mac != BOND_FOM_ACTIVE) { | 1505 | } else if (bond->params.fail_over_mac != BOND_FOM_ACTIVE) { |
1527 | pr_err(DRV_NAME | 1506 | pr_err("%s: Error: The slave device specified does not support setting the MAC address, but fail_over_mac is not set to active.\n", |
1528 | ": %s: Error: The slave device specified " | 1507 | bond_dev->name); |
1529 | "does not support setting the MAC address, " | ||
1530 | "but fail_over_mac is not set to active.\n" | ||
1531 | , bond_dev->name); | ||
1532 | res = -EOPNOTSUPP; | 1508 | res = -EOPNOTSUPP; |
1533 | goto err_undo_flags; | 1509 | goto err_undo_flags; |
1534 | } | 1510 | } |
@@ -1655,22 +1631,12 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1655 | * supported); thus, we don't need to change | 1631 | * supported); thus, we don't need to change |
1656 | * the messages for netif_carrier. | 1632 | * the messages for netif_carrier. |
1657 | */ | 1633 | */ |
1658 | pr_warning(DRV_NAME | 1634 | pr_warning("%s: Warning: MII and ETHTOOL support not available for interface %s, and arp_interval/arp_ip_target module parameters not specified, thus bonding will not detect link failures! see bonding.txt for details.\n", |
1659 | ": %s: Warning: MII and ETHTOOL support not " | ||
1660 | "available for interface %s, and " | ||
1661 | "arp_interval/arp_ip_target module parameters " | ||
1662 | "not specified, thus bonding will not detect " | ||
1663 | "link failures! see bonding.txt for details.\n", | ||
1664 | bond_dev->name, slave_dev->name); | 1635 | bond_dev->name, slave_dev->name); |
1665 | } else if (link_reporting == -1) { | 1636 | } else if (link_reporting == -1) { |
1666 | /* unable get link status using mii/ethtool */ | 1637 | /* unable get link status using mii/ethtool */ |
1667 | pr_warning(DRV_NAME | 1638 | pr_warning("%s: Warning: can't get link status from interface %s; the network driver associated with this interface does not support MII or ETHTOOL link status reporting, thus miimon has no effect on this interface.\n", |
1668 | ": %s: Warning: can't get link status from " | 1639 | bond_dev->name, slave_dev->name); |
1669 | "interface %s; the network driver associated " | ||
1670 | "with this interface does not support MII or " | ||
1671 | "ETHTOOL link status reporting, thus miimon " | ||
1672 | "has no effect on this interface.\n", | ||
1673 | bond_dev->name, slave_dev->name); | ||
1674 | } | 1640 | } |
1675 | } | 1641 | } |
1676 | 1642 | ||
@@ -1678,34 +1644,27 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1678 | if (!bond->params.miimon || | 1644 | if (!bond->params.miimon || |
1679 | (bond_check_dev_link(bond, slave_dev, 0) == BMSR_LSTATUS)) { | 1645 | (bond_check_dev_link(bond, slave_dev, 0) == BMSR_LSTATUS)) { |
1680 | if (bond->params.updelay) { | 1646 | if (bond->params.updelay) { |
1681 | pr_debug("Initial state of slave_dev is " | 1647 | pr_debug("Initial state of slave_dev is BOND_LINK_BACK\n"); |
1682 | "BOND_LINK_BACK\n"); | ||
1683 | new_slave->link = BOND_LINK_BACK; | 1648 | new_slave->link = BOND_LINK_BACK; |
1684 | new_slave->delay = bond->params.updelay; | 1649 | new_slave->delay = bond->params.updelay; |
1685 | } else { | 1650 | } else { |
1686 | pr_debug("Initial state of slave_dev is " | 1651 | pr_debug("Initial state of slave_dev is BOND_LINK_UP\n"); |
1687 | "BOND_LINK_UP\n"); | ||
1688 | new_slave->link = BOND_LINK_UP; | 1652 | new_slave->link = BOND_LINK_UP; |
1689 | } | 1653 | } |
1690 | new_slave->jiffies = jiffies; | 1654 | new_slave->jiffies = jiffies; |
1691 | } else { | 1655 | } else { |
1692 | pr_debug("Initial state of slave_dev is " | 1656 | pr_debug("Initial state of slave_dev is BOND_LINK_DOWN\n"); |
1693 | "BOND_LINK_DOWN\n"); | ||
1694 | new_slave->link = BOND_LINK_DOWN; | 1657 | new_slave->link = BOND_LINK_DOWN; |
1695 | } | 1658 | } |
1696 | 1659 | ||
1697 | if (bond_update_speed_duplex(new_slave) && | 1660 | if (bond_update_speed_duplex(new_slave) && |
1698 | (new_slave->link != BOND_LINK_DOWN)) { | 1661 | (new_slave->link != BOND_LINK_DOWN)) { |
1699 | pr_warning(DRV_NAME | 1662 | pr_warning("%s: Warning: failed to get speed and duplex from %s, assumed to be 100Mb/sec and Full.\n", |
1700 | ": %s: Warning: failed to get speed and duplex from %s, " | 1663 | bond_dev->name, new_slave->dev->name); |
1701 | "assumed to be 100Mb/sec and Full.\n", | ||
1702 | bond_dev->name, new_slave->dev->name); | ||
1703 | 1664 | ||
1704 | if (bond->params.mode == BOND_MODE_8023AD) { | 1665 | if (bond->params.mode == BOND_MODE_8023AD) { |
1705 | pr_warning(DRV_NAME | 1666 | pr_warning("%s: Warning: Operation of 802.3ad mode requires ETHTOOL support in base driver for proper aggregator selection.\n", |
1706 | ": %s: Warning: Operation of 802.3ad mode requires ETHTOOL " | 1667 | bond_dev->name); |
1707 | "support in base driver for proper aggregator " | ||
1708 | "selection.\n", bond_dev->name); | ||
1709 | } | 1668 | } |
1710 | } | 1669 | } |
1711 | 1670 | ||
@@ -1777,11 +1736,10 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1777 | if (res) | 1736 | if (res) |
1778 | goto err_close; | 1737 | goto err_close; |
1779 | 1738 | ||
1780 | pr_info(DRV_NAME | 1739 | pr_info("%s: enslaving %s as a%s interface with a%s link.\n", |
1781 | ": %s: enslaving %s as a%s interface with a%s link.\n", | 1740 | bond_dev->name, slave_dev->name, |
1782 | bond_dev->name, slave_dev->name, | 1741 | new_slave->state == BOND_STATE_ACTIVE ? "n active" : " backup", |
1783 | new_slave->state == BOND_STATE_ACTIVE ? "n active" : " backup", | 1742 | new_slave->link != BOND_LINK_DOWN ? "n up" : " down"); |
1784 | new_slave->link != BOND_LINK_DOWN ? "n up" : " down"); | ||
1785 | 1743 | ||
1786 | /* enslave is successful */ | 1744 | /* enslave is successful */ |
1787 | return 0; | 1745 | return 0; |
@@ -1833,8 +1791,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1833 | /* slave is not a slave or master is not master of this slave */ | 1791 | /* slave is not a slave or master is not master of this slave */ |
1834 | if (!(slave_dev->flags & IFF_SLAVE) || | 1792 | if (!(slave_dev->flags & IFF_SLAVE) || |
1835 | (slave_dev->master != bond_dev)) { | 1793 | (slave_dev->master != bond_dev)) { |
1836 | pr_err(DRV_NAME | 1794 | pr_err("%s: Error: cannot release %s.\n", |
1837 | ": %s: Error: cannot release %s.\n", | ||
1838 | bond_dev->name, slave_dev->name); | 1795 | bond_dev->name, slave_dev->name); |
1839 | return -EINVAL; | 1796 | return -EINVAL; |
1840 | } | 1797 | } |
@@ -1844,9 +1801,8 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1844 | slave = bond_get_slave_by_dev(bond, slave_dev); | 1801 | slave = bond_get_slave_by_dev(bond, slave_dev); |
1845 | if (!slave) { | 1802 | if (!slave) { |
1846 | /* not a slave of this bond */ | 1803 | /* not a slave of this bond */ |
1847 | pr_info(DRV_NAME | 1804 | pr_info("%s: %s not enslaved\n", |
1848 | ": %s: %s not enslaved\n", | 1805 | bond_dev->name, slave_dev->name); |
1849 | bond_dev->name, slave_dev->name); | ||
1850 | write_unlock_bh(&bond->lock); | 1806 | write_unlock_bh(&bond->lock); |
1851 | return -EINVAL; | 1807 | return -EINVAL; |
1852 | } | 1808 | } |
@@ -1854,14 +1810,10 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1854 | if (!bond->params.fail_over_mac) { | 1810 | if (!bond->params.fail_over_mac) { |
1855 | if (!compare_ether_addr(bond_dev->dev_addr, slave->perm_hwaddr) && | 1811 | if (!compare_ether_addr(bond_dev->dev_addr, slave->perm_hwaddr) && |
1856 | bond->slave_cnt > 1) | 1812 | bond->slave_cnt > 1) |
1857 | pr_warning(DRV_NAME | 1813 | pr_warning("%s: Warning: the permanent HWaddr of %s - %pM - is still in use by %s. Set the HWaddr of %s to a different address to avoid conflicts.\n", |
1858 | ": %s: Warning: the permanent HWaddr of %s - " | 1814 | bond_dev->name, slave_dev->name, |
1859 | "%pM - is still in use by %s. " | 1815 | slave->perm_hwaddr, |
1860 | "Set the HWaddr of %s to a different address " | 1816 | bond_dev->name, slave_dev->name); |
1861 | "to avoid conflicts.\n", | ||
1862 | bond_dev->name, slave_dev->name, | ||
1863 | slave->perm_hwaddr, | ||
1864 | bond_dev->name, slave_dev->name); | ||
1865 | } | 1817 | } |
1866 | 1818 | ||
1867 | /* Inform AD package of unbinding of slave. */ | 1819 | /* Inform AD package of unbinding of slave. */ |
@@ -1872,12 +1824,10 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1872 | bond_3ad_unbind_slave(slave); | 1824 | bond_3ad_unbind_slave(slave); |
1873 | } | 1825 | } |
1874 | 1826 | ||
1875 | pr_info(DRV_NAME | 1827 | pr_info("%s: releasing %s interface %s\n", |
1876 | ": %s: releasing %s interface %s\n", | 1828 | bond_dev->name, |
1877 | bond_dev->name, | 1829 | (slave->state == BOND_STATE_ACTIVE) ? "active" : "backup", |
1878 | (slave->state == BOND_STATE_ACTIVE) | 1830 | slave_dev->name); |
1879 | ? "active" : "backup", | ||
1880 | slave_dev->name); | ||
1881 | 1831 | ||
1882 | oldcurrent = bond->curr_active_slave; | 1832 | oldcurrent = bond->curr_active_slave; |
1883 | 1833 | ||
@@ -1934,21 +1884,15 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1934 | if (list_empty(&bond->vlan_list)) { | 1884 | if (list_empty(&bond->vlan_list)) { |
1935 | bond_dev->features |= NETIF_F_VLAN_CHALLENGED; | 1885 | bond_dev->features |= NETIF_F_VLAN_CHALLENGED; |
1936 | } else { | 1886 | } else { |
1937 | pr_warning(DRV_NAME | 1887 | pr_warning("%s: Warning: clearing HW address of %s while it still has VLANs.\n", |
1938 | ": %s: Warning: clearing HW address of %s while it " | 1888 | bond_dev->name, bond_dev->name); |
1939 | "still has VLANs.\n", | 1889 | pr_warning("%s: When re-adding slaves, make sure the bond's HW address matches its VLANs'.\n", |
1940 | bond_dev->name, bond_dev->name); | 1890 | bond_dev->name); |
1941 | pr_warning(DRV_NAME | ||
1942 | ": %s: When re-adding slaves, make sure the bond's " | ||
1943 | "HW address matches its VLANs'.\n", | ||
1944 | bond_dev->name); | ||
1945 | } | 1891 | } |
1946 | } else if ((bond_dev->features & NETIF_F_VLAN_CHALLENGED) && | 1892 | } else if ((bond_dev->features & NETIF_F_VLAN_CHALLENGED) && |
1947 | !bond_has_challenged_slaves(bond)) { | 1893 | !bond_has_challenged_slaves(bond)) { |
1948 | pr_info(DRV_NAME | 1894 | pr_info("%s: last VLAN challenged slave %s left bond %s. VLAN blocking is removed\n", |
1949 | ": %s: last VLAN challenged slave %s " | 1895 | bond_dev->name, slave_dev->name, bond_dev->name); |
1950 | "left bond %s. VLAN blocking is removed\n", | ||
1951 | bond_dev->name, slave_dev->name, bond_dev->name); | ||
1952 | bond_dev->features &= ~NETIF_F_VLAN_CHALLENGED; | 1896 | bond_dev->features &= ~NETIF_F_VLAN_CHALLENGED; |
1953 | } | 1897 | } |
1954 | 1898 | ||
@@ -2011,8 +1955,8 @@ int bond_release_and_destroy(struct net_device *bond_dev, | |||
2011 | 1955 | ||
2012 | ret = bond_release(bond_dev, slave_dev); | 1956 | ret = bond_release(bond_dev, slave_dev); |
2013 | if ((ret == 0) && (bond->slave_cnt == 0)) { | 1957 | if ((ret == 0) && (bond->slave_cnt == 0)) { |
2014 | pr_info(DRV_NAME ": %s: destroying bond %s.\n", | 1958 | pr_info("%s: destroying bond %s.\n", |
2015 | bond_dev->name, bond_dev->name); | 1959 | bond_dev->name, bond_dev->name); |
2016 | unregister_netdevice(bond_dev); | 1960 | unregister_netdevice(bond_dev); |
2017 | } | 1961 | } |
2018 | return ret; | 1962 | return ret; |
@@ -2116,19 +2060,13 @@ static int bond_release_all(struct net_device *bond_dev) | |||
2116 | if (list_empty(&bond->vlan_list)) | 2060 | if (list_empty(&bond->vlan_list)) |
2117 | bond_dev->features |= NETIF_F_VLAN_CHALLENGED; | 2061 | bond_dev->features |= NETIF_F_VLAN_CHALLENGED; |
2118 | else { | 2062 | else { |
2119 | pr_warning(DRV_NAME | 2063 | pr_warning("%s: Warning: clearing HW address of %s while it still has VLANs.\n", |
2120 | ": %s: Warning: clearing HW address of %s while it " | 2064 | bond_dev->name, bond_dev->name); |
2121 | "still has VLANs.\n", | 2065 | pr_warning("%s: When re-adding slaves, make sure the bond's HW address matches its VLANs'.\n", |
2122 | bond_dev->name, bond_dev->name); | 2066 | bond_dev->name); |
2123 | pr_warning(DRV_NAME | ||
2124 | ": %s: When re-adding slaves, make sure the bond's " | ||
2125 | "HW address matches its VLANs'.\n", | ||
2126 | bond_dev->name); | ||
2127 | } | 2067 | } |
2128 | 2068 | ||
2129 | pr_info(DRV_NAME | 2069 | pr_info("%s: released all slaves\n", bond_dev->name); |
2130 | ": %s: released all slaves\n", | ||
2131 | bond_dev->name); | ||
2132 | 2070 | ||
2133 | out: | 2071 | out: |
2134 | write_unlock_bh(&bond->lock); | 2072 | write_unlock_bh(&bond->lock); |
@@ -2254,16 +2192,14 @@ static int bond_miimon_inspect(struct bonding *bond) | |||
2254 | slave->link = BOND_LINK_FAIL; | 2192 | slave->link = BOND_LINK_FAIL; |
2255 | slave->delay = bond->params.downdelay; | 2193 | slave->delay = bond->params.downdelay; |
2256 | if (slave->delay) { | 2194 | if (slave->delay) { |
2257 | pr_info(DRV_NAME | 2195 | pr_info("%s: link status down for %sinterface %s, disabling it in %d ms.\n", |
2258 | ": %s: link status down for %s" | 2196 | bond->dev->name, |
2259 | "interface %s, disabling it in %d ms.\n", | 2197 | (bond->params.mode == |
2260 | bond->dev->name, | 2198 | BOND_MODE_ACTIVEBACKUP) ? |
2261 | (bond->params.mode == | 2199 | ((slave->state == BOND_STATE_ACTIVE) ? |
2262 | BOND_MODE_ACTIVEBACKUP) ? | 2200 | "active " : "backup ") : "", |
2263 | ((slave->state == BOND_STATE_ACTIVE) ? | 2201 | slave->dev->name, |
2264 | "active " : "backup ") : "", | 2202 | bond->params.downdelay * bond->params.miimon); |
2265 | slave->dev->name, | ||
2266 | bond->params.downdelay * bond->params.miimon); | ||
2267 | } | 2203 | } |
2268 | /*FALLTHRU*/ | 2204 | /*FALLTHRU*/ |
2269 | case BOND_LINK_FAIL: | 2205 | case BOND_LINK_FAIL: |
@@ -2273,13 +2209,11 @@ static int bond_miimon_inspect(struct bonding *bond) | |||
2273 | */ | 2209 | */ |
2274 | slave->link = BOND_LINK_UP; | 2210 | slave->link = BOND_LINK_UP; |
2275 | slave->jiffies = jiffies; | 2211 | slave->jiffies = jiffies; |
2276 | pr_info(DRV_NAME | 2212 | pr_info("%s: link status up again after %d ms for interface %s.\n", |
2277 | ": %s: link status up again after %d " | 2213 | bond->dev->name, |
2278 | "ms for interface %s.\n", | 2214 | (bond->params.downdelay - slave->delay) * |
2279 | bond->dev->name, | 2215 | bond->params.miimon, |
2280 | (bond->params.downdelay - slave->delay) * | 2216 | slave->dev->name); |
2281 | bond->params.miimon, | ||
2282 | slave->dev->name); | ||
2283 | continue; | 2217 | continue; |
2284 | } | 2218 | } |
2285 | 2219 | ||
@@ -2300,25 +2234,21 @@ static int bond_miimon_inspect(struct bonding *bond) | |||
2300 | slave->delay = bond->params.updelay; | 2234 | slave->delay = bond->params.updelay; |
2301 | 2235 | ||
2302 | if (slave->delay) { | 2236 | if (slave->delay) { |
2303 | pr_info(DRV_NAME | 2237 | pr_info("%s: link status up for interface %s, enabling it in %d ms.\n", |
2304 | ": %s: link status up for " | 2238 | bond->dev->name, slave->dev->name, |
2305 | "interface %s, enabling it in %d ms.\n", | 2239 | ignore_updelay ? 0 : |
2306 | bond->dev->name, slave->dev->name, | 2240 | bond->params.updelay * |
2307 | ignore_updelay ? 0 : | 2241 | bond->params.miimon); |
2308 | bond->params.updelay * | ||
2309 | bond->params.miimon); | ||
2310 | } | 2242 | } |
2311 | /*FALLTHRU*/ | 2243 | /*FALLTHRU*/ |
2312 | case BOND_LINK_BACK: | 2244 | case BOND_LINK_BACK: |
2313 | if (!link_state) { | 2245 | if (!link_state) { |
2314 | slave->link = BOND_LINK_DOWN; | 2246 | slave->link = BOND_LINK_DOWN; |
2315 | pr_info(DRV_NAME | 2247 | pr_info("%s: link status down again after %d ms for interface %s.\n", |
2316 | ": %s: link status down again after %d " | 2248 | bond->dev->name, |
2317 | "ms for interface %s.\n", | 2249 | (bond->params.updelay - slave->delay) * |
2318 | bond->dev->name, | 2250 | bond->params.miimon, |
2319 | (bond->params.updelay - slave->delay) * | 2251 | slave->dev->name); |
2320 | bond->params.miimon, | ||
2321 | slave->dev->name); | ||
2322 | 2252 | ||
2323 | continue; | 2253 | continue; |
2324 | } | 2254 | } |
@@ -2366,10 +2296,8 @@ static void bond_miimon_commit(struct bonding *bond) | |||
2366 | slave->state = BOND_STATE_BACKUP; | 2296 | slave->state = BOND_STATE_BACKUP; |
2367 | } | 2297 | } |
2368 | 2298 | ||
2369 | pr_info(DRV_NAME | 2299 | pr_info("%s: link status definitely up for interface %s.\n", |
2370 | ": %s: link status definitely " | 2300 | bond->dev->name, slave->dev->name); |
2371 | "up for interface %s.\n", | ||
2372 | bond->dev->name, slave->dev->name); | ||
2373 | 2301 | ||
2374 | /* notify ad that the link status has changed */ | 2302 | /* notify ad that the link status has changed */ |
2375 | if (bond->params.mode == BOND_MODE_8023AD) | 2303 | if (bond->params.mode == BOND_MODE_8023AD) |
@@ -2395,10 +2323,8 @@ static void bond_miimon_commit(struct bonding *bond) | |||
2395 | bond->params.mode == BOND_MODE_8023AD) | 2323 | bond->params.mode == BOND_MODE_8023AD) |
2396 | bond_set_slave_inactive_flags(slave); | 2324 | bond_set_slave_inactive_flags(slave); |
2397 | 2325 | ||
2398 | pr_info(DRV_NAME | 2326 | pr_info("%s: link status definitely down for interface %s, disabling it\n", |
2399 | ": %s: link status definitely down for " | 2327 | bond->dev->name, slave->dev->name); |
2400 | "interface %s, disabling it\n", | ||
2401 | bond->dev->name, slave->dev->name); | ||
2402 | 2328 | ||
2403 | if (bond->params.mode == BOND_MODE_8023AD) | 2329 | if (bond->params.mode == BOND_MODE_8023AD) |
2404 | bond_3ad_handle_link_change(slave, | 2330 | bond_3ad_handle_link_change(slave, |
@@ -2414,8 +2340,7 @@ static void bond_miimon_commit(struct bonding *bond) | |||
2414 | continue; | 2340 | continue; |
2415 | 2341 | ||
2416 | default: | 2342 | default: |
2417 | pr_err(DRV_NAME | 2343 | pr_err("%s: invalid new link %d on slave %s\n", |
2418 | ": %s: invalid new link %d on slave %s\n", | ||
2419 | bond->dev->name, slave->new_link, | 2344 | bond->dev->name, slave->new_link, |
2420 | slave->dev->name); | 2345 | slave->dev->name); |
2421 | slave->new_link = BOND_LINK_NOCHANGE; | 2346 | slave->new_link = BOND_LINK_NOCHANGE; |
@@ -2534,19 +2459,19 @@ static void bond_arp_send(struct net_device *slave_dev, int arp_op, __be32 dest_ | |||
2534 | struct sk_buff *skb; | 2459 | struct sk_buff *skb; |
2535 | 2460 | ||
2536 | pr_debug("arp %d on slave %s: dst %x src %x vid %d\n", arp_op, | 2461 | pr_debug("arp %d on slave %s: dst %x src %x vid %d\n", arp_op, |
2537 | slave_dev->name, dest_ip, src_ip, vlan_id); | 2462 | slave_dev->name, dest_ip, src_ip, vlan_id); |
2538 | 2463 | ||
2539 | skb = arp_create(arp_op, ETH_P_ARP, dest_ip, slave_dev, src_ip, | 2464 | skb = arp_create(arp_op, ETH_P_ARP, dest_ip, slave_dev, src_ip, |
2540 | NULL, slave_dev->dev_addr, NULL); | 2465 | NULL, slave_dev->dev_addr, NULL); |
2541 | 2466 | ||
2542 | if (!skb) { | 2467 | if (!skb) { |
2543 | pr_err(DRV_NAME ": ARP packet allocation failed\n"); | 2468 | pr_err("ARP packet allocation failed\n"); |
2544 | return; | 2469 | return; |
2545 | } | 2470 | } |
2546 | if (vlan_id) { | 2471 | if (vlan_id) { |
2547 | skb = vlan_put_tag(skb, vlan_id); | 2472 | skb = vlan_put_tag(skb, vlan_id); |
2548 | if (!skb) { | 2473 | if (!skb) { |
2549 | pr_err(DRV_NAME ": failed to insert VLAN tag\n"); | 2474 | pr_err("failed to insert VLAN tag\n"); |
2550 | return; | 2475 | return; |
2551 | } | 2476 | } |
2552 | } | 2477 | } |
@@ -2586,9 +2511,8 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave) | |||
2586 | rv = ip_route_output_key(dev_net(bond->dev), &rt, &fl); | 2511 | rv = ip_route_output_key(dev_net(bond->dev), &rt, &fl); |
2587 | if (rv) { | 2512 | if (rv) { |
2588 | if (net_ratelimit()) { | 2513 | if (net_ratelimit()) { |
2589 | pr_warning(DRV_NAME | 2514 | pr_warning("%s: no route to arp_ip_target %pI4\n", |
2590 | ": %s: no route to arp_ip_target %pI4\n", | 2515 | bond->dev->name, &fl.fl4_dst); |
2591 | bond->dev->name, &fl.fl4_dst); | ||
2592 | } | 2516 | } |
2593 | continue; | 2517 | continue; |
2594 | } | 2518 | } |
@@ -2623,10 +2547,9 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave) | |||
2623 | } | 2547 | } |
2624 | 2548 | ||
2625 | if (net_ratelimit()) { | 2549 | if (net_ratelimit()) { |
2626 | pr_warning(DRV_NAME | 2550 | pr_warning("%s: no path to arp_ip_target %pI4 via rt.dev %s\n", |
2627 | ": %s: no path to arp_ip_target %pI4 via rt.dev %s\n", | 2551 | bond->dev->name, &fl.fl4_dst, |
2628 | bond->dev->name, &fl.fl4_dst, | 2552 | rt->u.dst.dev ? rt->u.dst.dev->name : "NULL"); |
2629 | rt->u.dst.dev ? rt->u.dst.dev->name : "NULL"); | ||
2630 | } | 2553 | } |
2631 | ip_rt_put(rt); | 2554 | ip_rt_put(rt); |
2632 | } | 2555 | } |
@@ -2644,8 +2567,8 @@ static void bond_send_gratuitous_arp(struct bonding *bond) | |||
2644 | struct vlan_entry *vlan; | 2567 | struct vlan_entry *vlan; |
2645 | struct net_device *vlan_dev; | 2568 | struct net_device *vlan_dev; |
2646 | 2569 | ||
2647 | pr_debug("bond_send_grat_arp: bond %s slave %s\n", bond->dev->name, | 2570 | pr_debug("bond_send_grat_arp: bond %s slave %s\n", |
2648 | slave ? slave->dev->name : "NULL"); | 2571 | bond->dev->name, slave ? slave->dev->name : "NULL"); |
2649 | 2572 | ||
2650 | if (!slave || !bond->send_grat_arp || | 2573 | if (!slave || !bond->send_grat_arp || |
2651 | test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state)) | 2574 | test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state)) |
@@ -2674,7 +2597,8 @@ static void bond_validate_arp(struct bonding *bond, struct slave *slave, __be32 | |||
2674 | 2597 | ||
2675 | for (i = 0; (i < BOND_MAX_ARP_TARGETS) && targets[i]; i++) { | 2598 | for (i = 0; (i < BOND_MAX_ARP_TARGETS) && targets[i]; i++) { |
2676 | pr_debug("bva: sip %pI4 tip %pI4 t[%d] %pI4 bhti(tip) %d\n", | 2599 | pr_debug("bva: sip %pI4 tip %pI4 t[%d] %pI4 bhti(tip) %d\n", |
2677 | &sip, &tip, i, &targets[i], bond_has_this_ip(bond, tip)); | 2600 | &sip, &tip, i, &targets[i], |
2601 | bond_has_this_ip(bond, tip)); | ||
2678 | if (sip == targets[i]) { | 2602 | if (sip == targets[i]) { |
2679 | if (bond_has_this_ip(bond, tip)) | 2603 | if (bond_has_this_ip(bond, tip)) |
2680 | slave->last_arp_rx = jiffies; | 2604 | slave->last_arp_rx = jiffies; |
@@ -2698,8 +2622,8 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack | |||
2698 | read_lock(&bond->lock); | 2622 | read_lock(&bond->lock); |
2699 | 2623 | ||
2700 | pr_debug("bond_arp_rcv: bond %s skb->dev %s orig_dev %s\n", | 2624 | pr_debug("bond_arp_rcv: bond %s skb->dev %s orig_dev %s\n", |
2701 | bond->dev->name, skb->dev ? skb->dev->name : "NULL", | 2625 | bond->dev->name, skb->dev ? skb->dev->name : "NULL", |
2702 | orig_dev ? orig_dev->name : "NULL"); | 2626 | orig_dev ? orig_dev->name : "NULL"); |
2703 | 2627 | ||
2704 | slave = bond_get_slave_by_dev(bond, orig_dev); | 2628 | slave = bond_get_slave_by_dev(bond, orig_dev); |
2705 | if (!slave || !slave_do_arp_validate(bond, slave)) | 2629 | if (!slave || !slave_do_arp_validate(bond, slave)) |
@@ -2724,9 +2648,9 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack | |||
2724 | memcpy(&tip, arp_ptr, 4); | 2648 | memcpy(&tip, arp_ptr, 4); |
2725 | 2649 | ||
2726 | pr_debug("bond_arp_rcv: %s %s/%d av %d sv %d sip %pI4 tip %pI4\n", | 2650 | pr_debug("bond_arp_rcv: %s %s/%d av %d sv %d sip %pI4 tip %pI4\n", |
2727 | bond->dev->name, slave->dev->name, slave->state, | 2651 | bond->dev->name, slave->dev->name, slave->state, |
2728 | bond->params.arp_validate, slave_do_arp_validate(bond, slave), | 2652 | bond->params.arp_validate, slave_do_arp_validate(bond, slave), |
2729 | &sip, &tip); | 2653 | &sip, &tip); |
2730 | 2654 | ||
2731 | /* | 2655 | /* |
2732 | * Backup slaves won't see the ARP reply, but do come through | 2656 | * Backup slaves won't see the ARP reply, but do come through |
@@ -2800,17 +2724,14 @@ void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2800 | * is closed. | 2724 | * is closed. |
2801 | */ | 2725 | */ |
2802 | if (!oldcurrent) { | 2726 | if (!oldcurrent) { |
2803 | pr_info(DRV_NAME | 2727 | pr_info("%s: link status definitely up for interface %s, ", |
2804 | ": %s: link status definitely " | 2728 | bond->dev->name, |
2805 | "up for interface %s, ", | 2729 | slave->dev->name); |
2806 | bond->dev->name, | ||
2807 | slave->dev->name); | ||
2808 | do_failover = 1; | 2730 | do_failover = 1; |
2809 | } else { | 2731 | } else { |
2810 | pr_info(DRV_NAME | 2732 | pr_info("%s: interface %s is now up\n", |
2811 | ": %s: interface %s is now up\n", | 2733 | bond->dev->name, |
2812 | bond->dev->name, | 2734 | slave->dev->name); |
2813 | slave->dev->name); | ||
2814 | } | 2735 | } |
2815 | } | 2736 | } |
2816 | } else { | 2737 | } else { |
@@ -2829,10 +2750,9 @@ void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2829 | if (slave->link_failure_count < UINT_MAX) | 2750 | if (slave->link_failure_count < UINT_MAX) |
2830 | slave->link_failure_count++; | 2751 | slave->link_failure_count++; |
2831 | 2752 | ||
2832 | pr_info(DRV_NAME | 2753 | pr_info("%s: interface %s is now down.\n", |
2833 | ": %s: interface %s is now down.\n", | 2754 | bond->dev->name, |
2834 | bond->dev->name, | 2755 | slave->dev->name); |
2835 | slave->dev->name); | ||
2836 | 2756 | ||
2837 | if (slave == oldcurrent) | 2757 | if (slave == oldcurrent) |
2838 | do_failover = 1; | 2758 | do_failover = 1; |
@@ -2965,9 +2885,7 @@ static void bond_ab_arp_commit(struct bonding *bond, int delta_in_ticks) | |||
2965 | slave->link = BOND_LINK_UP; | 2885 | slave->link = BOND_LINK_UP; |
2966 | bond->current_arp_slave = NULL; | 2886 | bond->current_arp_slave = NULL; |
2967 | 2887 | ||
2968 | pr_info(DRV_NAME | 2888 | pr_info("%s: link status definitely up for interface %s.\n", |
2969 | ": %s: link status definitely " | ||
2970 | "up for interface %s.\n", | ||
2971 | bond->dev->name, slave->dev->name); | 2889 | bond->dev->name, slave->dev->name); |
2972 | 2890 | ||
2973 | if (!bond->curr_active_slave || | 2891 | if (!bond->curr_active_slave || |
@@ -2985,9 +2903,7 @@ static void bond_ab_arp_commit(struct bonding *bond, int delta_in_ticks) | |||
2985 | slave->link = BOND_LINK_DOWN; | 2903 | slave->link = BOND_LINK_DOWN; |
2986 | bond_set_slave_inactive_flags(slave); | 2904 | bond_set_slave_inactive_flags(slave); |
2987 | 2905 | ||
2988 | pr_info(DRV_NAME | 2906 | pr_info("%s: link status definitely down for interface %s, disabling it\n", |
2989 | ": %s: link status definitely down for " | ||
2990 | "interface %s, disabling it\n", | ||
2991 | bond->dev->name, slave->dev->name); | 2907 | bond->dev->name, slave->dev->name); |
2992 | 2908 | ||
2993 | if (slave == bond->curr_active_slave) { | 2909 | if (slave == bond->curr_active_slave) { |
@@ -2998,8 +2914,7 @@ static void bond_ab_arp_commit(struct bonding *bond, int delta_in_ticks) | |||
2998 | continue; | 2914 | continue; |
2999 | 2915 | ||
3000 | default: | 2916 | default: |
3001 | pr_err(DRV_NAME | 2917 | pr_err("%s: impossible: new_link %d on slave %s\n", |
3002 | ": %s: impossible: new_link %d on slave %s\n", | ||
3003 | bond->dev->name, slave->new_link, | 2918 | bond->dev->name, slave->new_link, |
3004 | slave->dev->name); | 2919 | slave->dev->name); |
3005 | continue; | 2920 | continue; |
@@ -3028,9 +2943,9 @@ static void bond_ab_arp_probe(struct bonding *bond) | |||
3028 | read_lock(&bond->curr_slave_lock); | 2943 | read_lock(&bond->curr_slave_lock); |
3029 | 2944 | ||
3030 | if (bond->current_arp_slave && bond->curr_active_slave) | 2945 | if (bond->current_arp_slave && bond->curr_active_slave) |
3031 | pr_info(DRV_NAME "PROBE: c_arp %s && cas %s BAD\n", | 2946 | pr_info("PROBE: c_arp %s && cas %s BAD\n", |
3032 | bond->current_arp_slave->dev->name, | 2947 | bond->current_arp_slave->dev->name, |
3033 | bond->curr_active_slave->dev->name); | 2948 | bond->curr_active_slave->dev->name); |
3034 | 2949 | ||
3035 | if (bond->curr_active_slave) { | 2950 | if (bond->curr_active_slave) { |
3036 | bond_arp_send_all(bond, bond->curr_active_slave); | 2951 | bond_arp_send_all(bond, bond->curr_active_slave); |
@@ -3078,9 +2993,8 @@ static void bond_ab_arp_probe(struct bonding *bond) | |||
3078 | 2993 | ||
3079 | bond_set_slave_inactive_flags(slave); | 2994 | bond_set_slave_inactive_flags(slave); |
3080 | 2995 | ||
3081 | pr_info(DRV_NAME | 2996 | pr_info("%s: backup interface %s is now down.\n", |
3082 | ": %s: backup interface %s is now down.\n", | 2997 | bond->dev->name, slave->dev->name); |
3083 | bond->dev->name, slave->dev->name); | ||
3084 | } | 2998 | } |
3085 | } | 2999 | } |
3086 | } | 3000 | } |
@@ -3360,9 +3274,8 @@ static void bond_create_proc_entry(struct bonding *bond) | |||
3360 | S_IRUGO, bn->proc_dir, | 3274 | S_IRUGO, bn->proc_dir, |
3361 | &bond_info_fops, bond); | 3275 | &bond_info_fops, bond); |
3362 | if (bond->proc_entry == NULL) | 3276 | if (bond->proc_entry == NULL) |
3363 | pr_warning(DRV_NAME | 3277 | pr_warning("Warning: Cannot create /proc/net/%s/%s\n", |
3364 | ": Warning: Cannot create /proc/net/%s/%s\n", | 3278 | DRV_NAME, bond_dev->name); |
3365 | DRV_NAME, bond_dev->name); | ||
3366 | else | 3279 | else |
3367 | memcpy(bond->proc_file_name, bond_dev->name, IFNAMSIZ); | 3280 | memcpy(bond->proc_file_name, bond_dev->name, IFNAMSIZ); |
3368 | } | 3281 | } |
@@ -3388,9 +3301,8 @@ static void bond_create_proc_dir(struct bond_net *bn) | |||
3388 | if (!bn->proc_dir) { | 3301 | if (!bn->proc_dir) { |
3389 | bn->proc_dir = proc_mkdir(DRV_NAME, bn->net->proc_net); | 3302 | bn->proc_dir = proc_mkdir(DRV_NAME, bn->net->proc_net); |
3390 | if (!bn->proc_dir) | 3303 | if (!bn->proc_dir) |
3391 | pr_warning(DRV_NAME | 3304 | pr_warning("Warning: cannot create /proc/net/%s\n", |
3392 | ": Warning: cannot create /proc/net/%s\n", | 3305 | DRV_NAME); |
3393 | DRV_NAME); | ||
3394 | } | 3306 | } |
3395 | } | 3307 | } |
3396 | 3308 | ||
@@ -3539,8 +3451,8 @@ static int bond_netdev_event(struct notifier_block *this, | |||
3539 | struct net_device *event_dev = (struct net_device *)ptr; | 3451 | struct net_device *event_dev = (struct net_device *)ptr; |
3540 | 3452 | ||
3541 | pr_debug("event_dev: %s, event: %lx\n", | 3453 | pr_debug("event_dev: %s, event: %lx\n", |
3542 | (event_dev ? event_dev->name : "None"), | 3454 | event_dev ? event_dev->name : "None", |
3543 | event); | 3455 | event); |
3544 | 3456 | ||
3545 | if (!(event_dev->priv_flags & IFF_BONDING)) | 3457 | if (!(event_dev->priv_flags & IFF_BONDING)) |
3546 | return NOTIFY_DONE; | 3458 | return NOTIFY_DONE; |
@@ -3875,8 +3787,7 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd | |||
3875 | struct mii_ioctl_data *mii = NULL; | 3787 | struct mii_ioctl_data *mii = NULL; |
3876 | int res = 0; | 3788 | int res = 0; |
3877 | 3789 | ||
3878 | pr_debug("bond_ioctl: master=%s, cmd=%d\n", | 3790 | pr_debug("bond_ioctl: master=%s, cmd=%d\n", bond_dev->name, cmd); |
3879 | bond_dev->name, cmd); | ||
3880 | 3791 | ||
3881 | switch (cmd) { | 3792 | switch (cmd) { |
3882 | case SIOCGMIIPHY: | 3793 | case SIOCGMIIPHY: |
@@ -3945,12 +3856,12 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd | |||
3945 | 3856 | ||
3946 | slave_dev = dev_get_by_name(dev_net(bond_dev), ifr->ifr_slave); | 3857 | slave_dev = dev_get_by_name(dev_net(bond_dev), ifr->ifr_slave); |
3947 | 3858 | ||
3948 | pr_debug("slave_dev=%p: \n", slave_dev); | 3859 | pr_debug("slave_dev=%p:\n", slave_dev); |
3949 | 3860 | ||
3950 | if (!slave_dev) | 3861 | if (!slave_dev) |
3951 | res = -ENODEV; | 3862 | res = -ENODEV; |
3952 | else { | 3863 | else { |
3953 | pr_debug("slave_dev->name=%s: \n", slave_dev->name); | 3864 | pr_debug("slave_dev->name=%s:\n", slave_dev->name); |
3954 | switch (cmd) { | 3865 | switch (cmd) { |
3955 | case BOND_ENSLAVE_OLD: | 3866 | case BOND_ENSLAVE_OLD: |
3956 | case SIOCBONDENSLAVE: | 3867 | case SIOCBONDENSLAVE: |
@@ -4059,7 +3970,7 @@ static int bond_change_mtu(struct net_device *bond_dev, int new_mtu) | |||
4059 | int i; | 3970 | int i; |
4060 | 3971 | ||
4061 | pr_debug("bond=%p, name=%s, new_mtu=%d\n", bond, | 3972 | pr_debug("bond=%p, name=%s, new_mtu=%d\n", bond, |
4062 | (bond_dev ? bond_dev->name : "None"), new_mtu); | 3973 | (bond_dev ? bond_dev->name : "None"), new_mtu); |
4063 | 3974 | ||
4064 | /* Can't hold bond->lock with bh disabled here since | 3975 | /* Can't hold bond->lock with bh disabled here since |
4065 | * some base drivers panic. On the other hand we can't | 3976 | * some base drivers panic. On the other hand we can't |
@@ -4077,8 +3988,10 @@ static int bond_change_mtu(struct net_device *bond_dev, int new_mtu) | |||
4077 | */ | 3988 | */ |
4078 | 3989 | ||
4079 | bond_for_each_slave(bond, slave, i) { | 3990 | bond_for_each_slave(bond, slave, i) { |
4080 | pr_debug("s %p s->p %p c_m %p\n", slave, | 3991 | pr_debug("s %p s->p %p c_m %p\n", |
4081 | slave->prev, slave->dev->netdev_ops->ndo_change_mtu); | 3992 | slave, |
3993 | slave->prev, | ||
3994 | slave->dev->netdev_ops->ndo_change_mtu); | ||
4082 | 3995 | ||
4083 | res = dev_set_mtu(slave->dev, new_mtu); | 3996 | res = dev_set_mtu(slave->dev, new_mtu); |
4084 | 3997 | ||
@@ -4108,8 +4021,8 @@ unwind: | |||
4108 | 4021 | ||
4109 | tmp_res = dev_set_mtu(slave->dev, bond_dev->mtu); | 4022 | tmp_res = dev_set_mtu(slave->dev, bond_dev->mtu); |
4110 | if (tmp_res) { | 4023 | if (tmp_res) { |
4111 | pr_debug("unwind err %d dev %s\n", tmp_res, | 4024 | pr_debug("unwind err %d dev %s\n", |
4112 | slave->dev->name); | 4025 | tmp_res, slave->dev->name); |
4113 | } | 4026 | } |
4114 | } | 4027 | } |
4115 | 4028 | ||
@@ -4135,7 +4048,8 @@ static int bond_set_mac_address(struct net_device *bond_dev, void *addr) | |||
4135 | return bond_alb_set_mac_address(bond_dev, addr); | 4048 | return bond_alb_set_mac_address(bond_dev, addr); |
4136 | 4049 | ||
4137 | 4050 | ||
4138 | pr_debug("bond=%p, name=%s\n", bond, (bond_dev ? bond_dev->name : "None")); | 4051 | pr_debug("bond=%p, name=%s\n", |
4052 | bond, bond_dev ? bond_dev->name : "None"); | ||
4139 | 4053 | ||
4140 | /* | 4054 | /* |
4141 | * If fail_over_mac is set to active, do nothing and return | 4055 | * If fail_over_mac is set to active, do nothing and return |
@@ -4200,8 +4114,8 @@ unwind: | |||
4200 | 4114 | ||
4201 | tmp_res = dev_set_mac_address(slave->dev, &tmp_sa); | 4115 | tmp_res = dev_set_mac_address(slave->dev, &tmp_sa); |
4202 | if (tmp_res) { | 4116 | if (tmp_res) { |
4203 | pr_debug("unwind err %d dev %s\n", tmp_res, | 4117 | pr_debug("unwind err %d dev %s\n", |
4204 | slave->dev->name); | 4118 | tmp_res, slave->dev->name); |
4205 | } | 4119 | } |
4206 | } | 4120 | } |
4207 | 4121 | ||
@@ -4357,9 +4271,7 @@ static int bond_xmit_broadcast(struct sk_buff *skb, struct net_device *bond_dev) | |||
4357 | if (tx_dev) { | 4271 | if (tx_dev) { |
4358 | struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC); | 4272 | struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC); |
4359 | if (!skb2) { | 4273 | if (!skb2) { |
4360 | pr_err(DRV_NAME | 4274 | pr_err("%s: Error: bond_xmit_broadcast(): skb_clone() failed\n", |
4361 | ": %s: Error: bond_xmit_broadcast(): " | ||
4362 | "skb_clone() failed\n", | ||
4363 | bond_dev->name); | 4275 | bond_dev->name); |
4364 | continue; | 4276 | continue; |
4365 | } | 4277 | } |
@@ -4425,8 +4337,8 @@ static netdev_tx_t bond_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
4425 | return bond_alb_xmit(skb, dev); | 4337 | return bond_alb_xmit(skb, dev); |
4426 | default: | 4338 | default: |
4427 | /* Should never happen, mode already checked */ | 4339 | /* Should never happen, mode already checked */ |
4428 | pr_err(DRV_NAME ": %s: Error: Unknown bonding mode %d\n", | 4340 | pr_err("%s: Error: Unknown bonding mode %d\n", |
4429 | dev->name, bond->params.mode); | 4341 | dev->name, bond->params.mode); |
4430 | WARN_ON_ONCE(1); | 4342 | WARN_ON_ONCE(1); |
4431 | dev_kfree_skb(skb); | 4343 | dev_kfree_skb(skb); |
4432 | return NETDEV_TX_OK; | 4344 | return NETDEV_TX_OK; |
@@ -4462,10 +4374,8 @@ void bond_set_mode_ops(struct bonding *bond, int mode) | |||
4462 | break; | 4374 | break; |
4463 | default: | 4375 | default: |
4464 | /* Should never happen, mode already checked */ | 4376 | /* Should never happen, mode already checked */ |
4465 | pr_err(DRV_NAME | 4377 | pr_err("%s: Error: Unknown bonding mode %d\n", |
4466 | ": %s: Error: Unknown bonding mode %d\n", | 4378 | bond_dev->name, mode); |
4467 | bond_dev->name, | ||
4468 | mode); | ||
4469 | break; | 4379 | break; |
4470 | } | 4380 | } |
4471 | } | 4381 | } |
@@ -4650,8 +4560,7 @@ static int bond_check_params(struct bond_params *params) | |||
4650 | if (mode) { | 4560 | if (mode) { |
4651 | bond_mode = bond_parse_parm(mode, bond_mode_tbl); | 4561 | bond_mode = bond_parse_parm(mode, bond_mode_tbl); |
4652 | if (bond_mode == -1) { | 4562 | if (bond_mode == -1) { |
4653 | pr_err(DRV_NAME | 4563 | pr_err("Error: Invalid bonding mode \"%s\"\n", |
4654 | ": Error: Invalid bonding mode \"%s\"\n", | ||
4655 | mode == NULL ? "NULL" : mode); | 4564 | mode == NULL ? "NULL" : mode); |
4656 | return -EINVAL; | 4565 | return -EINVAL; |
4657 | } | 4566 | } |
@@ -4660,16 +4569,13 @@ static int bond_check_params(struct bond_params *params) | |||
4660 | if (xmit_hash_policy) { | 4569 | if (xmit_hash_policy) { |
4661 | if ((bond_mode != BOND_MODE_XOR) && | 4570 | if ((bond_mode != BOND_MODE_XOR) && |
4662 | (bond_mode != BOND_MODE_8023AD)) { | 4571 | (bond_mode != BOND_MODE_8023AD)) { |
4663 | pr_info(DRV_NAME | 4572 | pr_info("xmit_hash_policy param is irrelevant in mode %s\n", |
4664 | ": xmit_hash_policy param is irrelevant in" | ||
4665 | " mode %s\n", | ||
4666 | bond_mode_name(bond_mode)); | 4573 | bond_mode_name(bond_mode)); |
4667 | } else { | 4574 | } else { |
4668 | xmit_hashtype = bond_parse_parm(xmit_hash_policy, | 4575 | xmit_hashtype = bond_parse_parm(xmit_hash_policy, |
4669 | xmit_hashtype_tbl); | 4576 | xmit_hashtype_tbl); |
4670 | if (xmit_hashtype == -1) { | 4577 | if (xmit_hashtype == -1) { |
4671 | pr_err(DRV_NAME | 4578 | pr_err("Error: Invalid xmit_hash_policy \"%s\"\n", |
4672 | ": Error: Invalid xmit_hash_policy \"%s\"\n", | ||
4673 | xmit_hash_policy == NULL ? "NULL" : | 4579 | xmit_hash_policy == NULL ? "NULL" : |
4674 | xmit_hash_policy); | 4580 | xmit_hash_policy); |
4675 | return -EINVAL; | 4581 | return -EINVAL; |
@@ -4679,14 +4585,12 @@ static int bond_check_params(struct bond_params *params) | |||
4679 | 4585 | ||
4680 | if (lacp_rate) { | 4586 | if (lacp_rate) { |
4681 | if (bond_mode != BOND_MODE_8023AD) { | 4587 | if (bond_mode != BOND_MODE_8023AD) { |
4682 | pr_info(DRV_NAME | 4588 | pr_info("lacp_rate param is irrelevant in mode %s\n", |
4683 | ": lacp_rate param is irrelevant in mode %s\n", | 4589 | bond_mode_name(bond_mode)); |
4684 | bond_mode_name(bond_mode)); | ||
4685 | } else { | 4590 | } else { |
4686 | lacp_fast = bond_parse_parm(lacp_rate, bond_lacp_tbl); | 4591 | lacp_fast = bond_parse_parm(lacp_rate, bond_lacp_tbl); |
4687 | if (lacp_fast == -1) { | 4592 | if (lacp_fast == -1) { |
4688 | pr_err(DRV_NAME | 4593 | pr_err("Error: Invalid lacp rate \"%s\"\n", |
4689 | ": Error: Invalid lacp rate \"%s\"\n", | ||
4690 | lacp_rate == NULL ? "NULL" : lacp_rate); | 4594 | lacp_rate == NULL ? "NULL" : lacp_rate); |
4691 | return -EINVAL; | 4595 | return -EINVAL; |
4692 | } | 4596 | } |
@@ -4696,82 +4600,64 @@ static int bond_check_params(struct bond_params *params) | |||
4696 | if (ad_select) { | 4600 | if (ad_select) { |
4697 | params->ad_select = bond_parse_parm(ad_select, ad_select_tbl); | 4601 | params->ad_select = bond_parse_parm(ad_select, ad_select_tbl); |
4698 | if (params->ad_select == -1) { | 4602 | if (params->ad_select == -1) { |
4699 | pr_err(DRV_NAME | 4603 | pr_err("Error: Invalid ad_select \"%s\"\n", |
4700 | ": Error: Invalid ad_select \"%s\"\n", | ||
4701 | ad_select == NULL ? "NULL" : ad_select); | 4604 | ad_select == NULL ? "NULL" : ad_select); |
4702 | return -EINVAL; | 4605 | return -EINVAL; |
4703 | } | 4606 | } |
4704 | 4607 | ||
4705 | if (bond_mode != BOND_MODE_8023AD) { | 4608 | if (bond_mode != BOND_MODE_8023AD) { |
4706 | pr_warning(DRV_NAME | 4609 | pr_warning("ad_select param only affects 802.3ad mode\n"); |
4707 | ": ad_select param only affects 802.3ad mode\n"); | ||
4708 | } | 4610 | } |
4709 | } else { | 4611 | } else { |
4710 | params->ad_select = BOND_AD_STABLE; | 4612 | params->ad_select = BOND_AD_STABLE; |
4711 | } | 4613 | } |
4712 | 4614 | ||
4713 | if (max_bonds < 0) { | 4615 | if (max_bonds < 0) { |
4714 | pr_warning(DRV_NAME | 4616 | pr_warning("Warning: max_bonds (%d) not in range %d-%d, so it was reset to BOND_DEFAULT_MAX_BONDS (%d)\n", |
4715 | ": Warning: max_bonds (%d) not in range %d-%d, so it " | 4617 | max_bonds, 0, INT_MAX, BOND_DEFAULT_MAX_BONDS); |
4716 | "was reset to BOND_DEFAULT_MAX_BONDS (%d)\n", | ||
4717 | max_bonds, 0, INT_MAX, BOND_DEFAULT_MAX_BONDS); | ||
4718 | max_bonds = BOND_DEFAULT_MAX_BONDS; | 4618 | max_bonds = BOND_DEFAULT_MAX_BONDS; |
4719 | } | 4619 | } |
4720 | 4620 | ||
4721 | if (miimon < 0) { | 4621 | if (miimon < 0) { |
4722 | pr_warning(DRV_NAME | 4622 | pr_warning("Warning: miimon module parameter (%d), not in range 0-%d, so it was reset to %d\n", |
4723 | ": Warning: miimon module parameter (%d), " | 4623 | miimon, INT_MAX, BOND_LINK_MON_INTERV); |
4724 | "not in range 0-%d, so it was reset to %d\n", | ||
4725 | miimon, INT_MAX, BOND_LINK_MON_INTERV); | ||
4726 | miimon = BOND_LINK_MON_INTERV; | 4624 | miimon = BOND_LINK_MON_INTERV; |
4727 | } | 4625 | } |
4728 | 4626 | ||
4729 | if (updelay < 0) { | 4627 | if (updelay < 0) { |
4730 | pr_warning(DRV_NAME | 4628 | pr_warning("Warning: updelay module parameter (%d), not in range 0-%d, so it was reset to 0\n", |
4731 | ": Warning: updelay module parameter (%d), " | 4629 | updelay, INT_MAX); |
4732 | "not in range 0-%d, so it was reset to 0\n", | ||
4733 | updelay, INT_MAX); | ||
4734 | updelay = 0; | 4630 | updelay = 0; |
4735 | } | 4631 | } |
4736 | 4632 | ||
4737 | if (downdelay < 0) { | 4633 | if (downdelay < 0) { |
4738 | pr_warning(DRV_NAME | 4634 | pr_warning("Warning: downdelay module parameter (%d), not in range 0-%d, so it was reset to 0\n", |
4739 | ": Warning: downdelay module parameter (%d), " | 4635 | downdelay, INT_MAX); |
4740 | "not in range 0-%d, so it was reset to 0\n", | ||
4741 | downdelay, INT_MAX); | ||
4742 | downdelay = 0; | 4636 | downdelay = 0; |
4743 | } | 4637 | } |
4744 | 4638 | ||
4745 | if ((use_carrier != 0) && (use_carrier != 1)) { | 4639 | if ((use_carrier != 0) && (use_carrier != 1)) { |
4746 | pr_warning(DRV_NAME | 4640 | pr_warning("Warning: use_carrier module parameter (%d), not of valid value (0/1), so it was set to 1\n", |
4747 | ": Warning: use_carrier module parameter (%d), " | 4641 | use_carrier); |
4748 | "not of valid value (0/1), so it was set to 1\n", | ||
4749 | use_carrier); | ||
4750 | use_carrier = 1; | 4642 | use_carrier = 1; |
4751 | } | 4643 | } |
4752 | 4644 | ||
4753 | if (num_grat_arp < 0 || num_grat_arp > 255) { | 4645 | if (num_grat_arp < 0 || num_grat_arp > 255) { |
4754 | pr_warning(DRV_NAME | 4646 | pr_warning("Warning: num_grat_arp (%d) not in range 0-255 so it was reset to 1 \n", |
4755 | ": Warning: num_grat_arp (%d) not in range 0-255 so it " | 4647 | num_grat_arp); |
4756 | "was reset to 1 \n", num_grat_arp); | ||
4757 | num_grat_arp = 1; | 4648 | num_grat_arp = 1; |
4758 | } | 4649 | } |
4759 | 4650 | ||
4760 | if (num_unsol_na < 0 || num_unsol_na > 255) { | 4651 | if (num_unsol_na < 0 || num_unsol_na > 255) { |
4761 | pr_warning(DRV_NAME | 4652 | pr_warning("Warning: num_unsol_na (%d) not in range 0-255 so it was reset to 1 \n", |
4762 | ": Warning: num_unsol_na (%d) not in range 0-255 so it " | 4653 | num_unsol_na); |
4763 | "was reset to 1 \n", num_unsol_na); | ||
4764 | num_unsol_na = 1; | 4654 | num_unsol_na = 1; |
4765 | } | 4655 | } |
4766 | 4656 | ||
4767 | /* reset values for 802.3ad */ | 4657 | /* reset values for 802.3ad */ |
4768 | if (bond_mode == BOND_MODE_8023AD) { | 4658 | if (bond_mode == BOND_MODE_8023AD) { |
4769 | if (!miimon) { | 4659 | if (!miimon) { |
4770 | pr_warning(DRV_NAME | 4660 | pr_warning("Warning: miimon must be specified, otherwise bonding will not detect link failure, speed and duplex which are essential for 802.3ad operation\n"); |
4771 | ": Warning: miimon must be specified, " | ||
4772 | "otherwise bonding will not detect link " | ||
4773 | "failure, speed and duplex which are " | ||
4774 | "essential for 802.3ad operation\n"); | ||
4775 | pr_warning("Forcing miimon to 100msec\n"); | 4661 | pr_warning("Forcing miimon to 100msec\n"); |
4776 | miimon = 100; | 4662 | miimon = 100; |
4777 | } | 4663 | } |
@@ -4781,24 +4667,15 @@ static int bond_check_params(struct bond_params *params) | |||
4781 | if ((bond_mode == BOND_MODE_TLB) || | 4667 | if ((bond_mode == BOND_MODE_TLB) || |
4782 | (bond_mode == BOND_MODE_ALB)) { | 4668 | (bond_mode == BOND_MODE_ALB)) { |
4783 | if (!miimon) { | 4669 | if (!miimon) { |
4784 | pr_warning(DRV_NAME | 4670 | pr_warning("Warning: miimon must be specified, otherwise bonding will not detect link failure and link speed which are essential for TLB/ALB load balancing\n"); |
4785 | ": Warning: miimon must be specified, " | ||
4786 | "otherwise bonding will not detect link " | ||
4787 | "failure and link speed which are essential " | ||
4788 | "for TLB/ALB load balancing\n"); | ||
4789 | pr_warning("Forcing miimon to 100msec\n"); | 4671 | pr_warning("Forcing miimon to 100msec\n"); |
4790 | miimon = 100; | 4672 | miimon = 100; |
4791 | } | 4673 | } |
4792 | } | 4674 | } |
4793 | 4675 | ||
4794 | if (bond_mode == BOND_MODE_ALB) { | 4676 | if (bond_mode == BOND_MODE_ALB) { |
4795 | pr_notice(DRV_NAME | 4677 | pr_notice("In ALB mode you might experience client disconnections upon reconnection of a link if the bonding module updelay parameter (%d msec) is incompatible with the forwarding delay time of the switch\n", |
4796 | ": In ALB mode you might experience client " | 4678 | updelay); |
4797 | "disconnections upon reconnection of a link if the " | ||
4798 | "bonding module updelay parameter (%d msec) is " | ||
4799 | "incompatible with the forwarding delay time of the " | ||
4800 | "switch\n", | ||
4801 | updelay); | ||
4802 | } | 4679 | } |
4803 | 4680 | ||
4804 | if (!miimon) { | 4681 | if (!miimon) { |
@@ -4806,49 +4683,37 @@ static int bond_check_params(struct bond_params *params) | |||
4806 | /* just warn the user the up/down delay will have | 4683 | /* just warn the user the up/down delay will have |
4807 | * no effect since miimon is zero... | 4684 | * no effect since miimon is zero... |
4808 | */ | 4685 | */ |
4809 | pr_warning(DRV_NAME | 4686 | pr_warning("Warning: miimon module parameter not set and updelay (%d) or downdelay (%d) module parameter is set; updelay and downdelay have no effect unless miimon is set\n", |
4810 | ": Warning: miimon module parameter not set " | 4687 | updelay, downdelay); |
4811 | "and updelay (%d) or downdelay (%d) module " | ||
4812 | "parameter is set; updelay and downdelay have " | ||
4813 | "no effect unless miimon is set\n", | ||
4814 | updelay, downdelay); | ||
4815 | } | 4688 | } |
4816 | } else { | 4689 | } else { |
4817 | /* don't allow arp monitoring */ | 4690 | /* don't allow arp monitoring */ |
4818 | if (arp_interval) { | 4691 | if (arp_interval) { |
4819 | pr_warning(DRV_NAME | 4692 | pr_warning("Warning: miimon (%d) and arp_interval (%d) can't be used simultaneously, disabling ARP monitoring\n", |
4820 | ": Warning: miimon (%d) and arp_interval (%d) " | 4693 | miimon, arp_interval); |
4821 | "can't be used simultaneously, disabling ARP " | ||
4822 | "monitoring\n", | ||
4823 | miimon, arp_interval); | ||
4824 | arp_interval = 0; | 4694 | arp_interval = 0; |
4825 | } | 4695 | } |
4826 | 4696 | ||
4827 | if ((updelay % miimon) != 0) { | 4697 | if ((updelay % miimon) != 0) { |
4828 | pr_warning(DRV_NAME | 4698 | pr_warning("Warning: updelay (%d) is not a multiple of miimon (%d), updelay rounded to %d ms\n", |
4829 | ": Warning: updelay (%d) is not a multiple " | 4699 | updelay, miimon, |
4830 | "of miimon (%d), updelay rounded to %d ms\n", | 4700 | (updelay / miimon) * miimon); |
4831 | updelay, miimon, (updelay / miimon) * miimon); | ||
4832 | } | 4701 | } |
4833 | 4702 | ||
4834 | updelay /= miimon; | 4703 | updelay /= miimon; |
4835 | 4704 | ||
4836 | if ((downdelay % miimon) != 0) { | 4705 | if ((downdelay % miimon) != 0) { |
4837 | pr_warning(DRV_NAME | 4706 | pr_warning("Warning: downdelay (%d) is not a multiple of miimon (%d), downdelay rounded to %d ms\n", |
4838 | ": Warning: downdelay (%d) is not a multiple " | 4707 | downdelay, miimon, |
4839 | "of miimon (%d), downdelay rounded to %d ms\n", | 4708 | (downdelay / miimon) * miimon); |
4840 | downdelay, miimon, | ||
4841 | (downdelay / miimon) * miimon); | ||
4842 | } | 4709 | } |
4843 | 4710 | ||
4844 | downdelay /= miimon; | 4711 | downdelay /= miimon; |
4845 | } | 4712 | } |
4846 | 4713 | ||
4847 | if (arp_interval < 0) { | 4714 | if (arp_interval < 0) { |
4848 | pr_warning(DRV_NAME | 4715 | pr_warning("Warning: arp_interval module parameter (%d) , not in range 0-%d, so it was reset to %d\n", |
4849 | ": Warning: arp_interval module parameter (%d) " | 4716 | arp_interval, INT_MAX, BOND_LINK_ARP_INTERV); |
4850 | ", not in range 0-%d, so it was reset to %d\n", | ||
4851 | arp_interval, INT_MAX, BOND_LINK_ARP_INTERV); | ||
4852 | arp_interval = BOND_LINK_ARP_INTERV; | 4717 | arp_interval = BOND_LINK_ARP_INTERV; |
4853 | } | 4718 | } |
4854 | 4719 | ||
@@ -4858,10 +4723,8 @@ static int bond_check_params(struct bond_params *params) | |||
4858 | /* not complete check, but should be good enough to | 4723 | /* not complete check, but should be good enough to |
4859 | catch mistakes */ | 4724 | catch mistakes */ |
4860 | if (!isdigit(arp_ip_target[arp_ip_count][0])) { | 4725 | if (!isdigit(arp_ip_target[arp_ip_count][0])) { |
4861 | pr_warning(DRV_NAME | 4726 | pr_warning("Warning: bad arp_ip_target module parameter (%s), ARP monitoring will not be performed\n", |
4862 | ": Warning: bad arp_ip_target module parameter " | 4727 | arp_ip_target[arp_ip_count]); |
4863 | "(%s), ARP monitoring will not be performed\n", | ||
4864 | arp_ip_target[arp_ip_count]); | ||
4865 | arp_interval = 0; | 4728 | arp_interval = 0; |
4866 | } else { | 4729 | } else { |
4867 | __be32 ip = in_aton(arp_ip_target[arp_ip_count]); | 4730 | __be32 ip = in_aton(arp_ip_target[arp_ip_count]); |
@@ -4871,31 +4734,25 @@ static int bond_check_params(struct bond_params *params) | |||
4871 | 4734 | ||
4872 | if (arp_interval && !arp_ip_count) { | 4735 | if (arp_interval && !arp_ip_count) { |
4873 | /* don't allow arping if no arp_ip_target given... */ | 4736 | /* don't allow arping if no arp_ip_target given... */ |
4874 | pr_warning(DRV_NAME | 4737 | pr_warning("Warning: arp_interval module parameter (%d) specified without providing an arp_ip_target parameter, arp_interval was reset to 0\n", |
4875 | ": Warning: arp_interval module parameter (%d) " | 4738 | arp_interval); |
4876 | "specified without providing an arp_ip_target " | ||
4877 | "parameter, arp_interval was reset to 0\n", | ||
4878 | arp_interval); | ||
4879 | arp_interval = 0; | 4739 | arp_interval = 0; |
4880 | } | 4740 | } |
4881 | 4741 | ||
4882 | if (arp_validate) { | 4742 | if (arp_validate) { |
4883 | if (bond_mode != BOND_MODE_ACTIVEBACKUP) { | 4743 | if (bond_mode != BOND_MODE_ACTIVEBACKUP) { |
4884 | pr_err(DRV_NAME | 4744 | pr_err("arp_validate only supported in active-backup mode\n"); |
4885 | ": arp_validate only supported in active-backup mode\n"); | ||
4886 | return -EINVAL; | 4745 | return -EINVAL; |
4887 | } | 4746 | } |
4888 | if (!arp_interval) { | 4747 | if (!arp_interval) { |
4889 | pr_err(DRV_NAME | 4748 | pr_err("arp_validate requires arp_interval\n"); |
4890 | ": arp_validate requires arp_interval\n"); | ||
4891 | return -EINVAL; | 4749 | return -EINVAL; |
4892 | } | 4750 | } |
4893 | 4751 | ||
4894 | arp_validate_value = bond_parse_parm(arp_validate, | 4752 | arp_validate_value = bond_parse_parm(arp_validate, |
4895 | arp_validate_tbl); | 4753 | arp_validate_tbl); |
4896 | if (arp_validate_value == -1) { | 4754 | if (arp_validate_value == -1) { |
4897 | pr_err(DRV_NAME | 4755 | pr_err("Error: invalid arp_validate \"%s\"\n", |
4898 | ": Error: invalid arp_validate \"%s\"\n", | ||
4899 | arp_validate == NULL ? "NULL" : arp_validate); | 4756 | arp_validate == NULL ? "NULL" : arp_validate); |
4900 | return -EINVAL; | 4757 | return -EINVAL; |
4901 | } | 4758 | } |
@@ -4903,17 +4760,14 @@ static int bond_check_params(struct bond_params *params) | |||
4903 | arp_validate_value = 0; | 4760 | arp_validate_value = 0; |
4904 | 4761 | ||
4905 | if (miimon) { | 4762 | if (miimon) { |
4906 | pr_info(DRV_NAME | 4763 | pr_info("MII link monitoring set to %d ms\n", miimon); |
4907 | ": MII link monitoring set to %d ms\n", | ||
4908 | miimon); | ||
4909 | } else if (arp_interval) { | 4764 | } else if (arp_interval) { |
4910 | int i; | 4765 | int i; |
4911 | 4766 | ||
4912 | pr_info(DRV_NAME ": ARP monitoring set to %d ms," | 4767 | pr_info("ARP monitoring set to %d ms, validate %s, with %d target(s):", |
4913 | " validate %s, with %d target(s):", | 4768 | arp_interval, |
4914 | arp_interval, | 4769 | arp_validate_tbl[arp_validate_value].modename, |
4915 | arp_validate_tbl[arp_validate_value].modename, | 4770 | arp_ip_count); |
4916 | arp_ip_count); | ||
4917 | 4771 | ||
4918 | for (i = 0; i < arp_ip_count; i++) | 4772 | for (i = 0; i < arp_ip_count; i++) |
4919 | pr_info(" %s", arp_ip_target[i]); | 4773 | pr_info(" %s", arp_ip_target[i]); |
@@ -4924,21 +4778,15 @@ static int bond_check_params(struct bond_params *params) | |||
4924 | /* miimon and arp_interval not set, we need one so things | 4778 | /* miimon and arp_interval not set, we need one so things |
4925 | * work as expected, see bonding.txt for details | 4779 | * work as expected, see bonding.txt for details |
4926 | */ | 4780 | */ |
4927 | pr_warning(DRV_NAME | 4781 | pr_warning("Warning: either miimon or arp_interval and arp_ip_target module parameters must be specified, otherwise bonding will not detect link failures! see bonding.txt for details.\n"); |
4928 | ": Warning: either miimon or arp_interval and " | ||
4929 | "arp_ip_target module parameters must be specified, " | ||
4930 | "otherwise bonding will not detect link failures! see " | ||
4931 | "bonding.txt for details.\n"); | ||
4932 | } | 4782 | } |
4933 | 4783 | ||
4934 | if (primary && !USES_PRIMARY(bond_mode)) { | 4784 | if (primary && !USES_PRIMARY(bond_mode)) { |
4935 | /* currently, using a primary only makes sense | 4785 | /* currently, using a primary only makes sense |
4936 | * in active backup, TLB or ALB modes | 4786 | * in active backup, TLB or ALB modes |
4937 | */ | 4787 | */ |
4938 | pr_warning(DRV_NAME | 4788 | pr_warning("Warning: %s primary device specified but has no effect in %s mode\n", |
4939 | ": Warning: %s primary device specified but has no " | 4789 | primary, bond_mode_name(bond_mode)); |
4940 | "effect in %s mode\n", | ||
4941 | primary, bond_mode_name(bond_mode)); | ||
4942 | primary = NULL; | 4790 | primary = NULL; |
4943 | } | 4791 | } |
4944 | 4792 | ||
@@ -4946,8 +4794,7 @@ static int bond_check_params(struct bond_params *params) | |||
4946 | primary_reselect_value = bond_parse_parm(primary_reselect, | 4794 | primary_reselect_value = bond_parse_parm(primary_reselect, |
4947 | pri_reselect_tbl); | 4795 | pri_reselect_tbl); |
4948 | if (primary_reselect_value == -1) { | 4796 | if (primary_reselect_value == -1) { |
4949 | pr_err(DRV_NAME | 4797 | pr_err("Error: Invalid primary_reselect \"%s\"\n", |
4950 | ": Error: Invalid primary_reselect \"%s\"\n", | ||
4951 | primary_reselect == | 4798 | primary_reselect == |
4952 | NULL ? "NULL" : primary_reselect); | 4799 | NULL ? "NULL" : primary_reselect); |
4953 | return -EINVAL; | 4800 | return -EINVAL; |
@@ -4960,16 +4807,13 @@ static int bond_check_params(struct bond_params *params) | |||
4960 | fail_over_mac_value = bond_parse_parm(fail_over_mac, | 4807 | fail_over_mac_value = bond_parse_parm(fail_over_mac, |
4961 | fail_over_mac_tbl); | 4808 | fail_over_mac_tbl); |
4962 | if (fail_over_mac_value == -1) { | 4809 | if (fail_over_mac_value == -1) { |
4963 | pr_err(DRV_NAME | 4810 | pr_err("Error: invalid fail_over_mac \"%s\"\n", |
4964 | ": Error: invalid fail_over_mac \"%s\"\n", | ||
4965 | arp_validate == NULL ? "NULL" : arp_validate); | 4811 | arp_validate == NULL ? "NULL" : arp_validate); |
4966 | return -EINVAL; | 4812 | return -EINVAL; |
4967 | } | 4813 | } |
4968 | 4814 | ||
4969 | if (bond_mode != BOND_MODE_ACTIVEBACKUP) | 4815 | if (bond_mode != BOND_MODE_ACTIVEBACKUP) |
4970 | pr_warning(DRV_NAME | 4816 | pr_warning("Warning: fail_over_mac only affects active-backup mode.\n"); |
4971 | ": Warning: fail_over_mac only affects " | ||
4972 | "active-backup mode.\n"); | ||
4973 | } else { | 4817 | } else { |
4974 | fail_over_mac_value = BOND_FOM_NONE; | 4818 | fail_over_mac_value = BOND_FOM_NONE; |
4975 | } | 4819 | } |
@@ -5076,8 +4920,7 @@ int bond_create(struct net *net, const char *name) | |||
5076 | bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "", | 4920 | bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "", |
5077 | bond_setup); | 4921 | bond_setup); |
5078 | if (!bond_dev) { | 4922 | if (!bond_dev) { |
5079 | pr_err(DRV_NAME ": %s: eek! can't alloc netdev!\n", | 4923 | pr_err("%s: eek! can't alloc netdev!\n", name); |
5080 | name); | ||
5081 | res = -ENOMEM; | 4924 | res = -ENOMEM; |
5082 | goto out; | 4925 | goto out; |
5083 | } | 4926 | } |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 4e00b4f83641..5acd557cea9b 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -19,6 +19,9 @@ | |||
19 | * file called LICENSE. | 19 | * file called LICENSE. |
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | |||
23 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
24 | |||
22 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
23 | #include <linux/module.h> | 26 | #include <linux/module.h> |
24 | #include <linux/device.h> | 27 | #include <linux/device.h> |
@@ -109,11 +112,10 @@ static ssize_t bonding_store_bonds(struct class *cls, | |||
109 | goto err_no_cmd; | 112 | goto err_no_cmd; |
110 | 113 | ||
111 | if (command[0] == '+') { | 114 | if (command[0] == '+') { |
112 | pr_info(DRV_NAME | 115 | pr_info("%s is being created...\n", ifname); |
113 | ": %s is being created...\n", ifname); | ||
114 | rv = bond_create(net, ifname); | 116 | rv = bond_create(net, ifname); |
115 | if (rv) { | 117 | if (rv) { |
116 | pr_info(DRV_NAME ": Bond creation failed.\n"); | 118 | pr_info("Bond creation failed.\n"); |
117 | res = rv; | 119 | res = rv; |
118 | } | 120 | } |
119 | } else if (command[0] == '-') { | 121 | } else if (command[0] == '-') { |
@@ -122,12 +124,10 @@ static ssize_t bonding_store_bonds(struct class *cls, | |||
122 | rtnl_lock(); | 124 | rtnl_lock(); |
123 | bond_dev = bond_get_by_name(net, ifname); | 125 | bond_dev = bond_get_by_name(net, ifname); |
124 | if (bond_dev) { | 126 | if (bond_dev) { |
125 | pr_info(DRV_NAME ": %s is being deleted...\n", | 127 | pr_info("%s is being deleted...\n", ifname); |
126 | ifname); | ||
127 | unregister_netdevice(bond_dev); | 128 | unregister_netdevice(bond_dev); |
128 | } else { | 129 | } else { |
129 | pr_err(DRV_NAME ": unable to delete non-existent %s\n", | 130 | pr_err("unable to delete non-existent %s\n", ifname); |
130 | ifname); | ||
131 | res = -ENODEV; | 131 | res = -ENODEV; |
132 | } | 132 | } |
133 | rtnl_unlock(); | 133 | rtnl_unlock(); |
@@ -140,8 +140,7 @@ static ssize_t bonding_store_bonds(struct class *cls, | |||
140 | return res; | 140 | return res; |
141 | 141 | ||
142 | err_no_cmd: | 142 | err_no_cmd: |
143 | pr_err(DRV_NAME ": no command found in bonding_masters." | 143 | pr_err("no command found in bonding_masters. Use +ifname or -ifname.\n"); |
144 | " Use +ifname or -ifname.\n"); | ||
145 | return -EPERM; | 144 | return -EPERM; |
146 | } | 145 | } |
147 | 146 | ||
@@ -225,8 +224,8 @@ static ssize_t bonding_store_slaves(struct device *d, | |||
225 | 224 | ||
226 | /* Quick sanity check -- is the bond interface up? */ | 225 | /* Quick sanity check -- is the bond interface up? */ |
227 | if (!(bond->dev->flags & IFF_UP)) { | 226 | if (!(bond->dev->flags & IFF_UP)) { |
228 | pr_warning(DRV_NAME ": %s: doing slave updates when " | 227 | pr_warning("%s: doing slave updates when interface is down.\n", |
229 | "interface is down.\n", bond->dev->name); | 228 | bond->dev->name); |
230 | } | 229 | } |
231 | 230 | ||
232 | /* Note: We can't hold bond->lock here, as bond_create grabs it. */ | 231 | /* Note: We can't hold bond->lock here, as bond_create grabs it. */ |
@@ -247,17 +246,14 @@ static ssize_t bonding_store_slaves(struct device *d, | |||
247 | 246 | ||
248 | dev = __dev_get_by_name(dev_net(bond->dev), ifname); | 247 | dev = __dev_get_by_name(dev_net(bond->dev), ifname); |
249 | if (!dev) { | 248 | if (!dev) { |
250 | pr_info(DRV_NAME | 249 | pr_info("%s: Interface %s does not exist!\n", |
251 | ": %s: Interface %s does not exist!\n", | 250 | bond->dev->name, ifname); |
252 | bond->dev->name, ifname); | ||
253 | ret = -ENODEV; | 251 | ret = -ENODEV; |
254 | goto out; | 252 | goto out; |
255 | } | 253 | } |
256 | 254 | ||
257 | if (dev->flags & IFF_UP) { | 255 | if (dev->flags & IFF_UP) { |
258 | pr_err(DRV_NAME | 256 | pr_err("%s: Error: Unable to enslave %s because it is already up.\n", |
259 | ": %s: Error: Unable to enslave %s " | ||
260 | "because it is already up.\n", | ||
261 | bond->dev->name, dev->name); | 257 | bond->dev->name, dev->name); |
262 | ret = -EPERM; | 258 | ret = -EPERM; |
263 | goto out; | 259 | goto out; |
@@ -266,8 +262,7 @@ static ssize_t bonding_store_slaves(struct device *d, | |||
266 | read_lock(&bond->lock); | 262 | read_lock(&bond->lock); |
267 | bond_for_each_slave(bond, slave, i) | 263 | bond_for_each_slave(bond, slave, i) |
268 | if (slave->dev == dev) { | 264 | if (slave->dev == dev) { |
269 | pr_err(DRV_NAME | 265 | pr_err("%s: Interface %s is already enslaved!\n", |
270 | ": %s: Interface %s is already enslaved!\n", | ||
271 | bond->dev->name, ifname); | 266 | bond->dev->name, ifname); |
272 | ret = -EPERM; | 267 | ret = -EPERM; |
273 | read_unlock(&bond->lock); | 268 | read_unlock(&bond->lock); |
@@ -275,8 +270,7 @@ static ssize_t bonding_store_slaves(struct device *d, | |||
275 | } | 270 | } |
276 | read_unlock(&bond->lock); | 271 | read_unlock(&bond->lock); |
277 | 272 | ||
278 | pr_info(DRV_NAME ": %s: Adding slave %s.\n", | 273 | pr_info("%s: Adding slave %s.\n", bond->dev->name, ifname); |
279 | bond->dev->name, ifname); | ||
280 | 274 | ||
281 | /* If this is the first slave, then we need to set | 275 | /* If this is the first slave, then we need to set |
282 | the master's hardware address to be the same as the | 276 | the master's hardware address to be the same as the |
@@ -313,7 +307,7 @@ static ssize_t bonding_store_slaves(struct device *d, | |||
313 | break; | 307 | break; |
314 | } | 308 | } |
315 | if (dev) { | 309 | if (dev) { |
316 | pr_info(DRV_NAME ": %s: Removing slave %s\n", | 310 | pr_info("%s: Removing slave %s\n", |
317 | bond->dev->name, dev->name); | 311 | bond->dev->name, dev->name); |
318 | res = bond_release(bond->dev, dev); | 312 | res = bond_release(bond->dev, dev); |
319 | if (res) { | 313 | if (res) { |
@@ -323,16 +317,16 @@ static ssize_t bonding_store_slaves(struct device *d, | |||
323 | /* set the slave MTU to the default */ | 317 | /* set the slave MTU to the default */ |
324 | dev_set_mtu(dev, original_mtu); | 318 | dev_set_mtu(dev, original_mtu); |
325 | } else { | 319 | } else { |
326 | pr_err(DRV_NAME ": unable to remove non-existent" | 320 | pr_err("unable to remove non-existent slave %s for bond %s.\n", |
327 | " slave %s for bond %s.\n", | 321 | ifname, bond->dev->name); |
328 | ifname, bond->dev->name); | ||
329 | ret = -ENODEV; | 322 | ret = -ENODEV; |
330 | } | 323 | } |
331 | goto out; | 324 | goto out; |
332 | } | 325 | } |
333 | 326 | ||
334 | err_no_cmd: | 327 | err_no_cmd: |
335 | pr_err(DRV_NAME ": no command found in slaves file for bond %s. Use +ifname or -ifname.\n", bond->dev->name); | 328 | pr_err("no command found in slaves file for bond %s. Use +ifname or -ifname.\n", |
329 | bond->dev->name); | ||
336 | ret = -EPERM; | 330 | ret = -EPERM; |
337 | 331 | ||
338 | out: | 332 | out: |
@@ -365,18 +359,16 @@ static ssize_t bonding_store_mode(struct device *d, | |||
365 | struct bonding *bond = to_bond(d); | 359 | struct bonding *bond = to_bond(d); |
366 | 360 | ||
367 | if (bond->dev->flags & IFF_UP) { | 361 | if (bond->dev->flags & IFF_UP) { |
368 | pr_err(DRV_NAME ": unable to update mode of %s" | 362 | pr_err("unable to update mode of %s because interface is up.\n", |
369 | " because interface is up.\n", bond->dev->name); | 363 | bond->dev->name); |
370 | ret = -EPERM; | 364 | ret = -EPERM; |
371 | goto out; | 365 | goto out; |
372 | } | 366 | } |
373 | 367 | ||
374 | new_value = bond_parse_parm(buf, bond_mode_tbl); | 368 | new_value = bond_parse_parm(buf, bond_mode_tbl); |
375 | if (new_value < 0) { | 369 | if (new_value < 0) { |
376 | pr_err(DRV_NAME | 370 | pr_err("%s: Ignoring invalid mode value %.*s.\n", |
377 | ": %s: Ignoring invalid mode value %.*s.\n", | 371 | bond->dev->name, (int)strlen(buf) - 1, buf); |
378 | bond->dev->name, | ||
379 | (int)strlen(buf) - 1, buf); | ||
380 | ret = -EINVAL; | 372 | ret = -EINVAL; |
381 | goto out; | 373 | goto out; |
382 | } else { | 374 | } else { |
@@ -388,8 +380,8 @@ static ssize_t bonding_store_mode(struct device *d, | |||
388 | 380 | ||
389 | bond->params.mode = new_value; | 381 | bond->params.mode = new_value; |
390 | bond_set_mode_ops(bond, bond->params.mode); | 382 | bond_set_mode_ops(bond, bond->params.mode); |
391 | pr_info(DRV_NAME ": %s: setting mode to %s (%d).\n", | 383 | pr_info("%s: setting mode to %s (%d).\n", |
392 | bond->dev->name, bond_mode_tbl[new_value].modename, | 384 | bond->dev->name, bond_mode_tbl[new_value].modename, |
393 | new_value); | 385 | new_value); |
394 | } | 386 | } |
395 | out: | 387 | out: |
@@ -421,8 +413,7 @@ static ssize_t bonding_store_xmit_hash(struct device *d, | |||
421 | struct bonding *bond = to_bond(d); | 413 | struct bonding *bond = to_bond(d); |
422 | 414 | ||
423 | if (bond->dev->flags & IFF_UP) { | 415 | if (bond->dev->flags & IFF_UP) { |
424 | pr_err(DRV_NAME | 416 | pr_err("%s: Interface is up. Unable to update xmit policy.\n", |
425 | "%s: Interface is up. Unable to update xmit policy.\n", | ||
426 | bond->dev->name); | 417 | bond->dev->name); |
427 | ret = -EPERM; | 418 | ret = -EPERM; |
428 | goto out; | 419 | goto out; |
@@ -430,8 +421,7 @@ static ssize_t bonding_store_xmit_hash(struct device *d, | |||
430 | 421 | ||
431 | new_value = bond_parse_parm(buf, xmit_hashtype_tbl); | 422 | new_value = bond_parse_parm(buf, xmit_hashtype_tbl); |
432 | if (new_value < 0) { | 423 | if (new_value < 0) { |
433 | pr_err(DRV_NAME | 424 | pr_err("%s: Ignoring invalid xmit hash policy value %.*s.\n", |
434 | ": %s: Ignoring invalid xmit hash policy value %.*s.\n", | ||
435 | bond->dev->name, | 425 | bond->dev->name, |
436 | (int)strlen(buf) - 1, buf); | 426 | (int)strlen(buf) - 1, buf); |
437 | ret = -EINVAL; | 427 | ret = -EINVAL; |
@@ -439,7 +429,7 @@ static ssize_t bonding_store_xmit_hash(struct device *d, | |||
439 | } else { | 429 | } else { |
440 | bond->params.xmit_policy = new_value; | 430 | bond->params.xmit_policy = new_value; |
441 | bond_set_mode_ops(bond, bond->params.mode); | 431 | bond_set_mode_ops(bond, bond->params.mode); |
442 | pr_info(DRV_NAME ": %s: setting xmit hash policy to %s (%d).\n", | 432 | pr_info("%s: setting xmit hash policy to %s (%d).\n", |
443 | bond->dev->name, | 433 | bond->dev->name, |
444 | xmit_hashtype_tbl[new_value].modename, new_value); | 434 | xmit_hashtype_tbl[new_value].modename, new_value); |
445 | } | 435 | } |
@@ -472,20 +462,18 @@ static ssize_t bonding_store_arp_validate(struct device *d, | |||
472 | 462 | ||
473 | new_value = bond_parse_parm(buf, arp_validate_tbl); | 463 | new_value = bond_parse_parm(buf, arp_validate_tbl); |
474 | if (new_value < 0) { | 464 | if (new_value < 0) { |
475 | pr_err(DRV_NAME | 465 | pr_err("%s: Ignoring invalid arp_validate value %s\n", |
476 | ": %s: Ignoring invalid arp_validate value %s\n", | ||
477 | bond->dev->name, buf); | 466 | bond->dev->name, buf); |
478 | return -EINVAL; | 467 | return -EINVAL; |
479 | } | 468 | } |
480 | if (new_value && (bond->params.mode != BOND_MODE_ACTIVEBACKUP)) { | 469 | if (new_value && (bond->params.mode != BOND_MODE_ACTIVEBACKUP)) { |
481 | pr_err(DRV_NAME | 470 | pr_err("%s: arp_validate only supported in active-backup mode.\n", |
482 | ": %s: arp_validate only supported in active-backup mode.\n", | ||
483 | bond->dev->name); | 471 | bond->dev->name); |
484 | return -EINVAL; | 472 | return -EINVAL; |
485 | } | 473 | } |
486 | pr_info(DRV_NAME ": %s: setting arp_validate to %s (%d).\n", | 474 | pr_info("%s: setting arp_validate to %s (%d).\n", |
487 | bond->dev->name, arp_validate_tbl[new_value].modename, | 475 | bond->dev->name, arp_validate_tbl[new_value].modename, |
488 | new_value); | 476 | new_value); |
489 | 477 | ||
490 | if (!bond->params.arp_validate && new_value) | 478 | if (!bond->params.arp_validate && new_value) |
491 | bond_register_arp(bond); | 479 | bond_register_arp(bond); |
@@ -523,24 +511,22 @@ static ssize_t bonding_store_fail_over_mac(struct device *d, | |||
523 | struct bonding *bond = to_bond(d); | 511 | struct bonding *bond = to_bond(d); |
524 | 512 | ||
525 | if (bond->slave_cnt != 0) { | 513 | if (bond->slave_cnt != 0) { |
526 | pr_err(DRV_NAME | 514 | pr_err("%s: Can't alter fail_over_mac with slaves in bond.\n", |
527 | ": %s: Can't alter fail_over_mac with slaves in bond.\n", | ||
528 | bond->dev->name); | 515 | bond->dev->name); |
529 | return -EPERM; | 516 | return -EPERM; |
530 | } | 517 | } |
531 | 518 | ||
532 | new_value = bond_parse_parm(buf, fail_over_mac_tbl); | 519 | new_value = bond_parse_parm(buf, fail_over_mac_tbl); |
533 | if (new_value < 0) { | 520 | if (new_value < 0) { |
534 | pr_err(DRV_NAME | 521 | pr_err("%s: Ignoring invalid fail_over_mac value %s.\n", |
535 | ": %s: Ignoring invalid fail_over_mac value %s.\n", | ||
536 | bond->dev->name, buf); | 522 | bond->dev->name, buf); |
537 | return -EINVAL; | 523 | return -EINVAL; |
538 | } | 524 | } |
539 | 525 | ||
540 | bond->params.fail_over_mac = new_value; | 526 | bond->params.fail_over_mac = new_value; |
541 | pr_info(DRV_NAME ": %s: Setting fail_over_mac to %s (%d).\n", | 527 | pr_info("%s: Setting fail_over_mac to %s (%d).\n", |
542 | bond->dev->name, fail_over_mac_tbl[new_value].modename, | 528 | bond->dev->name, fail_over_mac_tbl[new_value].modename, |
543 | new_value); | 529 | new_value); |
544 | 530 | ||
545 | return count; | 531 | return count; |
546 | } | 532 | } |
@@ -571,31 +557,26 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
571 | struct bonding *bond = to_bond(d); | 557 | struct bonding *bond = to_bond(d); |
572 | 558 | ||
573 | if (sscanf(buf, "%d", &new_value) != 1) { | 559 | if (sscanf(buf, "%d", &new_value) != 1) { |
574 | pr_err(DRV_NAME | 560 | pr_err("%s: no arp_interval value specified.\n", |
575 | ": %s: no arp_interval value specified.\n", | ||
576 | bond->dev->name); | 561 | bond->dev->name); |
577 | ret = -EINVAL; | 562 | ret = -EINVAL; |
578 | goto out; | 563 | goto out; |
579 | } | 564 | } |
580 | if (new_value < 0) { | 565 | if (new_value < 0) { |
581 | pr_err(DRV_NAME | 566 | pr_err("%s: Invalid arp_interval value %d not in range 1-%d; rejected.\n", |
582 | ": %s: Invalid arp_interval value %d not in range 1-%d; rejected.\n", | ||
583 | bond->dev->name, new_value, INT_MAX); | 567 | bond->dev->name, new_value, INT_MAX); |
584 | ret = -EINVAL; | 568 | ret = -EINVAL; |
585 | goto out; | 569 | goto out; |
586 | } | 570 | } |
587 | 571 | ||
588 | pr_info(DRV_NAME | 572 | pr_info("%s: Setting ARP monitoring interval to %d.\n", |
589 | ": %s: Setting ARP monitoring interval to %d.\n", | 573 | bond->dev->name, new_value); |
590 | bond->dev->name, new_value); | ||
591 | bond->params.arp_interval = new_value; | 574 | bond->params.arp_interval = new_value; |
592 | if (bond->params.arp_interval) | 575 | if (bond->params.arp_interval) |
593 | bond->dev->priv_flags |= IFF_MASTER_ARPMON; | 576 | bond->dev->priv_flags |= IFF_MASTER_ARPMON; |
594 | if (bond->params.miimon) { | 577 | if (bond->params.miimon) { |
595 | pr_info(DRV_NAME | 578 | pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n", |
596 | ": %s: ARP monitoring cannot be used with MII monitoring. " | 579 | bond->dev->name, bond->dev->name); |
597 | "%s Disabling MII monitoring.\n", | ||
598 | bond->dev->name, bond->dev->name); | ||
599 | bond->params.miimon = 0; | 580 | bond->params.miimon = 0; |
600 | if (delayed_work_pending(&bond->mii_work)) { | 581 | if (delayed_work_pending(&bond->mii_work)) { |
601 | cancel_delayed_work(&bond->mii_work); | 582 | cancel_delayed_work(&bond->mii_work); |
@@ -603,10 +584,8 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
603 | } | 584 | } |
604 | } | 585 | } |
605 | if (!bond->params.arp_targets[0]) { | 586 | if (!bond->params.arp_targets[0]) { |
606 | pr_info(DRV_NAME | 587 | pr_info("%s: ARP monitoring has been set up, but no ARP targets have been specified.\n", |
607 | ": %s: ARP monitoring has been set up, " | 588 | bond->dev->name); |
608 | "but no ARP targets have been specified.\n", | ||
609 | bond->dev->name); | ||
610 | } | 589 | } |
611 | if (bond->dev->flags & IFF_UP) { | 590 | if (bond->dev->flags & IFF_UP) { |
612 | /* If the interface is up, we may need to fire off | 591 | /* If the interface is up, we may need to fire off |
@@ -666,8 +645,7 @@ static ssize_t bonding_store_arp_targets(struct device *d, | |||
666 | /* look for adds */ | 645 | /* look for adds */ |
667 | if (buf[0] == '+') { | 646 | if (buf[0] == '+') { |
668 | if ((newtarget == 0) || (newtarget == htonl(INADDR_BROADCAST))) { | 647 | if ((newtarget == 0) || (newtarget == htonl(INADDR_BROADCAST))) { |
669 | pr_err(DRV_NAME | 648 | pr_err("%s: invalid ARP target %pI4 specified for addition\n", |
670 | ": %s: invalid ARP target %pI4 specified for addition\n", | ||
671 | bond->dev->name, &newtarget); | 649 | bond->dev->name, &newtarget); |
672 | ret = -EINVAL; | 650 | ret = -EINVAL; |
673 | goto out; | 651 | goto out; |
@@ -675,23 +653,20 @@ static ssize_t bonding_store_arp_targets(struct device *d, | |||
675 | /* look for an empty slot to put the target in, and check for dupes */ | 653 | /* look for an empty slot to put the target in, and check for dupes */ |
676 | for (i = 0; (i < BOND_MAX_ARP_TARGETS) && !done; i++) { | 654 | for (i = 0; (i < BOND_MAX_ARP_TARGETS) && !done; i++) { |
677 | if (targets[i] == newtarget) { /* duplicate */ | 655 | if (targets[i] == newtarget) { /* duplicate */ |
678 | pr_err(DRV_NAME | 656 | pr_err("%s: ARP target %pI4 is already present\n", |
679 | ": %s: ARP target %pI4 is already present\n", | ||
680 | bond->dev->name, &newtarget); | 657 | bond->dev->name, &newtarget); |
681 | ret = -EINVAL; | 658 | ret = -EINVAL; |
682 | goto out; | 659 | goto out; |
683 | } | 660 | } |
684 | if (targets[i] == 0) { | 661 | if (targets[i] == 0) { |
685 | pr_info(DRV_NAME | 662 | pr_info("%s: adding ARP target %pI4.\n", |
686 | ": %s: adding ARP target %pI4.\n", | 663 | bond->dev->name, &newtarget); |
687 | bond->dev->name, &newtarget); | ||
688 | done = 1; | 664 | done = 1; |
689 | targets[i] = newtarget; | 665 | targets[i] = newtarget; |
690 | } | 666 | } |
691 | } | 667 | } |
692 | if (!done) { | 668 | if (!done) { |
693 | pr_err(DRV_NAME | 669 | pr_err("%s: ARP target table is full!\n", |
694 | ": %s: ARP target table is full!\n", | ||
695 | bond->dev->name); | 670 | bond->dev->name); |
696 | ret = -EINVAL; | 671 | ret = -EINVAL; |
697 | goto out; | 672 | goto out; |
@@ -699,8 +674,7 @@ static ssize_t bonding_store_arp_targets(struct device *d, | |||
699 | 674 | ||
700 | } else if (buf[0] == '-') { | 675 | } else if (buf[0] == '-') { |
701 | if ((newtarget == 0) || (newtarget == htonl(INADDR_BROADCAST))) { | 676 | if ((newtarget == 0) || (newtarget == htonl(INADDR_BROADCAST))) { |
702 | pr_err(DRV_NAME | 677 | pr_err("%s: invalid ARP target %pI4 specified for removal\n", |
703 | ": %s: invalid ARP target %pI4 specified for removal\n", | ||
704 | bond->dev->name, &newtarget); | 678 | bond->dev->name, &newtarget); |
705 | ret = -EINVAL; | 679 | ret = -EINVAL; |
706 | goto out; | 680 | goto out; |
@@ -709,9 +683,8 @@ static ssize_t bonding_store_arp_targets(struct device *d, | |||
709 | for (i = 0; (i < BOND_MAX_ARP_TARGETS) && !done; i++) { | 683 | for (i = 0; (i < BOND_MAX_ARP_TARGETS) && !done; i++) { |
710 | if (targets[i] == newtarget) { | 684 | if (targets[i] == newtarget) { |
711 | int j; | 685 | int j; |
712 | pr_info(DRV_NAME | 686 | pr_info("%s: removing ARP target %pI4.\n", |
713 | ": %s: removing ARP target %pI4.\n", | 687 | bond->dev->name, &newtarget); |
714 | bond->dev->name, &newtarget); | ||
715 | for (j = i; (j < (BOND_MAX_ARP_TARGETS-1)) && targets[j+1]; j++) | 688 | for (j = i; (j < (BOND_MAX_ARP_TARGETS-1)) && targets[j+1]; j++) |
716 | targets[j] = targets[j+1]; | 689 | targets[j] = targets[j+1]; |
717 | 690 | ||
@@ -720,16 +693,14 @@ static ssize_t bonding_store_arp_targets(struct device *d, | |||
720 | } | 693 | } |
721 | } | 694 | } |
722 | if (!done) { | 695 | if (!done) { |
723 | pr_info(DRV_NAME | 696 | pr_info("%s: unable to remove nonexistent ARP target %pI4.\n", |
724 | ": %s: unable to remove nonexistent ARP target %pI4.\n", | 697 | bond->dev->name, &newtarget); |
725 | bond->dev->name, &newtarget); | ||
726 | ret = -EINVAL; | 698 | ret = -EINVAL; |
727 | goto out; | 699 | goto out; |
728 | } | 700 | } |
729 | } else { | 701 | } else { |
730 | pr_err(DRV_NAME ": no command found in arp_ip_targets file" | 702 | pr_err("no command found in arp_ip_targets file for bond %s. Use +<addr> or -<addr>.\n", |
731 | " for bond %s. Use +<addr> or -<addr>.\n", | 703 | bond->dev->name); |
732 | bond->dev->name); | ||
733 | ret = -EPERM; | 704 | ret = -EPERM; |
734 | goto out; | 705 | goto out; |
735 | } | 706 | } |
@@ -761,41 +732,34 @@ static ssize_t bonding_store_downdelay(struct device *d, | |||
761 | struct bonding *bond = to_bond(d); | 732 | struct bonding *bond = to_bond(d); |
762 | 733 | ||
763 | if (!(bond->params.miimon)) { | 734 | if (!(bond->params.miimon)) { |
764 | pr_err(DRV_NAME | 735 | pr_err("%s: Unable to set down delay as MII monitoring is disabled\n", |
765 | ": %s: Unable to set down delay as MII monitoring is disabled\n", | ||
766 | bond->dev->name); | 736 | bond->dev->name); |
767 | ret = -EPERM; | 737 | ret = -EPERM; |
768 | goto out; | 738 | goto out; |
769 | } | 739 | } |
770 | 740 | ||
771 | if (sscanf(buf, "%d", &new_value) != 1) { | 741 | if (sscanf(buf, "%d", &new_value) != 1) { |
772 | pr_err(DRV_NAME | 742 | pr_err("%s: no down delay value specified.\n", bond->dev->name); |
773 | ": %s: no down delay value specified.\n", | ||
774 | bond->dev->name); | ||
775 | ret = -EINVAL; | 743 | ret = -EINVAL; |
776 | goto out; | 744 | goto out; |
777 | } | 745 | } |
778 | if (new_value < 0) { | 746 | if (new_value < 0) { |
779 | pr_err(DRV_NAME | 747 | pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n", |
780 | ": %s: Invalid down delay value %d not in range %d-%d; rejected.\n", | ||
781 | bond->dev->name, new_value, 1, INT_MAX); | 748 | bond->dev->name, new_value, 1, INT_MAX); |
782 | ret = -EINVAL; | 749 | ret = -EINVAL; |
783 | goto out; | 750 | goto out; |
784 | } else { | 751 | } else { |
785 | if ((new_value % bond->params.miimon) != 0) { | 752 | if ((new_value % bond->params.miimon) != 0) { |
786 | pr_warning(DRV_NAME | 753 | pr_warning("%s: Warning: down delay (%d) is not a multiple of miimon (%d), delay rounded to %d ms\n", |
787 | ": %s: Warning: down delay (%d) is not a " | ||
788 | "multiple of miimon (%d), delay rounded " | ||
789 | "to %d ms\n", | ||
790 | bond->dev->name, new_value, | 754 | bond->dev->name, new_value, |
791 | bond->params.miimon, | 755 | bond->params.miimon, |
792 | (new_value / bond->params.miimon) * | 756 | (new_value / bond->params.miimon) * |
793 | bond->params.miimon); | 757 | bond->params.miimon); |
794 | } | 758 | } |
795 | bond->params.downdelay = new_value / bond->params.miimon; | 759 | bond->params.downdelay = new_value / bond->params.miimon; |
796 | pr_info(DRV_NAME ": %s: Setting down delay to %d.\n", | 760 | pr_info("%s: Setting down delay to %d.\n", |
797 | bond->dev->name, | 761 | bond->dev->name, |
798 | bond->params.downdelay * bond->params.miimon); | 762 | bond->params.downdelay * bond->params.miimon); |
799 | 763 | ||
800 | } | 764 | } |
801 | 765 | ||
@@ -823,41 +787,35 @@ static ssize_t bonding_store_updelay(struct device *d, | |||
823 | struct bonding *bond = to_bond(d); | 787 | struct bonding *bond = to_bond(d); |
824 | 788 | ||
825 | if (!(bond->params.miimon)) { | 789 | if (!(bond->params.miimon)) { |
826 | pr_err(DRV_NAME | 790 | pr_err("%s: Unable to set up delay as MII monitoring is disabled\n", |
827 | ": %s: Unable to set up delay as MII monitoring is disabled\n", | ||
828 | bond->dev->name); | 791 | bond->dev->name); |
829 | ret = -EPERM; | 792 | ret = -EPERM; |
830 | goto out; | 793 | goto out; |
831 | } | 794 | } |
832 | 795 | ||
833 | if (sscanf(buf, "%d", &new_value) != 1) { | 796 | if (sscanf(buf, "%d", &new_value) != 1) { |
834 | pr_err(DRV_NAME | 797 | pr_err("%s: no up delay value specified.\n", |
835 | ": %s: no up delay value specified.\n", | ||
836 | bond->dev->name); | 798 | bond->dev->name); |
837 | ret = -EINVAL; | 799 | ret = -EINVAL; |
838 | goto out; | 800 | goto out; |
839 | } | 801 | } |
840 | if (new_value < 0) { | 802 | if (new_value < 0) { |
841 | pr_err(DRV_NAME | 803 | pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n", |
842 | ": %s: Invalid down delay value %d not in range %d-%d; rejected.\n", | ||
843 | bond->dev->name, new_value, 1, INT_MAX); | 804 | bond->dev->name, new_value, 1, INT_MAX); |
844 | ret = -EINVAL; | 805 | ret = -EINVAL; |
845 | goto out; | 806 | goto out; |
846 | } else { | 807 | } else { |
847 | if ((new_value % bond->params.miimon) != 0) { | 808 | if ((new_value % bond->params.miimon) != 0) { |
848 | pr_warning(DRV_NAME | 809 | pr_warning("%s: Warning: up delay (%d) is not a multiple of miimon (%d), updelay rounded to %d ms\n", |
849 | ": %s: Warning: up delay (%d) is not a " | ||
850 | "multiple of miimon (%d), updelay rounded " | ||
851 | "to %d ms\n", | ||
852 | bond->dev->name, new_value, | 810 | bond->dev->name, new_value, |
853 | bond->params.miimon, | 811 | bond->params.miimon, |
854 | (new_value / bond->params.miimon) * | 812 | (new_value / bond->params.miimon) * |
855 | bond->params.miimon); | 813 | bond->params.miimon); |
856 | } | 814 | } |
857 | bond->params.updelay = new_value / bond->params.miimon; | 815 | bond->params.updelay = new_value / bond->params.miimon; |
858 | pr_info(DRV_NAME ": %s: Setting up delay to %d.\n", | 816 | pr_info("%s: Setting up delay to %d.\n", |
859 | bond->dev->name, bond->params.updelay * bond->params.miimon); | 817 | bond->dev->name, |
860 | 818 | bond->params.updelay * bond->params.miimon); | |
861 | } | 819 | } |
862 | 820 | ||
863 | out: | 821 | out: |
@@ -889,16 +847,14 @@ static ssize_t bonding_store_lacp(struct device *d, | |||
889 | struct bonding *bond = to_bond(d); | 847 | struct bonding *bond = to_bond(d); |
890 | 848 | ||
891 | if (bond->dev->flags & IFF_UP) { | 849 | if (bond->dev->flags & IFF_UP) { |
892 | pr_err(DRV_NAME | 850 | pr_err("%s: Unable to update LACP rate because interface is up.\n", |
893 | ": %s: Unable to update LACP rate because interface is up.\n", | ||
894 | bond->dev->name); | 851 | bond->dev->name); |
895 | ret = -EPERM; | 852 | ret = -EPERM; |
896 | goto out; | 853 | goto out; |
897 | } | 854 | } |
898 | 855 | ||
899 | if (bond->params.mode != BOND_MODE_8023AD) { | 856 | if (bond->params.mode != BOND_MODE_8023AD) { |
900 | pr_err(DRV_NAME | 857 | pr_err("%s: Unable to update LACP rate because bond is not in 802.3ad mode.\n", |
901 | ": %s: Unable to update LACP rate because bond is not in 802.3ad mode.\n", | ||
902 | bond->dev->name); | 858 | bond->dev->name); |
903 | ret = -EPERM; | 859 | ret = -EPERM; |
904 | goto out; | 860 | goto out; |
@@ -908,12 +864,11 @@ static ssize_t bonding_store_lacp(struct device *d, | |||
908 | 864 | ||
909 | if ((new_value == 1) || (new_value == 0)) { | 865 | if ((new_value == 1) || (new_value == 0)) { |
910 | bond->params.lacp_fast = new_value; | 866 | bond->params.lacp_fast = new_value; |
911 | pr_info(DRV_NAME ": %s: Setting LACP rate to %s (%d).\n", | 867 | pr_info("%s: Setting LACP rate to %s (%d).\n", |
912 | bond->dev->name, bond_lacp_tbl[new_value].modename, | 868 | bond->dev->name, bond_lacp_tbl[new_value].modename, |
913 | new_value); | 869 | new_value); |
914 | } else { | 870 | } else { |
915 | pr_err(DRV_NAME | 871 | pr_err("%s: Ignoring invalid LACP rate value %.*s.\n", |
916 | ": %s: Ignoring invalid LACP rate value %.*s.\n", | ||
917 | bond->dev->name, (int)strlen(buf) - 1, buf); | 872 | bond->dev->name, (int)strlen(buf) - 1, buf); |
918 | ret = -EINVAL; | 873 | ret = -EINVAL; |
919 | } | 874 | } |
@@ -943,9 +898,8 @@ static ssize_t bonding_store_ad_select(struct device *d, | |||
943 | struct bonding *bond = to_bond(d); | 898 | struct bonding *bond = to_bond(d); |
944 | 899 | ||
945 | if (bond->dev->flags & IFF_UP) { | 900 | if (bond->dev->flags & IFF_UP) { |
946 | pr_err(DRV_NAME | 901 | pr_err("%s: Unable to update ad_select because interface is up.\n", |
947 | ": %s: Unable to update ad_select because interface " | 902 | bond->dev->name); |
948 | "is up.\n", bond->dev->name); | ||
949 | ret = -EPERM; | 903 | ret = -EPERM; |
950 | goto out; | 904 | goto out; |
951 | } | 905 | } |
@@ -954,13 +908,11 @@ static ssize_t bonding_store_ad_select(struct device *d, | |||
954 | 908 | ||
955 | if (new_value != -1) { | 909 | if (new_value != -1) { |
956 | bond->params.ad_select = new_value; | 910 | bond->params.ad_select = new_value; |
957 | pr_info(DRV_NAME | 911 | pr_info("%s: Setting ad_select to %s (%d).\n", |
958 | ": %s: Setting ad_select to %s (%d).\n", | 912 | bond->dev->name, ad_select_tbl[new_value].modename, |
959 | bond->dev->name, ad_select_tbl[new_value].modename, | 913 | new_value); |
960 | new_value); | ||
961 | } else { | 914 | } else { |
962 | pr_err(DRV_NAME | 915 | pr_err("%s: Ignoring invalid ad_select value %.*s.\n", |
963 | ": %s: Ignoring invalid ad_select value %.*s.\n", | ||
964 | bond->dev->name, (int)strlen(buf) - 1, buf); | 916 | bond->dev->name, (int)strlen(buf) - 1, buf); |
965 | ret = -EINVAL; | 917 | ret = -EINVAL; |
966 | } | 918 | } |
@@ -990,15 +942,13 @@ static ssize_t bonding_store_n_grat_arp(struct device *d, | |||
990 | struct bonding *bond = to_bond(d); | 942 | struct bonding *bond = to_bond(d); |
991 | 943 | ||
992 | if (sscanf(buf, "%d", &new_value) != 1) { | 944 | if (sscanf(buf, "%d", &new_value) != 1) { |
993 | pr_err(DRV_NAME | 945 | pr_err("%s: no num_grat_arp value specified.\n", |
994 | ": %s: no num_grat_arp value specified.\n", | ||
995 | bond->dev->name); | 946 | bond->dev->name); |
996 | ret = -EINVAL; | 947 | ret = -EINVAL; |
997 | goto out; | 948 | goto out; |
998 | } | 949 | } |
999 | if (new_value < 0 || new_value > 255) { | 950 | if (new_value < 0 || new_value > 255) { |
1000 | pr_err(DRV_NAME | 951 | pr_err("%s: Invalid num_grat_arp value %d not in range 0-255; rejected.\n", |
1001 | ": %s: Invalid num_grat_arp value %d not in range 0-255; rejected.\n", | ||
1002 | bond->dev->name, new_value); | 952 | bond->dev->name, new_value); |
1003 | ret = -EINVAL; | 953 | ret = -EINVAL; |
1004 | goto out; | 954 | goto out; |
@@ -1031,16 +981,14 @@ static ssize_t bonding_store_n_unsol_na(struct device *d, | |||
1031 | struct bonding *bond = to_bond(d); | 981 | struct bonding *bond = to_bond(d); |
1032 | 982 | ||
1033 | if (sscanf(buf, "%d", &new_value) != 1) { | 983 | if (sscanf(buf, "%d", &new_value) != 1) { |
1034 | pr_err(DRV_NAME | 984 | pr_err("%s: no num_unsol_na value specified.\n", |
1035 | ": %s: no num_unsol_na value specified.\n", | ||
1036 | bond->dev->name); | 985 | bond->dev->name); |
1037 | ret = -EINVAL; | 986 | ret = -EINVAL; |
1038 | goto out; | 987 | goto out; |
1039 | } | 988 | } |
1040 | 989 | ||
1041 | if (new_value < 0 || new_value > 255) { | 990 | if (new_value < 0 || new_value > 255) { |
1042 | pr_err(DRV_NAME | 991 | pr_err("%s: Invalid num_unsol_na value %d not in range 0-255; rejected.\n", |
1043 | ": %s: Invalid num_unsol_na value %d not in range 0-255; rejected.\n", | ||
1044 | bond->dev->name, new_value); | 992 | bond->dev->name, new_value); |
1045 | ret = -EINVAL; | 993 | ret = -EINVAL; |
1046 | goto out; | 994 | goto out; |
@@ -1075,40 +1023,31 @@ static ssize_t bonding_store_miimon(struct device *d, | |||
1075 | struct bonding *bond = to_bond(d); | 1023 | struct bonding *bond = to_bond(d); |
1076 | 1024 | ||
1077 | if (sscanf(buf, "%d", &new_value) != 1) { | 1025 | if (sscanf(buf, "%d", &new_value) != 1) { |
1078 | pr_err(DRV_NAME | 1026 | pr_err("%s: no miimon value specified.\n", |
1079 | ": %s: no miimon value specified.\n", | ||
1080 | bond->dev->name); | 1027 | bond->dev->name); |
1081 | ret = -EINVAL; | 1028 | ret = -EINVAL; |
1082 | goto out; | 1029 | goto out; |
1083 | } | 1030 | } |
1084 | if (new_value < 0) { | 1031 | if (new_value < 0) { |
1085 | pr_err(DRV_NAME | 1032 | pr_err("%s: Invalid miimon value %d not in range %d-%d; rejected.\n", |
1086 | ": %s: Invalid miimon value %d not in range %d-%d; rejected.\n", | ||
1087 | bond->dev->name, new_value, 1, INT_MAX); | 1033 | bond->dev->name, new_value, 1, INT_MAX); |
1088 | ret = -EINVAL; | 1034 | ret = -EINVAL; |
1089 | goto out; | 1035 | goto out; |
1090 | } else { | 1036 | } else { |
1091 | pr_info(DRV_NAME | 1037 | pr_info("%s: Setting MII monitoring interval to %d.\n", |
1092 | ": %s: Setting MII monitoring interval to %d.\n", | 1038 | bond->dev->name, new_value); |
1093 | bond->dev->name, new_value); | ||
1094 | bond->params.miimon = new_value; | 1039 | bond->params.miimon = new_value; |
1095 | if (bond->params.updelay) | 1040 | if (bond->params.updelay) |
1096 | pr_info(DRV_NAME | 1041 | pr_info("%s: Note: Updating updelay (to %d) since it is a multiple of the miimon value.\n", |
1097 | ": %s: Note: Updating updelay (to %d) " | 1042 | bond->dev->name, |
1098 | "since it is a multiple of the miimon value.\n", | 1043 | bond->params.updelay * bond->params.miimon); |
1099 | bond->dev->name, | ||
1100 | bond->params.updelay * bond->params.miimon); | ||
1101 | if (bond->params.downdelay) | 1044 | if (bond->params.downdelay) |
1102 | pr_info(DRV_NAME | 1045 | pr_info("%s: Note: Updating downdelay (to %d) since it is a multiple of the miimon value.\n", |
1103 | ": %s: Note: Updating downdelay (to %d) " | 1046 | bond->dev->name, |
1104 | "since it is a multiple of the miimon value.\n", | 1047 | bond->params.downdelay * bond->params.miimon); |
1105 | bond->dev->name, | ||
1106 | bond->params.downdelay * bond->params.miimon); | ||
1107 | if (bond->params.arp_interval) { | 1048 | if (bond->params.arp_interval) { |
1108 | pr_info(DRV_NAME | 1049 | pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n", |
1109 | ": %s: MII monitoring cannot be used with " | 1050 | bond->dev->name); |
1110 | "ARP monitoring. Disabling ARP monitoring...\n", | ||
1111 | bond->dev->name); | ||
1112 | bond->params.arp_interval = 0; | 1051 | bond->params.arp_interval = 0; |
1113 | bond->dev->priv_flags &= ~IFF_MASTER_ARPMON; | 1052 | bond->dev->priv_flags &= ~IFF_MASTER_ARPMON; |
1114 | if (bond->params.arp_validate) { | 1053 | if (bond->params.arp_validate) { |
@@ -1176,17 +1115,15 @@ static ssize_t bonding_store_primary(struct device *d, | |||
1176 | write_lock_bh(&bond->curr_slave_lock); | 1115 | write_lock_bh(&bond->curr_slave_lock); |
1177 | 1116 | ||
1178 | if (!USES_PRIMARY(bond->params.mode)) { | 1117 | if (!USES_PRIMARY(bond->params.mode)) { |
1179 | pr_info(DRV_NAME | 1118 | pr_info("%s: Unable to set primary slave; %s is in mode %d\n", |
1180 | ": %s: Unable to set primary slave; %s is in mode %d\n", | 1119 | bond->dev->name, bond->dev->name, bond->params.mode); |
1181 | bond->dev->name, bond->dev->name, bond->params.mode); | ||
1182 | } else { | 1120 | } else { |
1183 | bond_for_each_slave(bond, slave, i) { | 1121 | bond_for_each_slave(bond, slave, i) { |
1184 | if (strnicmp | 1122 | if (strnicmp |
1185 | (slave->dev->name, buf, | 1123 | (slave->dev->name, buf, |
1186 | strlen(slave->dev->name)) == 0) { | 1124 | strlen(slave->dev->name)) == 0) { |
1187 | pr_info(DRV_NAME | 1125 | pr_info("%s: Setting %s as primary slave.\n", |
1188 | ": %s: Setting %s as primary slave.\n", | 1126 | bond->dev->name, slave->dev->name); |
1189 | bond->dev->name, slave->dev->name); | ||
1190 | bond->primary_slave = slave; | 1127 | bond->primary_slave = slave; |
1191 | strcpy(bond->params.primary, slave->dev->name); | 1128 | strcpy(bond->params.primary, slave->dev->name); |
1192 | bond_select_active_slave(bond); | 1129 | bond_select_active_slave(bond); |
@@ -1197,15 +1134,13 @@ static ssize_t bonding_store_primary(struct device *d, | |||
1197 | /* if we got here, then we didn't match the name of any slave */ | 1134 | /* if we got here, then we didn't match the name of any slave */ |
1198 | 1135 | ||
1199 | if (strlen(buf) == 0 || buf[0] == '\n') { | 1136 | if (strlen(buf) == 0 || buf[0] == '\n') { |
1200 | pr_info(DRV_NAME | 1137 | pr_info("%s: Setting primary slave to None.\n", |
1201 | ": %s: Setting primary slave to None.\n", | 1138 | bond->dev->name); |
1202 | bond->dev->name); | ||
1203 | bond->primary_slave = NULL; | 1139 | bond->primary_slave = NULL; |
1204 | bond_select_active_slave(bond); | 1140 | bond_select_active_slave(bond); |
1205 | } else { | 1141 | } else { |
1206 | pr_info(DRV_NAME | 1142 | pr_info("%s: Unable to set %.*s as primary slave as it is not a slave.\n", |
1207 | ": %s: Unable to set %.*s as primary slave as it is not a slave.\n", | 1143 | bond->dev->name, (int)strlen(buf) - 1, buf); |
1208 | bond->dev->name, (int)strlen(buf) - 1, buf); | ||
1209 | } | 1144 | } |
1210 | } | 1145 | } |
1211 | out: | 1146 | out: |
@@ -1244,8 +1179,7 @@ static ssize_t bonding_store_primary_reselect(struct device *d, | |||
1244 | 1179 | ||
1245 | new_value = bond_parse_parm(buf, pri_reselect_tbl); | 1180 | new_value = bond_parse_parm(buf, pri_reselect_tbl); |
1246 | if (new_value < 0) { | 1181 | if (new_value < 0) { |
1247 | pr_err(DRV_NAME | 1182 | pr_err("%s: Ignoring invalid primary_reselect value %.*s.\n", |
1248 | ": %s: Ignoring invalid primary_reselect value %.*s.\n", | ||
1249 | bond->dev->name, | 1183 | bond->dev->name, |
1250 | (int) strlen(buf) - 1, buf); | 1184 | (int) strlen(buf) - 1, buf); |
1251 | ret = -EINVAL; | 1185 | ret = -EINVAL; |
@@ -1253,7 +1187,7 @@ static ssize_t bonding_store_primary_reselect(struct device *d, | |||
1253 | } | 1187 | } |
1254 | 1188 | ||
1255 | bond->params.primary_reselect = new_value; | 1189 | bond->params.primary_reselect = new_value; |
1256 | pr_info(DRV_NAME ": %s: setting primary_reselect to %s (%d).\n", | 1190 | pr_info("%s: setting primary_reselect to %s (%d).\n", |
1257 | bond->dev->name, pri_reselect_tbl[new_value].modename, | 1191 | bond->dev->name, pri_reselect_tbl[new_value].modename, |
1258 | new_value); | 1192 | new_value); |
1259 | 1193 | ||
@@ -1291,20 +1225,18 @@ static ssize_t bonding_store_carrier(struct device *d, | |||
1291 | 1225 | ||
1292 | 1226 | ||
1293 | if (sscanf(buf, "%d", &new_value) != 1) { | 1227 | if (sscanf(buf, "%d", &new_value) != 1) { |
1294 | pr_err(DRV_NAME | 1228 | pr_err("%s: no use_carrier value specified.\n", |
1295 | ": %s: no use_carrier value specified.\n", | ||
1296 | bond->dev->name); | 1229 | bond->dev->name); |
1297 | ret = -EINVAL; | 1230 | ret = -EINVAL; |
1298 | goto out; | 1231 | goto out; |
1299 | } | 1232 | } |
1300 | if ((new_value == 0) || (new_value == 1)) { | 1233 | if ((new_value == 0) || (new_value == 1)) { |
1301 | bond->params.use_carrier = new_value; | 1234 | bond->params.use_carrier = new_value; |
1302 | pr_info(DRV_NAME ": %s: Setting use_carrier to %d.\n", | 1235 | pr_info("%s: Setting use_carrier to %d.\n", |
1303 | bond->dev->name, new_value); | 1236 | bond->dev->name, new_value); |
1304 | } else { | 1237 | } else { |
1305 | pr_info(DRV_NAME | 1238 | pr_info("%s: Ignoring invalid use_carrier value %d.\n", |
1306 | ": %s: Ignoring invalid use_carrier value %d.\n", | 1239 | bond->dev->name, new_value); |
1307 | bond->dev->name, new_value); | ||
1308 | } | 1240 | } |
1309 | out: | 1241 | out: |
1310 | return count; | 1242 | return count; |
@@ -1349,8 +1281,7 @@ static ssize_t bonding_store_active_slave(struct device *d, | |||
1349 | write_lock_bh(&bond->curr_slave_lock); | 1281 | write_lock_bh(&bond->curr_slave_lock); |
1350 | 1282 | ||
1351 | if (!USES_PRIMARY(bond->params.mode)) | 1283 | if (!USES_PRIMARY(bond->params.mode)) |
1352 | pr_info(DRV_NAME ": %s: Unable to change active slave;" | 1284 | pr_info("%s: Unable to change active slave; %s is in mode %d\n", |
1353 | " %s is in mode %d\n", | ||
1354 | bond->dev->name, bond->dev->name, bond->params.mode); | 1285 | bond->dev->name, bond->dev->name, bond->params.mode); |
1355 | else { | 1286 | else { |
1356 | bond_for_each_slave(bond, slave, i) { | 1287 | bond_for_each_slave(bond, slave, i) { |
@@ -1361,9 +1292,9 @@ static ssize_t bonding_store_active_slave(struct device *d, | |||
1361 | new_active = slave; | 1292 | new_active = slave; |
1362 | if (new_active == old_active) { | 1293 | if (new_active == old_active) { |
1363 | /* do nothing */ | 1294 | /* do nothing */ |
1364 | pr_info(DRV_NAME | 1295 | pr_info("%s: %s is already the current active slave.\n", |
1365 | ": %s: %s is already the current active slave.\n", | 1296 | bond->dev->name, |
1366 | bond->dev->name, slave->dev->name); | 1297 | slave->dev->name); |
1367 | goto out; | 1298 | goto out; |
1368 | } | 1299 | } |
1369 | else { | 1300 | else { |
@@ -1371,16 +1302,15 @@ static ssize_t bonding_store_active_slave(struct device *d, | |||
1371 | (old_active) && | 1302 | (old_active) && |
1372 | (new_active->link == BOND_LINK_UP) && | 1303 | (new_active->link == BOND_LINK_UP) && |
1373 | IS_UP(new_active->dev)) { | 1304 | IS_UP(new_active->dev)) { |
1374 | pr_info(DRV_NAME | 1305 | pr_info("%s: Setting %s as active slave.\n", |
1375 | ": %s: Setting %s as active slave.\n", | 1306 | bond->dev->name, |
1376 | bond->dev->name, slave->dev->name); | 1307 | slave->dev->name); |
1377 | bond_change_active_slave(bond, new_active); | 1308 | bond_change_active_slave(bond, new_active); |
1378 | } | 1309 | } |
1379 | else { | 1310 | else { |
1380 | pr_info(DRV_NAME | 1311 | pr_info("%s: Could not set %s as active slave; either %s is down or the link is down.\n", |
1381 | ": %s: Could not set %s as active slave; " | 1312 | bond->dev->name, |
1382 | "either %s is down or the link is down.\n", | 1313 | slave->dev->name, |
1383 | bond->dev->name, slave->dev->name, | ||
1384 | slave->dev->name); | 1314 | slave->dev->name); |
1385 | } | 1315 | } |
1386 | goto out; | 1316 | goto out; |
@@ -1391,14 +1321,12 @@ static ssize_t bonding_store_active_slave(struct device *d, | |||
1391 | /* if we got here, then we didn't match the name of any slave */ | 1321 | /* if we got here, then we didn't match the name of any slave */ |
1392 | 1322 | ||
1393 | if (strlen(buf) == 0 || buf[0] == '\n') { | 1323 | if (strlen(buf) == 0 || buf[0] == '\n') { |
1394 | pr_info(DRV_NAME | 1324 | pr_info("%s: Setting active slave to None.\n", |
1395 | ": %s: Setting active slave to None.\n", | ||
1396 | bond->dev->name); | 1325 | bond->dev->name); |
1397 | bond->primary_slave = NULL; | 1326 | bond->primary_slave = NULL; |
1398 | bond_select_active_slave(bond); | 1327 | bond_select_active_slave(bond); |
1399 | } else { | 1328 | } else { |
1400 | pr_info(DRV_NAME ": %s: Unable to set %.*s" | 1329 | pr_info("%s: Unable to set %.*s as active slave as it is not a slave.\n", |
1401 | " as active slave as it is not a slave.\n", | ||
1402 | bond->dev->name, (int)strlen(buf) - 1, buf); | 1330 | bond->dev->name, (int)strlen(buf) - 1, buf); |
1403 | } | 1331 | } |
1404 | } | 1332 | } |
@@ -1600,8 +1528,7 @@ int bond_create_sysfs(void) | |||
1600 | /* Is someone being kinky and naming a device bonding_master? */ | 1528 | /* Is someone being kinky and naming a device bonding_master? */ |
1601 | if (__dev_get_by_name(&init_net, | 1529 | if (__dev_get_by_name(&init_net, |
1602 | class_attr_bonding_masters.attr.name)) | 1530 | class_attr_bonding_masters.attr.name)) |
1603 | pr_err("network device named %s already " | 1531 | pr_err("network device named %s already exists in sysfs", |
1604 | "exists in sysfs", | ||
1605 | class_attr_bonding_masters.attr.name); | 1532 | class_attr_bonding_masters.attr.name); |
1606 | ret = 0; | 1533 | ret = 0; |
1607 | } | 1534 | } |
diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig index 8c485aad1b94..05b751719bd5 100644 --- a/drivers/net/can/Kconfig +++ b/drivers/net/can/Kconfig | |||
@@ -50,7 +50,7 @@ config CAN_TI_HECC | |||
50 | 50 | ||
51 | config CAN_MCP251X | 51 | config CAN_MCP251X |
52 | tristate "Microchip MCP251x SPI CAN controllers" | 52 | tristate "Microchip MCP251x SPI CAN controllers" |
53 | depends on CAN_DEV && SPI | 53 | depends on CAN_DEV && SPI && HAS_DMA |
54 | ---help--- | 54 | ---help--- |
55 | Driver for the Microchip MCP251x SPI CAN controllers. | 55 | Driver for the Microchip MCP251x SPI CAN controllers. |
56 | 56 | ||
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c index cbe3fce53e3b..166cc7e579c0 100644 --- a/drivers/net/can/at91_can.c +++ b/drivers/net/can/at91_can.c | |||
@@ -474,7 +474,7 @@ static void at91_read_mb(struct net_device *dev, unsigned int mb, | |||
474 | reg_msr = at91_read(priv, AT91_MSR(mb)); | 474 | reg_msr = at91_read(priv, AT91_MSR(mb)); |
475 | if (reg_msr & AT91_MSR_MRTR) | 475 | if (reg_msr & AT91_MSR_MRTR) |
476 | cf->can_id |= CAN_RTR_FLAG; | 476 | cf->can_id |= CAN_RTR_FLAG; |
477 | cf->can_dlc = min_t(__u8, (reg_msr >> 16) & 0xf, 8); | 477 | cf->can_dlc = get_can_dlc((reg_msr >> 16) & 0xf); |
478 | 478 | ||
479 | *(u32 *)(cf->data + 0) = at91_read(priv, AT91_MDL(mb)); | 479 | *(u32 *)(cf->data + 0) = at91_read(priv, AT91_MDL(mb)); |
480 | *(u32 *)(cf->data + 4) = at91_read(priv, AT91_MDH(mb)); | 480 | *(u32 *)(cf->data + 4) = at91_read(priv, AT91_MDH(mb)); |
@@ -1037,7 +1037,7 @@ static int __init at91_can_probe(struct platform_device *pdev) | |||
1037 | 1037 | ||
1038 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1038 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1039 | irq = platform_get_irq(pdev, 0); | 1039 | irq = platform_get_irq(pdev, 0); |
1040 | if (!res || !irq) { | 1040 | if (!res || irq <= 0) { |
1041 | err = -ENODEV; | 1041 | err = -ENODEV; |
1042 | goto exit_put; | 1042 | goto exit_put; |
1043 | } | 1043 | } |
diff --git a/drivers/net/can/bfin_can.c b/drivers/net/can/bfin_can.c index c7fc1de28173..0ec1524523cc 100644 --- a/drivers/net/can/bfin_can.c +++ b/drivers/net/can/bfin_can.c | |||
@@ -392,7 +392,7 @@ static void bfin_can_rx(struct net_device *dev, u16 isrc) | |||
392 | cf->can_id |= CAN_RTR_FLAG; | 392 | cf->can_id |= CAN_RTR_FLAG; |
393 | 393 | ||
394 | /* get data length code */ | 394 | /* get data length code */ |
395 | cf->can_dlc = bfin_read16(®->chl[obj].dlc); | 395 | cf->can_dlc = get_can_dlc(bfin_read16(®->chl[obj].dlc) & 0xF); |
396 | 396 | ||
397 | /* get payload */ | 397 | /* get payload */ |
398 | for (i = 0; i < 8; i += 2) { | 398 | for (i = 0; i < 8; i += 2) { |
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c index 78b1b69b2921..1a72ca066a17 100644 --- a/drivers/net/can/mcp251x.c +++ b/drivers/net/can/mcp251x.c | |||
@@ -403,9 +403,8 @@ static void mcp251x_hw_rx_frame(struct spi_device *spi, u8 *buf, | |||
403 | 403 | ||
404 | for (i = 1; i < RXBDAT_OFF; i++) | 404 | for (i = 1; i < RXBDAT_OFF; i++) |
405 | buf[i] = mcp251x_read_reg(spi, RXBCTRL(buf_idx) + i); | 405 | buf[i] = mcp251x_read_reg(spi, RXBCTRL(buf_idx) + i); |
406 | len = buf[RXBDLC_OFF] & RXBDLC_LEN_MASK; | 406 | |
407 | if (len > 8) | 407 | len = get_can_dlc(buf[RXBDLC_OFF] & RXBDLC_LEN_MASK); |
408 | len = 8; | ||
409 | for (; i < (RXBDAT_OFF + len); i++) | 408 | for (; i < (RXBDAT_OFF + len); i++) |
410 | buf[i] = mcp251x_read_reg(spi, RXBCTRL(buf_idx) + i); | 409 | buf[i] = mcp251x_read_reg(spi, RXBCTRL(buf_idx) + i); |
411 | } else { | 410 | } else { |
@@ -455,13 +454,7 @@ static void mcp251x_hw_rx(struct spi_device *spi, int buf_idx) | |||
455 | (buf[RXBSIDL_OFF] >> RXBSIDL_SHIFT); | 454 | (buf[RXBSIDL_OFF] >> RXBSIDL_SHIFT); |
456 | } | 455 | } |
457 | /* Data length */ | 456 | /* Data length */ |
458 | frame->can_dlc = buf[RXBDLC_OFF] & RXBDLC_LEN_MASK; | 457 | frame->can_dlc = get_can_dlc(buf[RXBDLC_OFF] & RXBDLC_LEN_MASK); |
459 | if (frame->can_dlc > 8) { | ||
460 | dev_warn(&spi->dev, "invalid frame recevied\n"); | ||
461 | priv->net->stats.rx_errors++; | ||
462 | dev_kfree_skb(skb); | ||
463 | return; | ||
464 | } | ||
465 | memcpy(frame->data, buf + RXBDAT_OFF, frame->can_dlc); | 458 | memcpy(frame->data, buf + RXBDAT_OFF, frame->can_dlc); |
466 | 459 | ||
467 | priv->net->stats.rx_packets++; | 460 | priv->net->stats.rx_packets++; |
@@ -997,7 +990,7 @@ static int __devinit mcp251x_can_probe(struct spi_device *spi) | |||
997 | goto error_tx_buf; | 990 | goto error_tx_buf; |
998 | } | 991 | } |
999 | priv->spi_rx_buf = kmalloc(SPI_TRANSFER_BUF_LEN, GFP_KERNEL); | 992 | priv->spi_rx_buf = kmalloc(SPI_TRANSFER_BUF_LEN, GFP_KERNEL); |
1000 | if (!priv->spi_tx_buf) { | 993 | if (!priv->spi_rx_buf) { |
1001 | ret = -ENOMEM; | 994 | ret = -ENOMEM; |
1002 | goto error_rx_buf; | 995 | goto error_rx_buf; |
1003 | } | 996 | } |
diff --git a/drivers/net/can/mscan/mscan.c b/drivers/net/can/mscan/mscan.c index bb06dfb58f25..07346f880ca6 100644 --- a/drivers/net/can/mscan/mscan.c +++ b/drivers/net/can/mscan/mscan.c | |||
@@ -297,7 +297,8 @@ static void mscan_get_rx_frame(struct net_device *dev, struct can_frame *frame) | |||
297 | frame->can_id |= can_id >> 1; | 297 | frame->can_id |= can_id >> 1; |
298 | if (can_id & 1) | 298 | if (can_id & 1) |
299 | frame->can_id |= CAN_RTR_FLAG; | 299 | frame->can_id |= CAN_RTR_FLAG; |
300 | frame->can_dlc = in_8(®s->rx.dlr) & 0xf; | 300 | |
301 | frame->can_dlc = get_can_dlc(in_8(®s->rx.dlr) & 0xf); | ||
301 | 302 | ||
302 | if (!(frame->can_id & CAN_RTR_FLAG)) { | 303 | if (!(frame->can_id & CAN_RTR_FLAG)) { |
303 | void __iomem *data = ®s->rx.dsr1_0; | 304 | void __iomem *data = ®s->rx.dsr1_0; |
diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c index b4ba88a31075..542a4f7255b4 100644 --- a/drivers/net/can/sja1000/sja1000.c +++ b/drivers/net/can/sja1000/sja1000.c | |||
@@ -293,15 +293,14 @@ static void sja1000_rx(struct net_device *dev) | |||
293 | uint8_t fi; | 293 | uint8_t fi; |
294 | uint8_t dreg; | 294 | uint8_t dreg; |
295 | canid_t id; | 295 | canid_t id; |
296 | uint8_t dlc; | ||
297 | int i; | 296 | int i; |
298 | 297 | ||
298 | /* create zero'ed CAN frame buffer */ | ||
299 | skb = alloc_can_skb(dev, &cf); | 299 | skb = alloc_can_skb(dev, &cf); |
300 | if (skb == NULL) | 300 | if (skb == NULL) |
301 | return; | 301 | return; |
302 | 302 | ||
303 | fi = priv->read_reg(priv, REG_FI); | 303 | fi = priv->read_reg(priv, REG_FI); |
304 | dlc = fi & 0x0F; | ||
305 | 304 | ||
306 | if (fi & FI_FF) { | 305 | if (fi & FI_FF) { |
307 | /* extended frame format (EFF) */ | 306 | /* extended frame format (EFF) */ |
@@ -318,16 +317,15 @@ static void sja1000_rx(struct net_device *dev) | |||
318 | | (priv->read_reg(priv, REG_ID2) >> 5); | 317 | | (priv->read_reg(priv, REG_ID2) >> 5); |
319 | } | 318 | } |
320 | 319 | ||
321 | if (fi & FI_RTR) | 320 | if (fi & FI_RTR) { |
322 | id |= CAN_RTR_FLAG; | 321 | id |= CAN_RTR_FLAG; |
322 | } else { | ||
323 | cf->can_dlc = get_can_dlc(fi & 0x0F); | ||
324 | for (i = 0; i < cf->can_dlc; i++) | ||
325 | cf->data[i] = priv->read_reg(priv, dreg++); | ||
326 | } | ||
323 | 327 | ||
324 | cf->can_id = id; | 328 | cf->can_id = id; |
325 | cf->can_dlc = dlc; | ||
326 | for (i = 0; i < dlc; i++) | ||
327 | cf->data[i] = priv->read_reg(priv, dreg++); | ||
328 | |||
329 | while (i < 8) | ||
330 | cf->data[i++] = 0; | ||
331 | 329 | ||
332 | /* release receive buffer */ | 330 | /* release receive buffer */ |
333 | priv->write_reg(priv, REG_CMR, CMD_RRB); | 331 | priv->write_reg(priv, REG_CMR, CMD_RRB); |
@@ -335,7 +333,7 @@ static void sja1000_rx(struct net_device *dev) | |||
335 | netif_rx(skb); | 333 | netif_rx(skb); |
336 | 334 | ||
337 | stats->rx_packets++; | 335 | stats->rx_packets++; |
338 | stats->rx_bytes += dlc; | 336 | stats->rx_bytes += cf->can_dlc; |
339 | } | 337 | } |
340 | 338 | ||
341 | static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) | 339 | static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) |
diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c index 07e8016b17ec..5c993c2da528 100644 --- a/drivers/net/can/ti_hecc.c +++ b/drivers/net/can/ti_hecc.c | |||
@@ -552,7 +552,7 @@ static int ti_hecc_rx_pkt(struct ti_hecc_priv *priv, int mbxno) | |||
552 | data = hecc_read_mbx(priv, mbxno, HECC_CANMCF); | 552 | data = hecc_read_mbx(priv, mbxno, HECC_CANMCF); |
553 | if (data & HECC_CANMCF_RTR) | 553 | if (data & HECC_CANMCF_RTR) |
554 | cf->can_id |= CAN_RTR_FLAG; | 554 | cf->can_id |= CAN_RTR_FLAG; |
555 | cf->can_dlc = data & 0xF; | 555 | cf->can_dlc = get_can_dlc(data & 0xF); |
556 | data = hecc_read_mbx(priv, mbxno, HECC_CANMDL); | 556 | data = hecc_read_mbx(priv, mbxno, HECC_CANMDL); |
557 | *(u32 *)(cf->data) = cpu_to_be32(data); | 557 | *(u32 *)(cf->data) = cpu_to_be32(data); |
558 | if (cf->can_dlc > 4) { | 558 | if (cf->can_dlc > 4) { |
diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c index 591eb0eb1c2b..efbb05c71bf4 100644 --- a/drivers/net/can/usb/ems_usb.c +++ b/drivers/net/can/usb/ems_usb.c | |||
@@ -316,7 +316,7 @@ static void ems_usb_rx_can_msg(struct ems_usb *dev, struct ems_cpc_msg *msg) | |||
316 | return; | 316 | return; |
317 | 317 | ||
318 | cf->can_id = le32_to_cpu(msg->msg.can_msg.id); | 318 | cf->can_id = le32_to_cpu(msg->msg.can_msg.id); |
319 | cf->can_dlc = min_t(u8, msg->msg.can_msg.length, 8); | 319 | cf->can_dlc = get_can_dlc(msg->msg.can_msg.length & 0xF); |
320 | 320 | ||
321 | if (msg->type == CPC_MSG_TYPE_EXT_CAN_FRAME || | 321 | if (msg->type == CPC_MSG_TYPE_EXT_CAN_FRAME || |
322 | msg->type == CPC_MSG_TYPE_EXT_RTR_FRAME) | 322 | msg->type == CPC_MSG_TYPE_EXT_RTR_FRAME) |
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c index 678222389407..8d0be26f94e3 100644 --- a/drivers/net/cpmac.c +++ b/drivers/net/cpmac.c | |||
@@ -1163,7 +1163,7 @@ static int __devinit cpmac_probe(struct platform_device *pdev) | |||
1163 | priv->dev = dev; | 1163 | priv->dev = dev; |
1164 | priv->ring_size = 64; | 1164 | priv->ring_size = 64; |
1165 | priv->msg_enable = netif_msg_init(debug_level, 0xff); | 1165 | priv->msg_enable = netif_msg_init(debug_level, 0xff); |
1166 | memcpy(dev->dev_addr, pdata->dev_addr, sizeof(dev->dev_addr)); | 1166 | memcpy(dev->dev_addr, pdata->dev_addr, sizeof(pdata->dev_addr)); |
1167 | 1167 | ||
1168 | snprintf(priv->phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id); | 1168 | snprintf(priv->phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id); |
1169 | 1169 | ||
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/davinci_emac.c b/drivers/net/davinci_emac.c index 8edac8915ea8..33c4fe26178c 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c | |||
@@ -2272,7 +2272,7 @@ static int emac_mii_reset(struct mii_bus *bus) | |||
2272 | unsigned int clk_div; | 2272 | unsigned int clk_div; |
2273 | int mdio_bus_freq = emac_bus_frequency; | 2273 | int mdio_bus_freq = emac_bus_frequency; |
2274 | 2274 | ||
2275 | if (mdio_max_freq & mdio_bus_freq) | 2275 | if (mdio_max_freq && mdio_bus_freq) |
2276 | clk_div = ((mdio_bus_freq / mdio_max_freq) - 1); | 2276 | clk_div = ((mdio_bus_freq / mdio_max_freq) - 1); |
2277 | else | 2277 | else |
2278 | clk_div = 0xFF; | 2278 | clk_div = 0xFF; |
@@ -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/dm9000.c b/drivers/net/dm9000.c index 0cbe3c0e7c06..b37730065688 100644 --- a/drivers/net/dm9000.c +++ b/drivers/net/dm9000.c | |||
@@ -1646,7 +1646,7 @@ dm9000_drv_resume(struct device *dev) | |||
1646 | return 0; | 1646 | return 0; |
1647 | } | 1647 | } |
1648 | 1648 | ||
1649 | static struct dev_pm_ops dm9000_drv_pm_ops = { | 1649 | static const struct dev_pm_ops dm9000_drv_pm_ops = { |
1650 | .suspend = dm9000_drv_suspend, | 1650 | .suspend = dm9000_drv_suspend, |
1651 | .resume = dm9000_drv_resume, | 1651 | .resume = dm9000_drv_resume, |
1652 | }; | 1652 | }; |
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 929701ca07d3..839fb2b136d3 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -1829,6 +1829,7 @@ static int e100_alloc_cbs(struct nic *nic) | |||
1829 | &nic->cbs_dma_addr); | 1829 | &nic->cbs_dma_addr); |
1830 | if (!nic->cbs) | 1830 | if (!nic->cbs) |
1831 | return -ENOMEM; | 1831 | return -ENOMEM; |
1832 | memset(nic->cbs, 0, count * sizeof(struct cb)); | ||
1832 | 1833 | ||
1833 | for (cb = nic->cbs, i = 0; i < count; cb++, i++) { | 1834 | for (cb = nic->cbs, i = 0; i < count; cb++, i++) { |
1834 | cb->next = (i + 1 < count) ? cb + 1 : nic->cbs; | 1835 | cb->next = (i + 1 < count) ? cb + 1 : nic->cbs; |
@@ -1837,7 +1838,6 @@ static int e100_alloc_cbs(struct nic *nic) | |||
1837 | cb->dma_addr = nic->cbs_dma_addr + i * sizeof(struct cb); | 1838 | cb->dma_addr = nic->cbs_dma_addr + i * sizeof(struct cb); |
1838 | cb->link = cpu_to_le32(nic->cbs_dma_addr + | 1839 | cb->link = cpu_to_le32(nic->cbs_dma_addr + |
1839 | ((i+1) % count) * sizeof(struct cb)); | 1840 | ((i+1) % count) * sizeof(struct cb)); |
1840 | cb->skb = NULL; | ||
1841 | } | 1841 | } |
1842 | 1842 | ||
1843 | nic->cb_to_use = nic->cb_to_send = nic->cb_to_clean = nic->cbs; | 1843 | nic->cb_to_use = nic->cb_to_send = nic->cb_to_clean = nic->cbs; |
diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c index c1a42cfc80ba..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) { |
@@ -1290,7 +1292,6 @@ static s32 e1000_setup_link_82571(struct e1000_hw *hw) | |||
1290 | static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw) | 1292 | static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw) |
1291 | { | 1293 | { |
1292 | u32 ctrl; | 1294 | u32 ctrl; |
1293 | u32 led_ctrl; | ||
1294 | s32 ret_val; | 1295 | s32 ret_val; |
1295 | 1296 | ||
1296 | ctrl = er32(CTRL); | 1297 | ctrl = er32(CTRL); |
@@ -1305,11 +1306,6 @@ static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw) | |||
1305 | break; | 1306 | break; |
1306 | case e1000_phy_igp_2: | 1307 | case e1000_phy_igp_2: |
1307 | ret_val = e1000e_copper_link_setup_igp(hw); | 1308 | ret_val = e1000e_copper_link_setup_igp(hw); |
1308 | /* Setup activity LED */ | ||
1309 | led_ctrl = er32(LEDCTL); | ||
1310 | led_ctrl &= IGP_ACTIVITY_LED_MASK; | ||
1311 | led_ctrl |= (IGP_ACTIVITY_LED_ENABLE | IGP_LED3_MODE); | ||
1312 | ew32(LEDCTL, led_ctrl); | ||
1313 | break; | 1309 | break; |
1314 | default: | 1310 | default: |
1315 | return -E1000_ERR_PHY; | 1311 | return -E1000_ERR_PHY; |
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index cebbd9079d53..d6ee28f6ea08 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h | |||
@@ -582,7 +582,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); | 582 | 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, | 583 | extern s32 e1000_write_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, |
584 | u16 data); | 584 | 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); | 585 | extern s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw); |
587 | extern s32 e1000_copper_link_setup_82577(struct e1000_hw *hw); | 586 | extern s32 e1000_copper_link_setup_82577(struct e1000_hw *hw); |
588 | extern s32 e1000_check_polarity_82577(struct e1000_hw *hw); | 587 | 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..c45965a256b6 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -3315,24 +3315,24 @@ void e1000e_update_stats(struct e1000_adapter *adapter) | |||
3315 | if ((hw->phy.type == e1000_phy_82578) || | 3315 | if ((hw->phy.type == e1000_phy_82578) || |
3316 | (hw->phy.type == e1000_phy_82577)) { | 3316 | (hw->phy.type == e1000_phy_82577)) { |
3317 | e1e_rphy(hw, HV_SCC_UPPER, &phy_data); | 3317 | e1e_rphy(hw, HV_SCC_UPPER, &phy_data); |
3318 | e1e_rphy(hw, HV_SCC_LOWER, &phy_data); | 3318 | if (!e1e_rphy(hw, HV_SCC_LOWER, &phy_data)) |
3319 | adapter->stats.scc += phy_data; | 3319 | adapter->stats.scc += phy_data; |
3320 | 3320 | ||
3321 | e1e_rphy(hw, HV_ECOL_UPPER, &phy_data); | 3321 | e1e_rphy(hw, HV_ECOL_UPPER, &phy_data); |
3322 | e1e_rphy(hw, HV_ECOL_LOWER, &phy_data); | 3322 | if (!e1e_rphy(hw, HV_ECOL_LOWER, &phy_data)) |
3323 | adapter->stats.ecol += phy_data; | 3323 | adapter->stats.ecol += phy_data; |
3324 | 3324 | ||
3325 | e1e_rphy(hw, HV_MCC_UPPER, &phy_data); | 3325 | e1e_rphy(hw, HV_MCC_UPPER, &phy_data); |
3326 | e1e_rphy(hw, HV_MCC_LOWER, &phy_data); | 3326 | if (!e1e_rphy(hw, HV_MCC_LOWER, &phy_data)) |
3327 | adapter->stats.mcc += phy_data; | 3327 | adapter->stats.mcc += phy_data; |
3328 | 3328 | ||
3329 | e1e_rphy(hw, HV_LATECOL_UPPER, &phy_data); | 3329 | e1e_rphy(hw, HV_LATECOL_UPPER, &phy_data); |
3330 | e1e_rphy(hw, HV_LATECOL_LOWER, &phy_data); | 3330 | if (!e1e_rphy(hw, HV_LATECOL_LOWER, &phy_data)) |
3331 | adapter->stats.latecol += phy_data; | 3331 | adapter->stats.latecol += phy_data; |
3332 | 3332 | ||
3333 | e1e_rphy(hw, HV_DC_UPPER, &phy_data); | 3333 | e1e_rphy(hw, HV_DC_UPPER, &phy_data); |
3334 | e1e_rphy(hw, HV_DC_LOWER, &phy_data); | 3334 | if (!e1e_rphy(hw, HV_DC_LOWER, &phy_data)) |
3335 | adapter->stats.dc += phy_data; | 3335 | adapter->stats.dc += phy_data; |
3336 | } else { | 3336 | } else { |
3337 | adapter->stats.scc += er32(SCC); | 3337 | adapter->stats.scc += er32(SCC); |
3338 | adapter->stats.ecol += er32(ECOL); | 3338 | adapter->stats.ecol += er32(ECOL); |
@@ -3360,8 +3360,8 @@ void e1000e_update_stats(struct e1000_adapter *adapter) | |||
3360 | if ((hw->phy.type == e1000_phy_82578) || | 3360 | if ((hw->phy.type == e1000_phy_82578) || |
3361 | (hw->phy.type == e1000_phy_82577)) { | 3361 | (hw->phy.type == e1000_phy_82577)) { |
3362 | e1e_rphy(hw, HV_COLC_UPPER, &phy_data); | 3362 | e1e_rphy(hw, HV_COLC_UPPER, &phy_data); |
3363 | e1e_rphy(hw, HV_COLC_LOWER, &phy_data); | 3363 | if (!e1e_rphy(hw, HV_COLC_LOWER, &phy_data)) |
3364 | hw->mac.collision_delta = phy_data; | 3364 | hw->mac.collision_delta = phy_data; |
3365 | } else { | 3365 | } else { |
3366 | hw->mac.collision_delta = er32(COLC); | 3366 | hw->mac.collision_delta = er32(COLC); |
3367 | } | 3367 | } |
@@ -3372,8 +3372,8 @@ void e1000e_update_stats(struct e1000_adapter *adapter) | |||
3372 | if ((hw->phy.type == e1000_phy_82578) || | 3372 | if ((hw->phy.type == e1000_phy_82578) || |
3373 | (hw->phy.type == e1000_phy_82577)) { | 3373 | (hw->phy.type == e1000_phy_82577)) { |
3374 | e1e_rphy(hw, HV_TNCRS_UPPER, &phy_data); | 3374 | e1e_rphy(hw, HV_TNCRS_UPPER, &phy_data); |
3375 | e1e_rphy(hw, HV_TNCRS_LOWER, &phy_data); | 3375 | if (!e1e_rphy(hw, HV_TNCRS_LOWER, &phy_data)) |
3376 | adapter->stats.tncrs += phy_data; | 3376 | adapter->stats.tncrs += phy_data; |
3377 | } else { | 3377 | } else { |
3378 | if ((hw->mac.type != e1000_82574) && | 3378 | if ((hw->mac.type != e1000_82574) && |
3379 | (hw->mac.type != e1000_82583)) | 3379 | (hw->mac.type != e1000_82583)) |
@@ -4674,6 +4674,7 @@ static int e1000_resume(struct pci_dev *pdev) | |||
4674 | 4674 | ||
4675 | pci_set_power_state(pdev, PCI_D0); | 4675 | pci_set_power_state(pdev, PCI_D0); |
4676 | pci_restore_state(pdev); | 4676 | pci_restore_state(pdev); |
4677 | pci_save_state(pdev); | ||
4677 | e1000e_disable_l1aspm(pdev); | 4678 | e1000e_disable_l1aspm(pdev); |
4678 | 4679 | ||
4679 | err = pci_enable_device_mem(pdev); | 4680 | err = pci_enable_device_mem(pdev); |
@@ -4825,6 +4826,7 @@ static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev) | |||
4825 | } else { | 4826 | } else { |
4826 | pci_set_master(pdev); | 4827 | pci_set_master(pdev); |
4827 | pci_restore_state(pdev); | 4828 | pci_restore_state(pdev); |
4829 | pci_save_state(pdev); | ||
4828 | 4830 | ||
4829 | pci_enable_wake(pdev, PCI_D3hot, 0); | 4831 | pci_enable_wake(pdev, PCI_D3hot, 0); |
4830 | pci_enable_wake(pdev, PCI_D3cold, 0); | 4832 | 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 6850dc0a7b91..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"); |
@@ -357,8 +356,11 @@ static void gfar_init_mac(struct net_device *ndev) | |||
357 | /* Configure the coalescing support */ | 356 | /* Configure the coalescing support */ |
358 | gfar_configure_coalescing(priv, 0xFF, 0xFF); | 357 | gfar_configure_coalescing(priv, 0xFF, 0xFF); |
359 | 358 | ||
360 | if (priv->rx_filer_enable) | 359 | if (priv->rx_filer_enable) { |
361 | rctrl |= RCTRL_FILREN; | 360 | rctrl |= RCTRL_FILREN; |
361 | /* Program the RIR0 reg with the required distribution */ | ||
362 | gfar_write(®s->rir0, DEFAULT_RIR0); | ||
363 | } | ||
362 | 364 | ||
363 | if (priv->rx_csum_enable) | 365 | if (priv->rx_csum_enable) |
364 | rctrl |= RCTRL_CHECKSUMMING; | 366 | rctrl |= RCTRL_CHECKSUMMING; |
@@ -414,6 +416,36 @@ static void gfar_init_mac(struct net_device *ndev) | |||
414 | gfar_write(®s->fifo_tx_starve_shutoff, priv->fifo_starve_off); | 416 | gfar_write(®s->fifo_tx_starve_shutoff, priv->fifo_starve_off); |
415 | } | 417 | } |
416 | 418 | ||
419 | static struct net_device_stats *gfar_get_stats(struct net_device *dev) | ||
420 | { | ||
421 | struct gfar_private *priv = netdev_priv(dev); | ||
422 | struct netdev_queue *txq; | ||
423 | unsigned long rx_packets = 0, rx_bytes = 0, rx_dropped = 0; | ||
424 | unsigned long tx_packets = 0, tx_bytes = 0; | ||
425 | int i = 0; | ||
426 | |||
427 | for (i = 0; i < priv->num_rx_queues; i++) { | ||
428 | rx_packets += priv->rx_queue[i]->stats.rx_packets; | ||
429 | rx_bytes += priv->rx_queue[i]->stats.rx_bytes; | ||
430 | rx_dropped += priv->rx_queue[i]->stats.rx_dropped; | ||
431 | } | ||
432 | |||
433 | dev->stats.rx_packets = rx_packets; | ||
434 | dev->stats.rx_bytes = rx_bytes; | ||
435 | dev->stats.rx_dropped = rx_dropped; | ||
436 | |||
437 | for (i = 0; i < priv->num_tx_queues; i++) { | ||
438 | txq = netdev_get_tx_queue(dev, i); | ||
439 | tx_bytes += txq->tx_bytes; | ||
440 | tx_packets += txq->tx_packets; | ||
441 | } | ||
442 | |||
443 | dev->stats.tx_bytes = tx_bytes; | ||
444 | dev->stats.tx_packets = tx_packets; | ||
445 | |||
446 | return &dev->stats; | ||
447 | } | ||
448 | |||
417 | static const struct net_device_ops gfar_netdev_ops = { | 449 | static const struct net_device_ops gfar_netdev_ops = { |
418 | .ndo_open = gfar_enet_open, | 450 | .ndo_open = gfar_enet_open, |
419 | .ndo_start_xmit = gfar_start_xmit, | 451 | .ndo_start_xmit = gfar_start_xmit, |
@@ -422,7 +454,7 @@ static const struct net_device_ops gfar_netdev_ops = { | |||
422 | .ndo_set_multicast_list = gfar_set_multi, | 454 | .ndo_set_multicast_list = gfar_set_multi, |
423 | .ndo_tx_timeout = gfar_timeout, | 455 | .ndo_tx_timeout = gfar_timeout, |
424 | .ndo_do_ioctl = gfar_ioctl, | 456 | .ndo_do_ioctl = gfar_ioctl, |
425 | .ndo_select_queue = gfar_select_queue, | 457 | .ndo_get_stats = gfar_get_stats, |
426 | .ndo_vlan_rx_register = gfar_vlan_rx_register, | 458 | .ndo_vlan_rx_register = gfar_vlan_rx_register, |
427 | .ndo_set_mac_address = eth_mac_addr, | 459 | .ndo_set_mac_address = eth_mac_addr, |
428 | .ndo_validate_addr = eth_validate_addr, | 460 | .ndo_validate_addr = eth_validate_addr, |
@@ -472,10 +504,6 @@ static inline int gfar_uses_fcb(struct gfar_private *priv) | |||
472 | return priv->vlgrp || priv->rx_csum_enable; | 504 | return priv->vlgrp || priv->rx_csum_enable; |
473 | } | 505 | } |
474 | 506 | ||
475 | u16 gfar_select_queue(struct net_device *dev, struct sk_buff *skb) | ||
476 | { | ||
477 | return skb_get_queue_mapping(skb); | ||
478 | } | ||
479 | static void free_tx_pointers(struct gfar_private *priv) | 507 | static void free_tx_pointers(struct gfar_private *priv) |
480 | { | 508 | { |
481 | int i = 0; | 509 | int i = 0; |
@@ -1022,6 +1050,9 @@ static int gfar_probe(struct of_device *ofdev, | |||
1022 | priv->rx_queue[i]->rxic = DEFAULT_RXIC; | 1050 | priv->rx_queue[i]->rxic = DEFAULT_RXIC; |
1023 | } | 1051 | } |
1024 | 1052 | ||
1053 | /* enable filer if using multiple RX queues*/ | ||
1054 | if(priv->num_rx_queues > 1) | ||
1055 | priv->rx_filer_enable = 1; | ||
1025 | /* Enable most messages by default */ | 1056 | /* Enable most messages by default */ |
1026 | priv->msg_enable = (NETIF_MSG_IFUP << 1 ) - 1; | 1057 | priv->msg_enable = (NETIF_MSG_IFUP << 1 ) - 1; |
1027 | 1058 | ||
@@ -1937,7 +1968,8 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1937 | } | 1968 | } |
1938 | 1969 | ||
1939 | /* Update transmit stats */ | 1970 | /* Update transmit stats */ |
1940 | dev->stats.tx_bytes += skb->len; | 1971 | txq->tx_bytes += skb->len; |
1972 | txq->tx_packets ++; | ||
1941 | 1973 | ||
1942 | txbdp = txbdp_start = tx_queue->cur_tx; | 1974 | txbdp = txbdp_start = tx_queue->cur_tx; |
1943 | 1975 | ||
@@ -2295,8 +2327,6 @@ static int gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue) | |||
2295 | tx_queue->skb_dirtytx = skb_dirtytx; | 2327 | tx_queue->skb_dirtytx = skb_dirtytx; |
2296 | tx_queue->dirty_tx = bdp; | 2328 | tx_queue->dirty_tx = bdp; |
2297 | 2329 | ||
2298 | dev->stats.tx_packets += howmany; | ||
2299 | |||
2300 | return howmany; | 2330 | return howmany; |
2301 | } | 2331 | } |
2302 | 2332 | ||
@@ -2434,10 +2464,11 @@ static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb, | |||
2434 | fcb = (struct rxfcb *)skb->data; | 2464 | fcb = (struct rxfcb *)skb->data; |
2435 | 2465 | ||
2436 | /* Remove the FCB from the skb */ | 2466 | /* Remove the FCB from the skb */ |
2437 | skb_set_queue_mapping(skb, fcb->rq); | ||
2438 | /* Remove the padded bytes, if there are any */ | 2467 | /* Remove the padded bytes, if there are any */ |
2439 | if (amount_pull) | 2468 | if (amount_pull) { |
2469 | skb_record_rx_queue(skb, fcb->rq); | ||
2440 | skb_pull(skb, amount_pull); | 2470 | skb_pull(skb, amount_pull); |
2471 | } | ||
2441 | 2472 | ||
2442 | if (priv->rx_csum_enable) | 2473 | if (priv->rx_csum_enable) |
2443 | gfar_rx_checksum(skb, fcb); | 2474 | gfar_rx_checksum(skb, fcb); |
@@ -2510,22 +2541,22 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit) | |||
2510 | } | 2541 | } |
2511 | } else { | 2542 | } else { |
2512 | /* Increment the number of packets */ | 2543 | /* Increment the number of packets */ |
2513 | dev->stats.rx_packets++; | 2544 | rx_queue->stats.rx_packets++; |
2514 | howmany++; | 2545 | howmany++; |
2515 | 2546 | ||
2516 | if (likely(skb)) { | 2547 | if (likely(skb)) { |
2517 | pkt_len = bdp->length - ETH_FCS_LEN; | 2548 | pkt_len = bdp->length - ETH_FCS_LEN; |
2518 | /* Remove the FCS from the packet length */ | 2549 | /* Remove the FCS from the packet length */ |
2519 | skb_put(skb, pkt_len); | 2550 | skb_put(skb, pkt_len); |
2520 | dev->stats.rx_bytes += pkt_len; | 2551 | rx_queue->stats.rx_bytes += pkt_len; |
2521 | 2552 | skb_record_rx_queue(skb, rx_queue->qindex); | |
2522 | gfar_process_frame(dev, skb, amount_pull); | 2553 | gfar_process_frame(dev, skb, amount_pull); |
2523 | 2554 | ||
2524 | } else { | 2555 | } else { |
2525 | if (netif_msg_rx_err(priv)) | 2556 | if (netif_msg_rx_err(priv)) |
2526 | printk(KERN_WARNING | 2557 | printk(KERN_WARNING |
2527 | "%s: Missing skb!\n", dev->name); | 2558 | "%s: Missing skb!\n", dev->name); |
2528 | dev->stats.rx_dropped++; | 2559 | rx_queue->stats.rx_dropped++; |
2529 | priv->extra_stats.rx_skbmissing++; | 2560 | priv->extra_stats.rx_skbmissing++; |
2530 | } | 2561 | } |
2531 | 2562 | ||
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h index cbb451011cb5..3d72dc43dca5 100644 --- a/drivers/net/gianfar.h +++ b/drivers/net/gianfar.h | |||
@@ -333,7 +333,7 @@ extern const char gfar_driver_version[]; | |||
333 | #define IMASK_BSY 0x20000000 | 333 | #define IMASK_BSY 0x20000000 |
334 | #define IMASK_EBERR 0x10000000 | 334 | #define IMASK_EBERR 0x10000000 |
335 | #define IMASK_MSRO 0x04000000 | 335 | #define IMASK_MSRO 0x04000000 |
336 | #define IMASK_GRSC 0x02000000 | 336 | #define IMASK_GTSC 0x02000000 |
337 | #define IMASK_BABT 0x01000000 | 337 | #define IMASK_BABT 0x01000000 |
338 | #define IMASK_TXC 0x00800000 | 338 | #define IMASK_TXC 0x00800000 |
339 | #define IMASK_TXEEN 0x00400000 | 339 | #define IMASK_TXEEN 0x00400000 |
@@ -344,7 +344,7 @@ extern const char gfar_driver_version[]; | |||
344 | #define IMASK_XFUN 0x00010000 | 344 | #define IMASK_XFUN 0x00010000 |
345 | #define IMASK_RXB0 0x00008000 | 345 | #define IMASK_RXB0 0x00008000 |
346 | #define IMASK_MAG 0x00000800 | 346 | #define IMASK_MAG 0x00000800 |
347 | #define IMASK_GTSC 0x00000100 | 347 | #define IMASK_GRSC 0x00000100 |
348 | #define IMASK_RXFEN0 0x00000080 | 348 | #define IMASK_RXFEN0 0x00000080 |
349 | #define IMASK_FIR 0x00000008 | 349 | #define IMASK_FIR 0x00000008 |
350 | #define IMASK_FIQ 0x00000004 | 350 | #define IMASK_FIQ 0x00000004 |
@@ -401,6 +401,10 @@ extern const char gfar_driver_version[]; | |||
401 | #define FPR_FILER_MASK 0xFFFFFFFF | 401 | #define FPR_FILER_MASK 0xFFFFFFFF |
402 | #define MAX_FILER_IDX 0xFF | 402 | #define MAX_FILER_IDX 0xFF |
403 | 403 | ||
404 | /* This default RIR value directly corresponds | ||
405 | * to the 3-bit hash value generated */ | ||
406 | #define DEFAULT_RIR0 0x05397700 | ||
407 | |||
404 | /* RQFCR register bits */ | 408 | /* RQFCR register bits */ |
405 | #define RQFCR_GPI 0x80000000 | 409 | #define RQFCR_GPI 0x80000000 |
406 | #define RQFCR_HASHTBL_Q 0x00000000 | 410 | #define RQFCR_HASHTBL_Q 0x00000000 |
@@ -936,6 +940,15 @@ struct gfar_priv_tx_q { | |||
936 | unsigned short txtime; | 940 | unsigned short txtime; |
937 | }; | 941 | }; |
938 | 942 | ||
943 | /* | ||
944 | * Per RX queue stats | ||
945 | */ | ||
946 | struct rx_q_stats { | ||
947 | unsigned long rx_packets; | ||
948 | unsigned long rx_bytes; | ||
949 | unsigned long rx_dropped; | ||
950 | }; | ||
951 | |||
939 | /** | 952 | /** |
940 | * struct gfar_priv_rx_q - per rx queue structure | 953 | * struct gfar_priv_rx_q - per rx queue structure |
941 | * @rxlock: per queue rx spin lock | 954 | * @rxlock: per queue rx spin lock |
@@ -958,6 +971,7 @@ struct gfar_priv_rx_q { | |||
958 | struct rxbd8 *cur_rx; | 971 | struct rxbd8 *cur_rx; |
959 | struct net_device *dev; | 972 | struct net_device *dev; |
960 | struct gfar_priv_grp *grp; | 973 | struct gfar_priv_grp *grp; |
974 | struct rx_q_stats stats; | ||
961 | u16 skb_currx; | 975 | u16 skb_currx; |
962 | u16 qindex; | 976 | u16 qindex; |
963 | unsigned int rx_ring_size; | 977 | unsigned int rx_ring_size; |
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..933c64ff2465 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -1306,13 +1306,8 @@ void igb_reset(struct igb_adapter *adapter) | |||
1306 | hwm = min(((pba << 10) * 9 / 10), | 1306 | hwm = min(((pba << 10) * 9 / 10), |
1307 | ((pba << 10) - 2 * adapter->max_frame_size)); | 1307 | ((pba << 10) - 2 * adapter->max_frame_size)); |
1308 | 1308 | ||
1309 | if (mac->type < e1000_82576) { | 1309 | fc->high_water = hwm & 0xFFF0; /* 16-byte granularity */ |
1310 | fc->high_water = hwm & 0xFFF8; /* 8-byte granularity */ | 1310 | 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; | 1311 | fc->pause_time = 0xFFFF; |
1317 | fc->send_xon = 1; | 1312 | fc->send_xon = 1; |
1318 | fc->current_mode = fc->requested_mode; | 1313 | fc->current_mode = fc->requested_mode; |
diff --git a/drivers/net/igbvf/netdev.c b/drivers/net/igbvf/netdev.c index e9dd95f136aa..0dbd0320023a 100644 --- a/drivers/net/igbvf/netdev.c +++ b/drivers/net/igbvf/netdev.c | |||
@@ -2763,7 +2763,8 @@ static int __devinit igbvf_probe(struct pci_dev *pdev, | |||
2763 | err = hw->mac.ops.reset_hw(hw); | 2763 | err = hw->mac.ops.reset_hw(hw); |
2764 | if (err) { | 2764 | if (err) { |
2765 | dev_info(&pdev->dev, | 2765 | dev_info(&pdev->dev, |
2766 | "PF still in reset state, assigning new address\n"); | 2766 | "PF still in reset state, assigning new address." |
2767 | " Is the PF interface up?\n"); | ||
2767 | random_ether_addr(hw->mac.addr); | 2768 | random_ether_addr(hw->mac.addr); |
2768 | } else { | 2769 | } else { |
2769 | err = hw->mac.ops.read_mac_addr(hw); | 2770 | err = hw->mac.ops.read_mac_addr(hw); |
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 e2d5343f1275..3103f4165311 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, |
@@ -510,6 +510,40 @@ static s32 ixgbe_start_mac_link_82598(struct ixgbe_hw *hw, | |||
510 | } | 510 | } |
511 | 511 | ||
512 | /** | 512 | /** |
513 | * ixgbe_validate_link_ready - Function looks for phy link | ||
514 | * @hw: pointer to hardware structure | ||
515 | * | ||
516 | * Function indicates success when phy link is available. If phy is not ready | ||
517 | * within 5 seconds of MAC indicating link, the function returns error. | ||
518 | **/ | ||
519 | static s32 ixgbe_validate_link_ready(struct ixgbe_hw *hw) | ||
520 | { | ||
521 | u32 timeout; | ||
522 | u16 an_reg; | ||
523 | |||
524 | if (hw->device_id != IXGBE_DEV_ID_82598AT2) | ||
525 | return 0; | ||
526 | |||
527 | for (timeout = 0; | ||
528 | timeout < IXGBE_VALIDATE_LINK_READY_TIMEOUT; timeout++) { | ||
529 | hw->phy.ops.read_reg(hw, MDIO_STAT1, MDIO_MMD_AN, &an_reg); | ||
530 | |||
531 | if ((an_reg & MDIO_AN_STAT1_COMPLETE) && | ||
532 | (an_reg & MDIO_STAT1_LSTATUS)) | ||
533 | break; | ||
534 | |||
535 | msleep(100); | ||
536 | } | ||
537 | |||
538 | if (timeout == IXGBE_VALIDATE_LINK_READY_TIMEOUT) { | ||
539 | hw_dbg(hw, "Link was indicated but link is down\n"); | ||
540 | return IXGBE_ERR_LINK_SETUP; | ||
541 | } | ||
542 | |||
543 | return 0; | ||
544 | } | ||
545 | |||
546 | /** | ||
513 | * ixgbe_check_mac_link_82598 - Get link/speed status | 547 | * ixgbe_check_mac_link_82598 - Get link/speed status |
514 | * @hw: pointer to hardware structure | 548 | * @hw: pointer to hardware structure |
515 | * @speed: pointer to link speed | 549 | * @speed: pointer to link speed |
@@ -589,6 +623,10 @@ static s32 ixgbe_check_mac_link_82598(struct ixgbe_hw *hw, | |||
589 | else | 623 | else |
590 | *speed = IXGBE_LINK_SPEED_1GB_FULL; | 624 | *speed = IXGBE_LINK_SPEED_1GB_FULL; |
591 | 625 | ||
626 | if ((hw->device_id == IXGBE_DEV_ID_82598AT2) && (*link_up == true) && | ||
627 | (ixgbe_validate_link_ready(hw) != 0)) | ||
628 | *link_up = false; | ||
629 | |||
592 | /* if link is down, zero out the current_mode */ | 630 | /* if link is down, zero out the current_mode */ |
593 | if (*link_up == false) { | 631 | if (*link_up == false) { |
594 | hw->fc.current_mode = ixgbe_fc_none; | 632 | hw->fc.current_mode = ixgbe_fc_none; |
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..56f37f66b696 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, |
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 35ea8c93fd80..9c9202f40b10 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) { |
@@ -4511,6 +4521,7 @@ void ixgbe_update_stats(struct ixgbe_adapter *adapter) | |||
4511 | struct ixgbe_hw *hw = &adapter->hw; | 4521 | struct ixgbe_hw *hw = &adapter->hw; |
4512 | u64 total_mpc = 0; | 4522 | u64 total_mpc = 0; |
4513 | u32 i, missed_rx = 0, mpc, bprc, lxon, lxoff, xon_off_tot; | 4523 | u32 i, missed_rx = 0, mpc, bprc, lxon, lxoff, xon_off_tot; |
4524 | u64 non_eop_descs = 0, restart_queue = 0; | ||
4514 | 4525 | ||
4515 | if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) { | 4526 | if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) { |
4516 | u64 rsc_count = 0; | 4527 | u64 rsc_count = 0; |
@@ -4528,10 +4539,12 @@ void ixgbe_update_stats(struct ixgbe_adapter *adapter) | |||
4528 | 4539 | ||
4529 | /* gather some stats to the adapter struct that are per queue */ | 4540 | /* gather some stats to the adapter struct that are per queue */ |
4530 | for (i = 0; i < adapter->num_tx_queues; i++) | 4541 | for (i = 0; i < adapter->num_tx_queues; i++) |
4531 | adapter->restart_queue += adapter->tx_ring[i].restart_queue; | 4542 | restart_queue += adapter->tx_ring[i].restart_queue; |
4543 | adapter->restart_queue = restart_queue; | ||
4532 | 4544 | ||
4533 | for (i = 0; i < adapter->num_rx_queues; i++) | 4545 | for (i = 0; i < adapter->num_rx_queues; i++) |
4534 | adapter->non_eop_descs += adapter->tx_ring[i].non_eop_descs; | 4546 | non_eop_descs += adapter->rx_ring[i].non_eop_descs; |
4547 | adapter->non_eop_descs = non_eop_descs; | ||
4535 | 4548 | ||
4536 | adapter->stats.crcerrs += IXGBE_READ_REG(hw, IXGBE_CRCERRS); | 4549 | adapter->stats.crcerrs += IXGBE_READ_REG(hw, IXGBE_CRCERRS); |
4537 | for (i = 0; i < 8; i++) { | 4550 | for (i = 0; i < 8; i++) { |
@@ -5003,7 +5016,18 @@ static bool ixgbe_tx_csum(struct ixgbe_adapter *adapter, | |||
5003 | IXGBE_ADVTXD_DTYP_CTXT); | 5016 | IXGBE_ADVTXD_DTYP_CTXT); |
5004 | 5017 | ||
5005 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 5018 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
5006 | switch (skb->protocol) { | 5019 | __be16 protocol; |
5020 | |||
5021 | if (skb->protocol == cpu_to_be16(ETH_P_8021Q)) { | ||
5022 | const struct vlan_ethhdr *vhdr = | ||
5023 | (const struct vlan_ethhdr *)skb->data; | ||
5024 | |||
5025 | protocol = vhdr->h_vlan_encapsulated_proto; | ||
5026 | } else { | ||
5027 | protocol = skb->protocol; | ||
5028 | } | ||
5029 | |||
5030 | switch (protocol) { | ||
5007 | case cpu_to_be16(ETH_P_IP): | 5031 | case cpu_to_be16(ETH_P_IP): |
5008 | type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_IPV4; | 5032 | type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_IPV4; |
5009 | if (ip_hdr(skb)->protocol == IPPROTO_TCP) | 5033 | if (ip_hdr(skb)->protocol == IPPROTO_TCP) |
@@ -5552,6 +5576,10 @@ static void ixgbe_netpoll(struct net_device *netdev) | |||
5552 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 5576 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
5553 | int i; | 5577 | int i; |
5554 | 5578 | ||
5579 | /* if interface is down do nothing */ | ||
5580 | if (test_bit(__IXGBE_DOWN, &adapter->state)) | ||
5581 | return; | ||
5582 | |||
5555 | adapter->flags |= IXGBE_FLAG_IN_NETPOLL; | 5583 | adapter->flags |= IXGBE_FLAG_IN_NETPOLL; |
5556 | if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) { | 5584 | if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) { |
5557 | int num_q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS; | 5585 | int num_q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS; |
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 f3e8d52610b7..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, |
@@ -841,6 +841,8 @@ | |||
841 | #define IXGBE_MPVC 0x04318 | 841 | #define IXGBE_MPVC 0x04318 |
842 | #define IXGBE_SGMIIC 0x04314 | 842 | #define IXGBE_SGMIIC 0x04314 |
843 | 843 | ||
844 | #define IXGBE_VALIDATE_LINK_READY_TIMEOUT 50 | ||
845 | |||
844 | /* Omer CORECTL */ | 846 | /* Omer CORECTL */ |
845 | #define IXGBE_CORECTL 0x014F00 | 847 | #define IXGBE_CORECTL 0x014F00 |
846 | /* BARCTRL */ | 848 | /* BARCTRL */ |
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/alloc.c b/drivers/net/mlx4/alloc.c index ad95d5f7b630..8c8515619b8e 100644 --- a/drivers/net/mlx4/alloc.c +++ b/drivers/net/mlx4/alloc.c | |||
@@ -72,35 +72,6 @@ void mlx4_bitmap_free(struct mlx4_bitmap *bitmap, u32 obj) | |||
72 | mlx4_bitmap_free_range(bitmap, obj, 1); | 72 | mlx4_bitmap_free_range(bitmap, obj, 1); |
73 | } | 73 | } |
74 | 74 | ||
75 | static unsigned long find_aligned_range(unsigned long *bitmap, | ||
76 | u32 start, u32 nbits, | ||
77 | int len, int align) | ||
78 | { | ||
79 | unsigned long end, i; | ||
80 | |||
81 | again: | ||
82 | start = ALIGN(start, align); | ||
83 | |||
84 | while ((start < nbits) && test_bit(start, bitmap)) | ||
85 | start += align; | ||
86 | |||
87 | if (start >= nbits) | ||
88 | return -1; | ||
89 | |||
90 | end = start+len; | ||
91 | if (end > nbits) | ||
92 | return -1; | ||
93 | |||
94 | for (i = start + 1; i < end; i++) { | ||
95 | if (test_bit(i, bitmap)) { | ||
96 | start = i + 1; | ||
97 | goto again; | ||
98 | } | ||
99 | } | ||
100 | |||
101 | return start; | ||
102 | } | ||
103 | |||
104 | u32 mlx4_bitmap_alloc_range(struct mlx4_bitmap *bitmap, int cnt, int align) | 75 | u32 mlx4_bitmap_alloc_range(struct mlx4_bitmap *bitmap, int cnt, int align) |
105 | { | 76 | { |
106 | u32 obj, i; | 77 | u32 obj, i; |
@@ -110,13 +81,13 @@ u32 mlx4_bitmap_alloc_range(struct mlx4_bitmap *bitmap, int cnt, int align) | |||
110 | 81 | ||
111 | spin_lock(&bitmap->lock); | 82 | spin_lock(&bitmap->lock); |
112 | 83 | ||
113 | obj = find_aligned_range(bitmap->table, bitmap->last, | 84 | obj = bitmap_find_next_zero_area(bitmap->table, bitmap->max, |
114 | bitmap->max, cnt, align); | 85 | bitmap->last, cnt, align - 1); |
115 | if (obj >= bitmap->max) { | 86 | if (obj >= bitmap->max) { |
116 | bitmap->top = (bitmap->top + bitmap->max + bitmap->reserved_top) | 87 | bitmap->top = (bitmap->top + bitmap->max + bitmap->reserved_top) |
117 | & bitmap->mask; | 88 | & bitmap->mask; |
118 | obj = find_aligned_range(bitmap->table, 0, bitmap->max, | 89 | obj = bitmap_find_next_zero_area(bitmap->table, bitmap->max, |
119 | cnt, align); | 90 | 0, cnt, align - 1); |
120 | } | 91 | } |
121 | 92 | ||
122 | if (obj < bitmap->max) { | 93 | if (obj < bitmap->max) { |
diff --git a/drivers/net/mlx4/fw.c b/drivers/net/mlx4/fw.c index 3c16602172fc..04f42ae1eda0 100644 --- a/drivers/net/mlx4/fw.c +++ b/drivers/net/mlx4/fw.c | |||
@@ -90,6 +90,7 @@ static void dump_dev_cap_flags(struct mlx4_dev *dev, u32 flags) | |||
90 | [ 9] = "Q_Key violation counter", | 90 | [ 9] = "Q_Key violation counter", |
91 | [10] = "VMM", | 91 | [10] = "VMM", |
92 | [12] = "DPDP", | 92 | [12] = "DPDP", |
93 | [15] = "Big LSO headers", | ||
93 | [16] = "MW support", | 94 | [16] = "MW support", |
94 | [17] = "APM support", | 95 | [17] = "APM support", |
95 | [18] = "Atomic ops support", | 96 | [18] = "Atomic ops support", |
@@ -235,7 +236,7 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) | |||
235 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_MPT_OFFSET); | 236 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_MPT_OFFSET); |
236 | dev_cap->max_mpts = 1 << (field & 0x3f); | 237 | dev_cap->max_mpts = 1 << (field & 0x3f); |
237 | MLX4_GET(field, outbox, QUERY_DEV_CAP_RSVD_EQ_OFFSET); | 238 | MLX4_GET(field, outbox, QUERY_DEV_CAP_RSVD_EQ_OFFSET); |
238 | dev_cap->reserved_eqs = 1 << (field & 0xf); | 239 | dev_cap->reserved_eqs = field & 0xf; |
239 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_EQ_OFFSET); | 240 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_EQ_OFFSET); |
240 | dev_cap->max_eqs = 1 << (field & 0xf); | 241 | dev_cap->max_eqs = 1 << (field & 0xf); |
241 | MLX4_GET(field, outbox, QUERY_DEV_CAP_RSVD_MTT_OFFSET); | 242 | MLX4_GET(field, outbox, QUERY_DEV_CAP_RSVD_MTT_OFFSET); |
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/mlx4/sense.c b/drivers/net/mlx4/sense.c index f36ae691cab3..015fbe785c13 100644 --- a/drivers/net/mlx4/sense.c +++ b/drivers/net/mlx4/sense.c | |||
@@ -53,7 +53,7 @@ static int mlx4_SENSE_PORT(struct mlx4_dev *dev, int port, | |||
53 | 53 | ||
54 | if (out_param > 2) { | 54 | if (out_param > 2) { |
55 | mlx4_err(dev, "Sense returned illegal value: 0x%llx\n", out_param); | 55 | mlx4_err(dev, "Sense returned illegal value: 0x%llx\n", out_param); |
56 | return EINVAL; | 56 | return -EINVAL; |
57 | } | 57 | } |
58 | 58 | ||
59 | *type = out_param; | 59 | *type = out_param; |
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 f4996846a234..9f9d6081959b 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -57,7 +57,9 @@ static int use_msi = 1; | |||
57 | 57 | ||
58 | static int use_msi_x = 1; | 58 | static int use_msi_x = 1; |
59 | 59 | ||
60 | static unsigned long auto_fw_reset = AUTO_FW_RESET_ENABLED; | 60 | static int auto_fw_reset = AUTO_FW_RESET_ENABLED; |
61 | module_param(auto_fw_reset, int, 0644); | ||
62 | MODULE_PARM_DESC(auto_fw_reset,"Auto firmware reset (0=disabled, 1=enabled"); | ||
61 | 63 | ||
62 | static int __devinit netxen_nic_probe(struct pci_dev *pdev, | 64 | static int __devinit netxen_nic_probe(struct pci_dev *pdev, |
63 | const struct pci_device_id *ent); | 65 | const struct pci_device_id *ent); |
@@ -338,7 +340,7 @@ netxen_check_hw_init(struct netxen_adapter *adapter, int first_boot) | |||
338 | if (!(first_boot & 0x4)) { | 340 | if (!(first_boot & 0x4)) { |
339 | first_boot |= 0x4; | 341 | first_boot |= 0x4; |
340 | NXWR32(adapter, NETXEN_PCIE_REG(0x4), first_boot); | 342 | NXWR32(adapter, NETXEN_PCIE_REG(0x4), first_boot); |
341 | first_boot = NXRD32(adapter, NETXEN_PCIE_REG(0x4)); | 343 | NXRD32(adapter, NETXEN_PCIE_REG(0x4)); |
342 | } | 344 | } |
343 | 345 | ||
344 | /* This is the first boot after power up */ | 346 | /* This is the first boot after power up */ |
@@ -1896,12 +1898,8 @@ static void netxen_nic_handle_phy_intr(struct netxen_adapter *adapter) | |||
1896 | linkup = (val == XG_LINK_UP_P3); | 1898 | linkup = (val == XG_LINK_UP_P3); |
1897 | } else { | 1899 | } else { |
1898 | val = NXRD32(adapter, CRB_XG_STATE); | 1900 | val = NXRD32(adapter, CRB_XG_STATE); |
1899 | if (adapter->ahw.port_type == NETXEN_NIC_GBE) | 1901 | val = (val >> port*8) & 0xff; |
1900 | linkup = (val >> port) & 1; | 1902 | linkup = (val == XG_LINK_UP); |
1901 | else { | ||
1902 | val = (val >> port*8) & 0xff; | ||
1903 | linkup = (val == XG_LINK_UP); | ||
1904 | } | ||
1905 | } | 1903 | } |
1906 | 1904 | ||
1907 | netxen_advert_link_change(adapter, linkup); | 1905 | netxen_advert_link_change(adapter, linkup); |
@@ -2534,42 +2532,6 @@ static struct bin_attribute bin_attr_mem = { | |||
2534 | .write = netxen_sysfs_write_mem, | 2532 | .write = netxen_sysfs_write_mem, |
2535 | }; | 2533 | }; |
2536 | 2534 | ||
2537 | #ifdef CONFIG_MODULES | ||
2538 | static ssize_t | ||
2539 | netxen_store_auto_fw_reset(struct module_attribute *mattr, | ||
2540 | struct module *mod, const char *buf, size_t count) | ||
2541 | |||
2542 | { | ||
2543 | unsigned long new; | ||
2544 | |||
2545 | if (strict_strtoul(buf, 16, &new)) | ||
2546 | return -EINVAL; | ||
2547 | |||
2548 | if ((new == AUTO_FW_RESET_ENABLED) || (new == AUTO_FW_RESET_DISABLED)) { | ||
2549 | auto_fw_reset = new; | ||
2550 | return count; | ||
2551 | } | ||
2552 | |||
2553 | return -EINVAL; | ||
2554 | } | ||
2555 | |||
2556 | static ssize_t | ||
2557 | netxen_show_auto_fw_reset(struct module_attribute *mattr, | ||
2558 | struct module *mod, char *buf) | ||
2559 | |||
2560 | { | ||
2561 | if (auto_fw_reset == AUTO_FW_RESET_ENABLED) | ||
2562 | return sprintf(buf, "enabled\n"); | ||
2563 | else | ||
2564 | return sprintf(buf, "disabled\n"); | ||
2565 | } | ||
2566 | |||
2567 | static struct module_attribute mod_attr_fw_reset = { | ||
2568 | .attr = {.name = "auto_fw_reset", .mode = (S_IRUGO | S_IWUSR)}, | ||
2569 | .show = netxen_show_auto_fw_reset, | ||
2570 | .store = netxen_store_auto_fw_reset, | ||
2571 | }; | ||
2572 | #endif | ||
2573 | 2535 | ||
2574 | static void | 2536 | static void |
2575 | netxen_create_sysfs_entries(struct netxen_adapter *adapter) | 2537 | netxen_create_sysfs_entries(struct netxen_adapter *adapter) |
@@ -2775,23 +2737,12 @@ static struct pci_driver netxen_driver = { | |||
2775 | 2737 | ||
2776 | static int __init netxen_init_module(void) | 2738 | static int __init netxen_init_module(void) |
2777 | { | 2739 | { |
2778 | #ifdef CONFIG_MODULES | ||
2779 | struct module *mod = THIS_MODULE; | ||
2780 | #endif | ||
2781 | |||
2782 | printk(KERN_INFO "%s\n", netxen_nic_driver_string); | 2740 | printk(KERN_INFO "%s\n", netxen_nic_driver_string); |
2783 | 2741 | ||
2784 | #ifdef CONFIG_INET | 2742 | #ifdef CONFIG_INET |
2785 | register_netdevice_notifier(&netxen_netdev_cb); | 2743 | register_netdevice_notifier(&netxen_netdev_cb); |
2786 | register_inetaddr_notifier(&netxen_inetaddr_cb); | 2744 | register_inetaddr_notifier(&netxen_inetaddr_cb); |
2787 | #endif | 2745 | #endif |
2788 | |||
2789 | #ifdef CONFIG_MODULES | ||
2790 | if (sysfs_create_file(&mod->mkobj.kobj, &mod_attr_fw_reset.attr)) | ||
2791 | printk(KERN_ERR "%s: Failed to create auto_fw_reset " | ||
2792 | "sysfs entry.", netxen_nic_driver_name); | ||
2793 | #endif | ||
2794 | |||
2795 | return pci_register_driver(&netxen_driver); | 2746 | return pci_register_driver(&netxen_driver); |
2796 | } | 2747 | } |
2797 | 2748 | ||
@@ -2799,12 +2750,6 @@ module_init(netxen_init_module); | |||
2799 | 2750 | ||
2800 | static void __exit netxen_exit_module(void) | 2751 | static void __exit netxen_exit_module(void) |
2801 | { | 2752 | { |
2802 | #ifdef CONFIG_MODULES | ||
2803 | struct module *mod = THIS_MODULE; | ||
2804 | |||
2805 | sysfs_remove_file(&mod->mkobj.kobj, &mod_attr_fw_reset.attr); | ||
2806 | #endif | ||
2807 | |||
2808 | pci_unregister_driver(&netxen_driver); | 2753 | pci_unregister_driver(&netxen_driver); |
2809 | 2754 | ||
2810 | #ifdef CONFIG_INET | 2755 | #ifdef CONFIG_INET |
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/octeon/Kconfig b/drivers/net/octeon/Kconfig new file mode 100644 index 000000000000..1e56bbf3f5c0 --- /dev/null +++ b/drivers/net/octeon/Kconfig | |||
@@ -0,0 +1,10 @@ | |||
1 | config OCTEON_MGMT_ETHERNET | ||
2 | tristate "Octeon Management port ethernet driver (CN5XXX, CN6XXX)" | ||
3 | depends on CPU_CAVIUM_OCTEON | ||
4 | select PHYLIB | ||
5 | select MDIO_OCTEON | ||
6 | default y | ||
7 | help | ||
8 | This option enables the ethernet driver for the management | ||
9 | port on Cavium Networks' Octeon CN57XX, CN56XX, CN55XX, | ||
10 | CN54XX, CN52XX, and CN6XXX chips. | ||
diff --git a/drivers/net/octeon/Makefile b/drivers/net/octeon/Makefile new file mode 100644 index 000000000000..906edecacfd3 --- /dev/null +++ b/drivers/net/octeon/Makefile | |||
@@ -0,0 +1,2 @@ | |||
1 | |||
2 | obj-$(CONFIG_OCTEON_MGMT_ETHERNET) += octeon_mgmt.o | ||
diff --git a/drivers/net/octeon/octeon_mgmt.c b/drivers/net/octeon/octeon_mgmt.c new file mode 100644 index 000000000000..050538bf155a --- /dev/null +++ b/drivers/net/octeon/octeon_mgmt.c | |||
@@ -0,0 +1,1176 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Copyright (C) 2009 Cavium Networks | ||
7 | */ | ||
8 | |||
9 | #include <linux/capability.h> | ||
10 | #include <linux/dma-mapping.h> | ||
11 | #include <linux/init.h> | ||
12 | #include <linux/platform_device.h> | ||
13 | #include <linux/netdevice.h> | ||
14 | #include <linux/etherdevice.h> | ||
15 | #include <linux/if_vlan.h> | ||
16 | #include <linux/phy.h> | ||
17 | #include <linux/spinlock.h> | ||
18 | |||
19 | #include <asm/octeon/octeon.h> | ||
20 | #include <asm/octeon/cvmx-mixx-defs.h> | ||
21 | #include <asm/octeon/cvmx-agl-defs.h> | ||
22 | |||
23 | #define DRV_NAME "octeon_mgmt" | ||
24 | #define DRV_VERSION "2.0" | ||
25 | #define DRV_DESCRIPTION \ | ||
26 | "Cavium Networks Octeon MII (management) port Network Driver" | ||
27 | |||
28 | #define OCTEON_MGMT_NAPI_WEIGHT 16 | ||
29 | |||
30 | /* | ||
31 | * Ring sizes that are powers of two allow for more efficient modulo | ||
32 | * opertions. | ||
33 | */ | ||
34 | #define OCTEON_MGMT_RX_RING_SIZE 512 | ||
35 | #define OCTEON_MGMT_TX_RING_SIZE 128 | ||
36 | |||
37 | /* Allow 8 bytes for vlan and FCS. */ | ||
38 | #define OCTEON_MGMT_RX_HEADROOM (ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN) | ||
39 | |||
40 | union mgmt_port_ring_entry { | ||
41 | u64 d64; | ||
42 | struct { | ||
43 | u64 reserved_62_63:2; | ||
44 | /* Length of the buffer/packet in bytes */ | ||
45 | u64 len:14; | ||
46 | /* For TX, signals that the packet should be timestamped */ | ||
47 | u64 tstamp:1; | ||
48 | /* The RX error code */ | ||
49 | u64 code:7; | ||
50 | #define RING_ENTRY_CODE_DONE 0xf | ||
51 | #define RING_ENTRY_CODE_MORE 0x10 | ||
52 | /* Physical address of the buffer */ | ||
53 | u64 addr:40; | ||
54 | } s; | ||
55 | }; | ||
56 | |||
57 | struct octeon_mgmt { | ||
58 | struct net_device *netdev; | ||
59 | int port; | ||
60 | int irq; | ||
61 | u64 *tx_ring; | ||
62 | dma_addr_t tx_ring_handle; | ||
63 | unsigned int tx_next; | ||
64 | unsigned int tx_next_clean; | ||
65 | unsigned int tx_current_fill; | ||
66 | /* The tx_list lock also protects the ring related variables */ | ||
67 | struct sk_buff_head tx_list; | ||
68 | |||
69 | /* RX variables only touched in napi_poll. No locking necessary. */ | ||
70 | u64 *rx_ring; | ||
71 | dma_addr_t rx_ring_handle; | ||
72 | unsigned int rx_next; | ||
73 | unsigned int rx_next_fill; | ||
74 | unsigned int rx_current_fill; | ||
75 | struct sk_buff_head rx_list; | ||
76 | |||
77 | spinlock_t lock; | ||
78 | unsigned int last_duplex; | ||
79 | unsigned int last_link; | ||
80 | struct device *dev; | ||
81 | struct napi_struct napi; | ||
82 | struct tasklet_struct tx_clean_tasklet; | ||
83 | struct phy_device *phydev; | ||
84 | }; | ||
85 | |||
86 | static void octeon_mgmt_set_rx_irq(struct octeon_mgmt *p, int enable) | ||
87 | { | ||
88 | int port = p->port; | ||
89 | union cvmx_mixx_intena mix_intena; | ||
90 | unsigned long flags; | ||
91 | |||
92 | spin_lock_irqsave(&p->lock, flags); | ||
93 | mix_intena.u64 = cvmx_read_csr(CVMX_MIXX_INTENA(port)); | ||
94 | mix_intena.s.ithena = enable ? 1 : 0; | ||
95 | cvmx_write_csr(CVMX_MIXX_INTENA(port), mix_intena.u64); | ||
96 | spin_unlock_irqrestore(&p->lock, flags); | ||
97 | } | ||
98 | |||
99 | static void octeon_mgmt_set_tx_irq(struct octeon_mgmt *p, int enable) | ||
100 | { | ||
101 | int port = p->port; | ||
102 | union cvmx_mixx_intena mix_intena; | ||
103 | unsigned long flags; | ||
104 | |||
105 | spin_lock_irqsave(&p->lock, flags); | ||
106 | mix_intena.u64 = cvmx_read_csr(CVMX_MIXX_INTENA(port)); | ||
107 | mix_intena.s.othena = enable ? 1 : 0; | ||
108 | cvmx_write_csr(CVMX_MIXX_INTENA(port), mix_intena.u64); | ||
109 | spin_unlock_irqrestore(&p->lock, flags); | ||
110 | } | ||
111 | |||
112 | static inline void octeon_mgmt_enable_rx_irq(struct octeon_mgmt *p) | ||
113 | { | ||
114 | octeon_mgmt_set_rx_irq(p, 1); | ||
115 | } | ||
116 | |||
117 | static inline void octeon_mgmt_disable_rx_irq(struct octeon_mgmt *p) | ||
118 | { | ||
119 | octeon_mgmt_set_rx_irq(p, 0); | ||
120 | } | ||
121 | |||
122 | static inline void octeon_mgmt_enable_tx_irq(struct octeon_mgmt *p) | ||
123 | { | ||
124 | octeon_mgmt_set_tx_irq(p, 1); | ||
125 | } | ||
126 | |||
127 | static inline void octeon_mgmt_disable_tx_irq(struct octeon_mgmt *p) | ||
128 | { | ||
129 | octeon_mgmt_set_tx_irq(p, 0); | ||
130 | } | ||
131 | |||
132 | static unsigned int ring_max_fill(unsigned int ring_size) | ||
133 | { | ||
134 | return ring_size - 8; | ||
135 | } | ||
136 | |||
137 | static unsigned int ring_size_to_bytes(unsigned int ring_size) | ||
138 | { | ||
139 | return ring_size * sizeof(union mgmt_port_ring_entry); | ||
140 | } | ||
141 | |||
142 | static void octeon_mgmt_rx_fill_ring(struct net_device *netdev) | ||
143 | { | ||
144 | struct octeon_mgmt *p = netdev_priv(netdev); | ||
145 | int port = p->port; | ||
146 | |||
147 | while (p->rx_current_fill < ring_max_fill(OCTEON_MGMT_RX_RING_SIZE)) { | ||
148 | unsigned int size; | ||
149 | union mgmt_port_ring_entry re; | ||
150 | struct sk_buff *skb; | ||
151 | |||
152 | /* CN56XX pass 1 needs 8 bytes of padding. */ | ||
153 | size = netdev->mtu + OCTEON_MGMT_RX_HEADROOM + 8 + NET_IP_ALIGN; | ||
154 | |||
155 | skb = netdev_alloc_skb(netdev, size); | ||
156 | if (!skb) | ||
157 | break; | ||
158 | skb_reserve(skb, NET_IP_ALIGN); | ||
159 | __skb_queue_tail(&p->rx_list, skb); | ||
160 | |||
161 | re.d64 = 0; | ||
162 | re.s.len = size; | ||
163 | re.s.addr = dma_map_single(p->dev, skb->data, | ||
164 | size, | ||
165 | DMA_FROM_DEVICE); | ||
166 | |||
167 | /* Put it in the ring. */ | ||
168 | p->rx_ring[p->rx_next_fill] = re.d64; | ||
169 | dma_sync_single_for_device(p->dev, p->rx_ring_handle, | ||
170 | ring_size_to_bytes(OCTEON_MGMT_RX_RING_SIZE), | ||
171 | DMA_BIDIRECTIONAL); | ||
172 | p->rx_next_fill = | ||
173 | (p->rx_next_fill + 1) % OCTEON_MGMT_RX_RING_SIZE; | ||
174 | p->rx_current_fill++; | ||
175 | /* Ring the bell. */ | ||
176 | cvmx_write_csr(CVMX_MIXX_IRING2(port), 1); | ||
177 | } | ||
178 | } | ||
179 | |||
180 | static void octeon_mgmt_clean_tx_buffers(struct octeon_mgmt *p) | ||
181 | { | ||
182 | int port = p->port; | ||
183 | union cvmx_mixx_orcnt mix_orcnt; | ||
184 | union mgmt_port_ring_entry re; | ||
185 | struct sk_buff *skb; | ||
186 | int cleaned = 0; | ||
187 | unsigned long flags; | ||
188 | |||
189 | mix_orcnt.u64 = cvmx_read_csr(CVMX_MIXX_ORCNT(port)); | ||
190 | while (mix_orcnt.s.orcnt) { | ||
191 | dma_sync_single_for_cpu(p->dev, p->tx_ring_handle, | ||
192 | ring_size_to_bytes(OCTEON_MGMT_TX_RING_SIZE), | ||
193 | DMA_BIDIRECTIONAL); | ||
194 | |||
195 | spin_lock_irqsave(&p->tx_list.lock, flags); | ||
196 | |||
197 | re.d64 = p->tx_ring[p->tx_next_clean]; | ||
198 | p->tx_next_clean = | ||
199 | (p->tx_next_clean + 1) % OCTEON_MGMT_TX_RING_SIZE; | ||
200 | skb = __skb_dequeue(&p->tx_list); | ||
201 | |||
202 | mix_orcnt.u64 = 0; | ||
203 | mix_orcnt.s.orcnt = 1; | ||
204 | |||
205 | /* Acknowledge to hardware that we have the buffer. */ | ||
206 | cvmx_write_csr(CVMX_MIXX_ORCNT(port), mix_orcnt.u64); | ||
207 | p->tx_current_fill--; | ||
208 | |||
209 | spin_unlock_irqrestore(&p->tx_list.lock, flags); | ||
210 | |||
211 | dma_unmap_single(p->dev, re.s.addr, re.s.len, | ||
212 | DMA_TO_DEVICE); | ||
213 | dev_kfree_skb_any(skb); | ||
214 | cleaned++; | ||
215 | |||
216 | mix_orcnt.u64 = cvmx_read_csr(CVMX_MIXX_ORCNT(port)); | ||
217 | } | ||
218 | |||
219 | if (cleaned && netif_queue_stopped(p->netdev)) | ||
220 | netif_wake_queue(p->netdev); | ||
221 | } | ||
222 | |||
223 | static void octeon_mgmt_clean_tx_tasklet(unsigned long arg) | ||
224 | { | ||
225 | struct octeon_mgmt *p = (struct octeon_mgmt *)arg; | ||
226 | octeon_mgmt_clean_tx_buffers(p); | ||
227 | octeon_mgmt_enable_tx_irq(p); | ||
228 | } | ||
229 | |||
230 | static void octeon_mgmt_update_rx_stats(struct net_device *netdev) | ||
231 | { | ||
232 | struct octeon_mgmt *p = netdev_priv(netdev); | ||
233 | int port = p->port; | ||
234 | unsigned long flags; | ||
235 | u64 drop, bad; | ||
236 | |||
237 | /* These reads also clear the count registers. */ | ||
238 | drop = cvmx_read_csr(CVMX_AGL_GMX_RXX_STATS_PKTS_DRP(port)); | ||
239 | bad = cvmx_read_csr(CVMX_AGL_GMX_RXX_STATS_PKTS_BAD(port)); | ||
240 | |||
241 | if (drop || bad) { | ||
242 | /* Do an atomic update. */ | ||
243 | spin_lock_irqsave(&p->lock, flags); | ||
244 | netdev->stats.rx_errors += bad; | ||
245 | netdev->stats.rx_dropped += drop; | ||
246 | spin_unlock_irqrestore(&p->lock, flags); | ||
247 | } | ||
248 | } | ||
249 | |||
250 | static void octeon_mgmt_update_tx_stats(struct net_device *netdev) | ||
251 | { | ||
252 | struct octeon_mgmt *p = netdev_priv(netdev); | ||
253 | int port = p->port; | ||
254 | unsigned long flags; | ||
255 | |||
256 | union cvmx_agl_gmx_txx_stat0 s0; | ||
257 | union cvmx_agl_gmx_txx_stat1 s1; | ||
258 | |||
259 | /* These reads also clear the count registers. */ | ||
260 | s0.u64 = cvmx_read_csr(CVMX_AGL_GMX_TXX_STAT0(port)); | ||
261 | s1.u64 = cvmx_read_csr(CVMX_AGL_GMX_TXX_STAT1(port)); | ||
262 | |||
263 | if (s0.s.xsdef || s0.s.xscol || s1.s.scol || s1.s.mcol) { | ||
264 | /* Do an atomic update. */ | ||
265 | spin_lock_irqsave(&p->lock, flags); | ||
266 | netdev->stats.tx_errors += s0.s.xsdef + s0.s.xscol; | ||
267 | netdev->stats.collisions += s1.s.scol + s1.s.mcol; | ||
268 | spin_unlock_irqrestore(&p->lock, flags); | ||
269 | } | ||
270 | } | ||
271 | |||
272 | /* | ||
273 | * Dequeue a receive skb and its corresponding ring entry. The ring | ||
274 | * entry is returned, *pskb is updated to point to the skb. | ||
275 | */ | ||
276 | static u64 octeon_mgmt_dequeue_rx_buffer(struct octeon_mgmt *p, | ||
277 | struct sk_buff **pskb) | ||
278 | { | ||
279 | union mgmt_port_ring_entry re; | ||
280 | |||
281 | dma_sync_single_for_cpu(p->dev, p->rx_ring_handle, | ||
282 | ring_size_to_bytes(OCTEON_MGMT_RX_RING_SIZE), | ||
283 | DMA_BIDIRECTIONAL); | ||
284 | |||
285 | re.d64 = p->rx_ring[p->rx_next]; | ||
286 | p->rx_next = (p->rx_next + 1) % OCTEON_MGMT_RX_RING_SIZE; | ||
287 | p->rx_current_fill--; | ||
288 | *pskb = __skb_dequeue(&p->rx_list); | ||
289 | |||
290 | dma_unmap_single(p->dev, re.s.addr, | ||
291 | ETH_FRAME_LEN + OCTEON_MGMT_RX_HEADROOM, | ||
292 | DMA_FROM_DEVICE); | ||
293 | |||
294 | return re.d64; | ||
295 | } | ||
296 | |||
297 | |||
298 | static int octeon_mgmt_receive_one(struct octeon_mgmt *p) | ||
299 | { | ||
300 | int port = p->port; | ||
301 | struct net_device *netdev = p->netdev; | ||
302 | union cvmx_mixx_ircnt mix_ircnt; | ||
303 | union mgmt_port_ring_entry re; | ||
304 | struct sk_buff *skb; | ||
305 | struct sk_buff *skb2; | ||
306 | struct sk_buff *skb_new; | ||
307 | union mgmt_port_ring_entry re2; | ||
308 | int rc = 1; | ||
309 | |||
310 | |||
311 | re.d64 = octeon_mgmt_dequeue_rx_buffer(p, &skb); | ||
312 | if (likely(re.s.code == RING_ENTRY_CODE_DONE)) { | ||
313 | /* A good packet, send it up. */ | ||
314 | skb_put(skb, re.s.len); | ||
315 | good: | ||
316 | skb->protocol = eth_type_trans(skb, netdev); | ||
317 | netdev->stats.rx_packets++; | ||
318 | netdev->stats.rx_bytes += skb->len; | ||
319 | netdev->last_rx = jiffies; | ||
320 | netif_receive_skb(skb); | ||
321 | rc = 0; | ||
322 | } else if (re.s.code == RING_ENTRY_CODE_MORE) { | ||
323 | /* | ||
324 | * Packet split across skbs. This can happen if we | ||
325 | * increase the MTU. Buffers that are already in the | ||
326 | * rx ring can then end up being too small. As the rx | ||
327 | * ring is refilled, buffers sized for the new MTU | ||
328 | * will be used and we should go back to the normal | ||
329 | * non-split case. | ||
330 | */ | ||
331 | skb_put(skb, re.s.len); | ||
332 | do { | ||
333 | re2.d64 = octeon_mgmt_dequeue_rx_buffer(p, &skb2); | ||
334 | if (re2.s.code != RING_ENTRY_CODE_MORE | ||
335 | && re2.s.code != RING_ENTRY_CODE_DONE) | ||
336 | goto split_error; | ||
337 | skb_put(skb2, re2.s.len); | ||
338 | skb_new = skb_copy_expand(skb, 0, skb2->len, | ||
339 | GFP_ATOMIC); | ||
340 | if (!skb_new) | ||
341 | goto split_error; | ||
342 | if (skb_copy_bits(skb2, 0, skb_tail_pointer(skb_new), | ||
343 | skb2->len)) | ||
344 | goto split_error; | ||
345 | skb_put(skb_new, skb2->len); | ||
346 | dev_kfree_skb_any(skb); | ||
347 | dev_kfree_skb_any(skb2); | ||
348 | skb = skb_new; | ||
349 | } while (re2.s.code == RING_ENTRY_CODE_MORE); | ||
350 | goto good; | ||
351 | } else { | ||
352 | /* Some other error, discard it. */ | ||
353 | dev_kfree_skb_any(skb); | ||
354 | /* | ||
355 | * Error statistics are accumulated in | ||
356 | * octeon_mgmt_update_rx_stats. | ||
357 | */ | ||
358 | } | ||
359 | goto done; | ||
360 | split_error: | ||
361 | /* Discard the whole mess. */ | ||
362 | dev_kfree_skb_any(skb); | ||
363 | dev_kfree_skb_any(skb2); | ||
364 | while (re2.s.code == RING_ENTRY_CODE_MORE) { | ||
365 | re2.d64 = octeon_mgmt_dequeue_rx_buffer(p, &skb2); | ||
366 | dev_kfree_skb_any(skb2); | ||
367 | } | ||
368 | netdev->stats.rx_errors++; | ||
369 | |||
370 | done: | ||
371 | /* Tell the hardware we processed a packet. */ | ||
372 | mix_ircnt.u64 = 0; | ||
373 | mix_ircnt.s.ircnt = 1; | ||
374 | cvmx_write_csr(CVMX_MIXX_IRCNT(port), mix_ircnt.u64); | ||
375 | return rc; | ||
376 | |||
377 | } | ||
378 | |||
379 | static int octeon_mgmt_receive_packets(struct octeon_mgmt *p, int budget) | ||
380 | { | ||
381 | int port = p->port; | ||
382 | unsigned int work_done = 0; | ||
383 | union cvmx_mixx_ircnt mix_ircnt; | ||
384 | int rc; | ||
385 | |||
386 | |||
387 | mix_ircnt.u64 = cvmx_read_csr(CVMX_MIXX_IRCNT(port)); | ||
388 | while (work_done < budget && mix_ircnt.s.ircnt) { | ||
389 | |||
390 | rc = octeon_mgmt_receive_one(p); | ||
391 | if (!rc) | ||
392 | work_done++; | ||
393 | |||
394 | /* Check for more packets. */ | ||
395 | mix_ircnt.u64 = cvmx_read_csr(CVMX_MIXX_IRCNT(port)); | ||
396 | } | ||
397 | |||
398 | octeon_mgmt_rx_fill_ring(p->netdev); | ||
399 | |||
400 | return work_done; | ||
401 | } | ||
402 | |||
403 | static int octeon_mgmt_napi_poll(struct napi_struct *napi, int budget) | ||
404 | { | ||
405 | struct octeon_mgmt *p = container_of(napi, struct octeon_mgmt, napi); | ||
406 | struct net_device *netdev = p->netdev; | ||
407 | unsigned int work_done = 0; | ||
408 | |||
409 | work_done = octeon_mgmt_receive_packets(p, budget); | ||
410 | |||
411 | if (work_done < budget) { | ||
412 | /* We stopped because no more packets were available. */ | ||
413 | napi_complete(napi); | ||
414 | octeon_mgmt_enable_rx_irq(p); | ||
415 | } | ||
416 | octeon_mgmt_update_rx_stats(netdev); | ||
417 | |||
418 | return work_done; | ||
419 | } | ||
420 | |||
421 | /* Reset the hardware to clean state. */ | ||
422 | static void octeon_mgmt_reset_hw(struct octeon_mgmt *p) | ||
423 | { | ||
424 | union cvmx_mixx_ctl mix_ctl; | ||
425 | union cvmx_mixx_bist mix_bist; | ||
426 | union cvmx_agl_gmx_bist agl_gmx_bist; | ||
427 | |||
428 | mix_ctl.u64 = 0; | ||
429 | cvmx_write_csr(CVMX_MIXX_CTL(p->port), mix_ctl.u64); | ||
430 | do { | ||
431 | mix_ctl.u64 = cvmx_read_csr(CVMX_MIXX_CTL(p->port)); | ||
432 | } while (mix_ctl.s.busy); | ||
433 | mix_ctl.s.reset = 1; | ||
434 | cvmx_write_csr(CVMX_MIXX_CTL(p->port), mix_ctl.u64); | ||
435 | cvmx_read_csr(CVMX_MIXX_CTL(p->port)); | ||
436 | cvmx_wait(64); | ||
437 | |||
438 | mix_bist.u64 = cvmx_read_csr(CVMX_MIXX_BIST(p->port)); | ||
439 | if (mix_bist.u64) | ||
440 | dev_warn(p->dev, "MIX failed BIST (0x%016llx)\n", | ||
441 | (unsigned long long)mix_bist.u64); | ||
442 | |||
443 | agl_gmx_bist.u64 = cvmx_read_csr(CVMX_AGL_GMX_BIST); | ||
444 | if (agl_gmx_bist.u64) | ||
445 | dev_warn(p->dev, "AGL failed BIST (0x%016llx)\n", | ||
446 | (unsigned long long)agl_gmx_bist.u64); | ||
447 | } | ||
448 | |||
449 | struct octeon_mgmt_cam_state { | ||
450 | u64 cam[6]; | ||
451 | u64 cam_mask; | ||
452 | int cam_index; | ||
453 | }; | ||
454 | |||
455 | static void octeon_mgmt_cam_state_add(struct octeon_mgmt_cam_state *cs, | ||
456 | unsigned char *addr) | ||
457 | { | ||
458 | int i; | ||
459 | |||
460 | for (i = 0; i < 6; i++) | ||
461 | cs->cam[i] |= (u64)addr[i] << (8 * (cs->cam_index)); | ||
462 | cs->cam_mask |= (1ULL << cs->cam_index); | ||
463 | cs->cam_index++; | ||
464 | } | ||
465 | |||
466 | static void octeon_mgmt_set_rx_filtering(struct net_device *netdev) | ||
467 | { | ||
468 | struct octeon_mgmt *p = netdev_priv(netdev); | ||
469 | int port = p->port; | ||
470 | int i; | ||
471 | union cvmx_agl_gmx_rxx_adr_ctl adr_ctl; | ||
472 | union cvmx_agl_gmx_prtx_cfg agl_gmx_prtx; | ||
473 | unsigned long flags; | ||
474 | unsigned int prev_packet_enable; | ||
475 | unsigned int cam_mode = 1; /* 1 - Accept on CAM match */ | ||
476 | unsigned int multicast_mode = 1; /* 1 - Reject all multicast. */ | ||
477 | struct octeon_mgmt_cam_state cam_state; | ||
478 | struct dev_addr_list *list; | ||
479 | struct list_head *pos; | ||
480 | int available_cam_entries; | ||
481 | |||
482 | memset(&cam_state, 0, sizeof(cam_state)); | ||
483 | |||
484 | if ((netdev->flags & IFF_PROMISC) || netdev->dev_addrs.count > 7) { | ||
485 | cam_mode = 0; | ||
486 | available_cam_entries = 8; | ||
487 | } else { | ||
488 | /* | ||
489 | * One CAM entry for the primary address, leaves seven | ||
490 | * for the secondary addresses. | ||
491 | */ | ||
492 | available_cam_entries = 7 - netdev->dev_addrs.count; | ||
493 | } | ||
494 | |||
495 | if (netdev->flags & IFF_MULTICAST) { | ||
496 | if (cam_mode == 0 || (netdev->flags & IFF_ALLMULTI) | ||
497 | || netdev->mc_count > available_cam_entries) | ||
498 | multicast_mode = 2; /* 1 - Accept all multicast. */ | ||
499 | else | ||
500 | multicast_mode = 0; /* 0 - Use CAM. */ | ||
501 | } | ||
502 | |||
503 | if (cam_mode == 1) { | ||
504 | /* Add primary address. */ | ||
505 | octeon_mgmt_cam_state_add(&cam_state, netdev->dev_addr); | ||
506 | list_for_each(pos, &netdev->dev_addrs.list) { | ||
507 | struct netdev_hw_addr *hw_addr; | ||
508 | hw_addr = list_entry(pos, struct netdev_hw_addr, list); | ||
509 | octeon_mgmt_cam_state_add(&cam_state, hw_addr->addr); | ||
510 | list = list->next; | ||
511 | } | ||
512 | } | ||
513 | if (multicast_mode == 0) { | ||
514 | i = netdev->mc_count; | ||
515 | list = netdev->mc_list; | ||
516 | while (i--) { | ||
517 | octeon_mgmt_cam_state_add(&cam_state, list->da_addr); | ||
518 | list = list->next; | ||
519 | } | ||
520 | } | ||
521 | |||
522 | |||
523 | spin_lock_irqsave(&p->lock, flags); | ||
524 | |||
525 | /* Disable packet I/O. */ | ||
526 | agl_gmx_prtx.u64 = cvmx_read_csr(CVMX_AGL_GMX_PRTX_CFG(port)); | ||
527 | prev_packet_enable = agl_gmx_prtx.s.en; | ||
528 | agl_gmx_prtx.s.en = 0; | ||
529 | cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), agl_gmx_prtx.u64); | ||
530 | |||
531 | |||
532 | adr_ctl.u64 = 0; | ||
533 | adr_ctl.s.cam_mode = cam_mode; | ||
534 | adr_ctl.s.mcst = multicast_mode; | ||
535 | adr_ctl.s.bcst = 1; /* Allow broadcast */ | ||
536 | |||
537 | cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CTL(port), adr_ctl.u64); | ||
538 | |||
539 | cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM0(port), cam_state.cam[0]); | ||
540 | cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM1(port), cam_state.cam[1]); | ||
541 | cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM2(port), cam_state.cam[2]); | ||
542 | cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM3(port), cam_state.cam[3]); | ||
543 | cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM4(port), cam_state.cam[4]); | ||
544 | cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM5(port), cam_state.cam[5]); | ||
545 | cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM_EN(port), cam_state.cam_mask); | ||
546 | |||
547 | /* Restore packet I/O. */ | ||
548 | agl_gmx_prtx.s.en = prev_packet_enable; | ||
549 | cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), agl_gmx_prtx.u64); | ||
550 | |||
551 | spin_unlock_irqrestore(&p->lock, flags); | ||
552 | } | ||
553 | |||
554 | static int octeon_mgmt_set_mac_address(struct net_device *netdev, void *addr) | ||
555 | { | ||
556 | struct sockaddr *sa = addr; | ||
557 | |||
558 | if (!is_valid_ether_addr(sa->sa_data)) | ||
559 | return -EADDRNOTAVAIL; | ||
560 | |||
561 | memcpy(netdev->dev_addr, sa->sa_data, ETH_ALEN); | ||
562 | |||
563 | octeon_mgmt_set_rx_filtering(netdev); | ||
564 | |||
565 | return 0; | ||
566 | } | ||
567 | |||
568 | static int octeon_mgmt_change_mtu(struct net_device *netdev, int new_mtu) | ||
569 | { | ||
570 | struct octeon_mgmt *p = netdev_priv(netdev); | ||
571 | int port = p->port; | ||
572 | int size_without_fcs = new_mtu + OCTEON_MGMT_RX_HEADROOM; | ||
573 | |||
574 | /* | ||
575 | * Limit the MTU to make sure the ethernet packets are between | ||
576 | * 64 bytes and 16383 bytes. | ||
577 | */ | ||
578 | if (size_without_fcs < 64 || size_without_fcs > 16383) { | ||
579 | dev_warn(p->dev, "MTU must be between %d and %d.\n", | ||
580 | 64 - OCTEON_MGMT_RX_HEADROOM, | ||
581 | 16383 - OCTEON_MGMT_RX_HEADROOM); | ||
582 | return -EINVAL; | ||
583 | } | ||
584 | |||
585 | netdev->mtu = new_mtu; | ||
586 | |||
587 | cvmx_write_csr(CVMX_AGL_GMX_RXX_FRM_MAX(port), size_without_fcs); | ||
588 | cvmx_write_csr(CVMX_AGL_GMX_RXX_JABBER(port), | ||
589 | (size_without_fcs + 7) & 0xfff8); | ||
590 | |||
591 | return 0; | ||
592 | } | ||
593 | |||
594 | static irqreturn_t octeon_mgmt_interrupt(int cpl, void *dev_id) | ||
595 | { | ||
596 | struct net_device *netdev = dev_id; | ||
597 | struct octeon_mgmt *p = netdev_priv(netdev); | ||
598 | int port = p->port; | ||
599 | union cvmx_mixx_isr mixx_isr; | ||
600 | |||
601 | mixx_isr.u64 = cvmx_read_csr(CVMX_MIXX_ISR(port)); | ||
602 | |||
603 | /* Clear any pending interrupts */ | ||
604 | cvmx_write_csr(CVMX_MIXX_ISR(port), | ||
605 | cvmx_read_csr(CVMX_MIXX_ISR(port))); | ||
606 | cvmx_read_csr(CVMX_MIXX_ISR(port)); | ||
607 | |||
608 | if (mixx_isr.s.irthresh) { | ||
609 | octeon_mgmt_disable_rx_irq(p); | ||
610 | napi_schedule(&p->napi); | ||
611 | } | ||
612 | if (mixx_isr.s.orthresh) { | ||
613 | octeon_mgmt_disable_tx_irq(p); | ||
614 | tasklet_schedule(&p->tx_clean_tasklet); | ||
615 | } | ||
616 | |||
617 | return IRQ_HANDLED; | ||
618 | } | ||
619 | |||
620 | static int octeon_mgmt_ioctl(struct net_device *netdev, | ||
621 | struct ifreq *rq, int cmd) | ||
622 | { | ||
623 | struct octeon_mgmt *p = netdev_priv(netdev); | ||
624 | |||
625 | if (!netif_running(netdev)) | ||
626 | return -EINVAL; | ||
627 | |||
628 | if (!p->phydev) | ||
629 | return -EINVAL; | ||
630 | |||
631 | return phy_mii_ioctl(p->phydev, if_mii(rq), cmd); | ||
632 | } | ||
633 | |||
634 | static void octeon_mgmt_adjust_link(struct net_device *netdev) | ||
635 | { | ||
636 | struct octeon_mgmt *p = netdev_priv(netdev); | ||
637 | int port = p->port; | ||
638 | union cvmx_agl_gmx_prtx_cfg prtx_cfg; | ||
639 | unsigned long flags; | ||
640 | int link_changed = 0; | ||
641 | |||
642 | spin_lock_irqsave(&p->lock, flags); | ||
643 | if (p->phydev->link) { | ||
644 | if (!p->last_link) | ||
645 | link_changed = 1; | ||
646 | if (p->last_duplex != p->phydev->duplex) { | ||
647 | p->last_duplex = p->phydev->duplex; | ||
648 | prtx_cfg.u64 = | ||
649 | cvmx_read_csr(CVMX_AGL_GMX_PRTX_CFG(port)); | ||
650 | prtx_cfg.s.duplex = p->phydev->duplex; | ||
651 | cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), | ||
652 | prtx_cfg.u64); | ||
653 | } | ||
654 | } else { | ||
655 | if (p->last_link) | ||
656 | link_changed = -1; | ||
657 | } | ||
658 | p->last_link = p->phydev->link; | ||
659 | spin_unlock_irqrestore(&p->lock, flags); | ||
660 | |||
661 | if (link_changed != 0) { | ||
662 | if (link_changed > 0) { | ||
663 | netif_carrier_on(netdev); | ||
664 | pr_info("%s: Link is up - %d/%s\n", netdev->name, | ||
665 | p->phydev->speed, | ||
666 | DUPLEX_FULL == p->phydev->duplex ? | ||
667 | "Full" : "Half"); | ||
668 | } else { | ||
669 | netif_carrier_off(netdev); | ||
670 | pr_info("%s: Link is down\n", netdev->name); | ||
671 | } | ||
672 | } | ||
673 | } | ||
674 | |||
675 | static int octeon_mgmt_init_phy(struct net_device *netdev) | ||
676 | { | ||
677 | struct octeon_mgmt *p = netdev_priv(netdev); | ||
678 | char phy_id[20]; | ||
679 | |||
680 | if (octeon_is_simulation()) { | ||
681 | /* No PHYs in the simulator. */ | ||
682 | netif_carrier_on(netdev); | ||
683 | return 0; | ||
684 | } | ||
685 | |||
686 | snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, "0", p->port); | ||
687 | |||
688 | p->phydev = phy_connect(netdev, phy_id, octeon_mgmt_adjust_link, 0, | ||
689 | PHY_INTERFACE_MODE_MII); | ||
690 | |||
691 | if (IS_ERR(p->phydev)) { | ||
692 | p->phydev = NULL; | ||
693 | return -1; | ||
694 | } | ||
695 | |||
696 | phy_start_aneg(p->phydev); | ||
697 | |||
698 | return 0; | ||
699 | } | ||
700 | |||
701 | static int octeon_mgmt_open(struct net_device *netdev) | ||
702 | { | ||
703 | struct octeon_mgmt *p = netdev_priv(netdev); | ||
704 | int port = p->port; | ||
705 | union cvmx_mixx_ctl mix_ctl; | ||
706 | union cvmx_agl_gmx_inf_mode agl_gmx_inf_mode; | ||
707 | union cvmx_mixx_oring1 oring1; | ||
708 | union cvmx_mixx_iring1 iring1; | ||
709 | union cvmx_agl_gmx_prtx_cfg prtx_cfg; | ||
710 | union cvmx_agl_gmx_rxx_frm_ctl rxx_frm_ctl; | ||
711 | union cvmx_mixx_irhwm mix_irhwm; | ||
712 | union cvmx_mixx_orhwm mix_orhwm; | ||
713 | union cvmx_mixx_intena mix_intena; | ||
714 | struct sockaddr sa; | ||
715 | |||
716 | /* Allocate ring buffers. */ | ||
717 | p->tx_ring = kzalloc(ring_size_to_bytes(OCTEON_MGMT_TX_RING_SIZE), | ||
718 | GFP_KERNEL); | ||
719 | if (!p->tx_ring) | ||
720 | return -ENOMEM; | ||
721 | p->tx_ring_handle = | ||
722 | dma_map_single(p->dev, p->tx_ring, | ||
723 | ring_size_to_bytes(OCTEON_MGMT_TX_RING_SIZE), | ||
724 | DMA_BIDIRECTIONAL); | ||
725 | p->tx_next = 0; | ||
726 | p->tx_next_clean = 0; | ||
727 | p->tx_current_fill = 0; | ||
728 | |||
729 | |||
730 | p->rx_ring = kzalloc(ring_size_to_bytes(OCTEON_MGMT_RX_RING_SIZE), | ||
731 | GFP_KERNEL); | ||
732 | if (!p->rx_ring) | ||
733 | goto err_nomem; | ||
734 | p->rx_ring_handle = | ||
735 | dma_map_single(p->dev, p->rx_ring, | ||
736 | ring_size_to_bytes(OCTEON_MGMT_RX_RING_SIZE), | ||
737 | DMA_BIDIRECTIONAL); | ||
738 | |||
739 | p->rx_next = 0; | ||
740 | p->rx_next_fill = 0; | ||
741 | p->rx_current_fill = 0; | ||
742 | |||
743 | octeon_mgmt_reset_hw(p); | ||
744 | |||
745 | mix_ctl.u64 = cvmx_read_csr(CVMX_MIXX_CTL(port)); | ||
746 | |||
747 | /* Bring it out of reset if needed. */ | ||
748 | if (mix_ctl.s.reset) { | ||
749 | mix_ctl.s.reset = 0; | ||
750 | cvmx_write_csr(CVMX_MIXX_CTL(port), mix_ctl.u64); | ||
751 | do { | ||
752 | mix_ctl.u64 = cvmx_read_csr(CVMX_MIXX_CTL(port)); | ||
753 | } while (mix_ctl.s.reset); | ||
754 | } | ||
755 | |||
756 | agl_gmx_inf_mode.u64 = 0; | ||
757 | agl_gmx_inf_mode.s.en = 1; | ||
758 | cvmx_write_csr(CVMX_AGL_GMX_INF_MODE, agl_gmx_inf_mode.u64); | ||
759 | |||
760 | oring1.u64 = 0; | ||
761 | oring1.s.obase = p->tx_ring_handle >> 3; | ||
762 | oring1.s.osize = OCTEON_MGMT_TX_RING_SIZE; | ||
763 | cvmx_write_csr(CVMX_MIXX_ORING1(port), oring1.u64); | ||
764 | |||
765 | iring1.u64 = 0; | ||
766 | iring1.s.ibase = p->rx_ring_handle >> 3; | ||
767 | iring1.s.isize = OCTEON_MGMT_RX_RING_SIZE; | ||
768 | cvmx_write_csr(CVMX_MIXX_IRING1(port), iring1.u64); | ||
769 | |||
770 | /* Disable packet I/O. */ | ||
771 | prtx_cfg.u64 = cvmx_read_csr(CVMX_AGL_GMX_PRTX_CFG(port)); | ||
772 | prtx_cfg.s.en = 0; | ||
773 | cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), prtx_cfg.u64); | ||
774 | |||
775 | memcpy(sa.sa_data, netdev->dev_addr, ETH_ALEN); | ||
776 | octeon_mgmt_set_mac_address(netdev, &sa); | ||
777 | |||
778 | octeon_mgmt_change_mtu(netdev, netdev->mtu); | ||
779 | |||
780 | /* | ||
781 | * Enable the port HW. Packets are not allowed until | ||
782 | * cvmx_mgmt_port_enable() is called. | ||
783 | */ | ||
784 | mix_ctl.u64 = 0; | ||
785 | mix_ctl.s.crc_strip = 1; /* Strip the ending CRC */ | ||
786 | mix_ctl.s.en = 1; /* Enable the port */ | ||
787 | mix_ctl.s.nbtarb = 0; /* Arbitration mode */ | ||
788 | /* MII CB-request FIFO programmable high watermark */ | ||
789 | mix_ctl.s.mrq_hwm = 1; | ||
790 | cvmx_write_csr(CVMX_MIXX_CTL(port), mix_ctl.u64); | ||
791 | |||
792 | if (OCTEON_IS_MODEL(OCTEON_CN56XX_PASS1_X) | ||
793 | || OCTEON_IS_MODEL(OCTEON_CN52XX_PASS1_X)) { | ||
794 | /* | ||
795 | * Force compensation values, as they are not | ||
796 | * determined properly by HW | ||
797 | */ | ||
798 | union cvmx_agl_gmx_drv_ctl drv_ctl; | ||
799 | |||
800 | drv_ctl.u64 = cvmx_read_csr(CVMX_AGL_GMX_DRV_CTL); | ||
801 | if (port) { | ||
802 | drv_ctl.s.byp_en1 = 1; | ||
803 | drv_ctl.s.nctl1 = 6; | ||
804 | drv_ctl.s.pctl1 = 6; | ||
805 | } else { | ||
806 | drv_ctl.s.byp_en = 1; | ||
807 | drv_ctl.s.nctl = 6; | ||
808 | drv_ctl.s.pctl = 6; | ||
809 | } | ||
810 | cvmx_write_csr(CVMX_AGL_GMX_DRV_CTL, drv_ctl.u64); | ||
811 | } | ||
812 | |||
813 | octeon_mgmt_rx_fill_ring(netdev); | ||
814 | |||
815 | /* Clear statistics. */ | ||
816 | /* Clear on read. */ | ||
817 | cvmx_write_csr(CVMX_AGL_GMX_RXX_STATS_CTL(port), 1); | ||
818 | cvmx_write_csr(CVMX_AGL_GMX_RXX_STATS_PKTS_DRP(port), 0); | ||
819 | cvmx_write_csr(CVMX_AGL_GMX_RXX_STATS_PKTS_BAD(port), 0); | ||
820 | |||
821 | cvmx_write_csr(CVMX_AGL_GMX_TXX_STATS_CTL(port), 1); | ||
822 | cvmx_write_csr(CVMX_AGL_GMX_TXX_STAT0(port), 0); | ||
823 | cvmx_write_csr(CVMX_AGL_GMX_TXX_STAT1(port), 0); | ||
824 | |||
825 | /* Clear any pending interrupts */ | ||
826 | cvmx_write_csr(CVMX_MIXX_ISR(port), cvmx_read_csr(CVMX_MIXX_ISR(port))); | ||
827 | |||
828 | if (request_irq(p->irq, octeon_mgmt_interrupt, 0, netdev->name, | ||
829 | netdev)) { | ||
830 | dev_err(p->dev, "request_irq(%d) failed.\n", p->irq); | ||
831 | goto err_noirq; | ||
832 | } | ||
833 | |||
834 | /* Interrupt every single RX packet */ | ||
835 | mix_irhwm.u64 = 0; | ||
836 | mix_irhwm.s.irhwm = 0; | ||
837 | cvmx_write_csr(CVMX_MIXX_IRHWM(port), mix_irhwm.u64); | ||
838 | |||
839 | /* Interrupt when we have 5 or more packets to clean. */ | ||
840 | mix_orhwm.u64 = 0; | ||
841 | mix_orhwm.s.orhwm = 5; | ||
842 | cvmx_write_csr(CVMX_MIXX_ORHWM(port), mix_orhwm.u64); | ||
843 | |||
844 | /* Enable receive and transmit interrupts */ | ||
845 | mix_intena.u64 = 0; | ||
846 | mix_intena.s.ithena = 1; | ||
847 | mix_intena.s.othena = 1; | ||
848 | cvmx_write_csr(CVMX_MIXX_INTENA(port), mix_intena.u64); | ||
849 | |||
850 | |||
851 | /* Enable packet I/O. */ | ||
852 | |||
853 | rxx_frm_ctl.u64 = 0; | ||
854 | rxx_frm_ctl.s.pre_align = 1; | ||
855 | /* | ||
856 | * When set, disables the length check for non-min sized pkts | ||
857 | * with padding in the client data. | ||
858 | */ | ||
859 | rxx_frm_ctl.s.pad_len = 1; | ||
860 | /* When set, disables the length check for VLAN pkts */ | ||
861 | rxx_frm_ctl.s.vlan_len = 1; | ||
862 | /* When set, PREAMBLE checking is less strict */ | ||
863 | rxx_frm_ctl.s.pre_free = 1; | ||
864 | /* Control Pause Frames can match station SMAC */ | ||
865 | rxx_frm_ctl.s.ctl_smac = 0; | ||
866 | /* Control Pause Frames can match globally assign Multicast address */ | ||
867 | rxx_frm_ctl.s.ctl_mcst = 1; | ||
868 | /* Forward pause information to TX block */ | ||
869 | rxx_frm_ctl.s.ctl_bck = 1; | ||
870 | /* Drop Control Pause Frames */ | ||
871 | rxx_frm_ctl.s.ctl_drp = 1; | ||
872 | /* Strip off the preamble */ | ||
873 | rxx_frm_ctl.s.pre_strp = 1; | ||
874 | /* | ||
875 | * This port is configured to send PREAMBLE+SFD to begin every | ||
876 | * frame. GMX checks that the PREAMBLE is sent correctly. | ||
877 | */ | ||
878 | rxx_frm_ctl.s.pre_chk = 1; | ||
879 | cvmx_write_csr(CVMX_AGL_GMX_RXX_FRM_CTL(port), rxx_frm_ctl.u64); | ||
880 | |||
881 | /* Enable the AGL block */ | ||
882 | agl_gmx_inf_mode.u64 = 0; | ||
883 | agl_gmx_inf_mode.s.en = 1; | ||
884 | cvmx_write_csr(CVMX_AGL_GMX_INF_MODE, agl_gmx_inf_mode.u64); | ||
885 | |||
886 | /* Configure the port duplex and enables */ | ||
887 | prtx_cfg.u64 = cvmx_read_csr(CVMX_AGL_GMX_PRTX_CFG(port)); | ||
888 | prtx_cfg.s.tx_en = 1; | ||
889 | prtx_cfg.s.rx_en = 1; | ||
890 | prtx_cfg.s.en = 1; | ||
891 | p->last_duplex = 1; | ||
892 | prtx_cfg.s.duplex = p->last_duplex; | ||
893 | cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), prtx_cfg.u64); | ||
894 | |||
895 | p->last_link = 0; | ||
896 | netif_carrier_off(netdev); | ||
897 | |||
898 | if (octeon_mgmt_init_phy(netdev)) { | ||
899 | dev_err(p->dev, "Cannot initialize PHY.\n"); | ||
900 | goto err_noirq; | ||
901 | } | ||
902 | |||
903 | netif_wake_queue(netdev); | ||
904 | napi_enable(&p->napi); | ||
905 | |||
906 | return 0; | ||
907 | err_noirq: | ||
908 | octeon_mgmt_reset_hw(p); | ||
909 | dma_unmap_single(p->dev, p->rx_ring_handle, | ||
910 | ring_size_to_bytes(OCTEON_MGMT_RX_RING_SIZE), | ||
911 | DMA_BIDIRECTIONAL); | ||
912 | kfree(p->rx_ring); | ||
913 | err_nomem: | ||
914 | dma_unmap_single(p->dev, p->tx_ring_handle, | ||
915 | ring_size_to_bytes(OCTEON_MGMT_TX_RING_SIZE), | ||
916 | DMA_BIDIRECTIONAL); | ||
917 | kfree(p->tx_ring); | ||
918 | return -ENOMEM; | ||
919 | } | ||
920 | |||
921 | static int octeon_mgmt_stop(struct net_device *netdev) | ||
922 | { | ||
923 | struct octeon_mgmt *p = netdev_priv(netdev); | ||
924 | |||
925 | napi_disable(&p->napi); | ||
926 | netif_stop_queue(netdev); | ||
927 | |||
928 | if (p->phydev) | ||
929 | phy_disconnect(p->phydev); | ||
930 | |||
931 | netif_carrier_off(netdev); | ||
932 | |||
933 | octeon_mgmt_reset_hw(p); | ||
934 | |||
935 | |||
936 | free_irq(p->irq, netdev); | ||
937 | |||
938 | /* dma_unmap is a nop on Octeon, so just free everything. */ | ||
939 | skb_queue_purge(&p->tx_list); | ||
940 | skb_queue_purge(&p->rx_list); | ||
941 | |||
942 | dma_unmap_single(p->dev, p->rx_ring_handle, | ||
943 | ring_size_to_bytes(OCTEON_MGMT_RX_RING_SIZE), | ||
944 | DMA_BIDIRECTIONAL); | ||
945 | kfree(p->rx_ring); | ||
946 | |||
947 | dma_unmap_single(p->dev, p->tx_ring_handle, | ||
948 | ring_size_to_bytes(OCTEON_MGMT_TX_RING_SIZE), | ||
949 | DMA_BIDIRECTIONAL); | ||
950 | kfree(p->tx_ring); | ||
951 | |||
952 | |||
953 | return 0; | ||
954 | } | ||
955 | |||
956 | static int octeon_mgmt_xmit(struct sk_buff *skb, struct net_device *netdev) | ||
957 | { | ||
958 | struct octeon_mgmt *p = netdev_priv(netdev); | ||
959 | int port = p->port; | ||
960 | union mgmt_port_ring_entry re; | ||
961 | unsigned long flags; | ||
962 | |||
963 | re.d64 = 0; | ||
964 | re.s.len = skb->len; | ||
965 | re.s.addr = dma_map_single(p->dev, skb->data, | ||
966 | skb->len, | ||
967 | DMA_TO_DEVICE); | ||
968 | |||
969 | spin_lock_irqsave(&p->tx_list.lock, flags); | ||
970 | |||
971 | if (unlikely(p->tx_current_fill >= | ||
972 | ring_max_fill(OCTEON_MGMT_TX_RING_SIZE))) { | ||
973 | spin_unlock_irqrestore(&p->tx_list.lock, flags); | ||
974 | |||
975 | dma_unmap_single(p->dev, re.s.addr, re.s.len, | ||
976 | DMA_TO_DEVICE); | ||
977 | |||
978 | netif_stop_queue(netdev); | ||
979 | return NETDEV_TX_BUSY; | ||
980 | } | ||
981 | |||
982 | __skb_queue_tail(&p->tx_list, skb); | ||
983 | |||
984 | /* Put it in the ring. */ | ||
985 | p->tx_ring[p->tx_next] = re.d64; | ||
986 | p->tx_next = (p->tx_next + 1) % OCTEON_MGMT_TX_RING_SIZE; | ||
987 | p->tx_current_fill++; | ||
988 | |||
989 | spin_unlock_irqrestore(&p->tx_list.lock, flags); | ||
990 | |||
991 | dma_sync_single_for_device(p->dev, p->tx_ring_handle, | ||
992 | ring_size_to_bytes(OCTEON_MGMT_TX_RING_SIZE), | ||
993 | DMA_BIDIRECTIONAL); | ||
994 | |||
995 | netdev->stats.tx_packets++; | ||
996 | netdev->stats.tx_bytes += skb->len; | ||
997 | |||
998 | /* Ring the bell. */ | ||
999 | cvmx_write_csr(CVMX_MIXX_ORING2(port), 1); | ||
1000 | |||
1001 | netdev->trans_start = jiffies; | ||
1002 | octeon_mgmt_clean_tx_buffers(p); | ||
1003 | octeon_mgmt_update_tx_stats(netdev); | ||
1004 | return NETDEV_TX_OK; | ||
1005 | } | ||
1006 | |||
1007 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
1008 | static void octeon_mgmt_poll_controller(struct net_device *netdev) | ||
1009 | { | ||
1010 | struct octeon_mgmt *p = netdev_priv(netdev); | ||
1011 | |||
1012 | octeon_mgmt_receive_packets(p, 16); | ||
1013 | octeon_mgmt_update_rx_stats(netdev); | ||
1014 | return; | ||
1015 | } | ||
1016 | #endif | ||
1017 | |||
1018 | static void octeon_mgmt_get_drvinfo(struct net_device *netdev, | ||
1019 | struct ethtool_drvinfo *info) | ||
1020 | { | ||
1021 | strncpy(info->driver, DRV_NAME, sizeof(info->driver)); | ||
1022 | strncpy(info->version, DRV_VERSION, sizeof(info->version)); | ||
1023 | strncpy(info->fw_version, "N/A", sizeof(info->fw_version)); | ||
1024 | strncpy(info->bus_info, "N/A", sizeof(info->bus_info)); | ||
1025 | info->n_stats = 0; | ||
1026 | info->testinfo_len = 0; | ||
1027 | info->regdump_len = 0; | ||
1028 | info->eedump_len = 0; | ||
1029 | } | ||
1030 | |||
1031 | static int octeon_mgmt_get_settings(struct net_device *netdev, | ||
1032 | struct ethtool_cmd *cmd) | ||
1033 | { | ||
1034 | struct octeon_mgmt *p = netdev_priv(netdev); | ||
1035 | |||
1036 | if (p->phydev) | ||
1037 | return phy_ethtool_gset(p->phydev, cmd); | ||
1038 | |||
1039 | return -EINVAL; | ||
1040 | } | ||
1041 | |||
1042 | static int octeon_mgmt_set_settings(struct net_device *netdev, | ||
1043 | struct ethtool_cmd *cmd) | ||
1044 | { | ||
1045 | struct octeon_mgmt *p = netdev_priv(netdev); | ||
1046 | |||
1047 | if (!capable(CAP_NET_ADMIN)) | ||
1048 | return -EPERM; | ||
1049 | |||
1050 | if (p->phydev) | ||
1051 | return phy_ethtool_sset(p->phydev, cmd); | ||
1052 | |||
1053 | return -EINVAL; | ||
1054 | } | ||
1055 | |||
1056 | static const struct ethtool_ops octeon_mgmt_ethtool_ops = { | ||
1057 | .get_drvinfo = octeon_mgmt_get_drvinfo, | ||
1058 | .get_link = ethtool_op_get_link, | ||
1059 | .get_settings = octeon_mgmt_get_settings, | ||
1060 | .set_settings = octeon_mgmt_set_settings | ||
1061 | }; | ||
1062 | |||
1063 | static const struct net_device_ops octeon_mgmt_ops = { | ||
1064 | .ndo_open = octeon_mgmt_open, | ||
1065 | .ndo_stop = octeon_mgmt_stop, | ||
1066 | .ndo_start_xmit = octeon_mgmt_xmit, | ||
1067 | .ndo_set_rx_mode = octeon_mgmt_set_rx_filtering, | ||
1068 | .ndo_set_multicast_list = octeon_mgmt_set_rx_filtering, | ||
1069 | .ndo_set_mac_address = octeon_mgmt_set_mac_address, | ||
1070 | .ndo_do_ioctl = octeon_mgmt_ioctl, | ||
1071 | .ndo_change_mtu = octeon_mgmt_change_mtu, | ||
1072 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
1073 | .ndo_poll_controller = octeon_mgmt_poll_controller, | ||
1074 | #endif | ||
1075 | }; | ||
1076 | |||
1077 | static int __init octeon_mgmt_probe(struct platform_device *pdev) | ||
1078 | { | ||
1079 | struct resource *res_irq; | ||
1080 | struct net_device *netdev; | ||
1081 | struct octeon_mgmt *p; | ||
1082 | int i; | ||
1083 | |||
1084 | netdev = alloc_etherdev(sizeof(struct octeon_mgmt)); | ||
1085 | if (netdev == NULL) | ||
1086 | return -ENOMEM; | ||
1087 | |||
1088 | dev_set_drvdata(&pdev->dev, netdev); | ||
1089 | p = netdev_priv(netdev); | ||
1090 | netif_napi_add(netdev, &p->napi, octeon_mgmt_napi_poll, | ||
1091 | OCTEON_MGMT_NAPI_WEIGHT); | ||
1092 | |||
1093 | p->netdev = netdev; | ||
1094 | p->dev = &pdev->dev; | ||
1095 | |||
1096 | p->port = pdev->id; | ||
1097 | snprintf(netdev->name, IFNAMSIZ, "mgmt%d", p->port); | ||
1098 | |||
1099 | res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | ||
1100 | if (!res_irq) | ||
1101 | goto err; | ||
1102 | |||
1103 | p->irq = res_irq->start; | ||
1104 | spin_lock_init(&p->lock); | ||
1105 | |||
1106 | skb_queue_head_init(&p->tx_list); | ||
1107 | skb_queue_head_init(&p->rx_list); | ||
1108 | tasklet_init(&p->tx_clean_tasklet, | ||
1109 | octeon_mgmt_clean_tx_tasklet, (unsigned long)p); | ||
1110 | |||
1111 | netdev->netdev_ops = &octeon_mgmt_ops; | ||
1112 | netdev->ethtool_ops = &octeon_mgmt_ethtool_ops; | ||
1113 | |||
1114 | |||
1115 | /* The mgmt ports get the first N MACs. */ | ||
1116 | for (i = 0; i < 6; i++) | ||
1117 | netdev->dev_addr[i] = octeon_bootinfo->mac_addr_base[i]; | ||
1118 | netdev->dev_addr[5] += p->port; | ||
1119 | |||
1120 | if (p->port >= octeon_bootinfo->mac_addr_count) | ||
1121 | dev_err(&pdev->dev, | ||
1122 | "Error %s: Using MAC outside of the assigned range: " | ||
1123 | "%02x:%02x:%02x:%02x:%02x:%02x\n", netdev->name, | ||
1124 | netdev->dev_addr[0], netdev->dev_addr[1], | ||
1125 | netdev->dev_addr[2], netdev->dev_addr[3], | ||
1126 | netdev->dev_addr[4], netdev->dev_addr[5]); | ||
1127 | |||
1128 | if (register_netdev(netdev)) | ||
1129 | goto err; | ||
1130 | |||
1131 | dev_info(&pdev->dev, "Version " DRV_VERSION "\n"); | ||
1132 | return 0; | ||
1133 | err: | ||
1134 | free_netdev(netdev); | ||
1135 | return -ENOENT; | ||
1136 | } | ||
1137 | |||
1138 | static int __exit octeon_mgmt_remove(struct platform_device *pdev) | ||
1139 | { | ||
1140 | struct net_device *netdev = dev_get_drvdata(&pdev->dev); | ||
1141 | |||
1142 | unregister_netdev(netdev); | ||
1143 | free_netdev(netdev); | ||
1144 | return 0; | ||
1145 | } | ||
1146 | |||
1147 | static struct platform_driver octeon_mgmt_driver = { | ||
1148 | .driver = { | ||
1149 | .name = "octeon_mgmt", | ||
1150 | .owner = THIS_MODULE, | ||
1151 | }, | ||
1152 | .probe = octeon_mgmt_probe, | ||
1153 | .remove = __exit_p(octeon_mgmt_remove), | ||
1154 | }; | ||
1155 | |||
1156 | extern void octeon_mdiobus_force_mod_depencency(void); | ||
1157 | |||
1158 | static int __init octeon_mgmt_mod_init(void) | ||
1159 | { | ||
1160 | /* Force our mdiobus driver module to be loaded first. */ | ||
1161 | octeon_mdiobus_force_mod_depencency(); | ||
1162 | return platform_driver_register(&octeon_mgmt_driver); | ||
1163 | } | ||
1164 | |||
1165 | static void __exit octeon_mgmt_mod_exit(void) | ||
1166 | { | ||
1167 | platform_driver_unregister(&octeon_mgmt_driver); | ||
1168 | } | ||
1169 | |||
1170 | module_init(octeon_mgmt_mod_init); | ||
1171 | module_exit(octeon_mgmt_mod_exit); | ||
1172 | |||
1173 | MODULE_DESCRIPTION(DRV_DESCRIPTION); | ||
1174 | MODULE_AUTHOR("David Daney"); | ||
1175 | MODULE_LICENSE("GPL"); | ||
1176 | MODULE_VERSION(DRV_VERSION); | ||
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c index 17a27225cc98..98938ea9e0bd 100644 --- a/drivers/net/pcmcia/3c574_cs.c +++ b/drivers/net/pcmcia/3c574_cs.c | |||
@@ -912,7 +912,11 @@ static void media_check(unsigned long arg) | |||
912 | if ((inw(ioaddr + EL3_STATUS) & IntLatch) && (inb(ioaddr + Timer) == 0xff)) { | 912 | if ((inw(ioaddr + EL3_STATUS) & IntLatch) && (inb(ioaddr + Timer) == 0xff)) { |
913 | if (!lp->fast_poll) | 913 | if (!lp->fast_poll) |
914 | printk(KERN_INFO "%s: interrupt(s) dropped!\n", dev->name); | 914 | printk(KERN_INFO "%s: interrupt(s) dropped!\n", dev->name); |
915 | |||
916 | local_irq_save(flags); | ||
915 | el3_interrupt(dev->irq, dev); | 917 | el3_interrupt(dev->irq, dev); |
918 | local_irq_restore(flags); | ||
919 | |||
916 | lp->fast_poll = HZ; | 920 | lp->fast_poll = HZ; |
917 | } | 921 | } |
918 | if (lp->fast_poll) { | 922 | if (lp->fast_poll) { |
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index 6f8d7e2e5922..322e11df0097 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c | |||
@@ -711,7 +711,11 @@ static void media_check(unsigned long arg) | |||
711 | (inb(ioaddr + EL3_TIMER) == 0xff)) { | 711 | (inb(ioaddr + EL3_TIMER) == 0xff)) { |
712 | if (!lp->fast_poll) | 712 | if (!lp->fast_poll) |
713 | printk(KERN_WARNING "%s: interrupt(s) dropped!\n", dev->name); | 713 | printk(KERN_WARNING "%s: interrupt(s) dropped!\n", dev->name); |
714 | |||
715 | local_irq_save(flags); | ||
714 | el3_interrupt(dev->irq, dev); | 716 | el3_interrupt(dev->irq, dev); |
717 | local_irq_restore(flags); | ||
718 | |||
715 | lp->fast_poll = HZ; | 719 | lp->fast_poll = HZ; |
716 | } | 720 | } |
717 | if (lp->fast_poll) { | 721 | if (lp->fast_poll) { |
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/Kconfig b/drivers/net/phy/Kconfig index d5d8e1c5bc91..fc5938ba3d78 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig | |||
@@ -115,4 +115,15 @@ config MDIO_GPIO | |||
115 | To compile this driver as a module, choose M here: the module | 115 | To compile this driver as a module, choose M here: the module |
116 | will be called mdio-gpio. | 116 | will be called mdio-gpio. |
117 | 117 | ||
118 | config MDIO_OCTEON | ||
119 | tristate "Support for MDIO buses on Octeon SOCs" | ||
120 | depends on CPU_CAVIUM_OCTEON | ||
121 | default y | ||
122 | help | ||
123 | |||
124 | This module provides a driver for the Octeon MDIO busses. | ||
125 | It is required by the Octeon Ethernet device drivers. | ||
126 | |||
127 | If in doubt, say Y. | ||
128 | |||
118 | endif # PHYLIB | 129 | endif # PHYLIB |
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile index edfaac48cbd5..1342585af381 100644 --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile | |||
@@ -20,3 +20,4 @@ obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o | |||
20 | obj-$(CONFIG_MDIO_GPIO) += mdio-gpio.o | 20 | obj-$(CONFIG_MDIO_GPIO) += mdio-gpio.o |
21 | obj-$(CONFIG_NATIONAL_PHY) += national.o | 21 | obj-$(CONFIG_NATIONAL_PHY) += national.o |
22 | obj-$(CONFIG_STE10XP) += ste10Xp.o | 22 | obj-$(CONFIG_STE10XP) += ste10Xp.o |
23 | obj-$(CONFIG_MDIO_OCTEON) += mdio-octeon.o | ||
diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c index f63c96a4ecb4..33c4b12a63ba 100644 --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c | |||
@@ -326,12 +326,13 @@ error: | |||
326 | 326 | ||
327 | static void bcm54xx_adjust_rxrefclk(struct phy_device *phydev) | 327 | static void bcm54xx_adjust_rxrefclk(struct phy_device *phydev) |
328 | { | 328 | { |
329 | u32 val, orig; | 329 | u32 orig; |
330 | int val; | ||
330 | bool clk125en = true; | 331 | bool clk125en = true; |
331 | 332 | ||
332 | /* Abort if we are using an untested phy. */ | 333 | /* Abort if we are using an untested phy. */ |
333 | if (BRCM_PHY_MODEL(phydev) != PHY_ID_BCM57780 || | 334 | if (BRCM_PHY_MODEL(phydev) != PHY_ID_BCM57780 && |
334 | BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610 || | 335 | BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610 && |
335 | BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610M) | 336 | BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610M) |
336 | return; | 337 | return; |
337 | 338 | ||
diff --git a/drivers/net/phy/mdio-octeon.c b/drivers/net/phy/mdio-octeon.c new file mode 100644 index 000000000000..61a4461cbda5 --- /dev/null +++ b/drivers/net/phy/mdio-octeon.c | |||
@@ -0,0 +1,180 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Copyright (C) 2009 Cavium Networks | ||
7 | */ | ||
8 | |||
9 | #include <linux/init.h> | ||
10 | #include <linux/module.h> | ||
11 | #include <linux/platform_device.h> | ||
12 | #include <linux/phy.h> | ||
13 | |||
14 | #include <asm/octeon/octeon.h> | ||
15 | #include <asm/octeon/cvmx-smix-defs.h> | ||
16 | |||
17 | #define DRV_VERSION "1.0" | ||
18 | #define DRV_DESCRIPTION "Cavium Networks Octeon SMI/MDIO driver" | ||
19 | |||
20 | struct octeon_mdiobus { | ||
21 | struct mii_bus *mii_bus; | ||
22 | int unit; | ||
23 | int phy_irq[PHY_MAX_ADDR]; | ||
24 | }; | ||
25 | |||
26 | static int octeon_mdiobus_read(struct mii_bus *bus, int phy_id, int regnum) | ||
27 | { | ||
28 | struct octeon_mdiobus *p = bus->priv; | ||
29 | union cvmx_smix_cmd smi_cmd; | ||
30 | union cvmx_smix_rd_dat smi_rd; | ||
31 | int timeout = 1000; | ||
32 | |||
33 | smi_cmd.u64 = 0; | ||
34 | smi_cmd.s.phy_op = 1; /* MDIO_CLAUSE_22_READ */ | ||
35 | smi_cmd.s.phy_adr = phy_id; | ||
36 | smi_cmd.s.reg_adr = regnum; | ||
37 | cvmx_write_csr(CVMX_SMIX_CMD(p->unit), smi_cmd.u64); | ||
38 | |||
39 | do { | ||
40 | /* | ||
41 | * Wait 1000 clocks so we don't saturate the RSL bus | ||
42 | * doing reads. | ||
43 | */ | ||
44 | cvmx_wait(1000); | ||
45 | smi_rd.u64 = cvmx_read_csr(CVMX_SMIX_RD_DAT(p->unit)); | ||
46 | } while (smi_rd.s.pending && --timeout); | ||
47 | |||
48 | if (smi_rd.s.val) | ||
49 | return smi_rd.s.dat; | ||
50 | else | ||
51 | return -EIO; | ||
52 | } | ||
53 | |||
54 | static int octeon_mdiobus_write(struct mii_bus *bus, int phy_id, | ||
55 | int regnum, u16 val) | ||
56 | { | ||
57 | struct octeon_mdiobus *p = bus->priv; | ||
58 | union cvmx_smix_cmd smi_cmd; | ||
59 | union cvmx_smix_wr_dat smi_wr; | ||
60 | int timeout = 1000; | ||
61 | |||
62 | smi_wr.u64 = 0; | ||
63 | smi_wr.s.dat = val; | ||
64 | cvmx_write_csr(CVMX_SMIX_WR_DAT(p->unit), smi_wr.u64); | ||
65 | |||
66 | smi_cmd.u64 = 0; | ||
67 | smi_cmd.s.phy_op = 0; /* MDIO_CLAUSE_22_WRITE */ | ||
68 | smi_cmd.s.phy_adr = phy_id; | ||
69 | smi_cmd.s.reg_adr = regnum; | ||
70 | cvmx_write_csr(CVMX_SMIX_CMD(p->unit), smi_cmd.u64); | ||
71 | |||
72 | do { | ||
73 | /* | ||
74 | * Wait 1000 clocks so we don't saturate the RSL bus | ||
75 | * doing reads. | ||
76 | */ | ||
77 | cvmx_wait(1000); | ||
78 | smi_wr.u64 = cvmx_read_csr(CVMX_SMIX_WR_DAT(p->unit)); | ||
79 | } while (smi_wr.s.pending && --timeout); | ||
80 | |||
81 | if (timeout <= 0) | ||
82 | return -EIO; | ||
83 | |||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | static int __init octeon_mdiobus_probe(struct platform_device *pdev) | ||
88 | { | ||
89 | struct octeon_mdiobus *bus; | ||
90 | int i; | ||
91 | int err = -ENOENT; | ||
92 | |||
93 | bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL); | ||
94 | if (!bus) | ||
95 | return -ENOMEM; | ||
96 | |||
97 | /* The platform_device id is our unit number. */ | ||
98 | bus->unit = pdev->id; | ||
99 | |||
100 | bus->mii_bus = mdiobus_alloc(); | ||
101 | |||
102 | if (!bus->mii_bus) | ||
103 | goto err; | ||
104 | |||
105 | /* | ||
106 | * Standard Octeon evaluation boards don't support phy | ||
107 | * interrupts, we need to poll. | ||
108 | */ | ||
109 | for (i = 0; i < PHY_MAX_ADDR; i++) | ||
110 | bus->phy_irq[i] = PHY_POLL; | ||
111 | |||
112 | bus->mii_bus->priv = bus; | ||
113 | bus->mii_bus->irq = bus->phy_irq; | ||
114 | bus->mii_bus->name = "mdio-octeon"; | ||
115 | snprintf(bus->mii_bus->id, MII_BUS_ID_SIZE, "%x", bus->unit); | ||
116 | bus->mii_bus->parent = &pdev->dev; | ||
117 | |||
118 | bus->mii_bus->read = octeon_mdiobus_read; | ||
119 | bus->mii_bus->write = octeon_mdiobus_write; | ||
120 | |||
121 | dev_set_drvdata(&pdev->dev, bus); | ||
122 | |||
123 | err = mdiobus_register(bus->mii_bus); | ||
124 | if (err) | ||
125 | goto err_register; | ||
126 | |||
127 | dev_info(&pdev->dev, "Version " DRV_VERSION "\n"); | ||
128 | |||
129 | return 0; | ||
130 | err_register: | ||
131 | mdiobus_free(bus->mii_bus); | ||
132 | |||
133 | err: | ||
134 | devm_kfree(&pdev->dev, bus); | ||
135 | return err; | ||
136 | } | ||
137 | |||
138 | static int __exit octeon_mdiobus_remove(struct platform_device *pdev) | ||
139 | { | ||
140 | struct octeon_mdiobus *bus; | ||
141 | |||
142 | bus = dev_get_drvdata(&pdev->dev); | ||
143 | |||
144 | mdiobus_unregister(bus->mii_bus); | ||
145 | mdiobus_free(bus->mii_bus); | ||
146 | return 0; | ||
147 | } | ||
148 | |||
149 | static struct platform_driver octeon_mdiobus_driver = { | ||
150 | .driver = { | ||
151 | .name = "mdio-octeon", | ||
152 | .owner = THIS_MODULE, | ||
153 | }, | ||
154 | .probe = octeon_mdiobus_probe, | ||
155 | .remove = __exit_p(octeon_mdiobus_remove), | ||
156 | }; | ||
157 | |||
158 | void octeon_mdiobus_force_mod_depencency(void) | ||
159 | { | ||
160 | /* Let ethernet drivers force us to be loaded. */ | ||
161 | } | ||
162 | EXPORT_SYMBOL(octeon_mdiobus_force_mod_depencency); | ||
163 | |||
164 | static int __init octeon_mdiobus_mod_init(void) | ||
165 | { | ||
166 | return platform_driver_register(&octeon_mdiobus_driver); | ||
167 | } | ||
168 | |||
169 | static void __exit octeon_mdiobus_mod_exit(void) | ||
170 | { | ||
171 | platform_driver_unregister(&octeon_mdiobus_driver); | ||
172 | } | ||
173 | |||
174 | module_init(octeon_mdiobus_mod_init); | ||
175 | module_exit(octeon_mdiobus_mod_exit); | ||
176 | |||
177 | MODULE_DESCRIPTION(DRV_DESCRIPTION); | ||
178 | MODULE_VERSION(DRV_VERSION); | ||
179 | MODULE_AUTHOR("David Daney"); | ||
180 | MODULE_LICENSE("GPL"); | ||
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_device.c b/drivers/net/phy/phy_device.c index b10fedd82143..8212b2b93422 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -378,6 +378,20 @@ void phy_disconnect(struct phy_device *phydev) | |||
378 | } | 378 | } |
379 | EXPORT_SYMBOL(phy_disconnect); | 379 | EXPORT_SYMBOL(phy_disconnect); |
380 | 380 | ||
381 | int phy_init_hw(struct phy_device *phydev) | ||
382 | { | ||
383 | int ret; | ||
384 | |||
385 | if (!phydev->drv || !phydev->drv->config_init) | ||
386 | return 0; | ||
387 | |||
388 | ret = phy_scan_fixups(phydev); | ||
389 | if (ret < 0) | ||
390 | return ret; | ||
391 | |||
392 | return phydev->drv->config_init(phydev); | ||
393 | } | ||
394 | |||
381 | /** | 395 | /** |
382 | * phy_attach_direct - attach a network device to a given PHY device pointer | 396 | * phy_attach_direct - attach a network device to a given PHY device pointer |
383 | * @dev: network device to attach | 397 | * @dev: network device to attach |
@@ -425,21 +439,7 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, | |||
425 | /* Do initial configuration here, now that | 439 | /* Do initial configuration here, now that |
426 | * we have certain key parameters | 440 | * we have certain key parameters |
427 | * (dev_flags and interface) */ | 441 | * (dev_flags and interface) */ |
428 | if (phydev->drv->config_init) { | 442 | 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 | } | 443 | } |
444 | EXPORT_SYMBOL(phy_attach_direct); | 444 | EXPORT_SYMBOL(phy_attach_direct); |
445 | 445 | ||
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index acfc5a3aa490..60f96c468a24 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -4859,7 +4859,7 @@ out: | |||
4859 | return 0; | 4859 | return 0; |
4860 | } | 4860 | } |
4861 | 4861 | ||
4862 | static struct dev_pm_ops rtl8169_pm_ops = { | 4862 | static const struct dev_pm_ops rtl8169_pm_ops = { |
4863 | .suspend = rtl8169_suspend, | 4863 | .suspend = rtl8169_suspend, |
4864 | .resume = rtl8169_resume, | 4864 | .resume = rtl8169_resume, |
4865 | .freeze = rtl8169_suspend, | 4865 | .freeze = rtl8169_suspend, |
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/sfc/efx.c b/drivers/net/sfc/efx.c index f983e3b507cc..103e8b0e2a0d 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); |
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_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..0d4eba7266ec 100644 --- a/drivers/net/sfc/mcdi.c +++ b/drivers/net/sfc/mcdi.c | |||
@@ -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 | ||
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/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..ff8f0a417fa3 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; |
@@ -137,6 +335,16 @@ static int qt202x_reset_phy(struct efx_nic *efx) | |||
137 | 335 | ||
138 | static int qt202x_phy_probe(struct efx_nic *efx) | 336 | static int qt202x_phy_probe(struct efx_nic *efx) |
139 | { | 337 | { |
338 | struct qt202x_phy_data *phy_data; | ||
339 | |||
340 | phy_data = kzalloc(sizeof(struct qt202x_phy_data), GFP_KERNEL); | ||
341 | if (!phy_data) | ||
342 | return -ENOMEM; | ||
343 | efx->phy_data = phy_data; | ||
344 | phy_data->phy_mode = efx->phy_mode; | ||
345 | phy_data->bug17190_in_bad_state = false; | ||
346 | phy_data->bug17190_timer = 0; | ||
347 | |||
140 | efx->mdio.mmds = QT202X_REQUIRED_DEVS; | 348 | efx->mdio.mmds = QT202X_REQUIRED_DEVS; |
141 | efx->mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22; | 349 | efx->mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22; |
142 | efx->loopback_modes = QT202X_LOOPBACKS | FALCON_XMAC_LOOPBACKS; | 350 | efx->loopback_modes = QT202X_LOOPBACKS | FALCON_XMAC_LOOPBACKS; |
@@ -145,7 +353,6 @@ static int qt202x_phy_probe(struct efx_nic *efx) | |||
145 | 353 | ||
146 | static int qt202x_phy_init(struct efx_nic *efx) | 354 | static int qt202x_phy_init(struct efx_nic *efx) |
147 | { | 355 | { |
148 | struct qt202x_phy_data *phy_data; | ||
149 | u32 devid; | 356 | u32 devid; |
150 | int rc; | 357 | int rc; |
151 | 358 | ||
@@ -155,17 +362,14 @@ static int qt202x_phy_init(struct efx_nic *efx) | |||
155 | return rc; | 362 | return rc; |
156 | } | 363 | } |
157 | 364 | ||
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); | 365 | devid = efx_mdio_read_id(efx, MDIO_MMD_PHYXS); |
164 | EFX_INFO(efx, "PHY ID reg %x (OUI %06x model %02x revision %x)\n", | 366 | 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), | 367 | devid, efx_mdio_id_oui(devid), efx_mdio_id_model(devid), |
166 | efx_mdio_id_rev(devid)); | 368 | efx_mdio_id_rev(devid)); |
167 | 369 | ||
168 | phy_data->phy_mode = efx->phy_mode; | 370 | if (efx->phy_type == PHY_TYPE_QT2025C) |
371 | qt2025c_firmware_id(efx); | ||
372 | |||
169 | return 0; | 373 | return 0; |
170 | } | 374 | } |
171 | 375 | ||
@@ -183,6 +387,9 @@ static bool qt202x_phy_poll(struct efx_nic *efx) | |||
183 | efx->link_state.fd = true; | 387 | efx->link_state.fd = true; |
184 | efx->link_state.fc = efx->wanted_fc; | 388 | efx->link_state.fc = efx->wanted_fc; |
185 | 389 | ||
390 | if (efx->phy_type == PHY_TYPE_QT2025C) | ||
391 | qt2025c_bug17190_workaround(efx); | ||
392 | |||
186 | return efx->link_state.up != was_up; | 393 | return efx->link_state.up != was_up; |
187 | } | 394 | } |
188 | 395 | ||
@@ -191,6 +398,10 @@ static int qt202x_phy_reconfigure(struct efx_nic *efx) | |||
191 | struct qt202x_phy_data *phy_data = efx->phy_data; | 398 | struct qt202x_phy_data *phy_data = efx->phy_data; |
192 | 399 | ||
193 | if (efx->phy_type == PHY_TYPE_QT2025C) { | 400 | if (efx->phy_type == PHY_TYPE_QT2025C) { |
401 | int rc = qt2025c_select_phy_mode(efx); | ||
402 | if (rc) | ||
403 | return rc; | ||
404 | |||
194 | /* There are several different register bits which can | 405 | /* There are several different register bits which can |
195 | * disable TX (and save power) on direct-attach cables | 406 | * disable TX (and save power) on direct-attach cables |
196 | * or optical transceivers, varying somewhat between | 407 | * or optical transceivers, varying somewhat between |
@@ -224,7 +435,7 @@ static void qt202x_phy_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecm | |||
224 | mdio45_ethtool_gset(&efx->mdio, ecmd); | 435 | mdio45_ethtool_gset(&efx->mdio, ecmd); |
225 | } | 436 | } |
226 | 437 | ||
227 | static void qt202x_phy_fini(struct efx_nic *efx) | 438 | static void qt202x_phy_remove(struct efx_nic *efx) |
228 | { | 439 | { |
229 | /* Free the context block */ | 440 | /* Free the context block */ |
230 | kfree(efx->phy_data); | 441 | kfree(efx->phy_data); |
@@ -236,7 +447,8 @@ struct efx_phy_operations falcon_qt202x_phy_ops = { | |||
236 | .init = qt202x_phy_init, | 447 | .init = qt202x_phy_init, |
237 | .reconfigure = qt202x_phy_reconfigure, | 448 | .reconfigure = qt202x_phy_reconfigure, |
238 | .poll = qt202x_phy_poll, | 449 | .poll = qt202x_phy_poll, |
239 | .fini = qt202x_phy_fini, | 450 | .fini = efx_port_dummy_op_void, |
451 | .remove = qt202x_phy_remove, | ||
240 | .get_settings = qt202x_phy_get_settings, | 452 | .get_settings = qt202x_phy_get_settings, |
241 | .set_settings = efx_mdio_set_settings, | 453 | .set_settings = efx_mdio_set_settings, |
242 | }; | 454 | }; |
diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c index 14949bb303a0..250c8827b842 100644 --- a/drivers/net/sfc/selftest.c +++ b/drivers/net/sfc/selftest.c | |||
@@ -47,7 +47,7 @@ static const unsigned char payload_source[ETH_ALEN] = { | |||
47 | 0x00, 0x0f, 0x53, 0x1b, 0x1b, 0x1b, | 47 | 0x00, 0x0f, 0x53, 0x1b, 0x1b, 0x1b, |
48 | }; | 48 | }; |
49 | 49 | ||
50 | static const char *payload_msg = | 50 | static const char payload_msg[] = |
51 | "Hello world! This is an Efx loopback test in progress!"; | 51 | "Hello world! This is an Efx loopback test in progress!"; |
52 | 52 | ||
53 | /** | 53 | /** |
@@ -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 c88bc1013047..7402b858cab7 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c | |||
@@ -84,6 +84,8 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = { | |||
84 | .mpr = 1, | 84 | .mpr = 1, |
85 | .tpauser = 1, | 85 | .tpauser = 1, |
86 | .hw_swap = 1, | 86 | .hw_swap = 1, |
87 | .rpadir = 1, | ||
88 | .rpadir_value = 0x00020000, /* NET_IP_ALIGN assumed to be 2 */ | ||
87 | }; | 89 | }; |
88 | 90 | ||
89 | #elif defined(CONFIG_CPU_SUBTYPE_SH7763) | 91 | #elif defined(CONFIG_CPU_SUBTYPE_SH7763) |
@@ -108,7 +110,7 @@ static void sh_eth_reset(struct net_device *ndev) | |||
108 | mdelay(1); | 110 | mdelay(1); |
109 | cnt--; | 111 | cnt--; |
110 | } | 112 | } |
111 | if (cnt < 0) | 113 | if (cnt == 0) |
112 | printk(KERN_ERR "Device reset fail\n"); | 114 | printk(KERN_ERR "Device reset fail\n"); |
113 | 115 | ||
114 | /* Table Init */ | 116 | /* Table Init */ |
@@ -175,7 +177,6 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = { | |||
175 | .tpauser = 1, | 177 | .tpauser = 1, |
176 | .bculr = 1, | 178 | .bculr = 1, |
177 | .hw_swap = 1, | 179 | .hw_swap = 1, |
178 | .rpadir = 1, | ||
179 | .no_trimd = 1, | 180 | .no_trimd = 1, |
180 | .no_ade = 1, | 181 | .no_ade = 1, |
181 | }; | 182 | }; |
@@ -501,6 +502,8 @@ static int sh_eth_ring_init(struct net_device *ndev) | |||
501 | */ | 502 | */ |
502 | mdp->rx_buf_sz = (ndev->mtu <= 1492 ? PKT_BUF_SZ : | 503 | mdp->rx_buf_sz = (ndev->mtu <= 1492 ? PKT_BUF_SZ : |
503 | (((ndev->mtu + 26 + 7) & ~7) + 2 + 16)); | 504 | (((ndev->mtu + 26 + 7) & ~7) + 2 + 16)); |
505 | if (mdp->cd->rpadir) | ||
506 | mdp->rx_buf_sz += NET_IP_ALIGN; | ||
504 | 507 | ||
505 | /* Allocate RX and TX skb rings */ | 508 | /* Allocate RX and TX skb rings */ |
506 | mdp->rx_skbuff = kmalloc(sizeof(*mdp->rx_skbuff) * RX_RING_SIZE, | 509 | mdp->rx_skbuff = kmalloc(sizeof(*mdp->rx_skbuff) * RX_RING_SIZE, |
@@ -715,6 +718,8 @@ static int sh_eth_rx(struct net_device *ndev) | |||
715 | pkt_len + 2); | 718 | pkt_len + 2); |
716 | skb = mdp->rx_skbuff[entry]; | 719 | skb = mdp->rx_skbuff[entry]; |
717 | mdp->rx_skbuff[entry] = NULL; | 720 | mdp->rx_skbuff[entry] = NULL; |
721 | if (mdp->cd->rpadir) | ||
722 | skb_reserve(skb, NET_IP_ALIGN); | ||
718 | skb_put(skb, pkt_len); | 723 | skb_put(skb, pkt_len); |
719 | skb->protocol = eth_type_trans(skb, ndev); | 724 | skb->protocol = eth_type_trans(skb, ndev); |
720 | netif_rx(skb); | 725 | netif_rx(skb); |
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 89a05d674ddc..37f486b65f63 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -644,7 +644,6 @@ 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); | ||
648 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); | 647 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); |
649 | reg1 &= ~phy_power[port]; | 648 | reg1 &= ~phy_power[port]; |
650 | 649 | ||
@@ -652,7 +651,6 @@ static void sky2_phy_power_up(struct sky2_hw *hw, unsigned port) | |||
652 | reg1 |= coma_mode[port]; | 651 | reg1 |= coma_mode[port]; |
653 | 652 | ||
654 | sky2_pci_write32(hw, PCI_DEV_REG1, reg1); | 653 | sky2_pci_write32(hw, PCI_DEV_REG1, reg1); |
655 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | ||
656 | sky2_pci_read32(hw, PCI_DEV_REG1); | 654 | sky2_pci_read32(hw, PCI_DEV_REG1); |
657 | 655 | ||
658 | if (hw->chip_id == CHIP_ID_YUKON_FE) | 656 | if (hw->chip_id == CHIP_ID_YUKON_FE) |
@@ -709,11 +707,9 @@ static void sky2_phy_power_down(struct sky2_hw *hw, unsigned port) | |||
709 | gm_phy_write(hw, port, PHY_MARV_CTRL, PHY_CT_PDOWN); | 707 | gm_phy_write(hw, port, PHY_MARV_CTRL, PHY_CT_PDOWN); |
710 | } | 708 | } |
711 | 709 | ||
712 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | ||
713 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); | 710 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); |
714 | reg1 |= phy_power[port]; /* set PHY to PowerDown/COMA Mode */ | 711 | reg1 |= phy_power[port]; /* set PHY to PowerDown/COMA Mode */ |
715 | sky2_pci_write32(hw, PCI_DEV_REG1, reg1); | 712 | sky2_pci_write32(hw, PCI_DEV_REG1, reg1); |
716 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | ||
717 | } | 713 | } |
718 | 714 | ||
719 | /* Force a renegotiation */ | 715 | /* Force a renegotiation */ |
@@ -1848,7 +1844,8 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done) | |||
1848 | sky2->tx_cons = idx; | 1844 | sky2->tx_cons = idx; |
1849 | smp_mb(); | 1845 | smp_mb(); |
1850 | 1846 | ||
1851 | if (tx_avail(sky2) > MAX_SKB_TX_LE + 4) | 1847 | /* Wake unless it's detached, and called e.g. from sky2_down() */ |
1848 | if (tx_avail(sky2) > MAX_SKB_TX_LE + 4 && netif_device_present(dev)) | ||
1852 | netif_wake_queue(dev); | 1849 | netif_wake_queue(dev); |
1853 | } | 1850 | } |
1854 | 1851 | ||
@@ -2152,9 +2149,7 @@ static void sky2_qlink_intr(struct sky2_hw *hw) | |||
2152 | 2149 | ||
2153 | /* reset PHY Link Detect */ | 2150 | /* reset PHY Link Detect */ |
2154 | phy = sky2_pci_read16(hw, PSM_CONFIG_REG4); | 2151 | phy = sky2_pci_read16(hw, PSM_CONFIG_REG4); |
2155 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | ||
2156 | sky2_pci_write16(hw, PSM_CONFIG_REG4, phy | 1); | 2152 | sky2_pci_write16(hw, PSM_CONFIG_REG4, phy | 1); |
2157 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | ||
2158 | 2153 | ||
2159 | sky2_link_up(sky2); | 2154 | sky2_link_up(sky2); |
2160 | } | 2155 | } |
@@ -2645,7 +2640,6 @@ static void sky2_hw_intr(struct sky2_hw *hw) | |||
2645 | if (status & (Y2_IS_MST_ERR | Y2_IS_IRQ_STAT)) { | 2640 | if (status & (Y2_IS_MST_ERR | Y2_IS_IRQ_STAT)) { |
2646 | u16 pci_err; | 2641 | u16 pci_err; |
2647 | 2642 | ||
2648 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | ||
2649 | pci_err = sky2_pci_read16(hw, PCI_STATUS); | 2643 | pci_err = sky2_pci_read16(hw, PCI_STATUS); |
2650 | if (net_ratelimit()) | 2644 | if (net_ratelimit()) |
2651 | dev_err(&pdev->dev, "PCI hardware error (0x%x)\n", | 2645 | dev_err(&pdev->dev, "PCI hardware error (0x%x)\n", |
@@ -2653,14 +2647,12 @@ static void sky2_hw_intr(struct sky2_hw *hw) | |||
2653 | 2647 | ||
2654 | sky2_pci_write16(hw, PCI_STATUS, | 2648 | sky2_pci_write16(hw, PCI_STATUS, |
2655 | pci_err | PCI_STATUS_ERROR_BITS); | 2649 | pci_err | PCI_STATUS_ERROR_BITS); |
2656 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | ||
2657 | } | 2650 | } |
2658 | 2651 | ||
2659 | if (status & Y2_IS_PCI_EXP) { | 2652 | if (status & Y2_IS_PCI_EXP) { |
2660 | /* PCI-Express uncorrectable Error occurred */ | 2653 | /* PCI-Express uncorrectable Error occurred */ |
2661 | u32 err; | 2654 | u32 err; |
2662 | 2655 | ||
2663 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | ||
2664 | err = sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS); | 2656 | err = sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS); |
2665 | sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS, | 2657 | sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS, |
2666 | 0xfffffffful); | 2658 | 0xfffffffful); |
@@ -2668,7 +2660,6 @@ static void sky2_hw_intr(struct sky2_hw *hw) | |||
2668 | dev_err(&pdev->dev, "PCI Express error (0x%x)\n", err); | 2660 | dev_err(&pdev->dev, "PCI Express error (0x%x)\n", err); |
2669 | 2661 | ||
2670 | sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS); | 2662 | sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS); |
2671 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | ||
2672 | } | 2663 | } |
2673 | 2664 | ||
2674 | if (status & Y2_HWE_L1_MASK) | 2665 | if (status & Y2_HWE_L1_MASK) |
@@ -3047,7 +3038,6 @@ static void sky2_reset(struct sky2_hw *hw) | |||
3047 | } | 3038 | } |
3048 | 3039 | ||
3049 | sky2_power_on(hw); | 3040 | sky2_power_on(hw); |
3050 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | ||
3051 | 3041 | ||
3052 | for (i = 0; i < hw->ports; i++) { | 3042 | for (i = 0; i < hw->ports; i++) { |
3053 | sky2_write8(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_SET); | 3043 | sky2_write8(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_SET); |
@@ -3084,7 +3074,6 @@ static void sky2_reset(struct sky2_hw *hw) | |||
3084 | reg <<= PSM_CONFIG_REG4_TIMER_PHY_LINK_DETECT_BASE; | 3074 | reg <<= PSM_CONFIG_REG4_TIMER_PHY_LINK_DETECT_BASE; |
3085 | 3075 | ||
3086 | /* reset PHY Link Detect */ | 3076 | /* reset PHY Link Detect */ |
3087 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | ||
3088 | sky2_pci_write16(hw, PSM_CONFIG_REG4, | 3077 | sky2_pci_write16(hw, PSM_CONFIG_REG4, |
3089 | reg | PSM_CONFIG_REG4_RST_PHY_LINK_DETECT); | 3078 | reg | PSM_CONFIG_REG4_RST_PHY_LINK_DETECT); |
3090 | sky2_pci_write16(hw, PSM_CONFIG_REG4, reg); | 3079 | sky2_pci_write16(hw, PSM_CONFIG_REG4, reg); |
@@ -3102,7 +3091,6 @@ static void sky2_reset(struct sky2_hw *hw) | |||
3102 | /* restore the PCIe Link Control register */ | 3091 | /* restore the PCIe Link Control register */ |
3103 | sky2_pci_write16(hw, cap + PCI_EXP_LNKCTL, reg); | 3092 | sky2_pci_write16(hw, cap + PCI_EXP_LNKCTL, reg); |
3104 | } | 3093 | } |
3105 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | ||
3106 | 3094 | ||
3107 | /* re-enable PEX PM in PEX PHY debug reg. 8 (clear bit 12) */ | 3095 | /* re-enable PEX PM in PEX PHY debug reg. 8 (clear bit 12) */ |
3108 | sky2_write32(hw, Y2_PEX_PHY_DATA, PEX_DB_ACCESS | (0x08UL << 16)); | 3096 | sky2_write32(hw, Y2_PEX_PHY_DATA, PEX_DB_ACCESS | (0x08UL << 16)); |
@@ -4530,7 +4518,7 @@ static const char *sky2_name(u8 chipid, char *buf, int sz) | |||
4530 | "Optima", /* 0xbc */ | 4518 | "Optima", /* 0xbc */ |
4531 | }; | 4519 | }; |
4532 | 4520 | ||
4533 | if (chipid >= CHIP_ID_YUKON_XL && chipid < CHIP_ID_YUKON_OPT) | 4521 | if (chipid >= CHIP_ID_YUKON_XL && chipid <= CHIP_ID_YUKON_OPT) |
4534 | strncpy(buf, name[chipid - CHIP_ID_YUKON_XL], sz); | 4522 | strncpy(buf, name[chipid - CHIP_ID_YUKON_XL], sz); |
4535 | else | 4523 | else |
4536 | snprintf(buf, sz, "(chip %#x)", chipid); | 4524 | snprintf(buf, sz, "(chip %#x)", chipid); |
@@ -4697,6 +4685,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
4697 | INIT_WORK(&hw->restart_work, sky2_restart); | 4685 | INIT_WORK(&hw->restart_work, sky2_restart); |
4698 | 4686 | ||
4699 | pci_set_drvdata(pdev, hw); | 4687 | pci_set_drvdata(pdev, hw); |
4688 | pdev->d3_delay = 150; | ||
4700 | 4689 | ||
4701 | return 0; | 4690 | return 0; |
4702 | 4691 | ||
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c index 20d6095cf411..494cd91ea39c 100644 --- a/drivers/net/smsc911x.c +++ b/drivers/net/smsc911x.c | |||
@@ -2154,7 +2154,7 @@ static int smsc911x_resume(struct device *dev) | |||
2154 | return (to == 0) ? -EIO : 0; | 2154 | return (to == 0) ? -EIO : 0; |
2155 | } | 2155 | } |
2156 | 2156 | ||
2157 | static struct dev_pm_ops smsc911x_pm_ops = { | 2157 | static const struct dev_pm_ops smsc911x_pm_ops = { |
2158 | .suspend = smsc911x_suspend, | 2158 | .suspend = smsc911x_suspend, |
2159 | .resume = smsc911x_resume, | 2159 | .resume = smsc911x_resume, |
2160 | }; | 2160 | }; |
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..595777dcadb1 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 }, |
@@ -1299,18 +1305,30 @@ static int __devinit tulip_init_one (struct pci_dev *pdev, | |||
1299 | } | 1305 | } |
1300 | 1306 | ||
1301 | /* | 1307 | /* |
1302 | * Early DM9100's need software CRC and the DMFE driver | 1308 | * DM910x chips should be handled by the dmfe driver, except |
1309 | * on-board chips on SPARC systems. Also, early DM9100s need | ||
1310 | * software CRC which only the dmfe driver supports. | ||
1303 | */ | 1311 | */ |
1304 | 1312 | ||
1305 | if (pdev->vendor == 0x1282 && pdev->device == 0x9100) | 1313 | #ifdef CONFIG_TULIP_DM910X |
1306 | { | 1314 | if (chip_idx == DM910X) { |
1307 | /* Read Chip revision */ | 1315 | struct device_node *dp; |
1308 | if (pdev->revision < 0x30) | 1316 | |
1309 | { | 1317 | if (pdev->vendor == 0x1282 && pdev->device == 0x9100 && |
1310 | printk(KERN_ERR PFX "skipping early DM9100 with Crc bug (use dmfe)\n"); | 1318 | pdev->revision < 0x30) { |
1319 | printk(KERN_INFO PFX | ||
1320 | "skipping early DM9100 with Crc bug (use dmfe)\n"); | ||
1321 | return -ENODEV; | ||
1322 | } | ||
1323 | |||
1324 | dp = pci_device_to_OF_node(pdev); | ||
1325 | if (!(dp && of_get_property(dp, "local-mac-address", NULL))) { | ||
1326 | printk(KERN_INFO PFX | ||
1327 | "skipping DM910x expansion card (use dmfe)\n"); | ||
1311 | return -ENODEV; | 1328 | return -ENODEV; |
1312 | } | 1329 | } |
1313 | } | 1330 | } |
1331 | #endif | ||
1314 | 1332 | ||
1315 | /* | 1333 | /* |
1316 | * Looks for early PCI chipsets where people report hangs | 1334 | * 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..96bdc0b43889 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,7 +3279,7 @@ 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 | if (bd == ugeth->txBd[txQ]) /* queue empty? */ |
3277 | break; | 3283 | break; |
3278 | 3284 | ||
3279 | dev->stats.tx_packets++; | 3285 | dev->stats.tx_packets++; |
@@ -3601,6 +3607,7 @@ static int ucc_geth_suspend(struct of_device *ofdev, pm_message_t state) | |||
3601 | if (!netif_running(ndev)) | 3607 | if (!netif_running(ndev)) |
3602 | return 0; | 3608 | return 0; |
3603 | 3609 | ||
3610 | netif_device_detach(ndev); | ||
3604 | napi_disable(&ugeth->napi); | 3611 | napi_disable(&ugeth->napi); |
3605 | 3612 | ||
3606 | /* | 3613 | /* |
@@ -3659,7 +3666,7 @@ static int ucc_geth_resume(struct of_device *ofdev) | |||
3659 | phy_start(ugeth->phydev); | 3666 | phy_start(ugeth->phydev); |
3660 | 3667 | ||
3661 | napi_enable(&ugeth->napi); | 3668 | napi_enable(&ugeth->napi); |
3662 | netif_start_queue(ndev); | 3669 | netif_device_attach(ndev); |
3663 | 3670 | ||
3664 | return 0; | 3671 | return 0; |
3665 | } | 3672 | } |
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/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 b091e20ca167..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; |
@@ -324,7 +324,7 @@ static int rtl8150_set_mac_address(struct net_device *netdev, void *p) | |||
324 | dbg("%02X:", netdev->dev_addr[i]); | 324 | dbg("%02X:", netdev->dev_addr[i]); |
325 | dbg("%02X\n", netdev->dev_addr[i]); | 325 | dbg("%02X\n", netdev->dev_addr[i]); |
326 | /* Set the IDR registers. */ | 326 | /* Set the IDR registers. */ |
327 | set_registers(dev, IDR, sizeof(netdev->dev_addr), netdev->dev_addr); | 327 | set_registers(dev, IDR, netdev->addr_len, netdev->dev_addr); |
328 | #ifdef EEPROM_WRITE | 328 | #ifdef EEPROM_WRITE |
329 | { | 329 | { |
330 | u8 cr; | 330 | u8 cr; |
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..c93f58f5c6f2 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c | |||
@@ -2237,8 +2237,6 @@ static int velocity_open(struct net_device *dev) | |||
2237 | /* Ensure chip is running */ | 2237 | /* Ensure chip is running */ |
2238 | pci_set_power_state(vptr->pdev, PCI_D0); | 2238 | pci_set_power_state(vptr->pdev, PCI_D0); |
2239 | 2239 | ||
2240 | velocity_give_many_rx_descs(vptr); | ||
2241 | |||
2242 | velocity_init_registers(vptr, VELOCITY_INIT_COLD); | 2240 | velocity_init_registers(vptr, VELOCITY_INIT_COLD); |
2243 | 2241 | ||
2244 | ret = request_irq(vptr->pdev->irq, velocity_intr, IRQF_SHARED, | 2242 | ret = request_irq(vptr->pdev->irq, velocity_intr, IRQF_SHARED, |
@@ -2250,6 +2248,8 @@ static int velocity_open(struct net_device *dev) | |||
2250 | goto out; | 2248 | goto out; |
2251 | } | 2249 | } |
2252 | 2250 | ||
2251 | velocity_give_many_rx_descs(vptr); | ||
2252 | |||
2253 | mac_enable_int(vptr->mac_regs); | 2253 | mac_enable_int(vptr->mac_regs); |
2254 | netif_start_queue(dev); | 2254 | netif_start_queue(dev); |
2255 | napi_enable(&vptr->napi); | 2255 | napi_enable(&vptr->napi); |
@@ -2339,10 +2339,10 @@ static int velocity_change_mtu(struct net_device *dev, int new_mtu) | |||
2339 | 2339 | ||
2340 | dev->mtu = new_mtu; | 2340 | dev->mtu = new_mtu; |
2341 | 2341 | ||
2342 | velocity_give_many_rx_descs(vptr); | ||
2343 | |||
2344 | velocity_init_registers(vptr, VELOCITY_INIT_COLD); | 2342 | velocity_init_registers(vptr, VELOCITY_INIT_COLD); |
2345 | 2343 | ||
2344 | velocity_give_many_rx_descs(vptr); | ||
2345 | |||
2346 | mac_enable_int(vptr->mac_regs); | 2346 | mac_enable_int(vptr->mac_regs); |
2347 | netif_start_queue(dev); | 2347 | netif_start_queue(dev); |
2348 | 2348 | ||
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index 1ceb9d0f8b97..9cc438282d77 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c | |||
@@ -2689,7 +2689,7 @@ vmxnet3_resume(struct device *device) | |||
2689 | return 0; | 2689 | return 0; |
2690 | } | 2690 | } |
2691 | 2691 | ||
2692 | static struct dev_pm_ops vmxnet3_pm_ops = { | 2692 | static const struct dev_pm_ops vmxnet3_pm_ops = { |
2693 | .suspend = vmxnet3_suspend, | 2693 | .suspend = vmxnet3_suspend, |
2694 | .resume = vmxnet3_resume, | 2694 | .resume = vmxnet3_resume, |
2695 | }; | 2695 | }; |
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/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/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..996eb90263cc 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,8 +2653,10 @@ 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 | ath_beacon_return(sc, avp); |
2659 | ath9k_ps_restore(sc); | ||
2646 | } | 2660 | } |
2647 | 2661 | ||
2648 | sc->sc_flags &= ~SC_OP_BEACONS; | 2662 | sc->sc_flags &= ~SC_OP_BEACONS; |
@@ -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..fa12b9060b0b 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 | } |
@@ -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; |
@@ -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/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/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..9b4b8b5c7574 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; |
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..33a5866538e7 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 | } |
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..5461f105bd2d 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); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 675b7df632fc..27ca859e7453 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -63,7 +63,7 @@ | |||
63 | #ifndef __iwl_core_h__ | 63 | #ifndef __iwl_core_h__ |
64 | #define __iwl_core_h__ | 64 | #define __iwl_core_h__ |
65 | 65 | ||
66 | #include <linux/utsrelease.h> | 66 | #include <generated/utsrelease.h> |
67 | 67 | ||
68 | /************************ | 68 | /************************ |
69 | * forward declarations * | 69 | * forward declarations * |
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-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..6f36b6e79f5e 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) |
@@ -1105,11 +1060,8 @@ void iwl_rx_reply_rx(struct iwl_priv *priv, | |||
1105 | if (iwl_is_associated(priv) && | 1060 | if (iwl_is_associated(priv) && |
1106 | !test_bit(STATUS_SCANNING, &priv->status)) { | 1061 | !test_bit(STATUS_SCANNING, &priv->status)) { |
1107 | rx_status.noise = priv->last_rx_noise; | 1062 | rx_status.noise = priv->last_rx_noise; |
1108 | rx_status.qual = iwl_calc_sig_qual(rx_status.signal, | ||
1109 | rx_status.noise); | ||
1110 | } else { | 1063 | } else { |
1111 | rx_status.noise = IWL_NOISE_MEAS_NOT_AVAILABLE; | 1064 | rx_status.noise = IWL_NOISE_MEAS_NOT_AVAILABLE; |
1112 | rx_status.qual = iwl_calc_sig_qual(rx_status.signal, 0); | ||
1113 | } | 1065 | } |
1114 | 1066 | ||
1115 | /* Reset beacon noise level if not associated. */ | 1067 | /* Reset beacon noise level if not associated. */ |
@@ -1122,8 +1074,8 @@ void iwl_rx_reply_rx(struct iwl_priv *priv, | |||
1122 | iwl_dbg_report_frame(priv, phy_res, len, header, 1); | 1074 | iwl_dbg_report_frame(priv, phy_res, len, header, 1); |
1123 | #endif | 1075 | #endif |
1124 | iwl_dbg_log_rx_data_frame(priv, len, header); | 1076 | iwl_dbg_log_rx_data_frame(priv, len, header); |
1125 | IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, noise %d, qual %d, TSF %llu\n", | 1077 | IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, noise %d, TSF %llu\n", |
1126 | rx_status.signal, rx_status.noise, rx_status.qual, | 1078 | rx_status.signal, rx_status.noise, |
1127 | (unsigned long long)rx_status.mactime); | 1079 | (unsigned long long)rx_status.mactime); |
1128 | 1080 | ||
1129 | /* | 1081 | /* |
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..cde09a890b73 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 | } |
@@ -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..87ce2bd292c7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c | |||
@@ -407,13 +407,14 @@ void iwl_hw_txq_ctx_free(struct iwl_priv *priv) | |||
407 | int txq_id; | 407 | int txq_id; |
408 | 408 | ||
409 | /* Tx queues */ | 409 | /* Tx queues */ |
410 | if (priv->txq) | 410 | if (priv->txq) { |
411 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; | 411 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; |
412 | txq_id++) | 412 | txq_id++) |
413 | if (txq_id == IWL_CMD_QUEUE_NUM) | 413 | if (txq_id == IWL_CMD_QUEUE_NUM) |
414 | iwl_cmd_queue_free(priv); | 414 | iwl_cmd_queue_free(priv); |
415 | else | 415 | else |
416 | iwl_tx_queue_free(priv, txq_id); | 416 | iwl_tx_queue_free(priv, txq_id); |
417 | } | ||
417 | iwl_free_dma_ptr(priv, &priv->kw); | 418 | iwl_free_dma_ptr(priv, &priv->kw); |
418 | 419 | ||
419 | iwl_free_dma_ptr(priv, &priv->scd_bc_tbls); | 420 | iwl_free_dma_ptr(priv, &priv->scd_bc_tbls); |
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/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..6d6ed7485175 100644 --- a/drivers/net/wireless/iwmc3200wifi/rx.c +++ b/drivers/net/wireless/iwmc3200wifi/rx.c | |||
@@ -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/cmd.c b/drivers/net/wireless/libertas/cmd.c index b9b371bfa30f..42611bea76a3 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -1365,7 +1365,7 @@ static void lbs_send_confirmsleep(struct lbs_private *priv) | |||
1365 | priv->dnld_sent = DNLD_RES_RECEIVED; | 1365 | priv->dnld_sent = DNLD_RES_RECEIVED; |
1366 | 1366 | ||
1367 | /* If nothing to do, go back to sleep (?) */ | 1367 | /* If nothing to do, go back to sleep (?) */ |
1368 | if (!__kfifo_len(priv->event_fifo) && !priv->resp_len[priv->resp_idx]) | 1368 | if (!kfifo_len(&priv->event_fifo) && !priv->resp_len[priv->resp_idx]) |
1369 | priv->psstate = PS_STATE_SLEEP; | 1369 | priv->psstate = PS_STATE_SLEEP; |
1370 | 1370 | ||
1371 | spin_unlock_irqrestore(&priv->driver_lock, flags); | 1371 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
@@ -1439,7 +1439,7 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv) | |||
1439 | } | 1439 | } |
1440 | 1440 | ||
1441 | /* Pending events or command responses? */ | 1441 | /* Pending events or command responses? */ |
1442 | if (__kfifo_len(priv->event_fifo) || priv->resp_len[priv->resp_idx]) { | 1442 | if (kfifo_len(&priv->event_fifo) || priv->resp_len[priv->resp_idx]) { |
1443 | allowed = 0; | 1443 | allowed = 0; |
1444 | lbs_deb_host("pending events or command responses\n"); | 1444 | lbs_deb_host("pending events or command responses\n"); |
1445 | } | 1445 | } |
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 6a8d2b291d8c..05bb298dfae9 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h | |||
@@ -10,7 +10,7 @@ | |||
10 | #include "scan.h" | 10 | #include "scan.h" |
11 | #include "assoc.h" | 11 | #include "assoc.h" |
12 | 12 | ||
13 | 13 | #include <linux/kfifo.h> | |
14 | 14 | ||
15 | /** sleep_params */ | 15 | /** sleep_params */ |
16 | struct sleep_params { | 16 | struct sleep_params { |
@@ -120,7 +120,7 @@ struct lbs_private { | |||
120 | u32 resp_len[2]; | 120 | u32 resp_len[2]; |
121 | 121 | ||
122 | /* Events sent from hardware to driver */ | 122 | /* Events sent from hardware to driver */ |
123 | struct kfifo *event_fifo; | 123 | struct kfifo event_fifo; |
124 | 124 | ||
125 | /** thread to service interrupts */ | 125 | /** thread to service interrupts */ |
126 | struct task_struct *main_thread; | 126 | struct task_struct *main_thread; |
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index db38a5a719fa..c2975c8e2f21 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c | |||
@@ -459,7 +459,7 @@ static int lbs_thread(void *data) | |||
459 | else if (!list_empty(&priv->cmdpendingq) && | 459 | else if (!list_empty(&priv->cmdpendingq) && |
460 | !(priv->wakeup_dev_required)) | 460 | !(priv->wakeup_dev_required)) |
461 | shouldsleep = 0; /* We have a command to send */ | 461 | shouldsleep = 0; /* We have a command to send */ |
462 | else if (__kfifo_len(priv->event_fifo)) | 462 | else if (kfifo_len(&priv->event_fifo)) |
463 | shouldsleep = 0; /* We have an event to process */ | 463 | shouldsleep = 0; /* We have an event to process */ |
464 | else | 464 | else |
465 | shouldsleep = 1; /* No command */ | 465 | shouldsleep = 1; /* No command */ |
@@ -511,10 +511,13 @@ static int lbs_thread(void *data) | |||
511 | 511 | ||
512 | /* Process hardware events, e.g. card removed, link lost */ | 512 | /* Process hardware events, e.g. card removed, link lost */ |
513 | spin_lock_irq(&priv->driver_lock); | 513 | spin_lock_irq(&priv->driver_lock); |
514 | while (__kfifo_len(priv->event_fifo)) { | 514 | while (kfifo_len(&priv->event_fifo)) { |
515 | u32 event; | 515 | u32 event; |
516 | __kfifo_get(priv->event_fifo, (unsigned char *) &event, | 516 | |
517 | sizeof(event)); | 517 | if (kfifo_out(&priv->event_fifo, |
518 | (unsigned char *) &event, sizeof(event)) != | ||
519 | sizeof(event)) | ||
520 | break; | ||
518 | spin_unlock_irq(&priv->driver_lock); | 521 | spin_unlock_irq(&priv->driver_lock); |
519 | lbs_process_event(priv, event); | 522 | lbs_process_event(priv, event); |
520 | spin_lock_irq(&priv->driver_lock); | 523 | spin_lock_irq(&priv->driver_lock); |
@@ -883,10 +886,9 @@ static int lbs_init_adapter(struct lbs_private *priv) | |||
883 | priv->resp_len[0] = priv->resp_len[1] = 0; | 886 | priv->resp_len[0] = priv->resp_len[1] = 0; |
884 | 887 | ||
885 | /* Create the event FIFO */ | 888 | /* Create the event FIFO */ |
886 | priv->event_fifo = kfifo_alloc(sizeof(u32) * 16, GFP_KERNEL, NULL); | 889 | ret = kfifo_alloc(&priv->event_fifo, sizeof(u32) * 16, GFP_KERNEL); |
887 | if (IS_ERR(priv->event_fifo)) { | 890 | if (ret) { |
888 | lbs_pr_err("Out of memory allocating event FIFO buffer\n"); | 891 | lbs_pr_err("Out of memory allocating event FIFO buffer\n"); |
889 | ret = -ENOMEM; | ||
890 | goto out; | 892 | goto out; |
891 | } | 893 | } |
892 | 894 | ||
@@ -901,8 +903,7 @@ static void lbs_free_adapter(struct lbs_private *priv) | |||
901 | lbs_deb_enter(LBS_DEB_MAIN); | 903 | lbs_deb_enter(LBS_DEB_MAIN); |
902 | 904 | ||
903 | lbs_free_cmd_buffer(priv); | 905 | lbs_free_cmd_buffer(priv); |
904 | if (priv->event_fifo) | 906 | kfifo_free(&priv->event_fifo); |
905 | kfifo_free(priv->event_fifo); | ||
906 | del_timer(&priv->command_timer); | 907 | del_timer(&priv->command_timer); |
907 | del_timer(&priv->auto_deepsleep_timer); | 908 | del_timer(&priv->auto_deepsleep_timer); |
908 | kfree(priv->networks); | 909 | kfree(priv->networks); |
@@ -1177,7 +1178,7 @@ void lbs_queue_event(struct lbs_private *priv, u32 event) | |||
1177 | if (priv->psstate == PS_STATE_SLEEP) | 1178 | if (priv->psstate == PS_STATE_SLEEP) |
1178 | priv->psstate = PS_STATE_AWAKE; | 1179 | priv->psstate = PS_STATE_AWAKE; |
1179 | 1180 | ||
1180 | __kfifo_put(priv->event_fifo, (unsigned char *) &event, sizeof(u32)); | 1181 | kfifo_in(&priv->event_fifo, (unsigned char *) &event, sizeof(u32)); |
1181 | 1182 | ||
1182 | wake_up_interruptible(&priv->waitq); | 1183 | wake_up_interruptible(&priv->waitq); |
1183 | 1184 | ||
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/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/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 | ||