From: Dan Smith <danms@us.ibm.com>
To: containers@lists.osdl.org
Cc: netdev@vger.kernel.org, orenl@librato.com
Subject: [PATCH 2/3] Add a veth_get_peer() and veth_set_peer() functions
Date: Fri, 22 Jan 2010 13:09:51 -0800 [thread overview]
Message-ID: <1264194592-7529-3-git-send-email-danms@us.ibm.com> (raw)
In-Reply-To: <1264194592-7529-1-git-send-email-danms@us.ibm.com>
This is needed for C/R. For checkpoint, we need to be able to follow
the link from one veth device to its peer. For restart, we need to be
able to link two veth devices we've restored to re-establish their
relationship.
Signed-off-by: Dan Smith <danms@us.ibm.com>
Cc: netdev@vger.kernel.org
---
drivers/net/veth.c | 14 ++++++++++++++
include/linux/veth.h | 5 +++++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index ade5b34..eb47080 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -454,6 +454,20 @@ static void veth_dellink(struct net_device *dev)
unregister_netdevice(peer);
}
+struct net_device *veth_get_peer(struct net_device *veth)
+{
+ struct veth_priv *priv = netdev_priv(veth);
+
+ return priv->peer;
+}
+
+void veth_set_peer(struct net_device *veth, struct net_device *peer)
+{
+ struct veth_priv *priv = netdev_priv(veth);
+
+ priv->peer = peer;
+}
+
static const struct nla_policy veth_policy[VETH_INFO_MAX + 1];
static struct rtnl_link_ops veth_link_ops = {
diff --git a/include/linux/veth.h b/include/linux/veth.h
index 3354c1e..eee059d 100644
--- a/include/linux/veth.h
+++ b/include/linux/veth.h
@@ -9,4 +9,9 @@ enum {
#define VETH_INFO_MAX (__VETH_INFO_MAX - 1)
};
+#ifdef __KERNEL__
+struct net_device *veth_get_peer(struct net_device *veth);
+void veth_set_peer(struct net_device *veth, struct net_device *peer);
+#endif
+
#endif
--
1.6.2.5
next prev parent reply other threads:[~2010-01-22 21:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-22 21:09 C/R: Network namespace and device support (v2) Dan Smith
2010-01-22 21:09 ` [PATCH 1/3] Expose rtnl_link_ops_get() Dan Smith
2010-01-22 21:09 ` Dan Smith [this message]
2010-01-22 21:09 ` [PATCH 3/3] C/R: Basic support for network namespaces and devices (v2) Dan Smith
2010-01-23 9:25 ` David Miller
[not found] ` <20100123.012537.99190542.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2010-01-23 15:19 ` Dan Smith
[not found] <1263999673-11279-1-git-send-email-danms@us.ibm.com>
[not found] ` <1263999673-11279-1-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-01-20 15:01 ` [PATCH 2/3] Add a veth_get_peer() and veth_set_peer() functions Dan Smith
2010-01-21 9:24 ` 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=1264194592-7529-3-git-send-email-danms@us.ibm.com \
--to=danms@us.ibm.com \
--cc=containers@lists.osdl.org \
--cc=netdev@vger.kernel.org \
--cc=orenl@librato.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).