From: Patrick Mullaney <pmullaney@novell.com>
To: alacrityvm-devel@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org, kaber@trash.net, arnd@arndb.de,
bridge@lists.linux-foundation.org, evb@yahoogroups.com,
netdev@vger.kernel.org
Subject: [PATCH 3/4] venetdev: support common venet netdev routines
Date: Tue, 10 Nov 2009 17:28:05 -0500 [thread overview]
Message-ID: <20091110222805.24100.59528.stgit@mimic.site> (raw)
In-Reply-To: <20091110222632.24100.14884.stgit@mimic.site>
This patch breaks out common netdev routines that allow
a device to pass venetdev pointer as opposed to assuming
it is the priv member of the netdevice.
Signed-off-by: Patrick Mullaney <pmullaney@novell.com>
---
kernel/vbus/devices/venet/device.c | 43 ++++++++++++++++++++++++++-----
kernel/vbus/devices/venet/venetdevice.h | 5 ++++
2 files changed, 41 insertions(+), 7 deletions(-)
diff --git a/kernel/vbus/devices/venet/device.c b/kernel/vbus/devices/venet/device.c
index d49ba7f..9fd94ca 100644
--- a/kernel/vbus/devices/venet/device.c
+++ b/kernel/vbus/devices/venet/device.c
@@ -228,9 +228,8 @@ venetdev_txq_notify_dec(struct venetdev *priv)
*/
int
-venetdev_netdev_open(struct net_device *dev)
+venetdev_open(struct venetdev *priv)
{
- struct venetdev *priv = netdev_priv(dev);
unsigned long flags;
BUG_ON(priv->netif.link);
@@ -260,7 +259,7 @@ venetdev_netdev_open(struct net_device *dev)
priv->netif.link = true;
if (!priv->vbus.link)
- netif_carrier_off(dev);
+ netif_carrier_off(priv->netif.dev);
spin_unlock_irqrestore(&priv->lock, flags);
@@ -268,9 +267,16 @@ venetdev_netdev_open(struct net_device *dev)
}
int
-venetdev_netdev_stop(struct net_device *dev)
+venetdev_netdev_open(struct net_device *dev)
{
struct venetdev *priv = netdev_priv(dev);
+
+ return venetdev_open(priv);
+}
+
+int
+venetdev_stop(struct venetdev *priv)
+{
unsigned long flags;
int needs_stop = false;
@@ -296,6 +302,14 @@ venetdev_netdev_stop(struct net_device *dev)
return 0;
}
+int
+venetdev_netdev_stop(struct net_device *dev)
+{
+ struct venetdev *priv = netdev_priv(dev);
+
+ return venetdev_stop(priv);
+}
+
/*
* Configuration changes (passed on by ifconfig)
*/
@@ -1541,10 +1555,10 @@ venetdev_apply_backpressure(struct venetdev *priv)
* the netif flow control is still managed by the actual consumer,
* thereby avoiding the creation of an extra servo-loop to the equation.
*/
+
int
-venetdev_netdev_tx(struct sk_buff *skb, struct net_device *dev)
+venetdev_xmit(struct sk_buff *skb, struct venetdev *priv)
{
- struct venetdev *priv = netdev_priv(dev);
struct ioq *ioq = NULL;
unsigned long flags;
@@ -1585,6 +1599,15 @@ flowcontrol:
return NETDEV_TX_BUSY;
}
+int
+venetdev_netdev_tx(struct sk_buff *skb, struct net_device *dev)
+{
+ struct venetdev *priv = netdev_priv(dev);
+
+ return venetdev_xmit(skb, priv);
+}
+
+
/*
* Ioctl commands
*/
@@ -1599,10 +1622,16 @@ venetdev_netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
* Return statistics to the caller
*/
struct net_device_stats *
+venetdev_get_stats(struct venetdev *priv)
+{
+ return &priv->netif.stats;
+}
+
+struct net_device_stats *
venetdev_netdev_stats(struct net_device *dev)
{
struct venetdev *priv = netdev_priv(dev);
- return &priv->netif.stats;
+ return venetdev_get_stats(priv);
}
/*
diff --git a/kernel/vbus/devices/venet/venetdevice.h b/kernel/vbus/devices/venet/venetdevice.h
index 9a60a2e..71c9f0f 100644
--- a/kernel/vbus/devices/venet/venetdevice.h
+++ b/kernel/vbus/devices/venet/venetdevice.h
@@ -142,6 +142,11 @@ int venetdev_netdev_ioctl(struct net_device *dev, struct ifreq *rq,
int cmd);
struct net_device_stats *venetdev_netdev_stats(struct net_device *dev);
+int venetdev_open(struct venetdev *dev);
+int venetdev_stop(struct venetdev *dev);
+int venetdev_xmit(struct sk_buff *skb, struct venetdev *dev);
+struct net_device_stats *venetdev_get_stats(struct venetdev *dev);
+
static inline void venetdev_netdev_unregister(struct venetdev *priv)
{
if (priv->netif.enabled) {
next prev parent reply other threads:[~2009-11-10 22:28 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-10 22:27 [PATCH 0/4] vbus: venet macvlan support Patrick Mullaney
2009-11-10 22:27 ` [PATCH 1/4] macvlan: derived from Arnd Bergmann's patch for macvtap Patrick Mullaney
2009-11-10 22:27 ` [PATCH 2/4] macvlan: allow in-kernel modules to create and manage macvlan devices Patrick Mullaney
2009-11-11 15:29 ` Patrick McHardy
2009-11-12 18:05 ` [PATCH] netdevice: provide common routine for macvlan and vlan operstate management Patrick Mullaney
2009-11-12 18:21 ` Patrick McHardy
2009-11-13 19:55 ` [PATCH 0/3] macvlan: support for guest vm direct rx/tx Patrick Mullaney
2009-11-13 19:55 ` [PATCH 1/3] netdevice: provide common routine for macvlan and vlan operstate management Patrick Mullaney
2009-11-27 13:09 ` Arnd Bergmann
2009-11-13 19:55 ` [PATCH 2/3] macvlan: derived from Arnd Bergmann's patch for macvtap Patrick Mullaney
2009-11-13 19:55 ` [PATCH 3/3] macvlan: allow in-kernel modules to create and manage macvlan devices Patrick Mullaney
2009-11-27 22:14 ` Arnd Bergmann
2009-11-27 22:19 ` Arnd Bergmann
2009-11-13 21:27 ` [PATCH 0/3] macvlan: support for guest vm direct rx/tx Stephen Hemminger
2009-11-27 23:43 ` Arnd Bergmann
2009-11-28 0:19 ` David Miller
2009-11-28 5:38 ` Stephen Hemminger
2009-11-28 6:58 ` David Miller
2009-11-10 22:28 ` Patrick Mullaney [this message]
2009-11-10 22:28 ` [PATCH 4/4] venet-macvlan: add new driver to connect a venet to a macvlan netdevice Patrick Mullaney
2009-11-11 15:36 ` Patrick McHardy
2009-11-12 15:44 ` [PATCH 0/4] vbus: venet macvlan support Gregory Haskins
2009-11-12 15:53 ` Patrick McHardy
2009-11-12 15:54 ` Gregory Haskins
2009-11-12 15:59 ` Patrick McHardy
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=20091110222805.24100.59528.stgit@mimic.site \
--to=pmullaney@novell.com \
--cc=alacrityvm-devel@lists.sourceforge.net \
--cc=arnd@arndb.de \
--cc=bridge@lists.linux-foundation.org \
--cc=evb@yahoogroups.com \
--cc=kaber@trash.net \
--cc=linux-kernel@vger.kernel.org \
--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).