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 10/10] Add support for netfront/netback acceleration

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 10/10] Add support for netfront/netback acceleration drivers
From: Kieran Mansley <kmansley@xxxxxxxxxxxxxx>
Date: Fri, 01 Dec 2006 17:20:30 +0000
Delivery-date: Fri, 01 Dec 2006 09:26:18 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
This set of patches adds the support for acceleration plugins to the
netfront/netback drivers.  These plugins are intended to support
virtualisable network hardware that can be directly accessed from the
guest, bypassing dom0.

This is in response to the RFC we posted to xen-devel with an outline
of our approach at the end of September.

To follow will be another set of patches to provide our hardware
specific drivers and plugins.  The above set are all hardware-agnostic
and so of wider relevance.

Signed-off-by: kmansley@xxxxxxxxxxxxxx

The following describes each of the patches that are attached.  

backend_accel
 - Add support to netback to hook into an accelerated network plugin

Backend net driver acceleration

diff -r cc0b5b5660a8 linux-2.6-xen-sparse/drivers/xen/netback/common.h
--- a/linux-2.6-xen-sparse/drivers/xen/netback/common.h Fri Dec 01
16:41:29 2006 +0000
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/common.h Fri Dec 01
16:41:29 2006 +0000
@@ -104,6 +104,31 @@ typedef struct netif_st {
        wait_queue_head_t waiting_to_free;
 } netif_t;
 
+
+#include <xen/xenbus.h>
+struct netback_accel_hooks {
+        int  (*probe)(struct xenbus_device *dev);
+};
+
+/* Structure to track the state of a netback accelerator plugin */
+struct netback_accelerator {
+        int id;
+        char *frontend;
+        struct netback_accel_hooks *hooks;
+        struct netback_accelerator *next;
+};
+extern void netback_connect_accelerator(int id, const char *frontend, 
+                                        struct netback_accel_hooks
*hooks);
+
+struct backend_info {
+       struct xenbus_device *dev;
+       netif_t *netif;
+       enum xenbus_state frontend_state;
+        void *netback_accel_priv;
+        struct netback_accelerator *accelerator;
+};
+
+
 #define NET_TX_RING_SIZE __RING_SIZE((netif_tx_sring_t *)0, PAGE_SIZE)
 #define NET_RX_RING_SIZE __RING_SIZE((netif_rx_sring_t *)0, PAGE_SIZE)
 
diff -r cc0b5b5660a8 linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Fri Dec 01
16:41:29 2006 +0000
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Fri Dec 01
16:42:16 2006 +0000
@@ -1,6 +1,7 @@
 /*  Xenbus code for netif backend
     Copyright (C) 2005 Rusty Russell <rusty@xxxxxxxxxxxxxxx>
     Copyright (C) 2005 XenSource Ltd
+    Copyright (c) 2006 Solarflare Communications, Inc.
 
     This program is free software; you can redistribute it and/or
modify
     it under the terms of the GNU General Public License as published
by
@@ -28,11 +29,52 @@
     printk("netback/xenbus (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__,
##args)
 #endif
 
-struct backend_info {
-       struct xenbus_device *dev;
-       netif_t *netif;
-       enum xenbus_state frontend_state;
-};
+static struct netback_accelerator *accelerators = NULL;
+
+static int netback_accelerator_tell_backend(struct device *dev, void
*arg){
+        struct netback_accelerator *accelerator = 
+                (struct netback_accelerator *)arg;
+        struct xenbus_device *xendev = to_xenbus_device(dev);
+
+        if(!strcmp("vif", xendev->devicetype)){
+                struct backend_info *be = xendev->dev.driver_data;
+
+                be->accelerator = accelerator;
+                be->accelerator->hooks->probe(xendev);
+        }
+        return 0;
+}
+
+
+static void 
+netback_accelerator_tell_backends(struct netback_accelerator
*accelerator)
+{
+        xenbus_for_each_backend(accelerator,
netback_accelerator_tell_backend);
+}
+
+
+void netback_connect_accelerator(int id, const char *frontend, 
+                                 struct netback_accel_hooks *hooks)
+{
+        /* TODO make accel_hooks a list of available acceleration
plugins */
+        struct netback_accelerator *new_accelerator = 
+                kzalloc(sizeof(struct netback_accelerator),
GFP_KERNEL);
+
+        if(new_accelerator){
+                new_accelerator->id = id;
+                new_accelerator->frontend = kzalloc(strlen(frontend),
GFP_KERNEL);
+                strcpy(new_accelerator->frontend, frontend);
+                new_accelerator->hooks = hooks;
+                
+                new_accelerator->next = accelerators;
+                accelerators = new_accelerator;
+                
+                /* tell existing backends about new plugin */
+                netback_accelerator_tell_backends(new_accelerator);
+        }
+}
+EXPORT_SYMBOL_GPL(netback_connect_accelerator);
+
 
 static int connect_rings(struct backend_info *);
 static void connect(struct backend_info *);
@@ -119,6 +161,12 @@ static int netback_probe(struct xenbus_d
                xenbus_dev_fatal(dev, err, "completing transaction");
                goto fail;
        }
+
+        be->accelerator = accelerators;
+        if(be->accelerator && be->accelerator->hooks
+           && be->accelerator->hooks->probe){
+                be->accelerator->hooks->probe(dev);
+        }
 
        err = xenbus_switch_state(dev, XenbusStateInitWait);
        if (err)



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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 10/10] Add support for netfront/netback acceleration drivers, Kieran Mansley <=