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

Re: [Xen-devel] RE: GPLPV: Respecting SG capability

To: James Harper <james.harper@xxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] RE: GPLPV: Respecting SG capability
From: Russ Blaine <russell.blaine@xxxxxxx>
Date: Thu, 18 Jun 2009 15:31:54 -0700
Cc: Mark Johnson <Mark.Johnson@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 18 Jun 2009 15:48:36 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <AEC6C66638C05B468B556EA548C1A77D0162D2A3@trantor>
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>
References: <49F5FA5A.7060204@xxxxxxx> <AEC6C66638C05B468B556EA548C1A77D0162D2A3@trantor>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.17 (X11/20081023)
James Harper wrote:
We may be able to simply tell Windows that we don't support SG and it
may coalesce the buffers itself. I will do some testing of that before I
consider other workarounds.

As I understand it, this isn't possible to do - Windows insists on handing us several buffers per packet.

Attached is a patch against the current source - it would be helpful to have this in the upstream source so that these drivers work out of the box on Solaris dom0 (albeit with scatter/gather disabled in the frontend). A future improvement on this work will be to avoid constructing header_buf in this case, but this gets things working well enough. Another piece of future work will be to have the net driver disable sg if the backend doesn't have "feature-sg" set to 1 in xenstore.

I can do a push if so desired, just let me know.

Thanks,
- Russ

--

-----------------------------------------------------
Russ Blaine | Solaris Kernel | russell.blaine@xxxxxxx
diff -r d40c760a4f6b xennet/xennet.h
--- a/xennet/xennet.h   Tue Jun 09 13:42:03 2009 +1000
+++ b/xennet/xennet.h   Thu Jun 18 15:26:27 2009 -0700
@@ -279,6 +279,7 @@
   ULONG tx_hb_free;
   ULONG tx_hb_list[TX_HEADER_BUFFERS];
   shared_buffer_t tx_hbs[TX_HEADER_BUFFERS];
+  shared_buffer_t tx_sendbuf;
   KDPC tx_dpc;
 
   /* rx_related - protected by rx_lock */
diff -r d40c760a4f6b xennet/xennet_tx.c
--- a/xennet/xennet_tx.c        Tue Jun 09 13:42:03 2009 +1000
+++ b/xennet/xennet_tx.c        Thu Jun 18 15:26:27 2009 -0700
@@ -231,7 +231,30 @@
   chunks++;
   xi->tx_ring_free--;
   tx0->id = 0xFFFF;
-  if (header_buf)
+  if (xi->config_sg == 0) {
+      ULONG len;
+      ULONG offset = 0;
+      PNDIS_BUFFER buf;
+
+      buf = pi.first_buffer;
+      while (buf) {
+          PUCHAR src_addr;
+
+          NdisQueryBufferSafe(buf, &src_addr, &len, NormalPagePriority);
+
+          memcpy((PUCHAR)xi->tx_sendbuf.virtual + offset, src_addr, len);
+          offset += len;
+
+          NdisGetNextBuffer(buf, &buf);
+      }
+
+      tx0->gref = (grant_ref_t)xi->tx_sendbuf.logical.QuadPart >> PAGE_SHIFT;
+      tx0->offset = (USHORT)xi->tx_sendbuf.logical.LowPart & (PAGE_SIZE - 1);
+      ASSERT(offset == pi.total_length);
+      tx0->size = (uint16_t)offset;
+      tx0->flags &= ~NETTXF_more_data;
+      sg_element = sg->NumberOfElements; 
+  } else if (header_buf)
   {
     ULONG remaining = pi.header_length;
     ASSERT(pi.header_length < TX_HEADER_BUFFER_SIZE);
@@ -587,6 +610,9 @@
   if (i == 0)
     KdPrint((__DRIVER_NAME "     Unable to allocate any SharedMemory 
buffers\n"));
 
+  xi->tx_sendbuf.virtual = xi->tx_hbs[0].virtual;
+  xi->tx_sendbuf.logical = xi->tx_hbs[0].logical;
+
   xi->tx_id_free = 0;
   for (i = 0; i < NET_TX_RING_SIZE; i++)
   {
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>