diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-14 16:25:30 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-14 16:25:30 -0500 |
commit | d018b6f4f1539f3679fbdc2d02d58d09e76be84a (patch) | |
tree | 317b9e04d8e7a73a4d07c69a5cb5455ec34f47e5 /drivers/net | |
parent | 18bce371ae09af6c20ee62c1092a4d1d0e84dd49 (diff) | |
parent | 0f73f2c5a3ebb957ee66718c903c17ed71a4fc2e (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (47 commits)
GRETH: resolve SMP issues and other problems
GRETH: handle frame error interrupts
GRETH: avoid writing bad speed/duplex when setting transfer mode
GRETH: fixed skb buffer memory leak on frame errors
GRETH: GBit transmit descriptor handling optimization
GRETH: fix opening/closing
GRETH: added raw AMBA vendor/device number to match against.
cassini: Fix build bustage on x86.
e1000e: consistent use of Rx/Tx vs. RX/TX/rx/tx in comments/logs
e1000e: update Copyright for 2011
e1000: Avoid unhandled IRQ
r8169: keep firmware in memory.
netdev: tilepro: Use is_unicast_ether_addr helper
etherdevice.h: Add is_unicast_ether_addr function
ks8695net: Use default implementation of ethtool_ops::get_link
ks8695net: Disable non-working ethtool operations
USB CDC NCM: Don't deref NULL in cdc_ncm_rx_fixup() and don't use uninitialized variable.
vxge: Remember to release firmware after upgrading firmware
netdev: bfin_mac: Remove is_multicast_ether_addr use in netdev_for_each_mc_addr
ipsec: update MAX_AH_AUTH_LEN to support sha512
...
Diffstat (limited to 'drivers/net')
38 files changed, 512 insertions, 505 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 | */ |
861 | static int | 861 | static int |
862 | ks8695_get_settings(struct net_device *ndev, struct ethtool_cmd *cmd) | 862 | ks8695_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 | */ |
934 | static int | 915 | static int |
935 | ks8695_set_settings(struct net_device *ndev, struct ethtool_cmd *cmd) | 916 | ks8695_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 | */ |
1027 | static int | 978 | static int |
1028 | ks8695_nwayreset(struct net_device *ndev) | 979 | ks8695_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 |
1058 | static u32 | 990 | /* auto-negotiation not enabled */ |
1059 | ks8695_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 | */ |
1083 | static void | 1001 | static void |
1084 | ks8695_get_pause(struct net_device *ndev, struct ethtool_pauseparam *param) | 1002 | ks8695_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 | */ | ||
1120 | static int | ||
1121 | ks8695_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) | |||
1140 | static const struct ethtool_ops ks8695_ethtool_ops = { | 1035 | static 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, | 1041 | static 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 0b9fc5173aef..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 (!(*addrs & 1)) | ||
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/bna/bnad_ethtool.c b/drivers/net/bna/bnad_ethtool.c index 99be5ae91991..142d6047da27 100644 --- a/drivers/net/bna/bnad_ethtool.c +++ b/drivers/net/bna/bnad_ethtool.c | |||
@@ -275,7 +275,6 @@ bnad_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo) | |||
275 | 275 | ||
276 | ioc_attr = kzalloc(sizeof(*ioc_attr), GFP_KERNEL); | 276 | ioc_attr = kzalloc(sizeof(*ioc_attr), GFP_KERNEL); |
277 | if (ioc_attr) { | 277 | if (ioc_attr) { |
278 | memset(ioc_attr, 0, sizeof(*ioc_attr)); | ||
279 | spin_lock_irqsave(&bnad->bna_lock, flags); | 278 | spin_lock_irqsave(&bnad->bna_lock, flags); |
280 | bfa_nw_ioc_get_attr(&bnad->bna.device.ioc, ioc_attr); | 279 | bfa_nw_ioc_get_attr(&bnad->bna.device.ioc, ioc_attr); |
281 | spin_unlock_irqrestore(&bnad->bna_lock, flags); | 280 | spin_unlock_irqrestore(&bnad->bna_lock, flags); |
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/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index de69c54301c1..bfab14092d2c 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -3478,9 +3478,17 @@ static irqreturn_t e1000_intr(int irq, void *data) | |||
3478 | struct e1000_hw *hw = &adapter->hw; | 3478 | struct e1000_hw *hw = &adapter->hw; |
3479 | u32 icr = er32(ICR); | 3479 | u32 icr = er32(ICR); |
3480 | 3480 | ||
3481 | if (unlikely((!icr) || test_bit(__E1000_DOWN, &adapter->flags))) | 3481 | if (unlikely((!icr))) |
3482 | return IRQ_NONE; /* Not our interrupt */ | 3482 | return IRQ_NONE; /* Not our interrupt */ |
3483 | 3483 | ||
3484 | /* | ||
3485 | * we might have caused the interrupt, but the above | ||
3486 | * read cleared it, and just in case the driver is | ||
3487 | * down there is nothing to do so return handled | ||
3488 | */ | ||
3489 | if (unlikely(test_bit(__E1000_DOWN, &adapter->flags))) | ||
3490 | return IRQ_HANDLED; | ||
3491 | |||
3484 | if (unlikely(icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC))) { | 3492 | if (unlikely(icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC))) { |
3485 | hw->get_link_status = 1; | 3493 | hw->get_link_status = 1; |
3486 | /* guard against interrupt when we're going down */ | 3494 | /* guard against interrupt when we're going down */ |
diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c index 1397da118f0d..89a69035e538 100644 --- a/drivers/net/e1000e/82571.c +++ b/drivers/net/e1000e/82571.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel PRO/1000 Linux driver | 3 | Intel PRO/1000 Linux driver |
4 | Copyright(c) 1999 - 2010 Intel Corporation. | 4 | Copyright(c) 1999 - 2011 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
@@ -1310,7 +1310,7 @@ static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw) | |||
1310 | * apply workaround for hardware errata documented in errata | 1310 | * apply workaround for hardware errata documented in errata |
1311 | * docs Fixes issue where some error prone or unreliable PCIe | 1311 | * docs Fixes issue where some error prone or unreliable PCIe |
1312 | * completions are occurring, particularly with ASPM enabled. | 1312 | * completions are occurring, particularly with ASPM enabled. |
1313 | * Without fix, issue can cause tx timeouts. | 1313 | * Without fix, issue can cause Tx timeouts. |
1314 | */ | 1314 | */ |
1315 | reg = er32(GCR2); | 1315 | reg = er32(GCR2); |
1316 | reg |= 1; | 1316 | reg |= 1; |
diff --git a/drivers/net/e1000e/Makefile b/drivers/net/e1000e/Makefile index 360c91369f35..28519acacd2d 100644 --- a/drivers/net/e1000e/Makefile +++ b/drivers/net/e1000e/Makefile | |||
@@ -1,7 +1,7 @@ | |||
1 | ################################################################################ | 1 | ################################################################################ |
2 | # | 2 | # |
3 | # Intel PRO/1000 Linux driver | 3 | # Intel PRO/1000 Linux driver |
4 | # Copyright(c) 1999 - 2008 Intel Corporation. | 4 | # Copyright(c) 1999 - 2011 Intel Corporation. |
5 | # | 5 | # |
6 | # This program is free software; you can redistribute it and/or modify it | 6 | # This program is free software; you can redistribute it and/or modify it |
7 | # under the terms and conditions of the GNU General Public License, | 7 | # under the terms and conditions of the GNU General Public License, |
diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h index 7245dc2e0b7c..13149983d07e 100644 --- a/drivers/net/e1000e/defines.h +++ b/drivers/net/e1000e/defines.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel PRO/1000 Linux driver | 3 | Intel PRO/1000 Linux driver |
4 | Copyright(c) 1999 - 2010 Intel Corporation. | 4 | Copyright(c) 1999 - 2011 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index 5255be753746..e610e1369053 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel PRO/1000 Linux driver | 3 | Intel PRO/1000 Linux driver |
4 | Copyright(c) 1999 - 2010 Intel Corporation. | 4 | Copyright(c) 1999 - 2011 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
diff --git a/drivers/net/e1000e/es2lan.c b/drivers/net/e1000e/es2lan.c index e45a61c8930a..2fefa820302b 100644 --- a/drivers/net/e1000e/es2lan.c +++ b/drivers/net/e1000e/es2lan.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel PRO/1000 Linux driver | 3 | Intel PRO/1000 Linux driver |
4 | Copyright(c) 1999 - 2010 Intel Corporation. | 4 | Copyright(c) 1999 - 2011 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index f8ed03dab9b1..fa08b6336cfb 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel PRO/1000 Linux driver | 3 | Intel PRO/1000 Linux driver |
4 | Copyright(c) 1999 - 2010 Intel Corporation. | 4 | Copyright(c) 1999 - 2011 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h index e774380c7cec..bc0860a598c9 100644 --- a/drivers/net/e1000e/hw.h +++ b/drivers/net/e1000e/hw.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel PRO/1000 Linux driver | 3 | Intel PRO/1000 Linux driver |
4 | Copyright(c) 1999 - 2010 Intel Corporation. | 4 | Copyright(c) 1999 - 2011 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
@@ -102,7 +102,7 @@ enum e1e_registers { | |||
102 | E1000_RDTR = 0x02820, /* Rx Delay Timer - RW */ | 102 | E1000_RDTR = 0x02820, /* Rx Delay Timer - RW */ |
103 | E1000_RXDCTL_BASE = 0x02828, /* Rx Descriptor Control - RW */ | 103 | E1000_RXDCTL_BASE = 0x02828, /* Rx Descriptor Control - RW */ |
104 | #define E1000_RXDCTL(_n) (E1000_RXDCTL_BASE + (_n << 8)) | 104 | #define E1000_RXDCTL(_n) (E1000_RXDCTL_BASE + (_n << 8)) |
105 | E1000_RADV = 0x0282C, /* RX Interrupt Absolute Delay Timer - RW */ | 105 | E1000_RADV = 0x0282C, /* Rx Interrupt Absolute Delay Timer - RW */ |
106 | 106 | ||
107 | /* Convenience macros | 107 | /* Convenience macros |
108 | * | 108 | * |
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c index 5bb65b7382db..fb46974cfec1 100644 --- a/drivers/net/e1000e/ich8lan.c +++ b/drivers/net/e1000e/ich8lan.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel PRO/1000 Linux driver | 3 | Intel PRO/1000 Linux driver |
4 | Copyright(c) 1999 - 2010 Intel Corporation. | 4 | Copyright(c) 1999 - 2011 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c index ff2872153b21..68aa1749bf66 100644 --- a/drivers/net/e1000e/lib.c +++ b/drivers/net/e1000e/lib.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel PRO/1000 Linux driver | 3 | Intel PRO/1000 Linux driver |
4 | Copyright(c) 1999 - 2010 Intel Corporation. | 4 | Copyright(c) 1999 - 2011 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
@@ -533,7 +533,7 @@ s32 e1000e_check_for_fiber_link(struct e1000_hw *hw) | |||
533 | mac->autoneg_failed = 1; | 533 | mac->autoneg_failed = 1; |
534 | return 0; | 534 | return 0; |
535 | } | 535 | } |
536 | e_dbg("NOT RXing /C/, disable AutoNeg and force link.\n"); | 536 | e_dbg("NOT Rx'ing /C/, disable AutoNeg and force link.\n"); |
537 | 537 | ||
538 | /* Disable auto-negotiation in the TXCW register */ | 538 | /* Disable auto-negotiation in the TXCW register */ |
539 | ew32(TXCW, (mac->txcw & ~E1000_TXCW_ANE)); | 539 | ew32(TXCW, (mac->txcw & ~E1000_TXCW_ANE)); |
@@ -556,7 +556,7 @@ s32 e1000e_check_for_fiber_link(struct e1000_hw *hw) | |||
556 | * and disable forced link in the Device Control register | 556 | * and disable forced link in the Device Control register |
557 | * in an attempt to auto-negotiate with our link partner. | 557 | * in an attempt to auto-negotiate with our link partner. |
558 | */ | 558 | */ |
559 | e_dbg("RXing /C/, enable AutoNeg and stop forcing link.\n"); | 559 | e_dbg("Rx'ing /C/, enable AutoNeg and stop forcing link.\n"); |
560 | ew32(TXCW, mac->txcw); | 560 | ew32(TXCW, mac->txcw); |
561 | ew32(CTRL, (ctrl & ~E1000_CTRL_SLU)); | 561 | ew32(CTRL, (ctrl & ~E1000_CTRL_SLU)); |
562 | 562 | ||
@@ -598,7 +598,7 @@ s32 e1000e_check_for_serdes_link(struct e1000_hw *hw) | |||
598 | mac->autoneg_failed = 1; | 598 | mac->autoneg_failed = 1; |
599 | return 0; | 599 | return 0; |
600 | } | 600 | } |
601 | e_dbg("NOT RXing /C/, disable AutoNeg and force link.\n"); | 601 | e_dbg("NOT Rx'ing /C/, disable AutoNeg and force link.\n"); |
602 | 602 | ||
603 | /* Disable auto-negotiation in the TXCW register */ | 603 | /* Disable auto-negotiation in the TXCW register */ |
604 | ew32(TXCW, (mac->txcw & ~E1000_TXCW_ANE)); | 604 | ew32(TXCW, (mac->txcw & ~E1000_TXCW_ANE)); |
@@ -621,7 +621,7 @@ s32 e1000e_check_for_serdes_link(struct e1000_hw *hw) | |||
621 | * and disable forced link in the Device Control register | 621 | * and disable forced link in the Device Control register |
622 | * in an attempt to auto-negotiate with our link partner. | 622 | * in an attempt to auto-negotiate with our link partner. |
623 | */ | 623 | */ |
624 | e_dbg("RXing /C/, enable AutoNeg and stop forcing link.\n"); | 624 | e_dbg("Rx'ing /C/, enable AutoNeg and stop forcing link.\n"); |
625 | ew32(TXCW, mac->txcw); | 625 | ew32(TXCW, mac->txcw); |
626 | ew32(CTRL, (ctrl & ~E1000_CTRL_SLU)); | 626 | ew32(CTRL, (ctrl & ~E1000_CTRL_SLU)); |
627 | 627 | ||
@@ -800,9 +800,9 @@ static s32 e1000_commit_fc_settings_generic(struct e1000_hw *hw) | |||
800 | * The possible values of the "fc" parameter are: | 800 | * The possible values of the "fc" parameter are: |
801 | * 0: Flow control is completely disabled | 801 | * 0: Flow control is completely disabled |
802 | * 1: Rx flow control is enabled (we can receive pause frames, | 802 | * 1: Rx flow control is enabled (we can receive pause frames, |
803 | * but not send pause frames). | 803 | * but not send pause frames). |
804 | * 2: Tx flow control is enabled (we can send pause frames but we | 804 | * 2: Tx flow control is enabled (we can send pause frames but we |
805 | * do not support receiving pause frames). | 805 | * do not support receiving pause frames). |
806 | * 3: Both Rx and Tx flow control (symmetric) are enabled. | 806 | * 3: Both Rx and Tx flow control (symmetric) are enabled. |
807 | */ | 807 | */ |
808 | switch (hw->fc.current_mode) { | 808 | switch (hw->fc.current_mode) { |
@@ -1031,9 +1031,9 @@ s32 e1000e_force_mac_fc(struct e1000_hw *hw) | |||
1031 | * The possible values of the "fc" parameter are: | 1031 | * The possible values of the "fc" parameter are: |
1032 | * 0: Flow control is completely disabled | 1032 | * 0: Flow control is completely disabled |
1033 | * 1: Rx flow control is enabled (we can receive pause | 1033 | * 1: Rx flow control is enabled (we can receive pause |
1034 | * frames but not send pause frames). | 1034 | * frames but not send pause frames). |
1035 | * 2: Tx flow control is enabled (we can send pause frames | 1035 | * 2: Tx flow control is enabled (we can send pause frames |
1036 | * frames but we do not receive pause frames). | 1036 | * frames but we do not receive pause frames). |
1037 | * 3: Both Rx and Tx flow control (symmetric) is enabled. | 1037 | * 3: Both Rx and Tx flow control (symmetric) is enabled. |
1038 | * other: No other values should be possible at this point. | 1038 | * other: No other values should be possible at this point. |
1039 | */ | 1039 | */ |
@@ -1189,7 +1189,7 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw) | |||
1189 | } else { | 1189 | } else { |
1190 | hw->fc.current_mode = e1000_fc_rx_pause; | 1190 | hw->fc.current_mode = e1000_fc_rx_pause; |
1191 | e_dbg("Flow Control = " | 1191 | e_dbg("Flow Control = " |
1192 | "RX PAUSE frames only.\r\n"); | 1192 | "Rx PAUSE frames only.\r\n"); |
1193 | } | 1193 | } |
1194 | } | 1194 | } |
1195 | /* | 1195 | /* |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index fa5b60452547..1c18f26b0812 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel PRO/1000 Linux driver | 3 | Intel PRO/1000 Linux driver |
4 | Copyright(c) 1999 - 2010 Intel Corporation. | 4 | Copyright(c) 1999 - 2011 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
@@ -77,17 +77,17 @@ struct e1000_reg_info { | |||
77 | char *name; | 77 | char *name; |
78 | }; | 78 | }; |
79 | 79 | ||
80 | #define E1000_RDFH 0x02410 /* Rx Data FIFO Head - RW */ | 80 | #define E1000_RDFH 0x02410 /* Rx Data FIFO Head - RW */ |
81 | #define E1000_RDFT 0x02418 /* Rx Data FIFO Tail - RW */ | 81 | #define E1000_RDFT 0x02418 /* Rx Data FIFO Tail - RW */ |
82 | #define E1000_RDFHS 0x02420 /* Rx Data FIFO Head Saved - RW */ | 82 | #define E1000_RDFHS 0x02420 /* Rx Data FIFO Head Saved - RW */ |
83 | #define E1000_RDFTS 0x02428 /* Rx Data FIFO Tail Saved - RW */ | 83 | #define E1000_RDFTS 0x02428 /* Rx Data FIFO Tail Saved - RW */ |
84 | #define E1000_RDFPC 0x02430 /* Rx Data FIFO Packet Count - RW */ | 84 | #define E1000_RDFPC 0x02430 /* Rx Data FIFO Packet Count - RW */ |
85 | 85 | ||
86 | #define E1000_TDFH 0x03410 /* Tx Data FIFO Head - RW */ | 86 | #define E1000_TDFH 0x03410 /* Tx Data FIFO Head - RW */ |
87 | #define E1000_TDFT 0x03418 /* Tx Data FIFO Tail - RW */ | 87 | #define E1000_TDFT 0x03418 /* Tx Data FIFO Tail - RW */ |
88 | #define E1000_TDFHS 0x03420 /* Tx Data FIFO Head Saved - RW */ | 88 | #define E1000_TDFHS 0x03420 /* Tx Data FIFO Head Saved - RW */ |
89 | #define E1000_TDFTS 0x03428 /* Tx Data FIFO Tail Saved - RW */ | 89 | #define E1000_TDFTS 0x03428 /* Tx Data FIFO Tail Saved - RW */ |
90 | #define E1000_TDFPC 0x03430 /* Tx Data FIFO Packet Count - RW */ | 90 | #define E1000_TDFPC 0x03430 /* Tx Data FIFO Packet Count - RW */ |
91 | 91 | ||
92 | static const struct e1000_reg_info e1000_reg_info_tbl[] = { | 92 | static const struct e1000_reg_info e1000_reg_info_tbl[] = { |
93 | 93 | ||
@@ -99,7 +99,7 @@ static const struct e1000_reg_info e1000_reg_info_tbl[] = { | |||
99 | /* Interrupt Registers */ | 99 | /* Interrupt Registers */ |
100 | {E1000_ICR, "ICR"}, | 100 | {E1000_ICR, "ICR"}, |
101 | 101 | ||
102 | /* RX Registers */ | 102 | /* Rx Registers */ |
103 | {E1000_RCTL, "RCTL"}, | 103 | {E1000_RCTL, "RCTL"}, |
104 | {E1000_RDLEN, "RDLEN"}, | 104 | {E1000_RDLEN, "RDLEN"}, |
105 | {E1000_RDH, "RDH"}, | 105 | {E1000_RDH, "RDH"}, |
@@ -115,7 +115,7 @@ static const struct e1000_reg_info e1000_reg_info_tbl[] = { | |||
115 | {E1000_RDFTS, "RDFTS"}, | 115 | {E1000_RDFTS, "RDFTS"}, |
116 | {E1000_RDFPC, "RDFPC"}, | 116 | {E1000_RDFPC, "RDFPC"}, |
117 | 117 | ||
118 | /* TX Registers */ | 118 | /* Tx Registers */ |
119 | {E1000_TCTL, "TCTL"}, | 119 | {E1000_TCTL, "TCTL"}, |
120 | {E1000_TDBAL, "TDBAL"}, | 120 | {E1000_TDBAL, "TDBAL"}, |
121 | {E1000_TDBAH, "TDBAH"}, | 121 | {E1000_TDBAH, "TDBAH"}, |
@@ -160,7 +160,7 @@ static void e1000_regdump(struct e1000_hw *hw, struct e1000_reg_info *reginfo) | |||
160 | break; | 160 | break; |
161 | default: | 161 | default: |
162 | printk(KERN_INFO "%-15s %08x\n", | 162 | printk(KERN_INFO "%-15s %08x\n", |
163 | reginfo->name, __er32(hw, reginfo->ofs)); | 163 | reginfo->name, __er32(hw, reginfo->ofs)); |
164 | return; | 164 | return; |
165 | } | 165 | } |
166 | 166 | ||
@@ -171,9 +171,8 @@ static void e1000_regdump(struct e1000_hw *hw, struct e1000_reg_info *reginfo) | |||
171 | printk(KERN_CONT "\n"); | 171 | printk(KERN_CONT "\n"); |
172 | } | 172 | } |
173 | 173 | ||
174 | |||
175 | /* | 174 | /* |
176 | * e1000e_dump - Print registers, tx-ring and rx-ring | 175 | * e1000e_dump - Print registers, Tx-ring and Rx-ring |
177 | */ | 176 | */ |
178 | static void e1000e_dump(struct e1000_adapter *adapter) | 177 | static void e1000e_dump(struct e1000_adapter *adapter) |
179 | { | 178 | { |
@@ -182,12 +181,20 @@ static void e1000e_dump(struct e1000_adapter *adapter) | |||
182 | struct e1000_reg_info *reginfo; | 181 | struct e1000_reg_info *reginfo; |
183 | struct e1000_ring *tx_ring = adapter->tx_ring; | 182 | struct e1000_ring *tx_ring = adapter->tx_ring; |
184 | struct e1000_tx_desc *tx_desc; | 183 | struct e1000_tx_desc *tx_desc; |
185 | struct my_u0 { u64 a; u64 b; } *u0; | 184 | struct my_u0 { |
185 | u64 a; | ||
186 | u64 b; | ||
187 | } *u0; | ||
186 | struct e1000_buffer *buffer_info; | 188 | struct e1000_buffer *buffer_info; |
187 | struct e1000_ring *rx_ring = adapter->rx_ring; | 189 | struct e1000_ring *rx_ring = adapter->rx_ring; |
188 | union e1000_rx_desc_packet_split *rx_desc_ps; | 190 | union e1000_rx_desc_packet_split *rx_desc_ps; |
189 | struct e1000_rx_desc *rx_desc; | 191 | struct e1000_rx_desc *rx_desc; |
190 | struct my_u1 { u64 a; u64 b; u64 c; u64 d; } *u1; | 192 | struct my_u1 { |
193 | u64 a; | ||
194 | u64 b; | ||
195 | u64 c; | ||
196 | u64 d; | ||
197 | } *u1; | ||
191 | u32 staterr; | 198 | u32 staterr; |
192 | int i = 0; | 199 | int i = 0; |
193 | 200 | ||
@@ -198,12 +205,10 @@ static void e1000e_dump(struct e1000_adapter *adapter) | |||
198 | if (netdev) { | 205 | if (netdev) { |
199 | dev_info(&adapter->pdev->dev, "Net device Info\n"); | 206 | dev_info(&adapter->pdev->dev, "Net device Info\n"); |
200 | printk(KERN_INFO "Device Name state " | 207 | printk(KERN_INFO "Device Name state " |
201 | "trans_start last_rx\n"); | 208 | "trans_start last_rx\n"); |
202 | printk(KERN_INFO "%-15s %016lX %016lX %016lX\n", | 209 | printk(KERN_INFO "%-15s %016lX %016lX %016lX\n", |
203 | netdev->name, | 210 | netdev->name, netdev->state, netdev->trans_start, |
204 | netdev->state, | 211 | netdev->last_rx); |
205 | netdev->trans_start, | ||
206 | netdev->last_rx); | ||
207 | } | 212 | } |
208 | 213 | ||
209 | /* Print Registers */ | 214 | /* Print Registers */ |
@@ -214,26 +219,26 @@ static void e1000e_dump(struct e1000_adapter *adapter) | |||
214 | e1000_regdump(hw, reginfo); | 219 | e1000_regdump(hw, reginfo); |
215 | } | 220 | } |
216 | 221 | ||
217 | /* Print TX Ring Summary */ | 222 | /* Print Tx Ring Summary */ |
218 | if (!netdev || !netif_running(netdev)) | 223 | if (!netdev || !netif_running(netdev)) |
219 | goto exit; | 224 | goto exit; |
220 | 225 | ||
221 | dev_info(&adapter->pdev->dev, "TX Rings Summary\n"); | 226 | dev_info(&adapter->pdev->dev, "Tx Ring Summary\n"); |
222 | printk(KERN_INFO "Queue [NTU] [NTC] [bi(ntc)->dma ]" | 227 | printk(KERN_INFO "Queue [NTU] [NTC] [bi(ntc)->dma ]" |
223 | " leng ntw timestamp\n"); | 228 | " leng ntw timestamp\n"); |
224 | buffer_info = &tx_ring->buffer_info[tx_ring->next_to_clean]; | 229 | buffer_info = &tx_ring->buffer_info[tx_ring->next_to_clean]; |
225 | printk(KERN_INFO " %5d %5X %5X %016llX %04X %3X %016llX\n", | 230 | printk(KERN_INFO " %5d %5X %5X %016llX %04X %3X %016llX\n", |
226 | 0, tx_ring->next_to_use, tx_ring->next_to_clean, | 231 | 0, tx_ring->next_to_use, tx_ring->next_to_clean, |
227 | (unsigned long long)buffer_info->dma, | 232 | (unsigned long long)buffer_info->dma, |
228 | buffer_info->length, | 233 | buffer_info->length, |
229 | buffer_info->next_to_watch, | 234 | buffer_info->next_to_watch, |
230 | (unsigned long long)buffer_info->time_stamp); | 235 | (unsigned long long)buffer_info->time_stamp); |
231 | 236 | ||
232 | /* Print TX Rings */ | 237 | /* Print Tx Ring */ |
233 | if (!netif_msg_tx_done(adapter)) | 238 | if (!netif_msg_tx_done(adapter)) |
234 | goto rx_ring_summary; | 239 | goto rx_ring_summary; |
235 | 240 | ||
236 | dev_info(&adapter->pdev->dev, "TX Rings Dump\n"); | 241 | dev_info(&adapter->pdev->dev, "Tx Ring Dump\n"); |
237 | 242 | ||
238 | /* Transmit Descriptor Formats - DEXT[29] is 0 (Legacy) or 1 (Extended) | 243 | /* Transmit Descriptor Formats - DEXT[29] is 0 (Legacy) or 1 (Extended) |
239 | * | 244 | * |
@@ -263,22 +268,22 @@ static void e1000e_dump(struct e1000_adapter *adapter) | |||
263 | * 63 48 47 40 39 36 35 32 31 24 23 20 19 0 | 268 | * 63 48 47 40 39 36 35 32 31 24 23 20 19 0 |
264 | */ | 269 | */ |
265 | printk(KERN_INFO "Tl[desc] [address 63:0 ] [SpeCssSCmCsLen]" | 270 | printk(KERN_INFO "Tl[desc] [address 63:0 ] [SpeCssSCmCsLen]" |
266 | " [bi->dma ] leng ntw timestamp bi->skb " | 271 | " [bi->dma ] leng ntw timestamp bi->skb " |
267 | "<-- Legacy format\n"); | 272 | "<-- Legacy format\n"); |
268 | printk(KERN_INFO "Tc[desc] [Ce CoCsIpceCoS] [MssHlRSCm0Plen]" | 273 | printk(KERN_INFO "Tc[desc] [Ce CoCsIpceCoS] [MssHlRSCm0Plen]" |
269 | " [bi->dma ] leng ntw timestamp bi->skb " | 274 | " [bi->dma ] leng ntw timestamp bi->skb " |
270 | "<-- Ext Context format\n"); | 275 | "<-- Ext Context format\n"); |
271 | printk(KERN_INFO "Td[desc] [address 63:0 ] [VlaPoRSCm1Dlen]" | 276 | printk(KERN_INFO "Td[desc] [address 63:0 ] [VlaPoRSCm1Dlen]" |
272 | " [bi->dma ] leng ntw timestamp bi->skb " | 277 | " [bi->dma ] leng ntw timestamp bi->skb " |
273 | "<-- Ext Data format\n"); | 278 | "<-- Ext Data format\n"); |
274 | for (i = 0; tx_ring->desc && (i < tx_ring->count); i++) { | 279 | for (i = 0; tx_ring->desc && (i < tx_ring->count); i++) { |
275 | tx_desc = E1000_TX_DESC(*tx_ring, i); | 280 | tx_desc = E1000_TX_DESC(*tx_ring, i); |
276 | buffer_info = &tx_ring->buffer_info[i]; | 281 | buffer_info = &tx_ring->buffer_info[i]; |
277 | u0 = (struct my_u0 *)tx_desc; | 282 | u0 = (struct my_u0 *)tx_desc; |
278 | printk(KERN_INFO "T%c[0x%03X] %016llX %016llX %016llX " | 283 | printk(KERN_INFO "T%c[0x%03X] %016llX %016llX %016llX " |
279 | "%04X %3X %016llX %p", | 284 | "%04X %3X %016llX %p", |
280 | (!(le64_to_cpu(u0->b) & (1<<29)) ? 'l' : | 285 | (!(le64_to_cpu(u0->b) & (1 << 29)) ? 'l' : |
281 | ((le64_to_cpu(u0->b) & (1<<20)) ? 'd' : 'c')), i, | 286 | ((le64_to_cpu(u0->b) & (1 << 20)) ? 'd' : 'c')), i, |
282 | (unsigned long long)le64_to_cpu(u0->a), | 287 | (unsigned long long)le64_to_cpu(u0->a), |
283 | (unsigned long long)le64_to_cpu(u0->b), | 288 | (unsigned long long)le64_to_cpu(u0->b), |
284 | (unsigned long long)buffer_info->dma, | 289 | (unsigned long long)buffer_info->dma, |
@@ -296,22 +301,22 @@ static void e1000e_dump(struct e1000_adapter *adapter) | |||
296 | 301 | ||
297 | if (netif_msg_pktdata(adapter) && buffer_info->dma != 0) | 302 | if (netif_msg_pktdata(adapter) && buffer_info->dma != 0) |
298 | print_hex_dump(KERN_INFO, "", DUMP_PREFIX_ADDRESS, | 303 | print_hex_dump(KERN_INFO, "", DUMP_PREFIX_ADDRESS, |
299 | 16, 1, phys_to_virt(buffer_info->dma), | 304 | 16, 1, phys_to_virt(buffer_info->dma), |
300 | buffer_info->length, true); | 305 | buffer_info->length, true); |
301 | } | 306 | } |
302 | 307 | ||
303 | /* Print RX Rings Summary */ | 308 | /* Print Rx Ring Summary */ |
304 | rx_ring_summary: | 309 | rx_ring_summary: |
305 | dev_info(&adapter->pdev->dev, "RX Rings Summary\n"); | 310 | dev_info(&adapter->pdev->dev, "Rx Ring Summary\n"); |
306 | printk(KERN_INFO "Queue [NTU] [NTC]\n"); | 311 | printk(KERN_INFO "Queue [NTU] [NTC]\n"); |
307 | printk(KERN_INFO " %5d %5X %5X\n", 0, | 312 | printk(KERN_INFO " %5d %5X %5X\n", 0, |
308 | rx_ring->next_to_use, rx_ring->next_to_clean); | 313 | rx_ring->next_to_use, rx_ring->next_to_clean); |
309 | 314 | ||
310 | /* Print RX Rings */ | 315 | /* Print Rx Ring */ |
311 | if (!netif_msg_rx_status(adapter)) | 316 | if (!netif_msg_rx_status(adapter)) |
312 | goto exit; | 317 | goto exit; |
313 | 318 | ||
314 | dev_info(&adapter->pdev->dev, "RX Rings Dump\n"); | 319 | dev_info(&adapter->pdev->dev, "Rx Ring Dump\n"); |
315 | switch (adapter->rx_ps_pages) { | 320 | switch (adapter->rx_ps_pages) { |
316 | case 1: | 321 | case 1: |
317 | case 2: | 322 | case 2: |
@@ -329,7 +334,7 @@ rx_ring_summary: | |||
329 | * +-----------------------------------------------------+ | 334 | * +-----------------------------------------------------+ |
330 | */ | 335 | */ |
331 | printk(KERN_INFO "R [desc] [buffer 0 63:0 ] " | 336 | printk(KERN_INFO "R [desc] [buffer 0 63:0 ] " |
332 | "[buffer 1 63:0 ] " | 337 | "[buffer 1 63:0 ] " |
333 | "[buffer 2 63:0 ] [buffer 3 63:0 ] [bi->dma ] " | 338 | "[buffer 2 63:0 ] [buffer 3 63:0 ] [bi->dma ] " |
334 | "[bi->skb] <-- Ext Pkt Split format\n"); | 339 | "[bi->skb] <-- Ext Pkt Split format\n"); |
335 | /* [Extended] Receive Descriptor (Write-Back) Format | 340 | /* [Extended] Receive Descriptor (Write-Back) Format |
@@ -344,7 +349,7 @@ rx_ring_summary: | |||
344 | * 63 48 47 32 31 20 19 0 | 349 | * 63 48 47 32 31 20 19 0 |
345 | */ | 350 | */ |
346 | printk(KERN_INFO "RWB[desc] [ck ipid mrqhsh] " | 351 | printk(KERN_INFO "RWB[desc] [ck ipid mrqhsh] " |
347 | "[vl l0 ee es] " | 352 | "[vl l0 ee es] " |
348 | "[ l3 l2 l1 hs] [reserved ] ---------------- " | 353 | "[ l3 l2 l1 hs] [reserved ] ---------------- " |
349 | "[bi->skb] <-- Ext Rx Write-Back format\n"); | 354 | "[bi->skb] <-- Ext Rx Write-Back format\n"); |
350 | for (i = 0; i < rx_ring->count; i++) { | 355 | for (i = 0; i < rx_ring->count; i++) { |
@@ -352,26 +357,26 @@ rx_ring_summary: | |||
352 | rx_desc_ps = E1000_RX_DESC_PS(*rx_ring, i); | 357 | rx_desc_ps = E1000_RX_DESC_PS(*rx_ring, i); |
353 | u1 = (struct my_u1 *)rx_desc_ps; | 358 | u1 = (struct my_u1 *)rx_desc_ps; |
354 | staterr = | 359 | staterr = |
355 | le32_to_cpu(rx_desc_ps->wb.middle.status_error); | 360 | le32_to_cpu(rx_desc_ps->wb.middle.status_error); |
356 | if (staterr & E1000_RXD_STAT_DD) { | 361 | if (staterr & E1000_RXD_STAT_DD) { |
357 | /* Descriptor Done */ | 362 | /* Descriptor Done */ |
358 | printk(KERN_INFO "RWB[0x%03X] %016llX " | 363 | printk(KERN_INFO "RWB[0x%03X] %016llX " |
359 | "%016llX %016llX %016llX " | 364 | "%016llX %016llX %016llX " |
360 | "---------------- %p", i, | 365 | "---------------- %p", i, |
361 | (unsigned long long)le64_to_cpu(u1->a), | 366 | (unsigned long long)le64_to_cpu(u1->a), |
362 | (unsigned long long)le64_to_cpu(u1->b), | 367 | (unsigned long long)le64_to_cpu(u1->b), |
363 | (unsigned long long)le64_to_cpu(u1->c), | 368 | (unsigned long long)le64_to_cpu(u1->c), |
364 | (unsigned long long)le64_to_cpu(u1->d), | 369 | (unsigned long long)le64_to_cpu(u1->d), |
365 | buffer_info->skb); | 370 | buffer_info->skb); |
366 | } else { | 371 | } else { |
367 | printk(KERN_INFO "R [0x%03X] %016llX " | 372 | printk(KERN_INFO "R [0x%03X] %016llX " |
368 | "%016llX %016llX %016llX %016llX %p", i, | 373 | "%016llX %016llX %016llX %016llX %p", i, |
369 | (unsigned long long)le64_to_cpu(u1->a), | 374 | (unsigned long long)le64_to_cpu(u1->a), |
370 | (unsigned long long)le64_to_cpu(u1->b), | 375 | (unsigned long long)le64_to_cpu(u1->b), |
371 | (unsigned long long)le64_to_cpu(u1->c), | 376 | (unsigned long long)le64_to_cpu(u1->c), |
372 | (unsigned long long)le64_to_cpu(u1->d), | 377 | (unsigned long long)le64_to_cpu(u1->d), |
373 | (unsigned long long)buffer_info->dma, | 378 | (unsigned long long)buffer_info->dma, |
374 | buffer_info->skb); | 379 | buffer_info->skb); |
375 | 380 | ||
376 | if (netif_msg_pktdata(adapter)) | 381 | if (netif_msg_pktdata(adapter)) |
377 | print_hex_dump(KERN_INFO, "", | 382 | print_hex_dump(KERN_INFO, "", |
@@ -400,18 +405,18 @@ rx_ring_summary: | |||
400 | * 63 48 47 40 39 32 31 16 15 0 | 405 | * 63 48 47 40 39 32 31 16 15 0 |
401 | */ | 406 | */ |
402 | printk(KERN_INFO "Rl[desc] [address 63:0 ] " | 407 | printk(KERN_INFO "Rl[desc] [address 63:0 ] " |
403 | "[vl er S cks ln] [bi->dma ] [bi->skb] " | 408 | "[vl er S cks ln] [bi->dma ] [bi->skb] " |
404 | "<-- Legacy format\n"); | 409 | "<-- Legacy format\n"); |
405 | for (i = 0; rx_ring->desc && (i < rx_ring->count); i++) { | 410 | for (i = 0; rx_ring->desc && (i < rx_ring->count); i++) { |
406 | rx_desc = E1000_RX_DESC(*rx_ring, i); | 411 | rx_desc = E1000_RX_DESC(*rx_ring, i); |
407 | buffer_info = &rx_ring->buffer_info[i]; | 412 | buffer_info = &rx_ring->buffer_info[i]; |
408 | u0 = (struct my_u0 *)rx_desc; | 413 | u0 = (struct my_u0 *)rx_desc; |
409 | printk(KERN_INFO "Rl[0x%03X] %016llX %016llX " | 414 | printk(KERN_INFO "Rl[0x%03X] %016llX %016llX " |
410 | "%016llX %p", i, | 415 | "%016llX %p", i, |
411 | (unsigned long long)le64_to_cpu(u0->a), | 416 | (unsigned long long)le64_to_cpu(u0->a), |
412 | (unsigned long long)le64_to_cpu(u0->b), | 417 | (unsigned long long)le64_to_cpu(u0->b), |
413 | (unsigned long long)buffer_info->dma, | 418 | (unsigned long long)buffer_info->dma, |
414 | buffer_info->skb); | 419 | buffer_info->skb); |
415 | if (i == rx_ring->next_to_use) | 420 | if (i == rx_ring->next_to_use) |
416 | printk(KERN_CONT " NTU\n"); | 421 | printk(KERN_CONT " NTU\n"); |
417 | else if (i == rx_ring->next_to_clean) | 422 | else if (i == rx_ring->next_to_clean) |
@@ -421,9 +426,10 @@ rx_ring_summary: | |||
421 | 426 | ||
422 | if (netif_msg_pktdata(adapter)) | 427 | if (netif_msg_pktdata(adapter)) |
423 | print_hex_dump(KERN_INFO, "", | 428 | print_hex_dump(KERN_INFO, "", |
424 | DUMP_PREFIX_ADDRESS, | 429 | DUMP_PREFIX_ADDRESS, |
425 | 16, 1, phys_to_virt(buffer_info->dma), | 430 | 16, 1, |
426 | adapter->rx_buffer_len, true); | 431 | phys_to_virt(buffer_info->dma), |
432 | adapter->rx_buffer_len, true); | ||
427 | } | 433 | } |
428 | } | 434 | } |
429 | 435 | ||
@@ -450,8 +456,7 @@ static int e1000_desc_unused(struct e1000_ring *ring) | |||
450 | * @skb: pointer to sk_buff to be indicated to stack | 456 | * @skb: pointer to sk_buff to be indicated to stack |
451 | **/ | 457 | **/ |
452 | static void e1000_receive_skb(struct e1000_adapter *adapter, | 458 | static void e1000_receive_skb(struct e1000_adapter *adapter, |
453 | struct net_device *netdev, | 459 | struct net_device *netdev, struct sk_buff *skb, |
454 | struct sk_buff *skb, | ||
455 | u8 status, __le16 vlan) | 460 | u8 status, __le16 vlan) |
456 | { | 461 | { |
457 | skb->protocol = eth_type_trans(skb, netdev); | 462 | skb->protocol = eth_type_trans(skb, netdev); |
@@ -464,7 +469,7 @@ static void e1000_receive_skb(struct e1000_adapter *adapter, | |||
464 | } | 469 | } |
465 | 470 | ||
466 | /** | 471 | /** |
467 | * e1000_rx_checksum - Receive Checksum Offload for 82543 | 472 | * e1000_rx_checksum - Receive Checksum Offload |
468 | * @adapter: board private structure | 473 | * @adapter: board private structure |
469 | * @status_err: receive descriptor status and error fields | 474 | * @status_err: receive descriptor status and error fields |
470 | * @csum: receive descriptor csum field | 475 | * @csum: receive descriptor csum field |
@@ -548,7 +553,7 @@ map_skb: | |||
548 | adapter->rx_buffer_len, | 553 | adapter->rx_buffer_len, |
549 | DMA_FROM_DEVICE); | 554 | DMA_FROM_DEVICE); |
550 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) { | 555 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) { |
551 | dev_err(&pdev->dev, "RX DMA map failed\n"); | 556 | dev_err(&pdev->dev, "Rx DMA map failed\n"); |
552 | adapter->rx_dma_failed++; | 557 | adapter->rx_dma_failed++; |
553 | break; | 558 | break; |
554 | } | 559 | } |
@@ -601,7 +606,8 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, | |||
601 | ps_page = &buffer_info->ps_pages[j]; | 606 | ps_page = &buffer_info->ps_pages[j]; |
602 | if (j >= adapter->rx_ps_pages) { | 607 | if (j >= adapter->rx_ps_pages) { |
603 | /* all unused desc entries get hw null ptr */ | 608 | /* all unused desc entries get hw null ptr */ |
604 | rx_desc->read.buffer_addr[j+1] = ~cpu_to_le64(0); | 609 | rx_desc->read.buffer_addr[j + 1] = |
610 | ~cpu_to_le64(0); | ||
605 | continue; | 611 | continue; |
606 | } | 612 | } |
607 | if (!ps_page->page) { | 613 | if (!ps_page->page) { |
@@ -617,7 +623,7 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, | |||
617 | if (dma_mapping_error(&pdev->dev, | 623 | if (dma_mapping_error(&pdev->dev, |
618 | ps_page->dma)) { | 624 | ps_page->dma)) { |
619 | dev_err(&adapter->pdev->dev, | 625 | dev_err(&adapter->pdev->dev, |
620 | "RX DMA page map failed\n"); | 626 | "Rx DMA page map failed\n"); |
621 | adapter->rx_dma_failed++; | 627 | adapter->rx_dma_failed++; |
622 | goto no_buffers; | 628 | goto no_buffers; |
623 | } | 629 | } |
@@ -627,8 +633,8 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, | |||
627 | * didn't change because each write-back | 633 | * didn't change because each write-back |
628 | * erases this info. | 634 | * erases this info. |
629 | */ | 635 | */ |
630 | rx_desc->read.buffer_addr[j+1] = | 636 | rx_desc->read.buffer_addr[j + 1] = |
631 | cpu_to_le64(ps_page->dma); | 637 | cpu_to_le64(ps_page->dma); |
632 | } | 638 | } |
633 | 639 | ||
634 | skb = netdev_alloc_skb_ip_align(netdev, | 640 | skb = netdev_alloc_skb_ip_align(netdev, |
@@ -644,7 +650,7 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, | |||
644 | adapter->rx_ps_bsize0, | 650 | adapter->rx_ps_bsize0, |
645 | DMA_FROM_DEVICE); | 651 | DMA_FROM_DEVICE); |
646 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) { | 652 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) { |
647 | dev_err(&pdev->dev, "RX DMA map failed\n"); | 653 | dev_err(&pdev->dev, "Rx DMA map failed\n"); |
648 | adapter->rx_dma_failed++; | 654 | adapter->rx_dma_failed++; |
649 | /* cleanup skb */ | 655 | /* cleanup skb */ |
650 | dev_kfree_skb_any(skb); | 656 | dev_kfree_skb_any(skb); |
@@ -662,7 +668,7 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, | |||
662 | * such as IA-64). | 668 | * such as IA-64). |
663 | */ | 669 | */ |
664 | wmb(); | 670 | wmb(); |
665 | writel(i<<1, adapter->hw.hw_addr + rx_ring->tail); | 671 | writel(i << 1, adapter->hw.hw_addr + rx_ring->tail); |
666 | } | 672 | } |
667 | 673 | ||
668 | i++; | 674 | i++; |
@@ -1106,11 +1112,10 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | |||
1106 | cleaned = 1; | 1112 | cleaned = 1; |
1107 | cleaned_count++; | 1113 | cleaned_count++; |
1108 | dma_unmap_single(&pdev->dev, buffer_info->dma, | 1114 | dma_unmap_single(&pdev->dev, buffer_info->dma, |
1109 | adapter->rx_ps_bsize0, | 1115 | adapter->rx_ps_bsize0, DMA_FROM_DEVICE); |
1110 | DMA_FROM_DEVICE); | ||
1111 | buffer_info->dma = 0; | 1116 | buffer_info->dma = 0; |
1112 | 1117 | ||
1113 | /* see !EOP comment in other rx routine */ | 1118 | /* see !EOP comment in other Rx routine */ |
1114 | if (!(staterr & E1000_RXD_STAT_EOP)) | 1119 | if (!(staterr & E1000_RXD_STAT_EOP)) |
1115 | adapter->flags2 |= FLAG2_IS_DISCARDING; | 1120 | adapter->flags2 |= FLAG2_IS_DISCARDING; |
1116 | 1121 | ||
@@ -2610,7 +2615,7 @@ static void e1000_init_manageability_pt(struct e1000_adapter *adapter) | |||
2610 | } | 2615 | } |
2611 | 2616 | ||
2612 | /** | 2617 | /** |
2613 | * e1000_configure_tx - Configure 8254x Transmit Unit after Reset | 2618 | * e1000_configure_tx - Configure Transmit Unit after Reset |
2614 | * @adapter: board private structure | 2619 | * @adapter: board private structure |
2615 | * | 2620 | * |
2616 | * Configure the Tx unit of the MAC after a reset. | 2621 | * Configure the Tx unit of the MAC after a reset. |
@@ -2663,7 +2668,7 @@ static void e1000_configure_tx(struct e1000_adapter *adapter) | |||
2663 | * hthresh = 1 ==> prefetch when one or more available | 2668 | * hthresh = 1 ==> prefetch when one or more available |
2664 | * pthresh = 0x1f ==> prefetch if internal cache 31 or less | 2669 | * pthresh = 0x1f ==> prefetch if internal cache 31 or less |
2665 | * BEWARE: this seems to work but should be considered first if | 2670 | * BEWARE: this seems to work but should be considered first if |
2666 | * there are tx hangs or other tx related bugs | 2671 | * there are Tx hangs or other Tx related bugs |
2667 | */ | 2672 | */ |
2668 | txdctl |= E1000_TXDCTL_DMA_BURST_ENABLE; | 2673 | txdctl |= E1000_TXDCTL_DMA_BURST_ENABLE; |
2669 | ew32(TXDCTL(0), txdctl); | 2674 | ew32(TXDCTL(0), txdctl); |
@@ -2877,7 +2882,7 @@ static void e1000_configure_rx(struct e1000_adapter *adapter) | |||
2877 | if (adapter->rx_ps_pages) { | 2882 | if (adapter->rx_ps_pages) { |
2878 | /* this is a 32 byte descriptor */ | 2883 | /* this is a 32 byte descriptor */ |
2879 | rdlen = rx_ring->count * | 2884 | rdlen = rx_ring->count * |
2880 | sizeof(union e1000_rx_desc_packet_split); | 2885 | sizeof(union e1000_rx_desc_packet_split); |
2881 | adapter->clean_rx = e1000_clean_rx_irq_ps; | 2886 | adapter->clean_rx = e1000_clean_rx_irq_ps; |
2882 | adapter->alloc_rx_buf = e1000_alloc_rx_buffers_ps; | 2887 | adapter->alloc_rx_buf = e1000_alloc_rx_buffers_ps; |
2883 | } else if (adapter->netdev->mtu > ETH_FRAME_LEN + ETH_FCS_LEN) { | 2888 | } else if (adapter->netdev->mtu > ETH_FRAME_LEN + ETH_FCS_LEN) { |
@@ -2900,7 +2905,7 @@ static void e1000_configure_rx(struct e1000_adapter *adapter) | |||
2900 | /* | 2905 | /* |
2901 | * set the writeback threshold (only takes effect if the RDTR | 2906 | * set the writeback threshold (only takes effect if the RDTR |
2902 | * is set). set GRAN=1 and write back up to 0x4 worth, and | 2907 | * is set). set GRAN=1 and write back up to 0x4 worth, and |
2903 | * enable prefetching of 0x20 rx descriptors | 2908 | * enable prefetching of 0x20 Rx descriptors |
2904 | * granularity = 01 | 2909 | * granularity = 01 |
2905 | * wthresh = 04, | 2910 | * wthresh = 04, |
2906 | * hthresh = 04, | 2911 | * hthresh = 04, |
@@ -2981,12 +2986,10 @@ static void e1000_configure_rx(struct e1000_adapter *adapter) | |||
2981 | * excessive C-state transition latencies result in | 2986 | * excessive C-state transition latencies result in |
2982 | * dropped transactions. | 2987 | * dropped transactions. |
2983 | */ | 2988 | */ |
2984 | pm_qos_update_request( | 2989 | pm_qos_update_request(&adapter->netdev->pm_qos_req, 55); |
2985 | &adapter->netdev->pm_qos_req, 55); | ||
2986 | } else { | 2990 | } else { |
2987 | pm_qos_update_request( | 2991 | pm_qos_update_request(&adapter->netdev->pm_qos_req, |
2988 | &adapter->netdev->pm_qos_req, | 2992 | PM_QOS_DEFAULT_VALUE); |
2989 | PM_QOS_DEFAULT_VALUE); | ||
2990 | } | 2993 | } |
2991 | } | 2994 | } |
2992 | 2995 | ||
@@ -3152,7 +3155,7 @@ void e1000e_reset(struct e1000_adapter *adapter) | |||
3152 | /* lower 16 bits has Rx packet buffer allocation size in KB */ | 3155 | /* lower 16 bits has Rx packet buffer allocation size in KB */ |
3153 | pba &= 0xffff; | 3156 | pba &= 0xffff; |
3154 | /* | 3157 | /* |
3155 | * the Tx fifo also stores 16 bytes of information about the tx | 3158 | * the Tx fifo also stores 16 bytes of information about the Tx |
3156 | * but don't include ethernet FCS because hardware appends it | 3159 | * but don't include ethernet FCS because hardware appends it |
3157 | */ | 3160 | */ |
3158 | min_tx_space = (adapter->max_frame_size + | 3161 | min_tx_space = (adapter->max_frame_size + |
@@ -3175,7 +3178,7 @@ void e1000e_reset(struct e1000_adapter *adapter) | |||
3175 | pba -= min_tx_space - tx_space; | 3178 | pba -= min_tx_space - tx_space; |
3176 | 3179 | ||
3177 | /* | 3180 | /* |
3178 | * if short on Rx space, Rx wins and must trump tx | 3181 | * if short on Rx space, Rx wins and must trump Tx |
3179 | * adjustment or use Early Receive if available | 3182 | * adjustment or use Early Receive if available |
3180 | */ | 3183 | */ |
3181 | if ((pba < min_rx_space) && | 3184 | if ((pba < min_rx_space) && |
@@ -4039,11 +4042,11 @@ static void e1000_print_link_info(struct e1000_adapter *adapter) | |||
4039 | adapter->netdev->name, | 4042 | adapter->netdev->name, |
4040 | adapter->link_speed, | 4043 | adapter->link_speed, |
4041 | (adapter->link_duplex == FULL_DUPLEX) ? | 4044 | (adapter->link_duplex == FULL_DUPLEX) ? |
4042 | "Full Duplex" : "Half Duplex", | 4045 | "Full Duplex" : "Half Duplex", |
4043 | ((ctrl & E1000_CTRL_TFCE) && (ctrl & E1000_CTRL_RFCE)) ? | 4046 | ((ctrl & E1000_CTRL_TFCE) && (ctrl & E1000_CTRL_RFCE)) ? |
4044 | "RX/TX" : | 4047 | "Rx/Tx" : |
4045 | ((ctrl & E1000_CTRL_RFCE) ? "RX" : | 4048 | ((ctrl & E1000_CTRL_RFCE) ? "Rx" : |
4046 | ((ctrl & E1000_CTRL_TFCE) ? "TX" : "None" ))); | 4049 | ((ctrl & E1000_CTRL_TFCE) ? "Tx" : "None"))); |
4047 | } | 4050 | } |
4048 | 4051 | ||
4049 | static bool e1000e_has_link(struct e1000_adapter *adapter) | 4052 | static bool e1000e_has_link(struct e1000_adapter *adapter) |
@@ -4338,7 +4341,7 @@ link_up: | |||
4338 | /* Force detection of hung controller every watchdog period */ | 4341 | /* Force detection of hung controller every watchdog period */ |
4339 | adapter->detect_tx_hung = 1; | 4342 | adapter->detect_tx_hung = 1; |
4340 | 4343 | ||
4341 | /* flush partial descriptors to memory before detecting tx hang */ | 4344 | /* flush partial descriptors to memory before detecting Tx hang */ |
4342 | if (adapter->flags2 & FLAG2_DMA_BURST) { | 4345 | if (adapter->flags2 & FLAG2_DMA_BURST) { |
4343 | ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD); | 4346 | ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD); |
4344 | ew32(RDTR, adapter->rx_int_delay | E1000_RDTR_FPD); | 4347 | ew32(RDTR, adapter->rx_int_delay | E1000_RDTR_FPD); |
@@ -4529,7 +4532,7 @@ static int e1000_tx_map(struct e1000_adapter *adapter, | |||
4529 | buffer_info->next_to_watch = i; | 4532 | buffer_info->next_to_watch = i; |
4530 | buffer_info->dma = dma_map_single(&pdev->dev, | 4533 | buffer_info->dma = dma_map_single(&pdev->dev, |
4531 | skb->data + offset, | 4534 | skb->data + offset, |
4532 | size, DMA_TO_DEVICE); | 4535 | size, DMA_TO_DEVICE); |
4533 | buffer_info->mapped_as_page = false; | 4536 | buffer_info->mapped_as_page = false; |
4534 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) | 4537 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) |
4535 | goto dma_error; | 4538 | goto dma_error; |
@@ -4576,7 +4579,7 @@ static int e1000_tx_map(struct e1000_adapter *adapter, | |||
4576 | } | 4579 | } |
4577 | } | 4580 | } |
4578 | 4581 | ||
4579 | segs = skb_shinfo(skb)->gso_segs ?: 1; | 4582 | segs = skb_shinfo(skb)->gso_segs ? : 1; |
4580 | /* multiply data chunks by size of headers */ | 4583 | /* multiply data chunks by size of headers */ |
4581 | bytecount = ((segs - 1) * skb_headlen(skb)) + skb->len; | 4584 | bytecount = ((segs - 1) * skb_headlen(skb)) + skb->len; |
4582 | 4585 | ||
@@ -4588,13 +4591,13 @@ static int e1000_tx_map(struct e1000_adapter *adapter, | |||
4588 | return count; | 4591 | return count; |
4589 | 4592 | ||
4590 | dma_error: | 4593 | dma_error: |
4591 | dev_err(&pdev->dev, "TX DMA map failed\n"); | 4594 | dev_err(&pdev->dev, "Tx DMA map failed\n"); |
4592 | buffer_info->dma = 0; | 4595 | buffer_info->dma = 0; |
4593 | if (count) | 4596 | if (count) |
4594 | count--; | 4597 | count--; |
4595 | 4598 | ||
4596 | while (count--) { | 4599 | while (count--) { |
4597 | if (i==0) | 4600 | if (i == 0) |
4598 | i += tx_ring->count; | 4601 | i += tx_ring->count; |
4599 | i--; | 4602 | i--; |
4600 | buffer_info = &tx_ring->buffer_info[i]; | 4603 | buffer_info = &tx_ring->buffer_info[i]; |
@@ -6193,7 +6196,7 @@ static int __init e1000_init_module(void) | |||
6193 | int ret; | 6196 | int ret; |
6194 | pr_info("Intel(R) PRO/1000 Network Driver - %s\n", | 6197 | pr_info("Intel(R) PRO/1000 Network Driver - %s\n", |
6195 | e1000e_driver_version); | 6198 | e1000e_driver_version); |
6196 | pr_info("Copyright (c) 1999 - 2010 Intel Corporation.\n"); | 6199 | pr_info("Copyright(c) 1999 - 2011 Intel Corporation.\n"); |
6197 | ret = pci_register_driver(&e1000_driver); | 6200 | ret = pci_register_driver(&e1000_driver); |
6198 | 6201 | ||
6199 | return ret; | 6202 | return ret; |
diff --git a/drivers/net/e1000e/param.c b/drivers/net/e1000e/param.c index a9612b0e4bca..4dd9b63273f6 100644 --- a/drivers/net/e1000e/param.c +++ b/drivers/net/e1000e/param.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel PRO/1000 Linux driver | 3 | Intel PRO/1000 Linux driver |
4 | Copyright(c) 1999 - 2010 Intel Corporation. | 4 | Copyright(c) 1999 - 2011 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
@@ -62,10 +62,9 @@ MODULE_PARM_DESC(copybreak, | |||
62 | module_param_array_named(X, X, int, &num_##X, 0); \ | 62 | module_param_array_named(X, X, int, &num_##X, 0); \ |
63 | MODULE_PARM_DESC(X, desc); | 63 | MODULE_PARM_DESC(X, desc); |
64 | 64 | ||
65 | |||
66 | /* | 65 | /* |
67 | * Transmit Interrupt Delay in units of 1.024 microseconds | 66 | * Transmit Interrupt Delay in units of 1.024 microseconds |
68 | * Tx interrupt delay needs to typically be set to something non zero | 67 | * Tx interrupt delay needs to typically be set to something non-zero |
69 | * | 68 | * |
70 | * Valid Range: 0-65535 | 69 | * Valid Range: 0-65535 |
71 | */ | 70 | */ |
@@ -112,6 +111,7 @@ E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate"); | |||
112 | #define DEFAULT_ITR 3 | 111 | #define DEFAULT_ITR 3 |
113 | #define MAX_ITR 100000 | 112 | #define MAX_ITR 100000 |
114 | #define MIN_ITR 100 | 113 | #define MIN_ITR 100 |
114 | |||
115 | /* IntMode (Interrupt Mode) | 115 | /* IntMode (Interrupt Mode) |
116 | * | 116 | * |
117 | * Valid Range: 0 - 2 | 117 | * Valid Range: 0 - 2 |
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c index 00f89e8a9fa0..6bea051b134b 100644 --- a/drivers/net/e1000e/phy.c +++ b/drivers/net/e1000e/phy.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel PRO/1000 Linux driver | 3 | Intel PRO/1000 Linux driver |
4 | Copyright(c) 1999 - 2010 Intel Corporation. | 4 | Copyright(c) 1999 - 2011 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
@@ -640,7 +640,7 @@ s32 e1000_copper_link_setup_82577(struct e1000_hw *hw) | |||
640 | s32 ret_val; | 640 | s32 ret_val; |
641 | u16 phy_data; | 641 | u16 phy_data; |
642 | 642 | ||
643 | /* Enable CRS on TX. This must be set for half-duplex operation. */ | 643 | /* Enable CRS on Tx. This must be set for half-duplex operation. */ |
644 | ret_val = e1e_rphy(hw, I82577_CFG_REG, &phy_data); | 644 | ret_val = e1e_rphy(hw, I82577_CFG_REG, &phy_data); |
645 | if (ret_val) | 645 | if (ret_val) |
646 | goto out; | 646 | goto out; |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 6de4675016b5..119aa2000c24 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -434,7 +434,6 @@ static void gfar_init_mac(struct net_device *ndev) | |||
434 | static struct net_device_stats *gfar_get_stats(struct net_device *dev) | 434 | static struct net_device_stats *gfar_get_stats(struct net_device *dev) |
435 | { | 435 | { |
436 | struct gfar_private *priv = netdev_priv(dev); | 436 | struct gfar_private *priv = netdev_priv(dev); |
437 | struct netdev_queue *txq; | ||
438 | unsigned long rx_packets = 0, rx_bytes = 0, rx_dropped = 0; | 437 | unsigned long rx_packets = 0, rx_bytes = 0, rx_dropped = 0; |
439 | unsigned long tx_packets = 0, tx_bytes = 0; | 438 | unsigned long tx_packets = 0, tx_bytes = 0; |
440 | int i = 0; | 439 | int i = 0; |
@@ -450,9 +449,8 @@ static struct net_device_stats *gfar_get_stats(struct net_device *dev) | |||
450 | dev->stats.rx_dropped = rx_dropped; | 449 | dev->stats.rx_dropped = rx_dropped; |
451 | 450 | ||
452 | for (i = 0; i < priv->num_tx_queues; i++) { | 451 | for (i = 0; i < priv->num_tx_queues; i++) { |
453 | txq = netdev_get_tx_queue(dev, i); | 452 | tx_bytes += priv->tx_queue[i]->stats.tx_bytes; |
454 | tx_bytes += txq->tx_bytes; | 453 | tx_packets += priv->tx_queue[i]->stats.tx_packets; |
455 | tx_packets += txq->tx_packets; | ||
456 | } | 454 | } |
457 | 455 | ||
458 | dev->stats.tx_bytes = tx_bytes; | 456 | dev->stats.tx_bytes = tx_bytes; |
@@ -2109,8 +2107,8 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2109 | } | 2107 | } |
2110 | 2108 | ||
2111 | /* Update transmit stats */ | 2109 | /* Update transmit stats */ |
2112 | txq->tx_bytes += skb->len; | 2110 | tx_queue->stats.tx_bytes += skb->len; |
2113 | txq->tx_packets ++; | 2111 | tx_queue->stats.tx_packets++; |
2114 | 2112 | ||
2115 | txbdp = txbdp_start = tx_queue->cur_tx; | 2113 | txbdp = txbdp_start = tx_queue->cur_tx; |
2116 | lstatus = txbdp->lstatus; | 2114 | 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 | */ | ||
913 | struct 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/greth.c b/drivers/net/greth.c index 27d6960ce09e..fdb0333f5cb6 100644 --- a/drivers/net/greth.c +++ b/drivers/net/greth.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Aeroflex Gaisler GRETH 10/100/1G Ethernet MAC. | 2 | * Aeroflex Gaisler GRETH 10/100/1G Ethernet MAC. |
3 | * | 3 | * |
4 | * 2005-2009 (c) Aeroflex Gaisler AB | 4 | * 2005-2010 (c) Aeroflex Gaisler AB |
5 | * | 5 | * |
6 | * This driver supports GRETH 10/100 and GRETH 10/100/1G Ethernet MACs | 6 | * This driver supports GRETH 10/100 and GRETH 10/100/1G Ethernet MACs |
7 | * available in the GRLIB VHDL IP core library. | 7 | * available in the GRLIB VHDL IP core library. |
@@ -356,6 +356,8 @@ static int greth_open(struct net_device *dev) | |||
356 | dev_dbg(&dev->dev, " starting queue\n"); | 356 | dev_dbg(&dev->dev, " starting queue\n"); |
357 | netif_start_queue(dev); | 357 | netif_start_queue(dev); |
358 | 358 | ||
359 | GRETH_REGSAVE(greth->regs->status, 0xFF); | ||
360 | |||
359 | napi_enable(&greth->napi); | 361 | napi_enable(&greth->napi); |
360 | 362 | ||
361 | greth_enable_irqs(greth); | 363 | greth_enable_irqs(greth); |
@@ -371,7 +373,9 @@ static int greth_close(struct net_device *dev) | |||
371 | 373 | ||
372 | napi_disable(&greth->napi); | 374 | napi_disable(&greth->napi); |
373 | 375 | ||
376 | greth_disable_irqs(greth); | ||
374 | greth_disable_tx(greth); | 377 | greth_disable_tx(greth); |
378 | greth_disable_rx(greth); | ||
375 | 379 | ||
376 | netif_stop_queue(dev); | 380 | netif_stop_queue(dev); |
377 | 381 | ||
@@ -388,12 +392,20 @@ greth_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
388 | struct greth_private *greth = netdev_priv(dev); | 392 | struct greth_private *greth = netdev_priv(dev); |
389 | struct greth_bd *bdp; | 393 | struct greth_bd *bdp; |
390 | int err = NETDEV_TX_OK; | 394 | int err = NETDEV_TX_OK; |
391 | u32 status, dma_addr; | 395 | u32 status, dma_addr, ctrl; |
396 | unsigned long flags; | ||
392 | 397 | ||
393 | bdp = greth->tx_bd_base + greth->tx_next; | 398 | /* Clean TX Ring */ |
399 | greth_clean_tx(greth->netdev); | ||
394 | 400 | ||
395 | if (unlikely(greth->tx_free <= 0)) { | 401 | if (unlikely(greth->tx_free <= 0)) { |
402 | spin_lock_irqsave(&greth->devlock, flags);/*save from poll/irq*/ | ||
403 | ctrl = GRETH_REGLOAD(greth->regs->control); | ||
404 | /* Enable TX IRQ only if not already in poll() routine */ | ||
405 | if (ctrl & GRETH_RXI) | ||
406 | GRETH_REGSAVE(greth->regs->control, ctrl | GRETH_TXI); | ||
396 | netif_stop_queue(dev); | 407 | netif_stop_queue(dev); |
408 | spin_unlock_irqrestore(&greth->devlock, flags); | ||
397 | return NETDEV_TX_BUSY; | 409 | return NETDEV_TX_BUSY; |
398 | } | 410 | } |
399 | 411 | ||
@@ -406,13 +418,14 @@ greth_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
406 | goto out; | 418 | goto out; |
407 | } | 419 | } |
408 | 420 | ||
421 | bdp = greth->tx_bd_base + greth->tx_next; | ||
409 | dma_addr = greth_read_bd(&bdp->addr); | 422 | dma_addr = greth_read_bd(&bdp->addr); |
410 | 423 | ||
411 | memcpy((unsigned char *) phys_to_virt(dma_addr), skb->data, skb->len); | 424 | memcpy((unsigned char *) phys_to_virt(dma_addr), skb->data, skb->len); |
412 | 425 | ||
413 | dma_sync_single_for_device(greth->dev, dma_addr, skb->len, DMA_TO_DEVICE); | 426 | dma_sync_single_for_device(greth->dev, dma_addr, skb->len, DMA_TO_DEVICE); |
414 | 427 | ||
415 | status = GRETH_BD_EN | (skb->len & GRETH_BD_LEN); | 428 | status = GRETH_BD_EN | GRETH_BD_IE | (skb->len & GRETH_BD_LEN); |
416 | 429 | ||
417 | /* Wrap around descriptor ring */ | 430 | /* Wrap around descriptor ring */ |
418 | if (greth->tx_next == GRETH_TXBD_NUM_MASK) { | 431 | if (greth->tx_next == GRETH_TXBD_NUM_MASK) { |
@@ -422,22 +435,11 @@ greth_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
422 | greth->tx_next = NEXT_TX(greth->tx_next); | 435 | greth->tx_next = NEXT_TX(greth->tx_next); |
423 | greth->tx_free--; | 436 | greth->tx_free--; |
424 | 437 | ||
425 | /* No more descriptors */ | ||
426 | if (unlikely(greth->tx_free == 0)) { | ||
427 | |||
428 | /* Free transmitted descriptors */ | ||
429 | greth_clean_tx(dev); | ||
430 | |||
431 | /* If nothing was cleaned, stop queue & wait for irq */ | ||
432 | if (unlikely(greth->tx_free == 0)) { | ||
433 | status |= GRETH_BD_IE; | ||
434 | netif_stop_queue(dev); | ||
435 | } | ||
436 | } | ||
437 | |||
438 | /* Write descriptor control word and enable transmission */ | 438 | /* Write descriptor control word and enable transmission */ |
439 | greth_write_bd(&bdp->stat, status); | 439 | greth_write_bd(&bdp->stat, status); |
440 | spin_lock_irqsave(&greth->devlock, flags); /*save from poll/irq*/ | ||
440 | greth_enable_tx(greth); | 441 | greth_enable_tx(greth); |
442 | spin_unlock_irqrestore(&greth->devlock, flags); | ||
441 | 443 | ||
442 | out: | 444 | out: |
443 | dev_kfree_skb(skb); | 445 | dev_kfree_skb(skb); |
@@ -450,13 +452,23 @@ greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev) | |||
450 | { | 452 | { |
451 | struct greth_private *greth = netdev_priv(dev); | 453 | struct greth_private *greth = netdev_priv(dev); |
452 | struct greth_bd *bdp; | 454 | struct greth_bd *bdp; |
453 | u32 status = 0, dma_addr; | 455 | u32 status = 0, dma_addr, ctrl; |
454 | int curr_tx, nr_frags, i, err = NETDEV_TX_OK; | 456 | int curr_tx, nr_frags, i, err = NETDEV_TX_OK; |
457 | unsigned long flags; | ||
455 | 458 | ||
456 | nr_frags = skb_shinfo(skb)->nr_frags; | 459 | nr_frags = skb_shinfo(skb)->nr_frags; |
457 | 460 | ||
461 | /* Clean TX Ring */ | ||
462 | greth_clean_tx_gbit(dev); | ||
463 | |||
458 | if (greth->tx_free < nr_frags + 1) { | 464 | if (greth->tx_free < nr_frags + 1) { |
465 | spin_lock_irqsave(&greth->devlock, flags);/*save from poll/irq*/ | ||
466 | ctrl = GRETH_REGLOAD(greth->regs->control); | ||
467 | /* Enable TX IRQ only if not already in poll() routine */ | ||
468 | if (ctrl & GRETH_RXI) | ||
469 | GRETH_REGSAVE(greth->regs->control, ctrl | GRETH_TXI); | ||
459 | netif_stop_queue(dev); | 470 | netif_stop_queue(dev); |
471 | spin_unlock_irqrestore(&greth->devlock, flags); | ||
460 | err = NETDEV_TX_BUSY; | 472 | err = NETDEV_TX_BUSY; |
461 | goto out; | 473 | goto out; |
462 | } | 474 | } |
@@ -499,7 +511,7 @@ greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev) | |||
499 | greth->tx_skbuff[curr_tx] = NULL; | 511 | greth->tx_skbuff[curr_tx] = NULL; |
500 | bdp = greth->tx_bd_base + curr_tx; | 512 | bdp = greth->tx_bd_base + curr_tx; |
501 | 513 | ||
502 | status = GRETH_TXBD_CSALL; | 514 | status = GRETH_TXBD_CSALL | GRETH_BD_EN; |
503 | status |= frag->size & GRETH_BD_LEN; | 515 | status |= frag->size & GRETH_BD_LEN; |
504 | 516 | ||
505 | /* Wrap around descriptor ring */ | 517 | /* Wrap around descriptor ring */ |
@@ -509,14 +521,8 @@ greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev) | |||
509 | /* More fragments left */ | 521 | /* More fragments left */ |
510 | if (i < nr_frags - 1) | 522 | if (i < nr_frags - 1) |
511 | status |= GRETH_TXBD_MORE; | 523 | status |= GRETH_TXBD_MORE; |
512 | 524 | else | |
513 | /* ... last fragment, check if out of descriptors */ | 525 | status |= GRETH_BD_IE; /* enable IRQ on last fragment */ |
514 | else if (greth->tx_free - nr_frags - 1 < (MAX_SKB_FRAGS + 1)) { | ||
515 | |||
516 | /* Enable interrupts and stop queue */ | ||
517 | status |= GRETH_BD_IE; | ||
518 | netif_stop_queue(dev); | ||
519 | } | ||
520 | 526 | ||
521 | greth_write_bd(&bdp->stat, status); | 527 | greth_write_bd(&bdp->stat, status); |
522 | 528 | ||
@@ -536,26 +542,29 @@ greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev) | |||
536 | 542 | ||
537 | wmb(); | 543 | wmb(); |
538 | 544 | ||
539 | /* Enable the descriptors that we configured ... */ | 545 | /* Enable the descriptor chain by enabling the first descriptor */ |
540 | for (i = 0; i < nr_frags + 1; i++) { | 546 | bdp = greth->tx_bd_base + greth->tx_next; |
541 | bdp = greth->tx_bd_base + greth->tx_next; | 547 | greth_write_bd(&bdp->stat, greth_read_bd(&bdp->stat) | GRETH_BD_EN); |
542 | greth_write_bd(&bdp->stat, greth_read_bd(&bdp->stat) | GRETH_BD_EN); | 548 | greth->tx_next = curr_tx; |
543 | greth->tx_next = NEXT_TX(greth->tx_next); | 549 | greth->tx_free -= nr_frags + 1; |
544 | greth->tx_free--; | ||
545 | } | ||
546 | 550 | ||
551 | wmb(); | ||
552 | |||
553 | spin_lock_irqsave(&greth->devlock, flags); /*save from poll/irq*/ | ||
547 | greth_enable_tx(greth); | 554 | greth_enable_tx(greth); |
555 | spin_unlock_irqrestore(&greth->devlock, flags); | ||
548 | 556 | ||
549 | return NETDEV_TX_OK; | 557 | return NETDEV_TX_OK; |
550 | 558 | ||
551 | frag_map_error: | 559 | frag_map_error: |
552 | /* Unmap SKB mappings that succeeded */ | 560 | /* Unmap SKB mappings that succeeded and disable descriptor */ |
553 | for (i = 0; greth->tx_next + i != curr_tx; i++) { | 561 | for (i = 0; greth->tx_next + i != curr_tx; i++) { |
554 | bdp = greth->tx_bd_base + greth->tx_next + i; | 562 | bdp = greth->tx_bd_base + greth->tx_next + i; |
555 | dma_unmap_single(greth->dev, | 563 | dma_unmap_single(greth->dev, |
556 | greth_read_bd(&bdp->addr), | 564 | greth_read_bd(&bdp->addr), |
557 | greth_read_bd(&bdp->stat) & GRETH_BD_LEN, | 565 | greth_read_bd(&bdp->stat) & GRETH_BD_LEN, |
558 | DMA_TO_DEVICE); | 566 | DMA_TO_DEVICE); |
567 | greth_write_bd(&bdp->stat, 0); | ||
559 | } | 568 | } |
560 | map_error: | 569 | map_error: |
561 | if (net_ratelimit()) | 570 | if (net_ratelimit()) |
@@ -565,12 +574,11 @@ out: | |||
565 | return err; | 574 | return err; |
566 | } | 575 | } |
567 | 576 | ||
568 | |||
569 | static irqreturn_t greth_interrupt(int irq, void *dev_id) | 577 | static irqreturn_t greth_interrupt(int irq, void *dev_id) |
570 | { | 578 | { |
571 | struct net_device *dev = dev_id; | 579 | struct net_device *dev = dev_id; |
572 | struct greth_private *greth; | 580 | struct greth_private *greth; |
573 | u32 status; | 581 | u32 status, ctrl; |
574 | irqreturn_t retval = IRQ_NONE; | 582 | irqreturn_t retval = IRQ_NONE; |
575 | 583 | ||
576 | greth = netdev_priv(dev); | 584 | greth = netdev_priv(dev); |
@@ -580,13 +588,15 @@ static irqreturn_t greth_interrupt(int irq, void *dev_id) | |||
580 | /* Get the interrupt events that caused us to be here. */ | 588 | /* Get the interrupt events that caused us to be here. */ |
581 | status = GRETH_REGLOAD(greth->regs->status); | 589 | status = GRETH_REGLOAD(greth->regs->status); |
582 | 590 | ||
583 | /* Handle rx and tx interrupts through poll */ | 591 | /* Must see if interrupts are enabled also, INT_TX|INT_RX flags may be |
584 | if (status & (GRETH_INT_RX | GRETH_INT_TX)) { | 592 | * set regardless of whether IRQ is enabled or not. Especially |
585 | 593 | * important when shared IRQ. | |
586 | /* Clear interrupt status */ | 594 | */ |
587 | GRETH_REGORIN(greth->regs->status, | 595 | ctrl = GRETH_REGLOAD(greth->regs->control); |
588 | status & (GRETH_INT_RX | GRETH_INT_TX)); | ||
589 | 596 | ||
597 | /* Handle rx and tx interrupts through poll */ | ||
598 | if (((status & (GRETH_INT_RE | GRETH_INT_RX)) && (ctrl & GRETH_RXI)) || | ||
599 | ((status & (GRETH_INT_TE | GRETH_INT_TX)) && (ctrl & GRETH_TXI))) { | ||
590 | retval = IRQ_HANDLED; | 600 | retval = IRQ_HANDLED; |
591 | 601 | ||
592 | /* Disable interrupts and schedule poll() */ | 602 | /* Disable interrupts and schedule poll() */ |
@@ -610,6 +620,8 @@ static void greth_clean_tx(struct net_device *dev) | |||
610 | 620 | ||
611 | while (1) { | 621 | while (1) { |
612 | bdp = greth->tx_bd_base + greth->tx_last; | 622 | bdp = greth->tx_bd_base + greth->tx_last; |
623 | GRETH_REGSAVE(greth->regs->status, GRETH_INT_TE | GRETH_INT_TX); | ||
624 | mb(); | ||
613 | stat = greth_read_bd(&bdp->stat); | 625 | stat = greth_read_bd(&bdp->stat); |
614 | 626 | ||
615 | if (unlikely(stat & GRETH_BD_EN)) | 627 | if (unlikely(stat & GRETH_BD_EN)) |
@@ -670,7 +682,10 @@ static void greth_clean_tx_gbit(struct net_device *dev) | |||
670 | 682 | ||
671 | /* We only clean fully completed SKBs */ | 683 | /* We only clean fully completed SKBs */ |
672 | bdp_last_frag = greth->tx_bd_base + SKIP_TX(greth->tx_last, nr_frags); | 684 | bdp_last_frag = greth->tx_bd_base + SKIP_TX(greth->tx_last, nr_frags); |
673 | stat = bdp_last_frag->stat; | 685 | |
686 | GRETH_REGSAVE(greth->regs->status, GRETH_INT_TE | GRETH_INT_TX); | ||
687 | mb(); | ||
688 | stat = greth_read_bd(&bdp_last_frag->stat); | ||
674 | 689 | ||
675 | if (stat & GRETH_BD_EN) | 690 | if (stat & GRETH_BD_EN) |
676 | break; | 691 | break; |
@@ -702,21 +717,9 @@ static void greth_clean_tx_gbit(struct net_device *dev) | |||
702 | greth->tx_free += nr_frags+1; | 717 | greth->tx_free += nr_frags+1; |
703 | dev_kfree_skb(skb); | 718 | dev_kfree_skb(skb); |
704 | } | 719 | } |
705 | if (greth->tx_free > (MAX_SKB_FRAGS + 1)) { | ||
706 | netif_wake_queue(dev); | ||
707 | } | ||
708 | } | ||
709 | 720 | ||
710 | static int greth_pending_packets(struct greth_private *greth) | 721 | if (netif_queue_stopped(dev) && (greth->tx_free > (MAX_SKB_FRAGS+1))) |
711 | { | 722 | netif_wake_queue(dev); |
712 | struct greth_bd *bdp; | ||
713 | u32 status; | ||
714 | bdp = greth->rx_bd_base + greth->rx_cur; | ||
715 | status = greth_read_bd(&bdp->stat); | ||
716 | if (status & GRETH_BD_EN) | ||
717 | return 0; | ||
718 | else | ||
719 | return 1; | ||
720 | } | 723 | } |
721 | 724 | ||
722 | static int greth_rx(struct net_device *dev, int limit) | 725 | static int greth_rx(struct net_device *dev, int limit) |
@@ -727,20 +730,24 @@ static int greth_rx(struct net_device *dev, int limit) | |||
727 | int pkt_len; | 730 | int pkt_len; |
728 | int bad, count; | 731 | int bad, count; |
729 | u32 status, dma_addr; | 732 | u32 status, dma_addr; |
733 | unsigned long flags; | ||
730 | 734 | ||
731 | greth = netdev_priv(dev); | 735 | greth = netdev_priv(dev); |
732 | 736 | ||
733 | for (count = 0; count < limit; ++count) { | 737 | for (count = 0; count < limit; ++count) { |
734 | 738 | ||
735 | bdp = greth->rx_bd_base + greth->rx_cur; | 739 | bdp = greth->rx_bd_base + greth->rx_cur; |
740 | GRETH_REGSAVE(greth->regs->status, GRETH_INT_RE | GRETH_INT_RX); | ||
741 | mb(); | ||
736 | status = greth_read_bd(&bdp->stat); | 742 | status = greth_read_bd(&bdp->stat); |
737 | dma_addr = greth_read_bd(&bdp->addr); | ||
738 | bad = 0; | ||
739 | 743 | ||
740 | if (unlikely(status & GRETH_BD_EN)) { | 744 | if (unlikely(status & GRETH_BD_EN)) { |
741 | break; | 745 | break; |
742 | } | 746 | } |
743 | 747 | ||
748 | dma_addr = greth_read_bd(&bdp->addr); | ||
749 | bad = 0; | ||
750 | |||
744 | /* Check status for errors. */ | 751 | /* Check status for errors. */ |
745 | if (unlikely(status & GRETH_RXBD_STATUS)) { | 752 | if (unlikely(status & GRETH_RXBD_STATUS)) { |
746 | if (status & GRETH_RXBD_ERR_FT) { | 753 | if (status & GRETH_RXBD_ERR_FT) { |
@@ -802,7 +809,9 @@ static int greth_rx(struct net_device *dev, int limit) | |||
802 | 809 | ||
803 | dma_sync_single_for_device(greth->dev, dma_addr, MAX_FRAME_SIZE, DMA_FROM_DEVICE); | 810 | dma_sync_single_for_device(greth->dev, dma_addr, MAX_FRAME_SIZE, DMA_FROM_DEVICE); |
804 | 811 | ||
812 | spin_lock_irqsave(&greth->devlock, flags); /* save from XMIT */ | ||
805 | greth_enable_rx(greth); | 813 | greth_enable_rx(greth); |
814 | spin_unlock_irqrestore(&greth->devlock, flags); | ||
806 | 815 | ||
807 | greth->rx_cur = NEXT_RX(greth->rx_cur); | 816 | greth->rx_cur = NEXT_RX(greth->rx_cur); |
808 | } | 817 | } |
@@ -836,6 +845,7 @@ static int greth_rx_gbit(struct net_device *dev, int limit) | |||
836 | int pkt_len; | 845 | int pkt_len; |
837 | int bad, count = 0; | 846 | int bad, count = 0; |
838 | u32 status, dma_addr; | 847 | u32 status, dma_addr; |
848 | unsigned long flags; | ||
839 | 849 | ||
840 | greth = netdev_priv(dev); | 850 | greth = netdev_priv(dev); |
841 | 851 | ||
@@ -843,6 +853,8 @@ static int greth_rx_gbit(struct net_device *dev, int limit) | |||
843 | 853 | ||
844 | bdp = greth->rx_bd_base + greth->rx_cur; | 854 | bdp = greth->rx_bd_base + greth->rx_cur; |
845 | skb = greth->rx_skbuff[greth->rx_cur]; | 855 | skb = greth->rx_skbuff[greth->rx_cur]; |
856 | GRETH_REGSAVE(greth->regs->status, GRETH_INT_RE | GRETH_INT_RX); | ||
857 | mb(); | ||
846 | status = greth_read_bd(&bdp->stat); | 858 | status = greth_read_bd(&bdp->stat); |
847 | bad = 0; | 859 | bad = 0; |
848 | 860 | ||
@@ -865,10 +877,9 @@ static int greth_rx_gbit(struct net_device *dev, int limit) | |||
865 | } | 877 | } |
866 | } | 878 | } |
867 | 879 | ||
868 | /* Allocate new skb to replace current */ | 880 | /* Allocate new skb to replace current, not needed if the |
869 | newskb = netdev_alloc_skb(dev, MAX_FRAME_SIZE + NET_IP_ALIGN); | 881 | * current skb can be reused */ |
870 | 882 | if (!bad && (newskb=netdev_alloc_skb(dev, MAX_FRAME_SIZE + NET_IP_ALIGN))) { | |
871 | if (!bad && newskb) { | ||
872 | skb_reserve(newskb, NET_IP_ALIGN); | 883 | skb_reserve(newskb, NET_IP_ALIGN); |
873 | 884 | ||
874 | dma_addr = dma_map_single(greth->dev, | 885 | dma_addr = dma_map_single(greth->dev, |
@@ -905,11 +916,22 @@ static int greth_rx_gbit(struct net_device *dev, int limit) | |||
905 | if (net_ratelimit()) | 916 | if (net_ratelimit()) |
906 | dev_warn(greth->dev, "Could not create DMA mapping, dropping packet\n"); | 917 | dev_warn(greth->dev, "Could not create DMA mapping, dropping packet\n"); |
907 | dev_kfree_skb(newskb); | 918 | dev_kfree_skb(newskb); |
919 | /* reusing current skb, so it is a drop */ | ||
908 | dev->stats.rx_dropped++; | 920 | dev->stats.rx_dropped++; |
909 | } | 921 | } |
922 | } else if (bad) { | ||
923 | /* Bad Frame transfer, the skb is reused */ | ||
924 | dev->stats.rx_dropped++; | ||
910 | } else { | 925 | } else { |
926 | /* Failed Allocating a new skb. This is rather stupid | ||
927 | * but the current "filled" skb is reused, as if | ||
928 | * transfer failure. One could argue that RX descriptor | ||
929 | * table handling should be divided into cleaning and | ||
930 | * filling as the TX part of the driver | ||
931 | */ | ||
911 | if (net_ratelimit()) | 932 | if (net_ratelimit()) |
912 | dev_warn(greth->dev, "Could not allocate SKB, dropping packet\n"); | 933 | dev_warn(greth->dev, "Could not allocate SKB, dropping packet\n"); |
934 | /* reusing current skb, so it is a drop */ | ||
913 | dev->stats.rx_dropped++; | 935 | dev->stats.rx_dropped++; |
914 | } | 936 | } |
915 | 937 | ||
@@ -920,7 +942,9 @@ static int greth_rx_gbit(struct net_device *dev, int limit) | |||
920 | 942 | ||
921 | wmb(); | 943 | wmb(); |
922 | greth_write_bd(&bdp->stat, status); | 944 | greth_write_bd(&bdp->stat, status); |
945 | spin_lock_irqsave(&greth->devlock, flags); | ||
923 | greth_enable_rx(greth); | 946 | greth_enable_rx(greth); |
947 | spin_unlock_irqrestore(&greth->devlock, flags); | ||
924 | greth->rx_cur = NEXT_RX(greth->rx_cur); | 948 | greth->rx_cur = NEXT_RX(greth->rx_cur); |
925 | } | 949 | } |
926 | 950 | ||
@@ -932,15 +956,18 @@ static int greth_poll(struct napi_struct *napi, int budget) | |||
932 | { | 956 | { |
933 | struct greth_private *greth; | 957 | struct greth_private *greth; |
934 | int work_done = 0; | 958 | int work_done = 0; |
959 | unsigned long flags; | ||
960 | u32 mask, ctrl; | ||
935 | greth = container_of(napi, struct greth_private, napi); | 961 | greth = container_of(napi, struct greth_private, napi); |
936 | 962 | ||
937 | if (greth->gbit_mac) { | 963 | restart_txrx_poll: |
938 | greth_clean_tx_gbit(greth->netdev); | 964 | if (netif_queue_stopped(greth->netdev)) { |
939 | } else { | 965 | if (greth->gbit_mac) |
940 | greth_clean_tx(greth->netdev); | 966 | greth_clean_tx_gbit(greth->netdev); |
967 | else | ||
968 | greth_clean_tx(greth->netdev); | ||
941 | } | 969 | } |
942 | 970 | ||
943 | restart_poll: | ||
944 | if (greth->gbit_mac) { | 971 | if (greth->gbit_mac) { |
945 | work_done += greth_rx_gbit(greth->netdev, budget - work_done); | 972 | work_done += greth_rx_gbit(greth->netdev, budget - work_done); |
946 | } else { | 973 | } else { |
@@ -949,15 +976,29 @@ restart_poll: | |||
949 | 976 | ||
950 | if (work_done < budget) { | 977 | if (work_done < budget) { |
951 | 978 | ||
952 | napi_complete(napi); | 979 | spin_lock_irqsave(&greth->devlock, flags); |
980 | |||
981 | ctrl = GRETH_REGLOAD(greth->regs->control); | ||
982 | if (netif_queue_stopped(greth->netdev)) { | ||
983 | GRETH_REGSAVE(greth->regs->control, | ||
984 | ctrl | GRETH_TXI | GRETH_RXI); | ||
985 | mask = GRETH_INT_RX | GRETH_INT_RE | | ||
986 | GRETH_INT_TX | GRETH_INT_TE; | ||
987 | } else { | ||
988 | GRETH_REGSAVE(greth->regs->control, ctrl | GRETH_RXI); | ||
989 | mask = GRETH_INT_RX | GRETH_INT_RE; | ||
990 | } | ||
953 | 991 | ||
954 | if (greth_pending_packets(greth)) { | 992 | if (GRETH_REGLOAD(greth->regs->status) & mask) { |
955 | napi_reschedule(napi); | 993 | GRETH_REGSAVE(greth->regs->control, ctrl); |
956 | goto restart_poll; | 994 | spin_unlock_irqrestore(&greth->devlock, flags); |
995 | goto restart_txrx_poll; | ||
996 | } else { | ||
997 | __napi_complete(napi); | ||
998 | spin_unlock_irqrestore(&greth->devlock, flags); | ||
957 | } | 999 | } |
958 | } | 1000 | } |
959 | 1001 | ||
960 | greth_enable_irqs(greth); | ||
961 | return work_done; | 1002 | return work_done; |
962 | } | 1003 | } |
963 | 1004 | ||
@@ -1152,11 +1193,11 @@ static const struct ethtool_ops greth_ethtool_ops = { | |||
1152 | }; | 1193 | }; |
1153 | 1194 | ||
1154 | static struct net_device_ops greth_netdev_ops = { | 1195 | static struct net_device_ops greth_netdev_ops = { |
1155 | .ndo_open = greth_open, | 1196 | .ndo_open = greth_open, |
1156 | .ndo_stop = greth_close, | 1197 | .ndo_stop = greth_close, |
1157 | .ndo_start_xmit = greth_start_xmit, | 1198 | .ndo_start_xmit = greth_start_xmit, |
1158 | .ndo_set_mac_address = greth_set_mac_add, | 1199 | .ndo_set_mac_address = greth_set_mac_add, |
1159 | .ndo_validate_addr = eth_validate_addr, | 1200 | .ndo_validate_addr = eth_validate_addr, |
1160 | }; | 1201 | }; |
1161 | 1202 | ||
1162 | static inline int wait_for_mdio(struct greth_private *greth) | 1203 | static inline int wait_for_mdio(struct greth_private *greth) |
@@ -1217,29 +1258,26 @@ static void greth_link_change(struct net_device *dev) | |||
1217 | struct greth_private *greth = netdev_priv(dev); | 1258 | struct greth_private *greth = netdev_priv(dev); |
1218 | struct phy_device *phydev = greth->phy; | 1259 | struct phy_device *phydev = greth->phy; |
1219 | unsigned long flags; | 1260 | unsigned long flags; |
1220 | |||
1221 | int status_change = 0; | 1261 | int status_change = 0; |
1262 | u32 ctrl; | ||
1222 | 1263 | ||
1223 | spin_lock_irqsave(&greth->devlock, flags); | 1264 | spin_lock_irqsave(&greth->devlock, flags); |
1224 | 1265 | ||
1225 | if (phydev->link) { | 1266 | if (phydev->link) { |
1226 | 1267 | ||
1227 | if ((greth->speed != phydev->speed) || (greth->duplex != phydev->duplex)) { | 1268 | if ((greth->speed != phydev->speed) || (greth->duplex != phydev->duplex)) { |
1228 | 1269 | ctrl = GRETH_REGLOAD(greth->regs->control) & | |
1229 | GRETH_REGANDIN(greth->regs->control, | 1270 | ~(GRETH_CTRL_FD | GRETH_CTRL_SP | GRETH_CTRL_GB); |
1230 | ~(GRETH_CTRL_FD | GRETH_CTRL_SP | GRETH_CTRL_GB)); | ||
1231 | 1271 | ||
1232 | if (phydev->duplex) | 1272 | if (phydev->duplex) |
1233 | GRETH_REGORIN(greth->regs->control, GRETH_CTRL_FD); | 1273 | ctrl |= GRETH_CTRL_FD; |
1234 | |||
1235 | if (phydev->speed == SPEED_100) { | ||
1236 | |||
1237 | GRETH_REGORIN(greth->regs->control, GRETH_CTRL_SP); | ||
1238 | } | ||
1239 | 1274 | ||
1275 | if (phydev->speed == SPEED_100) | ||
1276 | ctrl |= GRETH_CTRL_SP; | ||
1240 | else if (phydev->speed == SPEED_1000) | 1277 | else if (phydev->speed == SPEED_1000) |
1241 | GRETH_REGORIN(greth->regs->control, GRETH_CTRL_GB); | 1278 | ctrl |= GRETH_CTRL_GB; |
1242 | 1279 | ||
1280 | GRETH_REGSAVE(greth->regs->control, ctrl); | ||
1243 | greth->speed = phydev->speed; | 1281 | greth->speed = phydev->speed; |
1244 | greth->duplex = phydev->duplex; | 1282 | greth->duplex = phydev->duplex; |
1245 | status_change = 1; | 1283 | status_change = 1; |
@@ -1600,6 +1638,9 @@ static struct of_device_id greth_of_match[] = { | |||
1600 | { | 1638 | { |
1601 | .name = "GAISLER_ETHMAC", | 1639 | .name = "GAISLER_ETHMAC", |
1602 | }, | 1640 | }, |
1641 | { | ||
1642 | .name = "01_01d", | ||
1643 | }, | ||
1603 | {}, | 1644 | {}, |
1604 | }; | 1645 | }; |
1605 | 1646 | ||
diff --git a/drivers/net/greth.h b/drivers/net/greth.h index 03ad903cd676..be0f2062bd14 100644 --- a/drivers/net/greth.h +++ b/drivers/net/greth.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #define GRETH_BD_LEN 0x7FF | 23 | #define GRETH_BD_LEN 0x7FF |
24 | 24 | ||
25 | #define GRETH_TXEN 0x1 | 25 | #define GRETH_TXEN 0x1 |
26 | #define GRETH_INT_TE 0x2 | ||
26 | #define GRETH_INT_TX 0x8 | 27 | #define GRETH_INT_TX 0x8 |
27 | #define GRETH_TXI 0x4 | 28 | #define GRETH_TXI 0x4 |
28 | #define GRETH_TXBD_STATUS 0x0001C000 | 29 | #define GRETH_TXBD_STATUS 0x0001C000 |
@@ -35,6 +36,7 @@ | |||
35 | #define GRETH_TXBD_ERR_UE 0x4000 | 36 | #define GRETH_TXBD_ERR_UE 0x4000 |
36 | #define GRETH_TXBD_ERR_AL 0x8000 | 37 | #define GRETH_TXBD_ERR_AL 0x8000 |
37 | 38 | ||
39 | #define GRETH_INT_RE 0x1 | ||
38 | #define GRETH_INT_RX 0x4 | 40 | #define GRETH_INT_RX 0x4 |
39 | #define GRETH_RXEN 0x2 | 41 | #define GRETH_RXEN 0x2 |
40 | #define GRETH_RXI 0x8 | 42 | #define GRETH_RXI 0x8 |
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 | ||
559 | MODULE_AUTHOR("Realtek and the Linux r8169 crew <netdev@vger.kernel.org>"); | 561 | MODULE_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 | ||
1771 | static void rtl_release_firmware(struct rtl8169_private *tp) | ||
1772 | { | ||
1773 | release_firmware(tp->fw); | ||
1774 | tp->fw = NULL; | ||
1775 | } | ||
1776 | |||
1777 | static 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); | ||
1790 | out: | ||
1791 | return rc; | ||
1792 | } | ||
1793 | |||
1769 | static void rtl8169s_hw_phy_config(struct rtl8169_private *tp) | 1794 | static 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 | ||
1269 | struct efx_tx_queue * | ||
1270 | efx_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 | |||
1279 | static void efx_set_channels(struct efx_nic *efx) | 1272 | static 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 | ||
932 | extern struct efx_tx_queue * | 933 | static inline struct efx_tx_queue * |
933 | efx_get_tx_queue(struct efx_nic *efx, unsigned index, unsigned type); | 934 | efx_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 | ||
935 | static inline struct efx_tx_queue * | 941 | static inline struct efx_tx_queue * |
936 | efx_channel_get_tx_queue(struct efx_channel *channel, unsigned type) | 942 | efx_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 @@ | |||
142 | MODULE_AUTHOR("Tilera"); | 142 | MODULE_AUTHOR("Tilera"); |
143 | MODULE_LICENSE("GPL"); | 143 | MODULE_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/ucc_geth.c b/drivers/net/ucc_geth.c index 73a3e0d93237..715e7b47e7e9 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
@@ -2032,7 +2032,7 @@ static void ucc_geth_set_multi(struct net_device *dev) | |||
2032 | netdev_for_each_mc_addr(ha, dev) { | 2032 | netdev_for_each_mc_addr(ha, dev) { |
2033 | /* Only support group multicast for now. | 2033 | /* Only support group multicast for now. |
2034 | */ | 2034 | */ |
2035 | if (!(ha->addr[0] & 1)) | 2035 | if (!is_multicast_ether_addr(ha->addr)) |
2036 | continue; | 2036 | continue; |
2037 | 2037 | ||
2038 | /* Ask CPM to run CRC and set bit in | 2038 | /* Ask CPM to run CRC and set bit in |
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 | ||
4122 | out: | 4122 | out: |
4123 | release_firmware(fw); | ||
4123 | return ret; | 4124 | return ret; |
4124 | } | 4125 | } |
4125 | 4126 | ||
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_calib.c b/drivers/net/wireless/ath/ath9k/ar9002_calib.c index 01880aa13e36..ea2e7d714bda 100644 --- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c +++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c | |||
@@ -954,6 +954,9 @@ static void ar9002_hw_init_cal_settings(struct ath_hw *ah) | |||
954 | &adc_dc_cal_multi_sample; | 954 | &adc_dc_cal_multi_sample; |
955 | } | 955 | } |
956 | ah->supp_cals = ADC_GAIN_CAL | ADC_DC_CAL | IQ_MISMATCH_CAL; | 956 | ah->supp_cals = ADC_GAIN_CAL | ADC_DC_CAL | IQ_MISMATCH_CAL; |
957 | |||
958 | if (AR_SREV_9287(ah)) | ||
959 | ah->supp_cals &= ~ADC_GAIN_CAL; | ||
957 | } | 960 | } |
958 | } | 961 | } |
959 | 962 | ||
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c b/drivers/net/wireless/ath/ath9k/eeprom_def.c index 088f141f2006..749a93608664 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_def.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c | |||
@@ -226,6 +226,10 @@ static int ath9k_hw_def_check_eeprom(struct ath_hw *ah) | |||
226 | eep->baseEepHeader.pwdclkind == 0) | 226 | eep->baseEepHeader.pwdclkind == 0) |
227 | ah->need_an_top2_fixup = 1; | 227 | ah->need_an_top2_fixup = 1; |
228 | 228 | ||
229 | if ((common->bus_ops->ath_bus_type == ATH_USB) && | ||
230 | (AR_SREV_9280(ah))) | ||
231 | eep->modalHeader[0].xpaBiasLvl = 0; | ||
232 | |||
229 | return 0; | 233 | return 0; |
230 | } | 234 | } |
231 | 235 | ||
diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h index a099b3e87ed3..1ce506f23110 100644 --- a/drivers/net/wireless/ath/ath9k/htc.h +++ b/drivers/net/wireless/ath/ath9k/htc.h | |||
@@ -433,6 +433,7 @@ void ath9k_htc_txep(void *priv, struct sk_buff *skb, enum htc_endpoint_id ep_id, | |||
433 | void ath9k_htc_beaconep(void *drv_priv, struct sk_buff *skb, | 433 | void ath9k_htc_beaconep(void *drv_priv, struct sk_buff *skb, |
434 | enum htc_endpoint_id ep_id, bool txok); | 434 | enum htc_endpoint_id ep_id, bool txok); |
435 | 435 | ||
436 | int ath9k_htc_update_cap_target(struct ath9k_htc_priv *priv); | ||
436 | void ath9k_htc_station_work(struct work_struct *work); | 437 | void ath9k_htc_station_work(struct work_struct *work); |
437 | void ath9k_htc_aggr_work(struct work_struct *work); | 438 | void ath9k_htc_aggr_work(struct work_struct *work); |
438 | void ath9k_ani_work(struct work_struct *work);; | 439 | void ath9k_ani_work(struct work_struct *work);; |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c index 845b4c938d16..f4d576bc3ccd 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c | |||
@@ -301,6 +301,16 @@ static int ath9k_htc_add_monitor_interface(struct ath9k_htc_priv *priv) | |||
301 | 301 | ||
302 | priv->nstations++; | 302 | priv->nstations++; |
303 | 303 | ||
304 | /* | ||
305 | * Set chainmask etc. on the target. | ||
306 | */ | ||
307 | ret = ath9k_htc_update_cap_target(priv); | ||
308 | if (ret) | ||
309 | ath_dbg(common, ATH_DBG_CONFIG, | ||
310 | "Failed to update capability in target\n"); | ||
311 | |||
312 | priv->ah->is_monitoring = true; | ||
313 | |||
304 | return 0; | 314 | return 0; |
305 | 315 | ||
306 | err_vif: | 316 | err_vif: |
@@ -328,6 +338,7 @@ static int ath9k_htc_remove_monitor_interface(struct ath9k_htc_priv *priv) | |||
328 | } | 338 | } |
329 | 339 | ||
330 | priv->nstations--; | 340 | priv->nstations--; |
341 | priv->ah->is_monitoring = false; | ||
331 | 342 | ||
332 | return 0; | 343 | return 0; |
333 | } | 344 | } |
@@ -419,7 +430,7 @@ static int ath9k_htc_remove_station(struct ath9k_htc_priv *priv, | |||
419 | return 0; | 430 | return 0; |
420 | } | 431 | } |
421 | 432 | ||
422 | static int ath9k_htc_update_cap_target(struct ath9k_htc_priv *priv) | 433 | int ath9k_htc_update_cap_target(struct ath9k_htc_priv *priv) |
423 | { | 434 | { |
424 | struct ath9k_htc_cap_target tcap; | 435 | struct ath9k_htc_cap_target tcap; |
425 | int ret; | 436 | int ret; |
@@ -1186,6 +1197,20 @@ static int ath9k_htc_config(struct ieee80211_hw *hw, u32 changed) | |||
1186 | } | 1197 | } |
1187 | } | 1198 | } |
1188 | 1199 | ||
1200 | /* | ||
1201 | * Monitor interface should be added before | ||
1202 | * IEEE80211_CONF_CHANGE_CHANNEL is handled. | ||
1203 | */ | ||
1204 | if (changed & IEEE80211_CONF_CHANGE_MONITOR) { | ||
1205 | if (conf->flags & IEEE80211_CONF_MONITOR) { | ||
1206 | if (ath9k_htc_add_monitor_interface(priv)) | ||
1207 | ath_err(common, "Failed to set monitor mode\n"); | ||
1208 | else | ||
1209 | ath_dbg(common, ATH_DBG_CONFIG, | ||
1210 | "HW opmode set to Monitor mode\n"); | ||
1211 | } | ||
1212 | } | ||
1213 | |||
1189 | if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { | 1214 | if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { |
1190 | struct ieee80211_channel *curchan = hw->conf.channel; | 1215 | struct ieee80211_channel *curchan = hw->conf.channel; |
1191 | int pos = curchan->hw_value; | 1216 | int pos = curchan->hw_value; |
@@ -1221,16 +1246,6 @@ static int ath9k_htc_config(struct ieee80211_hw *hw, u32 changed) | |||
1221 | ath_update_txpow(priv); | 1246 | ath_update_txpow(priv); |
1222 | } | 1247 | } |
1223 | 1248 | ||
1224 | if (changed & IEEE80211_CONF_CHANGE_MONITOR) { | ||
1225 | if (conf->flags & IEEE80211_CONF_MONITOR) { | ||
1226 | if (ath9k_htc_add_monitor_interface(priv)) | ||
1227 | ath_err(common, "Failed to set monitor mode\n"); | ||
1228 | else | ||
1229 | ath_dbg(common, ATH_DBG_CONFIG, | ||
1230 | "HW opmode set to Monitor mode\n"); | ||
1231 | } | ||
1232 | } | ||
1233 | |||
1234 | if (changed & IEEE80211_CONF_CHANGE_IDLE) { | 1249 | if (changed & IEEE80211_CONF_CHANGE_IDLE) { |
1235 | mutex_lock(&priv->htc_pm_lock); | 1250 | mutex_lock(&priv->htc_pm_lock); |
1236 | if (!priv->ps_idle) { | 1251 | if (!priv->ps_idle) { |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index fde978665e07..1afb8bb85756 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -436,9 +436,10 @@ static int ath9k_hw_init_macaddr(struct ath_hw *ah) | |||
436 | 436 | ||
437 | static int ath9k_hw_post_init(struct ath_hw *ah) | 437 | static int ath9k_hw_post_init(struct ath_hw *ah) |
438 | { | 438 | { |
439 | struct ath_common *common = ath9k_hw_common(ah); | ||
439 | int ecode; | 440 | int ecode; |
440 | 441 | ||
441 | if (!AR_SREV_9271(ah)) { | 442 | if (common->bus_ops->ath_bus_type != ATH_USB) { |
442 | if (!ath9k_hw_chip_test(ah)) | 443 | if (!ath9k_hw_chip_test(ah)) |
443 | return -ENODEV; | 444 | return -ENODEV; |
444 | } | 445 | } |
@@ -1213,7 +1214,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, | |||
1213 | ah->txchainmask = common->tx_chainmask; | 1214 | ah->txchainmask = common->tx_chainmask; |
1214 | ah->rxchainmask = common->rx_chainmask; | 1215 | ah->rxchainmask = common->rx_chainmask; |
1215 | 1216 | ||
1216 | if (!ah->chip_fullsleep) { | 1217 | if ((common->bus_ops->ath_bus_type != ATH_USB) && !ah->chip_fullsleep) { |
1217 | ath9k_hw_abortpcurecv(ah); | 1218 | ath9k_hw_abortpcurecv(ah); |
1218 | if (!ath9k_hw_stopdmarecv(ah)) { | 1219 | if (!ath9k_hw_stopdmarecv(ah)) { |
1219 | ath_dbg(common, ATH_DBG_XMIT, | 1220 | ath_dbg(common, ATH_DBG_XMIT, |
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index bd8a4134edeb..2176edede39b 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c | |||
@@ -518,22 +518,21 @@ static int prism2_config(struct pcmcia_device *link) | |||
518 | hw_priv->link = link; | 518 | hw_priv->link = link; |
519 | 519 | ||
520 | /* | 520 | /* |
521 | * Make sure the IRQ handler cannot proceed until at least | 521 | * We enable IRQ here, but IRQ handler will not proceed |
522 | * dev->base_addr is initialized. | 522 | * until dev->base_addr is set below. This protect us from |
523 | * receive interrupts when driver is not initialized. | ||
523 | */ | 524 | */ |
524 | spin_lock_irqsave(&local->irq_init_lock, flags); | ||
525 | |||
526 | ret = pcmcia_request_irq(link, prism2_interrupt); | 525 | ret = pcmcia_request_irq(link, prism2_interrupt); |
527 | if (ret) | 526 | if (ret) |
528 | goto failed_unlock; | 527 | goto failed; |
529 | 528 | ||
530 | ret = pcmcia_enable_device(link); | 529 | ret = pcmcia_enable_device(link); |
531 | if (ret) | 530 | if (ret) |
532 | goto failed_unlock; | 531 | goto failed; |
533 | 532 | ||
533 | spin_lock_irqsave(&local->irq_init_lock, flags); | ||
534 | dev->irq = link->irq; | 534 | dev->irq = link->irq; |
535 | dev->base_addr = link->resource[0]->start; | 535 | dev->base_addr = link->resource[0]->start; |
536 | |||
537 | spin_unlock_irqrestore(&local->irq_init_lock, flags); | 536 | spin_unlock_irqrestore(&local->irq_init_lock, flags); |
538 | 537 | ||
539 | local->shutdown = 0; | 538 | local->shutdown = 0; |
@@ -546,8 +545,6 @@ static int prism2_config(struct pcmcia_device *link) | |||
546 | 545 | ||
547 | return ret; | 546 | return ret; |
548 | 547 | ||
549 | failed_unlock: | ||
550 | spin_unlock_irqrestore(&local->irq_init_lock, flags); | ||
551 | failed: | 548 | failed: |
552 | kfree(hw_priv); | 549 | kfree(hw_priv); |
553 | prism2_release((u_long)link); | 550 | prism2_release((u_long)link); |
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c index 8d6ed5f6f46f..ae438ed80c2f 100644 --- a/drivers/net/wireless/ipw2x00/ipw2200.c +++ b/drivers/net/wireless/ipw2x00/ipw2200.c | |||
@@ -1973,6 +1973,13 @@ static void ipw_irq_tasklet(struct ipw_priv *priv) | |||
1973 | 1973 | ||
1974 | inta = ipw_read32(priv, IPW_INTA_RW); | 1974 | inta = ipw_read32(priv, IPW_INTA_RW); |
1975 | inta_mask = ipw_read32(priv, IPW_INTA_MASK_R); | 1975 | inta_mask = ipw_read32(priv, IPW_INTA_MASK_R); |
1976 | |||
1977 | if (inta == 0xFFFFFFFF) { | ||
1978 | /* Hardware disappeared */ | ||
1979 | IPW_WARNING("TASKLET INTA == 0xFFFFFFFF\n"); | ||
1980 | /* Only handle the cached INTA values */ | ||
1981 | inta = 0; | ||
1982 | } | ||
1976 | inta &= (IPW_INTA_MASK_ALL & inta_mask); | 1983 | inta &= (IPW_INTA_MASK_ALL & inta_mask); |
1977 | 1984 | ||
1978 | /* Add any cached INTA values that need to be handled */ | 1985 | /* Add any cached INTA values that need to be handled */ |
diff --git a/drivers/net/wireless/p54/txrx.c b/drivers/net/wireless/p54/txrx.c index 76b2318a7dc7..f618b9623e5a 100644 --- a/drivers/net/wireless/p54/txrx.c +++ b/drivers/net/wireless/p54/txrx.c | |||
@@ -618,7 +618,7 @@ static void p54_tx_80211_header(struct p54_common *priv, struct sk_buff *skb, | |||
618 | else | 618 | else |
619 | *burst_possible = false; | 619 | *burst_possible = false; |
620 | 620 | ||
621 | if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) | 621 | if (!(info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ)) |
622 | *flags |= P54_HDR_FLAG_DATA_OUT_SEQNR; | 622 | *flags |= P54_HDR_FLAG_DATA_OUT_SEQNR; |
623 | 623 | ||
624 | if (info->flags & IEEE80211_TX_CTL_PSPOLL_RESPONSE) | 624 | if (info->flags & IEEE80211_TX_CTL_PSPOLL_RESPONSE) |