WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] add get_drvinfo() support for netloop

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] add get_drvinfo() support for netloop
From: Laszlo Ersek <lersek@xxxxxxxxxx>
Date: Fri, 22 Oct 2010 09:57:31 +0200
Delivery-date: Fri, 22 Oct 2010 00:56:33 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100921 Fedora/3.1.4-1.fc13 Lightning/1.0b3pre Thunderbird/3.1.4
The following patch for the 2.6.18 tree adds get_drvinfo() ("ethtool -i")
support to netloop.

Example:

  # ethtool  -i vif0.3
  driver: netloop
  version: 
  firmware-version: 
  bus-info: vif-0-3

  # ethtool  -i veth3
  driver: netloop
  version: 
  firmware-version: 
  bus-info: vif-0-3

Signed-off-by: Laszlo Ersek <lersek@xxxxxxxxxx>
---
 drivers/xen/netback/loopback.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/xen/netback/loopback.c b/drivers/xen/netback/loopback.c
index 6c45fae..d110f63 100644
--- a/drivers/xen/netback/loopback.c
+++ b/drivers/xen/netback/loopback.c
@@ -62,6 +62,7 @@ MODULE_PARM_DESC(nloopbacks, "Number of netback-loopback 
devices to create");
 struct net_private {
        struct net_device *loopback_dev;
        struct net_device_stats stats;
+       int loop_idx;
 };
 
 static int loopback_open(struct net_device *dev)
@@ -181,8 +182,17 @@ static struct net_device_stats *loopback_get_stats(struct 
net_device *dev)
        return &np->stats;
 }
 
+static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
+{
+       strcpy(info->driver, "netloop");
+       snprintf(info->bus_info, ETHTOOL_BUSINFO_LEN, "vif-0-%d",
+                ((struct net_private *)netdev_priv(dev))->loop_idx);
+}
+
 static struct ethtool_ops network_ethtool_ops =
 {
+       .get_drvinfo = get_drvinfo,
+
        .get_tx_csum = ethtool_op_get_tx_csum,
        .set_tx_csum = ethtool_op_set_tx_csum,
        .get_sg = ethtool_op_get_sg,
@@ -200,11 +210,13 @@ static void loopback_set_multicast_list(struct net_device 
*dev)
 {
 }
 
-static void loopback_construct(struct net_device *dev, struct net_device *lo)
+static void loopback_construct(struct net_device *dev, struct net_device *lo,
+                              int loop_idx)
 {
        struct net_private *np = netdev_priv(dev);
 
        np->loopback_dev     = lo;
+       np->loop_idx         = loop_idx;
 
        dev->open            = loopback_open;
        dev->stop            = loopback_close;
@@ -250,8 +262,8 @@ static int __init make_loopback(int i)
        if (!dev2)
                goto fail_netdev2;
 
-       loopback_construct(dev1, dev2);
-       loopback_construct(dev2, dev1);
+       loopback_construct(dev1, dev2, i);
+       loopback_construct(dev2, dev1, i);
 
        /*
         * Initialise a dummy MAC address for the 'dummy backend' interface. We
-- 
1.7.2.3


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>