IOCTL_SRIOV_DETACH IOCTL (pcivirt.h)

请求指示虚拟化堆栈希望注销即插即用事件(以前通过 IOCTL_SRIOV_ATTACH 请求注册)。

主要代码

IRP_MJ_DEVICE_CONTROL

状态块

Irp->IoStatus.Status 设置为STATUS_SUCCESS(如果请求成功)。 否则,状态 将相应的错误条件指示为 NTSTATUS 代码。

言论

此 IOCTL 请求由虚拟化堆栈发送到公开GUID_DEVINTERFACE_VIRTUALIZABLE_DEVICE的 PCI Express SR-IOV 物理功能(PF)驱动程序。

从此处开始,PF 不应收到 IOCTL_SRIOV_EVENT_COMPLETEIOCTL_SRIOV_NOTIFICATION 请求。

必须停止等待 IOCTL_SRIOV_EVENT_COMPLETE的驱动程序。 如果驱动程序当前正在等待,应停止等待并继续处理即插即用 IRP。

在此示例中,处理IOCTL_SRIOV_DETACH请求时,PF 驱动程序在其设备上下文中维护 PnP 状态。 当驱动程序收到 IRP_MN_QUERY_STOP_DEVICE 时,deviceContext->PnpRebalancing 设置为 TRUE,并在收到IRP_MN_START_DEVICE时设置为 FALSE。

    case IOCTL_SRIOV_DETACH:

        WdfWaitLockAcquire(deviceContext->PnpStateLock, NULL);

        deviceContext->PnpVspAttached = FALSE;

        if (deviceContext->PnpRebalancing != FALSE)
        {
            //
            // Any new client (VSP state machine) will not know about
            // the current rebalance is it should block attach until
            // rebalance is over.
            //

    								deviceContext>PnpSafeToAttach = FALSE;
    								KeClearEvent(&deviceContext>PnpSafeEvent);

        }

        //
        // Unblock the PnP thread if it waiting for an IO control from the
        // client as the client just detached.
        //
        deviceContext->PnpEventStatus = STATUS_SUCCESS;
        KeSetEvent(&deviceContext->PnpUnblockEvent, IO_NO_INCREMENT, FALSE);

        WdfWaitLockRelease(deviceContext->PnpStateLock);

        status = STATUS_SUCCESS;
        break;



要求

要求 价值
标头 pcivirt.h
IRQL PASSIVE_LEVEL

另请参阅

WdfIoTargetSendInternalIoctlSynchronously

WdfIoTargetSendInternalIoctlOthersSynchronously

在驱动程序中创建 IOCTL 请求

IOCTL_SRIOV_ATTACH

WdfIoTargetSendIoctlSynchronously