eventdev: fix missing internal port checks

Message ID 20211213083143.4233-1-pbhagavatula@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series eventdev: fix missing internal port checks |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot: build success github build: passed
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

Pavan Nikhilesh Bhagavatula Dec. 13, 2021, 8:31 a.m. UTC
  From: Pavan Nikhilesh <pbhagavatula@marvell.com>

When event delivery is through internal port, stats are mainitained
by HW and we should avoid reading SW data structures for stats.
Fix missing internal port checks.

Fixes: 995b150c1ae1 ("eventdev/eth_rx: add queue stats API")

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 lib/eventdev/rte_event_eth_rx_adapter.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

--
2.34.0
  

Comments

Jayatheerthan, Jay Dec. 14, 2021, 5:52 a.m. UTC | #1
@Harish, could you take a look at this please ?

-Jay


> -----Original Message-----
> From: pbhagavatula@marvell.com <pbhagavatula@marvell.com>
> Sent: Monday, December 13, 2021 2:02 PM
> To: jerinj@marvell.com; Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@marvell.com>
> Subject: [PATCH] eventdev: fix missing internal port checks
> 
> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
> 
> When event delivery is through internal port, stats are mainitained
> by HW and we should avoid reading SW data structures for stats.
> Fix missing internal port checks.
> 
> Fixes: 995b150c1ae1 ("eventdev/eth_rx: add queue stats API")
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
> ---
>  lib/eventdev/rte_event_eth_rx_adapter.c | 24 ++++++++++++++----------
>  1 file changed, 14 insertions(+), 10 deletions(-)
> 
> diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
> index 809416d9b7..da223aacac 100644
> --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> @@ -2984,15 +2984,17 @@ rte_event_eth_rx_adapter_queue_stats_get(uint8_t id,
>  		return -EINVAL;
>  	}
> 
> -	queue_info = &dev_info->rx_queue[rx_queue_id];
> -	event_buf = queue_info->event_buf;
> -	q_stats = queue_info->stats;
> +	if (dev_info->internal_event_port == 0) {
> +		queue_info = &dev_info->rx_queue[rx_queue_id];
> +		event_buf = queue_info->event_buf;
> +		q_stats = queue_info->stats;
> 
> -	stats->rx_event_buf_count = event_buf->count;
> -	stats->rx_event_buf_size = event_buf->events_size;
> -	stats->rx_packets = q_stats->rx_packets;
> -	stats->rx_poll_count = q_stats->rx_poll_count;
> -	stats->rx_dropped = q_stats->rx_dropped;
> +		stats->rx_event_buf_count = event_buf->count;
> +		stats->rx_event_buf_size = event_buf->events_size;
> +		stats->rx_packets = q_stats->rx_packets;
> +		stats->rx_poll_count = q_stats->rx_poll_count;
> +		stats->rx_dropped = q_stats->rx_dropped;
> +	}
> 
>  	dev = &rte_eventdevs[rx_adapter->eventdev_id];
>  	if (dev->dev_ops->eth_rx_adapter_queue_stats_get != NULL) {
> @@ -3086,8 +3088,10 @@ rte_event_eth_rx_adapter_queue_stats_reset(uint8_t id,
>  		return -EINVAL;
>  	}
> 
> -	queue_info = &dev_info->rx_queue[rx_queue_id];
> -	rxa_queue_stats_reset(queue_info);
> +	if (dev_info->internal_event_port == 0) {
> +		queue_info = &dev_info->rx_queue[rx_queue_id];
> +		rxa_queue_stats_reset(queue_info);
> +	}
> 
>  	dev = &rte_eventdevs[rx_adapter->eventdev_id];
>  	if (dev->dev_ops->eth_rx_adapter_queue_stats_reset != NULL) {
> --
> 2.34.0
  
Naga Harish K, S V Dec. 14, 2021, 10:53 a.m. UTC | #2
The patch looks good to me.

> -----Original Message-----
> From: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Sent: Tuesday, December 14, 2021 11:23 AM
> To: pbhagavatula@marvell.com; jerinj@marvell.com; Naga Harish K, S V
> <s.v.naga.harish.k@intel.com>
> Cc: dev@dpdk.org
> Subject: RE: [PATCH] eventdev: fix missing internal port checks
> 
> @Harish, could you take a look at this please ?
> 
> -Jay
> 
> 
> > -----Original Message-----
> > From: pbhagavatula@marvell.com <pbhagavatula@marvell.com>
> > Sent: Monday, December 13, 2021 2:02 PM
> > To: jerinj@marvell.com; Jayatheerthan, Jay
> > <jay.jayatheerthan@intel.com>
> > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@marvell.com>
> > Subject: [PATCH] eventdev: fix missing internal port checks
> >
> > From: Pavan Nikhilesh <pbhagavatula@marvell.com>
> >
> > When event delivery is through internal port, stats are mainitained by
> > HW and we should avoid reading SW data structures for stats.
> > Fix missing internal port checks.
> >
> > Fixes: 995b150c1ae1 ("eventdev/eth_rx: add queue stats API")
> >
> > Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
> > ---
> >  lib/eventdev/rte_event_eth_rx_adapter.c | 24 ++++++++++++++----------
> >  1 file changed, 14 insertions(+), 10 deletions(-)
> >
> > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c
> > b/lib/eventdev/rte_event_eth_rx_adapter.c
> > index 809416d9b7..da223aacac 100644
> > --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> > @@ -2984,15 +2984,17 @@
> rte_event_eth_rx_adapter_queue_stats_get(uint8_t id,
> >  		return -EINVAL;
> >  	}
> >
> > -	queue_info = &dev_info->rx_queue[rx_queue_id];
> > -	event_buf = queue_info->event_buf;
> > -	q_stats = queue_info->stats;
> > +	if (dev_info->internal_event_port == 0) {
> > +		queue_info = &dev_info->rx_queue[rx_queue_id];
> > +		event_buf = queue_info->event_buf;
> > +		q_stats = queue_info->stats;
> >
> > -	stats->rx_event_buf_count = event_buf->count;
> > -	stats->rx_event_buf_size = event_buf->events_size;
> > -	stats->rx_packets = q_stats->rx_packets;
> > -	stats->rx_poll_count = q_stats->rx_poll_count;
> > -	stats->rx_dropped = q_stats->rx_dropped;
> > +		stats->rx_event_buf_count = event_buf->count;
> > +		stats->rx_event_buf_size = event_buf->events_size;
> > +		stats->rx_packets = q_stats->rx_packets;
> > +		stats->rx_poll_count = q_stats->rx_poll_count;
> > +		stats->rx_dropped = q_stats->rx_dropped;
> > +	}
> >
> >  	dev = &rte_eventdevs[rx_adapter->eventdev_id];
> >  	if (dev->dev_ops->eth_rx_adapter_queue_stats_get != NULL) { @@
> > -3086,8 +3088,10 @@
> rte_event_eth_rx_adapter_queue_stats_reset(uint8_t id,
> >  		return -EINVAL;
> >  	}
> >
> > -	queue_info = &dev_info->rx_queue[rx_queue_id];
> > -	rxa_queue_stats_reset(queue_info);
> > +	if (dev_info->internal_event_port == 0) {
> > +		queue_info = &dev_info->rx_queue[rx_queue_id];
> > +		rxa_queue_stats_reset(queue_info);
> > +	}
> >
> >  	dev = &rte_eventdevs[rx_adapter->eventdev_id];
> >  	if (dev->dev_ops->eth_rx_adapter_queue_stats_reset != NULL) {
> > --
> > 2.34.0
  
Jayatheerthan, Jay Dec. 14, 2021, 11:43 a.m. UTC | #3
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>


> -----Original Message-----
> From: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> Sent: Tuesday, December 14, 2021 4:23 PM
> To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; pbhagavatula@marvell.com; jerinj@marvell.com
> Cc: dev@dpdk.org
> Subject: RE: [PATCH] eventdev: fix missing internal port checks
> 
> The patch looks good to me.
> 
> > -----Original Message-----
> > From: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> > Sent: Tuesday, December 14, 2021 11:23 AM
> > To: pbhagavatula@marvell.com; jerinj@marvell.com; Naga Harish K, S V
> > <s.v.naga.harish.k@intel.com>
> > Cc: dev@dpdk.org
> > Subject: RE: [PATCH] eventdev: fix missing internal port checks
> >
> > @Harish, could you take a look at this please ?
> >
> > -Jay
> >
> >
> > > -----Original Message-----
> > > From: pbhagavatula@marvell.com <pbhagavatula@marvell.com>
> > > Sent: Monday, December 13, 2021 2:02 PM
> > > To: jerinj@marvell.com; Jayatheerthan, Jay
> > > <jay.jayatheerthan@intel.com>
> > > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@marvell.com>
> > > Subject: [PATCH] eventdev: fix missing internal port checks
> > >
> > > From: Pavan Nikhilesh <pbhagavatula@marvell.com>
> > >
> > > When event delivery is through internal port, stats are mainitained by
> > > HW and we should avoid reading SW data structures for stats.
> > > Fix missing internal port checks.
> > >
> > > Fixes: 995b150c1ae1 ("eventdev/eth_rx: add queue stats API")
> > >
> > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
> > > ---
> > >  lib/eventdev/rte_event_eth_rx_adapter.c | 24 ++++++++++++++----------
> > >  1 file changed, 14 insertions(+), 10 deletions(-)
> > >
> > > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c
> > > b/lib/eventdev/rte_event_eth_rx_adapter.c
> > > index 809416d9b7..da223aacac 100644
> > > --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> > > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> > > @@ -2984,15 +2984,17 @@
> > rte_event_eth_rx_adapter_queue_stats_get(uint8_t id,
> > >  		return -EINVAL;
> > >  	}
> > >
> > > -	queue_info = &dev_info->rx_queue[rx_queue_id];
> > > -	event_buf = queue_info->event_buf;
> > > -	q_stats = queue_info->stats;
> > > +	if (dev_info->internal_event_port == 0) {
> > > +		queue_info = &dev_info->rx_queue[rx_queue_id];
> > > +		event_buf = queue_info->event_buf;
> > > +		q_stats = queue_info->stats;
> > >
> > > -	stats->rx_event_buf_count = event_buf->count;
> > > -	stats->rx_event_buf_size = event_buf->events_size;
> > > -	stats->rx_packets = q_stats->rx_packets;
> > > -	stats->rx_poll_count = q_stats->rx_poll_count;
> > > -	stats->rx_dropped = q_stats->rx_dropped;
> > > +		stats->rx_event_buf_count = event_buf->count;
> > > +		stats->rx_event_buf_size = event_buf->events_size;
> > > +		stats->rx_packets = q_stats->rx_packets;
> > > +		stats->rx_poll_count = q_stats->rx_poll_count;
> > > +		stats->rx_dropped = q_stats->rx_dropped;
> > > +	}
> > >
> > >  	dev = &rte_eventdevs[rx_adapter->eventdev_id];
> > >  	if (dev->dev_ops->eth_rx_adapter_queue_stats_get != NULL) { @@
> > > -3086,8 +3088,10 @@
> > rte_event_eth_rx_adapter_queue_stats_reset(uint8_t id,
> > >  		return -EINVAL;
> > >  	}
> > >
> > > -	queue_info = &dev_info->rx_queue[rx_queue_id];
> > > -	rxa_queue_stats_reset(queue_info);
> > > +	if (dev_info->internal_event_port == 0) {
> > > +		queue_info = &dev_info->rx_queue[rx_queue_id];
> > > +		rxa_queue_stats_reset(queue_info);
> > > +	}
> > >
> > >  	dev = &rte_eventdevs[rx_adapter->eventdev_id];
> > >  	if (dev->dev_ops->eth_rx_adapter_queue_stats_reset != NULL) {
> > > --
> > > 2.34.0
  
Jerin Jacob Jan. 20, 2022, 1:25 p.m. UTC | #4
On Tue, Dec 14, 2021 at 5:13 PM Jayatheerthan, Jay
<jay.jayatheerthan@intel.com> wrote:
>
>
> Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>


Updated git commit as

    eventdev/eth_rx: fix missing internal port checks

    When event delivery is through internal port, stats are mainitained
    by HW and we should avoid reading SW data structures for stats.
    Fix missing internal port checks.

    Fixes: 995b150c1ae1 ("eventdev/eth_rx: add queue stats API")
    Cc: stable@dpdk.org

    Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
    Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>


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: Tuesday, December 14, 2021 4:23 PM
> > To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; pbhagavatula@marvell.com; jerinj@marvell.com
> > Cc: dev@dpdk.org
> > Subject: RE: [PATCH] eventdev: fix missing internal port checks
> >
> > The patch looks good to me.
> >
> > > -----Original Message-----
> > > From: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> > > Sent: Tuesday, December 14, 2021 11:23 AM
> > > To: pbhagavatula@marvell.com; jerinj@marvell.com; Naga Harish K, S V
> > > <s.v.naga.harish.k@intel.com>
> > > Cc: dev@dpdk.org
> > > Subject: RE: [PATCH] eventdev: fix missing internal port checks
> > >
> > > @Harish, could you take a look at this please ?
> > >
> > > -Jay
> > >
> > >
> > > > -----Original Message-----
> > > > From: pbhagavatula@marvell.com <pbhagavatula@marvell.com>
> > > > Sent: Monday, December 13, 2021 2:02 PM
> > > > To: jerinj@marvell.com; Jayatheerthan, Jay
> > > > <jay.jayatheerthan@intel.com>
> > > > Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@marvell.com>
> > > > Subject: [PATCH] eventdev: fix missing internal port checks
> > > >
> > > > From: Pavan Nikhilesh <pbhagavatula@marvell.com>
> > > >
> > > > When event delivery is through internal port, stats are mainitained by
> > > > HW and we should avoid reading SW data structures for stats.
> > > > Fix missing internal port checks.
> > > >
> > > > Fixes: 995b150c1ae1 ("eventdev/eth_rx: add queue stats API")
> > > >
> > > > Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
> > > > ---
> > > >  lib/eventdev/rte_event_eth_rx_adapter.c | 24 ++++++++++++++----------
> > > >  1 file changed, 14 insertions(+), 10 deletions(-)
> > > >
> > > > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c
> > > > b/lib/eventdev/rte_event_eth_rx_adapter.c
> > > > index 809416d9b7..da223aacac 100644
> > > > --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> > > > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> > > > @@ -2984,15 +2984,17 @@
> > > rte_event_eth_rx_adapter_queue_stats_get(uint8_t id,
> > > >           return -EINVAL;
> > > >   }
> > > >
> > > > - queue_info = &dev_info->rx_queue[rx_queue_id];
> > > > - event_buf = queue_info->event_buf;
> > > > - q_stats = queue_info->stats;
> > > > + if (dev_info->internal_event_port == 0) {
> > > > +         queue_info = &dev_info->rx_queue[rx_queue_id];
> > > > +         event_buf = queue_info->event_buf;
> > > > +         q_stats = queue_info->stats;
> > > >
> > > > - stats->rx_event_buf_count = event_buf->count;
> > > > - stats->rx_event_buf_size = event_buf->events_size;
> > > > - stats->rx_packets = q_stats->rx_packets;
> > > > - stats->rx_poll_count = q_stats->rx_poll_count;
> > > > - stats->rx_dropped = q_stats->rx_dropped;
> > > > +         stats->rx_event_buf_count = event_buf->count;
> > > > +         stats->rx_event_buf_size = event_buf->events_size;
> > > > +         stats->rx_packets = q_stats->rx_packets;
> > > > +         stats->rx_poll_count = q_stats->rx_poll_count;
> > > > +         stats->rx_dropped = q_stats->rx_dropped;
> > > > + }
> > > >
> > > >   dev = &rte_eventdevs[rx_adapter->eventdev_id];
> > > >   if (dev->dev_ops->eth_rx_adapter_queue_stats_get != NULL) { @@
> > > > -3086,8 +3088,10 @@
> > > rte_event_eth_rx_adapter_queue_stats_reset(uint8_t id,
> > > >           return -EINVAL;
> > > >   }
> > > >
> > > > - queue_info = &dev_info->rx_queue[rx_queue_id];
> > > > - rxa_queue_stats_reset(queue_info);
> > > > + if (dev_info->internal_event_port == 0) {
> > > > +         queue_info = &dev_info->rx_queue[rx_queue_id];
> > > > +         rxa_queue_stats_reset(queue_info);
> > > > + }
> > > >
> > > >   dev = &rte_eventdevs[rx_adapter->eventdev_id];
> > > >   if (dev->dev_ops->eth_rx_adapter_queue_stats_reset != NULL) {
> > > > --
> > > > 2.34.0
>
  

Patch

diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index 809416d9b7..da223aacac 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -2984,15 +2984,17 @@  rte_event_eth_rx_adapter_queue_stats_get(uint8_t id,
 		return -EINVAL;
 	}

-	queue_info = &dev_info->rx_queue[rx_queue_id];
-	event_buf = queue_info->event_buf;
-	q_stats = queue_info->stats;
+	if (dev_info->internal_event_port == 0) {
+		queue_info = &dev_info->rx_queue[rx_queue_id];
+		event_buf = queue_info->event_buf;
+		q_stats = queue_info->stats;

-	stats->rx_event_buf_count = event_buf->count;
-	stats->rx_event_buf_size = event_buf->events_size;
-	stats->rx_packets = q_stats->rx_packets;
-	stats->rx_poll_count = q_stats->rx_poll_count;
-	stats->rx_dropped = q_stats->rx_dropped;
+		stats->rx_event_buf_count = event_buf->count;
+		stats->rx_event_buf_size = event_buf->events_size;
+		stats->rx_packets = q_stats->rx_packets;
+		stats->rx_poll_count = q_stats->rx_poll_count;
+		stats->rx_dropped = q_stats->rx_dropped;
+	}

 	dev = &rte_eventdevs[rx_adapter->eventdev_id];
 	if (dev->dev_ops->eth_rx_adapter_queue_stats_get != NULL) {
@@ -3086,8 +3088,10 @@  rte_event_eth_rx_adapter_queue_stats_reset(uint8_t id,
 		return -EINVAL;
 	}

-	queue_info = &dev_info->rx_queue[rx_queue_id];
-	rxa_queue_stats_reset(queue_info);
+	if (dev_info->internal_event_port == 0) {
+		queue_info = &dev_info->rx_queue[rx_queue_id];
+		rxa_queue_stats_reset(queue_info);
+	}

 	dev = &rte_eventdevs[rx_adapter->eventdev_id];
 	if (dev->dev_ops->eth_rx_adapter_queue_stats_reset != NULL) {