Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vioscsi] SendSRB minor refactor #1153

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions vioscsi/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ ENTER_FN_SRB();
srbExt->out, srbExt->in,
benyamin-codez marked this conversation as resolved.
Show resolved Hide resolved
benyamin-codez marked this conversation as resolved.
Show resolved Hide resolved
&srbExt->cmd, va, pa);

if (res >= 0) {
if (res == VQ_ADD_BUFFER_SUCCESS) {
benyamin-codez marked this conversation as resolved.
Show resolved Hide resolved
element = &adaptExt->processing_srbs[index];
InsertTailList(&element->srb_list, &srbExt->list_entry);
element->srb_cnt++;
Expand All @@ -120,13 +120,16 @@ ENTER_FN_SRB();
virtqueue_notify(adaptExt->vq[QueueNumber]);
}
} else {
// virtqueue_add_buf() returned -28 (ENOSPC), i.e. no space for buffer, or some other error
benyamin-codez marked this conversation as resolved.
Show resolved Hide resolved
virtqueue_notify(adaptExt->vq[QueueNumber]);
ScsiStatus = SCSISTAT_QUEUE_FULL;
SRB_SET_SRB_STATUS(Srb, SRB_STATUS_BUSY);
SRB_SET_SCSI_STATUS(Srb, ScsiStatus);
StorPortBusy(DeviceExtension, 10);
RhelDbgPrint(TRACE_LEVEL_WARNING,
benyamin-codez marked this conversation as resolved.
Show resolved Hide resolved
" Could not put an SRB into a VQ, so complete it with SRB_STATUS_BUSY. QueueNumber = %lu, SRB = 0x%p, Lun = %d, TimeOut = %d.\n",
QueueNumber, srbExt->Srb, SRB_LUN(Srb), Srb->TimeOutValue);
CompleteRequest(DeviceExtension, Srb);
RhelDbgPrint(TRACE_LEVEL_FATAL, " Could not put an SRB into a VQ, so complete it with SRB_STATUS_BUSY. QueueNumber = %d, SRB = 0x%p, Lun = %d, TimeOut = %d.\n", QueueNumber, srbExt->Srb, SRB_LUN(Srb), Srb->TimeOutValue);
}

EXIT_FN_SRB();
Expand Down
2 changes: 2 additions & 0 deletions vioscsi/helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
#define CACHE_LINE_SIZE 64
#define ROUND_TO_CACHE_LINES(Size) (((ULONG_PTR)(Size) + CACHE_LINE_SIZE - 1) & ~(CACHE_LINE_SIZE - 1))

#define VQ_ADD_BUFFER_SUCCESS 0

#include <srbhelper.h>

// Note: SrbGetCdbLength is defined in srbhelper.h
Expand Down