]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 Jan 2020 09:29:07 +0000 (10:29 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 Jan 2020 09:29:07 +0000 (10:29 +0100)
added patches:
rdma-srpt-report-the-scsi-residual-to-the-initiator.patch

queue-4.4/rdma-srpt-report-the-scsi-residual-to-the-initiator.patch [new file with mode: 0644]
queue-4.4/series

diff --git a/queue-4.4/rdma-srpt-report-the-scsi-residual-to-the-initiator.patch b/queue-4.4/rdma-srpt-report-the-scsi-residual-to-the-initiator.patch
new file mode 100644 (file)
index 0000000..f5a384c
--- /dev/null
@@ -0,0 +1,70 @@
+From e88982ad1bb12db699de96fbc07096359ef6176c Mon Sep 17 00:00:00 2001
+From: Bart Van Assche <bvanassche@acm.org>
+Date: Tue, 5 Nov 2019 13:46:32 -0800
+Subject: RDMA/srpt: Report the SCSI residual to the initiator
+
+From: Bart Van Assche <bvanassche@acm.org>
+
+commit e88982ad1bb12db699de96fbc07096359ef6176c upstream.
+
+The code added by this patch is similar to the code that already exists in
+ibmvscsis_determine_resid(). This patch has been tested by running the
+following command:
+
+strace sg_raw -r 1k /dev/sdb 12 00 00 00 60 00 -o inquiry.bin |&
+    grep resid=
+
+Link: https://lore.kernel.org/r/20191105214632.183302-1-bvanassche@acm.org
+Fixes: a42d985bd5b2 ("ib_srpt: Initial SRP Target merge for v3.3-rc1")
+Signed-off-by: Bart Van Assche <bvanassche@acm.org>
+Acked-by: Honggang Li <honli@redhat.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/infiniband/ulp/srpt/ib_srpt.c |   24 ++++++++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+
+--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
++++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
+@@ -1513,9 +1513,11 @@ static int srpt_build_cmd_rsp(struct srp
+                             struct srpt_send_ioctx *ioctx, u64 tag,
+                             int status)
+ {
++      struct se_cmd *cmd = &ioctx->cmd;
+       struct srp_rsp *srp_rsp;
+       const u8 *sense_data;
+       int sense_data_len, max_sense_len;
++      u32 resid = cmd->residual_count;
+       /*
+        * The lowest bit of all SAM-3 status codes is zero (see also
+@@ -1537,6 +1539,28 @@ static int srpt_build_cmd_rsp(struct srp
+       srp_rsp->tag = tag;
+       srp_rsp->status = status;
++      if (cmd->se_cmd_flags & SCF_UNDERFLOW_BIT) {
++              if (cmd->data_direction == DMA_TO_DEVICE) {
++                      /* residual data from an underflow write */
++                      srp_rsp->flags = SRP_RSP_FLAG_DOUNDER;
++                      srp_rsp->data_out_res_cnt = cpu_to_be32(resid);
++              } else if (cmd->data_direction == DMA_FROM_DEVICE) {
++                      /* residual data from an underflow read */
++                      srp_rsp->flags = SRP_RSP_FLAG_DIUNDER;
++                      srp_rsp->data_in_res_cnt = cpu_to_be32(resid);
++              }
++      } else if (cmd->se_cmd_flags & SCF_OVERFLOW_BIT) {
++              if (cmd->data_direction == DMA_TO_DEVICE) {
++                      /* residual data from an overflow write */
++                      srp_rsp->flags = SRP_RSP_FLAG_DOOVER;
++                      srp_rsp->data_out_res_cnt = cpu_to_be32(resid);
++              } else if (cmd->data_direction == DMA_FROM_DEVICE) {
++                      /* residual data from an overflow read */
++                      srp_rsp->flags = SRP_RSP_FLAG_DIOVER;
++                      srp_rsp->data_in_res_cnt = cpu_to_be32(resid);
++              }
++      }
++
+       if (sense_data_len) {
+               BUILD_BUG_ON(MIN_MAX_RSP_SIZE <= sizeof(*srp_rsp));
+               max_sense_len = ch->max_ti_iu_len - sizeof(*srp_rsp);
index c43c38a6ae880cff370f7cc0c9d1dbb3a2afe223..e72a66130b75c30a022696ebbed9c212eb3d13ef 100644 (file)
@@ -20,3 +20,4 @@ iommu-remove-device-link-to-group-on-failure.patch
 gpio-fix-error-message-on-out-of-range-gpio-in-lookup-table.patch
 hsr-reset-network-header-when-supervision-frame-is-created.patch
 cifs-adjust-indentation-in-smb2_open_file.patch
+rdma-srpt-report-the-scsi-residual-to-the-initiator.patch