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
|