Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 200ae1a0 authored by Or Gerlitz's avatar Or Gerlitz Committed by Roland Dreier
Browse files

IB/iser: Support iSCSI PDU padding



RFC3270 mandates that iSCSI PDUs are padded to the closest integer
number of four byte words.  Fix the iser code to support that on both
the TX/RX flows.

Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.co.il>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent 0ace64b8
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -101,13 +101,17 @@ iscsi_iser_recv(struct iscsi_conn *conn,

	/* verify PDU length */
	datalen = ntoh24(hdr->dlength);
	if (datalen != rx_data_len) {
		printk(KERN_ERR "iscsi_iser: datalen %d (hdr) != %d (IB) \n",
	if (datalen > rx_data_len || (datalen + 4) < rx_data_len) {
		iser_err("wrong datalen %d (hdr), %d (IB)\n",
			datalen, rx_data_len);
		rc = ISCSI_ERR_DATALEN;
		goto error;
	}

	if (datalen != rx_data_len)
		iser_dbg("aligned datalen (%d) hdr, %d (IB)\n",
			datalen, rx_data_len);

	/* read AHS */
	ahslen = hdr->hlength * 4;

+1 −1
Original line number Diff line number Diff line
@@ -412,7 +412,7 @@ int iser_send_control(struct iscsi_conn *conn,
		memcpy(iser_conn->ib_conn->login_buf, task->data,
							task->data_count);
		tx_dsg->addr    = iser_conn->ib_conn->login_dma;
		tx_dsg->length  = data_seg_len;
		tx_dsg->length  = task->data_count;
		tx_dsg->lkey    = device->mr->lkey;
		mdesc->num_sge = 2;
	}