All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russ Blaine <russell.blaine@sun.com>
To: James Harper <james.harper@bendigoit.com.au>
Cc: Mark Johnson <Mark.Johnson@sun.com>, xen-devel@lists.xensource.com
Subject: Re: RE: GPLPV: Respecting SG capability
Date: Thu, 18 Jun 2009 15:31:54 -0700	[thread overview]
Message-ID: <4A3AC05A.3020209@sun.com> (raw)
In-Reply-To: <AEC6C66638C05B468B556EA548C1A77D0162D2A3@trantor>

[-- Attachment #1: Type: text/plain, Size: 975 bytes --]

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@sun.com

[-- Attachment #2: xennet-nosg.diff --]
[-- Type: text/plain, Size: 1811 bytes --]

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++)
   {

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

  reply	other threads:[~2009-06-18 22:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-27 18:32 GPLPV: Respecting SG capability Russ Blaine
2009-04-28  0:51 ` James Harper
2009-06-18 22:31   ` Russ Blaine [this message]
2009-06-19 10:53     ` James Harper
2009-06-19 12:39     ` James Harper
2009-06-19 12:45       ` David Edmondson

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=4A3AC05A.3020209@sun.com \
    --to=russell.blaine@sun.com \
    --cc=Mark.Johnson@sun.com \
    --cc=james.harper@bendigoit.com.au \
    --cc=xen-devel@lists.xensource.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.