From: Alex Dubov <oakad@yahoo.com>
To: linux-kernel@vger.kernel.org
Cc: netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
davem@davemloft.net, mlcreech@gmail.com
Subject: [PATCH v2] gianfar: Fall back to software tcp/udp checksum on older controllers
Date: Wed, 16 Mar 2011 20:57:13 -0700 (PDT) [thread overview]
Message-ID: <598461.73809.qm@web37603.mail.mud.yahoo.com> (raw)
As specified by errata eTSEC49 of MPC8548 and errata eTSEC12 of MPC83xx,=0A=
older revisions of gianfar controllers will be unable to calculate a TCP/UD=
P=0Apacket checksum for some alignments of the appropriate FCB. This patch =
checks=0Afor FCB alignment on such controllers and falls back to software c=
hecksumming=0Aif the alignment is known to be bad.=0A=0ASigned-off-by: Alex=
Dubov <oakad@yahoo.com>=0A---=0ACan we, please, proceed with this patch?=
=0AThe issue is badly annoying, breaking quite a few of the MPC8548 chips.=
=0A=0AChanges for v2:=0A - Make indentation slightly more consistent.=0A =
- Replace bizarre switch-based condition with plain boring one.=0A=0A dri=
vers/net/gianfar.c | 16 ++++++++++++++--=0A drivers/net/gianfar.h | 1 =
+=0A 2 files changed, 15 insertions(+), 2 deletions(-)=0A=0Adiff --git a/dr=
ivers/net/gianfar.c b/drivers/net/gianfar.c=0Aindex 5ed8f9f..3da19a5 100644=
=0A--- a/drivers/net/gianfar.c=0A+++ b/drivers/net/gianfar.c=0A@@ -950,6 +9=
50,11 @@ static void gfar_detect_errata(struct gfar_private *priv)=0A =09=
=09=09(pvr =3D=3D 0x80861010 && (mod & 0xfff9) =3D=3D 0x80c0))=0A =09=09pri=
v->errata |=3D GFAR_ERRATA_A002;=0A =0A+=09/* MPC8313 Rev < 2.0, MPC8548 re=
v 2.0 */=0A+=09if ((pvr =3D=3D 0x80850010 && mod =3D=3D 0x80b0 && rev < 0x0=
020) ||=0A+=09=09=09(pvr =3D=3D 0x80210020 && mod =3D=3D 0x8030 && rev =3D=
=3D 0x0020))=0A+=09=09priv->errata |=3D GFAR_ERRATA_12;=0A+=0A =09if (priv-=
>errata)=0A =09=09dev_info(dev, "enabled errata workarounds, flags: 0x%x\n"=
,=0A =09=09=09 priv->errata);=0A@@ -2156,8 +2161,15 @@ static int gfar_star=
t_xmit(struct sk_buff *skb, struct net_device *dev)=0A =09/* Set up checksu=
mming */=0A =09if (CHECKSUM_PARTIAL =3D=3D skb->ip_summed) {=0A =09=09fcb =
=3D gfar_add_fcb(skb);=0A-=09=09lstatus |=3D BD_LFLAG(TXBD_TOE);=0A-=09=09g=
far_tx_checksum(skb, fcb);=0A+=09=09/* as specified by errata */=0A+=09=09i=
f (unlikely(gfar_has_errata(priv, GFAR_ERRATA_12)=0A+=09=09=09 && ((uns=
igned long)fcb % 0x20) > 0x18)) {=0A+=09=09=09__skb_pull(skb, GMAC_FCB_LEN)=
;=0A+=09=09=09skb_checksum_help(skb);=0A+=09=09} else {=0A+=09=09=09lstatus=
|=3D BD_LFLAG(TXBD_TOE);=0A+=09=09=09gfar_tx_checksum(skb, fcb);=0A+=09=09=
}=0A =09}=0A =0A =09if (vlan_tx_tag_present(skb)) {=0Adiff --git a/drivers/=
net/gianfar.h b/drivers/net/gianfar.h=0Aindex 54de413..ec5d595 100644=0A---=
a/drivers/net/gianfar.h=0A+++ b/drivers/net/gianfar.h=0A@@ -1039,6 +1039,7=
@@ enum gfar_errata {=0A =09GFAR_ERRATA_74=09=09=3D 0x01,=0A =09GFAR_ERRAT=
A_76=09=09=3D 0x02,=0A =09GFAR_ERRATA_A002=09=3D 0x04,=0A+=09GFAR_ERRATA_12=
=09=09=3D 0x08, /* a.k.a errata eTSEC49 */=0A };=0A =0A /* Struct stolen al=
most completely (and shamelessly) from the FCC enet source=0A-- =0A1.7.3.2=
=0A=0A=0A=0A=0A
WARNING: multiple messages have this Message-ID (diff)
From: Alex Dubov <oakad@yahoo.com>
To: linux-kernel@vger.kernel.org
Cc: galak@kernel.crashing.org, cbouatmailru@gmail.com,
mlcreech@gmail.com, linuxppc-dev@lists.ozlabs.org,
davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH v2] gianfar: Fall back to software tcp/udp checksum on older controllers
Date: Wed, 16 Mar 2011 20:57:13 -0700 (PDT) [thread overview]
Message-ID: <598461.73809.qm@web37603.mail.mud.yahoo.com> (raw)
As specified by errata eTSEC49 of MPC8548 and errata eTSEC12 of MPC83xx,
older revisions of gianfar controllers will be unable to calculate a TCP/UDP
packet checksum for some alignments of the appropriate FCB. This patch checks
for FCB alignment on such controllers and falls back to software checksumming
if the alignment is known to be bad.
Signed-off-by: Alex Dubov <oakad@yahoo.com>
---
Can we, please, proceed with this patch?
The issue is badly annoying, breaking quite a few of the MPC8548 chips.
Changes for v2:
- Make indentation slightly more consistent.
- Replace bizarre switch-based condition with plain boring one.
drivers/net/gianfar.c | 16 ++++++++++++++--
drivers/net/gianfar.h | 1 +
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 5ed8f9f..3da19a5 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -950,6 +950,11 @@ static void gfar_detect_errata(struct gfar_private *priv)
(pvr == 0x80861010 && (mod & 0xfff9) == 0x80c0))
priv->errata |= GFAR_ERRATA_A002;
+ /* MPC8313 Rev < 2.0, MPC8548 rev 2.0 */
+ if ((pvr == 0x80850010 && mod == 0x80b0 && rev < 0x0020) ||
+ (pvr == 0x80210020 && mod == 0x8030 && rev == 0x0020))
+ priv->errata |= GFAR_ERRATA_12;
+
if (priv->errata)
dev_info(dev, "enabled errata workarounds, flags: 0x%x\n",
priv->errata);
@@ -2156,8 +2161,15 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* Set up checksumming */
if (CHECKSUM_PARTIAL == skb->ip_summed) {
fcb = gfar_add_fcb(skb);
- lstatus |= BD_LFLAG(TXBD_TOE);
- gfar_tx_checksum(skb, fcb);
+ /* as specified by errata */
+ if (unlikely(gfar_has_errata(priv, GFAR_ERRATA_12)
+ && ((unsigned long)fcb % 0x20) > 0x18)) {
+ __skb_pull(skb, GMAC_FCB_LEN);
+ skb_checksum_help(skb);
+ } else {
+ lstatus |= BD_LFLAG(TXBD_TOE);
+ gfar_tx_checksum(skb, fcb);
+ }
}
if (vlan_tx_tag_present(skb)) {
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
index 54de413..ec5d595 100644
--- a/drivers/net/gianfar.h
+++ b/drivers/net/gianfar.h
@@ -1039,6 +1039,7 @@ enum gfar_errata {
GFAR_ERRATA_74 = 0x01,
GFAR_ERRATA_76 = 0x02,
GFAR_ERRATA_A002 = 0x04,
+ GFAR_ERRATA_12 = 0x08, /* a.k.a errata eTSEC49 */
};
/* Struct stolen almost completely (and shamelessly) from the FCC enet source
--
1.7.3.2
WARNING: multiple messages have this Message-ID (diff)
From: Alex Dubov <oakad@yahoo.com>
To: linux-kernel@vger.kernel.org
Cc: netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
davem@davemloft.net, mlcreech@gmail.com
Subject: [PATCH v2] gianfar: Fall back to software tcp/udp checksum on older controllers
Date: Wed, 16 Mar 2011 20:57:13 -0700 (PDT) [thread overview]
Message-ID: <598461.73809.qm@web37603.mail.mud.yahoo.com> (raw)
As specified by errata eTSEC49 of MPC8548 and errata eTSEC12 of MPC83xx,
older revisions of gianfar controllers will be unable to calculate a TCP/UDP
packet checksum for some alignments of the appropriate FCB. This patch checks
for FCB alignment on such controllers and falls back to software checksumming
if the alignment is known to be bad.
Signed-off-by: Alex Dubov <oakad@yahoo.com>
---
Can we, please, proceed with this patch?
The issue is badly annoying, breaking quite a few of the MPC8548 chips.
Changes for v2:
- Make indentation slightly more consistent.
- Replace bizarre switch-based condition with plain boring one.
drivers/net/gianfar.c | 16 ++++++++++++++--
drivers/net/gianfar.h | 1 +
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 5ed8f9f..3da19a5 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -950,6 +950,11 @@ static void gfar_detect_errata(struct gfar_private *priv)
(pvr == 0x80861010 && (mod & 0xfff9) == 0x80c0))
priv->errata |= GFAR_ERRATA_A002;
+ /* MPC8313 Rev < 2.0, MPC8548 rev 2.0 */
+ if ((pvr == 0x80850010 && mod == 0x80b0 && rev < 0x0020) ||
+ (pvr == 0x80210020 && mod == 0x8030 && rev == 0x0020))
+ priv->errata |= GFAR_ERRATA_12;
+
if (priv->errata)
dev_info(dev, "enabled errata workarounds, flags: 0x%x\n",
priv->errata);
@@ -2156,8 +2161,15 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* Set up checksumming */
if (CHECKSUM_PARTIAL == skb->ip_summed) {
fcb = gfar_add_fcb(skb);
- lstatus |= BD_LFLAG(TXBD_TOE);
- gfar_tx_checksum(skb, fcb);
+ /* as specified by errata */
+ if (unlikely(gfar_has_errata(priv, GFAR_ERRATA_12)
+ && ((unsigned long)fcb % 0x20) > 0x18)) {
+ __skb_pull(skb, GMAC_FCB_LEN);
+ skb_checksum_help(skb);
+ } else {
+ lstatus |= BD_LFLAG(TXBD_TOE);
+ gfar_tx_checksum(skb, fcb);
+ }
}
if (vlan_tx_tag_present(skb)) {
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
index 54de413..ec5d595 100644
--- a/drivers/net/gianfar.h
+++ b/drivers/net/gianfar.h
@@ -1039,6 +1039,7 @@ enum gfar_errata {
GFAR_ERRATA_74 = 0x01,
GFAR_ERRATA_76 = 0x02,
GFAR_ERRATA_A002 = 0x04,
+ GFAR_ERRATA_12 = 0x08, /* a.k.a errata eTSEC49 */
};
/* Struct stolen almost completely (and shamelessly) from the FCC enet source
--
1.7.3.2
next reply other threads:[~2011-03-17 3:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-17 3:57 Alex Dubov [this message]
2011-03-17 3:57 ` [PATCH v2] gianfar: Fall back to software tcp/udp checksum on older controllers Alex Dubov
2011-03-17 3:57 ` Alex Dubov
2011-03-18 22:15 ` David Miller
2011-03-18 22:15 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2011-01-27 9:51 [PATCH] " Anton Vorontsov
2011-01-28 4:37 ` [PATCH v2] " Alex Dubov
2011-01-28 4:37 ` Alex Dubov
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=598461.73809.qm@web37603.mail.mud.yahoo.com \
--to=oakad@yahoo.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mlcreech@gmail.com \
--cc=netdev@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.