Message ID | 1414020918-20903-2-git-send-email-andrew@lunn.ch |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
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 -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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 -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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;
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(-)