From: Jesse Gross <jesse@nicira.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, dev@openvswitch.org,
Jiri Pirko <jiri@resnulli.us>, Jesse Gross <jesse@nicira.com>
Subject: [PATCH net-next 04/11] openvswitch:: link upper device for port devices
Date: Tue, 27 Aug 2013 13:20:41 -0700 [thread overview]
Message-ID: <1377634848-34327-5-git-send-email-jesse@nicira.com> (raw)
In-Reply-To: <1377634848-34327-1-git-send-email-jesse@nicira.com>
From: Jiri Pirko <jiri@resnulli.us>
Link upper device properly. That will make IFLA_MASTER filled up.
Set the master to port 0 of the datapath under which the port belongs.
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Jesse Gross <jesse@nicira.com>
---
net/openvswitch/vport-netdev.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/net/openvswitch/vport-netdev.c b/net/openvswitch/vport-netdev.c
index 5982f3f..09d93c1 100644
--- a/net/openvswitch/vport-netdev.c
+++ b/net/openvswitch/vport-netdev.c
@@ -25,6 +25,7 @@
#include <linux/llc.h>
#include <linux/rtnetlink.h>
#include <linux/skbuff.h>
+#include <linux/openvswitch.h>
#include <net/llc.h>
@@ -74,6 +75,15 @@ static rx_handler_result_t netdev_frame_hook(struct sk_buff **pskb)
return RX_HANDLER_CONSUMED;
}
+static struct net_device *get_dpdev(struct datapath *dp)
+{
+ struct vport *local;
+
+ local = ovs_vport_ovsl(dp, OVSP_LOCAL);
+ BUG_ON(!local);
+ return netdev_vport_priv(local)->dev;
+}
+
static struct vport *netdev_create(const struct vport_parms *parms)
{
struct vport *vport;
@@ -103,10 +113,15 @@ static struct vport *netdev_create(const struct vport_parms *parms)
}
rtnl_lock();
+ err = netdev_master_upper_dev_link(netdev_vport->dev,
+ get_dpdev(vport->dp));
+ if (err)
+ goto error_unlock;
+
err = netdev_rx_handler_register(netdev_vport->dev, netdev_frame_hook,
vport);
if (err)
- goto error_unlock;
+ goto error_master_upper_dev_unlink;
dev_set_promiscuity(netdev_vport->dev, 1);
netdev_vport->dev->priv_flags |= IFF_OVS_DATAPATH;
@@ -114,6 +129,8 @@ static struct vport *netdev_create(const struct vport_parms *parms)
return vport;
+error_master_upper_dev_unlink:
+ netdev_upper_dev_unlink(netdev_vport->dev, get_dpdev(vport->dp));
error_unlock:
rtnl_unlock();
error_put:
@@ -140,6 +157,7 @@ static void netdev_destroy(struct vport *vport)
rtnl_lock();
netdev_vport->dev->priv_flags &= ~IFF_OVS_DATAPATH;
netdev_rx_handler_unregister(netdev_vport->dev);
+ netdev_upper_dev_unlink(netdev_vport->dev, get_dpdev(vport->dp));
dev_set_promiscuity(netdev_vport->dev, -1);
rtnl_unlock();
--
1.8.1.2
next prev parent reply other threads:[~2013-08-27 20:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-27 20:20 [GIT net-next] Open vSwitch Jesse Gross
2013-08-27 20:20 ` [PATCH net-next 02/11] openvswitch: Use RCU lock for dp dump operation Jesse Gross
2013-08-27 20:20 ` [PATCH net-next 03/11] openvswitch: Use non rcu hlist_del() flow table entry Jesse Gross
2013-08-27 20:20 ` Jesse Gross [this message]
[not found] ` <1377634848-34327-1-git-send-email-jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
2013-08-27 20:20 ` [PATCH net-next 01/11] openvswitch: Use RCU lock for flow dump operation Jesse Gross
2013-08-27 20:20 ` [PATCH net-next 05/11] openvswitch: Fix argument descriptions in vport.c Jesse Gross
2013-08-27 20:20 ` [PATCH net-next 06/11] openvswitch: check CONFIG_OPENVSWITCH_GRE in makefile Jesse Gross
2013-08-27 20:20 ` [PATCH net-next 07/11] openvswitch: Mega flow implementation Jesse Gross
2013-08-27 20:20 ` [PATCH net-next 08/11] net: Add NEXTHDR_SCTP to ipv6.h Jesse Gross
2013-08-27 20:20 ` [PATCH net-next 09/11] openvswitch: Add SCTP support Jesse Gross
2013-08-27 20:20 ` [PATCH net-next 10/11] openvswitch: Rename key_len to key_end Jesse Gross
2013-08-27 20:20 ` [PATCH net-next 11/11] openvswitch: optimize flow compare and mask functions Jesse Gross
2013-08-28 2:11 ` [GIT net-next] Open vSwitch 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=1377634848-34327-5-git-send-email-jesse@nicira.com \
--to=jesse@nicira.com \
--cc=davem@davemloft.net \
--cc=dev@openvswitch.org \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
/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).