Files
@ 052c0cbc4bbf
Branch filter:
Location: vmkdrivers/vmkdrivers/src_9/vmklinux_9/vmware/linux_usb.c
052c0cbc4bbf
4.2 KiB
text/x-csrc
ESXi-5.0-U3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | /*
* ****************************************************************
* Portions Copyright 2008, 2010 VMware, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* ****************************************************************/
/*
* linux_usb.c --
*
* vmklinux USB utility functions
*/
#include <linux/usb.h>
#include <linux/pci.h>
#include <vmklinux_9/vmklinux_log.h>
#include "vmkapi.h"
#include "linux_stubs.h"
#include "linux_usb.h"
#include "linux_stress.h"
#include "linux_pci.h"
/*
* Static Local Functions
********************************************************************
*/
/*
* Globals
********************************************************************
*/
/* Stress option handles */
vmk_StressOptionHandle stressUSBBulkDelayProcessURB;
EXPORT_SYMBOL(stressUSBBulkDelayProcessURB);
vmk_StressOptionHandle stressUSBBulkURBFakeTransientError;
EXPORT_SYMBOL(stressUSBBulkURBFakeTransientError);
vmk_StressOptionHandle stressUSBStorageDelaySCSIDataPhase;
EXPORT_SYMBOL(stressUSBStorageDelaySCSIDataPhase);
vmk_StressOptionHandle stressUSBStorageDelaySCSITransfer;
EXPORT_SYMBOL(stressUSBStorageDelaySCSITransfer);
vmk_StressOptionHandle stressUSBDelayProcessTD;
vmk_StressOptionHandle stressUSBFailGPHeapAlloc;
/*
* Externs
********************************************************************
*/
/*
* Implementation
********************************************************************
*/
/*
*----------------------------------------------------------------------
*
* LinuxUSB_Init
*
* This is the init entry point for USB. Called from vmklinux
* init from linux_stubs.c
*
* Results:
* None.
*
* Side effects:
* None
*
*----------------------------------------------------------------------
*/
void
LinuxUSB_Init(void)
{
VMK_ReturnStatus status;
status = vmk_StressOptionOpen(VMK_STRESS_OPT_USB_BULK_DELAY_PROCESS_URB,
&stressUSBBulkDelayProcessURB);
VMK_ASSERT(status == VMK_OK);
status = vmk_StressOptionOpen(VMK_STRESS_OPT_USB_BULK_URB_FAKE_TRANSIENT_ERROR,
&stressUSBBulkURBFakeTransientError);
VMK_ASSERT(status == VMK_OK);
status = vmk_StressOptionOpen(VMK_STRESS_OPT_USB_DELAY_PROCESS_TD,
&stressUSBDelayProcessTD);
VMK_ASSERT(status == VMK_OK);
status = vmk_StressOptionOpen(VMK_STRESS_OPT_USB_FAIL_GP_HEAP_ALLOC,
&stressUSBFailGPHeapAlloc);
VMK_ASSERT(status == VMK_OK);
status = vmk_StressOptionOpen(VMK_STRESS_OPT_USB_STORAGE_DELAY_SCSI_DATA_PHASE,
&stressUSBStorageDelaySCSIDataPhase);
VMK_ASSERT(status == VMK_OK);
status = vmk_StressOptionOpen(VMK_STRESS_OPT_USB_STORAGE_DELAY_SCSI_TRANSFER,
&stressUSBStorageDelaySCSITransfer);
VMK_ASSERT(status == VMK_OK);
if (status != VMK_OK) {
vmk_AlertMessage("%s - Failed to initialize USB common layer",
__FUNCTION__);
VMK_ASSERT(status == VMK_OK);
}
return;
}
/*
*----------------------------------------------------------------------
*
* LinuxUSB_Cleanup
*
* This is the cleanup entry point for USB. Called during vmklinux
* unload from linux_stubs.c
*
* Results:
* None.
*
* Side effects:
* None
*
*----------------------------------------------------------------------
*/
void
LinuxUSB_Cleanup(void)
{
VMK_ReturnStatus status;
status = vmk_StressOptionClose(stressUSBBulkDelayProcessURB);
VMK_ASSERT(status == VMK_OK);
status = vmk_StressOptionClose(stressUSBBulkURBFakeTransientError);
VMK_ASSERT(status == VMK_OK);
status = vmk_StressOptionClose(stressUSBDelayProcessTD);
VMK_ASSERT(status == VMK_OK);
status = vmk_StressOptionClose(stressUSBFailGPHeapAlloc);
VMK_ASSERT(status == VMK_OK);
status = vmk_StressOptionClose(stressUSBStorageDelaySCSIDataPhase);
VMK_ASSERT(status == VMK_OK);
status = vmk_StressOptionClose(stressUSBStorageDelaySCSITransfer);
VMK_ASSERT(status == VMK_OK);
}
|