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

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 7/10] Add support for netfront/netback acceleration drivers
From: Kieran Mansley <kmansley@xxxxxxxxxxxxxx>
Date: Fri, 01 Dec 2006 17:20:18 +0000
Delivery-date: Fri, 01 Dec 2006 09:24:15 -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.  

xenbus_map_ring_device 
 - New helper function akin to xenbus_map_ring[_valloc] which instead
 of mapping into the current address space instead maps it for access
 by a device using DMA.  Also includes its unmap equivalent.


Add xenbus_map_ring_device

diff -r b590bc8eef11 linux-2.6-xen-
sparse/drivers/xen/xenbus/xenbus_backend_client.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_backend_client.c
Fri Dec 01 15:57:01 2006 +0000
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_backend_client.c
Fri Dec 01 15:57:44 2006 +0000
@@ -4,6 +4,7 @@
  * driver.
  *
  * Copyright (C) 2005-2006 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 version
2
@@ -69,6 +70,32 @@ EXPORT_SYMBOL_GPL(xenbus_map_ring_valloc
 EXPORT_SYMBOL_GPL(xenbus_map_ring_valloc);
 
 
+int xenbus_map_ring_device(struct xenbus_device *dev,  
+                           int gnt_ref, grant_handle_t *handle,
+                           u64 *dev_bus_addr)
+{
+       struct gnttab_map_grant_ref op;
+
+       gnttab_set_map_op(&op, 0, GNTMAP_device_map,
+                         gnt_ref, dev->otherend_id);
+
+       BUG_ON(HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, &op, 1));
+
+       if (op.status != GNTST_okay) {
+               xenbus_dev_fatal(dev, op.status,
+                                "mapping in shared page %d from domain %d",
+                                gnt_ref, dev->otherend_id);
+               return op.status;
+       }
+
+       *handle = op.handle;
+        *dev_bus_addr = op.dev_bus_addr;
+
+       return op.status;
+}
+EXPORT_SYMBOL_GPL(xenbus_map_ring_device);
+
+
 int xenbus_map_ring(struct xenbus_device *dev, int gnt_ref,
                   grant_handle_t *handle, void *vaddr)
 {
@@ -132,6 +159,26 @@ int xenbus_unmap_ring(struct xenbus_devi
 }
 EXPORT_SYMBOL_GPL(xenbus_unmap_ring);
 
+
+int xenbus_unmap_ring_device(struct xenbus_device *dev,
+                             grant_handle_t handle, u64 dev_bus_addr)
+{
+        struct gnttab_unmap_grant_ref op;
+
+       gnttab_set_unmap_op(&op, 0, GNTMAP_device_map, handle);
+        op.dev_bus_addr = dev_bus_addr;
+       BUG_ON(HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1));
+
+       if (op.status != GNTST_okay)
+               xenbus_dev_error(dev, op.status,
+                                "unmapping page at handle %d error %d",
+                                handle, op.status);
+
+       return op.status;
+}
+EXPORT_SYMBOL_GPL(xenbus_unmap_ring_device);
+
+
 int xenbus_dev_is_online(struct xenbus_device *dev)
 {
        int rc, val;
diff -r b590bc8eef11 linux-2.6-xen-sparse/include/xen/xenbus.h
--- a/linux-2.6-xen-sparse/include/xen/xenbus.h Fri Dec 01 15:57:01 2006
+0000
+++ b/linux-2.6-xen-sparse/include/xen/xenbus.h Fri Dec 01 15:57:12 2006
+0000
@@ -233,11 +233,17 @@ int xenbus_grant_ring(struct xenbus_devi
  * Returns 0 on success, and GNTST_* (see
xen/include/interface/grant_table.h)
  * or -ENOMEM on error. If an error is returned, device will switch to
  * XenbusStateClosing and the error message will be saved in XenStore.
+ *
+ * The xenbus_map_ring_device() variant maps the grant for access by a
+ * device using GNTMAP_device_map flag and does not map it into the
+ * host's address space
  */
 struct vm_struct *xenbus_map_ring_valloc(struct xenbus_device *dev,
                                         int gnt_ref);
+int xenbus_map_ring_device(struct xenbus_device *dev, int gnt_ref,
+                           grant_handle_t *handle, u64 *dev_bus_addr);
 int xenbus_map_ring(struct xenbus_device *dev, int gnt_ref,
-                          grant_handle_t *handle, void *vaddr);
+                    grant_handle_t *handle, void *vaddr);
 
 
 /**
@@ -248,6 +254,8 @@ int xenbus_map_ring(struct xenbus_device
  * (see xen/include/interface/grant_table.h).
  */
 int xenbus_unmap_ring_vfree(struct xenbus_device *dev, struct vm_struct
*);
+int xenbus_unmap_ring_device(struct xenbus_device *dev,
+                             grant_handle_t handle, u64 dev_bus_addr);
 int xenbus_unmap_ring(struct xenbus_device *dev,
                      grant_handle_t handle, void *vaddr);
 



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

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