[v2] event/octeontx2: fix queue removal from Rx adapter

Message ID 1587052060-22042-1-git-send-email-lbartosik@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series [v2] event/octeontx2: fix queue removal from Rx adapter |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/travis-robot success Travis build: passed
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing fail Testing issues
ci/iol-intel-Performance success Performance Testing PASS
ci/Intel-compilation fail Compilation issues

Commit Message

Lukas Bartosik [C] April 16, 2020, 3:47 p.m. UTC
  When eth port queue is removed from Rx adapter using
rte_event_eth_rx_adapter_queue_del() it incorrectly
initializes CQ context instead of modifying it. This
might lead to a crash when CQ context is modified
as a part of rte_eth_dev_stop() sequence as CQ will
hold invalid entries. This is responsibility of an
application to call rte_event_eth_rx_adapter_queue_del()
to remove eth port queue from Rx adapter in tear down
sequence.

Fixes: 37720fc1fba8 ("event/octeontx2: add Rx adapter")
Cc: stable@dpdk.org

Signed-off-by: Lukasz Bartosik <lbartosik@marvell.com>
---
 drivers/event/octeontx2/otx2_evdev_adptr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Pavan Nikhilesh Bhagavatula May 1, 2020, 11:14 a.m. UTC | #1
>When eth port queue is removed from Rx adapter using
>rte_event_eth_rx_adapter_queue_del() it incorrectly
>initializes CQ context instead of modifying it. This
>might lead to a crash when CQ context is modified
>as a part of rte_eth_dev_stop() sequence as CQ will
>hold invalid entries. This is responsibility of an
>application to call rte_event_eth_rx_adapter_queue_del()
>to remove eth port queue from Rx adapter in tear down
>sequence.
>
>Fixes: 37720fc1fba8 ("event/octeontx2: add Rx adapter")
>Cc: stable@dpdk.org
>
>Signed-off-by: Lukasz Bartosik <lbartosik@marvell.com>

Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>

>---
> drivers/event/octeontx2/otx2_evdev_adptr.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/event/octeontx2/otx2_evdev_adptr.c
>b/drivers/event/octeontx2/otx2_evdev_adptr.c
>index 233cba2..8bdcfa3 100644
>--- a/drivers/event/octeontx2/otx2_evdev_adptr.c
>+++ b/drivers/event/octeontx2/otx2_evdev_adptr.c
>@@ -133,7 +133,7 @@ sso_rxq_disable(struct otx2_eth_dev *dev,
>uint16_t qid)
> 	aq = otx2_mbox_alloc_msg_nix_aq_enq(mbox);
> 	aq->qidx = qid;
> 	aq->ctype = NIX_AQ_CTYPE_CQ;
>-	aq->op = NIX_AQ_INSTOP_INIT;
>+	aq->op = NIX_AQ_INSTOP_WRITE;
>
> 	aq->cq.ena = 1;
> 	aq->cq.caching = 1;
>@@ -144,7 +144,7 @@ sso_rxq_disable(struct otx2_eth_dev *dev,
>uint16_t qid)
>
> 	rc = otx2_mbox_process(mbox);
> 	if (rc < 0) {
>-		otx2_err("Failed to init cq context");
>+		otx2_err("Failed to enable cq context");
> 		goto fail;
> 	}
>
>--
>2.7.4
  
Jerin Jacob May 2, 2020, 9:46 a.m. UTC | #2
On Fri, May 1, 2020 at 4:44 PM Pavan Nikhilesh Bhagavatula
<pbhagavatula@marvell.com> wrote:
>
> >When eth port queue is removed from Rx adapter using
> >rte_event_eth_rx_adapter_queue_del() it incorrectly
> >initializes CQ context instead of modifying it. This
> >might lead to a crash when CQ context is modified
> >as a part of rte_eth_dev_stop() sequence as CQ will
> >hold invalid entries. This is responsibility of an
> >application to call rte_event_eth_rx_adapter_queue_del()
> >to remove eth port queue from Rx adapter in tear down
> >sequence.
> >
> >Fixes: 37720fc1fba8 ("event/octeontx2: add Rx adapter")
> >Cc: stable@dpdk.org
> >
> >Signed-off-by: Lukasz Bartosik <lbartosik@marvell.com>
>
> Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>


Applied to dpdk-next-eventdev/master. Thanks.


>
> >---
> > drivers/event/octeontx2/otx2_evdev_adptr.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> >diff --git a/drivers/event/octeontx2/otx2_evdev_adptr.c
> >b/drivers/event/octeontx2/otx2_evdev_adptr.c
> >index 233cba2..8bdcfa3 100644
> >--- a/drivers/event/octeontx2/otx2_evdev_adptr.c
> >+++ b/drivers/event/octeontx2/otx2_evdev_adptr.c
> >@@ -133,7 +133,7 @@ sso_rxq_disable(struct otx2_eth_dev *dev,
> >uint16_t qid)
> >       aq = otx2_mbox_alloc_msg_nix_aq_enq(mbox);
> >       aq->qidx = qid;
> >       aq->ctype = NIX_AQ_CTYPE_CQ;
> >-      aq->op = NIX_AQ_INSTOP_INIT;
> >+      aq->op = NIX_AQ_INSTOP_WRITE;
> >
> >       aq->cq.ena = 1;
> >       aq->cq.caching = 1;
> >@@ -144,7 +144,7 @@ sso_rxq_disable(struct otx2_eth_dev *dev,
> >uint16_t qid)
> >
> >       rc = otx2_mbox_process(mbox);
> >       if (rc < 0) {
> >-              otx2_err("Failed to init cq context");
> >+              otx2_err("Failed to enable cq context");
> >               goto fail;
> >       }
> >
> >--
> >2.7.4
>
  

Patch

diff --git a/drivers/event/octeontx2/otx2_evdev_adptr.c b/drivers/event/octeontx2/otx2_evdev_adptr.c
index 233cba2..8bdcfa3 100644
--- a/drivers/event/octeontx2/otx2_evdev_adptr.c
+++ b/drivers/event/octeontx2/otx2_evdev_adptr.c
@@ -133,7 +133,7 @@  sso_rxq_disable(struct otx2_eth_dev *dev, uint16_t qid)
 	aq = otx2_mbox_alloc_msg_nix_aq_enq(mbox);
 	aq->qidx = qid;
 	aq->ctype = NIX_AQ_CTYPE_CQ;
-	aq->op = NIX_AQ_INSTOP_INIT;
+	aq->op = NIX_AQ_INSTOP_WRITE;
 
 	aq->cq.ena = 1;
 	aq->cq.caching = 1;
@@ -144,7 +144,7 @@  sso_rxq_disable(struct otx2_eth_dev *dev, uint16_t qid)
 
 	rc = otx2_mbox_process(mbox);
 	if (rc < 0) {
-		otx2_err("Failed to init cq context");
+		otx2_err("Failed to enable cq context");
 		goto fail;
 	}