aboutsummaryrefslogtreecommitdiffstats
path: root/net/dsa
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2016-08-22 10:01:01 -0400
committerDavid S. Miller <davem@davemloft.net>2016-08-23 00:08:08 -0400
commit7b314362a2344feaafbdf6aa8f3d57077728e37a (patch)
tree348a762b9bcfb4bb4adc2d0648dcd44e3d04865c /net/dsa
parent1ae292a2457cd692828da2be87cb967260993ad0 (diff)
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/dsa')
-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 8bda74e595a5..8d3a28d4e99d 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)
354 * switch. 354 * switch.
355 */ 355 */
356 if (dst->cpu_switch == index) { 356 if (dst->cpu_switch == index) {
357 dst->tag_ops = dsa_resolve_tag_protocol(drv->tag_protocol); 357 enum dsa_tag_protocol tag_protocol;
358
359 tag_protocol = drv->get_tag_protocol(ds);
360 dst->tag_ops = dsa_resolve_tag_protocol(tag_protocol);
358 if (IS_ERR(dst->tag_ops)) { 361 if (IS_ERR(dst->tag_ops)) {
359 ret = PTR_ERR(dst->tag_ops); 362 ret = PTR_ERR(dst->tag_ops);
360 goto out; 363 goto out;
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index f30bad9678f0..2e343221464c 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,
443 struct dsa_switch_tree *dst, 443 struct dsa_switch_tree *dst,
444 struct dsa_switch *ds) 444 struct dsa_switch *ds)
445{ 445{
446 enum dsa_tag_protocol tag_protocol;
446 struct net_device *ethernet_dev; 447 struct net_device *ethernet_dev;
447 struct device_node *ethernet; 448 struct device_node *ethernet;
448 449
@@ -465,7 +466,8 @@ static int dsa_cpu_parse(struct device_node *port, u32 index,
465 dst->cpu_port = index; 466 dst->cpu_port = index;
466 } 467 }
467 468
468 dst->tag_ops = dsa_resolve_tag_protocol(ds->drv->tag_protocol); 469 tag_protocol = ds->drv->get_tag_protocol(ds);
470 dst->tag_ops = dsa_resolve_tag_protocol(tag_protocol);
469 if (IS_ERR(dst->tag_ops)) { 471 if (IS_ERR(dst->tag_ops)) {
470 dev_warn(ds->dev, "No tagger for this switch\n"); 472 dev_warn(ds->dev, "No tagger for this switch\n");
471 return PTR_ERR(dst->tag_ops); 473 return PTR_ERR(dst->tag_ops);