summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2016-08-22 16:01:01 +0200
committerDavid S. Miller <davem@davemloft.net>2016-08-22 21:08:08 -0700
commit7b314362a2344feaafbdf6aa8f3d57077728e37a (patch)
tree348a762b9bcfb4bb4adc2d0648dcd44e3d04865c /net
parent1ae292a2457cd692828da2be87cb967260993ad0 (diff)
downloadop-kernel-dev-7b314362a2344feaafbdf6aa8f3d57077728e37a.zip
op-kernel-dev-7b314362a2344feaafbdf6aa8f3d57077728e37a.tar.gz
net: dsa: Allow the DSA driver to indicate the tag protocol
DSA drivers may drive different families of switches which need different tag protocol. Rather than hard code the tag protocol in the driver structure, have a callback for the DSA core to call. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/dsa/dsa.c5
-rw-r--r--net/dsa/dsa2.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 8bda74e..8d3a28d 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -354,7 +354,10 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
* switch.
*/
if (dst->cpu_switch == index) {
- dst->tag_ops = dsa_resolve_tag_protocol(drv->tag_protocol);
+ enum dsa_tag_protocol tag_protocol;
+
+ tag_protocol = drv->get_tag_protocol(ds);
+ dst->tag_ops = dsa_resolve_tag_protocol(tag_protocol);
if (IS_ERR(dst->tag_ops)) {
ret = PTR_ERR(dst->tag_ops);
goto out;
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index f30bad9..2e34322 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -443,6 +443,7 @@ static int dsa_cpu_parse(struct device_node *port, u32 index,
struct dsa_switch_tree *dst,
struct dsa_switch *ds)
{
+ enum dsa_tag_protocol tag_protocol;
struct net_device *ethernet_dev;
struct device_node *ethernet;
@@ -465,7 +466,8 @@ static int dsa_cpu_parse(struct device_node *port, u32 index,
dst->cpu_port = index;
}
- dst->tag_ops = dsa_resolve_tag_protocol(ds->drv->tag_protocol);
+ tag_protocol = ds->drv->get_tag_protocol(ds);
+ dst->tag_ops = dsa_resolve_tag_protocol(tag_protocol);
if (IS_ERR(dst->tag_ops)) {
dev_warn(ds->dev, "No tagger for this switch\n");
return PTR_ERR(dst->tag_ops);
OpenPOWER on IntegriCloud