[ofw] [PATCH][RFC] winverbs/cq: implement CQ:Notify()
Sean Hefty
sean.hefty at intel.com
Wed Apr 30 20:52:42 PDT 2008
> static void WvCqEventHandler(ib_event_rec_t *pEvent)
> {
>- pEvent;
>+ WV_COMPLETION_QUEUE *cq = pEvent->context;
>+ WDFREQUEST request;
>+ NTSTATUS status;
>+
>+ WdfObjectAcquireLock(cq->Queue);
>+ status = WdfIoQueueRetrieveNextRequest(cq->Queue, &request);
>+ WdfObjectReleaseLock(cq->Queue);
>+
>+ if (NT_SUCCESS(status)) {
>+ WdfRequestComplete(request, STATUS_UNEXPECTED_IO_ERROR);
>+ }
> }
>
> static void WvCqHandler(void *Context)
> {
>- WV_COMPLETION_QUEUE *pCq = Context;
>- pCq;
>+ WV_COMPLETION_QUEUE *cq = Context;
>+ WDFREQUEST request;
>+ NTSTATUS status;
>+
>+ WdfObjectAcquireLock(cq->Queue);
>+ status = WdfIoQueueRetrieveNextRequest(cq->Queue, &request);
>+ WdfObjectReleaseLock(cq->Queue);
>+
>+ if (NT_SUCCESS(status)) {
>+ WdfRequestComplete(request, STATUS_SUCCESS);
>+ }
> }
When I added support to cancel requests, I ended up with the two handlers calling into a single function.
>+ WDF_IO_QUEUE_CONFIG_INIT(&config, WdfIoQueueDispatchManual);
>+ status = WdfIoQueueCreate(ControlDevice, &config,
>+ WDF_NO_OBJECT_ATTRIBUTES, &cq->Queue);
>+ if (!NT_SUCCESS(status)) {
>+ goto err;
>+ }
And this needed to be destroyed when freeing the CQ.
These changes and the fixes were added to the WinVerbs branch.
- Sean
More information about the ofw
mailing list