From: Ben Hutchings <ben@decadent.org.uk>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: akpm@linux-foundation.org,
Nithin Nayak Sujir <nsujir@broadcom.com>,
Michael Chan <mchan@broadcom.com>,
"David S. Miller" <davem@davemloft.net>
Subject: [ 65/66] tg3: Fix crc errors on jumbo frame receive
Date: Sun, 17 Feb 2013 22:51:06 +0000 [thread overview]
Message-ID: <20130217225009.179334490@decadent.org.uk> (raw)
In-Reply-To: <20130217225001.621306883@decadent.org.uk>
3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nithin Nayak Sujir <nsujir@broadcom.com>
[ Upstream commit daf3ec688e057f6060fb9bb0819feac7a8bbf45c ]
TG3_PHY_AUXCTL_SMDSP_ENABLE/DISABLE macros do a blind write to the phy
auxiliary control register and overwrite the EXT_PKT_LEN (bit 14) resulting
in intermittent crc errors on jumbo frames with some link partners. Change
the code to do a read/modify/write.
Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
drivers/net/ethernet/broadcom/tg3.c | 58 ++++++++++++++++++++++---------------
1 file changed, 35 insertions(+), 23 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index c3197d9..c86fa50 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -1135,14 +1135,26 @@ static int tg3_phy_auxctl_write(struct tg3 *tp, int reg, u32 set)
return tg3_writephy(tp, MII_TG3_AUX_CTRL, set | reg);
}
-#define TG3_PHY_AUXCTL_SMDSP_ENABLE(tp) \
- tg3_phy_auxctl_write((tp), MII_TG3_AUXCTL_SHDWSEL_AUXCTL, \
- MII_TG3_AUXCTL_ACTL_SMDSP_ENA | \
- MII_TG3_AUXCTL_ACTL_TX_6DB)
+static int tg3_phy_toggle_auxctl_smdsp(struct tg3 *tp, bool enable)
+{
+ u32 val;
+ int err;
+
+ err = tg3_phy_auxctl_read(tp, MII_TG3_AUXCTL_SHDWSEL_AUXCTL, &val);
-#define TG3_PHY_AUXCTL_SMDSP_DISABLE(tp) \
- tg3_phy_auxctl_write((tp), MII_TG3_AUXCTL_SHDWSEL_AUXCTL, \
- MII_TG3_AUXCTL_ACTL_TX_6DB);
+ if (err)
+ return err;
+ if (enable)
+
+ val |= MII_TG3_AUXCTL_ACTL_SMDSP_ENA;
+ else
+ val &= ~MII_TG3_AUXCTL_ACTL_SMDSP_ENA;
+
+ err = tg3_phy_auxctl_write((tp), MII_TG3_AUXCTL_SHDWSEL_AUXCTL,
+ val | MII_TG3_AUXCTL_ACTL_TX_6DB);
+
+ return err;
+}
static int tg3_bmcr_reset(struct tg3 *tp)
{
@@ -2087,7 +2099,7 @@ static void tg3_phy_apply_otp(struct tg3 *tp)
otp = tp->phy_otp;
- if (TG3_PHY_AUXCTL_SMDSP_ENABLE(tp))
+ if (tg3_phy_toggle_auxctl_smdsp(tp, true))
return;
phy = ((otp & TG3_OTP_AGCTGT_MASK) >> TG3_OTP_AGCTGT_SHIFT);
@@ -2112,7 +2124,7 @@ static void tg3_phy_apply_otp(struct tg3 *tp)
((otp & TG3_OTP_RCOFF_MASK) >> TG3_OTP_RCOFF_SHIFT);
tg3_phydsp_write(tp, MII_TG3_DSP_EXP97, phy);
- TG3_PHY_AUXCTL_SMDSP_DISABLE(tp);
+ tg3_phy_toggle_auxctl_smdsp(tp, false);
}
static void tg3_phy_eee_adjust(struct tg3 *tp, u32 current_link_up)
@@ -2148,9 +2160,9 @@ static void tg3_phy_eee_adjust(struct tg3 *tp, u32 current_link_up)
if (!tp->setlpicnt) {
if (current_link_up == 1 &&
- !TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) {
+ !tg3_phy_toggle_auxctl_smdsp(tp, true)) {
tg3_phydsp_write(tp, MII_TG3_DSP_TAP26, 0x0000);
- TG3_PHY_AUXCTL_SMDSP_DISABLE(tp);
+ tg3_phy_toggle_auxctl_smdsp(tp, false);
}
val = tr32(TG3_CPMU_EEE_MODE);
@@ -2166,11 +2178,11 @@ static void tg3_phy_eee_enable(struct tg3 *tp)
(GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765) &&
- !TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) {
+ !tg3_phy_toggle_auxctl_smdsp(tp, true)) {
val = MII_TG3_DSP_TAP26_ALNOKO |
MII_TG3_DSP_TAP26_RMRXSTO;
tg3_phydsp_write(tp, MII_TG3_DSP_TAP26, val);
- TG3_PHY_AUXCTL_SMDSP_DISABLE(tp);
+ tg3_phy_toggle_auxctl_smdsp(tp, false);
}
val = tr32(TG3_CPMU_EEE_MODE);
@@ -2314,7 +2326,7 @@ static int tg3_phy_reset_5703_4_5(struct tg3 *tp)
tg3_writephy(tp, MII_CTRL1000,
CTL1000_AS_MASTER | CTL1000_ENABLE_MASTER);
- err = TG3_PHY_AUXCTL_SMDSP_ENABLE(tp);
+ err = tg3_phy_toggle_auxctl_smdsp(tp, true);
if (err)
return err;
@@ -2335,7 +2347,7 @@ static int tg3_phy_reset_5703_4_5(struct tg3 *tp)
tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8200);
tg3_writephy(tp, MII_TG3_DSP_CONTROL, 0x0000);
- TG3_PHY_AUXCTL_SMDSP_DISABLE(tp);
+ tg3_phy_toggle_auxctl_smdsp(tp, false);
tg3_writephy(tp, MII_CTRL1000, phy9_orig);
@@ -2424,10 +2436,10 @@ static int tg3_phy_reset(struct tg3 *tp)
out:
if ((tp->phy_flags & TG3_PHYFLG_ADC_BUG) &&
- !TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) {
+ !tg3_phy_toggle_auxctl_smdsp(tp, true)) {
tg3_phydsp_write(tp, 0x201f, 0x2aaa);
tg3_phydsp_write(tp, 0x000a, 0x0323);
- TG3_PHY_AUXCTL_SMDSP_DISABLE(tp);
+ tg3_phy_toggle_auxctl_smdsp(tp, false);
}
if (tp->phy_flags & TG3_PHYFLG_5704_A0_BUG) {
@@ -2436,14 +2448,14 @@ out:
}
if (tp->phy_flags & TG3_PHYFLG_BER_BUG) {
- if (!TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) {
+ if (!tg3_phy_toggle_auxctl_smdsp(tp, true)) {
tg3_phydsp_write(tp, 0x000a, 0x310b);
tg3_phydsp_write(tp, 0x201f, 0x9506);
tg3_phydsp_write(tp, 0x401f, 0x14e2);
- TG3_PHY_AUXCTL_SMDSP_DISABLE(tp);
+ tg3_phy_toggle_auxctl_smdsp(tp, false);
}
} else if (tp->phy_flags & TG3_PHYFLG_JITTER_BUG) {
- if (!TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) {
+ if (!tg3_phy_toggle_auxctl_smdsp(tp, true)) {
tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x000a);
if (tp->phy_flags & TG3_PHYFLG_ADJUST_TRIM) {
tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x110b);
@@ -2452,7 +2464,7 @@ out:
} else
tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x010b);
- TG3_PHY_AUXCTL_SMDSP_DISABLE(tp);
+ tg3_phy_toggle_auxctl_smdsp(tp, false);
}
}
@@ -3639,7 +3651,7 @@ static int tg3_phy_autoneg_cfg(struct tg3 *tp, u32 advertise, u32 flowctrl)
tw32(TG3_CPMU_EEE_MODE,
tr32(TG3_CPMU_EEE_MODE) & ~TG3_CPMU_EEEMD_LPI_ENABLE);
- err = TG3_PHY_AUXCTL_SMDSP_ENABLE(tp);
+ err = tg3_phy_toggle_auxctl_smdsp(tp, true);
if (!err) {
u32 err2;
@@ -3671,7 +3683,7 @@ static int tg3_phy_autoneg_cfg(struct tg3 *tp, u32 advertise, u32 flowctrl)
MII_TG3_DSP_CH34TP2_HIBW01);
}
- err2 = TG3_PHY_AUXCTL_SMDSP_DISABLE(tp);
+ err2 = tg3_phy_toggle_auxctl_smdsp(tp, false);
if (!err)
err = err2;
}
next prev parent reply other threads:[~2013-02-17 22:51 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-17 22:50 [ 00/66] 3.2.39-stable review Ben Hutchings
2013-02-17 22:50 ` [ 01/66] drm/i915: Fix misplaced intel_mark_page_flip_active() Ben Hutchings
2013-02-17 22:50 ` [ 02/66] xhci: Fix isoc TD encoding Ben Hutchings
2013-02-17 22:50 ` [ 03/66] xhci: Fix TD size for isochronous URBs Ben Hutchings
2013-02-17 22:50 ` [ 04/66] USB: XHCI: fix memory leak of URB-private data Ben Hutchings
2013-02-17 22:50 ` [ 05/66] usb: Prevent dead ports when xhci is not enabled Ben Hutchings
2013-02-17 22:50 ` [ 06/66] sched/rt: Use root_domain of rt_rq not current processor Ben Hutchings
2013-02-17 22:50 ` [ 07/66] rtlwifi: Fix the usage of the wrong variable in usb.c Ben Hutchings
2013-02-17 22:50 ` [ 08/66] drm/radeon: add quirk for RV100 board Ben Hutchings
2013-02-17 22:50 ` [ 09/66] USB: qcserial: add Telit Gobi QDL device Ben Hutchings
2013-02-17 22:50 ` [ 10/66] USB: option: add support for Telit LE920 Ben Hutchings
2013-02-17 22:50 ` [ 11/66] mwifiex: fix incomplete scan in case of IE parsing error Ben Hutchings
2013-02-17 22:50 ` [ 12/66] USB: EHCI: fix bug in scheduling periodic split transfers Ben Hutchings
2013-02-17 22:50 ` [ 13/66] x86-64: Replace left over sti/cli in ia32 audit exit code Ben Hutchings
2013-02-17 22:50 ` [ 14/66] Bluetooth: Fix handling of unexpected SMP PDUs Ben Hutchings
2013-02-17 22:50 ` [ 15/66] drm/radeon: Calling object_unrefer() when creating fb failure Ben Hutchings
2013-02-17 22:50 ` [ 16/66] drm/radeon: prevent crash in the ring space allocation Ben Hutchings
2013-02-17 22:50 ` [ 17/66] can: c_can: Set reserved bit in IFx_MASK2 to 1 on write Ben Hutchings
2013-02-17 22:50 ` [ 18/66] USB: ftdi_sio: add PID/VID entries for ELV WS 300 PC II Ben Hutchings
2013-02-17 22:50 ` [ 19/66] USB: option: add Changhong CH690 Ben Hutchings
2013-02-17 22:50 ` [ 20/66] USB: ftdi_sio: add Zolix FTDI PID Ben Hutchings
2013-02-17 22:50 ` [ 21/66] USB: storage: Define a new macro for USB storage match rules Ben Hutchings
2013-02-17 22:50 ` [ 22/66] USB: storage: optimize to match the Huawei USB storage devices and support new switch command Ben Hutchings
2013-02-17 22:50 ` [ 23/66] nilfs2: fix fix very long mount time issue Ben Hutchings
2013-02-17 22:50 ` [ 24/66] drivers/rtc/rtc-isl1208.c: call rtc_update_irq() from the alarm irq handler Ben Hutchings
2013-02-17 22:50 ` [ 25/66] drivers/rtc/rtc-pl031.c: fix the missing operation on enable Ben Hutchings
2013-02-17 22:50 ` [ 26/66] virtio_console: Dont access uninitialized data Ben Hutchings
2013-02-17 22:50 ` [ 27/66] wireless: rt2x00: rt{2500,73}usb.c put back duplicate id Ben Hutchings
2013-02-17 22:50 ` [ 28/66] Wireless: rt2x00: Add device id for Sweex LW323 to rt2800usb.c Ben Hutchings
2013-02-17 22:50 ` [ 29/66] rt2800usb: Add support for 2001:3c1e (D-Link DWA-125 rev B1) USB Wi-Fi adapter Ben Hutchings
2013-02-17 22:50 ` [ 30/66] [media] gspca_kinect: add Kinect for Windows USB id Ben Hutchings
2013-02-17 22:50 ` [ 31/66] ahci: support the STA2X11 I/O Hub Ben Hutchings
2013-02-17 22:50 ` [ 32/66] [libata] ahci: Add support for Enmotus Bobcat device Ben Hutchings
2013-02-17 22:50 ` [ 33/66] ptrace/x86: Introduce set_task_blockstep() helper Ben Hutchings
2013-02-17 22:50 ` [ 34/66] ptrace/x86: Partly fix set_task_blockstep()->update_debugctlmsr() logic Ben Hutchings
2013-02-17 22:50 ` [ 35/66] ptrace: introduce signal_wake_up_state() and ptrace_signal_wake_up() Ben Hutchings
2013-02-17 22:50 ` [ 36/66] ptrace: ensure arch_ptrace/ptrace_request can never race with SIGKILL Ben Hutchings
2013-02-17 22:50 ` [ 37/66] wake_up_process() should be never used to wakeup a TASK_STOPPED/TRACED task Ben Hutchings
2013-02-17 22:50 ` [ 38/66] Bluetooth: Fix sending HCI commands after reset Ben Hutchings
2013-02-17 22:50 ` [ 39/66] HID: usbhid: quirk for Formosa IR receiver Ben Hutchings
2013-02-17 22:50 ` [ 40/66] kernel/resource.c: fix stack overflow in __reserve_region_with_split() Ben Hutchings
2013-02-17 22:50 ` [ 41/66] net: prevent setting ttl=0 via IP_TTL Ben Hutchings
2013-02-17 22:50 ` [ 42/66] ipv6: fix the noflags test in addrconf_get_prefix_route Ben Hutchings
2013-02-17 22:50 ` [ 43/66] MAINTAINERS: Stephen Hemminger email change Ben Hutchings
2013-02-17 22:50 ` [ 44/66] ipv6: fix header length calculation in ip6_append_data() Ben Hutchings
2013-02-17 22:50 ` [ 45/66] isdn/gigaset: fix zero size border case in debug dump Ben Hutchings
2013-02-17 22:50 ` [ 46/66] netxen: fix off by one bug in netxen_release_tx_buffer() Ben Hutchings
2013-02-17 22:50 ` [ 47/66] r8169: remove the obsolete and incorrect AMD workaround Ben Hutchings
2013-02-17 22:50 ` [ 48/66] net: loopback: fix a dst refcounting issue Ben Hutchings
2013-02-17 22:50 ` [ 49/66] pktgen: correctly handle failures when adding a device Ben Hutchings
2013-02-17 22:50 ` [ 50/66] ipv6: do not create neighbor entries for local delivery Ben Hutchings
2013-02-17 22:50 ` [ 51/66] packet: fix leakage of tx_ring memory Ben Hutchings
2013-02-17 22:50 ` [ 52/66] atm/iphase: rename fregt_t -> ffreg_t Ben Hutchings
2013-02-17 22:50 ` [ 53/66] sctp: refactor sctp_outq_teardown to insure proper re-initalization Ben Hutchings
2013-02-17 22:50 ` [ 54/66] net: sctp: sctp_setsockopt_auth_key: use kzfree instead of kfree Ben Hutchings
2013-02-17 22:50 ` [ 55/66] net: sctp: sctp_endpoint_free: zero out secret key data Ben Hutchings
2013-02-17 22:50 ` [ 56/66] xen/netback: shutdown the ring if it contains garbage Ben Hutchings
2013-02-17 22:50 ` [ 57/66] xen/netback: dont leak pages on failure in xen_netbk_tx_check_gop Ben Hutchings
2013-02-17 22:50 ` [ 58/66] xen/netback: free already allocated memory on failure in xen_netbk_get_requests Ben Hutchings
2013-02-17 22:51 ` [ 59/66] netback: correct netbk_tx_err to handle wrap around Ben Hutchings
2013-02-17 22:51 ` [ 60/66] tcp: frto should not set snd_cwnd to 0 Ben Hutchings
2013-02-17 22:51 ` [ 61/66] tcp: fix for zero packets_in_flight was too broad Ben Hutchings
2013-02-17 22:51 ` [ 62/66] tcp: fix MSG_SENDPAGE_NOTLAST logic Ben Hutchings
2013-02-17 22:51 ` [ 63/66] bridge: Pull ip header into skb->data before looking into ip header Ben Hutchings
2013-02-17 22:51 ` [ 64/66] tg3: Avoid null pointer dereference in tg3_interrupt in netconsole mode Ben Hutchings
2013-02-17 22:51 ` Ben Hutchings [this message]
2013-02-17 22:51 ` [ 66/66] x86/xen: dont assume %ds is usable in xen_iret for 32-bit PVOPS Ben Hutchings
2013-02-18 0:02 ` [ 00/66] 3.2.39-stable review Ben Hutchings
2013-02-19 22:25 ` Satoru Takeuchi
2013-02-20 2:59 ` Ben Hutchings
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130217225009.179334490@decadent.org.uk \
--to=ben@decadent.org.uk \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mchan@broadcom.com \
--cc=nsujir@broadcom.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).