win-pvdrivers

changeset 50:5cd75aeb77cb

xennet: don't use device context; minor cleanups
author Andy Grover <andy.grover@oracle.com>
date Fri Dec 14 14:03:23 2007 -0800 (2007-12-14)
parents d69f904fcf28
children a1a6a68d8ab8
files xennet/xennet.c
line diff
     1.1 --- a/xennet/xennet.c	Fri Dec 14 13:30:56 2007 -0800
     1.2 +++ b/xennet/xennet.c	Fri Dec 14 14:03:23 2007 -0800
     1.3 @@ -103,14 +103,6 @@ struct xennet_info
     1.4    NDIS_HANDLE buffer_pool;
     1.5  };
     1.6  
     1.7 -/* need to do typedef so the DECLARE below works */
     1.8 -typedef struct _wdf_device_info
     1.9 -{
    1.10 -  struct xennet_info *xennet_info;
    1.11 -} wdf_device_info;
    1.12 -
    1.13 -WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(wdf_device_info, GetWdfDeviceInfo)
    1.14 -
    1.15  /* This function copied from linux's lib/vsprintf.c, see it for attribution */
    1.16  static unsigned long
    1.17  simple_strtoul(const char *cp,char **endp,unsigned int base)
    1.18 @@ -651,16 +643,7 @@ XenNet_Init(
    1.19      0, (NDIS_ATTRIBUTE_DESERIALIZE /*| NDIS_ATTRIBUTE_BUS_MASTER*/),
    1.20      NdisInterfaceInternal);
    1.21  
    1.22 -  // status = NdisMInitializeScatterGatherDma(xi->adapter_handle, TRUE,
    1.23 -    // XN_MAX_PKT_SIZE);
    1.24 -  // if (!NT_SUCCESS(status))
    1.25 -  // {
    1.26 -    // KdPrint(("NdisMInitializeScatterGatherDma failed with 0x%x\n", status));
    1.27 -    // status = NDIS_STATUS_FAILURE;
    1.28 -    // goto err;
    1.29 -  // }
    1.30 -
    1.31 -  WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&wdf_attrs, wdf_device_info);
    1.32 +  WDF_OBJECT_ATTRIBUTES_INIT(&wdf_attrs);
    1.33  
    1.34    status = WdfDeviceMiniportCreate(WdfGetDriver(), &wdf_attrs, xi->fdo,
    1.35      xi->lower_do, xi->pdo, &xi->wdf_device);
    1.36 @@ -671,8 +654,6 @@ XenNet_Init(
    1.37      goto err;
    1.38    }
    1.39  
    1.40 -  GetWdfDeviceInfo(xi->wdf_device)->xennet_info = xi;
    1.41 -
    1.42    /* get lower (Xen) interfaces */
    1.43  
    1.44    status = WdfFdoQueryForInterface(xi->wdf_device, &GUID_XEN_IFACE_EVTCHN,
    1.45 @@ -847,7 +828,10 @@ XenNet_QueryInformation(
    1.46        len = sizeof(supported_oids);
    1.47        break;
    1.48      case OID_GEN_HARDWARE_STATUS:
    1.49 -      temp_data = NdisHardwareStatusReady;
    1.50 +      if (!xi->connected)
    1.51 +        temp_data = NdisHardwareStatusInitializing;
    1.52 +      else
    1.53 +        temp_data = NdisHardwareStatusReady;
    1.54        break;
    1.55      case OID_GEN_MEDIA_SUPPORTED:
    1.56        temp_data = NdisMedium802_3;
    1.57 @@ -1152,8 +1136,8 @@ DriverEntry(
    1.58    }
    1.59  
    1.60    /* NDIS 5.1 driver */
    1.61 -  mini_chars.MajorNdisVersion = 5;
    1.62 -  mini_chars.MinorNdisVersion = 1;
    1.63 +  mini_chars.MajorNdisVersion = NDIS_MAJOR_VER;
    1.64 +  mini_chars.MinorNdisVersion = NDIS_MINOR_VER;
    1.65  
    1.66    mini_chars.HaltHandler = XenNet_Halt;
    1.67    mini_chars.InitializeHandler = XenNet_Init;