From: Daniele Di Proietto <daniele.di.proietto@gmail.com>
To: netdev@vger.kernel.org
Cc: pshelar@nicira.com, Daniele Di Proietto <daniele.di.proietto@gmail.com>
Subject: [PATCH net-next] openvswitch: Do not use private netdev_vport fields
Date: Tue, 6 Jan 2015 21:51:21 +0100 [thread overview]
Message-ID: <1420577481-20238-1-git-send-email-daniele.di.proietto@gmail.com> (raw)
This commit introduces netdev_vport_index() to prevent datapath.c from directly accessing the 'dev' member of 'struct netdev_vport'.
This fix is needed to allow possible alternative netdev_vport implementations.
Signed-off-by: Daniele Di Proietto <daniele.di.proietto@gmail.com>
---
net/openvswitch/datapath.c | 2 +-
net/openvswitch/vport-netdev.h | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 4e9a5f0..d632535 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -186,7 +186,7 @@ static int get_dpifindex(const struct datapath *dp)
local = ovs_vport_rcu(dp, OVSP_LOCAL);
if (local)
- ifindex = netdev_vport_priv(local)->dev->ifindex;
+ ifindex = netdev_vport_index(local);
else
ifindex = 0;
diff --git a/net/openvswitch/vport-netdev.h b/net/openvswitch/vport-netdev.h
index 6f7038e..ecfcbd5 100644
--- a/net/openvswitch/vport-netdev.h
+++ b/net/openvswitch/vport-netdev.h
@@ -38,6 +38,12 @@ netdev_vport_priv(const struct vport *vport)
return vport_priv(vport);
}
+static inline int
+netdev_vport_index(const struct vport *vport)
+{
+ return netdev_vport_priv(vport)->dev->ifindex;
+}
+
const char *ovs_netdev_get_name(const struct vport *);
void ovs_netdev_detach_dev(struct vport *);
--
2.1.4
next reply other threads:[~2015-01-06 20:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-06 20:51 Daniele Di Proietto [this message]
2015-01-06 21:16 ` [PATCH net-next] openvswitch: Do not use private netdev_vport fields Pravin Shelar
2015-01-06 22:02 ` David Miller
2015-01-06 22:15 ` Pravin Shelar
2015-01-06 22:28 ` Pravin Shelar
2015-01-06 23:32 ` Daniele Di Proietto
2015-01-07 6:00 ` Pravin Shelar
2015-01-07 23:49 ` Daniele Di Proietto
2015-01-06 22:01 ` 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=1420577481-20238-1-git-send-email-daniele.di.proietto@gmail.com \
--to=daniele.di.proietto@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pshelar@nicira.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).