Merge pull request #303 from bvanassche/master
Fix two recently introduced issues and improve SG_IO error reporting
This commit is contained in:
@@ -85,9 +85,6 @@ enum data_dir{
|
|||||||
#define ISER_MIN_POSTED_RX (ISER_DEF_XMIT_CMDS_MAX >> 2)
|
#define ISER_MIN_POSTED_RX (ISER_DEF_XMIT_CMDS_MAX >> 2)
|
||||||
|
|
||||||
|
|
||||||
#define ISER_RX_PAD_SIZE (256 - (ISER_RX_PAYLOAD_SIZE + \
|
|
||||||
sizeof(struct ibv_mr*) + sizeof(struct ibv_sge)))
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct iser_hdr - iSER header
|
* struct iser_hdr - iSER header
|
||||||
*
|
*
|
||||||
@@ -121,13 +118,15 @@ struct iser_hdr {
|
|||||||
|
|
||||||
struct iser_rx_desc {
|
struct iser_rx_desc {
|
||||||
struct iser_hdr iser_header;
|
struct iser_hdr iser_header;
|
||||||
|
char pad1[4];
|
||||||
char iscsi_header[ISCSI_RAW_HEADER_SIZE];
|
char iscsi_header[ISCSI_RAW_HEADER_SIZE];
|
||||||
char data[ISER_RECV_DATA_SEG_LEN];
|
char data[ISER_RECV_DATA_SEG_LEN];
|
||||||
struct ibv_sge rx_sg;
|
struct ibv_sge rx_sg;
|
||||||
struct ibv_mr *hdr_mr;
|
struct ibv_mr *hdr_mr;
|
||||||
char pad[ISER_RX_PAD_SIZE];
|
char pad2[24];
|
||||||
} __attribute__((packed));
|
};
|
||||||
|
|
||||||
|
static_assert(sizeof(struct iser_rx_desc) == 256, "iser_rx_desc size != 256");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct iser_tx_desc - iSER TX descriptor (for send wr_id)
|
* struct iser_tx_desc - iSER TX descriptor (for send wr_id)
|
||||||
|
|||||||
@@ -30,6 +30,10 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef static_assert
|
||||||
|
#define static_assert(e, m) extern char unused_array[1 - 2 * !(e)]
|
||||||
|
#endif
|
||||||
|
|
||||||
#define SCSI_CDB_MAX_SIZE 16
|
#define SCSI_CDB_MAX_SIZE 16
|
||||||
|
|
||||||
enum scsi_opcode {
|
enum scsi_opcode {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ libiscsipriv_la_SOURCES += iser.c
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if HAVE_LINUX_ISER
|
if HAVE_LINUX_ISER
|
||||||
libiscsipriv_la_LDFLAGS = -libverbs -lrdmacm
|
libiscsipriv_la_LDFLAGS = -libverbs -lrdmacm -lpthread
|
||||||
endif
|
endif
|
||||||
|
|
||||||
libiscsipriv_la_CPPFLAGS = -I${srcdir}/../include -I$(srcdir)/include \
|
libiscsipriv_la_CPPFLAGS = -I${srcdir}/../include -I$(srcdir)/include \
|
||||||
|
|||||||
@@ -370,10 +370,14 @@ static struct scsi_task *send_scsi_command(struct scsi_device *sdev, struct scsi
|
|||||||
io_hdr.timeout = 5000;
|
io_hdr.timeout = 5000;
|
||||||
|
|
||||||
if(ioctl(sdev->sgio_fd, SG_IO, &io_hdr) < 0){
|
if(ioctl(sdev->sgio_fd, SG_IO, &io_hdr) < 0){
|
||||||
|
int err = errno;
|
||||||
|
|
||||||
if (sdev->error_str != NULL) {
|
if (sdev->error_str != NULL) {
|
||||||
free(discard_const(sdev->error_str));
|
free(discard_const(sdev->error_str));
|
||||||
}
|
}
|
||||||
sdev->error_str = strdup("SG_IO ioctl failed");
|
if (asprintf(&sdev->error_str, "SG_IO ioctl failed: %s",
|
||||||
|
strerror(err)) < 0)
|
||||||
|
sdev->error_str = NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user