eventdev/eth_rx: fix queue config get API

Message ID 20220209050925.1552306-1-s.v.naga.harish.k@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Jerin Jacob
Headers
Series eventdev/eth_rx: fix queue config get API |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
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-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS

Commit Message

Naga Harish K, S V Feb. 9, 2022, 5:09 a.m. UTC
  the memcpy size used in queue config get function is more than
the source size. Use correct size to avoid copy of unnecessary
data.

Fixes: da781e6488 ("eventdev/eth_rx: support Rx queue config get")

Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
 lib/eventdev/rte_event_eth_rx_adapter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Jerin Jacob Feb. 14, 2022, 3:28 p.m. UTC | #1
On Wed, Feb 9, 2022 at 10:40 AM Naga Harish K S V
<s.v.naga.harish.k@intel.com> wrote:
>
> the memcpy size used in queue config get function is more than
> the source size. Use correct size to avoid copy of unnecessary
> data.
>
> Fixes: da781e6488 ("eventdev/eth_rx: support Rx queue config get")
>
> Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>

Hi @Jayatheerthan, Jay

Could you review it?


> ---
>  lib/eventdev/rte_event_eth_rx_adapter.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
> index ae1e260c08..e44499e887 100644
> --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> @@ -3238,7 +3238,7 @@ rte_event_eth_rx_adapter_queue_conf_get(uint8_t id,
>                         RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID;
>         queue_conf->servicing_weight = queue_info->wt;
>
> -       memcpy(&queue_conf->ev, qi_ev, sizeof(*qi_ev));
> +       memcpy(&queue_conf->ev, qi_ev, sizeof(queue_info->event));
>
>         dev = &rte_eventdevs[rx_adapter->eventdev_id];
>         if (dev->dev_ops->eth_rx_adapter_queue_conf_get != NULL) {
> --
> 2.23.0
>
  
Jayatheerthan, Jay Feb. 14, 2022, 5:09 p.m. UTC | #2
Hi Harish,

> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Monday, February 14, 2022 8:59 PM
> To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; Jerin Jacob <jerinj@marvell.com>; dpdk-dev <dev@dpdk.org>
> Subject: Re: [PATCH] eventdev/eth_rx: fix queue config get API
> 
> On Wed, Feb 9, 2022 at 10:40 AM Naga Harish K S V
> <s.v.naga.harish.k@intel.com> wrote:
> >
> > the memcpy size used in queue config get function is more than
> > the source size. Use correct size to avoid copy of unnecessary
> > data.
> >
> > Fixes: da781e6488 ("eventdev/eth_rx: support Rx queue config get")
> >
> > Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> 
> Hi @Jayatheerthan, Jay
> 
> Could you review it?
> 
> 
> > ---
> >  lib/eventdev/rte_event_eth_rx_adapter.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
> > index ae1e260c08..e44499e887 100644
> > --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> > @@ -3238,7 +3238,7 @@ rte_event_eth_rx_adapter_queue_conf_get(uint8_t id,
> >                         RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID;
> >         queue_conf->servicing_weight = queue_info->wt;
> >
> > -       memcpy(&queue_conf->ev, qi_ev, sizeof(*qi_ev));
> > +       memcpy(&queue_conf->ev, qi_ev, sizeof(queue_info->event));

Why do we need to assign queue_info->event to qi_ev and then copy it to queue_conf->ev ? We should be able to do straight copy from queue_info->event to queue_conf->ev.

> >
> >         dev = &rte_eventdevs[rx_adapter->eventdev_id];
> >         if (dev->dev_ops->eth_rx_adapter_queue_conf_get != NULL) {
> > --
> > 2.23.0
> >
  
Naga Harish K, S V Feb. 14, 2022, 5:13 p.m. UTC | #3
Hi Jay,

> -----Original Message-----
> From: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Sent: Monday, February 14, 2022 10:39 PM
> To: Jerin Jacob <jerinjacobk@gmail.com>; Naga Harish K, S V
> <s.v.naga.harish.k@intel.com>
> Cc: Jerin Jacob <jerinj@marvell.com>; dpdk-dev <dev@dpdk.org>
> Subject: RE: [PATCH] eventdev/eth_rx: fix queue config get API
> 
> Hi Harish,
> 
> > -----Original Message-----
> > From: Jerin Jacob <jerinjacobk@gmail.com>
> > Sent: Monday, February 14, 2022 8:59 PM
> > To: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; Jerin Jacob
> > <jerinj@marvell.com>; dpdk-dev <dev@dpdk.org>
> > Subject: Re: [PATCH] eventdev/eth_rx: fix queue config get API
> >
> > On Wed, Feb 9, 2022 at 10:40 AM Naga Harish K S V
> > <s.v.naga.harish.k@intel.com> wrote:
> > >
> > > the memcpy size used in queue config get function is more than the
> > > source size. Use correct size to avoid copy of unnecessary data.
> > >
> > > Fixes: da781e6488 ("eventdev/eth_rx: support Rx queue config get")
> > >
> > > Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> >
> > Hi @Jayatheerthan, Jay
> >
> > Could you review it?
> >
> >
> > > ---
> > >  lib/eventdev/rte_event_eth_rx_adapter.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c
> > > b/lib/eventdev/rte_event_eth_rx_adapter.c
> > > index ae1e260c08..e44499e887 100644
> > > --- a/lib/eventdev/rte_event_eth_rx_adapter.c
> > > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c
> > > @@ -3238,7 +3238,7 @@
> rte_event_eth_rx_adapter_queue_conf_get(uint8_t id,
> > >                         RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID;
> > >         queue_conf->servicing_weight = queue_info->wt;
> > >
> > > -       memcpy(&queue_conf->ev, qi_ev, sizeof(*qi_ev));
> > > +       memcpy(&queue_conf->ev, qi_ev, sizeof(queue_info->event));
> 
> Why do we need to assign queue_info->event to qi_ev and then copy it to
> queue_conf->ev ? We should be able to do straight copy from queue_info-
> >event to queue_conf->ev.
> 

Updated in v2 patch. Also added vector data and queue event buffer size.

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

Patch

diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index ae1e260c08..e44499e887 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -3238,7 +3238,7 @@  rte_event_eth_rx_adapter_queue_conf_get(uint8_t id,
 			RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID;
 	queue_conf->servicing_weight = queue_info->wt;
 
-	memcpy(&queue_conf->ev, qi_ev, sizeof(*qi_ev));
+	memcpy(&queue_conf->ev, qi_ev, sizeof(queue_info->event));
 
 	dev = &rte_eventdevs[rx_adapter->eventdev_id];
 	if (dev->dev_ops->eth_rx_adapter_queue_conf_get != NULL) {