DPDK patches and discussions
 help / color / mirror / Atom feed
* [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
* [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

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:25 [dpdk-dev] [PATCH] eventdev/rx_adapter: fix wrr buffer overrun issue Naga Harish K S V
2021-10-18 11:09 ` Jayatheerthan, Jay
2021-10-20  9:25   ` Jerin Jacob
  -- strict thread matches above, loose matches on Subject: below --
2021-10-18  8:20 Naga Harish K S V

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).