If we have a 4-byte data digest to send to the wire, but we
have more data to send, set MSG_MORE to tell the stack
that more is coming.
Reviewed-by: Mark Wunderlich <mark.wunderlich@intel.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Keith Busch <kbusch@kernel.org>
        return 1;
 }
 
-static int nvmet_try_send_ddgst(struct nvmet_tcp_cmd *cmd)
+static int nvmet_try_send_ddgst(struct nvmet_tcp_cmd *cmd, bool last_in_batch)
 {
        struct nvmet_tcp_queue *queue = cmd->queue;
        struct msghdr msg = { .msg_flags = MSG_DONTWAIT };
        };
        int ret;
 
+       if (!last_in_batch && cmd->queue->send_list_len)
+               msg.msg_flags |= MSG_MORE;
+
        ret = kernel_sendmsg(queue->sock, &msg, &iov, 1, iov.iov_len);
        if (unlikely(ret <= 0))
                return ret;
        }
 
        if (cmd->state == NVMET_TCP_SEND_DDGST) {
-               ret = nvmet_try_send_ddgst(cmd);
+               ret = nvmet_try_send_ddgst(cmd, last_in_batch);
                if (ret <= 0)
                        goto done_send;
        }