* [dpdk-dev] [PATCH] eventdev/rx_adapter: fix wrr buffer overrun issue
@ 2021-10-18 8:20 Naga Harish K S V
0 siblings, 0 replies; 4+ messages in thread
From: Naga Harish K S V @ 2021-10-18 8:20 UTC (permalink / raw)
To: jerinj, jay.jayatheerthan; +Cc: dev
when a poll queue is removed from a rx_adapter instance, the wrr poll
array is recomputed. The wrr array length is reduced in this case. The
next wrr position to poll is stored in wrr_pos variable of rx_adapter
instance. This wrr_pos can become invalid in some cases after wrr is
recomputed. Using this varaible to get the next queue and device pair
may leed to wrr buffer overruns.
Resetting the wrr_pos to zero after recomputation of wrr array fixes
the buffer overrun issue.
Fixes: 9c38b704d280 ("eventdev: add eth Rx adapter implementation")
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
lib/eventdev/rte_event_eth_rx_adapter.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index bd68b8efe1..82a652d305 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -2773,6 +2773,11 @@ rte_event_eth_rx_adapter_queue_del(uint8_t id, uint16_t eth_dev_id,
rx_adapter->eth_rx_poll = rx_poll;
rx_adapter->wrr_sched = rx_wrr;
rx_adapter->wrr_len = nb_wrr;
+ /*
+ * reset next poll start position (wrr_pos) to avoid buffer
+ * overrun when wrr_len is reduced in case of queue delete
+ */
+ rx_adapter->wrr_pos = 0;
rx_adapter->num_intr_vec += num_intr_vec;
if (dev_info->nb_dev_queues == 0) {
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] eventdev/rx_adapter: fix wrr buffer overrun issue
2021-10-18 11:09 ` Jayatheerthan, Jay
@ 2021-10-20 9:25 ` Jerin Jacob
0 siblings, 0 replies; 4+ messages in thread
From: Jerin Jacob @ 2021-10-20 9:25 UTC (permalink / raw)
To: Jayatheerthan, Jay; +Cc: Naga Harish K, S V, jerinj, dev
On Mon, Oct 18, 2021 at 4:39 PM Jayatheerthan, Jay
<jay.jayatheerthan@intel.com> wrote:
>
> Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
Changed the subject to:
eventdev/rx_adapter: fix WRR buffer overrun issue
Cced stable@dpdk.org
Series applied to dpdk-next-net-eventdev/for-main. Thanks
>
> > -----Original Message-----
> > From: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > Sent: Monday, October 18, 2021 1:56 PM
> > To: jerinj@marvell.com; Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> > Cc: dev@dpdk.org
> > Subject: [PATCH] eventdev/rx_adapter: fix wrr buffer overrun issue
> >
> > when a poll queue is removed from a rx_adapter instance, the wrr poll
> > array is recomputed. The wrr array length is reduced in this case. The
> > next wrr position to poll is stored in wrr_pos variable of rx_adapter
> > instance. This wrr_pos can become invalid in some cases after wrr is
> > recomputed. Using this variable to get the next queue and device pair
> > may leed to wrr buffer overruns.
> >
> > Resetting the wrr_pos to zero after recomputation of wrr array fixes
> > the buffer overrun issue.
> >
> > Fixes: 9c38b704d280 ("eventdev: add eth Rx adapter implementation")
> >
> > Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> > ---
> > lib/eventdev/rte_event_eth_rx_adapter.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
> > index bd68b8efe1..82a652d305 100644
> > --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> > @@ -2773,6 +2773,11 @@ rte_event_eth_rx_adapter_queue_del(uint8_t id, uint16_t eth_dev_id,
> > rx_adapter->eth_rx_poll = rx_poll;
> > rx_adapter->wrr_sched = rx_wrr;
> > rx_adapter->wrr_len = nb_wrr;
> > + /*
> > + * reset next poll start position (wrr_pos) to avoid buffer
> > + * overrun when wrr_len is reduced in case of queue delete
> > + */
> > + rx_adapter->wrr_pos = 0;
> > rx_adapter->num_intr_vec += num_intr_vec;
> >
> > if (dev_info->nb_dev_queues == 0) {
> > --
> > 2.25.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] eventdev/rx_adapter: fix wrr buffer overrun issue
2021-10-18 8:25 Naga Harish K S V
@ 2021-10-18 11:09 ` Jayatheerthan, Jay
2021-10-20 9:25 ` Jerin Jacob
0 siblings, 1 reply; 4+ messages in thread
From: Jayatheerthan, Jay @ 2021-10-18 11:09 UTC (permalink / raw)
To: Naga Harish K, S V, jerinj; +Cc: dev
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
> -----Original Message-----
> From: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> Sent: Monday, October 18, 2021 1:56 PM
> To: jerinj@marvell.com; Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Cc: dev@dpdk.org
> Subject: [PATCH] eventdev/rx_adapter: fix wrr buffer overrun issue
>
> when a poll queue is removed from a rx_adapter instance, the wrr poll
> array is recomputed. The wrr array length is reduced in this case. The
> next wrr position to poll is stored in wrr_pos variable of rx_adapter
> instance. This wrr_pos can become invalid in some cases after wrr is
> recomputed. Using this variable to get the next queue and device pair
> may leed to wrr buffer overruns.
>
> Resetting the wrr_pos to zero after recomputation of wrr array fixes
> the buffer overrun issue.
>
> Fixes: 9c38b704d280 ("eventdev: add eth Rx adapter implementation")
>
> Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> ---
> lib/eventdev/rte_event_eth_rx_adapter.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
> index bd68b8efe1..82a652d305 100644
> --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> @@ -2773,6 +2773,11 @@ rte_event_eth_rx_adapter_queue_del(uint8_t id, uint16_t eth_dev_id,
> rx_adapter->eth_rx_poll = rx_poll;
> rx_adapter->wrr_sched = rx_wrr;
> rx_adapter->wrr_len = nb_wrr;
> + /*
> + * reset next poll start position (wrr_pos) to avoid buffer
> + * overrun when wrr_len is reduced in case of queue delete
> + */
> + rx_adapter->wrr_pos = 0;
> rx_adapter->num_intr_vec += num_intr_vec;
>
> if (dev_info->nb_dev_queues == 0) {
> --
> 2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [dpdk-dev] [PATCH] eventdev/rx_adapter: fix wrr buffer overrun issue
@ 2021-10-18 8:25 Naga Harish K S V
2021-10-18 11:09 ` Jayatheerthan, Jay
0 siblings, 1 reply; 4+ messages in thread
From: Naga Harish K S V @ 2021-10-18 8:25 UTC (permalink / raw)
To: jerinj, jay.jayatheerthan; +Cc: dev
when a poll queue is removed from a rx_adapter instance, the wrr poll
array is recomputed. The wrr array length is reduced in this case. The
next wrr position to poll is stored in wrr_pos variable of rx_adapter
instance. This wrr_pos can become invalid in some cases after wrr is
recomputed. Using this variable to get the next queue and device pair
may leed to wrr buffer overruns.
Resetting the wrr_pos to zero after recomputation of wrr array fixes
the buffer overrun issue.
Fixes: 9c38b704d280 ("eventdev: add eth Rx adapter implementation")
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
lib/eventdev/rte_event_eth_rx_adapter.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index bd68b8efe1..82a652d305 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -2773,6 +2773,11 @@ rte_event_eth_rx_adapter_queue_del(uint8_t id, uint16_t eth_dev_id,
rx_adapter->eth_rx_poll = rx_poll;
rx_adapter->wrr_sched = rx_wrr;
rx_adapter->wrr_len = nb_wrr;
+ /*
+ * reset next poll start position (wrr_pos) to avoid buffer
+ * overrun when wrr_len is reduced in case of queue delete
+ */
+ rx_adapter->wrr_pos = 0;
rx_adapter->num_intr_vec += num_intr_vec;
if (dev_info->nb_dev_queues == 0) {
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-10-20 9:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-18 8:20 [dpdk-dev] [PATCH] eventdev/rx_adapter: fix wrr buffer overrun issue Naga Harish K S V
2021-10-18 8:25 Naga Harish K S V
2021-10-18 11:09 ` Jayatheerthan, Jay
2021-10-20 9:25 ` Jerin Jacob
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).