win-pvdrivers

changeset 241:dce3943a11ec

Updated the xennet tx code to no longer use windows sg lists. Can't get them working on 64 bit.
author James Harper <james.harper@bendigoit.com.au>
date Mon Mar 31 22:08:19 2008 +1100 (2008-03-31)
parents d5adfce6f643
children 3c2542b7d52d
files common.inc xennet/xennet.c xennet/xennet.inx xennet/xennet_tx.c
line diff
     1.1 --- a/common.inc	Sun Mar 30 00:03:49 2008 +1100
     1.2 +++ b/common.inc	Mon Mar 31 22:08:19 2008 +1100
     1.3 @@ -1,4 +1,4 @@
     1.4 -VERSION=0.8.7.1
     1.5 +VERSION=0.8.7.5
     1.6  TARGETPATH=..\Target\$(DDK_TARGET_OS)
     1.7  KMDF_VERSION=1
     1.8  !IF $(_NT_TOOLS_VERSION) > 0x700
     2.1 --- a/xennet/xennet.c	Sun Mar 30 00:03:49 2008 +1100
     2.2 +++ b/xennet/xennet.c	Mon Mar 31 22:08:19 2008 +1100
     2.3 @@ -363,9 +363,10 @@ XenNet_Init(
     2.4    }
     2.5  
     2.6    NdisMSetAttributesEx(xi->adapter_handle, (NDIS_HANDLE) xi,
     2.7 -    0, (NDIS_ATTRIBUTE_DESERIALIZE | NDIS_ATTRIBUTE_BUS_MASTER),
     2.8 +    0, NDIS_ATTRIBUTE_DESERIALIZE, // | NDIS_ATTRIBUTE_BUS_MASTER),
     2.9      NdisInterfaceInternal);
    2.10  
    2.11 +#if 0
    2.12    if (xi->config_sg)
    2.13    {
    2.14      status = NdisMInitializeScatterGatherDma(xi->adapter_handle, TRUE, xi->config_max_pkt_size);
    2.15 @@ -376,6 +377,8 @@ XenNet_Init(
    2.16        goto err;
    2.17      }
    2.18    }
    2.19 +#endif
    2.20 +
    2.21    WDF_OBJECT_ATTRIBUTES_INIT(&wdf_attrs);
    2.22  
    2.23    status = WdfDeviceMiniportCreate(WdfGetDriver(), &wdf_attrs, xi->fdo,
     3.1 --- a/xennet/xennet.inx	Sun Mar 30 00:03:49 2008 +1100
     3.2 +++ b/xennet/xennet.inx	Mon Mar 31 22:08:19 2008 +1100
     3.3 @@ -63,7 +63,7 @@ HKR, Ndi\Params\ChecksumOffload\enum, 0,
     3.4  HKR, Ndi\Params\ChecksumOffload\enum, 1, , "Enabled"
     3.5  
     3.6  HKR, Ndi\Params\LargeSendOffload, ParamDesc, , "Large Send Offload"
     3.7 -HKR, Ndi\Params\LargeSendOffload, default, , "65535"
     3.8 +HKR, Ndi\Params\LargeSendOffload, default, , "61440"
     3.9  HKR, Ndi\Params\LargeSendOffload, type, , "enum"
    3.10  HKR, Ndi\Params\LargeSendOffload\enum, 0, , "Disabled"
    3.11  HKR, Ndi\Params\LargeSendOffload\enum, 8192, , "8192"
     4.1 --- a/xennet/xennet_tx.c	Sun Mar 30 00:03:49 2008 +1100
     4.2 +++ b/xennet/xennet_tx.c	Mon Mar 31 22:08:19 2008 +1100
     4.3 @@ -133,32 +133,36 @@ typedef struct
     4.4  static VOID
     4.5  XenNet_BuildPageList(PNDIS_PACKET packet, page_element_t *elements, PUSHORT num_elements)
     4.6  {
     4.7 -  PSCATTER_GATHER_LIST sg_list;
     4.8 -  USHORT sg_num;
     4.9 -  USHORT element_num;
    4.10 -  PFN_NUMBER pfn;
    4.11 -  USHORT offset;
    4.12 -  USHORT remaining;
    4.13 -  USHORT pages;
    4.14 +  USHORT element_num = 0;
    4.15 +  UINT offset;
    4.16 +  PVOID addr;
    4.17 +  UINT remaining;
    4.18 +  ULONG pages;
    4.19    USHORT page;
    4.20 +  PMDL buffer;
    4.21 +  PPFN_NUMBER pfns;
    4.22  
    4.23 -  sg_list = NDIS_PER_PACKET_INFO_FROM_PACKET(packet, ScatterGatherListPacketInfo);
    4.24 -  for (sg_num = 0, element_num = 0; sg_num < sg_list->NumberOfElements; sg_num++)
    4.25 +  NdisQueryPacket(packet, NULL, NULL, &buffer, NULL);
    4.26 +
    4.27 +//  sg_list = NDIS_PER_PACKET_INFO_FROM_PACKET(packet, ScatterGatherListPacketInfo);
    4.28 +  while (buffer != NULL)
    4.29    {
    4.30 -    pfn = (PFN_NUMBER)(sg_list->Elements[sg_num].Address.QuadPart >> PAGE_SHIFT);
    4.31 -    remaining = (USHORT)sg_list->Elements[sg_num].Length;
    4.32 -    pages = (USHORT)ADDRESS_AND_SIZE_TO_SPAN_PAGES(sg_list->Elements[sg_num].Address.QuadPart, remaining);
    4.33 -    offset = (USHORT)sg_list->Elements[sg_num].Address.LowPart & (PAGE_SIZE - 1);
    4.34 +    addr = MmGetSystemAddressForMdlSafe(buffer, NormalPagePriority);
    4.35 +    offset = MmGetMdlByteOffset(buffer);
    4.36 +    remaining = MmGetMdlByteCount(buffer);
    4.37 +    pages = ADDRESS_AND_SIZE_TO_SPAN_PAGES(MmGetMdlVirtualAddress(buffer), remaining);
    4.38 +    pfns = MmGetMdlPfnArray(buffer);
    4.39      for (page = 0; page < pages; page++, element_num++)
    4.40      {
    4.41        ASSERT(element_num < *num_elements);
    4.42 -      elements[element_num].pfn = pfn + page;
    4.43 -      elements[element_num].offset = offset;
    4.44 -      elements[element_num].length = min(remaining, PAGE_SIZE - offset);
    4.45 +      elements[element_num].pfn = pfns[page];
    4.46 +      elements[element_num].offset = (USHORT)offset;
    4.47 +      elements[element_num].length = (USHORT)min(remaining, PAGE_SIZE - offset);
    4.48        offset = 0;
    4.49 -      remaining = remaining - (USHORT)elements[element_num].length;
    4.50 +      remaining -= elements[element_num].length;
    4.51      }
    4.52      ASSERT(remaining == 0);
    4.53 +    NdisGetNextBuffer(buffer, &buffer);
    4.54    }
    4.55    *num_elements = element_num;
    4.56  }