DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ethdev: replace rte_memcpy with assignment
@ 2026-09-29 15:57 Stephen Hemminger
  2026-10-01  8:14 ` Andrew Rybchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2026-09-29 15:57 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Thomas Monjalon, Andrew Rybchenko

Can use structure assignment instead of rte_memcpy here.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/ethdev/rte_ethdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 7c57a9bb8f..6f5a957d00 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -16,7 +16,6 @@
 #include <rte_log.h>
 #include <rte_interrupts.h>
 #include <rte_kvargs.h>
-#include <rte_memcpy.h>
 #include <rte_common.h>
 #include <rte_mempool.h>
 #include <rte_malloc.h>
@@ -631,7 +630,7 @@ rte_eth_dev_owner_get(const uint16_t port_id, struct rte_eth_dev_owner *owner)
 	rte_spinlock_lock(rte_mcfg_ethdev_get_lock());
 
 	if (eth_dev_shared_data_prepare() != NULL) {
-		rte_memcpy(owner, &ethdev->data->owner, sizeof(*owner));
+		*owner = ethdev->data->owner;
 		ret = 0;
 	} else {
 		ret = -ENOMEM;
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ethdev: replace rte_memcpy with assignment
  2026-09-29 15:57 [PATCH] ethdev: replace rte_memcpy with assignment Stephen Hemminger
@ 2026-10-01  8:14 ` Andrew Rybchenko
  2026-10-01 18:32   ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Rybchenko @ 2026-10-01  8:14 UTC (permalink / raw)
  To: Stephen Hemminger, dev; +Cc: Thomas Monjalon

On 9/29/26 6:57 PM, Stephen Hemminger wrote:
> Can use structure assignment instead of rte_memcpy here.

It would be useful to mention in the description or summary why
it is better.

Right now the description say what is done, but it is obvious
from the code change.

> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>   lib/ethdev/rte_ethdev.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
> index 7c57a9bb8f..6f5a957d00 100644
> --- a/lib/ethdev/rte_ethdev.c
> +++ b/lib/ethdev/rte_ethdev.c
> @@ -16,7 +16,6 @@
>   #include <rte_log.h>
>   #include <rte_interrupts.h>
>   #include <rte_kvargs.h>
> -#include <rte_memcpy.h>
>   #include <rte_common.h>
>   #include <rte_mempool.h>
>   #include <rte_malloc.h>
> @@ -631,7 +630,7 @@ rte_eth_dev_owner_get(const uint16_t port_id, struct rte_eth_dev_owner *owner)
>   	rte_spinlock_lock(rte_mcfg_ethdev_get_lock());
>   
>   	if (eth_dev_shared_data_prepare() != NULL) {
> -		rte_memcpy(owner, &ethdev->data->owner, sizeof(*owner));
> +		*owner = ethdev->data->owner;
>   		ret = 0;
>   	} else {
>   		ret = -ENOMEM;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ethdev: replace rte_memcpy with assignment
  2026-10-01  8:14 ` Andrew Rybchenko
@ 2026-10-01 18:32   ` Stephen Hemminger
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2026-10-01 18:32 UTC (permalink / raw)
  To: Andrew Rybchenko; +Cc: dev, Thomas Monjalon

On Thu, 1 Oct 2026 11:14:13 +0300
Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru> wrote:

> On 9/29/26 6:57 PM, Stephen Hemminger wrote:
> > Can use structure assignment instead of rte_memcpy here.  
> 
> It would be useful to mention in the description or summary why
> it is better.
> 
> Right now the description say what is done, but it is obvious
> from the code change.


I thought it was obvious, it is mentioned in AGENTS.md and there
is a coccinelle script that finds places like this.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-01 18:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-29 15:57 [PATCH] ethdev: replace rte_memcpy with assignment Stephen Hemminger
2026-10-01  8:14 ` Andrew Rybchenko
2026-10-01 18:32   ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox