netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@mellanox.com>
To: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"bridge@lists.linux-foundation.org"
	<bridge@lists.linux-foundation.org>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
	Jiri Pirko <jiri@mellanox.com>, Petr Machata <petrm@mellanox.com>,
	"roopa@cumulusnetworks.com" <roopa@cumulusnetworks.com>,
	"nikolay@cumulusnetworks.com" <nikolay@cumulusnetworks.com>,
	mlxsw <mlxsw@mellanox.com>, Ido Schimmel <idosch@mellanox.com>
Subject: [PATCH net-next 1/8] net: bridge: Extend br_vlan_get_pvid() for bridge ports
Date: Wed, 28 Nov 2018 20:06:58 +0000	[thread overview]
Message-ID: <20181128200558.31343-2-idosch@mellanox.com> (raw)
In-Reply-To: <20181128200558.31343-1-idosch@mellanox.com>

Currently, the function only works for the bridge device itself, but
subsequent patches will need to be able to query the PVID of a given
bridge port, so extend the function.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Petr Machata <petrm@mellanox.com>
---
 net/bridge/br_vlan.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index b21838b51220..48f50d7ac624 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -1217,9 +1217,13 @@ void br_vlan_get_stats(const struct net_bridge_vlan *v,
 int br_vlan_get_pvid(const struct net_device *dev, u16 *p_pvid)
 {
 	struct net_bridge_vlan_group *vg;
+	struct net_bridge_port *p;
 
 	ASSERT_RTNL();
-	if (netif_is_bridge_master(dev))
+	p = br_port_get_check_rtnl(dev);
+	if (p)
+		vg = nbp_vlan_group(p);
+	else if (netif_is_bridge_master(dev))
 		vg = br_vlan_group(netdev_priv(dev));
 	else
 		return -EINVAL;
-- 
2.19.1

  reply	other threads:[~2018-11-29  7:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-28 20:06 [PATCH net-next 0/8] mlxsw: Add VxLAN support with VLAN-aware bridges Ido Schimmel
2018-11-28 20:06 ` Ido Schimmel [this message]
2018-11-28 20:06 ` [PATCH net-next 2/8] mlxsw: spectrum_fid: Add API to lookup 802.1Q FIDs without creating them Ido Schimmel
2018-11-28 20:07 ` [PATCH net-next 3/8] mlxsw: spectrum_switchdev: Unify VxLAN leave function Ido Schimmel
2018-11-28 20:07 ` [PATCH net-next 4/8] mlxsw: spectrum_switchdev: Prepare function for VLAN-aware bridges Ido Schimmel
2018-11-28 20:07 ` [PATCH net-next 5/8] mlxsw: spectrum: Enable VxLAN enslavement to " Ido Schimmel
2018-11-28 20:07 ` [PATCH net-next 6/8] selftests: mlxsw: Consider VLAN-aware bridges as valid Ido Schimmel
2018-11-28 20:07 ` [PATCH net-next 7/8] selftests: mlxsw: Add a test for VxLAN configuration with a VLAN-aware bridge Ido Schimmel
2018-11-28 20:07 ` [PATCH net-next 8/8] selftests: forwarding: Add VxLAN test " Ido Schimmel
2018-12-01  1:08 ` [PATCH net-next 0/8] mlxsw: Add VxLAN support with VLAN-aware bridges David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181128200558.31343-2-idosch@mellanox.com \
    --to=idosch@mellanox.com \
    --cc=bridge@lists.linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=jiri@mellanox.com \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@cumulusnetworks.com \
    --cc=petrm@mellanox.com \
    --cc=roopa@cumulusnetworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).