win-pvdrivers

changeset 78:63da9239cfe2

Fixed dpc code so that xennet stuff all runs at DISPATCH_LEVEL rather than DIRQL, as is required by all the NDIS code.
Minor bug fixes for xennet. ping now works, although it takes a while for arp to take place for some reason...
author James Harper <james.harper@bendigoit.com.au>
date Sun Dec 30 14:33:08 2007 +1100 (2007-12-30)
parents b9b4b731f890
children 17319a4920eb
files xennet/sources xennet/xennet.c xenpci/evtchn.c xenpci/sources xenpci/xenpci.h
line diff
     1.1 --- a/xennet/sources	Fri Dec 28 23:21:49 2007 +1100
     1.2 +++ b/xennet/sources	Sun Dec 30 14:33:08 2007 +1100
     1.3 @@ -1,7 +1,7 @@
     1.4  TARGETNAME=XENNET
     1.5  TARGETTYPE=DRIVER
     1.6  TARGETPATH=..\Target\$(DDK_TARGET_OS)
     1.7 -VERSION=0.5.0.8
     1.8 +VERSION=0.5.0.27
     1.9  KMDF_VERSION=1
    1.10  MSC_WARNING_LEVEL=/W4
    1.11  INF_NAME=xennet
     2.1 --- a/xennet/xennet.c	Fri Dec 28 23:21:49 2007 +1100
     2.2 +++ b/xennet/xennet.c	Sun Dec 30 14:33:08 2007 +1100
     2.3 @@ -163,9 +163,12 @@ XenNet_TxBufferGC(struct xennet_info *xi
     2.4    unsigned short id;
     2.5    PNDIS_PACKET pkt;
     2.6    PMDL pmdl;
     2.7 +  int notify;
     2.8  
     2.9    ASSERT(xi->connected);
    2.10  
    2.11 +  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    2.12 +
    2.13    do {
    2.14      prod = xi->tx.sring->rsp_prod;
    2.15      KeMemoryBarrier(); /* Ensure we see responses up to 'rp'. */
    2.16 @@ -186,7 +189,7 @@ XenNet_TxBufferGC(struct xennet_info *xi
    2.17  
    2.18        /* free linearized data page */
    2.19        pmdl = *(PMDL *)pkt->MiniportReservedEx;
    2.20 -      NdisFreeMemory(MmGetMdlVirtualAddress(pmdl), 0, 0);
    2.21 +      NdisFreeMemory(MmGetMdlVirtualAddress(pmdl), 0, 0); // <= DISPATCH_LEVEL
    2.22        IoFreeMdl(pmdl);
    2.23  
    2.24        xi->stat_tx_ok++;
    2.25 @@ -207,10 +210,19 @@ XenNet_TxBufferGC(struct xennet_info *xi
    2.26        prod + ((xi->tx.sring->req_prod - prod) >> 1) + 1;
    2.27      KeMemoryBarrier();
    2.28    } while ((cons == prod) && (prod != xi->tx.sring->rsp_prod));
    2.29 -
    2.30 +/*
    2.31 +  RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&xi->tx, notify);
    2.32 +  if (notify)
    2.33 +  {
    2.34 +    xi->XenInterface.EvtChn_Notify(xi->XenInterface.InterfaceHeader.Context,
    2.35 +      xi->event_channel);
    2.36 +  }
    2.37 +*/
    2.38    /* if queued packets, send them now?
    2.39    network_maybe_wake_tx(dev); */
    2.40  
    2.41 +  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    2.42 +
    2.43    return NDIS_STATUS_SUCCESS;
    2.44  }
    2.45  
    2.46 @@ -227,6 +239,8 @@ XenNet_AllocRXBuffers(struct xennet_info
    2.47    NDIS_STATUS status;
    2.48    PVOID start;
    2.49  
    2.50 +  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    2.51 +
    2.52    batch_target = xi->rx_target - (req_prod - xi->rx.rsp_cons);
    2.53    for (i = 0; i < batch_target; i++)
    2.54    {
    2.55 @@ -281,9 +295,12 @@ XenNet_AllocRXBuffers(struct xennet_info
    2.56        xi->event_channel);
    2.57    }
    2.58  
    2.59 +  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    2.60 +
    2.61    return NDIS_STATUS_SUCCESS;
    2.62  }
    2.63  
    2.64 +// Called at DIRQL
    2.65  static NDIS_STATUS
    2.66  XenNet_RxBufferCheck(struct xennet_info *xi)
    2.67  {
    2.68 @@ -294,6 +311,9 @@ XenNet_RxBufferCheck(struct xennet_info 
    2.69    PVOID buff_va;
    2.70    UINT buff_len;
    2.71    UINT tot_buff_len;
    2.72 +  int moretodo;
    2.73 +
    2.74 +  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    2.75  
    2.76    ASSERT(xi->connected);
    2.77  
    2.78 @@ -308,6 +328,8 @@ XenNet_RxBufferCheck(struct xennet_info 
    2.79        if (rxrsp->status == NETIF_RSP_NULL)
    2.80          continue;
    2.81  
    2.82 +      KdPrint((__DRIVER_NAME "     Got a packet\n"));
    2.83 +
    2.84        pkt = xi->rx_pkts[rxrsp->id];
    2.85        xi->rx_pkts[rxrsp->id] = NULL;
    2.86        xi->XenInterface.GntTbl_EndAccess(xi->XenInterface.InterfaceHeader.Context,
    2.87 @@ -324,11 +346,15 @@ XenNet_RxBufferCheck(struct xennet_info 
    2.88        NDIS_SET_PACKET_STATUS(pkt, NDIS_STATUS_SUCCESS);
    2.89  
    2.90        /* just indicate 1 packet for now */
    2.91 +      KdPrint((__DRIVER_NAME "     Indicating Received\n"));
    2.92        NdisMIndicateReceivePacket(xi->adapter_handle, &pkt, 1);
    2.93 +      KdPrint((__DRIVER_NAME "     Done Indicating Received\n"));
    2.94      }
    2.95  
    2.96      xi->rx.rsp_cons = prod;
    2.97  
    2.98 +    RING_FINAL_CHECK_FOR_RESPONSES(&xi->rx, moretodo);
    2.99 +#if 0
   2.100      /*
   2.101       * Set a new event, then check for race with update of rx_cons.
   2.102       * Note that it is essential to schedule a callback, no matter
   2.103 @@ -341,13 +367,20 @@ XenNet_RxBufferCheck(struct xennet_info 
   2.104        prod + ((xi->rx.sring->req_prod - prod) >> 1) + 1;
   2.105      KeMemoryBarrier();
   2.106    } while ((cons == prod) && (prod != xi->rx.sring->rsp_prod));
   2.107 +#endif
   2.108 +  } while (moretodo);
   2.109  
   2.110    /* Give netback more buffers */
   2.111    XenNet_AllocRXBuffers(xi);
   2.112  
   2.113 +  //xi->rx.sring->rsp_event = xi->rx.rsp_cons + 1;
   2.114 +
   2.115 +  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   2.116 +
   2.117    return NDIS_STATUS_SUCCESS;
   2.118  }
   2.119  
   2.120 +// Called at DIRQL
   2.121  static BOOLEAN
   2.122  XenNet_Interrupt(
   2.123    PKINTERRUPT Interrupt,
   2.124 @@ -359,6 +392,8 @@ XenNet_Interrupt(
   2.125  
   2.126    UNREFERENCED_PARAMETER(Interrupt);
   2.127  
   2.128 +  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   2.129 +
   2.130    //KdPrint((__DRIVER_NAME "     ***XenNet Interrupt***\n"));  
   2.131  
   2.132    if (xi->connected)
   2.133 @@ -366,11 +401,8 @@ XenNet_Interrupt(
   2.134      XenNet_TxBufferGC(xi);
   2.135      XenNet_RxBufferCheck(xi);
   2.136    }
   2.137 -  // KeAcquireSpinLock(&ChildDeviceData->Lock, &KIrql);
   2.138 -  // KdPrint((__DRIVER_NAME " --> Setting Dpc Event\n"));
   2.139 -  // KeSetEvent(&ChildDeviceData->DpcThreadEvent, 1, FALSE);
   2.140 -  // KeReleaseSpinLock(&ChildDeviceData->Lock, KIrql);
   2.141 -  // KdPrint((__DRIVER_NAME " --> Dpc Event Set\n"));
   2.142 +
   2.143 +  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   2.144  
   2.145    return TRUE;
   2.146  }
   2.147 @@ -395,10 +427,12 @@ XenNet_BackEndStateHandler(char *Path, P
   2.148      {"rx-ring-ref", 0},
   2.149      {"event-channel", 0},
   2.150      {"request-rx-copy", 1},
   2.151 +#if 0 // these seemed to cause kernel messages about checksums
   2.152      {"feature-rx-notify", 1},
   2.153      {"feature-no-csum-offload", 1},
   2.154      {"feature-sg", 1},
   2.155      {"feature-gso-tcpv4", 0},
   2.156 +#endif
   2.157      {NULL, 0},
   2.158    };
   2.159  
   2.160 @@ -422,7 +456,7 @@ XenNet_BackEndStateHandler(char *Path, P
   2.161  
   2.162      xi->event_channel = xi->XenInterface.EvtChn_AllocUnbound(
   2.163        xi->XenInterface.InterfaceHeader.Context, 0);  
   2.164 -    xi->XenInterface.EvtChn_Bind(xi->XenInterface.InterfaceHeader.Context,
   2.165 +    xi->XenInterface.EvtChn_BindDpc(xi->XenInterface.InterfaceHeader.Context,
   2.166        xi->event_channel, XenNet_Interrupt, xi);
   2.167  
   2.168      /* TODO: must free pages in MDL as well as MDL using MmFreePagesFromMdl and ExFreePool */
   2.169 @@ -607,6 +641,8 @@ XenNet_Init(
   2.170      xi->grant_rx_ref[i] = GRANT_INVALID_REF;
   2.171    }
   2.172  
   2.173 +  xi->packet_filter = NDIS_PACKET_TYPE_PROMISCUOUS;
   2.174 +
   2.175    status = IoGetDeviceProperty(xi->pdo, DevicePropertyDeviceDescription,
   2.176      NAME_SIZE, xi->name, &length);
   2.177    if (!NT_SUCCESS(status))
   2.178 @@ -703,35 +739,37 @@ err:
   2.179    return status;
   2.180  }
   2.181  
   2.182 +// Q = Query Mandatory, S = Set Mandatory
   2.183  NDIS_OID supported_oids[] =
   2.184  {
   2.185    /* general OIDs */
   2.186 -  OID_GEN_SUPPORTED_LIST,
   2.187 -  OID_GEN_HARDWARE_STATUS,
   2.188 -  OID_GEN_MEDIA_SUPPORTED,
   2.189 -  OID_GEN_MEDIA_IN_USE,
   2.190 -  OID_GEN_MAXIMUM_LOOKAHEAD,
   2.191 -  OID_GEN_MAXIMUM_FRAME_SIZE,
   2.192 -  OID_GEN_LINK_SPEED,
   2.193 -  OID_GEN_TRANSMIT_BUFFER_SPACE,
   2.194 -  OID_GEN_RECEIVE_BUFFER_SPACE,
   2.195 -  OID_GEN_TRANSMIT_BLOCK_SIZE,
   2.196 -  OID_GEN_RECEIVE_BLOCK_SIZE,
   2.197 -  OID_GEN_VENDOR_ID,
   2.198 -  OID_GEN_VENDOR_DESCRIPTION,
   2.199 -  OID_GEN_CURRENT_PACKET_FILTER,
   2.200 -  OID_GEN_CURRENT_LOOKAHEAD,
   2.201 -  OID_GEN_DRIVER_VERSION,
   2.202 -  OID_GEN_MAXIMUM_TOTAL_SIZE,
   2.203 -  OID_GEN_MAC_OPTIONS,
   2.204 -  OID_GEN_MEDIA_CONNECT_STATUS,
   2.205 -  OID_GEN_MAXIMUM_SEND_PACKETS,
   2.206 +  OID_GEN_SUPPORTED_LIST,        // Q
   2.207 +  OID_GEN_HARDWARE_STATUS,       // Q
   2.208 +  OID_GEN_MEDIA_SUPPORTED,       // Q
   2.209 +  OID_GEN_MEDIA_IN_USE,          // Q
   2.210 +  OID_GEN_MAXIMUM_LOOKAHEAD,     // Q
   2.211 +  OID_GEN_MAXIMUM_FRAME_SIZE,    // Q
   2.212 +  OID_GEN_LINK_SPEED,            // Q
   2.213 +  OID_GEN_TRANSMIT_BUFFER_SPACE, // Q
   2.214 +  OID_GEN_RECEIVE_BUFFER_SPACE,  // Q
   2.215 +  OID_GEN_TRANSMIT_BLOCK_SIZE,   // Q
   2.216 +  OID_GEN_RECEIVE_BLOCK_SIZE,    // Q
   2.217 +  OID_GEN_VENDOR_ID,             // Q
   2.218 +  OID_GEN_VENDOR_DESCRIPTION,    // Q
   2.219 +  OID_GEN_CURRENT_PACKET_FILTER, // QS
   2.220 +  OID_GEN_CURRENT_LOOKAHEAD,     // QS
   2.221 +  OID_GEN_DRIVER_VERSION,        // Q
   2.222 +  OID_GEN_MAXIMUM_TOTAL_SIZE,    // Q
   2.223 +  OID_GEN_PROTOCOL_OPTIONS,      // S
   2.224 +  OID_GEN_MAC_OPTIONS,           // Q
   2.225 +  OID_GEN_MEDIA_CONNECT_STATUS,  // Q
   2.226 +  OID_GEN_MAXIMUM_SEND_PACKETS,  // Q
   2.227    /* stats */
   2.228 -  OID_GEN_XMIT_OK,
   2.229 -  OID_GEN_RCV_OK,
   2.230 -  OID_GEN_XMIT_ERROR,
   2.231 -  OID_GEN_RCV_ERROR,
   2.232 -  OID_GEN_RCV_NO_BUFFER, 
   2.233 +  OID_GEN_XMIT_OK,               // Q
   2.234 +  OID_GEN_RCV_OK,                // Q
   2.235 +  OID_GEN_XMIT_ERROR,            // Q
   2.236 +  OID_GEN_RCV_ERROR,             // Q
   2.237 +  OID_GEN_RCV_NO_BUFFER,         // Q
   2.238    /* media-specific OIDs */
   2.239    OID_802_3_PERMANENT_ADDRESS,
   2.240    OID_802_3_CURRENT_ADDRESS,
   2.241 @@ -755,6 +793,8 @@ XenNet_QueryInformation(
   2.242    UINT len = 4;
   2.243    NDIS_STATUS status = NDIS_STATUS_SUCCESS;
   2.244  
   2.245 +//  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   2.246 +
   2.247    switch(Oid)
   2.248    {
   2.249      case OID_GEN_SUPPORTED_LIST:
   2.250 @@ -797,7 +837,7 @@ XenNet_QueryInformation(
   2.251        temp_data = XN_MAX_PKT_SIZE;
   2.252        break;
   2.253      case OID_GEN_VENDOR_ID:
   2.254 -      temp_data = XENSOURCE_MAC_HDR;
   2.255 +      temp_data = 0xFFFFFF; // Not guaranteed to be XENSOURCE_MAC_HDR;
   2.256        break;
   2.257      case OID_GEN_VENDOR_DESCRIPTION:
   2.258        data = vendor_desc;
   2.259 @@ -807,6 +847,7 @@ XenNet_QueryInformation(
   2.260        temp_data = xi->packet_filter;
   2.261        break;
   2.262      case OID_GEN_CURRENT_LOOKAHEAD:
   2.263 +      // TODO: we should store this...
   2.264        temp_data = XN_MAX_PKT_SIZE;
   2.265        break;
   2.266      case OID_GEN_DRIVER_VERSION:
   2.267 @@ -865,18 +906,20 @@ XenNet_QueryInformation(
   2.268        temp_data = 0; /* no mcast support */
   2.269        break;
   2.270      default:
   2.271 -      //KdPrint(("Unknown OID 0x%x\n", Oid));
   2.272 +      KdPrint(("Get Unknown OID 0x%x\n", Oid));
   2.273        status = NDIS_STATUS_NOT_SUPPORTED;
   2.274    }
   2.275  
   2.276    if (!NT_SUCCESS(status))
   2.277    {
   2.278 +//    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (returned error)\n"));
   2.279      return status;
   2.280    }
   2.281  
   2.282    if (len > InformationBufferLength)
   2.283    {
   2.284      *BytesNeeded = len;
   2.285 +//    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (returned error)\n"));
   2.286      return NDIS_STATUS_BUFFER_TOO_SHORT;
   2.287    }
   2.288  
   2.289 @@ -887,6 +930,7 @@ XenNet_QueryInformation(
   2.290    }
   2.291  
   2.292    //KdPrint(("Got OID 0x%x\n", Oid));
   2.293 +//  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   2.294  
   2.295    return status;
   2.296  }
   2.297 @@ -901,15 +945,149 @@ XenNet_SetInformation(
   2.298    OUT PULONG BytesNeeded
   2.299    )
   2.300  {
   2.301 +  NTSTATUS status;
   2.302 +  struct xennet_info *xi = MiniportAdapterContext;
   2.303 +  PULONG64 data = InformationBuffer;
   2.304 +
   2.305 +  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   2.306 +
   2.307    UNREFERENCED_PARAMETER(MiniportAdapterContext);
   2.308 -  UNREFERENCED_PARAMETER(Oid);
   2.309 -  UNREFERENCED_PARAMETER(InformationBuffer);
   2.310    UNREFERENCED_PARAMETER(InformationBufferLength);
   2.311    UNREFERENCED_PARAMETER(BytesRead);
   2.312    UNREFERENCED_PARAMETER(BytesNeeded);
   2.313  
   2.314 -  KdPrint((__FUNCTION__ " called with OID=0x%x\n", Oid));
   2.315 -  return NDIS_STATUS_SUCCESS;
   2.316 +  switch(Oid)
   2.317 +  {
   2.318 +    case OID_GEN_SUPPORTED_LIST:
   2.319 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.320 +      KdPrint(("Unsupported set OID_GEN_SUPPORTED_LIST\n"));
   2.321 +      break;
   2.322 +    case OID_GEN_HARDWARE_STATUS:
   2.323 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.324 +      KdPrint(("Unsupported set OID_GEN_HARDWARE_STATUS\n"));
   2.325 +      break;
   2.326 +    case OID_GEN_MEDIA_SUPPORTED:
   2.327 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.328 +      KdPrint(("Unsupported set OID_GEN_MEDIA_SUPPORTED\n"));
   2.329 +      break;
   2.330 +    case OID_GEN_MEDIA_IN_USE:
   2.331 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.332 +      KdPrint(("Unsupported set OID_GEN_MEDIA_IN_USE\n"));
   2.333 +      break;
   2.334 +    case OID_GEN_MAXIMUM_LOOKAHEAD:
   2.335 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.336 +      KdPrint(("Unsupported set OID_GEN_MAXIMUM_LOOKAHEAD\n"));
   2.337 +      break;
   2.338 +    case OID_GEN_MAXIMUM_FRAME_SIZE:
   2.339 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.340 +      KdPrint(("Unsupported set OID_GEN_MAXIMUM_FRAME_SIZE\n"));
   2.341 +      break;
   2.342 +    case OID_GEN_LINK_SPEED:
   2.343 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.344 +      KdPrint(("Unsupported set OID_GEN_LINK_SPEED\n"));
   2.345 +      break;
   2.346 +    case OID_GEN_TRANSMIT_BUFFER_SPACE:
   2.347 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.348 +      KdPrint(("Unsupported set OID_GEN_TRANSMIT_BUFFER_SPACE\n"));
   2.349 +      break;
   2.350 +    case OID_GEN_RECEIVE_BUFFER_SPACE:
   2.351 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.352 +      KdPrint(("Unsupported set OID_GEN_RECEIVE_BUFFER_SPACE\n"));
   2.353 +      break;
   2.354 +    case OID_GEN_TRANSMIT_BLOCK_SIZE:
   2.355 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.356 +      KdPrint(("Unsupported set OID_GEN_TRANSMIT_BLOCK_SIZE\n"));
   2.357 +      break;
   2.358 +    case OID_GEN_RECEIVE_BLOCK_SIZE:
   2.359 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.360 +      KdPrint(("Unsupported set OID_GEN_RECEIVE_BLOCK_SIZE\n"));
   2.361 +      break;
   2.362 +    case OID_GEN_VENDOR_ID:
   2.363 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.364 +      KdPrint(("Unsupported set OID_GEN_VENDOR_ID\n"));
   2.365 +      break;
   2.366 +    case OID_GEN_VENDOR_DESCRIPTION:
   2.367 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.368 +      KdPrint(("Unsupported set OID_GEN_VENDOR_DESCRIPTION\n"));
   2.369 +      break;
   2.370 +    case OID_GEN_CURRENT_PACKET_FILTER:
   2.371 +      KdPrint(("Set OID_GEN_CURRENT_PACKET_FILTER\n"));
   2.372 +      xi->packet_filter = *(ULONG *)data;
   2.373 +      status = NDIS_STATUS_SUCCESS;
   2.374 +      break;
   2.375 +    case OID_GEN_CURRENT_LOOKAHEAD:
   2.376 +      KdPrint(("Set OID_GEN_CURRENT_LOOKAHEAD %d\n", *(int *)data));
   2.377 +      // TODO: We should do this...
   2.378 +      status = NDIS_STATUS_SUCCESS;
   2.379 +      break;
   2.380 +    case OID_GEN_DRIVER_VERSION:
   2.381 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.382 +      KdPrint(("Unsupported set OID_GEN_DRIVER_VERSION\n"));
   2.383 +      break;
   2.384 +    case OID_GEN_MAXIMUM_TOTAL_SIZE:
   2.385 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.386 +      KdPrint(("Unsupported set OID_GEN_MAXIMUM_TOTAL_SIZE\n"));
   2.387 +      break;
   2.388 +    case OID_GEN_PROTOCOL_OPTIONS:
   2.389 +      KdPrint(("Unsupported set OID_GEN_PROTOCOL_OPTIONS\n"));
   2.390 +      // TODO - actually do this...
   2.391 +      status = NDIS_STATUS_SUCCESS;
   2.392 +      break;
   2.393 +    case OID_GEN_MAC_OPTIONS:
   2.394 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.395 +      KdPrint(("Unsupported set OID_GEN_MAC_OPTIONS\n"));
   2.396 +      break;
   2.397 +    case OID_GEN_MEDIA_CONNECT_STATUS:
   2.398 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.399 +      KdPrint(("Unsupported set OID_GEN_MEDIA_CONNECT_STATUS\n"));
   2.400 +      break;
   2.401 +    case OID_GEN_MAXIMUM_SEND_PACKETS:
   2.402 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.403 +      KdPrint(("Unsupported set OID_GEN_MAXIMUM_SEND_PACKETS\n"));
   2.404 +      break;
   2.405 +    case OID_GEN_XMIT_OK:
   2.406 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.407 +      KdPrint(("Unsupported set OID_GEN_XMIT_OK\n"));
   2.408 +      break;
   2.409 +    case OID_GEN_RCV_OK:
   2.410 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.411 +      KdPrint(("Unsupported set OID_GEN_RCV_OK\n"));
   2.412 +      break;
   2.413 +    case OID_GEN_XMIT_ERROR:
   2.414 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.415 +      KdPrint(("Unsupported set OID_GEN_XMIT_ERROR\n"));
   2.416 +      break;
   2.417 +    case OID_GEN_RCV_ERROR:
   2.418 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.419 +      KdPrint(("Unsupported set OID_GEN_RCV_ERROR\n"));
   2.420 +      break;
   2.421 +    case OID_GEN_RCV_NO_BUFFER:
   2.422 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.423 +      KdPrint(("Unsupported set OID_GEN_RCV_NO_BUFFER\n"));
   2.424 +      break;
   2.425 +    case OID_802_3_PERMANENT_ADDRESS:
   2.426 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.427 +      KdPrint(("Unsupported set OID_802_3_PERMANENT_ADDRESS\n"));
   2.428 +      break;
   2.429 +    case OID_802_3_CURRENT_ADDRESS:
   2.430 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.431 +      KdPrint(("Unsupported set OID_802_3_CURRENT_ADDRESS\n"));
   2.432 +      break;
   2.433 +    case OID_802_3_MULTICAST_LIST:
   2.434 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.435 +      KdPrint(("Unsupported set OID_802_3_MULTICAST_LIST\n"));
   2.436 +      break;
   2.437 +    case OID_802_3_MAXIMUM_LIST_SIZE:
   2.438 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.439 +      KdPrint(("Unsupported set OID_802_3_MAXIMUM_LIST_SIZE\n"));
   2.440 +      break;
   2.441 +    default:
   2.442 +      KdPrint(("Set Unknown OID 0x%x\n", Oid));
   2.443 +      status = NDIS_STATUS_NOT_SUPPORTED;
   2.444 +      break;
   2.445 +  }
   2.446 +  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   2.447 +  return status;
   2.448  }
   2.449  
   2.450  VOID
   2.451 @@ -923,6 +1101,8 @@ XenNet_ReturnPacket(
   2.452    UINT buff_len;
   2.453    UINT tot_buff_len;
   2.454  
   2.455 +  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   2.456 +
   2.457    UNREFERENCED_PARAMETER(MiniportAdapterContext);
   2.458  
   2.459    NdisGetFirstBufferFromPacketSafe(Packet, &buffer, &buff_va, &buff_len,
   2.460 @@ -934,6 +1114,7 @@ XenNet_ReturnPacket(
   2.461    NdisFreePacket(Packet);
   2.462  
   2.463    //KdPrint((__FUNCTION__ " called\n"));
   2.464 +  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   2.465  }
   2.466  
   2.467  PMDL
   2.468 @@ -947,6 +1128,8 @@ XenNet_Linearize(PNDIS_PACKET Packet)
   2.469    UINT buff_len;
   2.470    UINT tot_buff_len;
   2.471  
   2.472 +  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   2.473 +
   2.474    NdisGetFirstBufferFromPacketSafe(Packet, &buffer, &buff_va, &buff_len,
   2.475      &tot_buff_len, NormalPagePriority);
   2.476    ASSERT(tot_buff_len <= XN_MAX_PKT_SIZE);
   2.477 @@ -974,6 +1157,7 @@ XenNet_Linearize(PNDIS_PACKET Packet)
   2.478      NdisGetNextBuffer(buffer, &buffer);
   2.479    }
   2.480  
   2.481 +  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   2.482    return pmdl;
   2.483  }
   2.484  
   2.485 @@ -993,6 +1177,8 @@ XenNet_SendPackets(
   2.486    PMDL pmdl;
   2.487    UINT pkt_size;
   2.488  
   2.489 +  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   2.490 +
   2.491    for (i = 0; i < NumberOfPackets; i++)
   2.492    {
   2.493      curr_packet = PacketArray[i];
   2.494 @@ -1024,7 +1210,8 @@ XenNet_SendPackets(
   2.495      xi->grant_tx_ref[id] = tx->gref;
   2.496      tx->offset = (uint16_t)MmGetMdlByteOffset(pmdl);
   2.497      tx->size = (UINT16)pkt_size;
   2.498 -    tx->flags = NETTXF_csum_blank;
   2.499 +    // NETTXF_csum_blank should only be used for tcp and udp packets...
   2.500 +    tx->flags = 0; //NETTXF_csum_blank;
   2.501  
   2.502      xi->tx.req_prod_pvt++;
   2.503  
   2.504 @@ -1038,6 +1225,8 @@ XenNet_SendPackets(
   2.505      xi->XenInterface.EvtChn_Notify(xi->XenInterface.InterfaceHeader.Context,
   2.506        xi->event_channel);
   2.507    }
   2.508 +
   2.509 +  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   2.510  }
   2.511  
   2.512  VOID
     3.1 --- a/xenpci/evtchn.c	Fri Dec 28 23:21:49 2007 +1100
     3.2 +++ b/xenpci/evtchn.c	Sun Dec 30 14:33:08 2007 +1100
     3.3 @@ -27,6 +27,7 @@ EvtChn_DpcBounce(WDFDPC Dpc)
     3.4  
     3.5    Action = GetEvtChnDeviceData(Dpc)->Action;
     3.6    Action->ServiceRoutine(NULL, Action->ServiceContext);
     3.7 +//  _interlockedbittestandreset((volatile LONG *)&GetEvtChnDeviceData(Dpc)->shared_info_area->evtchn_pending[0], GetEvtChnDeviceData(Dpc)->port);
     3.8  }
     3.9  
    3.10  BOOLEAN
    3.11 @@ -64,6 +65,7 @@ EvtChn_Interrupt(WDFINTERRUPT Interrupt,
    3.12        {
    3.13          if (ev_action->DpcFlag)
    3.14          {
    3.15 +          KdPrint((__DRIVER_NAME " --- Scheduling Dpc\n"));
    3.16            WdfDpcEnqueue(ev_action->Dpc);
    3.17          }
    3.18          else
    3.19 @@ -129,6 +131,8 @@ EvtChn_BindDpc(PVOID Context, evtchn_por
    3.20    DpcObjectAttributes.ParentObject = Device;
    3.21    WdfDpcCreate(&DpcConfig, &DpcObjectAttributes, &xpdd->ev_actions[Port].Dpc);
    3.22    GetEvtChnDeviceData(xpdd->ev_actions[Port].Dpc)->Action = &xpdd->ev_actions[Port];
    3.23 +//  GetEvtChnDeviceData(xpdd->ev_actions[Port].Dpc)->shared_info_area = xpdd->shared_info_area;
    3.24 +//  GetEvtChnDeviceData(xpdd->ev_actions[Port].Dpc)->port = Port;
    3.25  
    3.26    KeMemoryBarrier(); // make sure that the new service routine is only called once the context is set up
    3.27    xpdd->ev_actions[Port].ServiceRoutine = ServiceRoutine;
     4.1 --- a/xenpci/sources	Fri Dec 28 23:21:49 2007 +1100
     4.2 +++ b/xenpci/sources	Sun Dec 30 14:33:08 2007 +1100
     4.3 @@ -1,7 +1,7 @@
     4.4  TARGETNAME=XENPCI
     4.5  TARGETTYPE=DRIVER
     4.6  TARGETPATH=..\Target\$(DDK_TARGET_OS)
     4.7 -VERSION=0.5.0.6
     4.8 +VERSION=0.5.0.10
     4.9  KMDF_VERSION=1
    4.10  MSC_WARNING_LEVEL=/W4
    4.11  INF_NAME=xenpci
     5.1 --- a/xenpci/xenpci.h	Fri Dec 28 23:21:49 2007 +1100
     5.2 +++ b/xenpci/xenpci.h	Sun Dec 30 14:33:08 2007 +1100
     5.3 @@ -66,6 +66,8 @@ typedef struct _ev_action_t {
     5.4  
     5.5  typedef struct {
     5.6    ev_action_t *Action;
     5.7 +//  shared_info_t *shared_info_area;
     5.8 +//  ULONG port;
     5.9  } EVTCHN_DEVICE_DATA, *PEVTCHN_DEVICE_DATA;
    5.10  WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(EVTCHN_DEVICE_DATA, GetEvtChnDeviceData);
    5.11