Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/808386/?format=api
{ "id": 808386, "url": "http://patchwork.ozlabs.org/api/patches/808386/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170831183746.2109-4-vivien.didelot@savoirfairelinux.com/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170831183746.2109-4-vivien.didelot@savoirfairelinux.com>", "list_archive_url": null, "date": "2017-08-31T18:37:45", "name": "[net-next,3/4] net: dsa: change dsa_ptr for a dsa_master", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": true, "hash": "0735d300ed36275e51284db65347b0248886fe42", "submitter": { "id": 15889, "url": "http://patchwork.ozlabs.org/api/people/15889/?format=api", "name": "Vivien Didelot", "email": "vivien.didelot@savoirfairelinux.com" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/20170831183746.2109-4-vivien.didelot@savoirfairelinux.com/mbox/", "series": [ { "id": 892, "url": "http://patchwork.ozlabs.org/api/series/892/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=892", "date": "2017-08-31T18:37:46", "name": "net: dsa: add master interface", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/892/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/808386/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/808386/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xjrpx0BHWz9sMN\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 1 Sep 2017 04:43:05 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751761AbdHaSmx (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tThu, 31 Aug 2017 14:42:53 -0400", "from mail.savoirfairelinux.com ([208.88.110.44]:36936 \"EHLO\n\tmail.savoirfairelinux.com\" rhost-flags-OK-OK-OK-OK) by\n\tvger.kernel.org with ESMTP id S1751613AbdHaSm1 (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Thu, 31 Aug 2017 14:42:27 -0400", "from localhost (localhost [127.0.0.1])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTP id 6C2869C1A9D;\n\tThu, 31 Aug 2017 14:42:26 -0400 (EDT)", "from mail.savoirfairelinux.com ([127.0.0.1])\n\tby localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new,\n\tport 10032)\n\twith ESMTP id FBD5TMGspcwk; Thu, 31 Aug 2017 14:42:25 -0400 (EDT)", "from localhost (localhost [127.0.0.1])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTP id 1E4B09C1870;\n\tThu, 31 Aug 2017 14:42:25 -0400 (EDT)", "from mail.savoirfairelinux.com ([127.0.0.1])\n\tby localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new,\n\tport 10026)\n\twith ESMTP id KDyR_rj7wVTn; Thu, 31 Aug 2017 14:42:24 -0400 (EDT)", "from weeman.mtl.sfl (unknown [192.168.49.192])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTPSA id D732B9C1A8B;\n\tThu, 31 Aug 2017 14:42:24 -0400 (EDT)" ], "X-Virus-Scanned": "amavisd-new at mail.savoirfairelinux.com", "From": "Vivien Didelot <vivien.didelot@savoirfairelinux.com>", "To": "netdev@vger.kernel.org", "Cc": "linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com,\n\t\"David S. Miller\" <davem@davemloft.net>,\n\tFlorian Fainelli <f.fainelli@gmail.com>, Andrew Lunn <andrew@lunn.ch>,\n\tVivien Didelot <vivien.didelot@savoirfairelinux.com>", "Subject": "[PATCH net-next 3/4] net: dsa: change dsa_ptr for a dsa_master", "Date": "Thu, 31 Aug 2017 14:37:45 -0400", "Message-Id": "<20170831183746.2109-4-vivien.didelot@savoirfairelinux.com>", "X-Mailer": "git-send-email 2.14.1", "In-Reply-To": "<20170831183746.2109-1-vivien.didelot@savoirfairelinux.com>", "References": "<20170831183746.2109-1-vivien.didelot@savoirfairelinux.com>", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "The dsa_ptr of a net_device currently points to a dsa_switch_tree.\n\nThis is not correct because the interface is physically linked to a\nswitch port, and because several network interface could point to\nseveral (so called \"CPU\") ports of the same DSA switch tree.\n\nBecause the tagging operations are specific to the DSA master port and\nnot the whole switch tree, move the tag_ops pointer in dsa_master.\n\nFinally change the dsa_ptr from dsa_switch_tree to a dsa_master.\n\nSigned-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>\n---\n include/linux/netdevice.h | 4 ++--\n include/net/dsa.h | 21 ++++++++++-----------\n net/dsa/dsa.c | 6 +++---\n net/dsa/dsa2.c | 13 +++++--------\n net/dsa/dsa_priv.h | 8 ++------\n net/dsa/legacy.c | 13 ++++---------\n net/dsa/master.c | 28 ++++++++++++++++++++++------\n net/dsa/slave.c | 2 +-\n net/dsa/tag_brcm.c | 5 ++---\n net/dsa/tag_dsa.c | 3 ++-\n net/dsa/tag_edsa.c | 3 ++-\n net/dsa/tag_ksz.c | 5 ++---\n net/dsa/tag_lan9303.c | 6 ++----\n net/dsa/tag_mtk.c | 12 ++----------\n net/dsa/tag_qca.c | 12 ++----------\n net/dsa/tag_trailer.c | 5 ++---\n 16 files changed, 65 insertions(+), 81 deletions(-)", "diff": "diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h\nindex 29bf06ff157c..eb0501c9afc5 100644\n--- a/include/linux/netdevice.h\n+++ b/include/linux/netdevice.h\n@@ -55,7 +55,7 @@\n struct netpoll_info;\n struct device;\n struct phy_device;\n-struct dsa_switch_tree;\n+struct dsa_master;\n \n /* 802.11 specific */\n struct wireless_dev;\n@@ -1752,7 +1752,7 @@ struct net_device {\n \tstruct vlan_info __rcu\t*vlan_info;\n #endif\n #if IS_ENABLED(CONFIG_NET_DSA)\n-\tstruct dsa_switch_tree\t*dsa_ptr;\n+\tstruct dsa_master\t*dsa_ptr;\n #endif\n #if IS_ENABLED(CONFIG_TIPC)\n \tstruct tipc_bearer __rcu *tipc_ptr;\ndiff --git a/include/net/dsa.h b/include/net/dsa.h\nindex f4a5afc4255b..d5b24cd10f79 100644\n--- a/include/net/dsa.h\n+++ b/include/net/dsa.h\n@@ -130,11 +130,6 @@ struct dsa_switch_tree {\n \t */\n \tstruct dsa_platform_data\t*pd;\n \n-\t/* Copy of tag_ops->rcv for faster access in hot path */\n-\tstruct sk_buff *\t(*rcv)(struct sk_buff *skb,\n-\t\t\t\t struct net_device *dev,\n-\t\t\t\t struct packet_type *pt);\n-\n \t/*\n \t * The switch port to which the CPU is attached.\n \t */\n@@ -144,12 +139,6 @@ struct dsa_switch_tree {\n \t * Data for the individual switch chips.\n \t */\n \tstruct dsa_switch\t*ds[DSA_MAX_SWITCHES];\n-\n-\t/*\n-\t * Tagging protocol operations for adding and removing an\n-\t * encapsulation tag.\n-\t */\n-\tconst struct dsa_device_ops *tag_ops;\n };\n \n /* TC matchall action types, only mirroring for now */\n@@ -177,6 +166,16 @@ struct dsa_master {\n \tstruct dsa_port *port;\n \tstruct net_device *netdev;\n \n+\t/*\n+\t * Tagging protocol operations for adding and removing an\n+\t * encapsulation tag.\n+\t */\n+\tconst struct dsa_device_ops *tag_ops;\n+\n+\t/* Copy of tag_ops->rcv for faster access in hot path */\n+\tstruct sk_buff *(*rcv)(struct sk_buff *skb, struct net_device *dev,\n+\t\t\t struct packet_type *pt);\n+\n \t/* Original copy of the master netdev ethtool_ops */\n \tconst struct ethtool_ops *orig_ethtool_ops;\n \tstruct ethtool_ops ethtool_ops;\ndiff --git a/net/dsa/dsa.c b/net/dsa/dsa.c\nindex 81c852e32821..f2ebd3572d6f 100644\n--- a/net/dsa/dsa.c\n+++ b/net/dsa/dsa.c\n@@ -160,12 +160,12 @@ EXPORT_SYMBOL_GPL(dsa_dev_to_net_device);\n static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev,\n \t\t\t struct packet_type *pt, struct net_device *unused)\n {\n-\tstruct dsa_switch_tree *dst = dev->dsa_ptr;\n+\tstruct dsa_master *master = dev->dsa_ptr;\n \tstruct sk_buff *nskb = NULL;\n \tstruct pcpu_sw_netstats *s;\n \tstruct dsa_slave_priv *p;\n \n-\tif (unlikely(dst == NULL)) {\n+\tif (unlikely(!master)) {\n \t\tkfree_skb(skb);\n \t\treturn 0;\n \t}\n@@ -174,7 +174,7 @@ static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev,\n \tif (!skb)\n \t\treturn 0;\n \n-\tnskb = dst->rcv(skb, dev, pt);\n+\tnskb = master->rcv(skb, dev, pt);\n \tif (!nskb) {\n \t\tkfree_skb(skb);\n \t\treturn 0;\ndiff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c\nindex d60f681b96cc..80a9706324f2 100644\n--- a/net/dsa/dsa2.c\n+++ b/net/dsa/dsa2.c\n@@ -444,7 +444,7 @@ static int dsa_dst_apply(struct dsa_switch_tree *dst)\n \t * sent to the tag format's receive function.\n \t */\n \twmb();\n-\tdst->master->netdev->dsa_ptr = dst;\n+\tdst->master->netdev->dsa_ptr = dst->master;\n \tdst->applied = true;\n \n \treturn 0;\n@@ -487,9 +487,9 @@ static int dsa_cpu_parse(struct dsa_port *port, u32 index,\n \t\t\t struct dsa_switch_tree *dst,\n \t\t\t struct dsa_switch *ds)\n {\n-\tenum dsa_tag_protocol tag_protocol;\n \tstruct net_device *ethernet_dev;\n \tstruct device_node *ethernet;\n+\tint err;\n \n \tif (port->dn) {\n \t\tethernet = of_parse_phandle(port->dn, \"ethernet\", 0);\n@@ -516,16 +516,13 @@ static int dsa_cpu_parse(struct dsa_port *port, u32 index,\n \t */\n \tds->cpu_port_mask |= BIT(index);\n \n-\ttag_protocol = ds->ops->get_tag_protocol(ds);\n-\tdst->tag_ops = dsa_resolve_tag_protocol(tag_protocol);\n-\tif (IS_ERR(dst->tag_ops)) {\n+\terr = dsa_master_tag_protocol(dst->master);\n+\tif (err) {\n \t\tdev_warn(ds->dev, \"No tagger for this switch\\n\");\n \t\tds->cpu_port_mask &= ~BIT(index);\n-\t\treturn PTR_ERR(dst->tag_ops);\n+\t\treturn err;\n \t}\n \n-\tdst->rcv = dst->tag_ops->rcv;\n-\n \treturn 0;\n }\n \ndiff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h\nindex 4fa14b4305b9..59f155cbbe87 100644\n--- a/net/dsa/dsa_priv.h\n+++ b/net/dsa/dsa_priv.h\n@@ -66,7 +66,7 @@ struct dsa_notifier_vlan_info {\n };\n \n struct dsa_slave_priv {\n-\t/* Copy of dp->ds->dst->tag_ops->xmit for faster access in hot path */\n+\t/* Copy of the master xmit tagging op for faster access in hot path */\n \tstruct sk_buff *\t(*xmit)(struct sk_buff *skb,\n \t\t\t\t\tstruct net_device *dev);\n \n@@ -115,6 +115,7 @@ struct dsa_master *dsa_master_create(struct dsa_port *port,\n \t\t\t\t struct net_device *netdev);\n int dsa_master_ethtool_setup(struct dsa_master *master);\n void dsa_master_ethtool_restore(struct dsa_master *master);\n+int dsa_master_tag_protocol(struct dsa_master *master);\n \n /* port.c */\n int dsa_port_set_state(struct dsa_port *dp, u8 state,\n@@ -183,9 +184,4 @@ static inline struct net_device *dsa_master_netdev(struct dsa_slave_priv *p)\n \treturn p->dp->ds->dst->master->netdev;\n }\n \n-static inline struct dsa_port *dsa_get_cpu_port(struct dsa_switch_tree *dst)\n-{\n-\treturn dst->master->port;\n-}\n-\n #endif\ndiff --git a/net/dsa/legacy.c b/net/dsa/legacy.c\nindex acd81c488bf4..3afedd9758c5 100644\n--- a/net/dsa/legacy.c\n+++ b/net/dsa/legacy.c\n@@ -147,14 +147,9 @@ static int dsa_switch_setup_one(struct dsa_switch *ds,\n \t * switch.\n \t */\n \tif (dst->master->port->ds == ds) {\n-\t\tenum dsa_tag_protocol tag_protocol;\n-\n-\t\ttag_protocol = ops->get_tag_protocol(ds);\n-\t\tdst->tag_ops = dsa_resolve_tag_protocol(tag_protocol);\n-\t\tif (IS_ERR(dst->tag_ops))\n-\t\t\treturn PTR_ERR(dst->tag_ops);\n-\n-\t\tdst->rcv = dst->tag_ops->rcv;\n+\t\tret = dsa_master_tag_protocol(dst->master);\n+\t\tif (ret)\n+\t\t\treturn ret;\n \t}\n \n \tmemcpy(ds->rtable, cd->rtable, sizeof(ds->rtable));\n@@ -607,7 +602,7 @@ static int dsa_setup_dst(struct dsa_switch_tree *dst, struct net_device *dev,\n \t * sent to the tag format's receive function.\n \t */\n \twmb();\n-\tdev->dsa_ptr = dst;\n+\tdev->dsa_ptr = dst->master;\n \n \treturn 0;\n }\ndiff --git a/net/dsa/master.c b/net/dsa/master.c\nindex 9ecce3e7c8df..6714750ee13f 100644\n--- a/net/dsa/master.c\n+++ b/net/dsa/master.c\n@@ -16,8 +16,7 @@ static void dsa_master_get_ethtool_stats(struct net_device *dev,\n \t\t\t\t\t struct ethtool_stats *stats,\n \t\t\t\t\t uint64_t *data)\n {\n-\tstruct dsa_switch_tree *dst = dev->dsa_ptr;\n-\tstruct dsa_master *master = dst->master;\n+\tstruct dsa_master *master = dev->dsa_ptr;\n \tstruct dsa_port *port = master->port;\n \tstruct dsa_switch *ds = port->ds;\n \tint count = 0;\n@@ -33,8 +32,7 @@ static void dsa_master_get_ethtool_stats(struct net_device *dev,\n \n static int dsa_master_get_sset_count(struct net_device *dev, int sset)\n {\n-\tstruct dsa_switch_tree *dst = dev->dsa_ptr;\n-\tstruct dsa_master *master = dst->master;\n+\tstruct dsa_master *master = dev->dsa_ptr;\n \tstruct dsa_port *port = master->port;\n \tstruct dsa_switch *ds = port->ds;\n \tint count = 0;\n@@ -51,8 +49,7 @@ static int dsa_master_get_sset_count(struct net_device *dev, int sset)\n static void dsa_master_get_strings(struct net_device *dev, uint32_t stringset,\n \t\t\t\t uint8_t *data)\n {\n-\tstruct dsa_switch_tree *dst = dev->dsa_ptr;\n-\tstruct dsa_master *master = dst->master;\n+\tstruct dsa_master *master = dev->dsa_ptr;\n \tstruct dsa_port *port = master->port;\n \tstruct dsa_switch *ds = port->ds;\n \tint len = ETH_GSTRING_LEN;\n@@ -116,6 +113,25 @@ void dsa_master_ethtool_restore(struct dsa_master *master)\n \tmaster->orig_ethtool_ops = NULL;\n }\n \n+int dsa_master_tag_protocol(struct dsa_master *master)\n+{\n+\tstruct dsa_switch *ds = master->port->ds;\n+\tenum dsa_tag_protocol proto;\n+\n+\tif (!ds->ops->get_tag_protocol)\n+\t\treturn -EOPNOTSUPP;\n+\n+\tproto = ds->ops->get_tag_protocol(ds);\n+\n+\tmaster->tag_ops = dsa_resolve_tag_protocol(proto);\n+\tif (IS_ERR(master->tag_ops))\n+\t\treturn PTR_ERR(master->tag_ops);\n+\n+\tmaster->rcv = master->tag_ops->rcv;\n+\n+\treturn 0;\n+}\n+\n struct dsa_master *dsa_master_create(struct dsa_port *port,\n \t\t\t\t struct net_device *netdev)\n {\ndiff --git a/net/dsa/slave.c b/net/dsa/slave.c\nindex 99f9e48a6cee..d5a03ef8d0e0 100644\n--- a/net/dsa/slave.c\n+++ b/net/dsa/slave.c\n@@ -1206,7 +1206,7 @@ int dsa_slave_create(struct dsa_port *port, const char *name)\n \t}\n \tp->dp = port;\n \tINIT_LIST_HEAD(&p->mall_tc_list);\n-\tp->xmit = dst->tag_ops->xmit;\n+\tp->xmit = dst->master->tag_ops->xmit;\n \n \tp->old_pause = -1;\n \tp->old_link = -1;\ndiff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c\nindex de74c3f77818..417266f23bed 100644\n--- a/net/dsa/tag_brcm.c\n+++ b/net/dsa/tag_brcm.c\n@@ -91,9 +91,8 @@ static struct sk_buff *brcm_tag_xmit(struct sk_buff *skb, struct net_device *dev\n static struct sk_buff *brcm_tag_rcv(struct sk_buff *skb, struct net_device *dev,\n \t\t\t\t struct packet_type *pt)\n {\n-\tstruct dsa_switch_tree *dst = dev->dsa_ptr;\n-\tstruct dsa_port *cpu_dp = dsa_get_cpu_port(dst);\n-\tstruct dsa_switch *ds = cpu_dp->ds;\n+\tstruct dsa_master *master = dev->dsa_ptr;\n+\tstruct dsa_switch *ds = master->port->ds;\n \tint source_port;\n \tu8 *brcm_tag;\n \ndiff --git a/net/dsa/tag_dsa.c b/net/dsa/tag_dsa.c\nindex fbf9ca954773..7897bbd1a110 100644\n--- a/net/dsa/tag_dsa.c\n+++ b/net/dsa/tag_dsa.c\n@@ -67,7 +67,8 @@ static struct sk_buff *dsa_xmit(struct sk_buff *skb, struct net_device *dev)\n static struct sk_buff *dsa_rcv(struct sk_buff *skb, struct net_device *dev,\n \t\t\t struct packet_type *pt)\n {\n-\tstruct dsa_switch_tree *dst = dev->dsa_ptr;\n+\tstruct dsa_master *master = dev->dsa_ptr;\n+\tstruct dsa_switch_tree *dst = master->port->ds->dst;\n \tstruct dsa_switch *ds;\n \tu8 *dsa_header;\n \tint source_device;\ndiff --git a/net/dsa/tag_edsa.c b/net/dsa/tag_edsa.c\nindex 76367ba1b2e2..12f9efed6251 100644\n--- a/net/dsa/tag_edsa.c\n+++ b/net/dsa/tag_edsa.c\n@@ -80,7 +80,8 @@ static struct sk_buff *edsa_xmit(struct sk_buff *skb, struct net_device *dev)\n static struct sk_buff *edsa_rcv(struct sk_buff *skb, struct net_device *dev,\n \t\t\t\tstruct packet_type *pt)\n {\n-\tstruct dsa_switch_tree *dst = dev->dsa_ptr;\n+\tstruct dsa_master *master = dev->dsa_ptr;\n+\tstruct dsa_switch_tree *dst = master->port->ds->dst;\n \tstruct dsa_switch *ds;\n \tu8 *edsa_header;\n \tint source_device;\ndiff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c\nindex 17f30675c15c..7043d51a7a80 100644\n--- a/net/dsa/tag_ksz.c\n+++ b/net/dsa/tag_ksz.c\n@@ -78,9 +78,8 @@ static struct sk_buff *ksz_xmit(struct sk_buff *skb, struct net_device *dev)\n static struct sk_buff *ksz_rcv(struct sk_buff *skb, struct net_device *dev,\n \t\t\t struct packet_type *pt)\n {\n-\tstruct dsa_switch_tree *dst = dev->dsa_ptr;\n-\tstruct dsa_port *cpu_dp = dsa_get_cpu_port(dst);\n-\tstruct dsa_switch *ds = cpu_dp->ds;\n+\tstruct dsa_master *master = dev->dsa_ptr;\n+\tstruct dsa_switch *ds = master->port->ds;\n \tu8 *tag;\n \tint source_port;\n \ndiff --git a/net/dsa/tag_lan9303.c b/net/dsa/tag_lan9303.c\nindex 0b9826105e42..afb3df46712a 100644\n--- a/net/dsa/tag_lan9303.c\n+++ b/net/dsa/tag_lan9303.c\n@@ -70,13 +70,11 @@ static struct sk_buff *lan9303_xmit(struct sk_buff *skb, struct net_device *dev)\n static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev,\n \t\t\tstruct packet_type *pt)\n {\n+\tstruct dsa_master *master = dev->dsa_ptr;\n+\tstruct dsa_switch *ds = master->port->ds;\n \tu16 *lan9303_tag;\n-\tstruct dsa_switch_tree *dst = dev->dsa_ptr;\n-\tstruct dsa_switch *ds;\n \tunsigned int source_port;\n \n-\tds = dst->ds[0];\n-\n \tif (unlikely(!ds)) {\n \t\tdev_warn_ratelimited(&dev->dev, \"Dropping packet, due to missing DSA switch device\\n\");\n \t\treturn NULL;\ndiff --git a/net/dsa/tag_mtk.c b/net/dsa/tag_mtk.c\nindex ec8ee5f43255..7af26afaa8ac 100644\n--- a/net/dsa/tag_mtk.c\n+++ b/net/dsa/tag_mtk.c\n@@ -46,8 +46,8 @@ static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb,\n static struct sk_buff *mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev,\n \t\t\t\t struct packet_type *pt)\n {\n-\tstruct dsa_switch_tree *dst = dev->dsa_ptr;\n-\tstruct dsa_switch *ds;\n+\tstruct dsa_master *master = dev->dsa_ptr;\n+\tstruct dsa_switch *ds = master->port->ds;\n \tint port;\n \t__be16 *phdr, hdr;\n \n@@ -68,14 +68,6 @@ static struct sk_buff *mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev,\n \t\tskb->data - ETH_HLEN - MTK_HDR_LEN,\n \t\t2 * ETH_ALEN);\n \n-\t/* This protocol doesn't support cascading multiple\n-\t * switches so it's safe to assume the switch is first\n-\t * in the tree.\n-\t */\n-\tds = dst->ds[0];\n-\tif (!ds)\n-\t\treturn NULL;\n-\n \t/* Get source port information */\n \tport = (hdr & MTK_HDR_RECV_SOURCE_PORT_MASK);\n \tif (!ds->ports[port].netdev)\ndiff --git a/net/dsa/tag_qca.c b/net/dsa/tag_qca.c\nindex 1d4c70711c0f..a49cc7c6fac9 100644\n--- a/net/dsa/tag_qca.c\n+++ b/net/dsa/tag_qca.c\n@@ -65,9 +65,8 @@ static struct sk_buff *qca_tag_xmit(struct sk_buff *skb, struct net_device *dev)\n static struct sk_buff *qca_tag_rcv(struct sk_buff *skb, struct net_device *dev,\n \t\t\t\t struct packet_type *pt)\n {\n-\tstruct dsa_switch_tree *dst = dev->dsa_ptr;\n-\tstruct dsa_port *cpu_dp = dsa_get_cpu_port(dst);\n-\tstruct dsa_switch *ds;\n+\tstruct dsa_master *master = dev->dsa_ptr;\n+\tstruct dsa_switch *ds = master->port->ds;\n \tu8 ver;\n \tint port;\n \t__be16 *phdr, hdr;\n@@ -92,13 +91,6 @@ static struct sk_buff *qca_tag_rcv(struct sk_buff *skb, struct net_device *dev,\n \tmemmove(skb->data - ETH_HLEN, skb->data - ETH_HLEN - QCA_HDR_LEN,\n \t\tETH_HLEN - QCA_HDR_LEN);\n \n-\t/* This protocol doesn't support cascading multiple switches so it's\n-\t * safe to assume the switch is first in the tree\n-\t */\n-\tds = cpu_dp->ds;\n-\tif (!ds)\n-\t\treturn NULL;\n-\n \t/* Get source port information */\n \tport = (hdr & QCA_HDR_RECV_SOURCE_PORT_MASK);\n \tif (!ds->ports[port].netdev)\ndiff --git a/net/dsa/tag_trailer.c b/net/dsa/tag_trailer.c\nindex 8707157dea32..a3dacfb48dc0 100644\n--- a/net/dsa/tag_trailer.c\n+++ b/net/dsa/tag_trailer.c\n@@ -58,9 +58,8 @@ static struct sk_buff *trailer_xmit(struct sk_buff *skb, struct net_device *dev)\n static struct sk_buff *trailer_rcv(struct sk_buff *skb, struct net_device *dev,\n \t\t\t\t struct packet_type *pt)\n {\n-\tstruct dsa_switch_tree *dst = dev->dsa_ptr;\n-\tstruct dsa_port *cpu_dp = dsa_get_cpu_port(dst);\n-\tstruct dsa_switch *ds = cpu_dp->ds;\n+\tstruct dsa_master *master = dev->dsa_ptr;\n+\tstruct dsa_switch *ds = master->port->ds;\n \tu8 *trailer;\n \tint source_port;\n \n", "prefixes": [ "net-next", "3/4" ] }