aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-07 11:36:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-07 11:36:57 -0400
commit4cac04dd63fa3b202ee313ed1afbbd135ab887ee (patch)
tree8fa7ed0186030297c69ac95530853eb5c860a894
parente1c287b992d30dab86f1b1bfe1780d9d3a652b34 (diff)
parentbfe87dbc7b4da5b05a1a78480e996787a500cc6f (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: fix endian lossage in forcedeth net/tokenring/olympic.c section fixes net: marvell.c fix sparse shadowed variable warning [VLAN]: Fix egress priority mappings leak. [TG3]: Add PHY workaround for 5784 [NET]: srandom32 fixes for networking v2 [IPV6]: Fix refcounting for anycast dst entries. [IPV6]: inet6_dev on loopback should be kept until namespace stop. [IPV6]: Event type in addrconf_ifdown is mis-used. [ICMP]: Ensure that ICMP relookup maintains status quo
-rw-r--r--drivers/net/forcedeth.c5
-rw-r--r--drivers/net/phy/marvell.c2
-rw-r--r--drivers/net/tg3.c154
-rw-r--r--drivers/net/tg3.h79
-rw-r--r--drivers/net/tokenring/olympic.c6
-rw-r--r--lib/random32.c13
-rw-r--r--net/8021q/vlan_dev.c15
-rw-r--r--net/ipv4/icmp.c24
-rw-r--r--net/ipv6/addrconf.c12
-rw-r--r--net/ipv6/anycast.c9
-rw-r--r--net/ipv6/icmp.c22
11 files changed, 281 insertions, 60 deletions
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 980c2c229a71..419f533006ab 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -2112,9 +2112,8 @@ static inline void nv_tx_flip_ownership(struct net_device *dev)
2112 2112
2113 np->tx_pkts_in_progress--; 2113 np->tx_pkts_in_progress--;
2114 if (np->tx_change_owner) { 2114 if (np->tx_change_owner) {
2115 __le32 flaglen = le32_to_cpu(np->tx_change_owner->first_tx_desc->flaglen); 2115 np->tx_change_owner->first_tx_desc->flaglen |=
2116 flaglen |= NV_TX2_VALID; 2116 cpu_to_le32(NV_TX2_VALID);
2117 np->tx_change_owner->first_tx_desc->flaglen = cpu_to_le32(flaglen);
2118 np->tx_pkts_in_progress++; 2117 np->tx_pkts_in_progress++;
2119 2118
2120 np->tx_change_owner = np->tx_change_owner->next_tx_ctx; 2119 np->tx_change_owner = np->tx_change_owner->next_tx_ctx;
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 33539917e9b8..32a8503a7acd 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -211,8 +211,6 @@ static int m88e1111_config_init(struct phy_device *phydev)
211 } 211 }
212 212
213 if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { 213 if (phydev->interface == PHY_INTERFACE_MODE_SGMII) {
214 int temp;
215
216 temp = phy_read(phydev, MII_M1111_PHY_EXT_SR); 214 temp = phy_read(phydev, MII_M1111_PHY_EXT_SR);
217 if (temp < 0) 215 if (temp < 0)
218 return temp; 216 return temp;
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index f9ef8bd8b11e..d4655b2d1f3f 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -64,8 +64,8 @@
64 64
65#define DRV_MODULE_NAME "tg3" 65#define DRV_MODULE_NAME "tg3"
66#define PFX DRV_MODULE_NAME ": " 66#define PFX DRV_MODULE_NAME ": "
67#define DRV_MODULE_VERSION "3.88" 67#define DRV_MODULE_VERSION "3.89"
68#define DRV_MODULE_RELDATE "March 20, 2008" 68#define DRV_MODULE_RELDATE "April 03, 2008"
69 69
70#define TG3_DEF_MAC_MODE 0 70#define TG3_DEF_MAC_MODE 0
71#define TG3_DEF_RX_MODE 0 71#define TG3_DEF_RX_MODE 0
@@ -804,6 +804,12 @@ static int tg3_writephy(struct tg3 *tp, int reg, u32 val)
804 return ret; 804 return ret;
805} 805}
806 806
807static void tg3_phydsp_write(struct tg3 *tp, u32 reg, u32 val)
808{
809 tg3_writephy(tp, MII_TG3_DSP_ADDRESS, reg);
810 tg3_writephy(tp, MII_TG3_DSP_RW_PORT, val);
811}
812
807static void tg3_phy_toggle_automdix(struct tg3 *tp, int enable) 813static void tg3_phy_toggle_automdix(struct tg3 *tp, int enable)
808{ 814{
809 u32 phy; 815 u32 phy;
@@ -886,6 +892,49 @@ static int tg3_bmcr_reset(struct tg3 *tp)
886 return 0; 892 return 0;
887} 893}
888 894
895static void tg3_phy_apply_otp(struct tg3 *tp)
896{
897 u32 otp, phy;
898
899 if (!tp->phy_otp)
900 return;
901
902 otp = tp->phy_otp;
903
904 /* Enable SM_DSP clock and tx 6dB coding. */
905 phy = MII_TG3_AUXCTL_SHDWSEL_AUXCTL |
906 MII_TG3_AUXCTL_ACTL_SMDSP_ENA |
907 MII_TG3_AUXCTL_ACTL_TX_6DB;
908 tg3_writephy(tp, MII_TG3_AUX_CTRL, phy);
909
910 phy = ((otp & TG3_OTP_AGCTGT_MASK) >> TG3_OTP_AGCTGT_SHIFT);
911 phy |= MII_TG3_DSP_TAP1_AGCTGT_DFLT;
912 tg3_phydsp_write(tp, MII_TG3_DSP_TAP1, phy);
913
914 phy = ((otp & TG3_OTP_HPFFLTR_MASK) >> TG3_OTP_HPFFLTR_SHIFT) |
915 ((otp & TG3_OTP_HPFOVER_MASK) >> TG3_OTP_HPFOVER_SHIFT);
916 tg3_phydsp_write(tp, MII_TG3_DSP_AADJ1CH0, phy);
917
918 phy = ((otp & TG3_OTP_LPFDIS_MASK) >> TG3_OTP_LPFDIS_SHIFT);
919 phy |= MII_TG3_DSP_AADJ1CH3_ADCCKADJ;
920 tg3_phydsp_write(tp, MII_TG3_DSP_AADJ1CH3, phy);
921
922 phy = ((otp & TG3_OTP_VDAC_MASK) >> TG3_OTP_VDAC_SHIFT);
923 tg3_phydsp_write(tp, MII_TG3_DSP_EXP75, phy);
924
925 phy = ((otp & TG3_OTP_10BTAMP_MASK) >> TG3_OTP_10BTAMP_SHIFT);
926 tg3_phydsp_write(tp, MII_TG3_DSP_EXP96, phy);
927
928 phy = ((otp & TG3_OTP_ROFF_MASK) >> TG3_OTP_ROFF_SHIFT) |
929 ((otp & TG3_OTP_RCOFF_MASK) >> TG3_OTP_RCOFF_SHIFT);
930 tg3_phydsp_write(tp, MII_TG3_DSP_EXP97, phy);
931
932 /* Turn off SM_DSP clock. */
933 phy = MII_TG3_AUXCTL_SHDWSEL_AUXCTL |
934 MII_TG3_AUXCTL_ACTL_TX_6DB;
935 tg3_writephy(tp, MII_TG3_AUX_CTRL, phy);
936}
937
889static int tg3_wait_macro_done(struct tg3 *tp) 938static int tg3_wait_macro_done(struct tg3 *tp)
890{ 939{
891 int limit = 100; 940 int limit = 100;
@@ -1073,6 +1122,7 @@ static void tg3_link_report(struct tg3 *);
1073 */ 1122 */
1074static int tg3_phy_reset(struct tg3 *tp) 1123static int tg3_phy_reset(struct tg3 *tp)
1075{ 1124{
1125 u32 cpmuctrl;
1076 u32 phy_status; 1126 u32 phy_status;
1077 int err; 1127 int err;
1078 1128
@@ -1102,10 +1152,28 @@ static int tg3_phy_reset(struct tg3 *tp)
1102 goto out; 1152 goto out;
1103 } 1153 }
1104 1154
1155 cpmuctrl = 0;
1156 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 &&
1157 GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5784_AX) {
1158 cpmuctrl = tr32(TG3_CPMU_CTRL);
1159 if (cpmuctrl & CPMU_CTRL_GPHY_10MB_RXONLY)
1160 tw32(TG3_CPMU_CTRL,
1161 cpmuctrl & ~CPMU_CTRL_GPHY_10MB_RXONLY);
1162 }
1163
1105 err = tg3_bmcr_reset(tp); 1164 err = tg3_bmcr_reset(tp);
1106 if (err) 1165 if (err)
1107 return err; 1166 return err;
1108 1167
1168 if (cpmuctrl & CPMU_CTRL_GPHY_10MB_RXONLY) {
1169 u32 phy;
1170
1171 phy = MII_TG3_DSP_EXP8_AEDW | MII_TG3_DSP_EXP8_REJ2MHz;
1172 tg3_phydsp_write(tp, MII_TG3_DSP_EXP8, phy);
1173
1174 tw32(TG3_CPMU_CTRL, cpmuctrl);
1175 }
1176
1109 if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) { 1177 if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) {
1110 u32 val; 1178 u32 val;
1111 1179
@@ -1124,6 +1192,8 @@ static int tg3_phy_reset(struct tg3 *tp)
1124 MII_TG3_MISC_SHDW_APD_WKTM_84MS); 1192 MII_TG3_MISC_SHDW_APD_WKTM_84MS);
1125 } 1193 }
1126 1194
1195 tg3_phy_apply_otp(tp);
1196
1127out: 1197out:
1128 if (tp->tg3_flags2 & TG3_FLG2_PHY_ADC_BUG) { 1198 if (tp->tg3_flags2 & TG3_FLG2_PHY_ADC_BUG) {
1129 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00); 1199 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00);
@@ -9464,7 +9534,8 @@ static int tg3_test_loopback(struct tg3 *tp)
9464 if (err) 9534 if (err)
9465 return TG3_LOOPBACK_FAILED; 9535 return TG3_LOOPBACK_FAILED;
9466 9536
9467 if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) { 9537 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
9538 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761) {
9468 int i; 9539 int i;
9469 u32 status; 9540 u32 status;
9470 9541
@@ -9481,17 +9552,23 @@ static int tg3_test_loopback(struct tg3 *tp)
9481 if (status != CPMU_MUTEX_GNT_DRIVER) 9552 if (status != CPMU_MUTEX_GNT_DRIVER)
9482 return TG3_LOOPBACK_FAILED; 9553 return TG3_LOOPBACK_FAILED;
9483 9554
9484 /* Turn off power management based on link speed. */ 9555 /* Turn off link-based power management. */
9485 cpmuctrl = tr32(TG3_CPMU_CTRL); 9556 cpmuctrl = tr32(TG3_CPMU_CTRL);
9486 tw32(TG3_CPMU_CTRL, 9557 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
9487 cpmuctrl & ~(CPMU_CTRL_LINK_SPEED_MODE | 9558 GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5761_AX)
9488 CPMU_CTRL_LINK_AWARE_MODE)); 9559 tw32(TG3_CPMU_CTRL,
9560 cpmuctrl & ~(CPMU_CTRL_LINK_SPEED_MODE |
9561 CPMU_CTRL_LINK_AWARE_MODE));
9562 else
9563 tw32(TG3_CPMU_CTRL,
9564 cpmuctrl & ~CPMU_CTRL_LINK_AWARE_MODE);
9489 } 9565 }
9490 9566
9491 if (tg3_run_loopback(tp, TG3_MAC_LOOPBACK)) 9567 if (tg3_run_loopback(tp, TG3_MAC_LOOPBACK))
9492 err |= TG3_MAC_LOOPBACK_FAILED; 9568 err |= TG3_MAC_LOOPBACK_FAILED;
9493 9569
9494 if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) { 9570 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
9571 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761) {
9495 tw32(TG3_CPMU_CTRL, cpmuctrl); 9572 tw32(TG3_CPMU_CTRL, cpmuctrl);
9496 9573
9497 /* Release the mutex */ 9574 /* Release the mutex */
@@ -10724,9 +10801,8 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
10724 tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL) 10801 tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL)
10725 tp->led_ctrl = LED_CTRL_MODE_PHY_2; 10802 tp->led_ctrl = LED_CTRL_MODE_PHY_2;
10726 10803
10727 if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 || 10804 if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5784_AX)
10728 tp->pci_chip_rev_id == CHIPREV_ID_5784_A1) 10805 tp->led_ctrl = LED_CTRL_MODE_PHY_1;
10729 tp->led_ctrl = LED_CTRL_MODE_MAC;
10730 10806
10731 if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP) { 10807 if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP) {
10732 tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; 10808 tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT;
@@ -10773,6 +10849,55 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
10773 } 10849 }
10774} 10850}
10775 10851
10852static int __devinit tg3_issue_otp_command(struct tg3 *tp, u32 cmd)
10853{
10854 int i;
10855 u32 val;
10856
10857 tw32(OTP_CTRL, cmd | OTP_CTRL_OTP_CMD_START);
10858 tw32(OTP_CTRL, cmd);
10859
10860 /* Wait for up to 1 ms for command to execute. */
10861 for (i = 0; i < 100; i++) {
10862 val = tr32(OTP_STATUS);
10863 if (val & OTP_STATUS_CMD_DONE)
10864 break;
10865 udelay(10);
10866 }
10867
10868 return (val & OTP_STATUS_CMD_DONE) ? 0 : -EBUSY;
10869}
10870
10871/* Read the gphy configuration from the OTP region of the chip. The gphy
10872 * configuration is a 32-bit value that straddles the alignment boundary.
10873 * We do two 32-bit reads and then shift and merge the results.
10874 */
10875static u32 __devinit tg3_read_otp_phycfg(struct tg3 *tp)
10876{
10877 u32 bhalf_otp, thalf_otp;
10878
10879 tw32(OTP_MODE, OTP_MODE_OTP_THRU_GRC);
10880
10881 if (tg3_issue_otp_command(tp, OTP_CTRL_OTP_CMD_INIT))
10882 return 0;
10883
10884 tw32(OTP_ADDRESS, OTP_ADDRESS_MAGIC1);
10885
10886 if (tg3_issue_otp_command(tp, OTP_CTRL_OTP_CMD_READ))
10887 return 0;
10888
10889 thalf_otp = tr32(OTP_READ_DATA);
10890
10891 tw32(OTP_ADDRESS, OTP_ADDRESS_MAGIC2);
10892
10893 if (tg3_issue_otp_command(tp, OTP_CTRL_OTP_CMD_READ))
10894 return 0;
10895
10896 bhalf_otp = tr32(OTP_READ_DATA);
10897
10898 return ((thalf_otp & 0x0000ffff) << 16) | (bhalf_otp >> 16);
10899}
10900
10776static int __devinit tg3_phy_probe(struct tg3 *tp) 10901static int __devinit tg3_phy_probe(struct tg3 *tp)
10777{ 10902{
10778 u32 hw_phy_id_1, hw_phy_id_2; 10903 u32 hw_phy_id_1, hw_phy_id_2;
@@ -11586,6 +11711,13 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
11586 tp->tg3_flags2 |= TG3_FLG2_PHY_BER_BUG; 11711 tp->tg3_flags2 |= TG3_FLG2_PHY_BER_BUG;
11587 } 11712 }
11588 11713
11714 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 &&
11715 GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5784_AX) {
11716 tp->phy_otp = tg3_read_otp_phycfg(tp);
11717 if (tp->phy_otp == 0)
11718 tp->phy_otp = TG3_OTP_DEFAULT;
11719 }
11720
11589 tp->coalesce_mode = 0; 11721 tp->coalesce_mode = 0;
11590 if (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5700_AX && 11722 if (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5700_AX &&
11591 GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5700_BX) 11723 GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5700_BX)
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 3938eb35ce8c..c1075a73d66c 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -138,6 +138,8 @@
138#define CHIPREV_5704_BX 0x21 138#define CHIPREV_5704_BX 0x21
139#define CHIPREV_5750_AX 0x40 139#define CHIPREV_5750_AX 0x40
140#define CHIPREV_5750_BX 0x41 140#define CHIPREV_5750_BX 0x41
141#define CHIPREV_5784_AX 0x57840
142#define CHIPREV_5761_AX 0x57610
141#define GET_METAL_REV(CHIP_REV_ID) ((CHIP_REV_ID) & 0xff) 143#define GET_METAL_REV(CHIP_REV_ID) ((CHIP_REV_ID) & 0xff)
142#define METAL_REV_A0 0x00 144#define METAL_REV_A0 0x00
143#define METAL_REV_A1 0x01 145#define METAL_REV_A1 0x01
@@ -866,6 +868,7 @@
866#define CPMU_CTRL_LINK_IDLE_MODE 0x00000200 868#define CPMU_CTRL_LINK_IDLE_MODE 0x00000200
867#define CPMU_CTRL_LINK_AWARE_MODE 0x00000400 869#define CPMU_CTRL_LINK_AWARE_MODE 0x00000400
868#define CPMU_CTRL_LINK_SPEED_MODE 0x00004000 870#define CPMU_CTRL_LINK_SPEED_MODE 0x00004000
871#define CPMU_CTRL_GPHY_10MB_RXONLY 0x00010000
869#define TG3_CPMU_LSPD_10MB_CLK 0x00003604 872#define TG3_CPMU_LSPD_10MB_CLK 0x00003604
870#define CPMU_LSPD_10MB_MACCLK_MASK 0x001f0000 873#define CPMU_LSPD_10MB_MACCLK_MASK 0x001f0000
871#define CPMU_LSPD_10MB_MACCLK_6_25 0x00130000 874#define CPMU_LSPD_10MB_MACCLK_6_25 0x00130000
@@ -1559,7 +1562,24 @@
1559/* 0x702c unused */ 1562/* 0x702c unused */
1560 1563
1561#define NVRAM_ADDR_LOCKOUT 0x00007030 1564#define NVRAM_ADDR_LOCKOUT 0x00007030
1562/* 0x7034 --> 0x7c00 unused */ 1565/* 0x7034 --> 0x7500 unused */
1566
1567#define OTP_MODE 0x00007500
1568#define OTP_MODE_OTP_THRU_GRC 0x00000001
1569#define OTP_CTRL 0x00007504
1570#define OTP_CTRL_OTP_PROG_ENABLE 0x00200000
1571#define OTP_CTRL_OTP_CMD_READ 0x00000000
1572#define OTP_CTRL_OTP_CMD_INIT 0x00000008
1573#define OTP_CTRL_OTP_CMD_START 0x00000001
1574#define OTP_STATUS 0x00007508
1575#define OTP_STATUS_CMD_DONE 0x00000001
1576#define OTP_ADDRESS 0x0000750c
1577#define OTP_ADDRESS_MAGIC1 0x000000a0
1578#define OTP_ADDRESS_MAGIC2 0x00000080
1579/* 0x7510 unused */
1580
1581#define OTP_READ_DATA 0x00007514
1582/* 0x7518 --> 0x7c04 unused */
1563 1583
1564#define PCIE_TRANSACTION_CFG 0x00007c04 1584#define PCIE_TRANSACTION_CFG 0x00007c04
1565#define PCIE_TRANS_CFG_1SHOT_MSI 0x20000000 1585#define PCIE_TRANS_CFG_1SHOT_MSI 0x20000000
@@ -1568,6 +1588,28 @@
1568#define PCIE_PWR_MGMT_THRESH 0x00007d28 1588#define PCIE_PWR_MGMT_THRESH 0x00007d28
1569#define PCIE_PWR_MGMT_L1_THRESH_MSK 0x0000ff00 1589#define PCIE_PWR_MGMT_L1_THRESH_MSK 0x0000ff00
1570 1590
1591
1592/* OTP bit definitions */
1593#define TG3_OTP_AGCTGT_MASK 0x000000e0
1594#define TG3_OTP_AGCTGT_SHIFT 1
1595#define TG3_OTP_HPFFLTR_MASK 0x00000300
1596#define TG3_OTP_HPFFLTR_SHIFT 1
1597#define TG3_OTP_HPFOVER_MASK 0x00000400
1598#define TG3_OTP_HPFOVER_SHIFT 1
1599#define TG3_OTP_LPFDIS_MASK 0x00000800
1600#define TG3_OTP_LPFDIS_SHIFT 11
1601#define TG3_OTP_VDAC_MASK 0xff000000
1602#define TG3_OTP_VDAC_SHIFT 24
1603#define TG3_OTP_10BTAMP_MASK 0x0000f000
1604#define TG3_OTP_10BTAMP_SHIFT 8
1605#define TG3_OTP_ROFF_MASK 0x00e00000
1606#define TG3_OTP_ROFF_SHIFT 11
1607#define TG3_OTP_RCOFF_MASK 0x001c0000
1608#define TG3_OTP_RCOFF_SHIFT 16
1609
1610#define TG3_OTP_DEFAULT 0x286c1640
1611
1612
1571#define TG3_EEPROM_MAGIC 0x669955aa 1613#define TG3_EEPROM_MAGIC 0x669955aa
1572#define TG3_EEPROM_MAGIC_FW 0xa5000000 1614#define TG3_EEPROM_MAGIC_FW 0xa5000000
1573#define TG3_EEPROM_MAGIC_FW_MSK 0xff000000 1615#define TG3_EEPROM_MAGIC_FW_MSK 0xff000000
@@ -1705,15 +1747,31 @@
1705 1747
1706#define MII_TG3_DSP_RW_PORT 0x15 /* DSP coefficient read/write port */ 1748#define MII_TG3_DSP_RW_PORT 0x15 /* DSP coefficient read/write port */
1707 1749
1708#define MII_TG3_DSP_ADDRESS 0x17 /* DSP address register */
1709#define MII_TG3_EPHY_PTEST 0x17 /* 5906 PHY register */ 1750#define MII_TG3_EPHY_PTEST 0x17 /* 5906 PHY register */
1751#define MII_TG3_DSP_ADDRESS 0x17 /* DSP address register */
1752
1753#define MII_TG3_DSP_TAP1 0x0001
1754#define MII_TG3_DSP_TAP1_AGCTGT_DFLT 0x0007
1755#define MII_TG3_DSP_AADJ1CH0 0x001f
1756#define MII_TG3_DSP_AADJ1CH3 0x601f
1757#define MII_TG3_DSP_AADJ1CH3_ADCCKADJ 0x0002
1758#define MII_TG3_DSP_EXP8 0x0708
1759#define MII_TG3_DSP_EXP8_REJ2MHz 0x0001
1760#define MII_TG3_DSP_EXP8_AEDW 0x0200
1761#define MII_TG3_DSP_EXP75 0x0f75
1762#define MII_TG3_DSP_EXP96 0x0f96
1763#define MII_TG3_DSP_EXP97 0x0f97
1710 1764
1711#define MII_TG3_AUX_CTRL 0x18 /* auxilliary control register */ 1765#define MII_TG3_AUX_CTRL 0x18 /* auxilliary control register */
1712 1766
1713#define MII_TG3_AUXCTL_MISC_WREN 0x8000 1767#define MII_TG3_AUXCTL_MISC_WREN 0x8000
1714#define MII_TG3_AUXCTL_MISC_FORCE_AMDIX 0x0200 1768#define MII_TG3_AUXCTL_MISC_FORCE_AMDIX 0x0200
1715#define MII_TG3_AUXCTL_MISC_RDSEL_MISC 0x7000 1769#define MII_TG3_AUXCTL_MISC_RDSEL_MISC 0x7000
1716#define MII_TG3_AUXCTL_SHDWSEL_MISC 0x0007 1770#define MII_TG3_AUXCTL_SHDWSEL_MISC 0x0007
1771
1772#define MII_TG3_AUXCTL_ACTL_SMDSP_ENA 0x0800
1773#define MII_TG3_AUXCTL_ACTL_TX_6DB 0x0400
1774#define MII_TG3_AUXCTL_SHDWSEL_AUXCTL 0x0000
1717 1775
1718#define MII_TG3_AUX_STAT 0x19 /* auxilliary status register */ 1776#define MII_TG3_AUX_STAT 0x19 /* auxilliary status register */
1719#define MII_TG3_AUX_STAT_LPASS 0x0004 1777#define MII_TG3_AUX_STAT_LPASS 0x0004
@@ -1743,6 +1801,20 @@
1743#define MII_TG3_INT_DUPLEXCHG 0x0008 1801#define MII_TG3_INT_DUPLEXCHG 0x0008
1744#define MII_TG3_INT_ANEG_PAGE_RX 0x0400 1802#define MII_TG3_INT_ANEG_PAGE_RX 0x0400
1745 1803
1804#define MII_TG3_MISC_SHDW 0x1c
1805#define MII_TG3_MISC_SHDW_WREN 0x8000
1806#define MII_TG3_MISC_SHDW_SCR5_SEL 0x1400
1807#define MII_TG3_MISC_SHDW_APD_SEL 0x2800
1808
1809#define MII_TG3_MISC_SHDW_SCR5_C125OE 0x0001
1810#define MII_TG3_MISC_SHDW_SCR5_DLLAPD 0x0002
1811#define MII_TG3_MISC_SHDW_SCR5_SDTL 0x0004
1812#define MII_TG3_MISC_SHDW_SCR5_DLPTLM 0x0008
1813#define MII_TG3_MISC_SHDW_SCR5_LPED 0x0010
1814
1815#define MII_TG3_MISC_SHDW_APD_WKTM_84MS 0x0001
1816#define MII_TG3_MISC_SHDW_APD_ENABLE 0x0020
1817
1746#define MII_TG3_EPHY_TEST 0x1f /* 5906 PHY register */ 1818#define MII_TG3_EPHY_TEST 0x1f /* 5906 PHY register */
1747#define MII_TG3_EPHY_SHADOW_EN 0x80 1819#define MII_TG3_EPHY_SHADOW_EN 0x80
1748 1820
@@ -2473,6 +2545,7 @@ struct tg3 {
2473#define PHY_REV_BCM5411_X0 0x1 /* Found on Netgear GA302T */ 2545#define PHY_REV_BCM5411_X0 0x1 /* Found on Netgear GA302T */
2474 2546
2475 u32 led_ctrl; 2547 u32 led_ctrl;
2548 u32 phy_otp;
2476 u16 pci_cmd; 2549 u16 pci_cmd;
2477 2550
2478 char board_part_number[24]; 2551 char board_part_number[24];
diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c
index 433c994ea9d8..db4ca4f0b846 100644
--- a/drivers/net/tokenring/olympic.c
+++ b/drivers/net/tokenring/olympic.c
@@ -117,7 +117,7 @@
117 * Official releases will only have an a.b.c version number format. 117 * Official releases will only have an a.b.c version number format.
118 */ 118 */
119 119
120static char version[] __devinitdata = 120static char version[] =
121"Olympic.c v1.0.5 6/04/02 - Peter De Schrijver & Mike Phillips" ; 121"Olympic.c v1.0.5 6/04/02 - Peter De Schrijver & Mike Phillips" ;
122 122
123static char *open_maj_error[] = {"No error", "Lobe Media Test", "Physical Insertion", 123static char *open_maj_error[] = {"No error", "Lobe Media Test", "Physical Insertion",
@@ -290,7 +290,7 @@ op_disable_dev:
290 return i; 290 return i;
291} 291}
292 292
293static int __devinit olympic_init(struct net_device *dev) 293static int olympic_init(struct net_device *dev)
294{ 294{
295 struct olympic_private *olympic_priv; 295 struct olympic_private *olympic_priv;
296 u8 __iomem *olympic_mmio, *init_srb,*adapter_addr; 296 u8 __iomem *olympic_mmio, *init_srb,*adapter_addr;
@@ -434,7 +434,7 @@ static int __devinit olympic_init(struct net_device *dev)
434 434
435} 435}
436 436
437static int __devinit olympic_open(struct net_device *dev) 437static int olympic_open(struct net_device *dev)
438{ 438{
439 struct olympic_private *olympic_priv=netdev_priv(dev); 439 struct olympic_private *olympic_priv=netdev_priv(dev);
440 u8 __iomem *olympic_mmio=olympic_priv->olympic_mmio,*init_srb; 440 u8 __iomem *olympic_mmio=olympic_priv->olympic_mmio,*init_srb;
diff --git a/lib/random32.c b/lib/random32.c
index ec7f81d3fb18..ca87d86992bd 100644
--- a/lib/random32.c
+++ b/lib/random32.c
@@ -97,13 +97,18 @@ EXPORT_SYMBOL(random32);
97 * @seed: seed value 97 * @seed: seed value
98 * 98 *
99 * Add some additional seeding to the random32() pool. 99 * Add some additional seeding to the random32() pool.
100 * Note: this pool is per cpu so it only affects current CPU.
101 */ 100 */
102void srandom32(u32 entropy) 101void srandom32(u32 entropy)
103{ 102{
104 struct rnd_state *state = &get_cpu_var(net_rand_state); 103 int i;
105 __set_random32(state, state->s1 ^ entropy); 104 /*
106 put_cpu_var(state); 105 * No locking on the CPUs, but then somewhat random results are, well,
106 * expected.
107 */
108 for_each_possible_cpu (i) {
109 struct rnd_state *state = &per_cpu(net_rand_state, i);
110 __set_random32(state, state->s1 ^ entropy);
111 }
107} 112}
108EXPORT_SYMBOL(srandom32); 113EXPORT_SYMBOL(srandom32);
109 114
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 480ea90e7dcd..41a76a05e6fd 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -692,6 +692,20 @@ static int vlan_dev_init(struct net_device *dev)
692 return 0; 692 return 0;
693} 693}
694 694
695static void vlan_dev_uninit(struct net_device *dev)
696{
697 struct vlan_priority_tci_mapping *pm;
698 struct vlan_dev_info *vlan = vlan_dev_info(dev);
699 int i;
700
701 for (i = 0; i < ARRAY_SIZE(vlan->egress_priority_map); i++) {
702 while ((pm = vlan->egress_priority_map[i]) != NULL) {
703 vlan->egress_priority_map[i] = pm->next;
704 kfree(pm);
705 }
706 }
707}
708
695void vlan_setup(struct net_device *dev) 709void vlan_setup(struct net_device *dev)
696{ 710{
697 ether_setup(dev); 711 ether_setup(dev);
@@ -701,6 +715,7 @@ void vlan_setup(struct net_device *dev)
701 715
702 dev->change_mtu = vlan_dev_change_mtu; 716 dev->change_mtu = vlan_dev_change_mtu;
703 dev->init = vlan_dev_init; 717 dev->init = vlan_dev_init;
718 dev->uninit = vlan_dev_uninit;
704 dev->open = vlan_dev_open; 719 dev->open = vlan_dev_open;
705 dev->stop = vlan_dev_stop; 720 dev->stop = vlan_dev_stop;
706 dev->set_mac_address = vlan_dev_set_mac_address; 721 dev->set_mac_address = vlan_dev_set_mac_address;
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index a944e8053e28..40508babad8c 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -591,7 +591,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
591 } 591 }
592 592
593 if (xfrm_decode_session_reverse(skb_in, &fl, AF_INET)) 593 if (xfrm_decode_session_reverse(skb_in, &fl, AF_INET))
594 goto ende; 594 goto relookup_failed;
595 595
596 if (inet_addr_type(net, fl.fl4_src) == RTN_LOCAL) 596 if (inet_addr_type(net, fl.fl4_src) == RTN_LOCAL)
597 err = __ip_route_output_key(net, &rt2, &fl); 597 err = __ip_route_output_key(net, &rt2, &fl);
@@ -601,7 +601,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
601 601
602 fl2.fl4_dst = fl.fl4_src; 602 fl2.fl4_dst = fl.fl4_src;
603 if (ip_route_output_key(net, &rt2, &fl2)) 603 if (ip_route_output_key(net, &rt2, &fl2))
604 goto ende; 604 goto relookup_failed;
605 605
606 /* Ugh! */ 606 /* Ugh! */
607 odst = skb_in->dst; 607 odst = skb_in->dst;
@@ -614,21 +614,23 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
614 } 614 }
615 615
616 if (err) 616 if (err)
617 goto ende; 617 goto relookup_failed;
618 618
619 err = xfrm_lookup((struct dst_entry **)&rt2, &fl, NULL, 619 err = xfrm_lookup((struct dst_entry **)&rt2, &fl, NULL,
620 XFRM_LOOKUP_ICMP); 620 XFRM_LOOKUP_ICMP);
621 if (err == -ENOENT) { 621 switch (err) {
622 case 0:
623 dst_release(&rt->u.dst);
624 rt = rt2;
625 break;
626 case -EPERM:
627 goto ende;
628 default:
629relookup_failed:
622 if (!rt) 630 if (!rt)
623 goto out_unlock; 631 goto out_unlock;
624 goto route_done; 632 break;
625 } 633 }
626
627 dst_release(&rt->u.dst);
628 rt = rt2;
629
630 if (err)
631 goto out_unlock;
632 } 634 }
633 635
634route_done: 636route_done:
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index e7a1882db048..a65935a9afd9 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2456,7 +2456,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
2456 2456
2457 ASSERT_RTNL(); 2457 ASSERT_RTNL();
2458 2458
2459 if (dev == init_net.loopback_dev && how == 1) 2459 if ((dev->flags & IFF_LOOPBACK) && how == 1)
2460 how = 0; 2460 how = 0;
2461 2461
2462 rt6_ifdown(dev); 2462 rt6_ifdown(dev);
@@ -2469,7 +2469,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
2469 /* Step 1: remove reference to ipv6 device from parent device. 2469 /* Step 1: remove reference to ipv6 device from parent device.
2470 Do not dev_put! 2470 Do not dev_put!
2471 */ 2471 */
2472 if (how == 1) { 2472 if (how) {
2473 idev->dead = 1; 2473 idev->dead = 1;
2474 2474
2475 /* protected by rtnl_lock */ 2475 /* protected by rtnl_lock */
@@ -2501,12 +2501,12 @@ static int addrconf_ifdown(struct net_device *dev, int how)
2501 write_lock_bh(&idev->lock); 2501 write_lock_bh(&idev->lock);
2502 2502
2503 /* Step 3: clear flags for stateless addrconf */ 2503 /* Step 3: clear flags for stateless addrconf */
2504 if (how != 1) 2504 if (!how)
2505 idev->if_flags &= ~(IF_RS_SENT|IF_RA_RCVD|IF_READY); 2505 idev->if_flags &= ~(IF_RS_SENT|IF_RA_RCVD|IF_READY);
2506 2506
2507 /* Step 4: clear address list */ 2507 /* Step 4: clear address list */
2508#ifdef CONFIG_IPV6_PRIVACY 2508#ifdef CONFIG_IPV6_PRIVACY
2509 if (how == 1 && del_timer(&idev->regen_timer)) 2509 if (how && del_timer(&idev->regen_timer))
2510 in6_dev_put(idev); 2510 in6_dev_put(idev);
2511 2511
2512 /* clear tempaddr list */ 2512 /* clear tempaddr list */
@@ -2543,7 +2543,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
2543 2543
2544 /* Step 5: Discard multicast list */ 2544 /* Step 5: Discard multicast list */
2545 2545
2546 if (how == 1) 2546 if (how)
2547 ipv6_mc_destroy_dev(idev); 2547 ipv6_mc_destroy_dev(idev);
2548 else 2548 else
2549 ipv6_mc_down(idev); 2549 ipv6_mc_down(idev);
@@ -2552,7 +2552,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
2552 2552
2553 /* Shot the device (if unregistered) */ 2553 /* Shot the device (if unregistered) */
2554 2554
2555 if (how == 1) { 2555 if (how) {
2556 addrconf_sysctl_unregister(idev); 2556 addrconf_sysctl_unregister(idev);
2557 neigh_parms_release(&nd_tbl, idev->nd_parms); 2557 neigh_parms_release(&nd_tbl, idev->nd_parms);
2558 neigh_ifdown(&nd_tbl, dev); 2558 neigh_ifdown(&nd_tbl, dev);
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c
index 9c7f83fbc3a1..e5f56c953b58 100644
--- a/net/ipv6/anycast.c
+++ b/net/ipv6/anycast.c
@@ -334,9 +334,7 @@ int ipv6_dev_ac_inc(struct net_device *dev, struct in6_addr *addr)
334 idev->ac_list = aca; 334 idev->ac_list = aca;
335 write_unlock_bh(&idev->lock); 335 write_unlock_bh(&idev->lock);
336 336
337 dst_hold(&rt->u.dst); 337 ip6_ins_rt(rt);
338 if (ip6_ins_rt(rt))
339 dst_release(&rt->u.dst);
340 338
341 addrconf_join_solict(dev, &aca->aca_addr); 339 addrconf_join_solict(dev, &aca->aca_addr);
342 340
@@ -378,10 +376,7 @@ int __ipv6_dev_ac_dec(struct inet6_dev *idev, struct in6_addr *addr)
378 addrconf_leave_solict(idev, &aca->aca_addr); 376 addrconf_leave_solict(idev, &aca->aca_addr);
379 377
380 dst_hold(&aca->aca_rt->u.dst); 378 dst_hold(&aca->aca_rt->u.dst);
381 if (ip6_del_rt(aca->aca_rt)) 379 ip6_del_rt(aca->aca_rt);
382 dst_free(&aca->aca_rt->u.dst);
383 else
384 dst_release(&aca->aca_rt->u.dst);
385 380
386 aca_put(aca); 381 aca_put(aca);
387 return 0; 382 return 0;
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index f204a7275a0d..893287ecc628 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -436,24 +436,26 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
436 } 436 }
437 437
438 if (xfrm_decode_session_reverse(skb, &fl2, AF_INET6)) 438 if (xfrm_decode_session_reverse(skb, &fl2, AF_INET6))
439 goto out_dst_release; 439 goto relookup_failed;
440 440
441 if (ip6_dst_lookup(sk, &dst2, &fl)) 441 if (ip6_dst_lookup(sk, &dst2, &fl))
442 goto out_dst_release; 442 goto relookup_failed;
443 443
444 err = xfrm_lookup(&dst2, &fl, sk, XFRM_LOOKUP_ICMP); 444 err = xfrm_lookup(&dst2, &fl, sk, XFRM_LOOKUP_ICMP);
445 if (err == -ENOENT) { 445 switch (err) {
446 case 0:
447 dst_release(dst);
448 dst = dst2;
449 break;
450 case -EPERM:
451 goto out_dst_release;
452 default:
453relookup_failed:
446 if (!dst) 454 if (!dst)
447 goto out; 455 goto out;
448 goto route_done; 456 break;
449 } 457 }
450 458
451 dst_release(dst);
452 dst = dst2;
453
454 if (err)
455 goto out;
456
457route_done: 459route_done:
458 if (ipv6_addr_is_multicast(&fl.fl6_dst)) 460 if (ipv6_addr_is_multicast(&fl.fl6_dst))
459 hlimit = np->mcast_hops; 461 hlimit = np->mcast_hops;