* [PATCH net 0/2] tg3: 2 bugfixes - TSO data corruption and phy power down @ 2013-05-13 18:03 Nithin Nayak Sujir 2013-05-13 18:03 ` [PATCH net 1/2] tg3: Skip powering down function 0 on certain serdes devices Nithin Nayak Sujir 2013-05-13 18:03 ` [PATCH net 2/2] tg3: Fix data corruption on 5725 with TSO Nithin Nayak Sujir 0 siblings, 2 replies; 5+ messages in thread From: Nithin Nayak Sujir @ 2013-05-13 18:03 UTC (permalink / raw) To: davem; +Cc: netdev, Nithin Nayak Sujir Michael Chan (1): tg3: Fix data corruption on 5725 with TSO Nithin Nayak Sujir (1): tg3: Skip powering down function 0 on certain serdes devices drivers/net/ethernet/broadcom/tg3.c | 41 +++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) -- 1.8.1.4 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net 1/2] tg3: Skip powering down function 0 on certain serdes devices 2013-05-13 18:03 [PATCH net 0/2] tg3: 2 bugfixes - TSO data corruption and phy power down Nithin Nayak Sujir @ 2013-05-13 18:03 ` Nithin Nayak Sujir 2013-05-13 18:21 ` Joe Perches 2013-05-13 18:03 ` [PATCH net 2/2] tg3: Fix data corruption on 5725 with TSO Nithin Nayak Sujir 1 sibling, 1 reply; 5+ messages in thread From: Nithin Nayak Sujir @ 2013-05-13 18:03 UTC (permalink / raw) To: davem; +Cc: netdev, Nithin Nayak Sujir, stable, Michael Chan On the 5718, 5719 and 5720 serdes devices, powering down function 0 results in all the other ports being powered down. Add code to skip function 0 power down. Cc: <stable@vger.kernel.org> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com> --- drivers/net/ethernet/broadcom/tg3.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 728d42a..737f035 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c @@ -2957,6 +2957,23 @@ static int tg3_5700_link_polarity(struct tg3 *tp, u32 speed) return 0; } +static bool tg3_phy_power_bug(struct tg3 *tp) +{ + if (tg3_asic_rev(tp) == ASIC_REV_5700 || + tg3_asic_rev(tp) == ASIC_REV_5704 || + (tg3_asic_rev(tp) == ASIC_REV_5780 && + (tp->phy_flags & TG3_PHYFLG_MII_SERDES)) || + (tg3_asic_rev(tp) == ASIC_REV_5717 && + !tp->pci_fn) || + ((tg3_asic_rev(tp) == ASIC_REV_5719 || + tg3_asic_rev(tp) == ASIC_REV_5720) && + (tp->phy_flags & TG3_PHYFLG_PHY_SERDES) && + !tp->pci_fn)) + return true; + + return false; +} + static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power) { u32 val; @@ -3016,12 +3033,7 @@ static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power) /* The PHY should not be powered down on some chips because * of bugs. */ - if (tg3_asic_rev(tp) == ASIC_REV_5700 || - tg3_asic_rev(tp) == ASIC_REV_5704 || - (tg3_asic_rev(tp) == ASIC_REV_5780 && - (tp->phy_flags & TG3_PHYFLG_MII_SERDES)) || - (tg3_asic_rev(tp) == ASIC_REV_5717 && - !tp->pci_fn)) + if (tg3_phy_power_bug(tp)) return; if (tg3_chip_rev(tp) == CHIPREV_5784_AX || -- 1.8.1.4 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net 1/2] tg3: Skip powering down function 0 on certain serdes devices 2013-05-13 18:03 ` [PATCH net 1/2] tg3: Skip powering down function 0 on certain serdes devices Nithin Nayak Sujir @ 2013-05-13 18:21 ` Joe Perches 2013-05-13 18:31 ` Nithin Nayak Sujir 0 siblings, 1 reply; 5+ messages in thread From: Joe Perches @ 2013-05-13 18:21 UTC (permalink / raw) To: Nithin Nayak Sujir; +Cc: davem, netdev, stable, Michael Chan On Mon, 2013-05-13 at 11:03 -0700, Nithin Nayak Sujir wrote: > On the 5718, 5719 and 5720 serdes devices, powering down function 0 > results in all the other ports being powered down. Add code to skip > function 0 power down. > > Cc: <stable@vger.kernel.org> > Signed-off-by: Michael Chan <mchan@broadcom.com> > Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com> > --- > drivers/net/ethernet/broadcom/tg3.c | 24 ++++++++++++++++++------ > 1 file changed, 18 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c > index 728d42a..737f035 100644 > --- a/drivers/net/ethernet/broadcom/tg3.c > +++ b/drivers/net/ethernet/broadcom/tg3.c > @@ -2957,6 +2957,23 @@ static int tg3_5700_link_polarity(struct tg3 *tp, u32 speed) > return 0; > } > > +static bool tg3_phy_power_bug(struct tg3 *tp) > +{ > + if (tg3_asic_rev(tp) == ASIC_REV_5700 || > + tg3_asic_rev(tp) == ASIC_REV_5704 || > + (tg3_asic_rev(tp) == ASIC_REV_5780 && > + (tp->phy_flags & TG3_PHYFLG_MII_SERDES)) || > + (tg3_asic_rev(tp) == ASIC_REV_5717 && > + !tp->pci_fn) || > + ((tg3_asic_rev(tp) == ASIC_REV_5719 || > + tg3_asic_rev(tp) == ASIC_REV_5720) && > + (tp->phy_flags & TG3_PHYFLG_PHY_SERDES) && > + !tp->pci_fn)) > + return true; I think this would be a lot easier to read and more easily extended using a switch/case like: static bool tg3_phy_power_bug(struct tg3 *tp) { switch (tg3_asic_rev(tp)) { case ASIC_REV_5700: case ASIC_REV_5704: return true; case ASIC_REV_5717: if (!tp_>pci_fn) return true; return false; case ASIC_REV_5719: case ASIC_REV_5720: if ((tp_>phy_flags & TG3_PHYFLG_PHY_SERDES) && !tp->pci_fn) return true; return false; case ASIC_REV_5780: if (tp->phy_flags & TG3_PHYFLG_MII_SERDES) return true; return false; } return false; } ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net 1/2] tg3: Skip powering down function 0 on certain serdes devices 2013-05-13 18:21 ` Joe Perches @ 2013-05-13 18:31 ` Nithin Nayak Sujir 0 siblings, 0 replies; 5+ messages in thread From: Nithin Nayak Sujir @ 2013-05-13 18:31 UTC (permalink / raw) To: Joe Perches; +Cc: davem, netdev, stable, Michael Chan On 05/13/2013 11:21 AM, Joe Perches wrote: > On Mon, 2013-05-13 at 11:03 -0700, Nithin Nayak Sujir wrote: >> On the 5718, 5719 and 5720 serdes devices, powering down function 0 >> results in all the other ports being powered down. Add code to skip >> function 0 power down. >> >> Cc: <stable@vger.kernel.org> >> Signed-off-by: Michael Chan <mchan@broadcom.com> >> Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com> >> --- >> drivers/net/ethernet/broadcom/tg3.c | 24 ++++++++++++++++++------ >> 1 file changed, 18 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c >> index 728d42a..737f035 100644 >> --- a/drivers/net/ethernet/broadcom/tg3.c >> +++ b/drivers/net/ethernet/broadcom/tg3.c >> @@ -2957,6 +2957,23 @@ static int tg3_5700_link_polarity(struct tg3 *tp, u32 speed) >> return 0; >> } >> >> +static bool tg3_phy_power_bug(struct tg3 *tp) >> +{ >> + if (tg3_asic_rev(tp) == ASIC_REV_5700 || >> + tg3_asic_rev(tp) == ASIC_REV_5704 || >> + (tg3_asic_rev(tp) == ASIC_REV_5780 && >> + (tp->phy_flags & TG3_PHYFLG_MII_SERDES)) || >> + (tg3_asic_rev(tp) == ASIC_REV_5717 && >> + !tp->pci_fn) || >> + ((tg3_asic_rev(tp) == ASIC_REV_5719 || >> + tg3_asic_rev(tp) == ASIC_REV_5720) && >> + (tp->phy_flags & TG3_PHYFLG_PHY_SERDES) && >> + !tp->pci_fn)) >> + return true; > > I think this would be a lot easier to read and > more easily extended using a switch/case like: > Will do, I'll resubmit with this change. > static bool tg3_phy_power_bug(struct tg3 *tp) > { > switch (tg3_asic_rev(tp)) { > case ASIC_REV_5700: > case ASIC_REV_5704: > return true; > case ASIC_REV_5717: > if (!tp_>pci_fn) > return true; > return false; > case ASIC_REV_5719: > case ASIC_REV_5720: > if ((tp_>phy_flags & TG3_PHYFLG_PHY_SERDES) && > !tp->pci_fn) > return true; > return false; > case ASIC_REV_5780: > if (tp->phy_flags & TG3_PHYFLG_MII_SERDES) > return true; > return false; > } > > return false; > } > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net 2/2] tg3: Fix data corruption on 5725 with TSO 2013-05-13 18:03 [PATCH net 0/2] tg3: 2 bugfixes - TSO data corruption and phy power down Nithin Nayak Sujir 2013-05-13 18:03 ` [PATCH net 1/2] tg3: Skip powering down function 0 on certain serdes devices Nithin Nayak Sujir @ 2013-05-13 18:03 ` Nithin Nayak Sujir 1 sibling, 0 replies; 5+ messages in thread From: Nithin Nayak Sujir @ 2013-05-13 18:03 UTC (permalink / raw) To: davem; +Cc: netdev, Michael Chan, stable, Nithin Nayak Sujir From: Michael Chan <mchan@broadcom.com> The 5725 family of devices (asic rev 5762), corrupts TSO packets where the buffer is within MSS bytes of a 4G boundary (4G, 8G etc.). Detect this condition and trigger the workaround path. Cc: <stable@vger.kernel.org> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com> --- drivers/net/ethernet/broadcom/tg3.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 737f035..77f1fd3 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c @@ -7440,6 +7440,20 @@ static inline int tg3_4g_overflow_test(dma_addr_t mapping, int len) return (base > 0xffffdcc0) && (base + len + 8 < base); } +/* Test for TSO DMA buffers that cross into regions which are within MSS bytes + * of any 4GB boundaries: 4G, 8G, etc + */ +static inline int tg3_4g_tso_overflow_test(struct tg3 *tp, dma_addr_t mapping, + u32 len, u32 mss) +{ + if (tg3_asic_rev(tp) == ASIC_REV_5762 && mss) { + u32 base = (u32) mapping & 0xffffffff; + + return ((base + len + (mss & 0x3fff)) < base); + } + return 0; +} + /* Test for DMA addresses > 40-bit */ static inline int tg3_40bit_overflow_test(struct tg3 *tp, dma_addr_t mapping, int len) @@ -7476,6 +7490,9 @@ static bool tg3_tx_frag_set(struct tg3_napi *tnapi, u32 *entry, u32 *budget, if (tg3_4g_overflow_test(map, len)) hwbug = true; + if (tg3_4g_tso_overflow_test(tp, map, len, mss)) + hwbug = true; + if (tg3_40bit_overflow_test(tp, map, len)) hwbug = true; -- 1.8.1.4 ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-05-13 18:31 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-05-13 18:03 [PATCH net 0/2] tg3: 2 bugfixes - TSO data corruption and phy power down Nithin Nayak Sujir 2013-05-13 18:03 ` [PATCH net 1/2] tg3: Skip powering down function 0 on certain serdes devices Nithin Nayak Sujir 2013-05-13 18:21 ` Joe Perches 2013-05-13 18:31 ` Nithin Nayak Sujir 2013-05-13 18:03 ` [PATCH net 2/2] tg3: Fix data corruption on 5725 with TSO Nithin Nayak Sujir
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).