aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/arm/ks8695net.c288
-rw-r--r--drivers/net/bfin_mac.c9
-rw-r--r--drivers/net/cassini.c6
-rw-r--r--drivers/net/gianfar.c10
-rw-r--r--drivers/net/gianfar.h10
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c23
-rw-r--r--drivers/net/macvtap.c2
-rw-r--r--drivers/net/r8169.c43
-rw-r--r--drivers/net/sfc/efx.c18
-rw-r--r--drivers/net/sfc/net_driver.h10
-rw-r--r--drivers/net/tile/tilepro.c10
-rw-r--r--drivers/net/usb/cdc_ncm.c4
-rw-r--r--drivers/net/vxge/vxge-main.c1
-rw-r--r--drivers/vhost/vhost.c18
-rw-r--r--include/linux/etherdevice.h11
-rw-r--r--include/linux/netdevice.h5
-rw-r--r--include/net/ah.h2
-rw-r--r--net/core/dev.c29
-rw-r--r--net/sched/sch_teql.c26
19 files changed, 224 insertions, 301 deletions
diff --git a/drivers/net/arm/ks8695net.c b/drivers/net/arm/ks8695net.c
index 54c6d849cf25..62d6f88cbab5 100644
--- a/drivers/net/arm/ks8695net.c
+++ b/drivers/net/arm/ks8695net.c
@@ -854,12 +854,12 @@ ks8695_set_msglevel(struct net_device *ndev, u32 value)
854} 854}
855 855
856/** 856/**
857 * ks8695_get_settings - Get device-specific settings. 857 * ks8695_wan_get_settings - Get device-specific settings.
858 * @ndev: The network device to read settings from 858 * @ndev: The network device to read settings from
859 * @cmd: The ethtool structure to read into 859 * @cmd: The ethtool structure to read into
860 */ 860 */
861static int 861static int
862ks8695_get_settings(struct net_device *ndev, struct ethtool_cmd *cmd) 862ks8695_wan_get_settings(struct net_device *ndev, struct ethtool_cmd *cmd)
863{ 863{
864 struct ks8695_priv *ksp = netdev_priv(ndev); 864 struct ks8695_priv *ksp = netdev_priv(ndev);
865 u32 ctrl; 865 u32 ctrl;
@@ -870,69 +870,50 @@ ks8695_get_settings(struct net_device *ndev, struct ethtool_cmd *cmd)
870 SUPPORTED_TP | SUPPORTED_MII); 870 SUPPORTED_TP | SUPPORTED_MII);
871 cmd->transceiver = XCVR_INTERNAL; 871 cmd->transceiver = XCVR_INTERNAL;
872 872
873 /* Port specific extras */ 873 cmd->advertising = ADVERTISED_TP | ADVERTISED_MII;
874 switch (ksp->dtype) { 874 cmd->port = PORT_MII;
875 case KS8695_DTYPE_HPNA: 875 cmd->supported |= (SUPPORTED_Autoneg | SUPPORTED_Pause);
876 cmd->phy_address = 0; 876 cmd->phy_address = 0;
877 /* not supported for HPNA */
878 cmd->autoneg = AUTONEG_DISABLE;
879 877
880 /* BUG: Erm, dtype hpna implies no phy regs */ 878 ctrl = readl(ksp->phyiface_regs + KS8695_WMC);
881 /* 879 if ((ctrl & WMC_WAND) == 0) {
882 ctrl = readl(KS8695_MISC_VA + KS8695_HMC); 880 /* auto-negotiation is enabled */
883 cmd->speed = (ctrl & HMC_HSS) ? SPEED_100 : SPEED_10; 881 cmd->advertising |= ADVERTISED_Autoneg;
884 cmd->duplex = (ctrl & HMC_HDS) ? DUPLEX_FULL : DUPLEX_HALF; 882 if (ctrl & WMC_WANA100F)
885 */ 883 cmd->advertising |= ADVERTISED_100baseT_Full;
886 return -EOPNOTSUPP; 884 if (ctrl & WMC_WANA100H)
887 case KS8695_DTYPE_WAN: 885 cmd->advertising |= ADVERTISED_100baseT_Half;
888 cmd->advertising = ADVERTISED_TP | ADVERTISED_MII; 886 if (ctrl & WMC_WANA10F)
889 cmd->port = PORT_MII; 887 cmd->advertising |= ADVERTISED_10baseT_Full;
890 cmd->supported |= (SUPPORTED_Autoneg | SUPPORTED_Pause); 888 if (ctrl & WMC_WANA10H)
891 cmd->phy_address = 0; 889 cmd->advertising |= ADVERTISED_10baseT_Half;
890 if (ctrl & WMC_WANAP)
891 cmd->advertising |= ADVERTISED_Pause;
892 cmd->autoneg = AUTONEG_ENABLE;
893
894 cmd->speed = (ctrl & WMC_WSS) ? SPEED_100 : SPEED_10;
895 cmd->duplex = (ctrl & WMC_WDS) ?
896 DUPLEX_FULL : DUPLEX_HALF;
897 } else {
898 /* auto-negotiation is disabled */
899 cmd->autoneg = AUTONEG_DISABLE;
892 900
893 ctrl = readl(ksp->phyiface_regs + KS8695_WMC); 901 cmd->speed = (ctrl & WMC_WANF100) ?
894 if ((ctrl & WMC_WAND) == 0) { 902 SPEED_100 : SPEED_10;
895 /* auto-negotiation is enabled */ 903 cmd->duplex = (ctrl & WMC_WANFF) ?
896 cmd->advertising |= ADVERTISED_Autoneg; 904 DUPLEX_FULL : DUPLEX_HALF;
897 if (ctrl & WMC_WANA100F)
898 cmd->advertising |= ADVERTISED_100baseT_Full;
899 if (ctrl & WMC_WANA100H)
900 cmd->advertising |= ADVERTISED_100baseT_Half;
901 if (ctrl & WMC_WANA10F)
902 cmd->advertising |= ADVERTISED_10baseT_Full;
903 if (ctrl & WMC_WANA10H)
904 cmd->advertising |= ADVERTISED_10baseT_Half;
905 if (ctrl & WMC_WANAP)
906 cmd->advertising |= ADVERTISED_Pause;
907 cmd->autoneg = AUTONEG_ENABLE;
908
909 cmd->speed = (ctrl & WMC_WSS) ? SPEED_100 : SPEED_10;
910 cmd->duplex = (ctrl & WMC_WDS) ?
911 DUPLEX_FULL : DUPLEX_HALF;
912 } else {
913 /* auto-negotiation is disabled */
914 cmd->autoneg = AUTONEG_DISABLE;
915
916 cmd->speed = (ctrl & WMC_WANF100) ?
917 SPEED_100 : SPEED_10;
918 cmd->duplex = (ctrl & WMC_WANFF) ?
919 DUPLEX_FULL : DUPLEX_HALF;
920 }
921 break;
922 case KS8695_DTYPE_LAN:
923 return -EOPNOTSUPP;
924 } 905 }
925 906
926 return 0; 907 return 0;
927} 908}
928 909
929/** 910/**
930 * ks8695_set_settings - Set device-specific settings. 911 * ks8695_wan_set_settings - Set device-specific settings.
931 * @ndev: The network device to configure 912 * @ndev: The network device to configure
932 * @cmd: The settings to configure 913 * @cmd: The settings to configure
933 */ 914 */
934static int 915static int
935ks8695_set_settings(struct net_device *ndev, struct ethtool_cmd *cmd) 916ks8695_wan_set_settings(struct net_device *ndev, struct ethtool_cmd *cmd)
936{ 917{
937 struct ks8695_priv *ksp = netdev_priv(ndev); 918 struct ks8695_priv *ksp = netdev_priv(ndev);
938 u32 ctrl; 919 u32 ctrl;
@@ -956,171 +937,85 @@ ks8695_set_settings(struct net_device *ndev, struct ethtool_cmd *cmd)
956 ADVERTISED_100baseT_Full)) == 0) 937 ADVERTISED_100baseT_Full)) == 0)
957 return -EINVAL; 938 return -EINVAL;
958 939
959 switch (ksp->dtype) { 940 ctrl = readl(ksp->phyiface_regs + KS8695_WMC);
960 case KS8695_DTYPE_HPNA:
961 /* HPNA does not support auto-negotiation. */
962 return -EINVAL;
963 case KS8695_DTYPE_WAN:
964 ctrl = readl(ksp->phyiface_regs + KS8695_WMC);
965
966 ctrl &= ~(WMC_WAND | WMC_WANA100F | WMC_WANA100H |
967 WMC_WANA10F | WMC_WANA10H);
968 if (cmd->advertising & ADVERTISED_100baseT_Full)
969 ctrl |= WMC_WANA100F;
970 if (cmd->advertising & ADVERTISED_100baseT_Half)
971 ctrl |= WMC_WANA100H;
972 if (cmd->advertising & ADVERTISED_10baseT_Full)
973 ctrl |= WMC_WANA10F;
974 if (cmd->advertising & ADVERTISED_10baseT_Half)
975 ctrl |= WMC_WANA10H;
976
977 /* force a re-negotiation */
978 ctrl |= WMC_WANR;
979 writel(ctrl, ksp->phyiface_regs + KS8695_WMC);
980 break;
981 case KS8695_DTYPE_LAN:
982 return -EOPNOTSUPP;
983 }
984 941
942 ctrl &= ~(WMC_WAND | WMC_WANA100F | WMC_WANA100H |
943 WMC_WANA10F | WMC_WANA10H);
944 if (cmd->advertising & ADVERTISED_100baseT_Full)
945 ctrl |= WMC_WANA100F;
946 if (cmd->advertising & ADVERTISED_100baseT_Half)
947 ctrl |= WMC_WANA100H;
948 if (cmd->advertising & ADVERTISED_10baseT_Full)
949 ctrl |= WMC_WANA10F;
950 if (cmd->advertising & ADVERTISED_10baseT_Half)
951 ctrl |= WMC_WANA10H;
952
953 /* force a re-negotiation */
954 ctrl |= WMC_WANR;
955 writel(ctrl, ksp->phyiface_regs + KS8695_WMC);
985 } else { 956 } else {
986 switch (ksp->dtype) { 957 ctrl = readl(ksp->phyiface_regs + KS8695_WMC);
987 case KS8695_DTYPE_HPNA: 958
988 /* BUG: dtype_hpna implies no phy registers */ 959 /* disable auto-negotiation */
989 /* 960 ctrl |= WMC_WAND;
990 ctrl = __raw_readl(KS8695_MISC_VA + KS8695_HMC); 961 ctrl &= ~(WMC_WANF100 | WMC_WANFF);
991 962
992 ctrl &= ~(HMC_HSS | HMC_HDS); 963 if (cmd->speed == SPEED_100)
993 if (cmd->speed == SPEED_100) 964 ctrl |= WMC_WANF100;
994 ctrl |= HMC_HSS; 965 if (cmd->duplex == DUPLEX_FULL)
995 if (cmd->duplex == DUPLEX_FULL) 966 ctrl |= WMC_WANFF;
996 ctrl |= HMC_HDS; 967
997 968 writel(ctrl, ksp->phyiface_regs + KS8695_WMC);
998 __raw_writel(ctrl, KS8695_MISC_VA + KS8695_HMC);
999 */
1000 return -EOPNOTSUPP;
1001 case KS8695_DTYPE_WAN:
1002 ctrl = readl(ksp->phyiface_regs + KS8695_WMC);
1003
1004 /* disable auto-negotiation */
1005 ctrl |= WMC_WAND;
1006 ctrl &= ~(WMC_WANF100 | WMC_WANFF);
1007
1008 if (cmd->speed == SPEED_100)
1009 ctrl |= WMC_WANF100;
1010 if (cmd->duplex == DUPLEX_FULL)
1011 ctrl |= WMC_WANFF;
1012
1013 writel(ctrl, ksp->phyiface_regs + KS8695_WMC);
1014 break;
1015 case KS8695_DTYPE_LAN:
1016 return -EOPNOTSUPP;
1017 }
1018 } 969 }
1019 970
1020 return 0; 971 return 0;
1021} 972}
1022 973
1023/** 974/**
1024 * ks8695_nwayreset - Restart the autonegotiation on the port. 975 * ks8695_wan_nwayreset - Restart the autonegotiation on the port.
1025 * @ndev: The network device to restart autoneotiation on 976 * @ndev: The network device to restart autoneotiation on
1026 */ 977 */
1027static int 978static int
1028ks8695_nwayreset(struct net_device *ndev) 979ks8695_wan_nwayreset(struct net_device *ndev)
1029{ 980{
1030 struct ks8695_priv *ksp = netdev_priv(ndev); 981 struct ks8695_priv *ksp = netdev_priv(ndev);
1031 u32 ctrl; 982 u32 ctrl;
1032 983
1033 switch (ksp->dtype) { 984 ctrl = readl(ksp->phyiface_regs + KS8695_WMC);
1034 case KS8695_DTYPE_HPNA:
1035 /* No phy means no autonegotiation on hpna */
1036 return -EINVAL;
1037 case KS8695_DTYPE_WAN:
1038 ctrl = readl(ksp->phyiface_regs + KS8695_WMC);
1039
1040 if ((ctrl & WMC_WAND) == 0)
1041 writel(ctrl | WMC_WANR,
1042 ksp->phyiface_regs + KS8695_WMC);
1043 else
1044 /* auto-negotiation not enabled */
1045 return -EINVAL;
1046 break;
1047 case KS8695_DTYPE_LAN:
1048 return -EOPNOTSUPP;
1049 }
1050
1051 return 0;
1052}
1053 985
1054/** 986 if ((ctrl & WMC_WAND) == 0)
1055 * ks8695_get_link - Retrieve link status of network interface 987 writel(ctrl | WMC_WANR,
1056 * @ndev: The network interface to retrive the link status of. 988 ksp->phyiface_regs + KS8695_WMC);
1057 */ 989 else
1058static u32 990 /* auto-negotiation not enabled */
1059ks8695_get_link(struct net_device *ndev) 991 return -EINVAL;
1060{
1061 struct ks8695_priv *ksp = netdev_priv(ndev);
1062 u32 ctrl;
1063 992
1064 switch (ksp->dtype) {
1065 case KS8695_DTYPE_HPNA:
1066 /* HPNA always has link */
1067 return 1;
1068 case KS8695_DTYPE_WAN:
1069 /* WAN we can read the PHY for */
1070 ctrl = readl(ksp->phyiface_regs + KS8695_WMC);
1071 return ctrl & WMC_WLS;
1072 case KS8695_DTYPE_LAN:
1073 return -EOPNOTSUPP;
1074 }
1075 return 0; 993 return 0;
1076} 994}
1077 995
1078/** 996/**
1079 * ks8695_get_pause - Retrieve network pause/flow-control advertising 997 * ks8695_wan_get_pause - Retrieve network pause/flow-control advertising
1080 * @ndev: The device to retrieve settings from 998 * @ndev: The device to retrieve settings from
1081 * @param: The structure to fill out with the information 999 * @param: The structure to fill out with the information
1082 */ 1000 */
1083static void 1001static void
1084ks8695_get_pause(struct net_device *ndev, struct ethtool_pauseparam *param) 1002ks8695_wan_get_pause(struct net_device *ndev, struct ethtool_pauseparam *param)
1085{ 1003{
1086 struct ks8695_priv *ksp = netdev_priv(ndev); 1004 struct ks8695_priv *ksp = netdev_priv(ndev);
1087 u32 ctrl; 1005 u32 ctrl;
1088 1006
1089 switch (ksp->dtype) { 1007 ctrl = readl(ksp->phyiface_regs + KS8695_WMC);
1090 case KS8695_DTYPE_HPNA:
1091 /* No phy link on hpna to configure */
1092 return;
1093 case KS8695_DTYPE_WAN:
1094 ctrl = readl(ksp->phyiface_regs + KS8695_WMC);
1095
1096 /* advertise Pause */
1097 param->autoneg = (ctrl & WMC_WANAP);
1098 1008
1099 /* current Rx Flow-control */ 1009 /* advertise Pause */
1100 ctrl = ks8695_readreg(ksp, KS8695_DRXC); 1010 param->autoneg = (ctrl & WMC_WANAP);
1101 param->rx_pause = (ctrl & DRXC_RFCE);
1102 1011
1103 /* current Tx Flow-control */ 1012 /* current Rx Flow-control */
1104 ctrl = ks8695_readreg(ksp, KS8695_DTXC); 1013 ctrl = ks8695_readreg(ksp, KS8695_DRXC);
1105 param->tx_pause = (ctrl & DTXC_TFCE); 1014 param->rx_pause = (ctrl & DRXC_RFCE);
1106 break;
1107 case KS8695_DTYPE_LAN:
1108 /* The LAN's "phy" is a direct-attached switch */
1109 return;
1110 }
1111}
1112 1015
1113/** 1016 /* current Tx Flow-control */
1114 * ks8695_set_pause - Configure pause/flow-control 1017 ctrl = ks8695_readreg(ksp, KS8695_DTXC);
1115 * @ndev: The device to configure 1018 param->tx_pause = (ctrl & DTXC_TFCE);
1116 * @param: The pause parameters to set
1117 *
1118 * TODO: Implement this
1119 */
1120static int
1121ks8695_set_pause(struct net_device *ndev, struct ethtool_pauseparam *param)
1122{
1123 return -EOPNOTSUPP;
1124} 1019}
1125 1020
1126/** 1021/**
@@ -1140,12 +1035,17 @@ ks8695_get_drvinfo(struct net_device *ndev, struct ethtool_drvinfo *info)
1140static const struct ethtool_ops ks8695_ethtool_ops = { 1035static const struct ethtool_ops ks8695_ethtool_ops = {
1141 .get_msglevel = ks8695_get_msglevel, 1036 .get_msglevel = ks8695_get_msglevel,
1142 .set_msglevel = ks8695_set_msglevel, 1037 .set_msglevel = ks8695_set_msglevel,
1143 .get_settings = ks8695_get_settings, 1038 .get_drvinfo = ks8695_get_drvinfo,
1144 .set_settings = ks8695_set_settings, 1039};
1145 .nway_reset = ks8695_nwayreset, 1040
1146 .get_link = ks8695_get_link, 1041static const struct ethtool_ops ks8695_wan_ethtool_ops = {
1147 .get_pauseparam = ks8695_get_pause, 1042 .get_msglevel = ks8695_get_msglevel,
1148 .set_pauseparam = ks8695_set_pause, 1043 .set_msglevel = ks8695_set_msglevel,
1044 .get_settings = ks8695_wan_get_settings,
1045 .set_settings = ks8695_wan_set_settings,
1046 .nway_reset = ks8695_wan_nwayreset,
1047 .get_link = ethtool_op_get_link,
1048 .get_pauseparam = ks8695_wan_get_pause,
1149 .get_drvinfo = ks8695_get_drvinfo, 1049 .get_drvinfo = ks8695_get_drvinfo,
1150}; 1050};
1151 1051
@@ -1541,7 +1441,6 @@ ks8695_probe(struct platform_device *pdev)
1541 1441
1542 /* driver system setup */ 1442 /* driver system setup */
1543 ndev->netdev_ops = &ks8695_netdev_ops; 1443 ndev->netdev_ops = &ks8695_netdev_ops;
1544 SET_ETHTOOL_OPS(ndev, &ks8695_ethtool_ops);
1545 ndev->watchdog_timeo = msecs_to_jiffies(watchdog); 1444 ndev->watchdog_timeo = msecs_to_jiffies(watchdog);
1546 1445
1547 netif_napi_add(ndev, &ksp->napi, ks8695_poll, NAPI_WEIGHT); 1446 netif_napi_add(ndev, &ksp->napi, ks8695_poll, NAPI_WEIGHT);
@@ -1608,12 +1507,15 @@ ks8695_probe(struct platform_device *pdev)
1608 if (ksp->phyiface_regs && ksp->link_irq == -1) { 1507 if (ksp->phyiface_regs && ksp->link_irq == -1) {
1609 ks8695_init_switch(ksp); 1508 ks8695_init_switch(ksp);
1610 ksp->dtype = KS8695_DTYPE_LAN; 1509 ksp->dtype = KS8695_DTYPE_LAN;
1510 SET_ETHTOOL_OPS(ndev, &ks8695_ethtool_ops);
1611 } else if (ksp->phyiface_regs && ksp->link_irq != -1) { 1511 } else if (ksp->phyiface_regs && ksp->link_irq != -1) {
1612 ks8695_init_wan_phy(ksp); 1512 ks8695_init_wan_phy(ksp);
1613 ksp->dtype = KS8695_DTYPE_WAN; 1513 ksp->dtype = KS8695_DTYPE_WAN;
1514 SET_ETHTOOL_OPS(ndev, &ks8695_wan_ethtool_ops);
1614 } else { 1515 } else {
1615 /* No initialisation since HPNA does not have a PHY */ 1516 /* No initialisation since HPNA does not have a PHY */
1616 ksp->dtype = KS8695_DTYPE_HPNA; 1517 ksp->dtype = KS8695_DTYPE_HPNA;
1518 SET_ETHTOOL_OPS(ndev, &ks8695_ethtool_ops);
1617 } 1519 }
1618 1520
1619 /* And bring up the net_device with the net core */ 1521 /* And bring up the net_device with the net core */
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index fe75e7a9742e..22abfb39d813 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -1284,19 +1284,12 @@ static void bfin_mac_multicast_hash(struct net_device *dev)
1284{ 1284{
1285 u32 emac_hashhi, emac_hashlo; 1285 u32 emac_hashhi, emac_hashlo;
1286 struct netdev_hw_addr *ha; 1286 struct netdev_hw_addr *ha;
1287 char *addrs;
1288 u32 crc; 1287 u32 crc;
1289 1288
1290 emac_hashhi = emac_hashlo = 0; 1289 emac_hashhi = emac_hashlo = 0;
1291 1290
1292 netdev_for_each_mc_addr(ha, dev) { 1291 netdev_for_each_mc_addr(ha, dev) {
1293 addrs = ha->addr; 1292 crc = ether_crc(ETH_ALEN, ha->addr);
1294
1295 /* skip non-multicast addresses */
1296 if (!is_multicast_ether_addr(addrs))
1297 continue;
1298
1299 crc = ether_crc(ETH_ALEN, addrs);
1300 crc >>= 26; 1293 crc >>= 26;
1301 1294
1302 if (crc & 0x20) 1295 if (crc & 0x20)
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 7206ab2cbbf8..3437613f0454 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -3203,7 +3203,7 @@ static int cas_get_vpd_info(struct cas *cp, unsigned char *dev_addr,
3203 int phy_type = CAS_PHY_MII_MDIO0; /* default phy type */ 3203 int phy_type = CAS_PHY_MII_MDIO0; /* default phy type */
3204 int mac_off = 0; 3204 int mac_off = 0;
3205 3205
3206#if defined(CONFIG_OF) 3206#if defined(CONFIG_SPARC)
3207 const unsigned char *addr; 3207 const unsigned char *addr;
3208#endif 3208#endif
3209 3209
@@ -3354,7 +3354,7 @@ use_random_mac_addr:
3354 if (found & VPD_FOUND_MAC) 3354 if (found & VPD_FOUND_MAC)
3355 goto done; 3355 goto done;
3356 3356
3357#if defined(CONFIG_OF) 3357#if defined(CONFIG_SPARC)
3358 addr = of_get_property(cp->of_node, "local-mac-address", NULL); 3358 addr = of_get_property(cp->of_node, "local-mac-address", NULL);
3359 if (addr != NULL) { 3359 if (addr != NULL) {
3360 memcpy(dev_addr, addr, 6); 3360 memcpy(dev_addr, addr, 6);
@@ -5031,7 +5031,7 @@ static int __devinit cas_init_one(struct pci_dev *pdev,
5031 cp->msg_enable = (cassini_debug < 0) ? CAS_DEF_MSG_ENABLE : 5031 cp->msg_enable = (cassini_debug < 0) ? CAS_DEF_MSG_ENABLE :
5032 cassini_debug; 5032 cassini_debug;
5033 5033
5034#if defined(CONFIG_OF) 5034#if defined(CONFIG_SPARC)
5035 cp->of_node = pci_device_to_OF_node(pdev); 5035 cp->of_node = pci_device_to_OF_node(pdev);
5036#endif 5036#endif
5037 5037
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 45c4b7bfcf39..f1d4b450e797 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -433,7 +433,6 @@ static void gfar_init_mac(struct net_device *ndev)
433static struct net_device_stats *gfar_get_stats(struct net_device *dev) 433static struct net_device_stats *gfar_get_stats(struct net_device *dev)
434{ 434{
435 struct gfar_private *priv = netdev_priv(dev); 435 struct gfar_private *priv = netdev_priv(dev);
436 struct netdev_queue *txq;
437 unsigned long rx_packets = 0, rx_bytes = 0, rx_dropped = 0; 436 unsigned long rx_packets = 0, rx_bytes = 0, rx_dropped = 0;
438 unsigned long tx_packets = 0, tx_bytes = 0; 437 unsigned long tx_packets = 0, tx_bytes = 0;
439 int i = 0; 438 int i = 0;
@@ -449,9 +448,8 @@ static struct net_device_stats *gfar_get_stats(struct net_device *dev)
449 dev->stats.rx_dropped = rx_dropped; 448 dev->stats.rx_dropped = rx_dropped;
450 449
451 for (i = 0; i < priv->num_tx_queues; i++) { 450 for (i = 0; i < priv->num_tx_queues; i++) {
452 txq = netdev_get_tx_queue(dev, i); 451 tx_bytes += priv->tx_queue[i]->stats.tx_bytes;
453 tx_bytes += txq->tx_bytes; 452 tx_packets += priv->tx_queue[i]->stats.tx_packets;
454 tx_packets += txq->tx_packets;
455 } 453 }
456 454
457 dev->stats.tx_bytes = tx_bytes; 455 dev->stats.tx_bytes = tx_bytes;
@@ -2108,8 +2106,8 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
2108 } 2106 }
2109 2107
2110 /* Update transmit stats */ 2108 /* Update transmit stats */
2111 txq->tx_bytes += skb->len; 2109 tx_queue->stats.tx_bytes += skb->len;
2112 txq->tx_packets ++; 2110 tx_queue->stats.tx_packets++;
2113 2111
2114 txbdp = txbdp_start = tx_queue->cur_tx; 2112 txbdp = txbdp_start = tx_queue->cur_tx;
2115 lstatus = txbdp->lstatus; 2113 lstatus = txbdp->lstatus;
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
index 68984eb88ae0..54de4135e932 100644
--- a/drivers/net/gianfar.h
+++ b/drivers/net/gianfar.h
@@ -907,12 +907,21 @@ enum {
907 MQ_MG_MODE 907 MQ_MG_MODE
908}; 908};
909 909
910/*
911 * Per TX queue stats
912 */
913struct tx_q_stats {
914 unsigned long tx_packets;
915 unsigned long tx_bytes;
916};
917
910/** 918/**
911 * struct gfar_priv_tx_q - per tx queue structure 919 * struct gfar_priv_tx_q - per tx queue structure
912 * @txlock: per queue tx spin lock 920 * @txlock: per queue tx spin lock
913 * @tx_skbuff:skb pointers 921 * @tx_skbuff:skb pointers
914 * @skb_curtx: to be used skb pointer 922 * @skb_curtx: to be used skb pointer
915 * @skb_dirtytx:the last used skb pointer 923 * @skb_dirtytx:the last used skb pointer
924 * @stats: bytes/packets stats
916 * @qindex: index of this queue 925 * @qindex: index of this queue
917 * @dev: back pointer to the dev structure 926 * @dev: back pointer to the dev structure
918 * @grp: back pointer to the group to which this queue belongs 927 * @grp: back pointer to the group to which this queue belongs
@@ -934,6 +943,7 @@ struct gfar_priv_tx_q {
934 struct txbd8 *tx_bd_base; 943 struct txbd8 *tx_bd_base;
935 struct txbd8 *cur_tx; 944 struct txbd8 *cur_tx;
936 struct txbd8 *dirty_tx; 945 struct txbd8 *dirty_tx;
946 struct tx_q_stats stats;
937 struct net_device *dev; 947 struct net_device *dev;
938 struct gfar_priv_grp *grp; 948 struct gfar_priv_grp *grp;
939 u16 skb_curtx; 949 u16 skb_curtx;
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index a060610a42db..602078b84892 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -6667,8 +6667,6 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,
6667 struct ixgbe_adapter *adapter, 6667 struct ixgbe_adapter *adapter,
6668 struct ixgbe_ring *tx_ring) 6668 struct ixgbe_ring *tx_ring)
6669{ 6669{
6670 struct net_device *netdev = tx_ring->netdev;
6671 struct netdev_queue *txq;
6672 unsigned int first; 6670 unsigned int first;
6673 unsigned int tx_flags = 0; 6671 unsigned int tx_flags = 0;
6674 u8 hdr_len = 0; 6672 u8 hdr_len = 0;
@@ -6765,9 +6763,6 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,
6765 /* add the ATR filter if ATR is on */ 6763 /* add the ATR filter if ATR is on */
6766 if (test_bit(__IXGBE_TX_FDIR_INIT_DONE, &tx_ring->state)) 6764 if (test_bit(__IXGBE_TX_FDIR_INIT_DONE, &tx_ring->state))
6767 ixgbe_atr(tx_ring, skb, tx_flags, protocol); 6765 ixgbe_atr(tx_ring, skb, tx_flags, protocol);
6768 txq = netdev_get_tx_queue(netdev, tx_ring->queue_index);
6769 txq->tx_bytes += skb->len;
6770 txq->tx_packets++;
6771 ixgbe_tx_queue(tx_ring, tx_flags, count, skb->len, hdr_len); 6766 ixgbe_tx_queue(tx_ring, tx_flags, count, skb->len, hdr_len);
6772 ixgbe_maybe_stop_tx(tx_ring, DESC_NEEDED); 6767 ixgbe_maybe_stop_tx(tx_ring, DESC_NEEDED);
6773 6768
@@ -6925,8 +6920,6 @@ static struct rtnl_link_stats64 *ixgbe_get_stats64(struct net_device *netdev,
6925 struct ixgbe_adapter *adapter = netdev_priv(netdev); 6920 struct ixgbe_adapter *adapter = netdev_priv(netdev);
6926 int i; 6921 int i;
6927 6922
6928 /* accurate rx/tx bytes/packets stats */
6929 dev_txq_stats_fold(netdev, stats);
6930 rcu_read_lock(); 6923 rcu_read_lock();
6931 for (i = 0; i < adapter->num_rx_queues; i++) { 6924 for (i = 0; i < adapter->num_rx_queues; i++) {
6932 struct ixgbe_ring *ring = ACCESS_ONCE(adapter->rx_ring[i]); 6925 struct ixgbe_ring *ring = ACCESS_ONCE(adapter->rx_ring[i]);
@@ -6943,6 +6936,22 @@ static struct rtnl_link_stats64 *ixgbe_get_stats64(struct net_device *netdev,
6943 stats->rx_bytes += bytes; 6936 stats->rx_bytes += bytes;
6944 } 6937 }
6945 } 6938 }
6939
6940 for (i = 0; i < adapter->num_tx_queues; i++) {
6941 struct ixgbe_ring *ring = ACCESS_ONCE(adapter->tx_ring[i]);
6942 u64 bytes, packets;
6943 unsigned int start;
6944
6945 if (ring) {
6946 do {
6947 start = u64_stats_fetch_begin_bh(&ring->syncp);
6948 packets = ring->stats.packets;
6949 bytes = ring->stats.bytes;
6950 } while (u64_stats_fetch_retry_bh(&ring->syncp, start));
6951 stats->tx_packets += packets;
6952 stats->tx_bytes += bytes;
6953 }
6954 }
6946 rcu_read_unlock(); 6955 rcu_read_unlock();
6947 /* following stats updated by ixgbe_watchdog_task() */ 6956 /* following stats updated by ixgbe_watchdog_task() */
6948 stats->multicast = netdev->stats.multicast; 6957 stats->multicast = netdev->stats.multicast;
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index 21845affea13..5933621ac3ff 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -585,7 +585,7 @@ err:
585 rcu_read_lock_bh(); 585 rcu_read_lock_bh();
586 vlan = rcu_dereference(q->vlan); 586 vlan = rcu_dereference(q->vlan);
587 if (vlan) 587 if (vlan)
588 netdev_get_tx_queue(vlan->dev, 0)->tx_dropped++; 588 vlan->dev->stats.tx_dropped++;
589 rcu_read_unlock_bh(); 589 rcu_read_unlock_bh();
590 590
591 return err; 591 return err;
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index bb8645ab247c..bde7d61f1930 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -554,6 +554,8 @@ struct rtl8169_private {
554 struct mii_if_info mii; 554 struct mii_if_info mii;
555 struct rtl8169_counters counters; 555 struct rtl8169_counters counters;
556 u32 saved_wolopts; 556 u32 saved_wolopts;
557
558 const struct firmware *fw;
557}; 559};
558 560
559MODULE_AUTHOR("Realtek and the Linux r8169 crew <netdev@vger.kernel.org>"); 561MODULE_AUTHOR("Realtek and the Linux r8169 crew <netdev@vger.kernel.org>");
@@ -1766,6 +1768,29 @@ rtl_phy_write_fw(struct rtl8169_private *tp, const struct firmware *fw)
1766 } 1768 }
1767} 1769}
1768 1770
1771static void rtl_release_firmware(struct rtl8169_private *tp)
1772{
1773 release_firmware(tp->fw);
1774 tp->fw = NULL;
1775}
1776
1777static int rtl_apply_firmware(struct rtl8169_private *tp, const char *fw_name)
1778{
1779 const struct firmware **fw = &tp->fw;
1780 int rc = !*fw;
1781
1782 if (rc) {
1783 rc = request_firmware(fw, fw_name, &tp->pci_dev->dev);
1784 if (rc < 0)
1785 goto out;
1786 }
1787
1788 /* TODO: release firmware once rtl_phy_write_fw signals failures. */
1789 rtl_phy_write_fw(tp, *fw);
1790out:
1791 return rc;
1792}
1793
1769static void rtl8169s_hw_phy_config(struct rtl8169_private *tp) 1794static void rtl8169s_hw_phy_config(struct rtl8169_private *tp)
1770{ 1795{
1771 static const struct phy_reg phy_reg_init[] = { 1796 static const struct phy_reg phy_reg_init[] = {
@@ -2139,7 +2164,6 @@ static void rtl8168d_1_hw_phy_config(struct rtl8169_private *tp)
2139 { 0x0d, 0xf880 } 2164 { 0x0d, 0xf880 }
2140 }; 2165 };
2141 void __iomem *ioaddr = tp->mmio_addr; 2166 void __iomem *ioaddr = tp->mmio_addr;
2142 const struct firmware *fw;
2143 2167
2144 rtl_writephy_batch(tp, phy_reg_init_0, ARRAY_SIZE(phy_reg_init_0)); 2168 rtl_writephy_batch(tp, phy_reg_init_0, ARRAY_SIZE(phy_reg_init_0));
2145 2169
@@ -2203,11 +2227,8 @@ static void rtl8168d_1_hw_phy_config(struct rtl8169_private *tp)
2203 2227
2204 rtl_writephy(tp, 0x1f, 0x0005); 2228 rtl_writephy(tp, 0x1f, 0x0005);
2205 rtl_writephy(tp, 0x05, 0x001b); 2229 rtl_writephy(tp, 0x05, 0x001b);
2206 if (rtl_readphy(tp, 0x06) == 0xbf00 && 2230 if ((rtl_readphy(tp, 0x06) != 0xbf00) ||
2207 request_firmware(&fw, FIRMWARE_8168D_1, &tp->pci_dev->dev) == 0) { 2231 (rtl_apply_firmware(tp, FIRMWARE_8168D_1) < 0)) {
2208 rtl_phy_write_fw(tp, fw);
2209 release_firmware(fw);
2210 } else {
2211 netif_warn(tp, probe, tp->dev, "unable to apply firmware patch\n"); 2232 netif_warn(tp, probe, tp->dev, "unable to apply firmware patch\n");
2212 } 2233 }
2213 2234
@@ -2257,7 +2278,6 @@ static void rtl8168d_2_hw_phy_config(struct rtl8169_private *tp)
2257 { 0x0d, 0xf880 } 2278 { 0x0d, 0xf880 }
2258 }; 2279 };
2259 void __iomem *ioaddr = tp->mmio_addr; 2280 void __iomem *ioaddr = tp->mmio_addr;
2260 const struct firmware *fw;
2261 2281
2262 rtl_writephy_batch(tp, phy_reg_init_0, ARRAY_SIZE(phy_reg_init_0)); 2282 rtl_writephy_batch(tp, phy_reg_init_0, ARRAY_SIZE(phy_reg_init_0));
2263 2283
@@ -2312,11 +2332,8 @@ static void rtl8168d_2_hw_phy_config(struct rtl8169_private *tp)
2312 2332
2313 rtl_writephy(tp, 0x1f, 0x0005); 2333 rtl_writephy(tp, 0x1f, 0x0005);
2314 rtl_writephy(tp, 0x05, 0x001b); 2334 rtl_writephy(tp, 0x05, 0x001b);
2315 if (rtl_readphy(tp, 0x06) == 0xb300 && 2335 if ((rtl_readphy(tp, 0x06) != 0xb300) ||
2316 request_firmware(&fw, FIRMWARE_8168D_2, &tp->pci_dev->dev) == 0) { 2336 (rtl_apply_firmware(tp, FIRMWARE_8168D_2) < 0)) {
2317 rtl_phy_write_fw(tp, fw);
2318 release_firmware(fw);
2319 } else {
2320 netif_warn(tp, probe, tp->dev, "unable to apply firmware patch\n"); 2337 netif_warn(tp, probe, tp->dev, "unable to apply firmware patch\n");
2321 } 2338 }
2322 2339
@@ -3200,6 +3217,8 @@ static void __devexit rtl8169_remove_one(struct pci_dev *pdev)
3200 3217
3201 cancel_delayed_work_sync(&tp->task); 3218 cancel_delayed_work_sync(&tp->task);
3202 3219
3220 rtl_release_firmware(tp);
3221
3203 unregister_netdev(dev); 3222 unregister_netdev(dev);
3204 3223
3205 if (pci_dev_run_wake(pdev)) 3224 if (pci_dev_run_wake(pdev))
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index 711449c6e675..002bac743843 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -1153,6 +1153,9 @@ static int efx_wanted_channels(void)
1153 int count; 1153 int count;
1154 int cpu; 1154 int cpu;
1155 1155
1156 if (rss_cpus)
1157 return rss_cpus;
1158
1156 if (unlikely(!zalloc_cpumask_var(&core_mask, GFP_KERNEL))) { 1159 if (unlikely(!zalloc_cpumask_var(&core_mask, GFP_KERNEL))) {
1157 printk(KERN_WARNING 1160 printk(KERN_WARNING
1158 "sfc: RSS disabled due to allocation failure\n"); 1161 "sfc: RSS disabled due to allocation failure\n");
@@ -1266,27 +1269,18 @@ static void efx_remove_interrupts(struct efx_nic *efx)
1266 efx->legacy_irq = 0; 1269 efx->legacy_irq = 0;
1267} 1270}
1268 1271
1269struct efx_tx_queue *
1270efx_get_tx_queue(struct efx_nic *efx, unsigned index, unsigned type)
1271{
1272 unsigned tx_channel_offset =
1273 separate_tx_channels ? efx->n_channels - efx->n_tx_channels : 0;
1274 EFX_BUG_ON_PARANOID(index >= efx->n_tx_channels ||
1275 type >= EFX_TXQ_TYPES);
1276 return &efx->channel[tx_channel_offset + index]->tx_queue[type];
1277}
1278
1279static void efx_set_channels(struct efx_nic *efx) 1272static void efx_set_channels(struct efx_nic *efx)
1280{ 1273{
1281 struct efx_channel *channel; 1274 struct efx_channel *channel;
1282 struct efx_tx_queue *tx_queue; 1275 struct efx_tx_queue *tx_queue;
1283 unsigned tx_channel_offset = 1276
1277 efx->tx_channel_offset =
1284 separate_tx_channels ? efx->n_channels - efx->n_tx_channels : 0; 1278 separate_tx_channels ? efx->n_channels - efx->n_tx_channels : 0;
1285 1279
1286 /* Channel pointers were set in efx_init_struct() but we now 1280 /* Channel pointers were set in efx_init_struct() but we now
1287 * need to clear them for TX queues in any RX-only channels. */ 1281 * need to clear them for TX queues in any RX-only channels. */
1288 efx_for_each_channel(channel, efx) { 1282 efx_for_each_channel(channel, efx) {
1289 if (channel->channel - tx_channel_offset >= 1283 if (channel->channel - efx->tx_channel_offset >=
1290 efx->n_tx_channels) { 1284 efx->n_tx_channels) {
1291 efx_for_each_channel_tx_queue(tx_queue, channel) 1285 efx_for_each_channel_tx_queue(tx_queue, channel)
1292 tx_queue->channel = NULL; 1286 tx_queue->channel = NULL;
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h
index bdce66ddf93a..28df8665256a 100644
--- a/drivers/net/sfc/net_driver.h
+++ b/drivers/net/sfc/net_driver.h
@@ -735,6 +735,7 @@ struct efx_nic {
735 unsigned next_buffer_table; 735 unsigned next_buffer_table;
736 unsigned n_channels; 736 unsigned n_channels;
737 unsigned n_rx_channels; 737 unsigned n_rx_channels;
738 unsigned tx_channel_offset;
738 unsigned n_tx_channels; 739 unsigned n_tx_channels;
739 unsigned int rx_buffer_len; 740 unsigned int rx_buffer_len;
740 unsigned int rx_buffer_order; 741 unsigned int rx_buffer_order;
@@ -929,8 +930,13 @@ efx_get_channel(struct efx_nic *efx, unsigned index)
929 _channel = (_channel->channel + 1 < (_efx)->n_channels) ? \ 930 _channel = (_channel->channel + 1 < (_efx)->n_channels) ? \
930 (_efx)->channel[_channel->channel + 1] : NULL) 931 (_efx)->channel[_channel->channel + 1] : NULL)
931 932
932extern struct efx_tx_queue * 933static inline struct efx_tx_queue *
933efx_get_tx_queue(struct efx_nic *efx, unsigned index, unsigned type); 934efx_get_tx_queue(struct efx_nic *efx, unsigned index, unsigned type)
935{
936 EFX_BUG_ON_PARANOID(index >= efx->n_tx_channels ||
937 type >= EFX_TXQ_TYPES);
938 return &efx->channel[efx->tx_channel_offset + index]->tx_queue[type];
939}
934 940
935static inline struct efx_tx_queue * 941static inline struct efx_tx_queue *
936efx_channel_get_tx_queue(struct efx_channel *channel, unsigned type) 942efx_channel_get_tx_queue(struct efx_channel *channel, unsigned type)
diff --git a/drivers/net/tile/tilepro.c b/drivers/net/tile/tilepro.c
index 0e6bac5ec65b..7cb301da7474 100644
--- a/drivers/net/tile/tilepro.c
+++ b/drivers/net/tile/tilepro.c
@@ -142,14 +142,6 @@
142MODULE_AUTHOR("Tilera"); 142MODULE_AUTHOR("Tilera");
143MODULE_LICENSE("GPL"); 143MODULE_LICENSE("GPL");
144 144
145
146#define IS_MULTICAST(mac_addr) \
147 (((u8 *)(mac_addr))[0] & 0x01)
148
149#define IS_BROADCAST(mac_addr) \
150 (((u16 *)(mac_addr))[0] == 0xffff)
151
152
153/* 145/*
154 * Queue of incoming packets for a specific cpu and device. 146 * Queue of incoming packets for a specific cpu and device.
155 * 147 *
@@ -795,7 +787,7 @@ static bool tile_net_poll_aux(struct tile_net_cpu *info, int index)
795 /* 787 /*
796 * FIXME: Implement HW multicast filter. 788 * FIXME: Implement HW multicast filter.
797 */ 789 */
798 if (!IS_MULTICAST(buf) && !IS_BROADCAST(buf)) { 790 if (is_unicast_ether_addr(buf)) {
799 /* Filter packets not for our address. */ 791 /* Filter packets not for our address. */
800 const u8 *mine = dev->dev_addr; 792 const u8 *mine = dev->dev_addr;
801 filter = compare_ether_addr(mine, buf); 793 filter = compare_ether_addr(mine, buf);
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 593c104ab199..d776c4a8d3c1 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -1021,13 +1021,15 @@ static int cdc_ncm_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in)
1021 (temp > CDC_NCM_MAX_DATAGRAM_SIZE) || (temp < ETH_HLEN)) { 1021 (temp > CDC_NCM_MAX_DATAGRAM_SIZE) || (temp < ETH_HLEN)) {
1022 pr_debug("invalid frame detected (ignored)" 1022 pr_debug("invalid frame detected (ignored)"
1023 "offset[%u]=%u, length=%u, skb=%p\n", 1023 "offset[%u]=%u, length=%u, skb=%p\n",
1024 x, offset, temp, skb); 1024 x, offset, temp, skb_in);
1025 if (!x) 1025 if (!x)
1026 goto error; 1026 goto error;
1027 break; 1027 break;
1028 1028
1029 } else { 1029 } else {
1030 skb = skb_clone(skb_in, GFP_ATOMIC); 1030 skb = skb_clone(skb_in, GFP_ATOMIC);
1031 if (!skb)
1032 goto error;
1031 skb->len = temp; 1033 skb->len = temp;
1032 skb->data = ((u8 *)skb_in->data) + offset; 1034 skb->data = ((u8 *)skb_in->data) + offset;
1033 skb_set_tail_pointer(skb, temp); 1035 skb_set_tail_pointer(skb, temp);
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c
index 1ac9b568f1b0..c81a6512c683 100644
--- a/drivers/net/vxge/vxge-main.c
+++ b/drivers/net/vxge/vxge-main.c
@@ -4120,6 +4120,7 @@ int vxge_fw_upgrade(struct vxgedev *vdev, char *fw_name, int override)
4120 "hotplug event.\n"); 4120 "hotplug event.\n");
4121 4121
4122out: 4122out:
4123 release_firmware(fw);
4123 return ret; 4124 return ret;
4124} 4125}
4125 4126
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 38244f59cdd9..ade0568c07a4 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -97,22 +97,26 @@ void vhost_poll_stop(struct vhost_poll *poll)
97 remove_wait_queue(poll->wqh, &poll->wait); 97 remove_wait_queue(poll->wqh, &poll->wait);
98} 98}
99 99
100static bool vhost_work_seq_done(struct vhost_dev *dev, struct vhost_work *work,
101 unsigned seq)
102{
103 int left;
104 spin_lock_irq(&dev->work_lock);
105 left = seq - work->done_seq;
106 spin_unlock_irq(&dev->work_lock);
107 return left <= 0;
108}
109
100static void vhost_work_flush(struct vhost_dev *dev, struct vhost_work *work) 110static void vhost_work_flush(struct vhost_dev *dev, struct vhost_work *work)
101{ 111{
102 unsigned seq; 112 unsigned seq;
103 int left;
104 int flushing; 113 int flushing;
105 114
106 spin_lock_irq(&dev->work_lock); 115 spin_lock_irq(&dev->work_lock);
107 seq = work->queue_seq; 116 seq = work->queue_seq;
108 work->flushing++; 117 work->flushing++;
109 spin_unlock_irq(&dev->work_lock); 118 spin_unlock_irq(&dev->work_lock);
110 wait_event(work->done, ({ 119 wait_event(work->done, vhost_work_seq_done(dev, work, seq));
111 spin_lock_irq(&dev->work_lock);
112 left = seq - work->done_seq <= 0;
113 spin_unlock_irq(&dev->work_lock);
114 left;
115 }));
116 spin_lock_irq(&dev->work_lock); 120 spin_lock_irq(&dev->work_lock);
117 flushing = --work->flushing; 121 flushing = --work->flushing;
118 spin_unlock_irq(&dev->work_lock); 122 spin_unlock_irq(&dev->work_lock);
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index bec8b82889bf..ab68f785fd19 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -99,6 +99,17 @@ static inline int is_broadcast_ether_addr(const u8 *addr)
99} 99}
100 100
101/** 101/**
102 * is_unicast_ether_addr - Determine if the Ethernet address is unicast
103 * @addr: Pointer to a six-byte array containing the Ethernet address
104 *
105 * Return true if the address is a unicast address.
106 */
107static inline int is_unicast_ether_addr(const u8 *addr)
108{
109 return !is_multicast_ether_addr(addr);
110}
111
112/**
102 * is_valid_ether_addr - Determine if the given Ethernet address is valid 113 * is_valid_ether_addr - Determine if the given Ethernet address is valid
103 * @addr: Pointer to a six-byte array containing the Ethernet address 114 * @addr: Pointer to a six-byte array containing the Ethernet address
104 * 115 *
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index be4957cf6511..d971346b0340 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -520,9 +520,6 @@ struct netdev_queue {
520 * please use this field instead of dev->trans_start 520 * please use this field instead of dev->trans_start
521 */ 521 */
522 unsigned long trans_start; 522 unsigned long trans_start;
523 u64 tx_bytes;
524 u64 tx_packets;
525 u64 tx_dropped;
526} ____cacheline_aligned_in_smp; 523} ____cacheline_aligned_in_smp;
527 524
528static inline int netdev_queue_numa_node_read(const struct netdev_queue *q) 525static inline int netdev_queue_numa_node_read(const struct netdev_queue *q)
@@ -2265,8 +2262,6 @@ extern void dev_load(struct net *net, const char *name);
2265extern void dev_mcast_init(void); 2262extern void dev_mcast_init(void);
2266extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, 2263extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
2267 struct rtnl_link_stats64 *storage); 2264 struct rtnl_link_stats64 *storage);
2268extern void dev_txq_stats_fold(const struct net_device *dev,
2269 struct rtnl_link_stats64 *stats);
2270 2265
2271extern int netdev_max_backlog; 2266extern int netdev_max_backlog;
2272extern int netdev_tstamp_prequeue; 2267extern int netdev_tstamp_prequeue;
diff --git a/include/net/ah.h b/include/net/ah.h
index be7798dea6f4..ca95b98969dd 100644
--- a/include/net/ah.h
+++ b/include/net/ah.h
@@ -4,7 +4,7 @@
4#include <linux/skbuff.h> 4#include <linux/skbuff.h>
5 5
6/* This is the maximum truncated ICV length that we know of. */ 6/* This is the maximum truncated ICV length that we know of. */
7#define MAX_AH_AUTH_LEN 16 7#define MAX_AH_AUTH_LEN 64
8 8
9struct crypto_ahash; 9struct crypto_ahash;
10 10
diff --git a/net/core/dev.c b/net/core/dev.c
index a3ef808b5e36..83507c265e48 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5523,34 +5523,6 @@ void netdev_run_todo(void)
5523 } 5523 }
5524} 5524}
5525 5525
5526/**
5527 * dev_txq_stats_fold - fold tx_queues stats
5528 * @dev: device to get statistics from
5529 * @stats: struct rtnl_link_stats64 to hold results
5530 */
5531void dev_txq_stats_fold(const struct net_device *dev,
5532 struct rtnl_link_stats64 *stats)
5533{
5534 u64 tx_bytes = 0, tx_packets = 0, tx_dropped = 0;
5535 unsigned int i;
5536 struct netdev_queue *txq;
5537
5538 for (i = 0; i < dev->num_tx_queues; i++) {
5539 txq = netdev_get_tx_queue(dev, i);
5540 spin_lock_bh(&txq->_xmit_lock);
5541 tx_bytes += txq->tx_bytes;
5542 tx_packets += txq->tx_packets;
5543 tx_dropped += txq->tx_dropped;
5544 spin_unlock_bh(&txq->_xmit_lock);
5545 }
5546 if (tx_bytes || tx_packets || tx_dropped) {
5547 stats->tx_bytes = tx_bytes;
5548 stats->tx_packets = tx_packets;
5549 stats->tx_dropped = tx_dropped;
5550 }
5551}
5552EXPORT_SYMBOL(dev_txq_stats_fold);
5553
5554/* Convert net_device_stats to rtnl_link_stats64. They have the same 5526/* Convert net_device_stats to rtnl_link_stats64. They have the same
5555 * fields in the same order, with only the type differing. 5527 * fields in the same order, with only the type differing.
5556 */ 5528 */
@@ -5594,7 +5566,6 @@ struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
5594 netdev_stats_to_stats64(storage, ops->ndo_get_stats(dev)); 5566 netdev_stats_to_stats64(storage, ops->ndo_get_stats(dev));
5595 } else { 5567 } else {
5596 netdev_stats_to_stats64(storage, &dev->stats); 5568 netdev_stats_to_stats64(storage, &dev->stats);
5597 dev_txq_stats_fold(dev, storage);
5598 } 5569 }
5599 storage->rx_dropped += atomic_long_read(&dev->rx_dropped); 5570 storage->rx_dropped += atomic_long_read(&dev->rx_dropped);
5600 return storage; 5571 return storage;
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c
index af9360d1f6eb..84ce48eadff4 100644
--- a/net/sched/sch_teql.c
+++ b/net/sched/sch_teql.c
@@ -59,6 +59,10 @@ struct teql_master
59 struct net_device *dev; 59 struct net_device *dev;
60 struct Qdisc *slaves; 60 struct Qdisc *slaves;
61 struct list_head master_list; 61 struct list_head master_list;
62 unsigned long tx_bytes;
63 unsigned long tx_packets;
64 unsigned long tx_errors;
65 unsigned long tx_dropped;
62}; 66};
63 67
64struct teql_sched_data 68struct teql_sched_data
@@ -274,7 +278,6 @@ static inline int teql_resolve(struct sk_buff *skb,
274static netdev_tx_t teql_master_xmit(struct sk_buff *skb, struct net_device *dev) 278static netdev_tx_t teql_master_xmit(struct sk_buff *skb, struct net_device *dev)
275{ 279{
276 struct teql_master *master = netdev_priv(dev); 280 struct teql_master *master = netdev_priv(dev);
277 struct netdev_queue *txq = netdev_get_tx_queue(dev, 0);
278 struct Qdisc *start, *q; 281 struct Qdisc *start, *q;
279 int busy; 282 int busy;
280 int nores; 283 int nores;
@@ -314,8 +317,8 @@ restart:
314 __netif_tx_unlock(slave_txq); 317 __netif_tx_unlock(slave_txq);
315 master->slaves = NEXT_SLAVE(q); 318 master->slaves = NEXT_SLAVE(q);
316 netif_wake_queue(dev); 319 netif_wake_queue(dev);
317 txq->tx_packets++; 320 master->tx_packets++;
318 txq->tx_bytes += length; 321 master->tx_bytes += length;
319 return NETDEV_TX_OK; 322 return NETDEV_TX_OK;
320 } 323 }
321 __netif_tx_unlock(slave_txq); 324 __netif_tx_unlock(slave_txq);
@@ -342,10 +345,10 @@ restart:
342 netif_stop_queue(dev); 345 netif_stop_queue(dev);
343 return NETDEV_TX_BUSY; 346 return NETDEV_TX_BUSY;
344 } 347 }
345 dev->stats.tx_errors++; 348 master->tx_errors++;
346 349
347drop: 350drop:
348 txq->tx_dropped++; 351 master->tx_dropped++;
349 dev_kfree_skb(skb); 352 dev_kfree_skb(skb);
350 return NETDEV_TX_OK; 353 return NETDEV_TX_OK;
351} 354}
@@ -398,6 +401,18 @@ static int teql_master_close(struct net_device *dev)
398 return 0; 401 return 0;
399} 402}
400 403
404static struct rtnl_link_stats64 *teql_master_stats64(struct net_device *dev,
405 struct rtnl_link_stats64 *stats)
406{
407 struct teql_master *m = netdev_priv(dev);
408
409 stats->tx_packets = m->tx_packets;
410 stats->tx_bytes = m->tx_bytes;
411 stats->tx_errors = m->tx_errors;
412 stats->tx_dropped = m->tx_dropped;
413 return stats;
414}
415
401static int teql_master_mtu(struct net_device *dev, int new_mtu) 416static int teql_master_mtu(struct net_device *dev, int new_mtu)
402{ 417{
403 struct teql_master *m = netdev_priv(dev); 418 struct teql_master *m = netdev_priv(dev);
@@ -422,6 +437,7 @@ static const struct net_device_ops teql_netdev_ops = {
422 .ndo_open = teql_master_open, 437 .ndo_open = teql_master_open,
423 .ndo_stop = teql_master_close, 438 .ndo_stop = teql_master_close,
424 .ndo_start_xmit = teql_master_xmit, 439 .ndo_start_xmit = teql_master_xmit,
440 .ndo_get_stats64 = teql_master_stats64,
425 .ndo_change_mtu = teql_master_mtu, 441 .ndo_change_mtu = teql_master_mtu,
426}; 442};
427 443