From d046f06f2e61f95d0fe4a26aa55ab2c63e91b0fe Mon Sep 17 00:00:00 2001 From: Jesse Brandeburg Date: Fri, 4 Nov 2011 05:47:06 +0000 Subject: [PATCH] --- yaml --- r: 277568 b: refs/heads/master c: ef9b965a1c4ebd0f0ee961dbc328e1222dc8f487 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/ieee802154/fakehard.c | 2 +- trunk/drivers/infiniband/hw/nes/nes_nic.c | 6 +- .../drivers/infiniband/ulp/ipoib/ipoib_main.c | 2 +- trunk/drivers/lguest/lguest_device.c | 6 - trunk/drivers/misc/sgi-xp/xpnet.c | 2 +- trunk/drivers/net/bonding/bond_main.c | 11 +- trunk/drivers/net/can/dev.c | 2 +- trunk/drivers/net/can/slcan.c | 2 +- trunk/drivers/net/dummy.c | 2 +- trunk/drivers/net/ethernet/amd/nmclan_cs.c | 7 +- .../net/ethernet/atheros/atl1c/atl1c_main.c | 13 +- .../net/ethernet/atheros/atl1e/atl1e_main.c | 13 +- .../drivers/net/ethernet/atheros/atlx/atl2.c | 13 +- .../drivers/net/ethernet/atheros/atlx/atlx.c | 13 +- trunk/drivers/net/ethernet/broadcom/bnx2.c | 6 +- .../net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 5 +- .../net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | 5 +- trunk/drivers/net/ethernet/broadcom/tg3.c | 11 +- .../drivers/net/ethernet/chelsio/cxgb/cxgb2.c | 7 +- trunk/drivers/net/ethernet/chelsio/cxgb/sge.c | 2 +- trunk/drivers/net/ethernet/chelsio/cxgb/sge.h | 2 +- .../net/ethernet/chelsio/cxgb3/cxgb3_main.c | 9 +- .../net/ethernet/chelsio/cxgb4/cxgb4_main.c | 12 +- .../ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 8 +- trunk/drivers/net/ethernet/davicom/dm9000.c | 5 +- .../net/ethernet/emulex/benet/be_cmds.c | 65 +- .../net/ethernet/emulex/benet/be_cmds.h | 36 -- .../net/ethernet/emulex/benet/be_ethtool.c | 95 +-- .../net/ethernet/emulex/benet/be_main.c | 15 +- .../drivers/net/ethernet/freescale/gianfar.c | 2 +- .../drivers/net/ethernet/freescale/gianfar.h | 4 +- .../net/ethernet/freescale/gianfar_ethtool.c | 4 +- .../drivers/net/ethernet/fujitsu/fmvj18x_cs.c | 7 +- trunk/drivers/net/ethernet/ibm/ibmveth.c | 6 +- .../net/ethernet/intel/e1000/e1000_main.c | 14 +- .../net/ethernet/intel/e1000e/ethtool.c | 2 +- .../net/ethernet/intel/e1000e/netdev.c | 163 +++-- .../drivers/net/ethernet/intel/igb/igb_main.c | 12 +- .../drivers/net/ethernet/intel/igbvf/netdev.c | 3 +- .../net/ethernet/intel/ixgb/ixgb_main.c | 8 +- .../net/ethernet/intel/ixgbe/ixgbe_main.c | 6 +- .../net/ethernet/intel/ixgbevf/ixgbevf_main.c | 3 +- trunk/drivers/net/ethernet/jme.c | 8 +- .../net/ethernet/marvell/mv643xx_eth.c | 4 +- trunk/drivers/net/ethernet/marvell/sky2.c | 13 +- trunk/drivers/net/ethernet/micrel/ksz884x.c | 3 +- .../net/ethernet/myricom/myri10ge/myri10ge.c | 5 +- trunk/drivers/net/ethernet/neterion/s2io.c | 4 +- .../net/ethernet/neterion/vxge/vxge-main.c | 9 +- trunk/drivers/net/ethernet/nvidia/forcedeth.c | 11 +- .../ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 5 +- .../ethernet/qlogic/netxen/netxen_nic_main.c | 6 +- .../net/ethernet/qlogic/qlcnic/qlcnic.h | 5 +- .../net/ethernet/qlogic/qlcnic/qlcnic_hw.c | 9 +- .../net/ethernet/qlogic/qlcnic/qlcnic_main.c | 2 +- .../net/ethernet/qlogic/qlge/qlge_main.c | 10 +- trunk/drivers/net/ethernet/realtek/8139cp.c | 2 +- trunk/drivers/net/ethernet/realtek/r8169.c | 6 +- trunk/drivers/net/ethernet/sfc/efx.c | 2 +- trunk/drivers/net/ethernet/sfc/net_driver.h | 2 +- trunk/drivers/net/ethernet/smsc/smc91c92_cs.c | 4 +- .../ethernet/stmicro/stmmac/stmmac_ethtool.c | 5 +- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +- trunk/drivers/net/ifb.c | 2 +- trunk/drivers/net/loopback.c | 2 +- trunk/drivers/net/phy/mdio-bitbang.c | 9 - trunk/drivers/net/phy/mdio-gpio.c | 1 - trunk/drivers/net/team/team.c | 119 +--- .../drivers/net/team/team_mode_activebackup.c | 5 +- trunk/drivers/net/tun.c | 17 +- trunk/drivers/net/usb/smsc75xx.c | 3 +- trunk/drivers/net/usb/smsc95xx.c | 3 +- trunk/drivers/net/veth.c | 8 +- trunk/drivers/net/virtio_net.c | 15 - trunk/drivers/net/vmxnet3/vmxnet3_ethtool.c | 4 +- trunk/drivers/net/vmxnet3/vmxnet3_int.h | 2 +- trunk/drivers/net/xen-netback/interface.c | 3 +- trunk/drivers/net/xen-netfront.c | 8 +- trunk/drivers/s390/kvm/kvm_virtio.c | 6 - trunk/drivers/s390/net/qeth_l3_main.c | 6 +- trunk/drivers/virtio/virtio_mmio.c | 6 - trunk/drivers/virtio/virtio_pci.c | 8 - trunk/include/linux/ethtool.h | 53 ++ trunk/include/linux/if_team.h | 10 +- trunk/include/linux/mdio-bitbang.h | 2 - trunk/include/linux/mdio-gpio.h | 2 - trunk/include/linux/netdev_features.h | 146 ----- trunk/include/linux/netdevice.h | 137 ++++- trunk/include/linux/skbuff.h | 5 +- trunk/include/linux/virtio_config.h | 14 - trunk/include/net/protocol.h | 4 +- trunk/include/net/sock.h | 6 +- trunk/include/net/tcp.h | 3 +- trunk/include/net/udp.h | 3 +- trunk/lib/vsprintf.c | 19 - trunk/net/8021q/vlan_dev.c | 9 +- trunk/net/bridge/br_device.c | 7 +- trunk/net/bridge/br_if.c | 5 +- trunk/net/bridge/br_private.h | 3 +- trunk/net/core/dev.c | 103 ++-- trunk/net/core/ethtool.c | 555 ++++++++++++++---- trunk/net/core/skbuff.c | 2 +- trunk/net/ieee802154/6lowpan.c | 3 + trunk/net/ipv4/af_inet.c | 3 +- trunk/net/ipv4/tcp.c | 3 +- trunk/net/ipv4/udp.c | 3 +- trunk/net/ipv6/af_inet6.c | 3 +- trunk/net/ipv6/udp.c | 3 +- 109 files changed, 1054 insertions(+), 1010 deletions(-) delete mode 100644 trunk/include/linux/netdev_features.h diff --git a/[refs] b/[refs] index c3b4c6e5f69c..672cbc4ee4c1 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 358b838291f618278080bbed435b755f9b46748e +refs/heads/master: ef9b965a1c4ebd0f0ee961dbc328e1222dc8f487 diff --git a/trunk/drivers/ieee802154/fakehard.c b/trunk/drivers/ieee802154/fakehard.c index 73d453159408..eb0e2ccc79ae 100644 --- a/trunk/drivers/ieee802154/fakehard.c +++ b/trunk/drivers/ieee802154/fakehard.c @@ -343,7 +343,7 @@ static void ieee802154_fake_setup(struct net_device *dev) { dev->addr_len = IEEE802154_ADDR_LEN; memset(dev->broadcast, 0xff, IEEE802154_ADDR_LEN); - dev->features = NETIF_F_HW_CSUM; + dev->features = NETIF_F_NO_CSUM; dev->needed_tailroom = 2; /* FCS */ dev->mtu = 127; dev->tx_queue_len = 10; diff --git a/trunk/drivers/infiniband/hw/nes/nes_nic.c b/trunk/drivers/infiniband/hw/nes/nes_nic.c index 4b3fa711a247..c00d2f3f8966 100644 --- a/trunk/drivers/infiniband/hw/nes/nes_nic.c +++ b/trunk/drivers/infiniband/hw/nes/nes_nic.c @@ -1589,7 +1589,7 @@ static const struct ethtool_ops nes_ethtool_ops = { .set_pauseparam = nes_netdev_set_pauseparam, }; -static void nes_vlan_mode(struct net_device *netdev, struct nes_device *nesdev, netdev_features_t features) +static void nes_vlan_mode(struct net_device *netdev, struct nes_device *nesdev, u32 features) { struct nes_adapter *nesadapter = nesdev->nesadapter; u32 u32temp; @@ -1610,7 +1610,7 @@ static void nes_vlan_mode(struct net_device *netdev, struct nes_device *nesdev, spin_unlock_irqrestore(&nesadapter->phy_lock, flags); } -static netdev_features_t nes_fix_features(struct net_device *netdev, netdev_features_t features) +static u32 nes_fix_features(struct net_device *netdev, u32 features) { /* * Since there is no support for separate rx/tx vlan accel @@ -1624,7 +1624,7 @@ static netdev_features_t nes_fix_features(struct net_device *netdev, netdev_feat return features; } -static int nes_set_features(struct net_device *netdev, netdev_features_t features) +static int nes_set_features(struct net_device *netdev, u32 features) { struct nes_vnic *nesvnic = netdev_priv(netdev); struct nes_device *nesdev = nesvnic->nesdev; diff --git a/trunk/drivers/infiniband/ulp/ipoib/ipoib_main.c b/trunk/drivers/infiniband/ulp/ipoib/ipoib_main.c index efd7a9636aff..7567b6000230 100644 --- a/trunk/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/trunk/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -171,7 +171,7 @@ static int ipoib_stop(struct net_device *dev) return 0; } -static netdev_features_t ipoib_fix_features(struct net_device *dev, netdev_features_t features) +static u32 ipoib_fix_features(struct net_device *dev, u32 features) { struct ipoib_dev_priv *priv = netdev_priv(dev); diff --git a/trunk/drivers/lguest/lguest_device.c b/trunk/drivers/lguest/lguest_device.c index 595d73197016..0dc30ffde5ad 100644 --- a/trunk/drivers/lguest/lguest_device.c +++ b/trunk/drivers/lguest/lguest_device.c @@ -381,11 +381,6 @@ static int lg_find_vqs(struct virtio_device *vdev, unsigned nvqs, return PTR_ERR(vqs[i]); } -static const char *lg_bus_name(struct virtio_device *vdev) -{ - return ""; -} - /* The ops structure which hooks everything together. */ static struct virtio_config_ops lguest_config_ops = { .get_features = lg_get_features, @@ -397,7 +392,6 @@ static struct virtio_config_ops lguest_config_ops = { .reset = lg_reset, .find_vqs = lg_find_vqs, .del_vqs = lg_del_vqs, - .bus_name = lg_bus_name, }; /* diff --git a/trunk/drivers/misc/sgi-xp/xpnet.c b/trunk/drivers/misc/sgi-xp/xpnet.c index 3fac67a5204c..42f067347bc7 100644 --- a/trunk/drivers/misc/sgi-xp/xpnet.c +++ b/trunk/drivers/misc/sgi-xp/xpnet.c @@ -576,7 +576,7 @@ xpnet_init(void) * report an error if the data is not retrievable and the * packet will be dropped. */ - xpnet_device->features = NETIF_F_HW_CSUM; + xpnet_device->features = NETIF_F_NO_CSUM; result = register_netdev(xpnet_device); if (result != 0) { diff --git a/trunk/drivers/net/bonding/bond_main.c b/trunk/drivers/net/bonding/bond_main.c index 25a44d94be17..b0c577256487 100644 --- a/trunk/drivers/net/bonding/bond_main.c +++ b/trunk/drivers/net/bonding/bond_main.c @@ -1325,12 +1325,11 @@ static int bond_sethwaddr(struct net_device *bond_dev, return 0; } -static netdev_features_t bond_fix_features(struct net_device *dev, - netdev_features_t features) +static u32 bond_fix_features(struct net_device *dev, u32 features) { struct slave *slave; struct bonding *bond = netdev_priv(dev); - netdev_features_t mask; + u32 mask; int i; read_lock(&bond->lock); @@ -1364,7 +1363,7 @@ static void bond_compute_features(struct bonding *bond) { struct slave *slave; struct net_device *bond_dev = bond->dev; - netdev_features_t vlan_features = BOND_VLAN_FEATURES; + u32 vlan_features = BOND_VLAN_FEATURES; unsigned short max_hard_header_len = ETH_HLEN; int i; @@ -1898,7 +1897,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) struct bonding *bond = netdev_priv(bond_dev); struct slave *slave, *oldcurrent; struct sockaddr addr; - netdev_features_t old_features = bond_dev->features; + u32 old_features = bond_dev->features; /* slave is not a slave or master is not master of this slave */ if (!(slave_dev->flags & IFF_SLAVE) || @@ -4361,7 +4360,7 @@ static void bond_setup(struct net_device *bond_dev) NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER; - bond_dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_HW_CSUM); + bond_dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_NO_CSUM); bond_dev->features |= bond_dev->hw_features; } diff --git a/trunk/drivers/net/can/dev.c b/trunk/drivers/net/can/dev.c index 120f1ab5a2ce..25695bde0549 100644 --- a/trunk/drivers/net/can/dev.c +++ b/trunk/drivers/net/can/dev.c @@ -454,7 +454,7 @@ static void can_setup(struct net_device *dev) /* New-style flags. */ dev->flags = IFF_NOARP; - dev->features = NETIF_F_HW_CSUM; + dev->features = NETIF_F_NO_CSUM; } struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf) diff --git a/trunk/drivers/net/can/slcan.c b/trunk/drivers/net/can/slcan.c index 3f1ebcc2cb83..a979b006f459 100644 --- a/trunk/drivers/net/can/slcan.c +++ b/trunk/drivers/net/can/slcan.c @@ -387,7 +387,7 @@ static void slc_setup(struct net_device *dev) /* New-style flags. */ dev->flags = IFF_NOARP; - dev->features = NETIF_F_HW_CSUM; + dev->features = NETIF_F_NO_CSUM; } /****************************************** diff --git a/trunk/drivers/net/dummy.c b/trunk/drivers/net/dummy.c index 087648ea1edb..a7c5e8831e8c 100644 --- a/trunk/drivers/net/dummy.c +++ b/trunk/drivers/net/dummy.c @@ -134,7 +134,7 @@ static void dummy_setup(struct net_device *dev) dev->flags |= IFF_NOARP; dev->flags &= ~IFF_MULTICAST; dev->features |= NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO; - dev->features |= NETIF_F_HW_CSUM | NETIF_F_HIGHDMA | NETIF_F_LLTX; + dev->features |= NETIF_F_NO_CSUM | NETIF_F_HIGHDMA | NETIF_F_LLTX; random_ether_addr(dev->dev_addr); } diff --git a/trunk/drivers/net/ethernet/amd/nmclan_cs.c b/trunk/drivers/net/ethernet/amd/nmclan_cs.c index 3d7be5aa49eb..3accd5d21b08 100644 --- a/trunk/drivers/net/ethernet/amd/nmclan_cs.c +++ b/trunk/drivers/net/ethernet/amd/nmclan_cs.c @@ -822,10 +822,9 @@ static int mace_close(struct net_device *dev) static void netdev_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { - strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); - strlcpy(info->version, DRV_VERSION, sizeof(info->version)); - snprintf(info->bus_info, sizeof(info->bus_info), - "PCMCIA 0x%lx", dev->base_addr); + strcpy(info->driver, DRV_NAME); + strcpy(info->version, DRV_VERSION); + sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr); } static const struct ethtool_ops netdev_ethtool_ops = { diff --git a/trunk/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/trunk/drivers/net/ethernet/atheros/atl1c/atl1c_main.c index b8591246eb4c..02c7ed8d9eca 100644 --- a/trunk/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +++ b/trunk/drivers/net/ethernet/atheros/atl1c/atl1c_main.c @@ -411,7 +411,7 @@ static void atl1c_set_multi(struct net_device *netdev) } } -static void __atl1c_vlan_mode(netdev_features_t features, u32 *mac_ctrl_data) +static void __atl1c_vlan_mode(u32 features, u32 *mac_ctrl_data) { if (features & NETIF_F_HW_VLAN_RX) { /* enable VLAN tag insert/strip */ @@ -422,8 +422,7 @@ static void __atl1c_vlan_mode(netdev_features_t features, u32 *mac_ctrl_data) } } -static void atl1c_vlan_mode(struct net_device *netdev, - netdev_features_t features) +static void atl1c_vlan_mode(struct net_device *netdev, u32 features) { struct atl1c_adapter *adapter = netdev_priv(netdev); struct pci_dev *pdev = adapter->pdev; @@ -483,8 +482,7 @@ static void atl1c_set_rxbufsize(struct atl1c_adapter *adapter, roundup(mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN, 8) : AT_RX_BUF_SIZE; } -static netdev_features_t atl1c_fix_features(struct net_device *netdev, - netdev_features_t features) +static u32 atl1c_fix_features(struct net_device *netdev, u32 features) { /* * Since there is no support for separate rx/tx vlan accel @@ -501,10 +499,9 @@ static netdev_features_t atl1c_fix_features(struct net_device *netdev, return features; } -static int atl1c_set_features(struct net_device *netdev, - netdev_features_t features) +static int atl1c_set_features(struct net_device *netdev, u32 features) { - netdev_features_t changed = netdev->features ^ features; + u32 changed = netdev->features ^ features; if (changed & NETIF_F_HW_VLAN_RX) atl1c_vlan_mode(netdev, features); diff --git a/trunk/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/trunk/drivers/net/ethernet/atheros/atl1e/atl1e_main.c index c915c0873810..95483bcac1d0 100644 --- a/trunk/drivers/net/ethernet/atheros/atl1e/atl1e_main.c +++ b/trunk/drivers/net/ethernet/atheros/atl1e/atl1e_main.c @@ -313,7 +313,7 @@ static void atl1e_set_multi(struct net_device *netdev) } } -static void __atl1e_vlan_mode(netdev_features_t features, u32 *mac_ctrl_data) +static void __atl1e_vlan_mode(u32 features, u32 *mac_ctrl_data) { if (features & NETIF_F_HW_VLAN_RX) { /* enable VLAN tag insert/strip */ @@ -324,8 +324,7 @@ static void __atl1e_vlan_mode(netdev_features_t features, u32 *mac_ctrl_data) } } -static void atl1e_vlan_mode(struct net_device *netdev, - netdev_features_t features) +static void atl1e_vlan_mode(struct net_device *netdev, u32 features) { struct atl1e_adapter *adapter = netdev_priv(netdev); u32 mac_ctrl_data = 0; @@ -371,8 +370,7 @@ static int atl1e_set_mac_addr(struct net_device *netdev, void *p) return 0; } -static netdev_features_t atl1e_fix_features(struct net_device *netdev, - netdev_features_t features) +static u32 atl1e_fix_features(struct net_device *netdev, u32 features) { /* * Since there is no support for separate rx/tx vlan accel @@ -386,10 +384,9 @@ static netdev_features_t atl1e_fix_features(struct net_device *netdev, return features; } -static int atl1e_set_features(struct net_device *netdev, - netdev_features_t features) +static int atl1e_set_features(struct net_device *netdev, u32 features) { - netdev_features_t changed = netdev->features ^ features; + u32 changed = netdev->features ^ features; if (changed & NETIF_F_HW_VLAN_RX) atl1e_vlan_mode(netdev, features); diff --git a/trunk/drivers/net/ethernet/atheros/atlx/atl2.c b/trunk/drivers/net/ethernet/atheros/atlx/atl2.c index 071f4c858969..db3f43046d32 100644 --- a/trunk/drivers/net/ethernet/atheros/atlx/atl2.c +++ b/trunk/drivers/net/ethernet/atheros/atlx/atl2.c @@ -361,7 +361,7 @@ static inline void atl2_irq_disable(struct atl2_adapter *adapter) synchronize_irq(adapter->pdev->irq); } -static void __atl2_vlan_mode(netdev_features_t features, u32 *ctrl) +static void __atl2_vlan_mode(u32 features, u32 *ctrl) { if (features & NETIF_F_HW_VLAN_RX) { /* enable VLAN tag insert/strip */ @@ -372,8 +372,7 @@ static void __atl2_vlan_mode(netdev_features_t features, u32 *ctrl) } } -static void atl2_vlan_mode(struct net_device *netdev, - netdev_features_t features) +static void atl2_vlan_mode(struct net_device *netdev, u32 features) { struct atl2_adapter *adapter = netdev_priv(netdev); u32 ctrl; @@ -392,8 +391,7 @@ static void atl2_restore_vlan(struct atl2_adapter *adapter) atl2_vlan_mode(adapter->netdev, adapter->netdev->features); } -static netdev_features_t atl2_fix_features(struct net_device *netdev, - netdev_features_t features) +static u32 atl2_fix_features(struct net_device *netdev, u32 features) { /* * Since there is no support for separate rx/tx vlan accel @@ -407,10 +405,9 @@ static netdev_features_t atl2_fix_features(struct net_device *netdev, return features; } -static int atl2_set_features(struct net_device *netdev, - netdev_features_t features) +static int atl2_set_features(struct net_device *netdev, u32 features) { - netdev_features_t changed = netdev->features ^ features; + u32 changed = netdev->features ^ features; if (changed & NETIF_F_HW_VLAN_RX) atl2_vlan_mode(netdev, features); diff --git a/trunk/drivers/net/ethernet/atheros/atlx/atlx.c b/trunk/drivers/net/ethernet/atheros/atlx/atlx.c index 8ff7411094d5..aabcf4b5745a 100644 --- a/trunk/drivers/net/ethernet/atheros/atlx/atlx.c +++ b/trunk/drivers/net/ethernet/atheros/atlx/atlx.c @@ -211,7 +211,7 @@ static void atlx_link_chg_task(struct work_struct *work) spin_unlock_irqrestore(&adapter->lock, flags); } -static void __atlx_vlan_mode(netdev_features_t features, u32 *ctrl) +static void __atlx_vlan_mode(u32 features, u32 *ctrl) { if (features & NETIF_F_HW_VLAN_RX) { /* enable VLAN tag insert/strip */ @@ -222,8 +222,7 @@ static void __atlx_vlan_mode(netdev_features_t features, u32 *ctrl) } } -static void atlx_vlan_mode(struct net_device *netdev, - netdev_features_t features) +static void atlx_vlan_mode(struct net_device *netdev, u32 features) { struct atlx_adapter *adapter = netdev_priv(netdev); unsigned long flags; @@ -243,8 +242,7 @@ static void atlx_restore_vlan(struct atlx_adapter *adapter) atlx_vlan_mode(adapter->netdev, adapter->netdev->features); } -static netdev_features_t atlx_fix_features(struct net_device *netdev, - netdev_features_t features) +static u32 atlx_fix_features(struct net_device *netdev, u32 features) { /* * Since there is no support for separate rx/tx vlan accel @@ -258,10 +256,9 @@ static netdev_features_t atlx_fix_features(struct net_device *netdev, return features; } -static int atlx_set_features(struct net_device *netdev, - netdev_features_t features) +static int atlx_set_features(struct net_device *netdev, u32 features) { - netdev_features_t changed = netdev->features ^ features; + u32 changed = netdev->features ^ features; if (changed & NETIF_F_HW_VLAN_RX) atlx_vlan_mode(netdev, features); diff --git a/trunk/drivers/net/ethernet/broadcom/bnx2.c b/trunk/drivers/net/ethernet/broadcom/bnx2.c index 7203f37d2ef3..32d1f92a2479 100644 --- a/trunk/drivers/net/ethernet/broadcom/bnx2.c +++ b/trunk/drivers/net/ethernet/broadcom/bnx2.c @@ -7571,8 +7571,8 @@ bnx2_set_phys_id(struct net_device *dev, enum ethtool_phys_id_state state) return 0; } -static netdev_features_t -bnx2_fix_features(struct net_device *dev, netdev_features_t features) +static u32 +bnx2_fix_features(struct net_device *dev, u32 features) { struct bnx2 *bp = netdev_priv(dev); @@ -7583,7 +7583,7 @@ bnx2_fix_features(struct net_device *dev, netdev_features_t features) } static int -bnx2_set_features(struct net_device *dev, netdev_features_t features) +bnx2_set_features(struct net_device *dev, u32 features) { struct bnx2 *bp = netdev_priv(dev); diff --git a/trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index 8336c784db49..0d60b9e633ad 100644 --- a/trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c @@ -3398,8 +3398,7 @@ int bnx2x_change_mtu(struct net_device *dev, int new_mtu) return bnx2x_reload_if_running(dev); } -netdev_features_t bnx2x_fix_features(struct net_device *dev, - netdev_features_t features) +u32 bnx2x_fix_features(struct net_device *dev, u32 features) { struct bnx2x *bp = netdev_priv(dev); @@ -3410,7 +3409,7 @@ netdev_features_t bnx2x_fix_features(struct net_device *dev, return features; } -int bnx2x_set_features(struct net_device *dev, netdev_features_t features) +int bnx2x_set_features(struct net_device *dev, u32 features) { struct bnx2x *bp = netdev_priv(dev); u32 flags = bp->flags; diff --git a/trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h index 80c5ed08e419..41eb17e7720f 100644 --- a/trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +++ b/trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h @@ -533,9 +533,8 @@ int bnx2x_change_mtu(struct net_device *dev, int new_mtu); */ int bnx2x_fcoe_get_wwn(struct net_device *dev, u64 *wwn, int type); #endif -netdev_features_t bnx2x_fix_features(struct net_device *dev, - netdev_features_t features); -int bnx2x_set_features(struct net_device *dev, netdev_features_t features); +u32 bnx2x_fix_features(struct net_device *dev, u32 features); +int bnx2x_set_features(struct net_device *dev, u32 features); /** * bnx2x_tx_timeout - tx timeout netdev callback diff --git a/trunk/drivers/net/ethernet/broadcom/tg3.c b/trunk/drivers/net/ethernet/broadcom/tg3.c index 365cd47e2298..cd3623416a4e 100644 --- a/trunk/drivers/net/ethernet/broadcom/tg3.c +++ b/trunk/drivers/net/ethernet/broadcom/tg3.c @@ -6968,7 +6968,7 @@ static int tg3_phy_lpbk_set(struct tg3 *tp, u32 speed, bool extlpbk) return 0; } -static void tg3_set_loopback(struct net_device *dev, netdev_features_t features) +static void tg3_set_loopback(struct net_device *dev, u32 features) { struct tg3 *tp = netdev_priv(dev); @@ -6994,8 +6994,7 @@ static void tg3_set_loopback(struct net_device *dev, netdev_features_t features) } } -static netdev_features_t tg3_fix_features(struct net_device *dev, - netdev_features_t features) +static u32 tg3_fix_features(struct net_device *dev, u32 features) { struct tg3 *tp = netdev_priv(dev); @@ -7005,9 +7004,9 @@ static netdev_features_t tg3_fix_features(struct net_device *dev, return features; } -static int tg3_set_features(struct net_device *dev, netdev_features_t features) +static int tg3_set_features(struct net_device *dev, u32 features) { - netdev_features_t changed = dev->features ^ features; + u32 changed = dev->features ^ features; if ((changed & NETIF_F_LOOPBACK) && netif_running(dev)) tg3_set_loopback(dev, features); @@ -15314,7 +15313,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, u32 sndmbx, rcvmbx, intmbx; char str[40]; u64 dma_mask, persist_dma_mask; - netdev_features_t features = 0; + u32 features = 0; printk_once(KERN_INFO "%s\n", version); diff --git a/trunk/drivers/net/ethernet/chelsio/cxgb/cxgb2.c b/trunk/drivers/net/ethernet/chelsio/cxgb/cxgb2.c index a971796b2262..26d0fd2d9c9d 100644 --- a/trunk/drivers/net/ethernet/chelsio/cxgb/cxgb2.c +++ b/trunk/drivers/net/ethernet/chelsio/cxgb/cxgb2.c @@ -850,8 +850,7 @@ static int t1_set_mac_addr(struct net_device *dev, void *p) return 0; } -static netdev_features_t t1_fix_features(struct net_device *dev, - netdev_features_t features) +static u32 t1_fix_features(struct net_device *dev, u32 features) { /* * Since there is no support for separate rx/tx vlan accel @@ -865,9 +864,9 @@ static netdev_features_t t1_fix_features(struct net_device *dev, return features; } -static int t1_set_features(struct net_device *dev, netdev_features_t features) +static int t1_set_features(struct net_device *dev, u32 features) { - netdev_features_t changed = dev->features ^ features; + u32 changed = dev->features ^ features; struct adapter *adapter = dev->ml_priv; if (changed & NETIF_F_HW_VLAN_RX) diff --git a/trunk/drivers/net/ethernet/chelsio/cxgb/sge.c b/trunk/drivers/net/ethernet/chelsio/cxgb/sge.c index 47a84359d4e4..f9b602300040 100644 --- a/trunk/drivers/net/ethernet/chelsio/cxgb/sge.c +++ b/trunk/drivers/net/ethernet/chelsio/cxgb/sge.c @@ -742,7 +742,7 @@ static inline void setup_ring_params(struct adapter *adapter, u64 addr, /* * Enable/disable VLAN acceleration. */ -void t1_vlan_mode(struct adapter *adapter, netdev_features_t features) +void t1_vlan_mode(struct adapter *adapter, u32 features) { struct sge *sge = adapter->sge; diff --git a/trunk/drivers/net/ethernet/chelsio/cxgb/sge.h b/trunk/drivers/net/ethernet/chelsio/cxgb/sge.h index b9bf16b385f7..e03980bcdd65 100644 --- a/trunk/drivers/net/ethernet/chelsio/cxgb/sge.h +++ b/trunk/drivers/net/ethernet/chelsio/cxgb/sge.h @@ -79,7 +79,7 @@ irqreturn_t t1_interrupt(int irq, void *cookie); int t1_poll(struct napi_struct *, int); netdev_tx_t t1_start_xmit(struct sk_buff *skb, struct net_device *dev); -void t1_vlan_mode(struct adapter *adapter, netdev_features_t features); +void t1_vlan_mode(struct adapter *adapter, u32 features); void t1_sge_start(struct sge *); void t1_sge_stop(struct sge *); int t1_sge_intr_error_handler(struct sge *); diff --git a/trunk/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/trunk/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c index 63ffaa7e255f..053560da6347 100644 --- a/trunk/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c +++ b/trunk/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c @@ -2532,7 +2532,7 @@ static void t3_synchronize_rx(struct adapter *adap, const struct port_info *p) } } -static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features) +static void cxgb_vlan_mode(struct net_device *dev, u32 features) { struct port_info *pi = netdev_priv(dev); struct adapter *adapter = pi->adapter; @@ -2553,8 +2553,7 @@ static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features) t3_synchronize_rx(adapter, pi); } -static netdev_features_t cxgb_fix_features(struct net_device *dev, - netdev_features_t features) +static u32 cxgb_fix_features(struct net_device *dev, u32 features) { /* * Since there is no support for separate rx/tx vlan accel @@ -2568,9 +2567,9 @@ static netdev_features_t cxgb_fix_features(struct net_device *dev, return features; } -static int cxgb_set_features(struct net_device *dev, netdev_features_t features) +static int cxgb_set_features(struct net_device *dev, u32 features) { - netdev_features_t changed = dev->features ^ features; + u32 changed = dev->features ^ features; if (changed & NETIF_F_HW_VLAN_RX) cxgb_vlan_mode(dev, features); diff --git a/trunk/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/trunk/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index fd6d460ea475..48ffe11d9aa9 100644 --- a/trunk/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/trunk/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c @@ -1856,10 +1856,10 @@ static int set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) return err; } -static int cxgb_set_features(struct net_device *dev, netdev_features_t features) +static int cxgb_set_features(struct net_device *dev, u32 features) { const struct port_info *pi = netdev_priv(dev); - netdev_features_t changed = dev->features ^ features; + u32 changed = dev->features ^ features; int err; if (!(changed & NETIF_F_HW_VLAN_RX)) @@ -3538,7 +3538,7 @@ static int __devinit init_one(struct pci_dev *pdev, { int func, i, err; struct port_info *pi; - bool highdma = false; + unsigned int highdma = 0; struct adapter *adapter = NULL; printk_once(KERN_INFO "%s - version %s\n", DRV_DESC, DRV_VERSION); @@ -3564,7 +3564,7 @@ static int __devinit init_one(struct pci_dev *pdev, } if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { - highdma = true; + highdma = NETIF_F_HIGHDMA; err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); if (err) { dev_err(&pdev->dev, "unable to obtain 64-bit DMA for " @@ -3638,9 +3638,7 @@ static int __devinit init_one(struct pci_dev *pdev, NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | NETIF_F_RXHASH | NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; - if (highdma) - netdev->hw_features |= NETIF_F_HIGHDMA; - netdev->features |= netdev->hw_features; + netdev->features |= netdev->hw_features | highdma; netdev->vlan_features = netdev->features & VLAN_FEAT; netdev->priv_flags |= IFF_UNICAST_FLT; diff --git a/trunk/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/trunk/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c index 8155cfecae19..ee81d8e798ea 100644 --- a/trunk/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c +++ b/trunk/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c @@ -1092,8 +1092,7 @@ static int cxgb4vf_change_mtu(struct net_device *dev, int new_mtu) return ret; } -static netdev_features_t cxgb4vf_fix_features(struct net_device *dev, - netdev_features_t features) +static u32 cxgb4vf_fix_features(struct net_device *dev, u32 features) { /* * Since there is no support for separate rx/tx vlan accel @@ -1107,11 +1106,10 @@ static netdev_features_t cxgb4vf_fix_features(struct net_device *dev, return features; } -static int cxgb4vf_set_features(struct net_device *dev, - netdev_features_t features) +static int cxgb4vf_set_features(struct net_device *dev, u32 features) { struct port_info *pi = netdev_priv(dev); - netdev_features_t changed = dev->features ^ features; + u32 changed = dev->features ^ features; if (changed & NETIF_F_HW_VLAN_RX) t4vf_set_rxmode(pi->adapter, pi->viid, -1, -1, -1, -1, diff --git a/trunk/drivers/net/ethernet/davicom/dm9000.c b/trunk/drivers/net/ethernet/davicom/dm9000.c index 26be1dfc1577..438f4580bf66 100644 --- a/trunk/drivers/net/ethernet/davicom/dm9000.c +++ b/trunk/drivers/net/ethernet/davicom/dm9000.c @@ -474,11 +474,10 @@ static int dm9000_nway_reset(struct net_device *dev) return mii_nway_restart(&dm->mii); } -static int dm9000_set_features(struct net_device *dev, - netdev_features_t features) +static int dm9000_set_features(struct net_device *dev, u32 features) { board_info_t *dm = to_dm9000_board(dev); - netdev_features_t changed = dev->features ^ features; + u32 changed = dev->features ^ features; unsigned long flags; if (!(changed & NETIF_F_RXCSUM)) diff --git a/trunk/drivers/net/ethernet/emulex/benet/be_cmds.c b/trunk/drivers/net/ethernet/emulex/benet/be_cmds.c index 64f0c1aa1b09..ad3eef0beea0 100644 --- a/trunk/drivers/net/ethernet/emulex/benet/be_cmds.c +++ b/trunk/drivers/net/ethernet/emulex/benet/be_cmds.c @@ -916,14 +916,10 @@ int be_cmd_txq_create(struct be_adapter *adapter, void *ctxt; int status; - spin_lock_bh(&adapter->mcc_lock); - - wrb = wrb_from_mccq(adapter); - if (!wrb) { - status = -EBUSY; - goto err; - } + if (mutex_lock_interruptible(&adapter->mbox_lock)) + return -1; + wrb = wrb_from_mbox(adapter); req = embedded_payload(wrb); ctxt = &req->context; @@ -949,15 +945,14 @@ int be_cmd_txq_create(struct be_adapter *adapter, be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); - status = be_mcc_notify_wait(adapter); + status = be_mbox_notify_wait(adapter); if (!status) { struct be_cmd_resp_eth_tx_create *resp = embedded_payload(wrb); txq->id = le16_to_cpu(resp->cid); txq->created = true; } -err: - spin_unlock_bh(&adapter->mcc_lock); + mutex_unlock(&adapter->mbox_lock); return status; } @@ -1246,9 +1241,6 @@ int be_cmd_link_status_query(struct be_adapter *adapter, u8 *mac_speed, } req = embedded_payload(wrb); - if (lancer_chip(adapter)) - req->hdr.version = 1; - be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, OPCODE_COMMON_NTWK_LINK_STATUS_QUERY, sizeof(*req), wrb, NULL); @@ -1831,53 +1823,6 @@ int lancer_cmd_write_object(struct be_adapter *adapter, struct be_dma_mem *cmd, return status; } -int lancer_cmd_read_object(struct be_adapter *adapter, struct be_dma_mem *cmd, - u32 data_size, u32 data_offset, const char *obj_name, - u32 *data_read, u32 *eof, u8 *addn_status) -{ - struct be_mcc_wrb *wrb; - struct lancer_cmd_req_read_object *req; - struct lancer_cmd_resp_read_object *resp; - int status; - - spin_lock_bh(&adapter->mcc_lock); - - wrb = wrb_from_mccq(adapter); - if (!wrb) { - status = -EBUSY; - goto err_unlock; - } - - req = embedded_payload(wrb); - - be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, - OPCODE_COMMON_READ_OBJECT, - sizeof(struct lancer_cmd_req_read_object), wrb, - NULL); - - req->desired_read_len = cpu_to_le32(data_size); - req->read_offset = cpu_to_le32(data_offset); - strcpy(req->object_name, obj_name); - req->descriptor_count = cpu_to_le32(1); - req->buf_len = cpu_to_le32(data_size); - req->addr_low = cpu_to_le32((cmd->dma & 0xFFFFFFFF)); - req->addr_high = cpu_to_le32(upper_32_bits(cmd->dma)); - - status = be_mcc_notify_wait(adapter); - - resp = embedded_payload(wrb); - if (!status) { - *data_read = le32_to_cpu(resp->actual_read_len); - *eof = le32_to_cpu(resp->eof); - } else { - *addn_status = resp->additional_status; - } - -err_unlock: - spin_unlock_bh(&adapter->mcc_lock); - return status; -} - int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd, u32 flash_type, u32 flash_opcode, u32 buf_size) { diff --git a/trunk/drivers/net/ethernet/emulex/benet/be_cmds.h b/trunk/drivers/net/ethernet/emulex/benet/be_cmds.h index ac112465e719..08180396891c 100644 --- a/trunk/drivers/net/ethernet/emulex/benet/be_cmds.h +++ b/trunk/drivers/net/ethernet/emulex/benet/be_cmds.h @@ -189,7 +189,6 @@ struct be_mcc_mailbox { #define OPCODE_COMMON_GET_PHY_DETAILS 102 #define OPCODE_COMMON_SET_DRIVER_FUNCTION_CAP 103 #define OPCODE_COMMON_GET_CNTL_ADDITIONAL_ATTRIBUTES 121 -#define OPCODE_COMMON_READ_OBJECT 171 #define OPCODE_COMMON_WRITE_OBJECT 172 #define OPCODE_ETH_RSS_CONFIG 1 @@ -1162,38 +1161,6 @@ struct lancer_cmd_resp_write_object { u32 actual_write_len; }; -/************************ Lancer Read FW info **************/ -#define LANCER_READ_FILE_CHUNK (32*1024) -#define LANCER_READ_FILE_EOF_MASK 0x80000000 - -#define LANCER_FW_DUMP_FILE "/dbg/dump.bin" -#define LANCER_VPD_PF_FILE "/vpd/ntr_pf.vpd" -#define LANCER_VPD_VF_FILE "/vpd/ntr_vf.vpd" - -struct lancer_cmd_req_read_object { - struct be_cmd_req_hdr hdr; - u32 desired_read_len; - u32 read_offset; - u8 object_name[104]; - u32 descriptor_count; - u32 buf_len; - u32 addr_low; - u32 addr_high; -}; - -struct lancer_cmd_resp_read_object { - u8 opcode; - u8 subsystem; - u8 rsvd1[2]; - u8 status; - u8 additional_status; - u8 rsvd2[2]; - u32 resp_len; - u32 actual_resp_len; - u32 actual_read_len; - u32 eof; -}; - /************************ WOL *******************************/ struct be_cmd_req_acpi_wol_magic_config{ struct be_cmd_req_hdr hdr; @@ -1513,9 +1480,6 @@ extern int lancer_cmd_write_object(struct be_adapter *adapter, u32 data_size, u32 data_offset, const char *obj_name, u32 *data_written, u8 *addn_status); -int lancer_cmd_read_object(struct be_adapter *adapter, struct be_dma_mem *cmd, - u32 data_size, u32 data_offset, const char *obj_name, - u32 *data_read, u32 *eof, u8 *addn_status); int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc, int offset); extern int be_cmd_enable_magic_wol(struct be_adapter *adapter, u8 *mac, diff --git a/trunk/drivers/net/ethernet/emulex/benet/be_ethtool.c b/trunk/drivers/net/ethernet/emulex/benet/be_ethtool.c index 575c78306313..1ad7a28fae6a 100644 --- a/trunk/drivers/net/ethernet/emulex/benet/be_ethtool.c +++ b/trunk/drivers/net/ethernet/emulex/benet/be_ethtool.c @@ -143,77 +143,15 @@ static void be_get_drvinfo(struct net_device *netdev, drvinfo->eedump_len = 0; } -static u32 -lancer_cmd_get_file_len(struct be_adapter *adapter, u8 *file_name) -{ - u32 data_read = 0, eof; - u8 addn_status; - struct be_dma_mem data_len_cmd; - int status; - - memset(&data_len_cmd, 0, sizeof(data_len_cmd)); - /* data_offset and data_size should be 0 to get reg len */ - status = lancer_cmd_read_object(adapter, &data_len_cmd, 0, 0, - file_name, &data_read, &eof, &addn_status); - - return data_read; -} - -static int -lancer_cmd_read_file(struct be_adapter *adapter, u8 *file_name, - u32 buf_len, void *buf) -{ - struct be_dma_mem read_cmd; - u32 read_len = 0, total_read_len = 0, chunk_size; - u32 eof = 0; - u8 addn_status; - int status = 0; - - read_cmd.size = LANCER_READ_FILE_CHUNK; - read_cmd.va = pci_alloc_consistent(adapter->pdev, read_cmd.size, - &read_cmd.dma); - - if (!read_cmd.va) { - dev_err(&adapter->pdev->dev, - "Memory allocation failure while reading dump\n"); - return -ENOMEM; - } - - while ((total_read_len < buf_len) && !eof) { - chunk_size = min_t(u32, (buf_len - total_read_len), - LANCER_READ_FILE_CHUNK); - chunk_size = ALIGN(chunk_size, 4); - status = lancer_cmd_read_object(adapter, &read_cmd, chunk_size, - total_read_len, file_name, &read_len, - &eof, &addn_status); - if (!status) { - memcpy(buf + total_read_len, read_cmd.va, read_len); - total_read_len += read_len; - eof &= LANCER_READ_FILE_EOF_MASK; - } else { - status = -EIO; - break; - } - } - pci_free_consistent(adapter->pdev, read_cmd.size, read_cmd.va, - read_cmd.dma); - - return status; -} - static int be_get_reg_len(struct net_device *netdev) { struct be_adapter *adapter = netdev_priv(netdev); u32 log_size = 0; - if (be_physfn(adapter)) { - if (lancer_chip(adapter)) - log_size = lancer_cmd_get_file_len(adapter, - LANCER_FW_DUMP_FILE); - else - be_cmd_get_reg_len(adapter, &log_size); - } + if (be_physfn(adapter)) + be_cmd_get_reg_len(adapter, &log_size); + return log_size; } @@ -224,11 +162,7 @@ be_get_regs(struct net_device *netdev, struct ethtool_regs *regs, void *buf) if (be_physfn(adapter)) { memset(buf, 0, regs->len); - if (lancer_chip(adapter)) - lancer_cmd_read_file(adapter, LANCER_FW_DUMP_FILE, - regs->len, buf); - else - be_cmd_get_regs(adapter, regs->len, buf); + be_cmd_get_regs(adapter, regs->len, buf); } } @@ -727,17 +661,7 @@ be_do_flash(struct net_device *netdev, struct ethtool_flash *efl) static int be_get_eeprom_len(struct net_device *netdev) { - struct be_adapter *adapter = netdev_priv(netdev); - if (lancer_chip(adapter)) { - if (be_physfn(adapter)) - return lancer_cmd_get_file_len(adapter, - LANCER_VPD_PF_FILE); - else - return lancer_cmd_get_file_len(adapter, - LANCER_VPD_VF_FILE); - } else { - return BE_READ_SEEPROM_LEN; - } + return BE_READ_SEEPROM_LEN; } static int @@ -752,15 +676,6 @@ be_read_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom, if (!eeprom->len) return -EINVAL; - if (lancer_chip(adapter)) { - if (be_physfn(adapter)) - return lancer_cmd_read_file(adapter, LANCER_VPD_PF_FILE, - eeprom->len, data); - else - return lancer_cmd_read_file(adapter, LANCER_VPD_VF_FILE, - eeprom->len, data); - } - eeprom->magic = BE_VENDOR_ID | (adapter->pdev->device<<16); memset(&eeprom_cmd, 0, sizeof(struct be_dma_mem)); diff --git a/trunk/drivers/net/ethernet/emulex/benet/be_main.c b/trunk/drivers/net/ethernet/emulex/benet/be_main.c index 93869d457b14..ce20d64d1f95 100644 --- a/trunk/drivers/net/ethernet/emulex/benet/be_main.c +++ b/trunk/drivers/net/ethernet/emulex/benet/be_main.c @@ -1689,6 +1689,9 @@ static int be_tx_queues_create(struct be_adapter *adapter) if (be_queue_alloc(adapter, q, TX_Q_LEN, sizeof(struct be_eth_wrb))) goto err; + + if (be_cmd_txq_create(adapter, q, cq)) + goto err; } return 0; @@ -2569,9 +2572,8 @@ static int be_setup(struct be_adapter *adapter) struct net_device *netdev = adapter->netdev; u32 cap_flags, en_flags; u32 tx_fc, rx_fc; - int status, i; + int status; u8 mac[ETH_ALEN]; - struct be_tx_obj *txo; be_setup_init(adapter); @@ -2600,8 +2602,7 @@ static int be_setup(struct be_adapter *adapter) en_flags = BE_IF_FLAGS_UNTAGGED | BE_IF_FLAGS_BROADCAST | BE_IF_FLAGS_MULTICAST | BE_IF_FLAGS_PASS_L3L4_ERRORS; cap_flags = en_flags | BE_IF_FLAGS_MCAST_PROMISCUOUS | - BE_IF_FLAGS_VLAN_PROMISCUOUS | BE_IF_FLAGS_PROMISCUOUS; - + BE_IF_FLAGS_PROMISCUOUS; if (adapter->function_caps & BE_FUNCTION_CAPS_RSS) { cap_flags |= BE_IF_FLAGS_RSS; en_flags |= BE_IF_FLAGS_RSS; @@ -2612,12 +2613,6 @@ static int be_setup(struct be_adapter *adapter) if (status != 0) goto err; - for_all_tx_queues(adapter, txo, i) { - status = be_cmd_txq_create(adapter, &txo->q, &txo->cq); - if (status) - goto err; - } - /* For BEx, the VF's permanent mac queried from card is incorrect. * Query the mac configued by the PF using if_handle */ diff --git a/trunk/drivers/net/ethernet/freescale/gianfar.c b/trunk/drivers/net/ethernet/freescale/gianfar.c index ff3e8b0f0da3..83199fd0d62b 100644 --- a/trunk/drivers/net/ethernet/freescale/gianfar.c +++ b/trunk/drivers/net/ethernet/freescale/gianfar.c @@ -2306,7 +2306,7 @@ void gfar_check_rx_parser_mode(struct gfar_private *priv) } /* Enables and disables VLAN insertion/extraction */ -void gfar_vlan_mode(struct net_device *dev, netdev_features_t features) +void gfar_vlan_mode(struct net_device *dev, u32 features) { struct gfar_private *priv = netdev_priv(dev); struct gfar __iomem *regs = NULL; diff --git a/trunk/drivers/net/ethernet/freescale/gianfar.h b/trunk/drivers/net/ethernet/freescale/gianfar.h index cda6cb2eb1d2..9aa43773e8e3 100644 --- a/trunk/drivers/net/ethernet/freescale/gianfar.h +++ b/trunk/drivers/net/ethernet/freescale/gianfar.h @@ -1179,9 +1179,9 @@ extern void gfar_phy_test(struct mii_bus *bus, struct phy_device *phydev, extern void gfar_configure_coalescing(struct gfar_private *priv, unsigned long tx_mask, unsigned long rx_mask); void gfar_init_sysfs(struct net_device *dev); -int gfar_set_features(struct net_device *dev, netdev_features_t features); +int gfar_set_features(struct net_device *dev, u32 features); extern void gfar_check_rx_parser_mode(struct gfar_private *priv); -extern void gfar_vlan_mode(struct net_device *dev, netdev_features_t features); +extern void gfar_vlan_mode(struct net_device *dev, u32 features); extern const struct ethtool_ops gfar_ethtool_ops; diff --git a/trunk/drivers/net/ethernet/freescale/gianfar_ethtool.c b/trunk/drivers/net/ethernet/freescale/gianfar_ethtool.c index 1ea0eb9ee643..212736bab6bb 100644 --- a/trunk/drivers/net/ethernet/freescale/gianfar_ethtool.c +++ b/trunk/drivers/net/ethernet/freescale/gianfar_ethtool.c @@ -519,12 +519,12 @@ static int gfar_sringparam(struct net_device *dev, struct ethtool_ringparam *rva return err; } -int gfar_set_features(struct net_device *dev, netdev_features_t features) +int gfar_set_features(struct net_device *dev, u32 features) { struct gfar_private *priv = netdev_priv(dev); unsigned long flags; int err = 0, i = 0; - netdev_features_t changed = dev->features ^ features; + u32 changed = dev->features ^ features; if (changed & (NETIF_F_HW_VLAN_TX|NETIF_F_HW_VLAN_RX)) gfar_vlan_mode(dev, features); diff --git a/trunk/drivers/net/ethernet/fujitsu/fmvj18x_cs.c b/trunk/drivers/net/ethernet/fujitsu/fmvj18x_cs.c index ee84b472cee6..15416752c13e 100644 --- a/trunk/drivers/net/ethernet/fujitsu/fmvj18x_cs.c +++ b/trunk/drivers/net/ethernet/fujitsu/fmvj18x_cs.c @@ -1058,10 +1058,9 @@ static void fjn_rx(struct net_device *dev) static void netdev_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { - strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); - strlcpy(info->version, DRV_VERSION, sizeof(info->version)); - snprintf(info->bus_info, sizeof(info->bus_info), - "PCMCIA 0x%lx", dev->base_addr); + strcpy(info->driver, DRV_NAME); + strcpy(info->version, DRV_VERSION); + sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr); } static const struct ethtool_ops netdev_ethtool_ops = { diff --git a/trunk/drivers/net/ethernet/ibm/ibmveth.c b/trunk/drivers/net/ethernet/ibm/ibmveth.c index e877371680a9..b1cd41b9c61c 100644 --- a/trunk/drivers/net/ethernet/ibm/ibmveth.c +++ b/trunk/drivers/net/ethernet/ibm/ibmveth.c @@ -735,8 +735,7 @@ static void netdev_get_drvinfo(struct net_device *dev, sizeof(info->version) - 1); } -static netdev_features_t ibmveth_fix_features(struct net_device *dev, - netdev_features_t features) +static u32 ibmveth_fix_features(struct net_device *dev, u32 features) { /* * Since the ibmveth firmware interface does not have the @@ -839,8 +838,7 @@ static int ibmveth_set_csum_offload(struct net_device *dev, u32 data) return rc1 ? rc1 : rc2; } -static int ibmveth_set_features(struct net_device *dev, - netdev_features_t features) +static int ibmveth_set_features(struct net_device *dev, u32 features) { struct ibmveth_adapter *adapter = netdev_priv(dev); int rx_csum = !!(features & NETIF_F_RXCSUM); diff --git a/trunk/drivers/net/ethernet/intel/e1000/e1000_main.c b/trunk/drivers/net/ethernet/intel/e1000/e1000_main.c index 82f4ef142259..cf480b554622 100644 --- a/trunk/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/trunk/drivers/net/ethernet/intel/e1000/e1000_main.c @@ -167,8 +167,7 @@ static int e1000_82547_fifo_workaround(struct e1000_adapter *adapter, struct sk_buff *skb); static bool e1000_vlan_used(struct e1000_adapter *adapter); -static void e1000_vlan_mode(struct net_device *netdev, - netdev_features_t features); +static void e1000_vlan_mode(struct net_device *netdev, u32 features); static void e1000_vlan_rx_add_vid(struct net_device *netdev, u16 vid); static void e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid); static void e1000_restore_vlan(struct e1000_adapter *adapter); @@ -807,8 +806,7 @@ static int e1000_is_need_ioport(struct pci_dev *pdev) } } -static netdev_features_t e1000_fix_features(struct net_device *netdev, - netdev_features_t features) +static u32 e1000_fix_features(struct net_device *netdev, u32 features) { /* * Since there is no support for separate rx/tx vlan accel @@ -822,11 +820,10 @@ static netdev_features_t e1000_fix_features(struct net_device *netdev, return features; } -static int e1000_set_features(struct net_device *netdev, - netdev_features_t features) +static int e1000_set_features(struct net_device *netdev, u32 features) { struct e1000_adapter *adapter = netdev_priv(netdev); - netdev_features_t changed = features ^ netdev->features; + u32 changed = features ^ netdev->features; if (changed & NETIF_F_HW_VLAN_RX) e1000_vlan_mode(netdev, features); @@ -4580,8 +4577,7 @@ static void e1000_vlan_filter_on_off(struct e1000_adapter *adapter, e1000_irq_enable(adapter); } -static void e1000_vlan_mode(struct net_device *netdev, - netdev_features_t features) +static void e1000_vlan_mode(struct net_device *netdev, u32 features) { struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_hw *hw = &adapter->hw; diff --git a/trunk/drivers/net/ethernet/intel/e1000e/ethtool.c b/trunk/drivers/net/ethernet/intel/e1000e/ethtool.c index fb2c28e799a2..6d8f0ed33214 100644 --- a/trunk/drivers/net/ethernet/intel/e1000e/ethtool.c +++ b/trunk/drivers/net/ethernet/intel/e1000e/ethtool.c @@ -582,7 +582,7 @@ static void e1000_get_drvinfo(struct net_device *netdev, strlcpy(drvinfo->driver, e1000e_driver_name, sizeof(drvinfo->driver)); - strlcpy(drvinfo->version, e1000e_driver_version, + strncpy(drvinfo->version, e1000e_driver_version, sizeof(drvinfo->version)); /* diff --git a/trunk/drivers/net/ethernet/intel/e1000e/netdev.c b/trunk/drivers/net/ethernet/intel/e1000e/netdev.c index d85fac626a80..80e69d37b3c7 100644 --- a/trunk/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/trunk/drivers/net/ethernet/intel/e1000e/netdev.c @@ -3113,79 +3113,147 @@ static void e1000_configure_rx(struct e1000_adapter *adapter) } /** - * e1000_update_mc_addr_list - Update Multicast addresses - * @hw: pointer to the HW structure - * @mc_addr_list: array of multicast addresses to program - * @mc_addr_count: number of multicast addresses to program + * e1000e_write_mc_addr_list - write multicast addresses to MTA + * @netdev: network interface device structure * - * Updates the Multicast Table Array. - * The caller must have a packed mc_addr_list of multicast addresses. + * Writes multicast address list to the MTA hash table. + * Returns: -ENOMEM on failure + * 0 on no addresses written + * X on writing X addresses to MTA + */ +static int e1000e_write_mc_addr_list(struct net_device *netdev) +{ + struct e1000_adapter *adapter = netdev_priv(netdev); + struct e1000_hw *hw = &adapter->hw; + struct netdev_hw_addr *ha; + u8 *mta_list; + int i; + + if (netdev_mc_empty(netdev)) { + /* nothing to program, so clear mc list */ + hw->mac.ops.update_mc_addr_list(hw, NULL, 0); + return 0; + } + + mta_list = kzalloc(netdev_mc_count(netdev) * ETH_ALEN, GFP_ATOMIC); + if (!mta_list) + return -ENOMEM; + + /* update_mc_addr_list expects a packed array of only addresses. */ + i = 0; + netdev_for_each_mc_addr(ha, netdev) + memcpy(mta_list + (i++ * ETH_ALEN), ha->addr, ETH_ALEN); + + hw->mac.ops.update_mc_addr_list(hw, mta_list, i); + kfree(mta_list); + + return netdev_mc_count(netdev); +} + +/** + * e1000e_write_uc_addr_list - write unicast addresses to RAR table + * @netdev: network interface device structure + * + * Writes unicast address list to the RAR table. + * Returns: -ENOMEM on failure/insufficient address space + * 0 on no addresses written + * X on writing X addresses to the RAR table **/ -static void e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list, - u32 mc_addr_count) +static int e1000e_write_uc_addr_list(struct net_device *netdev) { - hw->mac.ops.update_mc_addr_list(hw, mc_addr_list, mc_addr_count); + struct e1000_adapter *adapter = netdev_priv(netdev); + struct e1000_hw *hw = &adapter->hw; + unsigned int rar_entries = hw->mac.rar_entry_count; + int count = 0; + + /* save a rar entry for our hardware address */ + rar_entries--; + + /* save a rar entry for the LAA workaround */ + if (adapter->flags & FLAG_RESET_OVERWRITES_LAA) + rar_entries--; + + /* return ENOMEM indicating insufficient memory for addresses */ + if (netdev_uc_count(netdev) > rar_entries) + return -ENOMEM; + + if (!netdev_uc_empty(netdev) && rar_entries) { + struct netdev_hw_addr *ha; + + /* + * write the addresses in reverse order to avoid write + * combining + */ + netdev_for_each_uc_addr(ha, netdev) { + if (!rar_entries) + break; + e1000e_rar_set(hw, ha->addr, rar_entries--); + count++; + } + } + + /* zero out the remaining RAR entries not used above */ + for (; rar_entries > 0; rar_entries--) { + ew32(RAH(rar_entries), 0); + ew32(RAL(rar_entries), 0); + } + e1e_flush(); + + return count; } /** - * e1000_set_multi - Multicast and Promiscuous mode set + * e1000e_set_rx_mode - secondary unicast, Multicast and Promiscuous mode set * @netdev: network interface device structure * - * The set_multi entry point is called whenever the multicast address - * list or the network interface flags are updated. This routine is - * responsible for configuring the hardware for proper multicast, + * The ndo_set_rx_mode entry point is called whenever the unicast or multicast + * address list or the network interface flags are updated. This routine is + * responsible for configuring the hardware for proper unicast, multicast, * promiscuous mode, and all-multi behavior. **/ -static void e1000_set_multi(struct net_device *netdev) +static void e1000e_set_rx_mode(struct net_device *netdev) { struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_hw *hw = &adapter->hw; - struct netdev_hw_addr *ha; - u8 *mta_list; u32 rctl; /* Check for Promiscuous and All Multicast modes */ - rctl = er32(RCTL); + /* clear the affected bits */ + rctl &= ~(E1000_RCTL_UPE | E1000_RCTL_MPE); + if (netdev->flags & IFF_PROMISC) { rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); - rctl &= ~E1000_RCTL_VFE; /* Do not hardware filter VLANs in promisc mode */ e1000e_vlan_filter_disable(adapter); } else { + int count; if (netdev->flags & IFF_ALLMULTI) { rctl |= E1000_RCTL_MPE; - rctl &= ~E1000_RCTL_UPE; } else { - rctl &= ~(E1000_RCTL_UPE | E1000_RCTL_MPE); + /* + * Write addresses to the MTA, if the attempt fails + * then we should just turn on promiscuous mode so + * that we can at least receive multicast traffic + */ + count = e1000e_write_mc_addr_list(netdev); + if (count < 0) + rctl |= E1000_RCTL_MPE; } e1000e_vlan_filter_enable(adapter); - } - - ew32(RCTL, rctl); - - if (!netdev_mc_empty(netdev)) { - int i = 0; - - mta_list = kmalloc(netdev_mc_count(netdev) * 6, GFP_ATOMIC); - if (!mta_list) - return; - - /* prepare a packed array of only addresses. */ - netdev_for_each_mc_addr(ha, netdev) - memcpy(mta_list + (i++ * ETH_ALEN), ha->addr, ETH_ALEN); - - e1000_update_mc_addr_list(hw, mta_list, i); - kfree(mta_list); - } else { /* - * if we're called from probe, we might not have - * anything to do here, so clear out the list + * Write addresses to available RAR registers, if there is not + * sufficient space to store all the addresses then enable + * unicast promiscuous mode */ - e1000_update_mc_addr_list(hw, NULL, 0); + count = e1000e_write_uc_addr_list(netdev); + if (count < 0) + rctl |= E1000_RCTL_UPE; } + ew32(RCTL, rctl); + if (netdev->features & NETIF_F_HW_VLAN_RX) e1000e_vlan_strip_enable(adapter); else @@ -3198,7 +3266,7 @@ static void e1000_set_multi(struct net_device *netdev) **/ static void e1000_configure(struct e1000_adapter *adapter) { - e1000_set_multi(adapter->netdev); + e1000e_set_rx_mode(adapter->netdev); e1000_restore_vlan(adapter); e1000_init_manageability_pt(adapter); @@ -5331,7 +5399,7 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake, if (wufc) { e1000_setup_rctl(adapter); - e1000_set_multi(netdev); + e1000e_set_rx_mode(netdev); /* turn on all-multi mode if wake on multicast is enabled */ if (wufc & E1000_WUFC_MC) { @@ -5859,11 +5927,10 @@ static void e1000_eeprom_checks(struct e1000_adapter *adapter) } } -static int e1000_set_features(struct net_device *netdev, - netdev_features_t features) +static int e1000_set_features(struct net_device *netdev, u32 features) { struct e1000_adapter *adapter = netdev_priv(netdev); - netdev_features_t changed = features ^ netdev->features; + u32 changed = features ^ netdev->features; if (changed & (NETIF_F_TSO | NETIF_F_TSO6)) adapter->flags |= FLAG_TSO_FORCE; @@ -5885,7 +5952,7 @@ static const struct net_device_ops e1000e_netdev_ops = { .ndo_stop = e1000_close, .ndo_start_xmit = e1000_xmit_frame, .ndo_get_stats64 = e1000e_get_stats64, - .ndo_set_rx_mode = e1000_set_multi, + .ndo_set_rx_mode = e1000e_set_rx_mode, .ndo_set_mac_address = e1000_set_mac, .ndo_change_mtu = e1000_change_mtu, .ndo_do_ioctl = e1000_ioctl, @@ -6077,6 +6144,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev, NETIF_F_TSO6 | NETIF_F_HW_CSUM); + netdev->priv_flags |= IFF_UNICAST_FLT; + if (pci_using_dac) { netdev->features |= NETIF_F_HIGHDMA; netdev->vlan_features |= NETIF_F_HIGHDMA; diff --git a/trunk/drivers/net/ethernet/intel/igb/igb_main.c b/trunk/drivers/net/ethernet/intel/igb/igb_main.c index 1fcba22c6403..ced544499f1b 100644 --- a/trunk/drivers/net/ethernet/intel/igb/igb_main.c +++ b/trunk/drivers/net/ethernet/intel/igb/igb_main.c @@ -145,7 +145,7 @@ static bool igb_clean_rx_irq(struct igb_q_vector *, int); static int igb_ioctl(struct net_device *, struct ifreq *, int cmd); static void igb_tx_timeout(struct net_device *); static void igb_reset_task(struct work_struct *); -static void igb_vlan_mode(struct net_device *netdev, netdev_features_t features); +static void igb_vlan_mode(struct net_device *netdev, u32 features); static void igb_vlan_rx_add_vid(struct net_device *, u16); static void igb_vlan_rx_kill_vid(struct net_device *, u16); static void igb_restore_vlan(struct igb_adapter *); @@ -1742,8 +1742,7 @@ void igb_reset(struct igb_adapter *adapter) igb_get_phy_info(hw); } -static netdev_features_t igb_fix_features(struct net_device *netdev, - netdev_features_t features) +static u32 igb_fix_features(struct net_device *netdev, u32 features) { /* * Since there is no support for separate rx/tx vlan accel @@ -1757,10 +1756,9 @@ static netdev_features_t igb_fix_features(struct net_device *netdev, return features; } -static int igb_set_features(struct net_device *netdev, - netdev_features_t features) +static int igb_set_features(struct net_device *netdev, u32 features) { - netdev_features_t changed = netdev->features ^ features; + u32 changed = netdev->features ^ features; if (changed & NETIF_F_HW_VLAN_RX) igb_vlan_mode(netdev, features); @@ -6469,7 +6467,7 @@ s32 igb_write_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value) return 0; } -static void igb_vlan_mode(struct net_device *netdev, netdev_features_t features) +static void igb_vlan_mode(struct net_device *netdev, u32 features) { struct igb_adapter *adapter = netdev_priv(netdev); struct e1000_hw *hw = &adapter->hw; diff --git a/trunk/drivers/net/ethernet/intel/igbvf/netdev.c b/trunk/drivers/net/ethernet/intel/igbvf/netdev.c index 2a05658938bd..cca78124be31 100644 --- a/trunk/drivers/net/ethernet/intel/igbvf/netdev.c +++ b/trunk/drivers/net/ethernet/intel/igbvf/netdev.c @@ -2532,8 +2532,7 @@ static void igbvf_print_device_info(struct igbvf_adapter *adapter) dev_info(&pdev->dev, "Address: %pM\n", netdev->dev_addr); } -static int igbvf_set_features(struct net_device *netdev, - netdev_features_t features) +static int igbvf_set_features(struct net_device *netdev, u32 features) { struct igbvf_adapter *adapter = netdev_priv(netdev); diff --git a/trunk/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/trunk/drivers/net/ethernet/intel/ixgb/ixgb_main.c index 247cf9219e03..e21148f8b160 100644 --- a/trunk/drivers/net/ethernet/intel/ixgb/ixgb_main.c +++ b/trunk/drivers/net/ethernet/intel/ixgb/ixgb_main.c @@ -325,8 +325,8 @@ ixgb_reset(struct ixgb_adapter *adapter) } } -static netdev_features_t -ixgb_fix_features(struct net_device *netdev, netdev_features_t features) +static u32 +ixgb_fix_features(struct net_device *netdev, u32 features) { /* * Tx VLAN insertion does not work per HW design when Rx stripping is @@ -339,10 +339,10 @@ ixgb_fix_features(struct net_device *netdev, netdev_features_t features) } static int -ixgb_set_features(struct net_device *netdev, netdev_features_t features) +ixgb_set_features(struct net_device *netdev, u32 features) { struct ixgb_adapter *adapter = netdev_priv(netdev); - netdev_features_t changed = features ^ netdev->features; + u32 changed = features ^ netdev->features; if (!(changed & (NETIF_F_RXCSUM|NETIF_F_HW_VLAN_RX))) return 0; diff --git a/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 820fc040c241..8ef92d1a6aa1 100644 --- a/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -7174,8 +7174,7 @@ void ixgbe_do_reset(struct net_device *netdev) ixgbe_reset(adapter); } -static netdev_features_t ixgbe_fix_features(struct net_device *netdev, - netdev_features_t data) +static u32 ixgbe_fix_features(struct net_device *netdev, u32 data) { struct ixgbe_adapter *adapter = netdev_priv(netdev); @@ -7205,8 +7204,7 @@ static netdev_features_t ixgbe_fix_features(struct net_device *netdev, return data; } -static int ixgbe_set_features(struct net_device *netdev, - netdev_features_t data) +static int ixgbe_set_features(struct net_device *netdev, u32 data) { struct ixgbe_adapter *adapter = netdev_priv(netdev); bool need_reset = false; diff --git a/trunk/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/trunk/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index 3e6ec088c50d..4c8e19951d57 100644 --- a/trunk/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/trunk/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c @@ -3249,8 +3249,7 @@ static struct rtnl_link_stats64 *ixgbevf_get_stats(struct net_device *netdev, return stats; } -static int ixgbevf_set_features(struct net_device *netdev, - netdev_features_t features) +static int ixgbevf_set_features(struct net_device *netdev, u32 features) { struct ixgbevf_adapter *adapter = netdev_priv(netdev); diff --git a/trunk/drivers/net/ethernet/jme.c b/trunk/drivers/net/ethernet/jme.c index df3ab831b1ad..7d88c7c28a7c 100644 --- a/trunk/drivers/net/ethernet/jme.c +++ b/trunk/drivers/net/ethernet/jme.c @@ -1917,7 +1917,7 @@ jme_map_tx_skb(struct jme_adapter *jme, struct sk_buff *skb, int idx) struct jme_ring *txring = &(jme->txring[0]); struct txdesc *txdesc = txring->desc, *ctxdesc; struct jme_buffer_info *txbi = txring->bufinf, *ctxbi; - u8 hidma = !!(jme->dev->features & NETIF_F_HIGHDMA); + u8 hidma = jme->dev->features & NETIF_F_HIGHDMA; int i, nr_frags = skb_shinfo(skb)->nr_frags; int mask = jme->tx_ring_mask; const struct skb_frag_struct *frag; @@ -2620,8 +2620,8 @@ jme_set_msglevel(struct net_device *netdev, u32 value) jme->msg_enable = value; } -static netdev_features_t -jme_fix_features(struct net_device *netdev, netdev_features_t features) +static u32 +jme_fix_features(struct net_device *netdev, u32 features) { if (netdev->mtu > 1900) features &= ~(NETIF_F_ALL_TSO | NETIF_F_ALL_CSUM); @@ -2629,7 +2629,7 @@ jme_fix_features(struct net_device *netdev, netdev_features_t features) } static int -jme_set_features(struct net_device *netdev, netdev_features_t features) +jme_set_features(struct net_device *netdev, u32 features) { struct jme_adapter *jme = netdev_priv(netdev); diff --git a/trunk/drivers/net/ethernet/marvell/mv643xx_eth.c b/trunk/drivers/net/ethernet/marvell/mv643xx_eth.c index 157c5c17fdcc..f6b4304ca459 100644 --- a/trunk/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/trunk/drivers/net/ethernet/marvell/mv643xx_eth.c @@ -1579,10 +1579,10 @@ mv643xx_eth_set_ringparam(struct net_device *dev, struct ethtool_ringparam *er) static int -mv643xx_eth_set_features(struct net_device *dev, netdev_features_t features) +mv643xx_eth_set_features(struct net_device *dev, u32 features) { struct mv643xx_eth_private *mp = netdev_priv(dev); - int rx_csum = !!(features & NETIF_F_RXCSUM); + u32 rx_csum = features & NETIF_F_RXCSUM; wrlp(mp, PORT_CONFIG, rx_csum ? 0x02000000 : 0x00000000); diff --git a/trunk/drivers/net/ethernet/marvell/sky2.c b/trunk/drivers/net/ethernet/marvell/sky2.c index c79dc5447658..553d1a315b3a 100644 --- a/trunk/drivers/net/ethernet/marvell/sky2.c +++ b/trunk/drivers/net/ethernet/marvell/sky2.c @@ -1275,7 +1275,7 @@ static void rx_set_checksum(struct sky2_port *sky2) } /* Enable/disable receive hash calculation (RSS) */ -static void rx_set_rss(struct net_device *dev, netdev_features_t features) +static void rx_set_rss(struct net_device *dev, u32 features) { struct sky2_port *sky2 = netdev_priv(dev); struct sky2_hw *hw = sky2->hw; @@ -1396,7 +1396,7 @@ static int sky2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) #define SKY2_VLAN_OFFLOADS (NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO) -static void sky2_vlan_mode(struct net_device *dev, netdev_features_t features) +static void sky2_vlan_mode(struct net_device *dev, u32 features) { struct sky2_port *sky2 = netdev_priv(dev); struct sky2_hw *hw = sky2->hw; @@ -4282,8 +4282,7 @@ static int sky2_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom return sky2_vpd_write(sky2->hw, cap, data, eeprom->offset, eeprom->len); } -static netdev_features_t sky2_fix_features(struct net_device *dev, - netdev_features_t features) +static u32 sky2_fix_features(struct net_device *dev, u32 features) { const struct sky2_port *sky2 = netdev_priv(dev); const struct sky2_hw *hw = sky2->hw; @@ -4307,13 +4306,13 @@ static netdev_features_t sky2_fix_features(struct net_device *dev, return features; } -static int sky2_set_features(struct net_device *dev, netdev_features_t features) +static int sky2_set_features(struct net_device *dev, u32 features) { struct sky2_port *sky2 = netdev_priv(dev); - netdev_features_t changed = dev->features ^ features; + u32 changed = dev->features ^ features; if (changed & NETIF_F_RXCSUM) { - int on = !!(features & NETIF_F_RXCSUM); + u32 on = features & NETIF_F_RXCSUM; sky2_write32(sky2->hw, Q_ADDR(rxqaddr[sky2->port], Q_CSR), on ? BMU_ENA_RX_CHKSUM : BMU_DIS_RX_CHKSUM); } diff --git a/trunk/drivers/net/ethernet/micrel/ksz884x.c b/trunk/drivers/net/ethernet/micrel/ksz884x.c index 8d846bd09711..3b67fe65404a 100644 --- a/trunk/drivers/net/ethernet/micrel/ksz884x.c +++ b/trunk/drivers/net/ethernet/micrel/ksz884x.c @@ -6588,8 +6588,7 @@ static void netdev_get_ethtool_stats(struct net_device *dev, * * Return 0 if successful; otherwise an error code. */ -static int netdev_set_features(struct net_device *dev, - netdev_features_t features) +static int netdev_set_features(struct net_device *dev, u32 features) { struct dev_priv *priv = netdev_priv(dev); struct dev_info *hw_priv = priv->adapter; diff --git a/trunk/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/trunk/drivers/net/ethernet/myricom/myri10ge/myri10ge.c index 20b72ecb020a..0778edcf7b9a 100644 --- a/trunk/drivers/net/ethernet/myricom/myri10ge/myri10ge.c +++ b/trunk/drivers/net/ethernet/myricom/myri10ge/myri10ge.c @@ -1491,7 +1491,7 @@ myri10ge_clean_rx_done(struct myri10ge_slice_state *ss, int budget) * access to avoid theoretical race condition with functions that * change NETIF_F_LRO flag at runtime. */ - bool lro_enabled = !!(ACCESS_ONCE(mgp->dev->features) & NETIF_F_LRO); + bool lro_enabled = ACCESS_ONCE(mgp->dev->features) & NETIF_F_LRO; while (rx_done->entry[idx].length != 0 && work_done < budget) { length = ntohs(rx_done->entry[idx].length); @@ -3149,8 +3149,7 @@ static int myri10ge_set_mac_address(struct net_device *dev, void *addr) return 0; } -static netdev_features_t myri10ge_fix_features(struct net_device *dev, - netdev_features_t features) +static u32 myri10ge_fix_features(struct net_device *dev, u32 features) { if (!(features & NETIF_F_RXCSUM)) features &= ~NETIF_F_LRO; diff --git a/trunk/drivers/net/ethernet/neterion/s2io.c b/trunk/drivers/net/ethernet/neterion/s2io.c index 76ae47627200..e6c90a5ac5d4 100644 --- a/trunk/drivers/net/ethernet/neterion/s2io.c +++ b/trunk/drivers/net/ethernet/neterion/s2io.c @@ -6616,10 +6616,10 @@ static void s2io_ethtool_get_strings(struct net_device *dev, } } -static int s2io_set_features(struct net_device *dev, netdev_features_t features) +static int s2io_set_features(struct net_device *dev, u32 features) { struct s2io_nic *sp = netdev_priv(dev); - netdev_features_t changed = (features ^ dev->features) & NETIF_F_LRO; + u32 changed = (features ^ dev->features) & NETIF_F_LRO; if (changed && netif_running(dev)) { int rc; diff --git a/trunk/drivers/net/ethernet/neterion/vxge/vxge-main.c b/trunk/drivers/net/ethernet/neterion/vxge/vxge-main.c index 16d4d8e913c3..a83197d757c1 100644 --- a/trunk/drivers/net/ethernet/neterion/vxge/vxge-main.c +++ b/trunk/drivers/net/ethernet/neterion/vxge/vxge-main.c @@ -2662,10 +2662,9 @@ static void vxge_poll_vp_lockup(unsigned long data) mod_timer(&vdev->vp_lockup_timer, jiffies + HZ / 1000); } -static netdev_features_t vxge_fix_features(struct net_device *dev, - netdev_features_t features) +static u32 vxge_fix_features(struct net_device *dev, u32 features) { - netdev_features_t changed = dev->features ^ features; + u32 changed = dev->features ^ features; /* Enabling RTH requires some of the logic in vxge_device_register and a * vpath reset. Due to these restrictions, only allow modification @@ -2677,10 +2676,10 @@ static netdev_features_t vxge_fix_features(struct net_device *dev, return features; } -static int vxge_set_features(struct net_device *dev, netdev_features_t features) +static int vxge_set_features(struct net_device *dev, u32 features) { struct vxgedev *vdev = netdev_priv(dev); - netdev_features_t changed = dev->features ^ features; + u32 changed = dev->features ^ features; if (!(changed & NETIF_F_RXHASH)) return 0; diff --git a/trunk/drivers/net/ethernet/nvidia/forcedeth.c b/trunk/drivers/net/ethernet/nvidia/forcedeth.c index 01bb7bfe14e6..e8a5ae356407 100644 --- a/trunk/drivers/net/ethernet/nvidia/forcedeth.c +++ b/trunk/drivers/net/ethernet/nvidia/forcedeth.c @@ -4536,7 +4536,7 @@ static int nv_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam* return 0; } -static int nv_set_loopback(struct net_device *dev, netdev_features_t features) +static int nv_set_loopback(struct net_device *dev, u32 features) { struct fe_priv *np = netdev_priv(dev); unsigned long flags; @@ -4591,8 +4591,7 @@ static int nv_set_loopback(struct net_device *dev, netdev_features_t features) return retval; } -static netdev_features_t nv_fix_features(struct net_device *dev, - netdev_features_t features) +static u32 nv_fix_features(struct net_device *dev, u32 features) { /* vlan is dependent on rx checksum offload */ if (features & (NETIF_F_HW_VLAN_TX|NETIF_F_HW_VLAN_RX)) @@ -4601,7 +4600,7 @@ static netdev_features_t nv_fix_features(struct net_device *dev, return features; } -static void nv_vlan_mode(struct net_device *dev, netdev_features_t features) +static void nv_vlan_mode(struct net_device *dev, u32 features) { struct fe_priv *np = get_nvpriv(dev); @@ -4622,11 +4621,11 @@ static void nv_vlan_mode(struct net_device *dev, netdev_features_t features) spin_unlock_irq(&np->lock); } -static int nv_set_features(struct net_device *dev, netdev_features_t features) +static int nv_set_features(struct net_device *dev, u32 features) { struct fe_priv *np = netdev_priv(dev); u8 __iomem *base = get_hwbase(dev); - netdev_features_t changed = dev->features ^ features; + u32 changed = dev->features ^ features; int retval; if ((changed & NETIF_F_LOOPBACK) && netif_running(dev)) { diff --git a/trunk/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/trunk/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c index 964e9c0948bc..48406ca382f1 100644 --- a/trunk/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +++ b/trunk/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c @@ -2109,11 +2109,10 @@ static int pch_gbe_change_mtu(struct net_device *netdev, int new_mtu) * Returns * 0: HW state updated successfully */ -static int pch_gbe_set_features(struct net_device *netdev, - netdev_features_t features) +static int pch_gbe_set_features(struct net_device *netdev, u32 features) { struct pch_gbe_adapter *adapter = netdev_priv(netdev); - netdev_features_t changed = features ^ netdev->features; + u32 changed = features ^ netdev->features; if (!(changed & NETIF_F_RXCSUM)) return 0; diff --git a/trunk/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/trunk/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c index 7dd9a4b107e6..8cf3173ba488 100644 --- a/trunk/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +++ b/trunk/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c @@ -544,8 +544,7 @@ static void netxen_set_multicast_list(struct net_device *dev) adapter->set_multi(dev); } -static netdev_features_t netxen_fix_features(struct net_device *dev, - netdev_features_t features) +static u32 netxen_fix_features(struct net_device *dev, u32 features) { if (!(features & NETIF_F_RXCSUM)) { netdev_info(dev, "disabling LRO as RXCSUM is off\n"); @@ -556,8 +555,7 @@ static netdev_features_t netxen_fix_features(struct net_device *dev, return features; } -static int netxen_set_features(struct net_device *dev, - netdev_features_t features) +static int netxen_set_features(struct net_device *dev, u32 features) { struct netxen_adapter *adapter = netdev_priv(dev); int hw_lro; diff --git a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h index 60976fc4ccc6..7ed53dbb8646 100644 --- a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +++ b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h @@ -1466,9 +1466,8 @@ void qlcnic_advert_link_change(struct qlcnic_adapter *adapter, int linkup); int qlcnic_fw_cmd_set_mtu(struct qlcnic_adapter *adapter, int mtu); int qlcnic_change_mtu(struct net_device *netdev, int new_mtu); -netdev_features_t qlcnic_fix_features(struct net_device *netdev, - netdev_features_t features); -int qlcnic_set_features(struct net_device *netdev, netdev_features_t features); +u32 qlcnic_fix_features(struct net_device *netdev, u32 features); +int qlcnic_set_features(struct net_device *netdev, u32 features); int qlcnic_config_hw_lro(struct qlcnic_adapter *adapter, int enable); int qlcnic_config_bridged_mode(struct qlcnic_adapter *adapter, u32 enable); int qlcnic_send_lro_cleanup(struct qlcnic_adapter *adapter); diff --git a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c index b528e52a8ee1..bcb81e47543a 100644 --- a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c +++ b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c @@ -817,13 +817,12 @@ int qlcnic_change_mtu(struct net_device *netdev, int mtu) } -netdev_features_t qlcnic_fix_features(struct net_device *netdev, - netdev_features_t features) +u32 qlcnic_fix_features(struct net_device *netdev, u32 features) { struct qlcnic_adapter *adapter = netdev_priv(netdev); if ((adapter->flags & QLCNIC_ESWITCH_ENABLED)) { - netdev_features_t changed = features ^ netdev->features; + u32 changed = features ^ netdev->features; features ^= changed & (NETIF_F_ALL_CSUM | NETIF_F_RXCSUM); } @@ -834,10 +833,10 @@ netdev_features_t qlcnic_fix_features(struct net_device *netdev, } -int qlcnic_set_features(struct net_device *netdev, netdev_features_t features) +int qlcnic_set_features(struct net_device *netdev, u32 features) { struct qlcnic_adapter *adapter = netdev_priv(netdev); - netdev_features_t changed = netdev->features ^ features; + u32 changed = netdev->features ^ features; int hw_lro = (features & NETIF_F_LRO) ? QLCNIC_LRO_ENABLED : 0; if (!(changed & NETIF_F_LRO)) diff --git a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 823f845ddc04..0bd163828e33 100644 --- a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c @@ -792,7 +792,7 @@ qlcnic_set_netdev_features(struct qlcnic_adapter *adapter, struct qlcnic_esw_func_cfg *esw_cfg) { struct net_device *netdev = adapter->netdev; - netdev_features_t features, vlan_features; + unsigned long features, vlan_features; features = (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | NETIF_F_IPV6_CSUM | NETIF_F_GRO); diff --git a/trunk/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/trunk/drivers/net/ethernet/qlogic/qlge/qlge_main.c index 1ce4e08037b8..c92afcd912e2 100644 --- a/trunk/drivers/net/ethernet/qlogic/qlge/qlge_main.c +++ b/trunk/drivers/net/ethernet/qlogic/qlge/qlge_main.c @@ -2307,7 +2307,7 @@ static int ql_napi_poll_msix(struct napi_struct *napi, int budget) return work_done; } -static void qlge_vlan_mode(struct net_device *ndev, netdev_features_t features) +static void qlge_vlan_mode(struct net_device *ndev, u32 features) { struct ql_adapter *qdev = netdev_priv(ndev); @@ -2323,8 +2323,7 @@ static void qlge_vlan_mode(struct net_device *ndev, netdev_features_t features) } } -static netdev_features_t qlge_fix_features(struct net_device *ndev, - netdev_features_t features) +static u32 qlge_fix_features(struct net_device *ndev, u32 features) { /* * Since there is no support for separate rx/tx vlan accel @@ -2338,10 +2337,9 @@ static netdev_features_t qlge_fix_features(struct net_device *ndev, return features; } -static int qlge_set_features(struct net_device *ndev, - netdev_features_t features) +static int qlge_set_features(struct net_device *ndev, u32 features) { - netdev_features_t changed = ndev->features ^ features; + u32 changed = ndev->features ^ features; if (changed & NETIF_F_HW_VLAN_RX) qlge_vlan_mode(ndev, features); diff --git a/trunk/drivers/net/ethernet/realtek/8139cp.c b/trunk/drivers/net/ethernet/realtek/8139cp.c index 87cff10f7be7..6cfc5dc0f76e 100644 --- a/trunk/drivers/net/ethernet/realtek/8139cp.c +++ b/trunk/drivers/net/ethernet/realtek/8139cp.c @@ -1392,7 +1392,7 @@ static void cp_set_msglevel(struct net_device *dev, u32 value) cp->msg_enable = value; } -static int cp_set_features(struct net_device *dev, netdev_features_t features) +static int cp_set_features(struct net_device *dev, u32 features) { struct cp_private *cp = netdev_priv(dev); unsigned long flags; diff --git a/trunk/drivers/net/ethernet/realtek/r8169.c b/trunk/drivers/net/ethernet/realtek/r8169.c index 2dfb0c0ea01b..cdf66d68d849 100644 --- a/trunk/drivers/net/ethernet/realtek/r8169.c +++ b/trunk/drivers/net/ethernet/realtek/r8169.c @@ -1553,8 +1553,7 @@ static int rtl8169_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) return ret; } -static netdev_features_t rtl8169_fix_features(struct net_device *dev, - netdev_features_t features) +static u32 rtl8169_fix_features(struct net_device *dev, u32 features) { struct rtl8169_private *tp = netdev_priv(dev); @@ -1568,8 +1567,7 @@ static netdev_features_t rtl8169_fix_features(struct net_device *dev, return features; } -static int rtl8169_set_features(struct net_device *dev, - netdev_features_t features) +static int rtl8169_set_features(struct net_device *dev, u32 features) { struct rtl8169_private *tp = netdev_priv(dev); void __iomem *ioaddr = tp->mmio_addr; diff --git a/trunk/drivers/net/ethernet/sfc/efx.c b/trunk/drivers/net/ethernet/sfc/efx.c index 14e134d3b4d7..d5731f1fe6d6 100644 --- a/trunk/drivers/net/ethernet/sfc/efx.c +++ b/trunk/drivers/net/ethernet/sfc/efx.c @@ -1900,7 +1900,7 @@ static void efx_set_multicast_list(struct net_device *net_dev) /* Otherwise efx_start_port() will do this */ } -static int efx_set_features(struct net_device *net_dev, netdev_features_t data) +static int efx_set_features(struct net_device *net_dev, u32 data) { struct efx_nic *efx = netdev_priv(net_dev); diff --git a/trunk/drivers/net/ethernet/sfc/net_driver.h b/trunk/drivers/net/ethernet/sfc/net_driver.h index c49502bab6a3..b8e251a1ee48 100644 --- a/trunk/drivers/net/ethernet/sfc/net_driver.h +++ b/trunk/drivers/net/ethernet/sfc/net_driver.h @@ -908,7 +908,7 @@ struct efx_nic_type { unsigned int phys_addr_channels; unsigned int tx_dc_base; unsigned int rx_dc_base; - netdev_features_t offload_features; + u32 offload_features; }; /************************************************************************** diff --git a/trunk/drivers/net/ethernet/smsc/smc91c92_cs.c b/trunk/drivers/net/ethernet/smsc/smc91c92_cs.c index ada927aba7a5..cbfa98187131 100644 --- a/trunk/drivers/net/ethernet/smsc/smc91c92_cs.c +++ b/trunk/drivers/net/ethernet/smsc/smc91c92_cs.c @@ -1909,8 +1909,8 @@ static int check_if_running(struct net_device *dev) static void smc_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { - strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); - strlcpy(info->version, DRV_VERSION, sizeof(info->version)); + strcpy(info->driver, DRV_NAME); + strcpy(info->version, DRV_VERSION); } static int smc_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) diff --git a/trunk/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/trunk/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c index c18ca596a490..e8eff09bbbd7 100644 --- a/trunk/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +++ b/trunk/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c @@ -185,10 +185,9 @@ static void stmmac_ethtool_getdrvinfo(struct net_device *dev, struct stmmac_priv *priv = netdev_priv(dev); if (priv->plat->has_gmac) - strlcpy(info->driver, GMAC_ETHTOOL_NAME, sizeof(info->driver)); + strcpy(info->driver, GMAC_ETHTOOL_NAME); else - strlcpy(info->driver, MAC100_ETHTOOL_NAME, - sizeof(info->driver)); + strcpy(info->driver, MAC100_ETHTOOL_NAME); strcpy(info->version, DRV_MODULE_VERSION); info->fw_version[0] = '\0'; diff --git a/trunk/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/trunk/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 643ca97a2d9a..20546bbbb8db 100644 --- a/trunk/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/trunk/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1419,8 +1419,7 @@ static int stmmac_change_mtu(struct net_device *dev, int new_mtu) return 0; } -static netdev_features_t stmmac_fix_features(struct net_device *dev, - netdev_features_t features) +static u32 stmmac_fix_features(struct net_device *dev, u32 features) { struct stmmac_priv *priv = netdev_priv(dev); diff --git a/trunk/drivers/net/ifb.c b/trunk/drivers/net/ifb.c index e05b645bbc32..46b5f5fd686b 100644 --- a/trunk/drivers/net/ifb.c +++ b/trunk/drivers/net/ifb.c @@ -164,7 +164,7 @@ static const struct net_device_ops ifb_netdev_ops = { .ndo_validate_addr = eth_validate_addr, }; -#define IFB_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_FRAGLIST | \ +#define IFB_FEATURES (NETIF_F_NO_CSUM | NETIF_F_SG | NETIF_F_FRAGLIST | \ NETIF_F_TSO_ECN | NETIF_F_TSO | NETIF_F_TSO6 | \ NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_TX) diff --git a/trunk/drivers/net/loopback.c b/trunk/drivers/net/loopback.c index b71998d0b5b4..4ce9e5f2c069 100644 --- a/trunk/drivers/net/loopback.c +++ b/trunk/drivers/net/loopback.c @@ -169,7 +169,7 @@ static void loopback_setup(struct net_device *dev) dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | NETIF_F_UFO - | NETIF_F_HW_CSUM + | NETIF_F_NO_CSUM | NETIF_F_RXCSUM | NETIF_F_HIGHDMA | NETIF_F_LLTX diff --git a/trunk/drivers/net/phy/mdio-bitbang.c b/trunk/drivers/net/phy/mdio-bitbang.c index daec9b05d168..65391891d8c4 100644 --- a/trunk/drivers/net/phy/mdio-bitbang.c +++ b/trunk/drivers/net/phy/mdio-bitbang.c @@ -202,14 +202,6 @@ static int mdiobb_write(struct mii_bus *bus, int phy, int reg, u16 val) return 0; } -static int mdiobb_reset(struct mii_bus *bus) -{ - struct mdiobb_ctrl *ctrl = bus->priv; - if (ctrl->reset) - ctrl->reset(bus); - return 0; -} - struct mii_bus *alloc_mdio_bitbang(struct mdiobb_ctrl *ctrl) { struct mii_bus *bus; @@ -222,7 +214,6 @@ struct mii_bus *alloc_mdio_bitbang(struct mdiobb_ctrl *ctrl) bus->read = mdiobb_read; bus->write = mdiobb_write; - bus->reset = mdiobb_reset; bus->priv = ctrl; return bus; diff --git a/trunk/drivers/net/phy/mdio-gpio.c b/trunk/drivers/net/phy/mdio-gpio.c index 89c5a3eccc12..2843c90f712f 100644 --- a/trunk/drivers/net/phy/mdio-gpio.c +++ b/trunk/drivers/net/phy/mdio-gpio.c @@ -95,7 +95,6 @@ static struct mii_bus * __devinit mdio_gpio_bus_init(struct device *dev, goto out; bitbang->ctrl.ops = &mdio_gpio_ops; - bitbang->ctrl.reset = pdata->reset; bitbang->mdc = pdata->mdc; bitbang->mdio = pdata->mdio; diff --git a/trunk/drivers/net/team/team.c b/trunk/drivers/net/team/team.c index f3092749b072..60672bb09960 100644 --- a/trunk/drivers/net/team/team.c +++ b/trunk/drivers/net/team/team.c @@ -80,78 +80,30 @@ EXPORT_SYMBOL(team_port_set_team_mac); * Options handling *******************/ -struct team_option *__team_find_option(struct team *team, const char *opt_name) -{ - struct team_option *option; - - list_for_each_entry(option, &team->option_list, list) { - if (strcmp(option->name, opt_name) == 0) - return option; - } - return NULL; -} - -int team_options_register(struct team *team, - const struct team_option *option, - size_t option_count) +void team_options_register(struct team *team, struct team_option *option, + size_t option_count) { int i; - struct team_option *dst_opts[option_count]; - int err; - - memset(dst_opts, 0, sizeof(dst_opts)); - for (i = 0; i < option_count; i++, option++) { - struct team_option *dst_opt; - - if (__team_find_option(team, option->name)) { - err = -EEXIST; - goto rollback; - } - dst_opt = kmalloc(sizeof(*option), GFP_KERNEL); - if (!dst_opt) { - err = -ENOMEM; - goto rollback; - } - memcpy(dst_opt, option, sizeof(*option)); - dst_opts[i] = dst_opt; - } - - for (i = 0; i < option_count; i++) - list_add_tail(&dst_opts[i]->list, &team->option_list); - - return 0; - -rollback: - for (i = 0; i < option_count; i++) - kfree(dst_opts[i]); - return err; + for (i = 0; i < option_count; i++, option++) + list_add_tail(&option->list, &team->option_list); } - EXPORT_SYMBOL(team_options_register); static void __team_options_change_check(struct team *team, struct team_option *changed_option); static void __team_options_unregister(struct team *team, - const struct team_option *option, + struct team_option *option, size_t option_count) { int i; - for (i = 0; i < option_count; i++, option++) { - struct team_option *del_opt; - - del_opt = __team_find_option(team, option->name); - if (del_opt) { - list_del(&del_opt->list); - kfree(del_opt); - } - } + for (i = 0; i < option_count; i++, option++) + list_del(&option->list); } -void team_options_unregister(struct team *team, - const struct team_option *option, +void team_options_unregister(struct team *team, struct team_option *option, size_t option_count) { __team_options_unregister(team, option, option_count); @@ -491,9 +443,9 @@ static void __team_compute_features(struct team *team) static void team_compute_features(struct team *team) { - mutex_lock(&team->lock); + spin_lock(&team->lock); __team_compute_features(team); - mutex_unlock(&team->lock); + spin_unlock(&team->lock); } static int team_port_enter(struct team *team, struct team_port *port) @@ -680,7 +632,7 @@ static int team_mode_option_set(struct team *team, void *arg) return team_change_mode(team, *str); } -static const struct team_option team_options[] = { +static struct team_option team_options[] = { { .name = "mode", .type = TEAM_OPTION_TYPE_STRING, @@ -693,10 +645,9 @@ static int team_init(struct net_device *dev) { struct team *team = netdev_priv(dev); int i; - int err; team->dev = dev; - mutex_init(&team->lock); + spin_lock_init(&team->lock); team->pcpu_stats = alloc_percpu(struct team_pcpu_stats); if (!team->pcpu_stats) @@ -709,17 +660,10 @@ static int team_init(struct net_device *dev) team_adjust_ops(team); INIT_LIST_HEAD(&team->option_list); - err = team_options_register(team, team_options, ARRAY_SIZE(team_options)); - if (err) - goto err_options_register; + team_options_register(team, team_options, ARRAY_SIZE(team_options)); netif_carrier_off(dev); return 0; - -err_options_register: - free_percpu(team->pcpu_stats); - - return err; } static void team_uninit(struct net_device *dev) @@ -728,13 +672,13 @@ static void team_uninit(struct net_device *dev) struct team_port *port; struct team_port *tmp; - mutex_lock(&team->lock); + spin_lock(&team->lock); list_for_each_entry_safe(port, tmp, &team->port_list, list) team_port_del(team, port->dev); __team_change_mode(team, NULL); /* cleanup */ __team_options_unregister(team, team_options, ARRAY_SIZE(team_options)); - mutex_unlock(&team->lock); + spin_unlock(&team->lock); } static void team_destructor(struct net_device *dev) @@ -840,7 +784,7 @@ static int team_change_mtu(struct net_device *dev, int new_mtu) * Alhough this is reader, it's guarded by team lock. It's not possible * to traverse list in reverse under rcu_read_lock */ - mutex_lock(&team->lock); + spin_lock(&team->lock); list_for_each_entry(port, &team->port_list, list) { err = dev_set_mtu(port->dev, new_mtu); if (err) { @@ -849,7 +793,7 @@ static int team_change_mtu(struct net_device *dev, int new_mtu) goto unwind; } } - mutex_unlock(&team->lock); + spin_unlock(&team->lock); dev->mtu = new_mtu; @@ -858,7 +802,7 @@ static int team_change_mtu(struct net_device *dev, int new_mtu) unwind: list_for_each_entry_continue_reverse(port, &team->port_list, list) dev_set_mtu(port->dev, dev->mtu); - mutex_unlock(&team->lock); + spin_unlock(&team->lock); return err; } @@ -936,9 +880,9 @@ static int team_add_slave(struct net_device *dev, struct net_device *port_dev) struct team *team = netdev_priv(dev); int err; - mutex_lock(&team->lock); + spin_lock(&team->lock); err = team_port_add(team, port_dev); - mutex_unlock(&team->lock); + spin_unlock(&team->lock); return err; } @@ -947,9 +891,9 @@ static int team_del_slave(struct net_device *dev, struct net_device *port_dev) struct team *team = netdev_priv(dev); int err; - mutex_lock(&team->lock); + spin_lock(&team->lock); err = team_port_del(team, port_dev); - mutex_unlock(&team->lock); + spin_unlock(&team->lock); return err; } @@ -1099,7 +1043,8 @@ static int team_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info) /* * Netlink cmd functions should be locked by following two functions. - * Since dev gets held here, that ensures dev won't disappear in between. + * To ensure team_uninit would not be called in between, hold rcu_read_lock + * all the time. */ static struct team *team_nl_team_get(struct genl_info *info) { @@ -1112,22 +1057,22 @@ static struct team *team_nl_team_get(struct genl_info *info) return NULL; ifindex = nla_get_u32(info->attrs[TEAM_ATTR_TEAM_IFINDEX]); - dev = dev_get_by_index(net, ifindex); + rcu_read_lock(); + dev = dev_get_by_index_rcu(net, ifindex); if (!dev || dev->netdev_ops != &team_netdev_ops) { - if (dev) - dev_put(dev); + rcu_read_unlock(); return NULL; } team = netdev_priv(dev); - mutex_lock(&team->lock); + spin_lock(&team->lock); return team; } static void team_nl_team_put(struct team *team) { - mutex_unlock(&team->lock); - dev_put(team->dev); + spin_unlock(&team->lock); + rcu_read_unlock(); } static int team_nl_send_generic(struct genl_info *info, struct team *team, @@ -1542,9 +1487,9 @@ static void team_port_change_check(struct team_port *port, bool linkup) { struct team *team = port->team; - mutex_lock(&team->lock); + spin_lock(&team->lock); __team_port_change_check(port, linkup); - mutex_unlock(&team->lock); + spin_unlock(&team->lock); } /************************************ diff --git a/trunk/drivers/net/team/team_mode_activebackup.c b/trunk/drivers/net/team/team_mode_activebackup.c index b34427502b54..6fe920c440b3 100644 --- a/trunk/drivers/net/team/team_mode_activebackup.c +++ b/trunk/drivers/net/team/team_mode_activebackup.c @@ -83,7 +83,7 @@ static int ab_active_port_set(struct team *team, void *arg) return -ENOENT; } -static const struct team_option ab_options[] = { +static struct team_option ab_options[] = { { .name = "activeport", .type = TEAM_OPTION_TYPE_U32, @@ -94,7 +94,8 @@ static const struct team_option ab_options[] = { int ab_init(struct team *team) { - return team_options_register(team, ab_options, ARRAY_SIZE(ab_options)); + team_options_register(team, ab_options, ARRAY_SIZE(ab_options)); + return 0; } void ab_exit(struct team *team) diff --git a/trunk/drivers/net/tun.c b/trunk/drivers/net/tun.c index 3dd13d606d00..7bea9c65119e 100644 --- a/trunk/drivers/net/tun.c +++ b/trunk/drivers/net/tun.c @@ -123,7 +123,7 @@ struct tun_struct { gid_t group; struct net_device *dev; - netdev_features_t set_features; + u32 set_features; #define TUN_USER_FEATURES (NETIF_F_HW_CSUM|NETIF_F_TSO_ECN|NETIF_F_TSO| \ NETIF_F_TSO6|NETIF_F_UFO) struct fasync_struct *fasync; @@ -454,8 +454,7 @@ tun_net_change_mtu(struct net_device *dev, int new_mtu) return 0; } -static netdev_features_t tun_net_fix_features(struct net_device *dev, - netdev_features_t features) +static u32 tun_net_fix_features(struct net_device *dev, u32 features) { struct tun_struct *tun = netdev_priv(dev); @@ -1197,7 +1196,7 @@ static int tun_get_iff(struct net *net, struct tun_struct *tun, * privs required. */ static int set_offload(struct tun_struct *tun, unsigned long arg) { - netdev_features_t features = 0; + u32 features = 0; if (arg & TUN_F_CSUM) { features |= NETIF_F_HW_CSUM; @@ -1590,16 +1589,16 @@ static void tun_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info { struct tun_struct *tun = netdev_priv(dev); - strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); - strlcpy(info->version, DRV_VERSION, sizeof(info->version)); - strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); + strcpy(info->driver, DRV_NAME); + strcpy(info->version, DRV_VERSION); + strcpy(info->fw_version, "N/A"); switch (tun->flags & TUN_TYPE_MASK) { case TUN_TUN_DEV: - strlcpy(info->bus_info, "tun", sizeof(info->bus_info)); + strcpy(info->bus_info, "tun"); break; case TUN_TAP_DEV: - strlcpy(info->bus_info, "tap", sizeof(info->bus_info)); + strcpy(info->bus_info, "tap"); break; } } diff --git a/trunk/drivers/net/usb/smsc75xx.c b/trunk/drivers/net/usb/smsc75xx.c index 7d62c39f65cf..a5b9b12ef268 100644 --- a/trunk/drivers/net/usb/smsc75xx.c +++ b/trunk/drivers/net/usb/smsc75xx.c @@ -728,8 +728,7 @@ static int smsc75xx_change_mtu(struct net_device *netdev, int new_mtu) } /* Enable or disable Rx checksum offload engine */ -static int smsc75xx_set_features(struct net_device *netdev, - netdev_features_t features) +static int smsc75xx_set_features(struct net_device *netdev, u32 features) { struct usbnet *dev = netdev_priv(netdev); struct smsc75xx_priv *pdata = (struct smsc75xx_priv *)(dev->data[0]); diff --git a/trunk/drivers/net/usb/smsc95xx.c b/trunk/drivers/net/usb/smsc95xx.c index 56f3894d701a..eff67678c5a6 100644 --- a/trunk/drivers/net/usb/smsc95xx.c +++ b/trunk/drivers/net/usb/smsc95xx.c @@ -516,8 +516,7 @@ static void smsc95xx_status(struct usbnet *dev, struct urb *urb) } /* Enable or disable Tx & Rx checksum offload engines */ -static int smsc95xx_set_features(struct net_device *netdev, - netdev_features_t features) +static int smsc95xx_set_features(struct net_device *netdev, u32 features) { struct usbnet *dev = netdev_priv(netdev); u32 read_buf; diff --git a/trunk/drivers/net/veth.c b/trunk/drivers/net/veth.c index b576812bdc59..726c790ec74c 100644 --- a/trunk/drivers/net/veth.c +++ b/trunk/drivers/net/veth.c @@ -66,9 +66,9 @@ static int veth_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) static void veth_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { - strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); - strlcpy(info->version, DRV_VERSION, sizeof(info->version)); - strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); + strcpy(info->driver, DRV_NAME); + strcpy(info->version, DRV_VERSION); + strcpy(info->fw_version, "N/A"); } static void veth_get_strings(struct net_device *dev, u32 stringset, u8 *buf) @@ -271,7 +271,7 @@ static void veth_setup(struct net_device *dev) dev->features |= NETIF_F_LLTX; dev->destructor = veth_dev_free; - dev->hw_features = NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_RXCSUM; + dev->hw_features = NETIF_F_NO_CSUM | NETIF_F_SG | NETIF_F_RXCSUM; } /* diff --git a/trunk/drivers/net/virtio_net.c b/trunk/drivers/net/virtio_net.c index 4dc9d842a7a3..6ee8410443c4 100644 --- a/trunk/drivers/net/virtio_net.c +++ b/trunk/drivers/net/virtio_net.c @@ -39,7 +39,6 @@ module_param(gso, bool, 0444); #define GOOD_COPY_LEN 128 #define VIRTNET_SEND_COMMAND_SG_MAX 2 -#define VIRTNET_DRIVER_VERSION "1.0.0" struct virtnet_stats { struct u64_stats_sync syncp; @@ -890,21 +889,7 @@ static void virtnet_get_ringparam(struct net_device *dev, } - -static void virtnet_get_drvinfo(struct net_device *dev, - struct ethtool_drvinfo *info) -{ - struct virtnet_info *vi = netdev_priv(dev); - struct virtio_device *vdev = vi->vdev; - - strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); - strlcpy(info->version, VIRTNET_DRIVER_VERSION, sizeof(info->version)); - strlcpy(info->bus_info, virtio_bus_name(vdev), sizeof(info->bus_info)); - -} - static const struct ethtool_ops virtnet_ethtool_ops = { - .get_drvinfo = virtnet_get_drvinfo, .get_link = ethtool_op_get_link, .get_ringparam = virtnet_get_ringparam, }; diff --git a/trunk/drivers/net/vmxnet3/vmxnet3_ethtool.c b/trunk/drivers/net/vmxnet3/vmxnet3_ethtool.c index 77f723415c9c..e662cbc8bfbd 100644 --- a/trunk/drivers/net/vmxnet3/vmxnet3_ethtool.c +++ b/trunk/drivers/net/vmxnet3/vmxnet3_ethtool.c @@ -262,11 +262,11 @@ vmxnet3_get_strings(struct net_device *netdev, u32 stringset, u8 *buf) } } -int vmxnet3_set_features(struct net_device *netdev, netdev_features_t features) +int vmxnet3_set_features(struct net_device *netdev, u32 features) { struct vmxnet3_adapter *adapter = netdev_priv(netdev); unsigned long flags; - netdev_features_t changed = features ^ netdev->features; + u32 changed = features ^ netdev->features; if (changed & (NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_HW_VLAN_RX)) { if (features & NETIF_F_RXCSUM) diff --git a/trunk/drivers/net/vmxnet3/vmxnet3_int.h b/trunk/drivers/net/vmxnet3/vmxnet3_int.h index ed54797db191..b18eac1dccaa 100644 --- a/trunk/drivers/net/vmxnet3/vmxnet3_int.h +++ b/trunk/drivers/net/vmxnet3/vmxnet3_int.h @@ -401,7 +401,7 @@ void vmxnet3_rq_destroy_all(struct vmxnet3_adapter *adapter); int -vmxnet3_set_features(struct net_device *netdev, netdev_features_t features); +vmxnet3_set_features(struct net_device *netdev, u32 features); int vmxnet3_create_queues(struct vmxnet3_adapter *adapter, diff --git a/trunk/drivers/net/xen-netback/interface.c b/trunk/drivers/net/xen-netback/interface.c index 0b5c18feb303..182562952c79 100644 --- a/trunk/drivers/net/xen-netback/interface.c +++ b/trunk/drivers/net/xen-netback/interface.c @@ -165,8 +165,7 @@ static int xenvif_change_mtu(struct net_device *dev, int mtu) return 0; } -static netdev_features_t xenvif_fix_features(struct net_device *dev, - netdev_features_t features) +static u32 xenvif_fix_features(struct net_device *dev, u32 features) { struct xenvif *vif = netdev_priv(dev); diff --git a/trunk/drivers/net/xen-netfront.c b/trunk/drivers/net/xen-netfront.c index a6e379fbf377..226faab23603 100644 --- a/trunk/drivers/net/xen-netfront.c +++ b/trunk/drivers/net/xen-netfront.c @@ -203,7 +203,7 @@ static void xennet_sysfs_delif(struct net_device *netdev); static int xennet_can_sg(struct net_device *dev) { - return !!(dev->features & NETIF_F_SG); + return dev->features & NETIF_F_SG; } @@ -1190,8 +1190,7 @@ static void xennet_uninit(struct net_device *dev) gnttab_free_grant_references(np->gref_rx_head); } -static netdev_features_t xennet_fix_features(struct net_device *dev, - netdev_features_t features) +static u32 xennet_fix_features(struct net_device *dev, u32 features) { struct netfront_info *np = netdev_priv(dev); int val; @@ -1217,8 +1216,7 @@ static netdev_features_t xennet_fix_features(struct net_device *dev, return features; } -static int xennet_set_features(struct net_device *dev, - netdev_features_t features) +static int xennet_set_features(struct net_device *dev, u32 features) { if (!(features & NETIF_F_SG) && dev->mtu > ETH_DATA_LEN) { netdev_info(dev, "Reducing MTU because no SG offload"); diff --git a/trunk/drivers/s390/kvm/kvm_virtio.c b/trunk/drivers/s390/kvm/kvm_virtio.c index 8af868bab20b..94f49ffa70ba 100644 --- a/trunk/drivers/s390/kvm/kvm_virtio.c +++ b/trunk/drivers/s390/kvm/kvm_virtio.c @@ -263,11 +263,6 @@ static int kvm_find_vqs(struct virtio_device *vdev, unsigned nvqs, return PTR_ERR(vqs[i]); } -static const char *kvm_bus_name(struct virtio_device *vdev) -{ - return ""; -} - /* * The config ops structure as defined by virtio config */ @@ -281,7 +276,6 @@ static struct virtio_config_ops kvm_vq_configspace_ops = { .reset = kvm_reset, .find_vqs = kvm_find_vqs, .del_vqs = kvm_del_vqs, - .bus_name = kvm_bus_name, }; /* diff --git a/trunk/drivers/s390/net/qeth_l3_main.c b/trunk/drivers/s390/net/qeth_l3_main.c index a64f9e789b0a..e4c1176ee25b 100644 --- a/trunk/drivers/s390/net/qeth_l3_main.c +++ b/trunk/drivers/s390/net/qeth_l3_main.c @@ -3202,8 +3202,7 @@ static int qeth_l3_stop(struct net_device *dev) return 0; } -static netdev_features_t qeth_l3_fix_features(struct net_device *dev, - netdev_features_t features) +static u32 qeth_l3_fix_features(struct net_device *dev, u32 features) { struct qeth_card *card = dev->ml_priv; @@ -3217,8 +3216,7 @@ static netdev_features_t qeth_l3_fix_features(struct net_device *dev, return features; } -static int qeth_l3_set_features(struct net_device *dev, - netdev_features_t features) +static int qeth_l3_set_features(struct net_device *dev, u32 features) { struct qeth_card *card = dev->ml_priv; u32 changed = dev->features ^ features; diff --git a/trunk/drivers/virtio/virtio_mmio.c b/trunk/drivers/virtio/virtio_mmio.c index 2f57380d7ed4..acc5e43c373e 100644 --- a/trunk/drivers/virtio/virtio_mmio.c +++ b/trunk/drivers/virtio/virtio_mmio.c @@ -361,12 +361,7 @@ static int vm_find_vqs(struct virtio_device *vdev, unsigned nvqs, return 0; } -static const char *vm_bus_name(struct virtio_device *vdev) -{ - struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev); - return vm_dev->pdev->name; -} static struct virtio_config_ops virtio_mmio_config_ops = { .get = vm_get, @@ -378,7 +373,6 @@ static struct virtio_config_ops virtio_mmio_config_ops = { .del_vqs = vm_del_vqs, .get_features = vm_get_features, .finalize_features = vm_finalize_features, - .bus_name = vm_bus_name, }; diff --git a/trunk/drivers/virtio/virtio_pci.c b/trunk/drivers/virtio/virtio_pci.c index 764ec05ea3e8..79a31e5b4b68 100644 --- a/trunk/drivers/virtio/virtio_pci.c +++ b/trunk/drivers/virtio/virtio_pci.c @@ -580,13 +580,6 @@ static int vp_find_vqs(struct virtio_device *vdev, unsigned nvqs, false, false); } -static const char *vp_bus_name(struct virtio_device *vdev) -{ - struct virtio_pci_device *vp_dev = to_vp_device(vdev); - - return pci_name(vp_dev->pci_dev); -} - static struct virtio_config_ops virtio_pci_config_ops = { .get = vp_get, .set = vp_set, @@ -597,7 +590,6 @@ static struct virtio_config_ops virtio_pci_config_ops = { .del_vqs = vp_del_vqs, .get_features = vp_get_features, .finalize_features = vp_finalize_features, - .bus_name = vp_bus_name, }; static void virtio_pci_release_dev(struct device *_d) diff --git a/trunk/include/linux/ethtool.h b/trunk/include/linux/ethtool.h index 20db5b275c3f..de33de1e2052 100644 --- a/trunk/include/linux/ethtool.h +++ b/trunk/include/linux/ethtool.h @@ -724,6 +724,9 @@ enum ethtool_sfeatures_retval_bits { #include +/* needed by dev_disable_lro() */ +extern int __ethtool_set_flags(struct net_device *dev, u32 flags); + extern int __ethtool_get_settings(struct net_device *dev, struct ethtool_cmd *cmd); @@ -747,6 +750,19 @@ struct net_device; /* Some generic methods drivers may use in their ethtool_ops */ u32 ethtool_op_get_link(struct net_device *dev); +u32 ethtool_op_get_tx_csum(struct net_device *dev); +int ethtool_op_set_tx_csum(struct net_device *dev, u32 data); +int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data); +int ethtool_op_set_tx_ipv6_csum(struct net_device *dev, u32 data); +u32 ethtool_op_get_sg(struct net_device *dev); +int ethtool_op_set_sg(struct net_device *dev, u32 data); +u32 ethtool_op_get_tso(struct net_device *dev); +int ethtool_op_set_tso(struct net_device *dev, u32 data); +u32 ethtool_op_get_ufo(struct net_device *dev); +int ethtool_op_set_ufo(struct net_device *dev, u32 data); +u32 ethtool_op_get_flags(struct net_device *dev); +int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported); +bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported); /** * struct ethtool_ops - optional netdev operations @@ -791,6 +807,22 @@ u32 ethtool_op_get_link(struct net_device *dev); * @get_pauseparam: Report pause parameters * @set_pauseparam: Set pause parameters. Returns a negative error code * or zero. + * @get_rx_csum: Deprecated in favour of the netdev feature %NETIF_F_RXCSUM. + * Report whether receive checksums are turned on or off. + * @set_rx_csum: Deprecated in favour of generic netdev features. Turn + * receive checksum on or off. Returns a negative error code or zero. + * @get_tx_csum: Deprecated as redundant. Report whether transmit checksums + * are turned on or off. + * @set_tx_csum: Deprecated in favour of generic netdev features. Turn + * transmit checksums on or off. Returns a negative error code or zero. + * @get_sg: Deprecated as redundant. Report whether scatter-gather is + * enabled. + * @set_sg: Deprecated in favour of generic netdev features. Turn + * scatter-gather on or off. Returns a negative error code or zero. + * @get_tso: Deprecated as redundant. Report whether TCP segmentation + * offload is enabled. + * @set_tso: Deprecated in favour of generic netdev features. Turn TCP + * segmentation offload on or off. Returns a negative error code or zero. * @self_test: Run specified self-tests * @get_strings: Return a set of strings that describe the requested objects * @set_phys_id: Identify the physical devices, e.g. by flashing an LED @@ -812,6 +844,15 @@ u32 ethtool_op_get_link(struct net_device *dev); * negative error code or zero. * @complete: Function to be called after any other operation except * @begin. Will be called even if the other operation failed. + * @get_ufo: Deprecated as redundant. Report whether UDP fragmentation + * offload is enabled. + * @set_ufo: Deprecated in favour of generic netdev features. Turn UDP + * fragmentation offload on or off. Returns a negative error code or zero. + * @get_flags: Deprecated as redundant. Report features included in + * &enum ethtool_flags that are enabled. + * @set_flags: Deprecated in favour of generic netdev features. Turn + * features included in &enum ethtool_flags on or off. Returns a + * negative error code or zero. * @get_priv_flags: Report driver-specific feature flags. * @set_priv_flags: Set driver-specific feature flags. Returns a negative * error code or zero. @@ -876,6 +917,14 @@ struct ethtool_ops { struct ethtool_pauseparam*); int (*set_pauseparam)(struct net_device *, struct ethtool_pauseparam*); + u32 (*get_rx_csum)(struct net_device *); + int (*set_rx_csum)(struct net_device *, u32); + u32 (*get_tx_csum)(struct net_device *); + int (*set_tx_csum)(struct net_device *, u32); + u32 (*get_sg)(struct net_device *); + int (*set_sg)(struct net_device *, u32); + u32 (*get_tso)(struct net_device *); + int (*set_tso)(struct net_device *, u32); void (*self_test)(struct net_device *, struct ethtool_test *, u64 *); void (*get_strings)(struct net_device *, u32 stringset, u8 *); int (*set_phys_id)(struct net_device *, enum ethtool_phys_id_state); @@ -883,6 +932,10 @@ struct ethtool_ops { struct ethtool_stats *, u64 *); int (*begin)(struct net_device *); void (*complete)(struct net_device *); + u32 (*get_ufo)(struct net_device *); + int (*set_ufo)(struct net_device *, u32); + u32 (*get_flags)(struct net_device *); + int (*set_flags)(struct net_device *, u32); u32 (*get_priv_flags)(struct net_device *); int (*set_priv_flags)(struct net_device *, u32); int (*get_sset_count)(struct net_device *, int); diff --git a/trunk/include/linux/if_team.h b/trunk/include/linux/if_team.h index 828181fbad5d..14f6388f5460 100644 --- a/trunk/include/linux/if_team.h +++ b/trunk/include/linux/if_team.h @@ -92,7 +92,7 @@ struct team { struct net_device *dev; /* associated netdevice */ struct team_pcpu_stats __percpu *pcpu_stats; - struct mutex lock; /* used for overall locking, e.g. port lists write */ + spinlock_t lock; /* used for overall locking, e.g. port lists write */ /* * port lists with port count @@ -140,11 +140,11 @@ static inline struct team_port *team_get_port_by_index_rcu(struct team *team, } extern int team_port_set_team_mac(struct team_port *port); -extern int team_options_register(struct team *team, - const struct team_option *option, - size_t option_count); +extern void team_options_register(struct team *team, + struct team_option *option, + size_t option_count); extern void team_options_unregister(struct team *team, - const struct team_option *option, + struct team_option *option, size_t option_count); extern int team_mode_register(struct team_mode *mode); extern int team_mode_unregister(struct team_mode *mode); diff --git a/trunk/include/linux/mdio-bitbang.h b/trunk/include/linux/mdio-bitbang.h index 76f52bbbb2f4..0fe00cd4c93c 100644 --- a/trunk/include/linux/mdio-bitbang.h +++ b/trunk/include/linux/mdio-bitbang.h @@ -32,8 +32,6 @@ struct mdiobb_ops { struct mdiobb_ctrl { const struct mdiobb_ops *ops; - /* reset callback */ - int (*reset)(struct mii_bus *bus); }; /* The returned bus is not yet registered with the phy layer. */ diff --git a/trunk/include/linux/mdio-gpio.h b/trunk/include/linux/mdio-gpio.h index 7c9fe3c2be73..e9d3fdfe41d7 100644 --- a/trunk/include/linux/mdio-gpio.h +++ b/trunk/include/linux/mdio-gpio.h @@ -20,8 +20,6 @@ struct mdio_gpio_platform_data { unsigned int phy_mask; int irqs[PHY_MAX_ADDR]; - /* reset callback */ - int (*reset)(struct mii_bus *bus); }; #endif /* __LINUX_MDIO_GPIO_H */ diff --git a/trunk/include/linux/netdev_features.h b/trunk/include/linux/netdev_features.h deleted file mode 100644 index 77f5202977ce..000000000000 --- a/trunk/include/linux/netdev_features.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Network device features. - * - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ -#ifndef _LINUX_NETDEV_FEATURES_H -#define _LINUX_NETDEV_FEATURES_H - -#include - -typedef u64 netdev_features_t; - -enum { - NETIF_F_SG_BIT, /* Scatter/gather IO. */ - NETIF_F_IP_CSUM_BIT, /* Can checksum TCP/UDP over IPv4. */ - __UNUSED_NETIF_F_1, - NETIF_F_HW_CSUM_BIT, /* Can checksum all the packets. */ - NETIF_F_IPV6_CSUM_BIT, /* Can checksum TCP/UDP over IPV6 */ - NETIF_F_HIGHDMA_BIT, /* Can DMA to high memory. */ - NETIF_F_FRAGLIST_BIT, /* Scatter/gather IO. */ - NETIF_F_HW_VLAN_TX_BIT, /* Transmit VLAN hw acceleration */ - NETIF_F_HW_VLAN_RX_BIT, /* Receive VLAN hw acceleration */ - NETIF_F_HW_VLAN_FILTER_BIT, /* Receive filtering on VLAN */ - NETIF_F_VLAN_CHALLENGED_BIT, /* Device cannot handle VLAN packets */ - NETIF_F_GSO_BIT, /* Enable software GSO. */ - NETIF_F_LLTX_BIT, /* LockLess TX - deprecated. Please */ - /* do not use LLTX in new drivers */ - NETIF_F_NETNS_LOCAL_BIT, /* Does not change network namespaces */ - NETIF_F_GRO_BIT, /* Generic receive offload */ - NETIF_F_LRO_BIT, /* large receive offload */ - - /**/NETIF_F_GSO_SHIFT, /* keep the order of SKB_GSO_* bits */ - NETIF_F_TSO_BIT /* ... TCPv4 segmentation */ - = NETIF_F_GSO_SHIFT, - NETIF_F_UFO_BIT, /* ... UDPv4 fragmentation */ - NETIF_F_GSO_ROBUST_BIT, /* ... ->SKB_GSO_DODGY */ - NETIF_F_TSO_ECN_BIT, /* ... TCP ECN support */ - NETIF_F_TSO6_BIT, /* ... TCPv6 segmentation */ - NETIF_F_FSO_BIT, /* ... FCoE segmentation */ - NETIF_F_GSO_RESERVED1, /* ... free (fill GSO_MASK to 8 bits) */ - /**/NETIF_F_GSO_LAST, /* [can't be last bit, see GSO_MASK] */ - NETIF_F_GSO_RESERVED2 /* ... free (fill GSO_MASK to 8 bits) */ - = NETIF_F_GSO_LAST, - - NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */ - NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */ - NETIF_F_FCOE_MTU_BIT, /* Supports max FCoE MTU, 2158 bytes*/ - NETIF_F_NTUPLE_BIT, /* N-tuple filters supported */ - NETIF_F_RXHASH_BIT, /* Receive hashing offload */ - NETIF_F_RXCSUM_BIT, /* Receive checksumming offload */ - NETIF_F_NOCACHE_COPY_BIT, /* Use no-cache copyfromuser */ - NETIF_F_LOOPBACK_BIT, /* Enable loopback */ - - /* - * Add your fresh new feature above and remember to update - * netdev_features_strings[] in net/core/ethtool.c and maybe - * some feature mask #defines below. Please also describe it - * in Documentation/networking/netdev-features.txt. - */ - - /**/NETDEV_FEATURE_COUNT -}; - -/* copy'n'paste compression ;) */ -#define __NETIF_F_BIT(bit) ((netdev_features_t)1 << (bit)) -#define __NETIF_F(name) __NETIF_F_BIT(NETIF_F_##name##_BIT) - -#define NETIF_F_FCOE_CRC __NETIF_F(FCOE_CRC) -#define NETIF_F_FCOE_MTU __NETIF_F(FCOE_MTU) -#define NETIF_F_FRAGLIST __NETIF_F(FRAGLIST) -#define NETIF_F_FSO __NETIF_F(FSO) -#define NETIF_F_GRO __NETIF_F(GRO) -#define NETIF_F_GSO __NETIF_F(GSO) -#define NETIF_F_GSO_ROBUST __NETIF_F(GSO_ROBUST) -#define NETIF_F_HIGHDMA __NETIF_F(HIGHDMA) -#define NETIF_F_HW_CSUM __NETIF_F(HW_CSUM) -#define NETIF_F_HW_VLAN_FILTER __NETIF_F(HW_VLAN_FILTER) -#define NETIF_F_HW_VLAN_RX __NETIF_F(HW_VLAN_RX) -#define NETIF_F_HW_VLAN_TX __NETIF_F(HW_VLAN_TX) -#define NETIF_F_IP_CSUM __NETIF_F(IP_CSUM) -#define NETIF_F_IPV6_CSUM __NETIF_F(IPV6_CSUM) -#define NETIF_F_LLTX __NETIF_F(LLTX) -#define NETIF_F_LOOPBACK __NETIF_F(LOOPBACK) -#define NETIF_F_LRO __NETIF_F(LRO) -#define NETIF_F_NETNS_LOCAL __NETIF_F(NETNS_LOCAL) -#define NETIF_F_NOCACHE_COPY __NETIF_F(NOCACHE_COPY) -#define NETIF_F_NTUPLE __NETIF_F(NTUPLE) -#define NETIF_F_RXCSUM __NETIF_F(RXCSUM) -#define NETIF_F_RXHASH __NETIF_F(RXHASH) -#define NETIF_F_SCTP_CSUM __NETIF_F(SCTP_CSUM) -#define NETIF_F_SG __NETIF_F(SG) -#define NETIF_F_TSO6 __NETIF_F(TSO6) -#define NETIF_F_TSO_ECN __NETIF_F(TSO_ECN) -#define NETIF_F_TSO __NETIF_F(TSO) -#define NETIF_F_UFO __NETIF_F(UFO) -#define NETIF_F_VLAN_CHALLENGED __NETIF_F(VLAN_CHALLENGED) - -/* Features valid for ethtool to change */ -/* = all defined minus driver/device-class-related */ -#define NETIF_F_NEVER_CHANGE (NETIF_F_VLAN_CHALLENGED | \ - NETIF_F_LLTX | NETIF_F_NETNS_LOCAL) - -/* remember that ((t)1 << t_BITS) is undefined in C99 */ -#define NETIF_F_ETHTOOL_BITS ((__NETIF_F_BIT(NETDEV_FEATURE_COUNT - 1) | \ - (__NETIF_F_BIT(NETDEV_FEATURE_COUNT - 1) - 1)) & \ - ~NETIF_F_NEVER_CHANGE) - -/* Segmentation offload feature mask */ -#define NETIF_F_GSO_MASK (__NETIF_F_BIT(NETIF_F_GSO_LAST + 1) - \ - __NETIF_F_BIT(NETIF_F_GSO_SHIFT)) - -/* List of features with software fallbacks. */ -#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \ - NETIF_F_TSO6 | NETIF_F_UFO) - -#define NETIF_F_GEN_CSUM NETIF_F_HW_CSUM -#define NETIF_F_V4_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IP_CSUM) -#define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM) -#define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM) - -#define NETIF_F_ALL_TSO (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN) - -#define NETIF_F_ALL_FCOE (NETIF_F_FCOE_CRC | NETIF_F_FCOE_MTU | \ - NETIF_F_FSO) - -/* - * If one device supports one of these features, then enable them - * for all in netdev_increment_features. - */ -#define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \ - NETIF_F_SG | NETIF_F_HIGHDMA | \ - NETIF_F_FRAGLIST | NETIF_F_VLAN_CHALLENGED) -/* - * If one device doesn't support one of these features, then disable it - * for all in netdev_increment_features. - */ -#define NETIF_F_ALL_FOR_ALL (NETIF_F_NOCACHE_COPY | NETIF_F_FSO) - -/* changeable features with no special hardware requirements */ -#define NETIF_F_SOFT_FEATURES (NETIF_F_GSO | NETIF_F_GRO) - -#endif /* _LINUX_NETDEV_FEATURES_H */ diff --git a/trunk/include/linux/netdevice.h b/trunk/include/linux/netdevice.h index b35ffd735ecc..cbeb5867cff7 100644 --- a/trunk/include/linux/netdevice.h +++ b/trunk/include/linux/netdevice.h @@ -51,8 +51,6 @@ #include #endif -#include - struct vlan_group; struct netpoll_info; struct phy_device; @@ -847,13 +845,12 @@ struct netdev_tc_txq { * Called to release previously enslaved netdev. * * Feature/offload setting functions. - * netdev_features_t (*ndo_fix_features)(struct net_device *dev, - * netdev_features_t features); + * u32 (*ndo_fix_features)(struct net_device *dev, u32 features); * Adjusts the requested feature flags according to device-specific * constraints, and returns the resulting flags. Must not modify * the device state. * - * int (*ndo_set_features)(struct net_device *dev, netdev_features_t features); + * int (*ndo_set_features)(struct net_device *dev, u32 features); * Called to update device configuration to new features. Passed * feature set might be less than what was returned by ndo_fix_features()). * Must return >0 or -errno if it changed dev->features itself. @@ -947,10 +944,10 @@ struct net_device_ops { struct net_device *slave_dev); int (*ndo_del_slave)(struct net_device *dev, struct net_device *slave_dev); - netdev_features_t (*ndo_fix_features)(struct net_device *dev, - netdev_features_t features); + u32 (*ndo_fix_features)(struct net_device *dev, + u32 features); int (*ndo_set_features)(struct net_device *dev, - netdev_features_t features); + u32 features); }; /* @@ -1000,13 +997,91 @@ struct net_device { struct list_head unreg_list; /* currently active device features */ - netdev_features_t features; + u32 features; /* user-changeable features */ - netdev_features_t hw_features; + u32 hw_features; /* user-requested features */ - netdev_features_t wanted_features; + u32 wanted_features; /* mask of features inheritable by VLAN devices */ - netdev_features_t vlan_features; + u32 vlan_features; + + /* Net device feature bits; if you change something, + * also update netdev_features_strings[] in ethtool.c */ + +#define NETIF_F_SG 1 /* Scatter/gather IO. */ +#define NETIF_F_IP_CSUM 2 /* Can checksum TCP/UDP over IPv4. */ +#define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */ +#define NETIF_F_HW_CSUM 8 /* Can checksum all the packets. */ +#define NETIF_F_IPV6_CSUM 16 /* Can checksum TCP/UDP over IPV6 */ +#define NETIF_F_HIGHDMA 32 /* Can DMA to high memory. */ +#define NETIF_F_FRAGLIST 64 /* Scatter/gather IO. */ +#define NETIF_F_HW_VLAN_TX 128 /* Transmit VLAN hw acceleration */ +#define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */ +#define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */ +#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */ +#define NETIF_F_GSO 2048 /* Enable software GSO. */ +#define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */ + /* do not use LLTX in new drivers */ +#define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */ +#define NETIF_F_GRO 16384 /* Generic receive offload */ +#define NETIF_F_LRO 32768 /* large receive offload */ + +/* the GSO_MASK reserves bits 16 through 23 */ +#define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */ +#define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */ +#define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/ +#define NETIF_F_NTUPLE (1 << 27) /* N-tuple filters supported */ +#define NETIF_F_RXHASH (1 << 28) /* Receive hashing offload */ +#define NETIF_F_RXCSUM (1 << 29) /* Receive checksumming offload */ +#define NETIF_F_NOCACHE_COPY (1 << 30) /* Use no-cache copyfromuser */ +#define NETIF_F_LOOPBACK (1 << 31) /* Enable loopback */ + + /* Segmentation offload features */ +#define NETIF_F_GSO_SHIFT 16 +#define NETIF_F_GSO_MASK 0x00ff0000 +#define NETIF_F_TSO (SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT) +#define NETIF_F_UFO (SKB_GSO_UDP << NETIF_F_GSO_SHIFT) +#define NETIF_F_GSO_ROBUST (SKB_GSO_DODGY << NETIF_F_GSO_SHIFT) +#define NETIF_F_TSO_ECN (SKB_GSO_TCP_ECN << NETIF_F_GSO_SHIFT) +#define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT) +#define NETIF_F_FSO (SKB_GSO_FCOE << NETIF_F_GSO_SHIFT) + + /* Features valid for ethtool to change */ + /* = all defined minus driver/device-class-related */ +#define NETIF_F_NEVER_CHANGE (NETIF_F_VLAN_CHALLENGED | \ + NETIF_F_LLTX | NETIF_F_NETNS_LOCAL) +#define NETIF_F_ETHTOOL_BITS (0xff3fffff & ~NETIF_F_NEVER_CHANGE) + + /* List of features with software fallbacks. */ +#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \ + NETIF_F_TSO6 | NETIF_F_UFO) + + +#define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM) +#define NETIF_F_V4_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IP_CSUM) +#define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM) +#define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM) + +#define NETIF_F_ALL_TSO (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN) + +#define NETIF_F_ALL_FCOE (NETIF_F_FCOE_CRC | NETIF_F_FCOE_MTU | \ + NETIF_F_FSO) + + /* + * If one device supports one of these features, then enable them + * for all in netdev_increment_features. + */ +#define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \ + NETIF_F_SG | NETIF_F_HIGHDMA | \ + NETIF_F_FRAGLIST | NETIF_F_VLAN_CHALLENGED) + /* + * If one device doesn't support one of these features, then disable it + * for all in netdev_increment_features. + */ +#define NETIF_F_ALL_FOR_ALL (NETIF_F_NOCACHE_COPY | NETIF_F_FSO) + + /* changeable features with no special hardware requirements */ +#define NETIF_F_SOFT_FEATURES (NETIF_F_GSO | NETIF_F_GRO) /* Interface index. Unique device identifier */ int ifindex; @@ -1440,7 +1515,7 @@ struct packet_type { struct packet_type *, struct net_device *); struct sk_buff *(*gso_segment)(struct sk_buff *skb, - netdev_features_t features); + u32 features); int (*gso_send_check)(struct sk_buff *skb); struct sk_buff **(*gro_receive)(struct sk_buff **head, struct sk_buff *skb); @@ -2445,8 +2520,7 @@ extern int netdev_set_master(struct net_device *dev, struct net_device *master) extern int netdev_set_bond_master(struct net_device *dev, struct net_device *master); extern int skb_checksum_help(struct sk_buff *skb); -extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, - netdev_features_t features); +extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, u32 features); #ifdef CONFIG_BUG extern void netdev_rx_csum_fault(struct net_device *dev); #else @@ -2473,13 +2547,11 @@ extern const char *netdev_drivername(const struct net_device *dev); extern void linkwatch_run_queue(void); -static inline netdev_features_t netdev_get_wanted_features( - struct net_device *dev) +static inline u32 netdev_get_wanted_features(struct net_device *dev) { return (dev->features & ~dev->hw_features) | dev->wanted_features; } -netdev_features_t netdev_increment_features(netdev_features_t all, - netdev_features_t one, netdev_features_t mask); +u32 netdev_increment_features(u32 all, u32 one, u32 mask); int __netdev_update_features(struct net_device *dev); void netdev_update_features(struct net_device *dev); void netdev_change_features(struct net_device *dev); @@ -2487,22 +2559,21 @@ void netdev_change_features(struct net_device *dev); void netif_stacked_transfer_operstate(const struct net_device *rootdev, struct net_device *dev); -netdev_features_t netif_skb_features(struct sk_buff *skb); +u32 netif_skb_features(struct sk_buff *skb); -static inline int net_gso_ok(netdev_features_t features, int gso_type) +static inline int net_gso_ok(u32 features, int gso_type) { - netdev_features_t feature = gso_type << NETIF_F_GSO_SHIFT; + int feature = gso_type << NETIF_F_GSO_SHIFT; return (features & feature) == feature; } -static inline int skb_gso_ok(struct sk_buff *skb, netdev_features_t features) +static inline int skb_gso_ok(struct sk_buff *skb, u32 features) { return net_gso_ok(features, skb_shinfo(skb)->gso_type) && (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); } -static inline int netif_needs_gso(struct sk_buff *skb, - netdev_features_t features) +static inline int netif_needs_gso(struct sk_buff *skb, int features) { return skb_is_gso(skb) && (!skb_gso_ok(skb, features) || unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); @@ -2521,6 +2592,22 @@ static inline int netif_is_bond_slave(struct net_device *dev) extern struct pernet_operations __net_initdata loopback_net_ops; +static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev) +{ + if (dev->features & NETIF_F_RXCSUM) + return 1; + if (!dev->ethtool_ops || !dev->ethtool_ops->get_rx_csum) + return 0; + return dev->ethtool_ops->get_rx_csum(dev); +} + +static inline u32 dev_ethtool_get_flags(struct net_device *dev) +{ + if (!dev->ethtool_ops || !dev->ethtool_ops->get_flags) + return 0; + return dev->ethtool_ops->get_flags(dev); +} + /* Logging, debugging and troubleshooting/diagnostic helpers. */ /* netdev_printk helpers, similar to dev_printk */ diff --git a/trunk/include/linux/skbuff.h b/trunk/include/linux/skbuff.h index b93117389cfe..abad8a0941e8 100644 --- a/trunk/include/linux/skbuff.h +++ b/trunk/include/linux/skbuff.h @@ -30,7 +30,6 @@ #include #include #include -#include /* Don't change this without changing skb_csum_unnecessary! */ #define CHECKSUM_NONE 0 @@ -88,6 +87,7 @@ * at device setup time. * NETIF_F_HW_CSUM - it is clever device, it is able to checksum * everything. + * NETIF_F_NO_CSUM - loopback or reliable single hop media. * NETIF_F_IP_CSUM - device is dumb. It is able to csum only * TCP/UDP over IPv4. Sigh. Vendors like this * way by an unknown reason. Though, see comment above @@ -2106,8 +2106,7 @@ extern void skb_split(struct sk_buff *skb, extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen); -extern struct sk_buff *skb_segment(struct sk_buff *skb, - netdev_features_t features); +extern struct sk_buff *skb_segment(struct sk_buff *skb, u32 features); static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, int len, void *buffer) diff --git a/trunk/include/linux/virtio_config.h b/trunk/include/linux/virtio_config.h index 63f98d0a8efa..add4790b21fe 100644 --- a/trunk/include/linux/virtio_config.h +++ b/trunk/include/linux/virtio_config.h @@ -100,10 +100,6 @@ * vdev: the virtio_device * This gives the final feature bits for the device: it can change * the dev->feature bits if it wants. - * @bus_name: return the bus name associated with the device - * vdev: the virtio_device - * This returns a pointer to the bus name a la pci_name from which - * the caller can then copy. */ typedef void vq_callback_t(struct virtqueue *); struct virtio_config_ops { @@ -121,7 +117,6 @@ struct virtio_config_ops { void (*del_vqs)(struct virtio_device *); u32 (*get_features)(struct virtio_device *vdev); void (*finalize_features)(struct virtio_device *vdev); - const char *(*bus_name)(struct virtio_device *vdev); }; /* If driver didn't advertise the feature, it will never appear. */ @@ -187,14 +182,5 @@ struct virtqueue *virtio_find_single_vq(struct virtio_device *vdev, return ERR_PTR(err); return vq; } - -static inline -const char *virtio_bus_name(struct virtio_device *vdev) -{ - if (!vdev->config->bus_name) - return "virtio"; - return vdev->config->bus_name(vdev); -} - #endif /* __KERNEL__ */ #endif /* _LINUX_VIRTIO_CONFIG_H */ diff --git a/trunk/include/net/protocol.h b/trunk/include/net/protocol.h index e182e13d6391..6f7eb800974a 100644 --- a/trunk/include/net/protocol.h +++ b/trunk/include/net/protocol.h @@ -38,7 +38,7 @@ struct net_protocol { void (*err_handler)(struct sk_buff *skb, u32 info); int (*gso_send_check)(struct sk_buff *skb); struct sk_buff *(*gso_segment)(struct sk_buff *skb, - netdev_features_t features); + u32 features); struct sk_buff **(*gro_receive)(struct sk_buff **head, struct sk_buff *skb); int (*gro_complete)(struct sk_buff *skb); @@ -57,7 +57,7 @@ struct inet6_protocol { int (*gso_send_check)(struct sk_buff *skb); struct sk_buff *(*gso_segment)(struct sk_buff *skb, - netdev_features_t features); + u32 features); struct sk_buff **(*gro_receive)(struct sk_buff **head, struct sk_buff *skb); int (*gro_complete)(struct sk_buff *skb); diff --git a/trunk/include/net/sock.h b/trunk/include/net/sock.h index 1331008ad885..67cd4581b6da 100644 --- a/trunk/include/net/sock.h +++ b/trunk/include/net/sock.h @@ -306,8 +306,8 @@ struct sock { kmemcheck_bitfield_end(flags); int sk_wmem_queued; gfp_t sk_allocation; - netdev_features_t sk_route_caps; - netdev_features_t sk_route_nocaps; + int sk_route_caps; + int sk_route_nocaps; int sk_gso_type; unsigned int sk_gso_max_size; int sk_rcvlowat; @@ -1393,7 +1393,7 @@ static inline int sk_can_gso(const struct sock *sk) extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst); -static inline void sk_nocaps_add(struct sock *sk, netdev_features_t flags) +static inline void sk_nocaps_add(struct sock *sk, int flags) { sk->sk_route_nocaps |= flags; sk->sk_route_caps &= ~flags; diff --git a/trunk/include/net/tcp.h b/trunk/include/net/tcp.h index 113160b84588..bb18c4d69aba 100644 --- a/trunk/include/net/tcp.h +++ b/trunk/include/net/tcp.h @@ -1430,8 +1430,7 @@ extern struct request_sock_ops tcp6_request_sock_ops; extern void tcp_v4_destroy_sock(struct sock *sk); extern int tcp_v4_gso_send_check(struct sk_buff *skb); -extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, - netdev_features_t features); +extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, u32 features); extern struct sk_buff **tcp_gro_receive(struct sk_buff **head, struct sk_buff *skb); extern struct sk_buff **tcp4_gro_receive(struct sk_buff **head, diff --git a/trunk/include/net/udp.h b/trunk/include/net/udp.h index f54a5156b248..3b285f402f48 100644 --- a/trunk/include/net/udp.h +++ b/trunk/include/net/udp.h @@ -258,6 +258,5 @@ extern void udp4_proc_exit(void); extern void udp_init(void); extern int udp4_ufo_send_check(struct sk_buff *skb); -extern struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, - netdev_features_t features); +extern struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, u32 features); #endif /* _UDP_H */ diff --git a/trunk/lib/vsprintf.c b/trunk/lib/vsprintf.c index 8e75003d62f6..993599e66e5a 100644 --- a/trunk/lib/vsprintf.c +++ b/trunk/lib/vsprintf.c @@ -777,18 +777,6 @@ char *uuid_string(char *buf, char *end, const u8 *addr, return string(buf, end, uuid, spec); } -static -char *netdev_feature_string(char *buf, char *end, const u8 *addr, - struct printf_spec spec) -{ - spec.flags |= SPECIAL | SMALL | ZEROPAD; - if (spec.field_width == -1) - spec.field_width = 2 + 2 * sizeof(netdev_features_t); - spec.base = 16; - - return number(buf, end, *(const netdev_features_t *)addr, spec); -} - int kptr_restrict __read_mostly; /* @@ -836,7 +824,6 @@ int kptr_restrict __read_mostly; * Do not use this feature without some mechanism to verify the * correctness of the format string and va_list arguments. * - 'K' For a kernel pointer that should be hidden from unprivileged users - * - 'NF' For a netdev_features_t * * Note: The difference between 'S' and 'F' is that on ia64 and ppc64 * function pointers are really function descriptors, which contain a @@ -909,12 +896,6 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, has_capability_noaudit(current, CAP_SYSLOG)))) ptr = NULL; break; - case 'N': - switch (fmt[1]) { - case 'F': - return netdev_feature_string(buf, end, ptr, spec); - } - break; } spec.flags |= SMALL; if (spec.field_width == -1) { diff --git a/trunk/net/8021q/vlan_dev.c b/trunk/net/8021q/vlan_dev.c index 2b5fcde1f629..bc2528624583 100644 --- a/trunk/net/8021q/vlan_dev.c +++ b/trunk/net/8021q/vlan_dev.c @@ -591,17 +591,18 @@ static void vlan_dev_uninit(struct net_device *dev) } } -static netdev_features_t vlan_dev_fix_features(struct net_device *dev, - netdev_features_t features) +static u32 vlan_dev_fix_features(struct net_device *dev, u32 features) { struct net_device *real_dev = vlan_dev_info(dev)->real_dev; u32 old_features = features; - features &= real_dev->vlan_features; - features |= NETIF_F_RXCSUM; features &= real_dev->features; + features &= real_dev->vlan_features; features |= old_features & NETIF_F_SOFT_FEATURES; + + if (dev_ethtool_get_rx_csum(real_dev)) + features |= NETIF_F_RXCSUM; features |= NETIF_F_LLTX; return features; diff --git a/trunk/net/bridge/br_device.c b/trunk/net/bridge/br_device.c index a3754ac262c3..feb77ea7b58e 100644 --- a/trunk/net/bridge/br_device.c +++ b/trunk/net/bridge/br_device.c @@ -186,8 +186,7 @@ static void br_getinfo(struct net_device *dev, struct ethtool_drvinfo *info) strcpy(info->bus_info, "N/A"); } -static netdev_features_t br_fix_features(struct net_device *dev, - netdev_features_t features) +static u32 br_fix_features(struct net_device *dev, u32 features) { struct net_bridge *br = netdev_priv(dev); @@ -342,10 +341,10 @@ void br_dev_setup(struct net_device *dev) dev->priv_flags = IFF_EBRIDGE; dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | - NETIF_F_GSO_MASK | NETIF_F_HW_CSUM | NETIF_F_LLTX | + NETIF_F_GSO_MASK | NETIF_F_NO_CSUM | NETIF_F_LLTX | NETIF_F_NETNS_LOCAL | NETIF_F_HW_VLAN_TX; dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | - NETIF_F_GSO_MASK | NETIF_F_HW_CSUM | + NETIF_F_GSO_MASK | NETIF_F_NO_CSUM | NETIF_F_HW_VLAN_TX; br->dev = dev; diff --git a/trunk/net/bridge/br_if.c b/trunk/net/bridge/br_if.c index 0a942fbccc9a..f603e5b0b930 100644 --- a/trunk/net/bridge/br_if.c +++ b/trunk/net/bridge/br_if.c @@ -296,11 +296,10 @@ int br_min_mtu(const struct net_bridge *br) /* * Recomputes features using slave's features */ -netdev_features_t br_features_recompute(struct net_bridge *br, - netdev_features_t features) +u32 br_features_recompute(struct net_bridge *br, u32 features) { struct net_bridge_port *p; - netdev_features_t mask; + u32 mask; if (list_empty(&br->port_list)) return features; diff --git a/trunk/net/bridge/br_private.h b/trunk/net/bridge/br_private.h index 4027029aa5e4..d7d6fb05411f 100644 --- a/trunk/net/bridge/br_private.h +++ b/trunk/net/bridge/br_private.h @@ -387,8 +387,7 @@ extern int br_add_if(struct net_bridge *br, extern int br_del_if(struct net_bridge *br, struct net_device *dev); extern int br_min_mtu(const struct net_bridge *br); -extern netdev_features_t br_features_recompute(struct net_bridge *br, - netdev_features_t features); +extern u32 br_features_recompute(struct net_bridge *br, u32 features); /* br_input.c */ extern int br_handle_frame_finish(struct sk_buff *skb); diff --git a/trunk/net/core/dev.c b/trunk/net/core/dev.c index 26c49d55e79d..6ba50a1e404c 100644 --- a/trunk/net/core/dev.c +++ b/trunk/net/core/dev.c @@ -137,7 +137,6 @@ #include #include #include -#include #include "net-sysfs.h" @@ -1321,6 +1320,8 @@ EXPORT_SYMBOL(dev_close); */ void dev_disable_lro(struct net_device *dev) { + u32 flags; + /* * If we're trying to disable lro on a vlan device * use the underlying physical device instead @@ -1328,9 +1329,15 @@ void dev_disable_lro(struct net_device *dev) if (is_vlan_dev(dev)) dev = vlan_dev_real_dev(dev); - dev->wanted_features &= ~NETIF_F_LRO; - netdev_update_features(dev); + if (dev->ethtool_ops && dev->ethtool_ops->get_flags) + flags = dev->ethtool_ops->get_flags(dev); + else + flags = ethtool_op_get_flags(dev); + + if (!(flags & ETH_FLAG_LRO)) + return; + __ethtool_set_flags(dev, flags & ~ETH_FLAG_LRO); if (unlikely(dev->features & NETIF_F_LRO)) netdev_WARN(dev, "failed to disable LRO!\n"); } @@ -1442,32 +1449,34 @@ int call_netdevice_notifiers(unsigned long val, struct net_device *dev) } EXPORT_SYMBOL(call_netdevice_notifiers); -static struct jump_label_key netstamp_needed __read_mostly; +/* When > 0 there are consumers of rx skb time stamps */ +static atomic_t netstamp_needed = ATOMIC_INIT(0); void net_enable_timestamp(void) { - jump_label_inc(&netstamp_needed); + atomic_inc(&netstamp_needed); } EXPORT_SYMBOL(net_enable_timestamp); void net_disable_timestamp(void) { - jump_label_dec(&netstamp_needed); + atomic_dec(&netstamp_needed); } EXPORT_SYMBOL(net_disable_timestamp); static inline void net_timestamp_set(struct sk_buff *skb) { - skb->tstamp.tv64 = 0; - if (static_branch(&netstamp_needed)) + if (atomic_read(&netstamp_needed)) __net_timestamp(skb); + else + skb->tstamp.tv64 = 0; } -#define net_timestamp_check(COND, SKB) \ - if (static_branch(&netstamp_needed)) { \ - if ((COND) && !(SKB)->tstamp.tv64) \ - __net_timestamp(SKB); \ - } \ +static inline void net_timestamp_check(struct sk_buff *skb) +{ + if (!skb->tstamp.tv64 && atomic_read(&netstamp_needed)) + __net_timestamp(skb); +} static int net_hwtstamp_validate(struct ifreq *ifr) { @@ -1914,8 +1923,7 @@ EXPORT_SYMBOL(skb_checksum_help); * It may return NULL if the skb requires no segmentation. This is * only possible when GSO is used for verifying header integrity. */ -struct sk_buff *skb_gso_segment(struct sk_buff *skb, - netdev_features_t features) +struct sk_buff *skb_gso_segment(struct sk_buff *skb, u32 features) { struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT); struct packet_type *ptype; @@ -1945,9 +1953,9 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, if (dev && dev->ethtool_ops && dev->ethtool_ops->get_drvinfo) dev->ethtool_ops->get_drvinfo(dev, &info); - WARN(1, "%s: caps=(%pNF, %pNF) len=%d data_len=%d ip_summed=%d\n", - info.driver, dev ? &dev->features : NULL, - skb->sk ? &skb->sk->sk_route_caps : NULL, + WARN(1, "%s: caps=(0x%lx, 0x%lx) len=%d data_len=%d ip_summed=%d\n", + info.driver, dev ? dev->features : 0L, + skb->sk ? skb->sk->sk_route_caps : 0L, skb->len, skb->data_len, skb->ip_summed); if (skb_header_cloned(skb) && @@ -2056,7 +2064,7 @@ static void dev_gso_skb_destructor(struct sk_buff *skb) * This function segments the given skb and stores the list of segments * in skb->next. */ -static int dev_gso_segment(struct sk_buff *skb, netdev_features_t features) +static int dev_gso_segment(struct sk_buff *skb, int features) { struct sk_buff *segs; @@ -2095,7 +2103,7 @@ static inline void skb_orphan_try(struct sk_buff *skb) } } -static bool can_checksum_protocol(netdev_features_t features, __be16 protocol) +static bool can_checksum_protocol(unsigned long features, __be16 protocol) { return ((features & NETIF_F_GEN_CSUM) || ((features & NETIF_F_V4_CSUM) && @@ -2106,8 +2114,7 @@ static bool can_checksum_protocol(netdev_features_t features, __be16 protocol) protocol == htons(ETH_P_FCOE))); } -static netdev_features_t harmonize_features(struct sk_buff *skb, - __be16 protocol, netdev_features_t features) +static u32 harmonize_features(struct sk_buff *skb, __be16 protocol, u32 features) { if (!can_checksum_protocol(features, protocol)) { features &= ~NETIF_F_ALL_CSUM; @@ -2119,10 +2126,10 @@ static netdev_features_t harmonize_features(struct sk_buff *skb, return features; } -netdev_features_t netif_skb_features(struct sk_buff *skb) +u32 netif_skb_features(struct sk_buff *skb) { __be16 protocol = skb->protocol; - netdev_features_t features = skb->dev->features; + u32 features = skb->dev->features; if (protocol == htons(ETH_P_8021Q)) { struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; @@ -2168,7 +2175,7 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, unsigned int skb_len; if (likely(!skb->next)) { - netdev_features_t features; + u32 features; /* * If device doesn't need skb->dst, release it right now while @@ -2990,7 +2997,8 @@ int netif_rx(struct sk_buff *skb) if (netpoll_rx(skb)) return NET_RX_DROP; - net_timestamp_check(netdev_tstamp_prequeue, skb); + if (netdev_tstamp_prequeue) + net_timestamp_check(skb); trace_netif_rx(skb); #ifdef CONFIG_RPS @@ -3222,7 +3230,8 @@ static int __netif_receive_skb(struct sk_buff *skb) int ret = NET_RX_DROP; __be16 type; - net_timestamp_check(!netdev_tstamp_prequeue, skb); + if (!netdev_tstamp_prequeue) + net_timestamp_check(skb); trace_netif_receive_skb(skb); @@ -3353,7 +3362,8 @@ static int __netif_receive_skb(struct sk_buff *skb) */ int netif_receive_skb(struct sk_buff *skb) { - net_timestamp_check(netdev_tstamp_prequeue, skb); + if (netdev_tstamp_prequeue) + net_timestamp_check(skb); if (skb_defer_rx_timestamp(skb)) return NET_RX_SUCCESS; @@ -5352,8 +5362,7 @@ static void rollback_registered(struct net_device *dev) list_del(&single); } -static netdev_features_t netdev_fix_features(struct net_device *dev, - netdev_features_t features) +static u32 netdev_fix_features(struct net_device *dev, u32 features) { /* Fix illegal checksum combinations */ if ((features & NETIF_F_HW_CSUM) && @@ -5362,6 +5371,12 @@ static netdev_features_t netdev_fix_features(struct net_device *dev, features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM); } + if ((features & NETIF_F_NO_CSUM) && + (features & (NETIF_F_HW_CSUM|NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) { + netdev_warn(dev, "mixed no checksumming and other settings.\n"); + features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM|NETIF_F_HW_CSUM); + } + /* Fix illegal SG+CSUM combinations. */ if ((features & NETIF_F_SG) && !(features & NETIF_F_ALL_CSUM)) { @@ -5409,7 +5424,7 @@ static netdev_features_t netdev_fix_features(struct net_device *dev, int __netdev_update_features(struct net_device *dev) { - netdev_features_t features; + u32 features; int err = 0; ASSERT_RTNL(); @@ -5425,16 +5440,16 @@ int __netdev_update_features(struct net_device *dev) if (dev->features == features) return 0; - netdev_dbg(dev, "Features changed: %pNF -> %pNF\n", - &dev->features, &features); + netdev_dbg(dev, "Features changed: 0x%08x -> 0x%08x\n", + dev->features, features); if (dev->netdev_ops->ndo_set_features) err = dev->netdev_ops->ndo_set_features(dev, features); if (unlikely(err < 0)) { netdev_err(dev, - "set_features() failed (%d); wanted %pNF, left %pNF\n", - err, &features, &dev->features); + "set_features() failed (%d); wanted 0x%08x, left 0x%08x\n", + err, features, dev->features); return -1; } @@ -5618,12 +5633,11 @@ int register_netdevice(struct net_device *dev) dev->wanted_features = dev->features & dev->hw_features; /* Turn on no cache copy if HW is doing checksum */ - if (!(dev->flags & IFF_LOOPBACK)) { - dev->hw_features |= NETIF_F_NOCACHE_COPY; - if (dev->features & NETIF_F_ALL_CSUM) { - dev->wanted_features |= NETIF_F_NOCACHE_COPY; - dev->features |= NETIF_F_NOCACHE_COPY; - } + dev->hw_features |= NETIF_F_NOCACHE_COPY; + if ((dev->features & NETIF_F_ALL_CSUM) && + !(dev->features & NETIF_F_NO_CSUM)) { + dev->wanted_features |= NETIF_F_NOCACHE_COPY; + dev->features |= NETIF_F_NOCACHE_COPY; } /* Make NETIF_F_HIGHDMA inheritable to VLAN devices. @@ -6359,8 +6373,7 @@ static int dev_cpu_callback(struct notifier_block *nfb, * @one to the master device with current feature set @all. Will not * enable anything that is off in @mask. Returns the new feature set. */ -netdev_features_t netdev_increment_features(netdev_features_t all, - netdev_features_t one, netdev_features_t mask) +u32 netdev_increment_features(u32 all, u32 one, u32 mask) { if (mask & NETIF_F_GEN_CSUM) mask |= NETIF_F_ALL_CSUM; @@ -6369,6 +6382,10 @@ netdev_features_t netdev_increment_features(netdev_features_t all, all |= one & (NETIF_F_ONE_FOR_ALL|NETIF_F_ALL_CSUM) & mask; all &= one | ~NETIF_F_ALL_FOR_ALL; + /* If device needs checksumming, downgrade to it. */ + if (all & (NETIF_F_ALL_CSUM & ~NETIF_F_NO_CSUM)) + all &= ~NETIF_F_NO_CSUM; + /* If one device supports hw checksumming, set for all. */ if (all & NETIF_F_GEN_CSUM) all &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_GEN_CSUM); diff --git a/trunk/net/core/ethtool.c b/trunk/net/core/ethtool.c index d2eff9ec88be..f44481707124 100644 --- a/trunk/net/core/ethtool.c +++ b/trunk/net/core/ethtool.c @@ -36,44 +36,235 @@ u32 ethtool_op_get_link(struct net_device *dev) } EXPORT_SYMBOL(ethtool_op_get_link); +u32 ethtool_op_get_tx_csum(struct net_device *dev) +{ + return (dev->features & NETIF_F_ALL_CSUM) != 0; +} +EXPORT_SYMBOL(ethtool_op_get_tx_csum); + +int ethtool_op_set_tx_csum(struct net_device *dev, u32 data) +{ + if (data) + dev->features |= NETIF_F_IP_CSUM; + else + dev->features &= ~NETIF_F_IP_CSUM; + + return 0; +} +EXPORT_SYMBOL(ethtool_op_set_tx_csum); + +int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data) +{ + if (data) + dev->features |= NETIF_F_HW_CSUM; + else + dev->features &= ~NETIF_F_HW_CSUM; + + return 0; +} +EXPORT_SYMBOL(ethtool_op_set_tx_hw_csum); + +int ethtool_op_set_tx_ipv6_csum(struct net_device *dev, u32 data) +{ + if (data) + dev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; + else + dev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); + + return 0; +} +EXPORT_SYMBOL(ethtool_op_set_tx_ipv6_csum); + +u32 ethtool_op_get_sg(struct net_device *dev) +{ + return (dev->features & NETIF_F_SG) != 0; +} +EXPORT_SYMBOL(ethtool_op_get_sg); + +int ethtool_op_set_sg(struct net_device *dev, u32 data) +{ + if (data) + dev->features |= NETIF_F_SG; + else + dev->features &= ~NETIF_F_SG; + + return 0; +} +EXPORT_SYMBOL(ethtool_op_set_sg); + +u32 ethtool_op_get_tso(struct net_device *dev) +{ + return (dev->features & NETIF_F_TSO) != 0; +} +EXPORT_SYMBOL(ethtool_op_get_tso); + +int ethtool_op_set_tso(struct net_device *dev, u32 data) +{ + if (data) + dev->features |= NETIF_F_TSO; + else + dev->features &= ~NETIF_F_TSO; + + return 0; +} +EXPORT_SYMBOL(ethtool_op_set_tso); + +u32 ethtool_op_get_ufo(struct net_device *dev) +{ + return (dev->features & NETIF_F_UFO) != 0; +} +EXPORT_SYMBOL(ethtool_op_get_ufo); + +int ethtool_op_set_ufo(struct net_device *dev, u32 data) +{ + if (data) + dev->features |= NETIF_F_UFO; + else + dev->features &= ~NETIF_F_UFO; + return 0; +} +EXPORT_SYMBOL(ethtool_op_set_ufo); + +/* the following list of flags are the same as their associated + * NETIF_F_xxx values in include/linux/netdevice.h + */ +static const u32 flags_dup_features = + (ETH_FLAG_LRO | ETH_FLAG_RXVLAN | ETH_FLAG_TXVLAN | ETH_FLAG_NTUPLE | + ETH_FLAG_RXHASH); + +u32 ethtool_op_get_flags(struct net_device *dev) +{ + /* in the future, this function will probably contain additional + * handling for flags which are not so easily handled + * by a simple masking operation + */ + + return dev->features & flags_dup_features; +} +EXPORT_SYMBOL(ethtool_op_get_flags); + +/* Check if device can enable (or disable) particular feature coded in "data" + * argument. Flags "supported" describe features that can be toggled by device. + * If feature can not be toggled, it state (enabled or disabled) must match + * hardcoded device features state, otherwise flags are marked as invalid. + */ +bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported) +{ + u32 features = dev->features & flags_dup_features; + /* "data" can contain only flags_dup_features bits, + * see __ethtool_set_flags */ + + return (features & ~supported) != (data & ~supported); +} +EXPORT_SYMBOL(ethtool_invalid_flags); + +int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported) +{ + if (ethtool_invalid_flags(dev, data, supported)) + return -EINVAL; + + dev->features = ((dev->features & ~flags_dup_features) | + (data & flags_dup_features)); + return 0; +} +EXPORT_SYMBOL(ethtool_op_set_flags); + /* Handlers for each ethtool command */ -#define ETHTOOL_DEV_FEATURE_WORDS ((NETDEV_FEATURE_COUNT + 31) / 32) - -static const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN] = { - [NETIF_F_SG_BIT] = "tx-scatter-gather", - [NETIF_F_IP_CSUM_BIT] = "tx-checksum-ipv4", - [NETIF_F_HW_CSUM_BIT] = "tx-checksum-ip-generic", - [NETIF_F_IPV6_CSUM_BIT] = "tx-checksum-ipv6", - [NETIF_F_HIGHDMA_BIT] = "highdma", - [NETIF_F_FRAGLIST_BIT] = "tx-scatter-gather-fraglist", - [NETIF_F_HW_VLAN_TX_BIT] = "tx-vlan-hw-insert", - - [NETIF_F_HW_VLAN_RX_BIT] = "rx-vlan-hw-parse", - [NETIF_F_HW_VLAN_FILTER_BIT] = "rx-vlan-filter", - [NETIF_F_VLAN_CHALLENGED_BIT] = "vlan-challenged", - [NETIF_F_GSO_BIT] = "tx-generic-segmentation", - [NETIF_F_LLTX_BIT] = "tx-lockless", - [NETIF_F_NETNS_LOCAL_BIT] = "netns-local", - [NETIF_F_GRO_BIT] = "rx-gro", - [NETIF_F_LRO_BIT] = "rx-lro", - - [NETIF_F_TSO_BIT] = "tx-tcp-segmentation", - [NETIF_F_UFO_BIT] = "tx-udp-fragmentation", - [NETIF_F_GSO_ROBUST_BIT] = "tx-gso-robust", - [NETIF_F_TSO_ECN_BIT] = "tx-tcp-ecn-segmentation", - [NETIF_F_TSO6_BIT] = "tx-tcp6-segmentation", - [NETIF_F_FSO_BIT] = "tx-fcoe-segmentation", - - [NETIF_F_FCOE_CRC_BIT] = "tx-checksum-fcoe-crc", - [NETIF_F_SCTP_CSUM_BIT] = "tx-checksum-sctp", - [NETIF_F_FCOE_MTU_BIT] = "fcoe-mtu", - [NETIF_F_NTUPLE_BIT] = "rx-ntuple-filter", - [NETIF_F_RXHASH_BIT] = "rx-hashing", - [NETIF_F_RXCSUM_BIT] = "rx-checksum", - [NETIF_F_NOCACHE_COPY_BIT] = "tx-nocache-copy", - [NETIF_F_LOOPBACK_BIT] = "loopback", -}; +#define ETHTOOL_DEV_FEATURE_WORDS 1 + +static void ethtool_get_features_compat(struct net_device *dev, + struct ethtool_get_features_block *features) +{ + if (!dev->ethtool_ops) + return; + + /* getting RX checksum */ + if (dev->ethtool_ops->get_rx_csum) + if (dev->ethtool_ops->get_rx_csum(dev)) + features[0].active |= NETIF_F_RXCSUM; + + /* mark legacy-changeable features */ + if (dev->ethtool_ops->set_sg) + features[0].available |= NETIF_F_SG; + if (dev->ethtool_ops->set_tx_csum) + features[0].available |= NETIF_F_ALL_CSUM; + if (dev->ethtool_ops->set_tso) + features[0].available |= NETIF_F_ALL_TSO; + if (dev->ethtool_ops->set_rx_csum) + features[0].available |= NETIF_F_RXCSUM; + if (dev->ethtool_ops->set_flags) + features[0].available |= flags_dup_features; +} + +static int ethtool_set_feature_compat(struct net_device *dev, + int (*legacy_set)(struct net_device *, u32), + struct ethtool_set_features_block *features, u32 mask) +{ + u32 do_set; + + if (!legacy_set) + return 0; + + if (!(features[0].valid & mask)) + return 0; + + features[0].valid &= ~mask; + + do_set = !!(features[0].requested & mask); + + if (legacy_set(dev, do_set) < 0) + netdev_info(dev, + "Legacy feature change (%s) failed for 0x%08x\n", + do_set ? "set" : "clear", mask); + + return 1; +} + +static int ethtool_set_flags_compat(struct net_device *dev, + int (*legacy_set)(struct net_device *, u32), + struct ethtool_set_features_block *features, u32 mask) +{ + u32 value; + + if (!legacy_set) + return 0; + + if (!(features[0].valid & mask)) + return 0; + + value = dev->features & ~features[0].valid; + value |= features[0].requested; + + features[0].valid &= ~mask; + + if (legacy_set(dev, value & mask) < 0) + netdev_info(dev, "Legacy flags change failed\n"); + + return 1; +} + +static int ethtool_set_features_compat(struct net_device *dev, + struct ethtool_set_features_block *features) +{ + int compat; + + if (!dev->ethtool_ops) + return 0; + + compat = ethtool_set_feature_compat(dev, dev->ethtool_ops->set_sg, + features, NETIF_F_SG); + compat |= ethtool_set_feature_compat(dev, dev->ethtool_ops->set_tx_csum, + features, NETIF_F_ALL_CSUM); + compat |= ethtool_set_feature_compat(dev, dev->ethtool_ops->set_tso, + features, NETIF_F_ALL_TSO); + compat |= ethtool_set_feature_compat(dev, dev->ethtool_ops->set_rx_csum, + features, NETIF_F_RXCSUM); + compat |= ethtool_set_flags_compat(dev, dev->ethtool_ops->set_flags, + features, flags_dup_features); + + return compat; +} static int ethtool_get_features(struct net_device *dev, void __user *useraddr) { @@ -81,20 +272,18 @@ static int ethtool_get_features(struct net_device *dev, void __user *useraddr) .cmd = ETHTOOL_GFEATURES, .size = ETHTOOL_DEV_FEATURE_WORDS, }; - struct ethtool_get_features_block features[ETHTOOL_DEV_FEATURE_WORDS]; + struct ethtool_get_features_block features[ETHTOOL_DEV_FEATURE_WORDS] = { + { + .available = dev->hw_features, + .requested = dev->wanted_features, + .active = dev->features, + .never_changed = NETIF_F_NEVER_CHANGE, + }, + }; u32 __user *sizeaddr; u32 copy_size; - int i; - /* in case feature bits run out again */ - BUILD_BUG_ON(ETHTOOL_DEV_FEATURE_WORDS*sizeof(u32) > sizeof(netdev_features_t)); - - for (i = 0; i < ETHTOOL_DEV_FEATURE_WORDS; ++i) { - features[i].available = (u32)(dev->hw_features >> (32*i)); - features[i].requested = (u32)(dev->wanted_features >> (32*i)); - features[i].active = (u32)(dev->features >> (32*i)); - features[i].never_changed = (u32)(NETIF_F_NEVER_CHANGE >> (32*i)); - } + ethtool_get_features_compat(dev, features); sizeaddr = useraddr + offsetof(struct ethtool_gfeatures, size); if (get_user(copy_size, sizeaddr)) @@ -116,8 +305,7 @@ static int ethtool_set_features(struct net_device *dev, void __user *useraddr) { struct ethtool_sfeatures cmd; struct ethtool_set_features_block features[ETHTOOL_DEV_FEATURE_WORDS]; - netdev_features_t wanted = 0, valid = 0; - int i, ret = 0; + int ret = 0; if (copy_from_user(&cmd, useraddr, sizeof(cmd))) return -EFAULT; @@ -129,29 +317,65 @@ static int ethtool_set_features(struct net_device *dev, void __user *useraddr) if (copy_from_user(features, useraddr, sizeof(features))) return -EFAULT; - for (i = 0; i < ETHTOOL_DEV_FEATURE_WORDS; ++i) { - valid |= (netdev_features_t)features[i].valid << (32*i); - wanted |= (netdev_features_t)features[i].requested << (32*i); - } - - if (valid & ~NETIF_F_ETHTOOL_BITS) + if (features[0].valid & ~NETIF_F_ETHTOOL_BITS) return -EINVAL; - if (valid & ~dev->hw_features) { - valid &= dev->hw_features; + if (ethtool_set_features_compat(dev, features)) + ret |= ETHTOOL_F_COMPAT; + + if (features[0].valid & ~dev->hw_features) { + features[0].valid &= dev->hw_features; ret |= ETHTOOL_F_UNSUPPORTED; } - dev->wanted_features &= ~valid; - dev->wanted_features |= wanted & valid; + dev->wanted_features &= ~features[0].valid; + dev->wanted_features |= features[0].valid & features[0].requested; __netdev_update_features(dev); - if ((dev->wanted_features ^ dev->features) & valid) + if ((dev->wanted_features ^ dev->features) & features[0].valid) ret |= ETHTOOL_F_WISH; return ret; } +static const char netdev_features_strings[ETHTOOL_DEV_FEATURE_WORDS * 32][ETH_GSTRING_LEN] = { + /* NETIF_F_SG */ "tx-scatter-gather", + /* NETIF_F_IP_CSUM */ "tx-checksum-ipv4", + /* NETIF_F_NO_CSUM */ "tx-checksum-unneeded", + /* NETIF_F_HW_CSUM */ "tx-checksum-ip-generic", + /* NETIF_F_IPV6_CSUM */ "tx-checksum-ipv6", + /* NETIF_F_HIGHDMA */ "highdma", + /* NETIF_F_FRAGLIST */ "tx-scatter-gather-fraglist", + /* NETIF_F_HW_VLAN_TX */ "tx-vlan-hw-insert", + + /* NETIF_F_HW_VLAN_RX */ "rx-vlan-hw-parse", + /* NETIF_F_HW_VLAN_FILTER */ "rx-vlan-filter", + /* NETIF_F_VLAN_CHALLENGED */ "vlan-challenged", + /* NETIF_F_GSO */ "tx-generic-segmentation", + /* NETIF_F_LLTX */ "tx-lockless", + /* NETIF_F_NETNS_LOCAL */ "netns-local", + /* NETIF_F_GRO */ "rx-gro", + /* NETIF_F_LRO */ "rx-lro", + + /* NETIF_F_TSO */ "tx-tcp-segmentation", + /* NETIF_F_UFO */ "tx-udp-fragmentation", + /* NETIF_F_GSO_ROBUST */ "tx-gso-robust", + /* NETIF_F_TSO_ECN */ "tx-tcp-ecn-segmentation", + /* NETIF_F_TSO6 */ "tx-tcp6-segmentation", + /* NETIF_F_FSO */ "tx-fcoe-segmentation", + "", + "", + + /* NETIF_F_FCOE_CRC */ "tx-checksum-fcoe-crc", + /* NETIF_F_SCTP_CSUM */ "tx-checksum-sctp", + /* NETIF_F_FCOE_MTU */ "fcoe-mtu", + /* NETIF_F_NTUPLE */ "rx-ntuple-filter", + /* NETIF_F_RXHASH */ "rx-hashing", + /* NETIF_F_RXCSUM */ "rx-checksum", + /* NETIF_F_NOCACHE_COPY */ "tx-nocache-copy", + /* NETIF_F_LOOPBACK */ "loopback", +}; + static int __ethtool_get_sset_count(struct net_device *dev, int sset) { const struct ethtool_ops *ops = dev->ethtool_ops; @@ -178,7 +402,7 @@ static void __ethtool_get_strings(struct net_device *dev, ops->get_strings(dev, stringset, data); } -static netdev_features_t ethtool_get_feature_mask(u32 eth_cmd) +static u32 ethtool_get_feature_mask(u32 eth_cmd) { /* feature masks of legacy discrete ethtool ops */ @@ -209,82 +433,136 @@ static netdev_features_t ethtool_get_feature_mask(u32 eth_cmd) } } +static void *__ethtool_get_one_feature_actor(struct net_device *dev, u32 ethcmd) +{ + const struct ethtool_ops *ops = dev->ethtool_ops; + + if (!ops) + return NULL; + + switch (ethcmd) { + case ETHTOOL_GTXCSUM: + return ops->get_tx_csum; + case ETHTOOL_GRXCSUM: + return ops->get_rx_csum; + case ETHTOOL_SSG: + return ops->get_sg; + case ETHTOOL_STSO: + return ops->get_tso; + case ETHTOOL_SUFO: + return ops->get_ufo; + default: + return NULL; + } +} + +static u32 __ethtool_get_rx_csum_oldbug(struct net_device *dev) +{ + return !!(dev->features & NETIF_F_ALL_CSUM); +} + static int ethtool_get_one_feature(struct net_device *dev, char __user *useraddr, u32 ethcmd) { - netdev_features_t mask = ethtool_get_feature_mask(ethcmd); + u32 mask = ethtool_get_feature_mask(ethcmd); struct ethtool_value edata = { .cmd = ethcmd, .data = !!(dev->features & mask), }; + /* compatibility with discrete get_ ops */ + if (!(dev->hw_features & mask)) { + u32 (*actor)(struct net_device *); + + actor = __ethtool_get_one_feature_actor(dev, ethcmd); + + /* bug compatibility with old get_rx_csum */ + if (ethcmd == ETHTOOL_GRXCSUM && !actor) + actor = __ethtool_get_rx_csum_oldbug; + + if (actor) + edata.data = actor(dev); + } + if (copy_to_user(useraddr, &edata, sizeof(edata))) return -EFAULT; return 0; } +static int __ethtool_set_tx_csum(struct net_device *dev, u32 data); +static int __ethtool_set_rx_csum(struct net_device *dev, u32 data); +static int __ethtool_set_sg(struct net_device *dev, u32 data); +static int __ethtool_set_tso(struct net_device *dev, u32 data); +static int __ethtool_set_ufo(struct net_device *dev, u32 data); + static int ethtool_set_one_feature(struct net_device *dev, void __user *useraddr, u32 ethcmd) { struct ethtool_value edata; - netdev_features_t mask; + u32 mask; if (copy_from_user(&edata, useraddr, sizeof(edata))) return -EFAULT; mask = ethtool_get_feature_mask(ethcmd); mask &= dev->hw_features; - if (!mask) - return -EOPNOTSUPP; - - if (edata.data) - dev->wanted_features |= mask; - else - dev->wanted_features &= ~mask; - - __netdev_update_features(dev); - - return 0; -} - -#define ETH_ALL_FLAGS (ETH_FLAG_LRO | ETH_FLAG_RXVLAN | ETH_FLAG_TXVLAN | \ - ETH_FLAG_NTUPLE | ETH_FLAG_RXHASH) -#define ETH_ALL_FEATURES (NETIF_F_LRO | NETIF_F_HW_VLAN_RX | \ - NETIF_F_HW_VLAN_TX | NETIF_F_NTUPLE | NETIF_F_RXHASH) + if (mask) { + if (edata.data) + dev->wanted_features |= mask; + else + dev->wanted_features &= ~mask; -static u32 __ethtool_get_flags(struct net_device *dev) -{ - u32 flags = 0; + __netdev_update_features(dev); + return 0; + } - if (dev->features & NETIF_F_LRO) flags |= ETH_FLAG_LRO; - if (dev->features & NETIF_F_HW_VLAN_RX) flags |= ETH_FLAG_RXVLAN; - if (dev->features & NETIF_F_HW_VLAN_TX) flags |= ETH_FLAG_TXVLAN; - if (dev->features & NETIF_F_NTUPLE) flags |= ETH_FLAG_NTUPLE; - if (dev->features & NETIF_F_RXHASH) flags |= ETH_FLAG_RXHASH; + /* Driver is not converted to ndo_fix_features or does not + * support changing this offload. In the latter case it won't + * have corresponding ethtool_ops field set. + * + * Following part is to be removed after all drivers advertise + * their changeable features in netdev->hw_features and stop + * using discrete offload setting ops. + */ - return flags; + switch (ethcmd) { + case ETHTOOL_STXCSUM: + return __ethtool_set_tx_csum(dev, edata.data); + case ETHTOOL_SRXCSUM: + return __ethtool_set_rx_csum(dev, edata.data); + case ETHTOOL_SSG: + return __ethtool_set_sg(dev, edata.data); + case ETHTOOL_STSO: + return __ethtool_set_tso(dev, edata.data); + case ETHTOOL_SUFO: + return __ethtool_set_ufo(dev, edata.data); + default: + return -EOPNOTSUPP; + } } -static int __ethtool_set_flags(struct net_device *dev, u32 data) +int __ethtool_set_flags(struct net_device *dev, u32 data) { - netdev_features_t features = 0, changed; + u32 changed; - if (data & ~ETH_ALL_FLAGS) + if (data & ~flags_dup_features) return -EINVAL; - if (data & ETH_FLAG_LRO) features |= NETIF_F_LRO; - if (data & ETH_FLAG_RXVLAN) features |= NETIF_F_HW_VLAN_RX; - if (data & ETH_FLAG_TXVLAN) features |= NETIF_F_HW_VLAN_TX; - if (data & ETH_FLAG_NTUPLE) features |= NETIF_F_NTUPLE; - if (data & ETH_FLAG_RXHASH) features |= NETIF_F_RXHASH; + /* legacy set_flags() op */ + if (dev->ethtool_ops->set_flags) { + if (unlikely(dev->hw_features & flags_dup_features)) + netdev_warn(dev, + "driver BUG: mixed hw_features and set_flags()\n"); + return dev->ethtool_ops->set_flags(dev, data); + } /* allow changing only bits set in hw_features */ - changed = (features ^ dev->features) & ETH_ALL_FEATURES; + changed = (data ^ dev->features) & flags_dup_features; if (changed & ~dev->hw_features) return (changed & dev->hw_features) ? -EINVAL : -EOPNOTSUPP; dev->wanted_features = - (dev->wanted_features & ~changed) | (features & changed); + (dev->wanted_features & ~changed) | (data & dev->hw_features); __netdev_update_features(dev); @@ -953,6 +1231,81 @@ static int ethtool_set_pauseparam(struct net_device *dev, void __user *useraddr) return dev->ethtool_ops->set_pauseparam(dev, &pauseparam); } +static int __ethtool_set_sg(struct net_device *dev, u32 data) +{ + int err; + + if (!dev->ethtool_ops->set_sg) + return -EOPNOTSUPP; + + if (data && !(dev->features & NETIF_F_ALL_CSUM)) + return -EINVAL; + + if (!data && dev->ethtool_ops->set_tso) { + err = dev->ethtool_ops->set_tso(dev, 0); + if (err) + return err; + } + + if (!data && dev->ethtool_ops->set_ufo) { + err = dev->ethtool_ops->set_ufo(dev, 0); + if (err) + return err; + } + return dev->ethtool_ops->set_sg(dev, data); +} + +static int __ethtool_set_tx_csum(struct net_device *dev, u32 data) +{ + int err; + + if (!dev->ethtool_ops->set_tx_csum) + return -EOPNOTSUPP; + + if (!data && dev->ethtool_ops->set_sg) { + err = __ethtool_set_sg(dev, 0); + if (err) + return err; + } + + return dev->ethtool_ops->set_tx_csum(dev, data); +} + +static int __ethtool_set_rx_csum(struct net_device *dev, u32 data) +{ + if (!dev->ethtool_ops->set_rx_csum) + return -EOPNOTSUPP; + + if (!data) + dev->features &= ~NETIF_F_GRO; + + return dev->ethtool_ops->set_rx_csum(dev, data); +} + +static int __ethtool_set_tso(struct net_device *dev, u32 data) +{ + if (!dev->ethtool_ops->set_tso) + return -EOPNOTSUPP; + + if (data && !(dev->features & NETIF_F_SG)) + return -EINVAL; + + return dev->ethtool_ops->set_tso(dev, data); +} + +static int __ethtool_set_ufo(struct net_device *dev, u32 data) +{ + if (!dev->ethtool_ops->set_ufo) + return -EOPNOTSUPP; + if (data && !(dev->features & NETIF_F_SG)) + return -EINVAL; + if (data && !((dev->features & NETIF_F_GEN_CSUM) || + (dev->features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM)) + == (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) + return -EINVAL; + return dev->ethtool_ops->set_ufo(dev, data); +} + static int ethtool_self_test(struct net_device *dev, char __user *useraddr) { struct ethtool_test test; @@ -1418,7 +1771,9 @@ int dev_ethtool(struct net *net, struct ifreq *ifr) break; case ETHTOOL_GFLAGS: rc = ethtool_get_value(dev, useraddr, ethcmd, - __ethtool_get_flags); + (dev->ethtool_ops->get_flags ? + dev->ethtool_ops->get_flags : + ethtool_op_get_flags)); break; case ETHTOOL_SFLAGS: rc = ethtool_set_value(dev, useraddr, __ethtool_set_flags); diff --git a/trunk/net/core/skbuff.c b/trunk/net/core/skbuff.c index cbc003b2914a..8d2c5b32f172 100644 --- a/trunk/net/core/skbuff.c +++ b/trunk/net/core/skbuff.c @@ -2670,7 +2670,7 @@ EXPORT_SYMBOL_GPL(skb_pull_rcsum); * a pointer to the first in a list of new skbs for the segments. * In case of error it returns ERR_PTR(err). */ -struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features) +struct sk_buff *skb_segment(struct sk_buff *skb, u32 features) { struct sk_buff *segs = NULL; struct sk_buff *tail = NULL; diff --git a/trunk/net/ieee802154/6lowpan.c b/trunk/net/ieee802154/6lowpan.c index e4ecc1eef98c..602f318a8d62 100644 --- a/trunk/net/ieee802154/6lowpan.c +++ b/trunk/net/ieee802154/6lowpan.c @@ -980,6 +980,9 @@ lowpan_fragment_xmit(struct sk_buff *skb, u8 *head, ret = dev_queue_xmit(frag); + if (ret < 0) + dev_kfree_skb(frag); + return ret; } diff --git a/trunk/net/ipv4/af_inet.c b/trunk/net/ipv4/af_inet.c index 15dc4c4828de..b2bbcd0ebd19 100644 --- a/trunk/net/ipv4/af_inet.c +++ b/trunk/net/ipv4/af_inet.c @@ -1250,8 +1250,7 @@ static int inet_gso_send_check(struct sk_buff *skb) return err; } -static struct sk_buff *inet_gso_segment(struct sk_buff *skb, - netdev_features_t features) +static struct sk_buff *inet_gso_segment(struct sk_buff *skb, u32 features) { struct sk_buff *segs = ERR_PTR(-EINVAL); struct iphdr *iph; diff --git a/trunk/net/ipv4/tcp.c b/trunk/net/ipv4/tcp.c index 50c359645665..34f5db1e1c8b 100644 --- a/trunk/net/ipv4/tcp.c +++ b/trunk/net/ipv4/tcp.c @@ -2653,8 +2653,7 @@ int compat_tcp_getsockopt(struct sock *sk, int level, int optname, EXPORT_SYMBOL(compat_tcp_getsockopt); #endif -struct sk_buff *tcp_tso_segment(struct sk_buff *skb, - netdev_features_t features) +struct sk_buff *tcp_tso_segment(struct sk_buff *skb, u32 features) { struct sk_buff *segs = ERR_PTR(-EINVAL); struct tcphdr *th; diff --git a/trunk/net/ipv4/udp.c b/trunk/net/ipv4/udp.c index b867ea23ece9..6854f581313f 100644 --- a/trunk/net/ipv4/udp.c +++ b/trunk/net/ipv4/udp.c @@ -2247,8 +2247,7 @@ int udp4_ufo_send_check(struct sk_buff *skb) return 0; } -struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, - netdev_features_t features) +struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, u32 features) { struct sk_buff *segs = ERR_PTR(-EINVAL); unsigned int mss; diff --git a/trunk/net/ipv6/af_inet6.c b/trunk/net/ipv6/af_inet6.c index ee3319487c4f..282dc7a91f32 100644 --- a/trunk/net/ipv6/af_inet6.c +++ b/trunk/net/ipv6/af_inet6.c @@ -769,8 +769,7 @@ static int ipv6_gso_send_check(struct sk_buff *skb) return err; } -static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, - netdev_features_t features) +static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, u32 features) { struct sk_buff *segs = ERR_PTR(-EINVAL); struct ipv6hdr *ipv6h; diff --git a/trunk/net/ipv6/udp.c b/trunk/net/ipv6/udp.c index ccfb0451b1c3..b4a4a15fa96f 100644 --- a/trunk/net/ipv6/udp.c +++ b/trunk/net/ipv6/udp.c @@ -1300,8 +1300,7 @@ static int udp6_ufo_send_check(struct sk_buff *skb) return 0; } -static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, - netdev_features_t features) +static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, u32 features) { struct sk_buff *segs = ERR_PTR(-EINVAL); unsigned int mss;