nvme tcp receive errors

Sagi Grimberg sagi at grimberg.me
Mon May 3 20:38:39 BST 2021


>>> Hey Keith,
>>>
>>> Did this resolve the issues?
>>
>> We're unfortunately still observing data digest issues even with this.
>> Most of the testing has shifted to the r2t error, so I don't have any
>> additional details on the data digest problem.
> 
> I've looked again at the code, and I'm not convinced that the patch
> is needed at all anymore, I'm now surprised that it actually changed
> anything (disregarding data digest).
> 
> The driver does not track the received bytes by definition, it relies
> on the controller to send it a completion, or set the success flag in
> the _last_ c2hdata pdu. Does your target set
> NVME_TCP_F_DATA_SUCCESS on any of the c2hdata pdus?

Perhaps you can also run this patch instead?
--
diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 6bd5b281c818..a848b5b7f77b 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -55,6 +55,7 @@ struct nvme_tcp_request {
         /* send state */
         size_t                  offset;
         size_t                  data_sent;
+       size_t                  data_received;
         enum nvme_tcp_send_state state;
  };

@@ -751,6 +752,7 @@ static int nvme_tcp_recv_data(struct nvme_tcp_queue 
*queue, struct sk_buff *skb,
                 *len -= recv_len;
                 *offset += recv_len;
                 queue->data_remaining -= recv_len;
+               req->data_received += recv_len;
         }

         if (!queue->data_remaining) {
@@ -759,6 +761,7 @@ static int nvme_tcp_recv_data(struct nvme_tcp_queue 
*queue, struct sk_buff *skb,
                         queue->ddgst_remaining = NVME_TCP_DIGEST_LENGTH;
                 } else {
                         if (pdu->hdr.flags & NVME_TCP_F_DATA_SUCCESS) {
+                               BUG_ON(req->data_received != req->data_len);
                                 nvme_tcp_end_request(rq, NVME_SC_SUCCESS);
                                 queue->nr_cqe++;
                         }
@@ -2274,6 +2277,7 @@ static blk_status_t nvme_tcp_setup_cmd_pdu(struct 
nvme_ns *ns,
         req->state = NVME_TCP_SEND_CMD_PDU;
         req->offset = 0;
         req->data_sent = 0;
+       req->data_received = 0;
         req->pdu_len = 0;
         req->pdu_sent = 0;
         req->data_len = blk_rq_nr_phys_segments(rq) ?
--



More information about the Linux-nvme mailing list