Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6

Conflicts:
drivers/net/e1000/e1000_main.c

+512 -424
+6 -19
Documentation/networking/alias.txt
··· 2 2 IP-Aliasing: 3 3 ============ 4 4 5 - IP-aliases are additional IP-addresses/masks hooked up to a base 6 - interface by adding a colon and a string when running ifconfig. 5 + IP-aliases are an obsolete way to manage multiple IP-addresses/masks 6 + per interface. Newer tools such as iproute2 support multiple 7 + address/prefixes per interface, but aliases are still supported 8 + for backwards compatibility. 9 + 10 + An alias is formed by adding a colon and a string when running ifconfig. 7 11 This string is usually numeric, but this is not a must. 8 - 9 - IP-Aliases are avail if CONFIG_INET (`standard' IPv4 networking) 10 - is configured in the kernel. 11 - 12 12 13 13 o Alias creation. 14 14 Alias creation is done by 'magic' interface naming: eg. to create a ··· 38 38 39 39 If the base device is shut down the added aliases will be deleted 40 40 too. 41 - 42 - 43 - Contact 44 - ------- 45 - Please finger or e-mail me: 46 - Juan Jose Ciarlante <jjciarla@raiz.uncu.edu.ar> 47 - 48 - Updated by Erik Schoenfelder <schoenfr@gaertner.DE> 49 - 50 - ; local variables: 51 - ; mode: indented-text 52 - ; mode: auto-fill 53 - ; end:
-2
MAINTAINERS
··· 2836 2836 MAC80211 2837 2837 P: Johannes Berg 2838 2838 M: johannes@sipsolutions.net 2839 - P: Michael Wu 2840 - M: flamingice@sourmilk.net 2841 2839 L: linux-wireless@vger.kernel.org 2842 2840 W: http://linuxwireless.org/ 2843 2841 T: git kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6.git
+2 -2
drivers/net/e1000/e1000_main.c
··· 31 31 32 32 char e1000_driver_name[] = "e1000"; 33 33 static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; 34 - #define DRV_VERSION "7.3.21-k2-NAPI" 34 + #define DRV_VERSION "7.3.21-k3-NAPI" 35 35 const char e1000_driver_version[] = DRV_VERSION; 36 36 static const char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; 37 37 ··· 3697 3697 struct e1000_hw *hw = &adapter->hw; 3698 3698 u32 rctl, icr = er32(ICR); 3699 3699 3700 - if (unlikely(!icr)) 3700 + if (unlikely((!icr) || test_bit(__E1000_RESETTING, &adapter->flags))) 3701 3701 return IRQ_NONE; /* Not our interrupt */ 3702 3702 3703 3703 /* IMS will not auto-mask if INT_ASSERTED is not set, and if it is
+2
drivers/net/gianfar_mii.c
··· 234 234 if (NULL == new_bus) 235 235 return -ENOMEM; 236 236 237 + device_init_wakeup(&ofdev->dev, 1); 238 + 237 239 new_bus->name = "Gianfar MII Bus", 238 240 new_bus->read = &gfar_mdio_read, 239 241 new_bus->write = &gfar_mdio_write,
+1 -1
drivers/net/netxen/netxen_nic.h
··· 210 210 #define MAX_CMD_DESCRIPTORS_HOST 1024 211 211 #define MAX_RCV_DESCRIPTORS_1G 2048 212 212 #define MAX_RCV_DESCRIPTORS_10G 4096 213 - #define MAX_JUMBO_RCV_DESCRIPTORS 512 213 + #define MAX_JUMBO_RCV_DESCRIPTORS 1024 214 214 #define MAX_LRO_RCV_DESCRIPTORS 8 215 215 #define MAX_RCVSTATUS_DESCRIPTORS MAX_RCV_DESCRIPTORS 216 216 #define MAX_JUMBO_RCV_DESC MAX_JUMBO_RCV_DESCRIPTORS
+3 -1
drivers/net/netxen/netxen_nic_init.c
··· 947 947 } 948 948 for (i = 0; i < n; i++) { 949 949 if (netxen_rom_fast_read(adapter, 8*i + 4*offset, &val) != 0 || 950 - netxen_rom_fast_read(adapter, 8*i + 4*offset + 4, &addr) != 0) 950 + netxen_rom_fast_read(adapter, 8*i + 4*offset + 4, &addr) != 0) { 951 + kfree(buf); 951 952 return -EIO; 953 + } 952 954 953 955 buf[i].addr = addr; 954 956 buf[i].data = val;
-1
drivers/net/r6040.c
··· 438 438 { 439 439 struct r6040_private *lp = netdev_priv(dev); 440 440 void __iomem *ioaddr = lp->base; 441 - struct pci_dev *pdev = lp->pdev; 442 441 int limit = 2048; 443 442 u16 *adrp; 444 443 u16 cmd;
+41 -18
drivers/net/sfc/efx.c
··· 675 675 rc = efx->phy_op->init(efx); 676 676 if (rc) 677 677 return rc; 678 - efx->phy_op->reconfigure(efx); 679 - 680 678 mutex_lock(&efx->mac_lock); 679 + efx->phy_op->reconfigure(efx); 681 680 rc = falcon_switch_mac(efx); 682 681 mutex_unlock(&efx->mac_lock); 683 682 if (rc) ··· 684 685 efx->mac_op->reconfigure(efx); 685 686 686 687 efx->port_initialized = true; 687 - efx->stats_enabled = true; 688 + efx_stats_enable(efx); 688 689 return 0; 689 690 690 691 fail: ··· 733 734 if (!efx->port_initialized) 734 735 return; 735 736 737 + efx_stats_disable(efx); 736 738 efx->phy_op->fini(efx); 737 739 efx->port_initialized = false; 738 740 ··· 1352 1352 return 0; 1353 1353 } 1354 1354 1355 + void efx_stats_disable(struct efx_nic *efx) 1356 + { 1357 + spin_lock(&efx->stats_lock); 1358 + ++efx->stats_disable_count; 1359 + spin_unlock(&efx->stats_lock); 1360 + } 1361 + 1362 + void efx_stats_enable(struct efx_nic *efx) 1363 + { 1364 + spin_lock(&efx->stats_lock); 1365 + --efx->stats_disable_count; 1366 + spin_unlock(&efx->stats_lock); 1367 + } 1368 + 1355 1369 /* Context: process, dev_base_lock or RTNL held, non-blocking. */ 1356 1370 static struct net_device_stats *efx_net_stats(struct net_device *net_dev) 1357 1371 { ··· 1374 1360 struct net_device_stats *stats = &net_dev->stats; 1375 1361 1376 1362 /* Update stats if possible, but do not wait if another thread 1377 - * is updating them (or resetting the NIC); slightly stale 1378 - * stats are acceptable. 1363 + * is updating them or if MAC stats fetches are temporarily 1364 + * disabled; slightly stale stats are acceptable. 1379 1365 */ 1380 1366 if (!spin_trylock(&efx->stats_lock)) 1381 1367 return stats; 1382 - if (efx->stats_enabled) { 1368 + if (!efx->stats_disable_count) { 1383 1369 efx->mac_op->update_stats(efx); 1384 1370 falcon_update_nic_stats(efx); 1385 1371 } ··· 1627 1613 1628 1614 /* Tears down the entire software state and most of the hardware state 1629 1615 * before reset. */ 1630 - void efx_reset_down(struct efx_nic *efx, struct ethtool_cmd *ecmd) 1616 + void efx_reset_down(struct efx_nic *efx, enum reset_type method, 1617 + struct ethtool_cmd *ecmd) 1631 1618 { 1632 1619 EFX_ASSERT_RESET_SERIALISED(efx); 1633 1620 1634 - /* The net_dev->get_stats handler is quite slow, and will fail 1635 - * if a fetch is pending over reset. Serialise against it. */ 1636 - spin_lock(&efx->stats_lock); 1637 - efx->stats_enabled = false; 1638 - spin_unlock(&efx->stats_lock); 1639 - 1621 + efx_stats_disable(efx); 1640 1622 efx_stop_all(efx); 1641 1623 mutex_lock(&efx->mac_lock); 1642 1624 mutex_lock(&efx->spi_lock); ··· 1640 1630 efx->phy_op->get_settings(efx, ecmd); 1641 1631 1642 1632 efx_fini_channels(efx); 1633 + if (efx->port_initialized && method != RESET_TYPE_INVISIBLE) 1634 + efx->phy_op->fini(efx); 1643 1635 } 1644 1636 1645 1637 /* This function will always ensure that the locks acquired in ··· 1649 1637 * that we were unable to reinitialise the hardware, and the 1650 1638 * driver should be disabled. If ok is false, then the rx and tx 1651 1639 * engines are not restarted, pending a RESET_DISABLE. */ 1652 - int efx_reset_up(struct efx_nic *efx, struct ethtool_cmd *ecmd, bool ok) 1640 + int efx_reset_up(struct efx_nic *efx, enum reset_type method, 1641 + struct ethtool_cmd *ecmd, bool ok) 1653 1642 { 1654 1643 int rc; 1655 1644 ··· 1660 1647 if (rc) { 1661 1648 EFX_ERR(efx, "failed to initialise NIC\n"); 1662 1649 ok = false; 1650 + } 1651 + 1652 + if (efx->port_initialized && method != RESET_TYPE_INVISIBLE) { 1653 + if (ok) { 1654 + rc = efx->phy_op->init(efx); 1655 + if (rc) 1656 + ok = false; 1657 + } else 1658 + efx->port_initialized = false; 1663 1659 } 1664 1660 1665 1661 if (ok) { ··· 1683 1661 1684 1662 if (ok) { 1685 1663 efx_start_all(efx); 1686 - efx->stats_enabled = true; 1664 + efx_stats_enable(efx); 1687 1665 } 1688 1666 return rc; 1689 1667 } ··· 1715 1693 1716 1694 EFX_INFO(efx, "resetting (%d)\n", method); 1717 1695 1718 - efx_reset_down(efx, &ecmd); 1696 + efx_reset_down(efx, method, &ecmd); 1719 1697 1720 1698 rc = falcon_reset_hw(efx, method); 1721 1699 if (rc) { ··· 1734 1712 1735 1713 /* Leave device stopped if necessary */ 1736 1714 if (method == RESET_TYPE_DISABLE) { 1737 - efx_reset_up(efx, &ecmd, false); 1715 + efx_reset_up(efx, method, &ecmd, false); 1738 1716 rc = -EIO; 1739 1717 } else { 1740 - rc = efx_reset_up(efx, &ecmd, true); 1718 + rc = efx_reset_up(efx, method, &ecmd, true); 1741 1719 } 1742 1720 1743 1721 out_disable: ··· 1889 1867 efx->rx_checksum_enabled = true; 1890 1868 spin_lock_init(&efx->netif_stop_lock); 1891 1869 spin_lock_init(&efx->stats_lock); 1870 + efx->stats_disable_count = 1; 1892 1871 mutex_init(&efx->mac_lock); 1893 1872 efx->mac_op = &efx_dummy_mac_operations; 1894 1873 efx->phy_op = &efx_dummy_phy_operations;
+6 -3
drivers/net/sfc/efx.h
··· 36 36 extern void efx_flush_queues(struct efx_nic *efx); 37 37 38 38 /* Ports */ 39 + extern void efx_stats_disable(struct efx_nic *efx); 40 + extern void efx_stats_enable(struct efx_nic *efx); 39 41 extern void efx_reconfigure_port(struct efx_nic *efx); 40 42 extern void __efx_reconfigure_port(struct efx_nic *efx); 41 43 42 44 /* Reset handling */ 43 - extern void efx_reset_down(struct efx_nic *efx, struct ethtool_cmd *ecmd); 44 - extern int efx_reset_up(struct efx_nic *efx, struct ethtool_cmd *ecmd, 45 - bool ok); 45 + extern void efx_reset_down(struct efx_nic *efx, enum reset_type method, 46 + struct ethtool_cmd *ecmd); 47 + extern int efx_reset_up(struct efx_nic *efx, enum reset_type method, 48 + struct ethtool_cmd *ecmd, bool ok); 46 49 47 50 /* Global */ 48 51 extern void efx_schedule_reset(struct efx_nic *efx, enum reset_type type);
-3
drivers/net/sfc/ethtool.c
··· 219 219 struct efx_nic *efx = netdev_priv(net_dev); 220 220 int rc; 221 221 222 - if (EFX_WORKAROUND_13963(efx) && !ecmd->autoneg) 223 - return -EINVAL; 224 - 225 222 /* Falcon GMAC does not support 1000Mbps HD */ 226 223 if (ecmd->speed == SPEED_1000 && ecmd->duplex != DUPLEX_FULL) { 227 224 EFX_LOG(efx, "rejecting unsupported 1000Mbps HD"
+18 -14
drivers/net/sfc/falcon.c
··· 824 824 rx_ev_pause_frm ? " [PAUSE]" : ""); 825 825 } 826 826 #endif 827 - 828 - if (unlikely(rx_ev_eth_crc_err && EFX_WORKAROUND_10750(efx) && 829 - efx->phy_type == PHY_TYPE_SFX7101)) 830 - tenxpress_crc_err(efx); 831 827 } 832 828 833 829 /* Handle receive events that are not in-order. */ ··· 1883 1887 1884 1888 /* MAC stats will fail whilst the TX fifo is draining. Serialise 1885 1889 * the drain sequence with the statistics fetch */ 1886 - spin_lock(&efx->stats_lock); 1890 + efx_stats_disable(efx); 1887 1891 1888 1892 falcon_read(efx, &reg, MAC0_CTRL_REG_KER); 1889 1893 EFX_SET_OWORD_FIELD(reg, TXFIFO_DRAIN_EN_B0, 1); ··· 1913 1917 udelay(10); 1914 1918 } 1915 1919 1916 - spin_unlock(&efx->stats_lock); 1920 + efx_stats_enable(efx); 1917 1921 1918 1922 /* If we've reset the EM block and the link is up, then 1919 1923 * we'll have to kick the XAUI link so the PHY can recover */ ··· 2273 2277 struct efx_mac_operations *old_mac_op = efx->mac_op; 2274 2278 efx_oword_t nic_stat; 2275 2279 unsigned strap_val; 2280 + int rc = 0; 2281 + 2282 + /* Don't try to fetch MAC stats while we're switching MACs */ 2283 + efx_stats_disable(efx); 2276 2284 2277 2285 /* Internal loopbacks override the phy speed setting */ 2278 2286 if (efx->loopback_mode == LOOPBACK_GMAC) { ··· 2287 2287 efx->link_fd = true; 2288 2288 } 2289 2289 2290 + WARN_ON(!mutex_is_locked(&efx->mac_lock)); 2290 2291 efx->mac_op = (EFX_IS10G(efx) ? 2291 2292 &falcon_xmac_operations : &falcon_gmac_operations); 2292 - if (old_mac_op == efx->mac_op) 2293 - return 0; 2294 2293 2295 - WARN_ON(!mutex_is_locked(&efx->mac_lock)); 2296 - 2297 - /* Not all macs support a mac-level link state */ 2298 - efx->mac_up = true; 2299 - 2294 + /* Always push the NIC_STAT_REG setting even if the mac hasn't 2295 + * changed, because this function is run post online reset */ 2300 2296 falcon_read(efx, &nic_stat, NIC_STAT_REG); 2301 2297 strap_val = EFX_IS10G(efx) ? 5 : 3; 2302 2298 if (falcon_rev(efx) >= FALCON_REV_B0) { ··· 2305 2309 BUG_ON(EFX_OWORD_FIELD(nic_stat, STRAP_PINS) != strap_val); 2306 2310 } 2307 2311 2312 + if (old_mac_op == efx->mac_op) 2313 + goto out; 2308 2314 2309 2315 EFX_LOG(efx, "selected %cMAC\n", EFX_IS10G(efx) ? 'X' : 'G'); 2310 - return falcon_reset_macs(efx); 2316 + /* Not all macs support a mac-level link state */ 2317 + efx->mac_up = true; 2318 + 2319 + rc = falcon_reset_macs(efx); 2320 + out: 2321 + efx_stats_enable(efx); 2322 + return rc; 2311 2323 } 2312 2324 2313 2325 /* This call is responsible for hooking in the MAC and PHY operations */
+87 -100
drivers/net/sfc/mdio_10g.c
··· 15 15 #include "net_driver.h" 16 16 #include "mdio_10g.h" 17 17 #include "boards.h" 18 + #include "workarounds.h" 18 19 19 20 int mdio_clause45_reset_mmd(struct efx_nic *port, int mmd, 20 21 int spins, int spintime) ··· 180 179 return false; 181 180 else if (efx_phy_mode_disabled(efx->phy_mode)) 182 181 return false; 183 - else if (efx->loopback_mode == LOOPBACK_PHYXS) { 182 + else if (efx->loopback_mode == LOOPBACK_PHYXS) 184 183 mmd_mask &= ~(MDIO_MMDREG_DEVS_PHYXS | 185 184 MDIO_MMDREG_DEVS_PCS | 186 185 MDIO_MMDREG_DEVS_PMAPMD | 187 186 MDIO_MMDREG_DEVS_AN); 188 - if (!mmd_mask) { 189 - reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_PHYXS, 190 - MDIO_PHYXS_STATUS2); 191 - return !(reg & (1 << MDIO_PHYXS_STATUS2_RX_FAULT_LBN)); 192 - } 193 - } else if (efx->loopback_mode == LOOPBACK_PCS) 187 + else if (efx->loopback_mode == LOOPBACK_PCS) 194 188 mmd_mask &= ~(MDIO_MMDREG_DEVS_PCS | 195 189 MDIO_MMDREG_DEVS_PMAPMD | 196 190 MDIO_MMDREG_DEVS_AN); 197 191 else if (efx->loopback_mode == LOOPBACK_PMAPMD) 198 192 mmd_mask &= ~(MDIO_MMDREG_DEVS_PMAPMD | 199 193 MDIO_MMDREG_DEVS_AN); 194 + 195 + if (!mmd_mask) { 196 + /* Use presence of XGMII faults in leui of link state */ 197 + reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_PHYXS, 198 + MDIO_PHYXS_STATUS2); 199 + return !(reg & (1 << MDIO_PHYXS_STATUS2_RX_FAULT_LBN)); 200 + } 200 201 201 202 while (mmd_mask) { 202 203 if (mmd_mask & 1) { ··· 266 263 } 267 264 } 268 265 269 - static u32 mdio_clause45_get_an(struct efx_nic *efx, u16 addr, u32 xnp) 266 + static u32 mdio_clause45_get_an(struct efx_nic *efx, u16 addr) 270 267 { 271 268 int phy_id = efx->mii.phy_id; 272 269 u32 result = 0; ··· 281 278 result |= ADVERTISED_100baseT_Half; 282 279 if (reg & ADVERTISE_100FULL) 283 280 result |= ADVERTISED_100baseT_Full; 284 - if (reg & LPA_RESV) 285 - result |= xnp; 286 - 287 281 return result; 288 282 } 289 283 ··· 310 310 */ 311 311 void mdio_clause45_get_settings_ext(struct efx_nic *efx, 312 312 struct ethtool_cmd *ecmd, 313 - u32 xnp, u32 xnp_lpa) 313 + u32 npage_adv, u32 npage_lpa) 314 314 { 315 315 int phy_id = efx->mii.phy_id; 316 316 int reg; ··· 361 361 ecmd->autoneg = AUTONEG_ENABLE; 362 362 ecmd->advertising |= 363 363 ADVERTISED_Autoneg | 364 - mdio_clause45_get_an(efx, 365 - MDIO_AN_ADVERTISE, xnp); 364 + mdio_clause45_get_an(efx, MDIO_AN_ADVERTISE) | 365 + npage_adv; 366 366 } else 367 367 ecmd->autoneg = AUTONEG_DISABLE; 368 368 } else ··· 371 371 if (ecmd->autoneg) { 372 372 /* If AN is complete, report best common mode, 373 373 * otherwise report best advertised mode. */ 374 - u32 common = ecmd->advertising; 374 + u32 modes = 0; 375 375 if (mdio_clause45_read(efx, phy_id, MDIO_MMD_AN, 376 376 MDIO_MMDREG_STAT1) & 377 - (1 << MDIO_AN_STATUS_AN_DONE_LBN)) { 378 - common &= mdio_clause45_get_an(efx, MDIO_AN_LPA, 379 - xnp_lpa); 380 - } 381 - if (common & ADVERTISED_10000baseT_Full) { 377 + (1 << MDIO_AN_STATUS_AN_DONE_LBN)) 378 + modes = (ecmd->advertising & 379 + (mdio_clause45_get_an(efx, MDIO_AN_LPA) | 380 + npage_lpa)); 381 + if (modes == 0) 382 + modes = ecmd->advertising; 383 + 384 + if (modes & ADVERTISED_10000baseT_Full) { 382 385 ecmd->speed = SPEED_10000; 383 386 ecmd->duplex = DUPLEX_FULL; 384 - } else if (common & (ADVERTISED_1000baseT_Full | 385 - ADVERTISED_1000baseT_Half)) { 387 + } else if (modes & (ADVERTISED_1000baseT_Full | 388 + ADVERTISED_1000baseT_Half)) { 386 389 ecmd->speed = SPEED_1000; 387 - ecmd->duplex = !!(common & ADVERTISED_1000baseT_Full); 388 - } else if (common & (ADVERTISED_100baseT_Full | 389 - ADVERTISED_100baseT_Half)) { 390 + ecmd->duplex = !!(modes & ADVERTISED_1000baseT_Full); 391 + } else if (modes & (ADVERTISED_100baseT_Full | 392 + ADVERTISED_100baseT_Half)) { 390 393 ecmd->speed = SPEED_100; 391 - ecmd->duplex = !!(common & ADVERTISED_100baseT_Full); 394 + ecmd->duplex = !!(modes & ADVERTISED_100baseT_Full); 392 395 } else { 393 396 ecmd->speed = SPEED_10; 394 - ecmd->duplex = !!(common & ADVERTISED_10baseT_Full); 397 + ecmd->duplex = !!(modes & ADVERTISED_10baseT_Full); 395 398 } 396 399 } else { 397 400 /* Report forced settings */ ··· 418 415 int phy_id = efx->mii.phy_id; 419 416 struct ethtool_cmd prev; 420 417 u32 required; 421 - int ctrl1_bits, reg; 418 + int reg; 422 419 423 420 efx->phy_op->get_settings(efx, &prev); 424 421 ··· 433 430 if (prev.port != PORT_TP || ecmd->port != PORT_TP) 434 431 return -EINVAL; 435 432 436 - /* Check that PHY supports these settings and work out the 437 - * basic control bits */ 438 - if (ecmd->duplex) { 433 + /* Check that PHY supports these settings */ 434 + if (ecmd->autoneg) { 435 + required = SUPPORTED_Autoneg; 436 + } else if (ecmd->duplex) { 439 437 switch (ecmd->speed) { 440 - case SPEED_10: 441 - ctrl1_bits = BMCR_FULLDPLX; 442 - required = SUPPORTED_10baseT_Full; 443 - break; 444 - case SPEED_100: 445 - ctrl1_bits = BMCR_SPEED100 | BMCR_FULLDPLX; 446 - required = SUPPORTED_100baseT_Full; 447 - break; 448 - case SPEED_1000: 449 - ctrl1_bits = BMCR_SPEED1000 | BMCR_FULLDPLX; 450 - required = SUPPORTED_1000baseT_Full; 451 - break; 452 - case SPEED_10000: 453 - ctrl1_bits = (BMCR_SPEED1000 | BMCR_SPEED100 | 454 - BMCR_FULLDPLX); 455 - required = SUPPORTED_10000baseT_Full; 456 - break; 457 - default: 458 - return -EINVAL; 438 + case SPEED_10: required = SUPPORTED_10baseT_Full; break; 439 + case SPEED_100: required = SUPPORTED_100baseT_Full; break; 440 + default: return -EINVAL; 459 441 } 460 442 } else { 461 443 switch (ecmd->speed) { 462 - case SPEED_10: 463 - ctrl1_bits = 0; 464 - required = SUPPORTED_10baseT_Half; 465 - break; 466 - case SPEED_100: 467 - ctrl1_bits = BMCR_SPEED100; 468 - required = SUPPORTED_100baseT_Half; 469 - break; 470 - case SPEED_1000: 471 - ctrl1_bits = BMCR_SPEED1000; 472 - required = SUPPORTED_1000baseT_Half; 473 - break; 474 - default: 475 - return -EINVAL; 444 + case SPEED_10: required = SUPPORTED_10baseT_Half; break; 445 + case SPEED_100: required = SUPPORTED_100baseT_Half; break; 446 + default: return -EINVAL; 476 447 } 477 448 } 478 - if (ecmd->autoneg) 479 - required |= SUPPORTED_Autoneg; 480 449 required |= ecmd->advertising; 481 450 if (required & ~prev.supported) 482 451 return -EINVAL; 483 452 484 - /* Set the basic control bits */ 485 - reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_PMAPMD, 486 - MDIO_MMDREG_CTRL1); 487 - reg &= ~(BMCR_SPEED1000 | BMCR_SPEED100 | BMCR_FULLDPLX | 0x003c); 488 - reg |= ctrl1_bits; 489 - mdio_clause45_write(efx, phy_id, MDIO_MMD_PMAPMD, MDIO_MMDREG_CTRL1, 490 - reg); 453 + if (ecmd->autoneg) { 454 + bool xnp = (ecmd->advertising & ADVERTISED_10000baseT_Full 455 + || EFX_WORKAROUND_13204(efx)); 491 456 492 - /* Set the AN registers */ 493 - if (ecmd->autoneg != prev.autoneg || 494 - ecmd->advertising != prev.advertising) { 495 - bool xnp = false; 457 + /* Set up the base page */ 458 + reg = ADVERTISE_CSMA; 459 + if (ecmd->advertising & ADVERTISED_10baseT_Half) 460 + reg |= ADVERTISE_10HALF; 461 + if (ecmd->advertising & ADVERTISED_10baseT_Full) 462 + reg |= ADVERTISE_10FULL; 463 + if (ecmd->advertising & ADVERTISED_100baseT_Half) 464 + reg |= ADVERTISE_100HALF; 465 + if (ecmd->advertising & ADVERTISED_100baseT_Full) 466 + reg |= ADVERTISE_100FULL; 467 + if (xnp) 468 + reg |= ADVERTISE_RESV; 469 + else if (ecmd->advertising & (ADVERTISED_1000baseT_Half | 470 + ADVERTISED_1000baseT_Full)) 471 + reg |= ADVERTISE_NPAGE; 472 + reg |= efx_fc_advertise(efx->wanted_fc); 473 + mdio_clause45_write(efx, phy_id, MDIO_MMD_AN, 474 + MDIO_AN_ADVERTISE, reg); 496 475 497 - if (efx->phy_op->set_xnp_advertise) 498 - xnp = efx->phy_op->set_xnp_advertise(efx, 499 - ecmd->advertising); 476 + /* Set up the (extended) next page if necessary */ 477 + if (efx->phy_op->set_npage_adv) 478 + efx->phy_op->set_npage_adv(efx, ecmd->advertising); 500 479 501 - if (ecmd->autoneg) { 502 - reg = 0; 503 - if (ecmd->advertising & ADVERTISED_10baseT_Half) 504 - reg |= ADVERTISE_10HALF; 505 - if (ecmd->advertising & ADVERTISED_10baseT_Full) 506 - reg |= ADVERTISE_10FULL; 507 - if (ecmd->advertising & ADVERTISED_100baseT_Half) 508 - reg |= ADVERTISE_100HALF; 509 - if (ecmd->advertising & ADVERTISED_100baseT_Full) 510 - reg |= ADVERTISE_100FULL; 511 - if (xnp) 512 - reg |= ADVERTISE_RESV; 513 - mdio_clause45_write(efx, phy_id, MDIO_MMD_AN, 514 - MDIO_AN_ADVERTISE, reg); 515 - } 516 - 480 + /* Enable and restart AN */ 517 481 reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_AN, 518 482 MDIO_MMDREG_CTRL1); 519 - if (ecmd->autoneg) 520 - reg |= BMCR_ANENABLE | BMCR_ANRESTART; 521 - else 522 - reg &= ~BMCR_ANENABLE; 483 + reg |= BMCR_ANENABLE; 484 + if (!(EFX_WORKAROUND_15195(efx) && 485 + LOOPBACK_MASK(efx) & efx->phy_op->loopbacks)) 486 + reg |= BMCR_ANRESTART; 523 487 if (xnp) 524 488 reg |= 1 << MDIO_AN_CTRL_XNP_LBN; 525 489 else 526 490 reg &= ~(1 << MDIO_AN_CTRL_XNP_LBN); 527 491 mdio_clause45_write(efx, phy_id, MDIO_MMD_AN, 492 + MDIO_MMDREG_CTRL1, reg); 493 + } else { 494 + /* Disable AN */ 495 + mdio_clause45_set_flag(efx, phy_id, MDIO_MMD_AN, 496 + MDIO_MMDREG_CTRL1, 497 + __ffs(BMCR_ANENABLE), false); 498 + 499 + /* Set the basic control bits */ 500 + reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_PMAPMD, 501 + MDIO_MMDREG_CTRL1); 502 + reg &= ~(BMCR_SPEED1000 | BMCR_SPEED100 | BMCR_FULLDPLX | 503 + 0x003c); 504 + if (ecmd->speed == SPEED_100) 505 + reg |= BMCR_SPEED100; 506 + if (ecmd->duplex) 507 + reg |= BMCR_FULLDPLX; 508 + mdio_clause45_write(efx, phy_id, MDIO_MMD_PMAPMD, 528 509 MDIO_MMDREG_CTRL1, reg); 529 510 } 530 511
+2 -1
drivers/net/sfc/mdio_10g.h
··· 155 155 #define MDIO_AN_XNP 22 156 156 #define MDIO_AN_LPA_XNP 25 157 157 158 - #define MDIO_AN_10GBT_ADVERTISE 32 158 + #define MDIO_AN_10GBT_CTRL 32 159 + #define MDIO_AN_10GBT_CTRL_ADV_10G_LBN 12 159 160 #define MDIO_AN_10GBT_STATUS (33) 160 161 #define MDIO_AN_10GBT_STATUS_MS_FLT_LBN (15) /* MASTER/SLAVE config fault */ 161 162 #define MDIO_AN_10GBT_STATUS_MS_LBN (14) /* MASTER/SLAVE config */
+4 -5
drivers/net/sfc/net_driver.h
··· 557 557 * @poll: Poll for hardware state. Serialised by the mac_lock. 558 558 * @get_settings: Get ethtool settings. Serialised by the mac_lock. 559 559 * @set_settings: Set ethtool settings. Serialised by the mac_lock. 560 - * @set_xnp_advertise: Set abilities advertised in Extended Next Page 560 + * @set_npage_adv: Set abilities advertised in (Extended) Next Page 561 561 * (only needed where AN bit is set in mmds) 562 562 * @num_tests: Number of PHY-specific tests/results 563 563 * @test_names: Names of the tests/results ··· 577 577 struct ethtool_cmd *ecmd); 578 578 int (*set_settings) (struct efx_nic *efx, 579 579 struct ethtool_cmd *ecmd); 580 - bool (*set_xnp_advertise) (struct efx_nic *efx, u32); 580 + void (*set_npage_adv) (struct efx_nic *efx, u32); 581 581 u32 num_tests; 582 582 const char *const *test_names; 583 583 int (*run_tests) (struct efx_nic *efx, int *results, unsigned flags); ··· 745 745 * &struct net_device_stats. 746 746 * @stats_buffer: DMA buffer for statistics 747 747 * @stats_lock: Statistics update lock. Serialises statistics fetches 748 - * @stats_enabled: Temporarily disable statistics fetches. 749 - * Serialised by @stats_lock 748 + * @stats_disable_count: Nest count for disabling statistics fetches 750 749 * @mac_op: MAC interface 751 750 * @mac_address: Permanent MAC address 752 751 * @phy_type: PHY type ··· 827 828 struct efx_mac_stats mac_stats; 828 829 struct efx_buffer stats_buffer; 829 830 spinlock_t stats_lock; 830 - bool stats_enabled; 831 + unsigned int stats_disable_count; 831 832 832 833 struct efx_mac_operations *mac_op; 833 834 unsigned char mac_address[ETH_ALEN];
-1
drivers/net/sfc/phy.h
··· 17 17 extern struct efx_phy_operations falcon_sft9001_phy_ops; 18 18 19 19 extern void tenxpress_phy_blink(struct efx_nic *efx, bool blink); 20 - extern void tenxpress_crc_err(struct efx_nic *efx); 21 20 22 21 /**************************************************************************** 23 22 * Exported functions from the driver for XFP optical PHYs
+4 -3
drivers/net/sfc/selftest.c
··· 665 665 { 666 666 enum efx_loopback_mode loopback_mode = efx->loopback_mode; 667 667 int phy_mode = efx->phy_mode; 668 + enum reset_type reset_method = RESET_TYPE_INVISIBLE; 668 669 struct ethtool_cmd ecmd; 669 670 struct efx_channel *channel; 670 671 int rc_test = 0, rc_reset = 0, rc; ··· 719 718 mutex_unlock(&efx->mac_lock); 720 719 721 720 /* free up all consumers of SRAM (including all the queues) */ 722 - efx_reset_down(efx, &ecmd); 721 + efx_reset_down(efx, reset_method, &ecmd); 723 722 724 723 rc = efx_test_chip(efx, tests); 725 724 if (rc && !rc_test) 726 725 rc_test = rc; 727 726 728 727 /* reset the chip to recover from the register test */ 729 - rc_reset = falcon_reset_hw(efx, RESET_TYPE_ALL); 728 + rc_reset = falcon_reset_hw(efx, reset_method); 730 729 731 730 /* Ensure that the phy is powered and out of loopback 732 731 * for the bist and loopback tests */ 733 732 efx->phy_mode &= ~PHY_MODE_LOW_POWER; 734 733 efx->loopback_mode = LOOPBACK_NONE; 735 734 736 - rc = efx_reset_up(efx, &ecmd, rc_reset == 0); 735 + rc = efx_reset_up(efx, reset_method, &ecmd, rc_reset == 0); 737 736 if (rc && !rc_reset) 738 737 rc_reset = rc; 739 738
+33 -9
drivers/net/sfc/sfe4001.c
··· 187 187 { 188 188 efx_oword_t reg; 189 189 190 - /* GPIO pins are also used for I2C, so block that temporarily */ 190 + /* GPIO 3 and the GPIO register are shared with I2C, so block that */ 191 191 mutex_lock(&efx->i2c_adap.bus_lock); 192 192 193 + /* Pull RST_N (GPIO 2) low then let it up again, setting the 194 + * FLASH_CFG_1 strap (GPIO 3) appropriately. Only change the 195 + * output enables; the output levels should always be 0 (low) 196 + * and we rely on external pull-ups. */ 193 197 falcon_read(efx, &reg, GPIO_CTL_REG_KER); 194 198 EFX_SET_OWORD_FIELD(reg, GPIO2_OEN, true); 195 - EFX_SET_OWORD_FIELD(reg, GPIO2_OUT, false); 196 199 falcon_write(efx, &reg, GPIO_CTL_REG_KER); 197 200 msleep(1000); 198 - EFX_SET_OWORD_FIELD(reg, GPIO2_OUT, true); 199 - EFX_SET_OWORD_FIELD(reg, GPIO3_OEN, true); 200 - EFX_SET_OWORD_FIELD(reg, GPIO3_OUT, 201 - !(efx->phy_mode & PHY_MODE_SPECIAL)); 201 + EFX_SET_OWORD_FIELD(reg, GPIO2_OEN, false); 202 + EFX_SET_OWORD_FIELD(reg, GPIO3_OEN, 203 + !!(efx->phy_mode & PHY_MODE_SPECIAL)); 202 204 falcon_write(efx, &reg, GPIO_CTL_REG_KER); 205 + msleep(1); 203 206 204 207 mutex_unlock(&efx->i2c_adap.bus_lock); 205 208 ··· 236 233 } else if (efx->state != STATE_RUNNING || netif_running(efx->net_dev)) { 237 234 err = -EBUSY; 238 235 } else { 236 + /* Reset the PHY, reconfigure the MAC and enable/disable 237 + * MAC stats accordingly. */ 239 238 efx->phy_mode = new_mode; 239 + if (new_mode & PHY_MODE_SPECIAL) 240 + efx_stats_disable(efx); 240 241 if (efx->board_info.type == EFX_BOARD_SFE4001) 241 242 err = sfe4001_poweron(efx); 242 243 else 243 244 err = sfn4111t_reset(efx); 244 245 efx_reconfigure_port(efx); 246 + if (!(new_mode & PHY_MODE_SPECIAL)) 247 + efx_stats_enable(efx); 245 248 } 246 249 rtnl_unlock(); 247 250 ··· 336 327 efx->board_info.monitor = sfe4001_check_hw; 337 328 efx->board_info.fini = sfe4001_fini; 338 329 330 + if (efx->phy_mode & PHY_MODE_SPECIAL) { 331 + /* PHY won't generate a 156.25 MHz clock and MAC stats fetch 332 + * will fail. */ 333 + efx_stats_disable(efx); 334 + } 339 335 rc = sfe4001_poweron(efx); 340 336 if (rc) 341 337 goto fail_ioexp; ··· 387 373 i2c_unregister_device(efx->board_info.hwmon_client); 388 374 } 389 375 390 - static struct i2c_board_info sfn4111t_hwmon_info = { 376 + static struct i2c_board_info sfn4111t_a0_hwmon_info = { 391 377 I2C_BOARD_INFO("max6647", 0x4e), 378 + .irq = -1, 379 + }; 380 + 381 + static struct i2c_board_info sfn4111t_r5_hwmon_info = { 382 + I2C_BOARD_INFO("max6646", 0x4d), 392 383 .irq = -1, 393 384 }; 394 385 ··· 402 383 int rc; 403 384 404 385 efx->board_info.hwmon_client = 405 - i2c_new_device(&efx->i2c_adap, &sfn4111t_hwmon_info); 386 + i2c_new_device(&efx->i2c_adap, 387 + (efx->board_info.minor < 5) ? 388 + &sfn4111t_a0_hwmon_info : 389 + &sfn4111t_r5_hwmon_info); 406 390 if (!efx->board_info.hwmon_client) 407 391 return -EIO; 408 392 ··· 417 395 if (rc) 418 396 goto fail_hwmon; 419 397 420 - if (efx->phy_mode & PHY_MODE_SPECIAL) 398 + if (efx->phy_mode & PHY_MODE_SPECIAL) { 399 + efx_stats_disable(efx); 421 400 sfn4111t_reset(efx); 401 + } 422 402 423 403 return 0; 424 404
+77 -136
drivers/net/sfc/tenxpress.c
··· 68 68 #define PMA_PMD_EXT_CLK312_WIDTH 1 69 69 #define PMA_PMD_EXT_LPOWER_LBN 12 70 70 #define PMA_PMD_EXT_LPOWER_WIDTH 1 71 + #define PMA_PMD_EXT_ROBUST_LBN 14 72 + #define PMA_PMD_EXT_ROBUST_WIDTH 1 71 73 #define PMA_PMD_EXT_SSR_LBN 15 72 74 #define PMA_PMD_EXT_SSR_WIDTH 1 73 75 ··· 180 178 #define C22EXT_STATUS_LINK_LBN 2 181 179 #define C22EXT_STATUS_LINK_WIDTH 1 182 180 183 - #define C22EXT_MSTSLV_REG 49162 184 - #define C22EXT_MSTSLV_1000_HD_LBN 10 185 - #define C22EXT_MSTSLV_1000_HD_WIDTH 1 186 - #define C22EXT_MSTSLV_1000_FD_LBN 11 187 - #define C22EXT_MSTSLV_1000_FD_WIDTH 1 181 + #define C22EXT_MSTSLV_CTRL 49161 182 + #define C22EXT_MSTSLV_CTRL_ADV_1000_HD_LBN 8 183 + #define C22EXT_MSTSLV_CTRL_ADV_1000_FD_LBN 9 184 + 185 + #define C22EXT_MSTSLV_STATUS 49162 186 + #define C22EXT_MSTSLV_STATUS_LP_1000_HD_LBN 10 187 + #define C22EXT_MSTSLV_STATUS_LP_1000_FD_LBN 11 188 188 189 189 /* Time to wait between powering down the LNPGA and turning off the power 190 190 * rails */ 191 191 #define LNPGA_PDOWN_WAIT (HZ / 5) 192 192 193 - static int crc_error_reset_threshold = 100; 194 - module_param(crc_error_reset_threshold, int, 0644); 195 - MODULE_PARM_DESC(crc_error_reset_threshold, 196 - "Max number of CRC errors before XAUI reset"); 197 - 198 193 struct tenxpress_phy_data { 199 194 enum efx_loopback_mode loopback_mode; 200 - atomic_t bad_crc_count; 201 195 enum efx_phy_mode phy_mode; 202 196 int bad_lp_tries; 203 197 }; 204 - 205 - void tenxpress_crc_err(struct efx_nic *efx) 206 - { 207 - struct tenxpress_phy_data *phy_data = efx->phy_data; 208 - if (phy_data != NULL) 209 - atomic_inc(&phy_data->bad_crc_count); 210 - } 211 198 212 199 static ssize_t show_phy_short_reach(struct device *dev, 213 200 struct device_attribute *attr, char *buf) ··· 276 285 PMA_PMD_XCONTROL_REG); 277 286 reg |= ((1 << PMA_PMD_EXT_GMII_EN_LBN) | 278 287 (1 << PMA_PMD_EXT_CLK_OUT_LBN) | 279 - (1 << PMA_PMD_EXT_CLK312_LBN)); 288 + (1 << PMA_PMD_EXT_CLK312_LBN) | 289 + (1 << PMA_PMD_EXT_ROBUST_LBN)); 290 + 280 291 mdio_clause45_write(efx, phy_id, MDIO_MMD_PMAPMD, 281 292 PMA_PMD_XCONTROL_REG, reg); 282 293 mdio_clause45_set_flag(efx, phy_id, MDIO_MMD_C22EXT, ··· 340 347 rc = tenxpress_init(efx); 341 348 if (rc < 0) 342 349 goto fail; 350 + mdio_clause45_set_pause(efx); 343 351 344 352 if (efx->phy_type == PHY_TYPE_SFT9001B) { 345 353 rc = device_create_file(&efx->pci_dev->dev, ··· 371 377 372 378 /* The XGMAC clock is driven from the SFC7101/SFT9001 312MHz clock, so 373 379 * a special software reset can glitch the XGMAC sufficiently for stats 374 - * requests to fail. Since we don't often special_reset, just lock. */ 375 - spin_lock(&efx->stats_lock); 380 + * requests to fail. */ 381 + efx_stats_disable(efx); 376 382 377 383 /* Initiate reset */ 378 384 reg = mdio_clause45_read(efx, efx->mii.phy_id, ··· 387 393 rc = mdio_clause45_wait_reset_mmds(efx, 388 394 TENXPRESS_REQUIRED_DEVS); 389 395 if (rc < 0) 390 - goto unlock; 396 + goto out; 391 397 392 398 /* Try and reconfigure the device */ 393 399 rc = tenxpress_init(efx); 394 400 if (rc < 0) 395 - goto unlock; 401 + goto out; 396 402 397 403 /* Wait for the XGXS state machine to churn */ 398 404 mdelay(10); 399 - unlock: 400 - spin_unlock(&efx->stats_lock); 405 + out: 406 + efx_stats_enable(efx); 401 407 return rc; 402 408 } 403 409 ··· 515 521 { 516 522 struct tenxpress_phy_data *phy_data = efx->phy_data; 517 523 struct ethtool_cmd ecmd; 518 - bool phy_mode_change, loop_reset, loop_toggle, loopback; 524 + bool phy_mode_change, loop_reset; 519 525 520 526 if (efx->phy_mode & (PHY_MODE_OFF | PHY_MODE_SPECIAL)) { 521 527 phy_data->phy_mode = efx->phy_mode; ··· 526 532 527 533 phy_mode_change = (efx->phy_mode == PHY_MODE_NORMAL && 528 534 phy_data->phy_mode != PHY_MODE_NORMAL); 529 - loopback = LOOPBACK_MASK(efx) & efx->phy_op->loopbacks; 530 - loop_toggle = LOOPBACK_CHANGED(phy_data, efx, efx->phy_op->loopbacks); 531 535 loop_reset = (LOOPBACK_OUT_OF(phy_data, efx, efx->phy_op->loopbacks) || 532 536 LOOPBACK_CHANGED(phy_data, efx, 1 << LOOPBACK_GPHY)); 533 537 534 - if (loop_reset || loop_toggle || loopback || phy_mode_change) { 538 + if (loop_reset || phy_mode_change) { 535 539 int rc; 536 540 537 541 efx->phy_op->get_settings(efx, &ecmd); ··· 542 550 * then xaui will be reset anyway */ 543 551 if (EFX_IS10G(efx)) 544 552 falcon_reset_xaui(efx); 545 - } 546 - 547 - if (efx->phy_type != PHY_TYPE_SFX7101) { 548 - /* Only change autoneg once, on coming out or 549 - * going into loopback */ 550 - if (loop_toggle) 551 - ecmd.autoneg = !loopback; 552 - if (loopback) { 553 - ecmd.duplex = DUPLEX_FULL; 554 - if (efx->loopback_mode == LOOPBACK_GPHY) 555 - ecmd.speed = SPEED_1000; 556 - else 557 - ecmd.speed = SPEED_10000; 558 - } 559 553 } 560 554 561 555 rc = efx->phy_op->set_settings(efx, &ecmd); ··· 602 624 603 625 if (phy_data->phy_mode != PHY_MODE_NORMAL) 604 626 return; 605 - 606 - if (EFX_WORKAROUND_10750(efx) && 607 - atomic_read(&phy_data->bad_crc_count) > crc_error_reset_threshold) { 608 - EFX_ERR(efx, "Resetting XAUI due to too many CRC errors\n"); 609 - falcon_reset_xaui(efx); 610 - atomic_set(&phy_data->bad_crc_count, 0); 611 - } 612 627 } 613 628 614 629 static void tenxpress_phy_fini(struct efx_nic *efx) ··· 744 773 return rc; 745 774 } 746 775 747 - static u32 tenxpress_get_xnp_lpa(struct efx_nic *efx) 776 + static void 777 + tenxpress_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) 748 778 { 749 - int phy = efx->mii.phy_id; 750 - u32 lpa = 0; 779 + int phy_id = efx->mii.phy_id; 780 + u32 adv = 0, lpa = 0; 751 781 int reg; 752 782 753 783 if (efx->phy_type != PHY_TYPE_SFX7101) { 754 - reg = mdio_clause45_read(efx, phy, MDIO_MMD_C22EXT, 755 - C22EXT_MSTSLV_REG); 756 - if (reg & (1 << C22EXT_MSTSLV_1000_HD_LBN)) 784 + reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_C22EXT, 785 + C22EXT_MSTSLV_CTRL); 786 + if (reg & (1 << C22EXT_MSTSLV_CTRL_ADV_1000_FD_LBN)) 787 + adv |= ADVERTISED_1000baseT_Full; 788 + reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_C22EXT, 789 + C22EXT_MSTSLV_STATUS); 790 + if (reg & (1 << C22EXT_MSTSLV_STATUS_LP_1000_HD_LBN)) 757 791 lpa |= ADVERTISED_1000baseT_Half; 758 - if (reg & (1 << C22EXT_MSTSLV_1000_FD_LBN)) 792 + if (reg & (1 << C22EXT_MSTSLV_STATUS_LP_1000_FD_LBN)) 759 793 lpa |= ADVERTISED_1000baseT_Full; 760 794 } 761 - reg = mdio_clause45_read(efx, phy, MDIO_MMD_AN, MDIO_AN_10GBT_STATUS); 795 + reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_AN, 796 + MDIO_AN_10GBT_CTRL); 797 + if (reg & (1 << MDIO_AN_10GBT_CTRL_ADV_10G_LBN)) 798 + adv |= ADVERTISED_10000baseT_Full; 799 + reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_AN, 800 + MDIO_AN_10GBT_STATUS); 762 801 if (reg & (1 << MDIO_AN_10GBT_STATUS_LP_10G_LBN)) 763 802 lpa |= ADVERTISED_10000baseT_Full; 764 - return lpa; 803 + 804 + mdio_clause45_get_settings_ext(efx, ecmd, adv, lpa); 805 + 806 + if (efx->phy_type != PHY_TYPE_SFX7101) 807 + ecmd->supported |= (SUPPORTED_100baseT_Full | 808 + SUPPORTED_1000baseT_Full); 809 + 810 + /* In loopback, the PHY automatically brings up the correct interface, 811 + * but doesn't advertise the correct speed. So override it */ 812 + if (efx->loopback_mode == LOOPBACK_GPHY) 813 + ecmd->speed = SPEED_1000; 814 + else if (LOOPBACK_MASK(efx) & efx->phy_op->loopbacks) 815 + ecmd->speed = SPEED_10000; 765 816 } 766 817 767 - static void sfx7101_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) 818 + static int tenxpress_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) 768 819 { 769 - mdio_clause45_get_settings_ext(efx, ecmd, ADVERTISED_10000baseT_Full, 770 - tenxpress_get_xnp_lpa(efx)); 771 - ecmd->supported |= SUPPORTED_10000baseT_Full; 772 - ecmd->advertising |= ADVERTISED_10000baseT_Full; 820 + if (!ecmd->autoneg) 821 + return -EINVAL; 822 + 823 + return mdio_clause45_set_settings(efx, ecmd); 773 824 } 774 825 775 - static void sft9001_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) 826 + static void sfx7101_set_npage_adv(struct efx_nic *efx, u32 advertising) 776 827 { 777 - int phy_id = efx->mii.phy_id; 778 - u32 xnp_adv = 0; 779 - int reg; 780 - 781 - reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_PMAPMD, 782 - PMA_PMD_SPEED_ENABLE_REG); 783 - if (EFX_WORKAROUND_13204(efx) && (reg & (1 << PMA_PMD_100TX_ADV_LBN))) 784 - xnp_adv |= ADVERTISED_100baseT_Full; 785 - if (reg & (1 << PMA_PMD_1000T_ADV_LBN)) 786 - xnp_adv |= ADVERTISED_1000baseT_Full; 787 - if (reg & (1 << PMA_PMD_10000T_ADV_LBN)) 788 - xnp_adv |= ADVERTISED_10000baseT_Full; 789 - 790 - mdio_clause45_get_settings_ext(efx, ecmd, xnp_adv, 791 - tenxpress_get_xnp_lpa(efx)); 792 - 793 - ecmd->supported |= (SUPPORTED_100baseT_Half | 794 - SUPPORTED_100baseT_Full | 795 - SUPPORTED_1000baseT_Full); 796 - 797 - /* Use the vendor defined C22ext register for duplex settings */ 798 - if (ecmd->speed != SPEED_10000 && !ecmd->autoneg) { 799 - reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_C22EXT, 800 - GPHY_XCONTROL_REG); 801 - ecmd->duplex = (reg & (1 << GPHY_DUPLEX_LBN) ? 802 - DUPLEX_FULL : DUPLEX_HALF); 803 - } 828 + mdio_clause45_set_flag(efx, efx->mii.phy_id, MDIO_MMD_AN, 829 + MDIO_AN_10GBT_CTRL, 830 + MDIO_AN_10GBT_CTRL_ADV_10G_LBN, 831 + advertising & ADVERTISED_10000baseT_Full); 804 832 } 805 833 806 - static int sft9001_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) 834 + static void sft9001_set_npage_adv(struct efx_nic *efx, u32 advertising) 807 835 { 808 836 int phy_id = efx->mii.phy_id; 809 - int rc; 810 837 811 - rc = mdio_clause45_set_settings(efx, ecmd); 812 - if (rc) 813 - return rc; 814 - 815 - if (ecmd->speed != SPEED_10000 && !ecmd->autoneg) 816 - mdio_clause45_set_flag(efx, phy_id, MDIO_MMD_C22EXT, 817 - GPHY_XCONTROL_REG, GPHY_DUPLEX_LBN, 818 - ecmd->duplex == DUPLEX_FULL); 819 - 820 - return rc; 821 - } 822 - 823 - static bool sft9001_set_xnp_advertise(struct efx_nic *efx, u32 advertising) 824 - { 825 - int phy = efx->mii.phy_id; 826 - int reg = mdio_clause45_read(efx, phy, MDIO_MMD_PMAPMD, 827 - PMA_PMD_SPEED_ENABLE_REG); 828 - bool enabled; 829 - 830 - reg &= ~((1 << 2) | (1 << 3)); 831 - if (EFX_WORKAROUND_13204(efx) && 832 - (advertising & ADVERTISED_100baseT_Full)) 833 - reg |= 1 << PMA_PMD_100TX_ADV_LBN; 834 - if (advertising & ADVERTISED_1000baseT_Full) 835 - reg |= 1 << PMA_PMD_1000T_ADV_LBN; 836 - if (advertising & ADVERTISED_10000baseT_Full) 837 - reg |= 1 << PMA_PMD_10000T_ADV_LBN; 838 - mdio_clause45_write(efx, phy, MDIO_MMD_PMAPMD, 839 - PMA_PMD_SPEED_ENABLE_REG, reg); 840 - 841 - enabled = (advertising & 842 - (ADVERTISED_1000baseT_Half | 843 - ADVERTISED_1000baseT_Full | 844 - ADVERTISED_10000baseT_Full)); 845 - if (EFX_WORKAROUND_13204(efx)) 846 - enabled |= (advertising & ADVERTISED_100baseT_Full); 847 - return enabled; 838 + mdio_clause45_set_flag(efx, phy_id, MDIO_MMD_C22EXT, 839 + C22EXT_MSTSLV_CTRL, 840 + C22EXT_MSTSLV_CTRL_ADV_1000_FD_LBN, 841 + advertising & ADVERTISED_1000baseT_Full); 842 + mdio_clause45_set_flag(efx, phy_id, MDIO_MMD_AN, 843 + MDIO_AN_10GBT_CTRL, 844 + MDIO_AN_10GBT_CTRL_ADV_10G_LBN, 845 + advertising & ADVERTISED_10000baseT_Full); 848 846 } 849 847 850 848 struct efx_phy_operations falcon_sfx7101_phy_ops = { ··· 823 883 .poll = tenxpress_phy_poll, 824 884 .fini = tenxpress_phy_fini, 825 885 .clear_interrupt = efx_port_dummy_op_void, 826 - .get_settings = sfx7101_get_settings, 827 - .set_settings = mdio_clause45_set_settings, 886 + .get_settings = tenxpress_get_settings, 887 + .set_settings = tenxpress_set_settings, 888 + .set_npage_adv = sfx7101_set_npage_adv, 828 889 .num_tests = ARRAY_SIZE(sfx7101_test_names), 829 890 .test_names = sfx7101_test_names, 830 891 .run_tests = sfx7101_run_tests, ··· 840 899 .poll = tenxpress_phy_poll, 841 900 .fini = tenxpress_phy_fini, 842 901 .clear_interrupt = efx_port_dummy_op_void, 843 - .get_settings = sft9001_get_settings, 844 - .set_settings = sft9001_set_settings, 845 - .set_xnp_advertise = sft9001_set_xnp_advertise, 902 + .get_settings = tenxpress_get_settings, 903 + .set_settings = tenxpress_set_settings, 904 + .set_npage_adv = sft9001_set_npage_adv, 846 905 .num_tests = ARRAY_SIZE(sft9001_test_names), 847 906 .test_names = sft9001_test_names, 848 907 .run_tests = sft9001_run_tests,
+5 -7
drivers/net/sfc/workarounds.h
··· 18 18 #define EFX_WORKAROUND_ALWAYS(efx) 1 19 19 #define EFX_WORKAROUND_FALCON_A(efx) (falcon_rev(efx) <= FALCON_REV_A1) 20 20 #define EFX_WORKAROUND_10G(efx) EFX_IS10G(efx) 21 - #define EFX_WORKAROUND_SFX7101(efx) ((efx)->phy_type == PHY_TYPE_SFX7101) 22 - #define EFX_WORKAROUND_SFT9001A(efx) ((efx)->phy_type == PHY_TYPE_SFT9001A) 21 + #define EFX_WORKAROUND_SFT9001(efx) ((efx)->phy_type == PHY_TYPE_SFT9001A || \ 22 + (efx)->phy_type == PHY_TYPE_SFT9001B) 23 23 24 24 /* XAUI resets if link not detected */ 25 25 #define EFX_WORKAROUND_5147 EFX_WORKAROUND_ALWAYS ··· 29 29 #define EFX_WORKAROUND_7884 EFX_WORKAROUND_10G 30 30 /* TX pkt parser problem with <= 16 byte TXes */ 31 31 #define EFX_WORKAROUND_9141 EFX_WORKAROUND_ALWAYS 32 - /* Low rate CRC errors require XAUI reset */ 33 - #define EFX_WORKAROUND_10750 EFX_WORKAROUND_SFX7101 34 32 /* TX_EV_PKT_ERR can be caused by a dangling TX descriptor 35 33 * or a PCIe error (bug 11028) */ 36 34 #define EFX_WORKAROUND_10727 EFX_WORKAROUND_ALWAYS ··· 53 55 #define EFX_WORKAROUND_8071 EFX_WORKAROUND_FALCON_A 54 56 55 57 /* Need to send XNP pages for 100BaseT */ 56 - #define EFX_WORKAROUND_13204 EFX_WORKAROUND_SFT9001A 57 - /* Need to keep AN enabled */ 58 - #define EFX_WORKAROUND_13963 EFX_WORKAROUND_SFT9001A 58 + #define EFX_WORKAROUND_13204 EFX_WORKAROUND_SFT9001 59 + /* Don't restart AN in near-side loopback */ 60 + #define EFX_WORKAROUND_15195 EFX_WORKAROUND_SFT9001 59 61 60 62 #endif /* EFX_WORKAROUNDS_H */
+2 -2
drivers/net/skfp/skfddi.c
··· 1003 1003 break; 1004 1004 case SKFP_CLR_STATS: /* Zero out the driver statistics */ 1005 1005 if (!capable(CAP_NET_ADMIN)) { 1006 - memset(&lp->MacStat, 0, sizeof(lp->MacStat)); 1007 - } else { 1008 1006 status = -EPERM; 1007 + } else { 1008 + memset(&lp->MacStat, 0, sizeof(lp->MacStat)); 1009 1009 } 1010 1010 break; 1011 1011 default:
+3 -3
drivers/net/sky2.c
··· 1403 1403 1404 1404 } 1405 1405 1406 - if (netif_msg_ifup(sky2)) 1407 - printk(KERN_INFO PFX "%s: enabling interface\n", dev->name); 1408 - 1409 1406 netif_carrier_off(dev); 1410 1407 1411 1408 /* must be power of 2 */ ··· 1481 1484 sky2_write32(hw, B0_IMSK, imask); 1482 1485 1483 1486 sky2_set_multicast(dev); 1487 + 1488 + if (netif_msg_ifup(sky2)) 1489 + printk(KERN_INFO PFX "%s: enabling interface\n", dev->name); 1484 1490 return 0; 1485 1491 1486 1492 err_out:
+1 -1
drivers/net/smsc911x.c
··· 954 954 do { 955 955 udelay(1); 956 956 val = smsc911x_reg_read(pdata, RX_DP_CTRL); 957 - } while (timeout-- && (val & RX_DP_CTRL_RX_FFWD_)); 957 + } while (--timeout && (val & RX_DP_CTRL_RX_FFWD_)); 958 958 959 959 if (unlikely(timeout == 0)) 960 960 SMSC_WARNING(HW, "Timed out waiting for "
+1 -2
drivers/net/smsc9420.c
··· 1378 1378 1379 1379 /* test the IRQ connection to the ISR */ 1380 1380 smsc_dbg(IFUP, "Testing ISR using IRQ %d", dev->irq); 1381 + pd->software_irq_signal = false; 1381 1382 1382 1383 spin_lock_irqsave(&pd->int_lock, flags); 1383 1384 /* configure interrupt deassertion timer and enable interrupts */ ··· 1394 1393 smsc9420_pci_flush_write(pd); 1395 1394 1396 1395 timeout = 1000; 1397 - pd->software_irq_signal = false; 1398 - smp_wmb(); 1399 1396 while (timeout--) { 1400 1397 if (pd->software_irq_signal) 1401 1398 break;
+19 -4
drivers/net/tulip/21142.c
··· 9 9 10 10 Please refer to Documentation/DocBook/tulip-user.{pdf,ps,html} 11 11 for more information on this driver. 12 + 13 + DC21143 manual "21143 PCI/CardBus 10/100Mb/s Ethernet LAN Controller 14 + Hardware Reference Manual" is currently available at : 15 + http://developer.intel.com/design/network/manuals/278074.htm 16 + 12 17 Please submit bugs to http://bugzilla.kernel.org/ . 13 18 */ 14 19 ··· 37 32 int csr12 = ioread32(ioaddr + CSR12); 38 33 int next_tick = 60*HZ; 39 34 int new_csr6 = 0; 35 + int csr14 = ioread32(ioaddr + CSR14); 40 36 37 + /* CSR12[LS10,LS100] are not reliable during autonegotiation */ 38 + if ((csr14 & 0x80) && (csr12 & 0x7000) != 0x5000) 39 + csr12 |= 6; 41 40 if (tulip_debug > 2) 42 41 printk(KERN_INFO"%s: 21143 negotiation status %8.8x, %s.\n", 43 42 dev->name, csr12, medianame[dev->if_port]); ··· 85 76 new_csr6 = 0x83860000; 86 77 dev->if_port = 3; 87 78 iowrite32(0, ioaddr + CSR13); 88 - iowrite32(0x0003FF7F, ioaddr + CSR14); 79 + iowrite32(0x0003FFFF, ioaddr + CSR14); 89 80 iowrite16(8, ioaddr + CSR15); 90 81 iowrite32(1, ioaddr + CSR13); 91 82 } ··· 141 132 struct tulip_private *tp = netdev_priv(dev); 142 133 void __iomem *ioaddr = tp->base_addr; 143 134 int csr12 = ioread32(ioaddr + CSR12); 135 + int csr14 = ioread32(ioaddr + CSR14); 144 136 137 + /* CSR12[LS10,LS100] are not reliable during autonegotiation */ 138 + if ((csr14 & 0x80) && (csr12 & 0x7000) != 0x5000) 139 + csr12 |= 6; 145 140 if (tulip_debug > 1) 146 141 printk(KERN_INFO"%s: 21143 link status interrupt %8.8x, CSR5 %x, " 147 - "%8.8x.\n", dev->name, csr12, csr5, ioread32(ioaddr + CSR14)); 142 + "%8.8x.\n", dev->name, csr12, csr5, csr14); 148 143 149 144 /* If NWay finished and we have a negotiated partner capability. */ 150 145 if (tp->nway && !tp->nwayset && (csr12 & 0x7000) == 0x5000) { ··· 156 143 int negotiated = tp->sym_advertise & (csr12 >> 16); 157 144 tp->lpar = csr12 >> 16; 158 145 tp->nwayset = 1; 159 - if (negotiated & 0x0100) dev->if_port = 5; 146 + /* If partner cannot negotiate, it is 10Mbps Half Duplex */ 147 + if (!(csr12 & 0x8000)) dev->if_port = 0; 148 + else if (negotiated & 0x0100) dev->if_port = 5; 160 149 else if (negotiated & 0x0080) dev->if_port = 3; 161 150 else if (negotiated & 0x0040) dev->if_port = 4; 162 151 else if (negotiated & 0x0020) dev->if_port = 0; ··· 229 214 tp->timer.expires = RUN_AT(3*HZ); 230 215 add_timer(&tp->timer); 231 216 } else if (dev->if_port == 5) 232 - iowrite32(ioread32(ioaddr + CSR14) & ~0x080, ioaddr + CSR14); 217 + iowrite32(csr14 & ~0x080, ioaddr + CSR14); 233 218 } else if (dev->if_port == 0 || dev->if_port == 4) { 234 219 if ((csr12 & 4) == 0) 235 220 printk(KERN_INFO"%s: 21143 10baseT link beat good.\n",
+18 -2
drivers/net/ucc_geth.c
··· 1536 1536 static int init_phy(struct net_device *dev) 1537 1537 { 1538 1538 struct ucc_geth_private *priv = netdev_priv(dev); 1539 + struct device_node *np = priv->node; 1540 + struct device_node *phy, *mdio; 1541 + const phandle *ph; 1542 + char bus_name[MII_BUS_ID_SIZE]; 1543 + const unsigned int *id; 1539 1544 struct phy_device *phydev; 1540 1545 char phy_id[BUS_ID_SIZE]; 1541 1546 ··· 1548 1543 priv->oldspeed = 0; 1549 1544 priv->oldduplex = -1; 1550 1545 1551 - snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, priv->ug_info->mdio_bus, 1552 - priv->ug_info->phy_address); 1546 + ph = of_get_property(np, "phy-handle", NULL); 1547 + phy = of_find_node_by_phandle(*ph); 1548 + mdio = of_get_parent(phy); 1549 + 1550 + id = of_get_property(phy, "reg", NULL); 1551 + 1552 + of_node_put(phy); 1553 + of_node_put(mdio); 1554 + 1555 + uec_mdio_bus_name(bus_name, mdio); 1556 + snprintf(phy_id, sizeof(phy_id), "%s:%02x", 1557 + bus_name, *id); 1553 1558 1554 1559 phydev = phy_connect(dev, phy_id, &adjust_link, 0, priv->phy_interface); 1555 1560 ··· 3763 3748 3764 3749 ugeth->ug_info = ug_info; 3765 3750 ugeth->dev = dev; 3751 + ugeth->node = np; 3766 3752 3767 3753 return 0; 3768 3754 }
+2
drivers/net/ucc_geth.h
··· 1186 1186 int oldspeed; 1187 1187 int oldduplex; 1188 1188 int oldlink; 1189 + 1190 + struct device_node *node; 1189 1191 }; 1190 1192 1191 1193 void uec_set_ethtool_ops(struct net_device *netdev);
+11 -1
drivers/net/ucc_geth_mii.c
··· 156 156 if (err) 157 157 goto reg_map_fail; 158 158 159 - snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", res.start); 159 + uec_mdio_bus_name(new_bus->id, np); 160 160 161 161 new_bus->irq = kmalloc(32 * sizeof(int), GFP_KERNEL); 162 162 ··· 283 283 { 284 284 of_unregister_platform_driver(&uec_mdio_driver); 285 285 } 286 + 287 + void uec_mdio_bus_name(char *name, struct device_node *np) 288 + { 289 + const u32 *reg; 290 + 291 + reg = of_get_property(np, "reg", NULL); 292 + 293 + snprintf(name, MII_BUS_ID_SIZE, "%s@%x", np->name, reg ? *reg : 0); 294 + } 295 +
+1
drivers/net/ucc_geth_mii.h
··· 97 97 int uec_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value); 98 98 int __init uec_mdio_init(void); 99 99 void uec_mdio_exit(void); 100 + void uec_mdio_bus_name(char *name, struct device_node *np); 100 101 #endif /* __UEC_MII_H */
+3 -3
drivers/net/virtio_net.c
··· 288 288 skb_put(skb, MAX_PACKET_LEN); 289 289 290 290 hdr = skb_vnet_hdr(skb); 291 - sg_init_one(sg, hdr, sizeof(*hdr)); 291 + sg_set_buf(sg, hdr, sizeof(*hdr)); 292 292 293 293 if (vi->big_packets) { 294 294 for (i = 0; i < MAX_SKB_FRAGS; i++) { ··· 489 489 490 490 /* Encode metadata header at front. */ 491 491 if (vi->mergeable_rx_bufs) 492 - sg_init_one(sg, mhdr, sizeof(*mhdr)); 492 + sg_set_buf(sg, mhdr, sizeof(*mhdr)); 493 493 else 494 - sg_init_one(sg, hdr, sizeof(*hdr)); 494 + sg_set_buf(sg, hdr, sizeof(*hdr)); 495 495 496 496 num = skb_to_sgvec(skb, sg+1, 0, skb->len) + 1; 497 497
-14
drivers/net/wimax/i2400m/debugfs.c
··· 234 234 &fops_i2400m_reset); 235 235 } 236 236 237 - /* 238 - * Debug levels control; see debug.h 239 - */ 240 - struct d_level D_LEVEL[] = { 241 - D_SUBMODULE_DEFINE(control), 242 - D_SUBMODULE_DEFINE(driver), 243 - D_SUBMODULE_DEFINE(debugfs), 244 - D_SUBMODULE_DEFINE(fw), 245 - D_SUBMODULE_DEFINE(netdev), 246 - D_SUBMODULE_DEFINE(rfkill), 247 - D_SUBMODULE_DEFINE(rx), 248 - D_SUBMODULE_DEFINE(tx), 249 - }; 250 - size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL); 251 237 252 238 #define __debugfs_register(prefix, name, parent) \ 253 239 do { \
+16
drivers/net/wimax/i2400m/driver.c
··· 707 707 EXPORT_SYMBOL_GPL(i2400m_release); 708 708 709 709 710 + /* 711 + * Debug levels control; see debug.h 712 + */ 713 + struct d_level D_LEVEL[] = { 714 + D_SUBMODULE_DEFINE(control), 715 + D_SUBMODULE_DEFINE(driver), 716 + D_SUBMODULE_DEFINE(debugfs), 717 + D_SUBMODULE_DEFINE(fw), 718 + D_SUBMODULE_DEFINE(netdev), 719 + D_SUBMODULE_DEFINE(rfkill), 720 + D_SUBMODULE_DEFINE(rx), 721 + D_SUBMODULE_DEFINE(tx), 722 + }; 723 + size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL); 724 + 725 + 710 726 static 711 727 int __init i2400m_driver_init(void) 712 728 {
+9 -1
drivers/net/wireless/ath5k/base.c
··· 1028 1028 * it's done by reseting the chip. To accomplish this we must 1029 1029 * first cleanup any pending DMA, then restart stuff after a la 1030 1030 * ath5k_init. 1031 + * 1032 + * Called with sc->lock. 1031 1033 */ 1032 1034 static int 1033 1035 ath5k_chan_set(struct ath5k_softc *sc, struct ieee80211_channel *chan) ··· 2816 2814 { 2817 2815 struct ath5k_softc *sc = hw->priv; 2818 2816 struct ieee80211_conf *conf = &hw->conf; 2817 + int ret; 2818 + 2819 + mutex_lock(&sc->lock); 2819 2820 2820 2821 sc->bintval = conf->beacon_int; 2821 2822 sc->power_level = conf->power_level; 2822 2823 2823 - return ath5k_chan_set(sc, conf->channel); 2824 + ret = ath5k_chan_set(sc, conf->channel); 2825 + 2826 + mutex_unlock(&sc->lock); 2827 + return ret; 2824 2828 } 2825 2829 2826 2830 static int
+4
drivers/net/wireless/iwlwifi/iwl-agn.c
··· 1719 1719 priv->ucode_data_backup.len = data_size; 1720 1720 iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); 1721 1721 1722 + if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr || 1723 + !priv->ucode_data_backup.v_addr) 1724 + goto err_pci_alloc; 1725 + 1722 1726 /* Initialization instructions and data */ 1723 1727 if (init_size && init_data_size) { 1724 1728 priv->ucode_init.len = init_size;
+8 -2
drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
··· 285 285 ofdm_power = priv->channels[channel - 1].hw_value >> 4; 286 286 287 287 cck_power = min(cck_power, (u8)11); 288 - ofdm_power = min(ofdm_power, (u8)35); 288 + if (ofdm_power > (u8)15) 289 + ofdm_power = 25; 290 + else 291 + ofdm_power += 10; 289 292 290 293 rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK, 291 294 rtl8225_tx_gain_cck_ofdm[cck_power / 6] >> 1); ··· 539 536 cck_power += priv->txpwr_base & 0xF; 540 537 cck_power = min(cck_power, (u8)35); 541 538 542 - ofdm_power = min(ofdm_power, (u8)15); 539 + if (ofdm_power > (u8)15) 540 + ofdm_power = 25; 541 + else 542 + ofdm_power += 10; 543 543 ofdm_power += priv->txpwr_base >> 4; 544 544 ofdm_power = min(ofdm_power, (u8)35); 545 545
+7
fs/compat_ioctl.c
··· 538 538 * cannot be fixed without breaking all existing apps. 539 539 */ 540 540 case TUNSETIFF: 541 + case TUNGETIFF: 541 542 case SIOCGIFFLAGS: 542 543 case SIOCGIFMETRIC: 543 544 case SIOCGIFMTU: ··· 1983 1982 COMPATIBLE_IOCTL(TUNSETDEBUG) 1984 1983 COMPATIBLE_IOCTL(TUNSETPERSIST) 1985 1984 COMPATIBLE_IOCTL(TUNSETOWNER) 1985 + COMPATIBLE_IOCTL(TUNSETLINK) 1986 + COMPATIBLE_IOCTL(TUNSETGROUP) 1987 + COMPATIBLE_IOCTL(TUNGETFEATURES) 1988 + COMPATIBLE_IOCTL(TUNSETOFFLOAD) 1989 + COMPATIBLE_IOCTL(TUNSETTXFILTER) 1986 1990 /* Big V */ 1987 1991 COMPATIBLE_IOCTL(VT_SETMODE) 1988 1992 COMPATIBLE_IOCTL(VT_GETMODE) ··· 2579 2573 HANDLE_IOCTL(SIOCGIFTXQLEN, dev_ifsioc) 2580 2574 HANDLE_IOCTL(SIOCSIFTXQLEN, dev_ifsioc) 2581 2575 HANDLE_IOCTL(TUNSETIFF, dev_ifsioc) 2576 + HANDLE_IOCTL(TUNGETIFF, dev_ifsioc) 2582 2577 HANDLE_IOCTL(SIOCETHTOOL, ethtool_ioctl) 2583 2578 HANDLE_IOCTL(SIOCBONDENSLAVE, bond_ioctl) 2584 2579 HANDLE_IOCTL(SIOCBONDRELEASE, bond_ioctl)
+1 -1
include/net/inet_hashtables.h
··· 183 183 size = 2048; 184 184 if (nr_pcpus >= 32) 185 185 size = 4096; 186 - if (sizeof(rwlock_t) != 0) { 186 + if (sizeof(spinlock_t) != 0) { 187 187 #ifdef CONFIG_NUMA 188 188 if (size * sizeof(spinlock_t) > PAGE_SIZE) 189 189 hashinfo->ehash_locks = vmalloc(size * sizeof(spinlock_t));
+8 -7
net/core/skbuff.c
··· 2212 2212 return 0; 2213 2213 2214 2214 next_skb: 2215 - block_limit = skb_headlen(st->cur_skb); 2215 + block_limit = skb_headlen(st->cur_skb) + st->stepped_offset; 2216 2216 2217 2217 if (abs_offset < block_limit) { 2218 - *data = st->cur_skb->data + abs_offset; 2218 + *data = st->cur_skb->data + (abs_offset - st->stepped_offset); 2219 2219 return block_limit - abs_offset; 2220 2220 } 2221 2221 ··· 2250 2250 st->frag_data = NULL; 2251 2251 } 2252 2252 2253 - if (st->cur_skb->next) { 2254 - st->cur_skb = st->cur_skb->next; 2253 + if (st->root_skb == st->cur_skb && 2254 + skb_shinfo(st->root_skb)->frag_list) { 2255 + st->cur_skb = skb_shinfo(st->root_skb)->frag_list; 2255 2256 st->frag_idx = 0; 2256 2257 goto next_skb; 2257 - } else if (st->root_skb == st->cur_skb && 2258 - skb_shinfo(st->root_skb)->frag_list) { 2259 - st->cur_skb = skb_shinfo(st->root_skb)->frag_list; 2258 + } else if (st->cur_skb->next) { 2259 + st->cur_skb = st->cur_skb->next; 2260 + st->frag_idx = 0; 2260 2261 goto next_skb; 2261 2262 } 2262 2263
+3 -3
net/ipv4/ipconfig.c
··· 1268 1268 static int __init ip_auto_config(void) 1269 1269 { 1270 1270 __be32 addr; 1271 + #ifdef IPCONFIG_DYNAMIC 1272 + int retries = CONF_OPEN_RETRIES; 1273 + #endif 1271 1274 1272 1275 #ifdef CONFIG_PROC_FS 1273 1276 proc_net_fops_create(&init_net, "pnp", S_IRUGO, &pnp_seq_fops); ··· 1307 1304 #endif 1308 1305 ic_first_dev->next) { 1309 1306 #ifdef IPCONFIG_DYNAMIC 1310 - 1311 - int retries = CONF_OPEN_RETRIES; 1312 - 1313 1307 if (ic_dynamic() < 0) { 1314 1308 ic_close_devs(); 1315 1309
+2 -1
net/ipv4/tcp.c
··· 524 524 struct tcp_splice_state *tss = rd_desc->arg.data; 525 525 int ret; 526 526 527 - ret = skb_splice_bits(skb, offset, tss->pipe, rd_desc->count, tss->flags); 527 + ret = skb_splice_bits(skb, offset, tss->pipe, min(rd_desc->count, len), 528 + tss->flags); 528 529 if (ret > 0) 529 530 rd_desc->count -= ret; 530 531 return ret;
+39 -16
net/ipv4/udp.c
··· 120 120 atomic_t udp_memory_allocated; 121 121 EXPORT_SYMBOL(udp_memory_allocated); 122 122 123 + #define PORTS_PER_CHAIN (65536 / UDP_HTABLE_SIZE) 124 + 123 125 static int udp_lib_lport_inuse(struct net *net, __u16 num, 124 126 const struct udp_hslot *hslot, 127 + unsigned long *bitmap, 125 128 struct sock *sk, 126 129 int (*saddr_comp)(const struct sock *sk1, 127 130 const struct sock *sk2)) ··· 135 132 sk_nulls_for_each(sk2, node, &hslot->head) 136 133 if (net_eq(sock_net(sk2), net) && 137 134 sk2 != sk && 138 - sk2->sk_hash == num && 135 + (bitmap || sk2->sk_hash == num) && 139 136 (!sk2->sk_reuse || !sk->sk_reuse) && 140 137 (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if 141 138 || sk2->sk_bound_dev_if == sk->sk_bound_dev_if) && 142 - (*saddr_comp)(sk, sk2)) 143 - return 1; 139 + (*saddr_comp)(sk, sk2)) { 140 + if (bitmap) 141 + __set_bit(sk2->sk_hash / UDP_HTABLE_SIZE, 142 + bitmap); 143 + else 144 + return 1; 145 + } 144 146 return 0; 145 147 } 146 148 ··· 168 160 if (!snum) { 169 161 int low, high, remaining; 170 162 unsigned rand; 171 - unsigned short first; 163 + unsigned short first, last; 164 + DECLARE_BITMAP(bitmap, PORTS_PER_CHAIN); 172 165 173 166 inet_get_local_port_range(&low, &high); 174 167 remaining = (high - low) + 1; 175 168 176 169 rand = net_random(); 177 - snum = first = rand % remaining + low; 178 - rand |= 1; 179 - for (;;) { 180 - hslot = &udptable->hash[udp_hashfn(net, snum)]; 170 + first = (((u64)rand * remaining) >> 32) + low; 171 + /* 172 + * force rand to be an odd multiple of UDP_HTABLE_SIZE 173 + */ 174 + rand = (rand | 1) * UDP_HTABLE_SIZE; 175 + for (last = first + UDP_HTABLE_SIZE; first != last; first++) { 176 + hslot = &udptable->hash[udp_hashfn(net, first)]; 177 + bitmap_zero(bitmap, PORTS_PER_CHAIN); 181 178 spin_lock_bh(&hslot->lock); 182 - if (!udp_lib_lport_inuse(net, snum, hslot, sk, saddr_comp)) 183 - break; 184 - spin_unlock_bh(&hslot->lock); 179 + udp_lib_lport_inuse(net, snum, hslot, bitmap, sk, 180 + saddr_comp); 181 + 182 + snum = first; 183 + /* 184 + * Iterate on all possible values of snum for this hash. 185 + * Using steps of an odd multiple of UDP_HTABLE_SIZE 186 + * give us randomization and full range coverage. 187 + */ 185 188 do { 186 - snum = snum + rand; 187 - } while (snum < low || snum > high); 188 - if (snum == first) 189 - goto fail; 189 + if (low <= snum && snum <= high && 190 + !test_bit(snum / UDP_HTABLE_SIZE, bitmap)) 191 + goto found; 192 + snum += rand; 193 + } while (snum != first); 194 + spin_unlock_bh(&hslot->lock); 190 195 } 196 + goto fail; 191 197 } else { 192 198 hslot = &udptable->hash[udp_hashfn(net, snum)]; 193 199 spin_lock_bh(&hslot->lock); 194 - if (udp_lib_lport_inuse(net, snum, hslot, sk, saddr_comp)) 200 + if (udp_lib_lport_inuse(net, snum, hslot, NULL, sk, saddr_comp)) 195 201 goto fail_unlock; 196 202 } 203 + found: 197 204 inet_sk(sk)->num = snum; 198 205 sk->sk_hash = snum; 199 206 if (sk_unhashed(sk)) {
+1 -1
net/ipv6/addrconf.c
··· 4250 4250 .procname = "mc_forwarding", 4251 4251 .data = &ipv6_devconf.mc_forwarding, 4252 4252 .maxlen = sizeof(int), 4253 - .mode = 0644, 4253 + .mode = 0444, 4254 4254 .proc_handler = proc_dointvec, 4255 4255 }, 4256 4256 #endif
+2 -2
net/ipv6/icmp.c
··· 443 443 if (xfrm_decode_session_reverse(skb, &fl2, AF_INET6)) 444 444 goto relookup_failed; 445 445 446 - if (ip6_dst_lookup(sk, &dst2, &fl)) 446 + if (ip6_dst_lookup(sk, &dst2, &fl2)) 447 447 goto relookup_failed; 448 448 449 - err = xfrm_lookup(net, &dst2, &fl, sk, XFRM_LOOKUP_ICMP); 449 + err = xfrm_lookup(net, &dst2, &fl2, sk, XFRM_LOOKUP_ICMP); 450 450 switch (err) { 451 451 case 0: 452 452 dst_release(dst);
+1 -1
net/ipv6/ip6_input.c
··· 255 255 * IPv6 multicast router mode is now supported ;) 256 256 */ 257 257 if (dev_net(skb->dev)->ipv6.devconf_all->mc_forwarding && 258 + !(ipv6_addr_type(&hdr->daddr) & IPV6_ADDR_LINKLOCAL) && 258 259 likely(!(IP6CB(skb)->flags & IP6SKB_FORWARDED))) { 259 260 /* 260 261 * Okay, we try to forward - split and duplicate ··· 317 316 } 318 317 319 318 if (skb2) { 320 - skb2->dev = skb2->dst->dev; 321 319 ip6_mr_input(skb2); 322 320 } 323 321 }
+18 -5
net/ipv6/ip6mr.c
··· 365 365 pim = (struct pimreghdr *)skb_transport_header(skb); 366 366 if (pim->type != ((PIM_VERSION << 4) | PIM_REGISTER) || 367 367 (pim->flags & PIM_NULL_REGISTER) || 368 - (ip_compute_csum((void *)pim, sizeof(*pim)) != 0 && 368 + (csum_ipv6_magic(&ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr, 369 + sizeof(*pim), IPPROTO_PIM, 370 + csum_partial((void *)pim, sizeof(*pim), 0)) && 369 371 csum_fold(skb_checksum(skb, 0, skb->len, 0)))) 370 372 goto drop; 371 373 ··· 394 392 skb_pull(skb, (u8 *)encap - skb->data); 395 393 skb_reset_network_header(skb); 396 394 skb->dev = reg_dev; 397 - skb->protocol = htons(ETH_P_IP); 395 + skb->protocol = htons(ETH_P_IPV6); 398 396 skb->ip_summed = 0; 399 397 skb->pkt_type = PACKET_HOST; 400 398 dst_release(skb->dst); ··· 483 481 { 484 482 struct mif_device *v; 485 483 struct net_device *dev; 484 + struct inet6_dev *in6_dev; 486 485 if (vifi < 0 || vifi >= net->ipv6.maxvif) 487 486 return -EADDRNOTAVAIL; 488 487 ··· 515 512 write_unlock_bh(&mrt_lock); 516 513 517 514 dev_set_allmulti(dev, -1); 515 + 516 + in6_dev = __in6_dev_get(dev); 517 + if (in6_dev) 518 + in6_dev->cnf.mc_forwarding--; 518 519 519 520 if (v->flags & MIFF_REGISTER) 520 521 unregister_netdevice(dev); ··· 629 622 int vifi = vifc->mif6c_mifi; 630 623 struct mif_device *v = &net->ipv6.vif6_table[vifi]; 631 624 struct net_device *dev; 625 + struct inet6_dev *in6_dev; 632 626 int err; 633 627 634 628 /* Is vif busy ? */ ··· 669 661 default: 670 662 return -EINVAL; 671 663 } 664 + 665 + in6_dev = __in6_dev_get(dev); 666 + if (in6_dev) 667 + in6_dev->cnf.mc_forwarding++; 672 668 673 669 /* 674 670 * Fill in the VIF structures ··· 850 838 851 839 skb->dst = dst_clone(pkt->dst); 852 840 skb->ip_summed = CHECKSUM_UNNECESSARY; 853 - 854 - skb_pull(skb, sizeof(struct ipv6hdr)); 855 841 } 856 842 857 843 if (net->ipv6.mroute6_sk == NULL) { ··· 1232 1222 1233 1223 rtnl_lock(); 1234 1224 write_lock_bh(&mrt_lock); 1235 - if (likely(net->ipv6.mroute6_sk == NULL)) 1225 + if (likely(net->ipv6.mroute6_sk == NULL)) { 1236 1226 net->ipv6.mroute6_sk = sk; 1227 + net->ipv6.devconf_all->mc_forwarding++; 1228 + } 1237 1229 else 1238 1230 err = -EADDRINUSE; 1239 1231 write_unlock_bh(&mrt_lock); ··· 1254 1242 if (sk == net->ipv6.mroute6_sk) { 1255 1243 write_lock_bh(&mrt_lock); 1256 1244 net->ipv6.mroute6_sk = NULL; 1245 + net->ipv6.devconf_all->mc_forwarding--; 1257 1246 write_unlock_bh(&mrt_lock); 1258 1247 1259 1248 mroute_clean_tables(net);
+1 -1
net/ipv6/route.c
··· 794 794 .proto = iph->nexthdr, 795 795 }; 796 796 797 - if (rt6_need_strict(&iph->daddr)) 797 + if (rt6_need_strict(&iph->daddr) && skb->dev->type != ARPHRD_PIMREG) 798 798 flags |= RT6_LOOKUP_F_IFACE; 799 799 800 800 skb->dst = fib6_rule_lookup(net, &fl, flags, ip6_pol_route_input);
+7 -2
net/packet/af_packet.c
··· 77 77 #include <linux/poll.h> 78 78 #include <linux/module.h> 79 79 #include <linux/init.h> 80 + #include <linux/mutex.h> 80 81 81 82 #ifdef CONFIG_INET 82 83 #include <net/inet_common.h> ··· 176 175 #endif 177 176 struct packet_type prot_hook; 178 177 spinlock_t bind_lock; 178 + struct mutex pg_vec_lock; 179 179 unsigned int running:1, /* prot_hook is attached*/ 180 180 auxdata:1, 181 181 origdev:1; ··· 1071 1069 */ 1072 1070 1073 1071 spin_lock_init(&po->bind_lock); 1072 + mutex_init(&po->pg_vec_lock); 1074 1073 po->prot_hook.func = packet_rcv; 1075 1074 1076 1075 if (sock->type == SOCK_PACKET) ··· 1868 1865 synchronize_net(); 1869 1866 1870 1867 err = -EBUSY; 1868 + mutex_lock(&po->pg_vec_lock); 1871 1869 if (closing || atomic_read(&po->mapped) == 0) { 1872 1870 err = 0; 1873 1871 #define XC(a, b) ({ __typeof__ ((a)) __t; __t = (a); (a) = (b); __t; }) ··· 1890 1886 if (atomic_read(&po->mapped)) 1891 1887 printk(KERN_DEBUG "packet_mmap: vma is busy: %d\n", atomic_read(&po->mapped)); 1892 1888 } 1889 + mutex_unlock(&po->pg_vec_lock); 1893 1890 1894 1891 spin_lock(&po->bind_lock); 1895 1892 if (was_running && !po->running) { ··· 1923 1918 1924 1919 size = vma->vm_end - vma->vm_start; 1925 1920 1926 - lock_sock(sk); 1921 + mutex_lock(&po->pg_vec_lock); 1927 1922 if (po->pg_vec == NULL) 1928 1923 goto out; 1929 1924 if (size != po->pg_vec_len*po->pg_vec_pages*PAGE_SIZE) ··· 1946 1941 err = 0; 1947 1942 1948 1943 out: 1949 - release_sock(sk); 1944 + mutex_unlock(&po->pg_vec_lock); 1950 1945 return err; 1951 1946 } 1952 1947 #endif
-11
net/wimax/debugfs.c
··· 28 28 #include "debug-levels.h" 29 29 30 30 31 - /* Debug framework control of debug levels */ 32 - struct d_level D_LEVEL[] = { 33 - D_SUBMODULE_DEFINE(debugfs), 34 - D_SUBMODULE_DEFINE(id_table), 35 - D_SUBMODULE_DEFINE(op_msg), 36 - D_SUBMODULE_DEFINE(op_reset), 37 - D_SUBMODULE_DEFINE(op_rfkill), 38 - D_SUBMODULE_DEFINE(stack), 39 - }; 40 - size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL); 41 - 42 31 #define __debugfs_register(prefix, name, parent) \ 43 32 do { \ 44 33 result = d_level_register_debugfs(prefix, name, parent); \
+13
net/wimax/stack.c
··· 516 516 } 517 517 EXPORT_SYMBOL_GPL(wimax_dev_rm); 518 518 519 + 520 + /* Debug framework control of debug levels */ 521 + struct d_level D_LEVEL[] = { 522 + D_SUBMODULE_DEFINE(debugfs), 523 + D_SUBMODULE_DEFINE(id_table), 524 + D_SUBMODULE_DEFINE(op_msg), 525 + D_SUBMODULE_DEFINE(op_reset), 526 + D_SUBMODULE_DEFINE(op_rfkill), 527 + D_SUBMODULE_DEFINE(stack), 528 + }; 529 + size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL); 530 + 531 + 519 532 struct genl_family wimax_gnl_family = { 520 533 .id = GENL_ID_GENERATE, 521 534 .name = "WiMAX",
+20 -12
net/wireless/reg.c
··· 498 498 * calculate the number of reg rules we will need. We will need one 499 499 * for each channel subband */ 500 500 while (country_ie_len >= 3) { 501 + int end_channel = 0; 501 502 struct ieee80211_country_ie_triplet *triplet = 502 503 (struct ieee80211_country_ie_triplet *) country_ie; 503 504 int cur_sub_max_channel = 0, cur_channel = 0; ··· 510 509 continue; 511 510 } 512 511 512 + /* 2 GHz */ 513 + if (triplet->chans.first_channel <= 14) 514 + end_channel = triplet->chans.first_channel + 515 + triplet->chans.num_channels; 516 + else 517 + /* 518 + * 5 GHz -- For example in country IEs if the first 519 + * channel given is 36 and the number of channels is 4 520 + * then the individual channel numbers defined for the 521 + * 5 GHz PHY by these parameters are: 36, 40, 44, and 48 522 + * and not 36, 37, 38, 39. 523 + * 524 + * See: http://tinyurl.com/11d-clarification 525 + */ 526 + end_channel = triplet->chans.first_channel + 527 + (4 * (triplet->chans.num_channels - 1)); 528 + 513 529 cur_channel = triplet->chans.first_channel; 514 - cur_sub_max_channel = ieee80211_channel_to_frequency( 515 - cur_channel + triplet->chans.num_channels); 530 + cur_sub_max_channel = end_channel; 516 531 517 532 /* Basic sanity check */ 518 533 if (cur_sub_max_channel < cur_channel) ··· 607 590 end_channel = triplet->chans.first_channel + 608 591 triplet->chans.num_channels; 609 592 else 610 - /* 611 - * 5 GHz -- For example in country IEs if the first 612 - * channel given is 36 and the number of channels is 4 613 - * then the individual channel numbers defined for the 614 - * 5 GHz PHY by these parameters are: 36, 40, 44, and 48 615 - * and not 36, 37, 38, 39. 616 - * 617 - * See: http://tinyurl.com/11d-clarification 618 - */ 619 593 end_channel = triplet->chans.first_channel + 620 594 (4 * (triplet->chans.num_channels - 1)); 621 595 ··· 1284 1276 if (intersected_rd) { 1285 1277 printk(KERN_DEBUG "cfg80211: We intersect both of these " 1286 1278 "and get:\n"); 1287 - print_regdomain_info(rd); 1279 + print_regdomain_info(intersected_rd); 1288 1280 return; 1289 1281 } 1290 1282 printk(KERN_DEBUG "cfg80211: Intersection between both failed\n");