netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] DSA tagging mismatches
@ 2014-10-22 23:35 Andrew Lunn
  2014-10-22 23:35 ` [PATCH 1/2] net: dsa: Error out on tagging protocol mismatches Andrew Lunn
  2014-10-22 23:35 ` [PATCH 2/2] dsa: mv88e6171: Fix tagging protocol/Kconfig Andrew Lunn
  0 siblings, 2 replies; 5+ messages in thread
From: Andrew Lunn @ 2014-10-22 23:35 UTC (permalink / raw)
  To: davem; +Cc: netdev, Andrew Lunn

The second patch is a fix, which should be applied to -rc. It is
possible to get a DSA configuration which does not work. The patch
stops this happening.

The first patch detects this situation, and errors out the probe of
DSA, making it more obvious something is wrong. It is not required to
apply it -rc.

Andrew Lunn (2):
  net: dsa: Error out on tagging protocol mismatches
  dsa: mv88e6171: Fix tagging protocol/Kconfig

 drivers/net/dsa/mv88e6171.c | 2 +-
 net/dsa/dsa.c               | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

-- 
2.1.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] net: dsa: Error out on tagging protocol mismatches
  2014-10-22 23:35 [PATCH 0/2] DSA tagging mismatches Andrew Lunn
@ 2014-10-22 23:35 ` Andrew Lunn
  2014-10-22 23:46   ` Florian Fainelli
  2014-10-22 23:35 ` [PATCH 2/2] dsa: mv88e6171: Fix tagging protocol/Kconfig Andrew Lunn
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2014-10-22 23:35 UTC (permalink / raw)
  To: davem; +Cc: netdev, Andrew Lunn, alexander.h.duyck

If there is a mismatch between enabled tagging protocols and the
protocol the switch supports, error out, rather than continue with a
situation which is unlikely to work.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
cc: alexander.h.duyck@intel.com
---
 net/dsa/dsa.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 22f34cf4cb27..8a31bd81a315 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -175,7 +175,8 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index,
 			break;
 #endif
 		default:
-			break;
+			ret = -ENOPROTOOPT;
+			goto out;
 		}
 
 		dst->tag_protocol = drv->tag_protocol;
-- 
2.1.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] dsa: mv88e6171: Fix tagging protocol/Kconfig
  2014-10-22 23:35 [PATCH 0/2] DSA tagging mismatches Andrew Lunn
  2014-10-22 23:35 ` [PATCH 1/2] net: dsa: Error out on tagging protocol mismatches Andrew Lunn
@ 2014-10-22 23:35 ` Andrew Lunn
  1 sibling, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2014-10-22 23:35 UTC (permalink / raw)
  To: davem; +Cc: netdev, Andrew Lunn

The mv88e6171 can support two different tagging protocols, DSA and
EDSA. The switch driver structure only allows one protocol to be
enumerated, and DSA was chosen. However the Kconfig entry ensures the
EDSA tagging code is built. With a minimal configuration, we then end
up with a mismatch. The probe is successful, EDSA tagging is used, but
the switch is configured for DSA, resulting in mangled packets.

Change the switch driver structure to enumerate EDSA, fixing the
mismatch.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Fixes: 42f272539487 ("net: DSA: Marvell mv88e6171 switch driver")
---
 drivers/net/dsa/mv88e6171.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/mv88e6171.c b/drivers/net/dsa/mv88e6171.c
index 1020a7af67cf..78d8e876f3aa 100644
--- a/drivers/net/dsa/mv88e6171.c
+++ b/drivers/net/dsa/mv88e6171.c
@@ -395,7 +395,7 @@ static int mv88e6171_get_sset_count(struct dsa_switch *ds)
 }
 
 struct dsa_switch_driver mv88e6171_switch_driver = {
-	.tag_protocol		= DSA_TAG_PROTO_DSA,
+	.tag_protocol		= DSA_TAG_PROTO_EDSA,
 	.priv_size		= sizeof(struct mv88e6xxx_priv_state),
 	.probe			= mv88e6171_probe,
 	.setup			= mv88e6171_setup,
-- 
2.1.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] net: dsa: Error out on tagging protocol mismatches
  2014-10-22 23:35 ` [PATCH 1/2] net: dsa: Error out on tagging protocol mismatches Andrew Lunn
@ 2014-10-22 23:46   ` Florian Fainelli
  2014-10-23 13:32     ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: Florian Fainelli @ 2014-10-22 23:46 UTC (permalink / raw)
  To: Andrew Lunn, davem; +Cc: netdev, alexander.h.duyck

On 10/22/2014 04:35 PM, Andrew Lunn wrote:
> If there is a mismatch between enabled tagging protocols and the
> protocol the switch supports, error out, rather than continue with a
> situation which is unlikely to work.
> 
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> cc: alexander.h.duyck@intel.com
> ---
>  net/dsa/dsa.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
> index 22f34cf4cb27..8a31bd81a315 100644
> --- a/net/dsa/dsa.c
> +++ b/net/dsa/dsa.c
> @@ -175,7 +175,8 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index,
>  			break;
>  #endif
>  		default:
> -			break;
> +			ret = -ENOPROTOOPT;
> +			goto out;
>  		}

This prevents using a switch driver without tagging, which is something
that you might want to do (link setup, ethtool stats, EEE etc...).
--
Florian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] net: dsa: Error out on tagging protocol mismatches
  2014-10-22 23:46   ` Florian Fainelli
@ 2014-10-23 13:32     ` Andrew Lunn
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2014-10-23 13:32 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: Andrew Lunn, davem, netdev, alexander.h.duyck

On Wed, Oct 22, 2014 at 04:46:52PM -0700, Florian Fainelli wrote:
> On 10/22/2014 04:35 PM, Andrew Lunn wrote:
> > If there is a mismatch between enabled tagging protocols and the
> > protocol the switch supports, error out, rather than continue with a
> > situation which is unlikely to work.
> > 
> > Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> > cc: alexander.h.duyck@intel.com
> > ---
> >  net/dsa/dsa.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
> > index 22f34cf4cb27..8a31bd81a315 100644
> > --- a/net/dsa/dsa.c
> > +++ b/net/dsa/dsa.c
> > @@ -175,7 +175,8 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index,
> >  			break;
> >  #endif
> >  		default:
> > -			break;
> > +			ret = -ENOPROTOOPT;
> > +			goto out;
> >  		}
> 
> This prevents using a switch driver without tagging, which is something
> that you might want to do (link setup, ethtool stats, EEE etc...).

Hi Florian

I didn't know that was a use case.

So i assume such a driver would use DSA_TAG_PROTO_NONE? So all i need
to do is add that as a case value to the switch statement, and we
should cover that use case, and still be able to detect a mismatch.

v2 patch soon.

   Andrew

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-10-23 13:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-22 23:35 [PATCH 0/2] DSA tagging mismatches Andrew Lunn
2014-10-22 23:35 ` [PATCH 1/2] net: dsa: Error out on tagging protocol mismatches Andrew Lunn
2014-10-22 23:46   ` Florian Fainelli
2014-10-23 13:32     ` Andrew Lunn
2014-10-22 23:35 ` [PATCH 2/2] dsa: mv88e6171: Fix tagging protocol/Kconfig Andrew Lunn

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).