IB/rxe: Clear queue buffer when modifying QP to reset
authorYonatan Cohen <yonatanc@mellanox.com>
Wed, 16 Nov 2016 08:39:17 +0000 (10:39 +0200)
committerDoug Ledford <dledford@redhat.com>
Thu, 17 Nov 2016 01:03:44 +0000 (20:03 -0500)
RXE resets the send-q only once in rxe_qp_init_req() when
QP is created, but when the QP is reused after QP reset, the send-q
holds previous garbage data.

This garbage data wrongly fails CQEs that otherwise
should have completed successfully.

Fixes: 8700e3e7c485 ("Soft RoCE driver")
Signed-off-by: Yonatan Cohen <yonatanc@mellanox.com>
Reviewed-by: Moni Shoua <monis@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/sw/rxe/rxe_qp.c
drivers/infiniband/sw/rxe/rxe_queue.c
drivers/infiniband/sw/rxe/rxe_queue.h

index b8036cfbce04041d77a3679979ed5def0d9a0b46..95aaaa282a0406b192dcadb5258168a3aee12858 100644 (file)
@@ -522,6 +522,7 @@ static void rxe_qp_reset(struct rxe_qp *qp)
        if (qp->sq.queue) {
                __rxe_do_task(&qp->comp.task);
                __rxe_do_task(&qp->req.task);
+               rxe_queue_reset(qp->sq.queue);
        }
 
        /* cleanup attributes */
index 08274254eb887531068d8239dd13c95a16ef190c..d14bf496d62d3af7581bb307fa1350989a90f042 100644 (file)
@@ -84,6 +84,15 @@ err1:
        return -EINVAL;
 }
 
+inline void rxe_queue_reset(struct rxe_queue *q)
+{
+       /* queue is comprised from header and the memory
+        * of the actual queue. See "struct rxe_queue_buf" in rxe_queue.h
+        * reset only the queue itself and not the management header
+        */
+       memset(q->buf->data, 0, q->buf_size - sizeof(struct rxe_queue_buf));
+}
+
 struct rxe_queue *rxe_queue_init(struct rxe_dev *rxe,
                                 int *num_elem,
                                 unsigned int elem_size)
index 239fd609c31ef51b47d306420a54a26d3ddeb185..8c8641c87817f3fcb6024e58ae31311179d4d060 100644 (file)
@@ -84,6 +84,8 @@ int do_mmap_info(struct rxe_dev *rxe,
                 size_t buf_size,
                 struct rxe_mmap_info **ip_p);
 
+void rxe_queue_reset(struct rxe_queue *q);
+
 struct rxe_queue *rxe_queue_init(struct rxe_dev *rxe,
                                 int *num_elem,
                                 unsigned int elem_size);