Hi,
> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Saturday, March 2, 2024 1:15 AM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>; Xu, Rosen
> <rosen.xu@intel.com>
> Subject: [PATCH v2 22/71] raw/ifpga: replace use of fixed size rte_memcpy
>
> Automatically generated by devtools/cocci/rte_memcpy.cocci
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> drivers/raw/ifpga/afu_pmd_he_hssi.c | 3 +--
> drivers/raw/ifpga/afu_pmd_he_lpbk.c | 3 +--
> drivers/raw/ifpga/afu_pmd_he_mem.c | 3 +--
> drivers/raw/ifpga/afu_pmd_n3000.c | 8 ++++----
> drivers/raw/ifpga/ifpga_rawdev.c | 11 +++++------
> 5 files changed, 12 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/raw/ifpga/afu_pmd_he_hssi.c
> b/drivers/raw/ifpga/afu_pmd_he_hssi.c
> index 859f28dcc1f0..c2aaed9203ae 100644
> --- a/drivers/raw/ifpga/afu_pmd_he_hssi.c
> +++ b/drivers/raw/ifpga/afu_pmd_he_hssi.c
> @@ -15,7 +15,6 @@
>
> #include <rte_eal.h>
> #include <rte_malloc.h>
> -#include <rte_memcpy.h>
> #include <rte_io.h>
> #include <rte_vfio.h>
> #include <bus_pci_driver.h>
> @@ -314,7 +313,7 @@ static int he_hssi_config(struct afu_rawdev *dev,
> void *config,
> if (cfg->port >= NUM_HE_HSSI_PORTS)
> return -EINVAL;
>
> - rte_memcpy(&priv->he_hssi_cfg, cfg, sizeof(priv->he_hssi_cfg));
> + memcpy(&priv->he_hssi_cfg, cfg, sizeof(priv->he_hssi_cfg));
>
> return 0;
> }
> diff --git a/drivers/raw/ifpga/afu_pmd_he_lpbk.c
> b/drivers/raw/ifpga/afu_pmd_he_lpbk.c
> index c7c5cda48c35..ffb7075c84d2 100644
> --- a/drivers/raw/ifpga/afu_pmd_he_lpbk.c
> +++ b/drivers/raw/ifpga/afu_pmd_he_lpbk.c
> @@ -15,7 +15,6 @@
>
> #include <rte_eal.h>
> #include <rte_malloc.h>
> -#include <rte_memcpy.h>
> #include <rte_io.h>
> #include <rte_vfio.h>
> #include <bus_pci_driver.h>
> @@ -363,7 +362,7 @@ static int he_lpbk_config(struct afu_rawdev *dev,
> void *config,
> if ((cfg->end < cfg->begin) || (cfg->end > MAX_CACHE_LINES))
> return -EINVAL;
>
> - rte_memcpy(&priv->he_lpbk_cfg, cfg, sizeof(priv->he_lpbk_cfg));
> + memcpy(&priv->he_lpbk_cfg, cfg, sizeof(priv->he_lpbk_cfg));
>
> return 0;
> }
> diff --git a/drivers/raw/ifpga/afu_pmd_he_mem.c
> b/drivers/raw/ifpga/afu_pmd_he_mem.c
> index a1db533eeb93..b799e40d2db9 100644
> --- a/drivers/raw/ifpga/afu_pmd_he_mem.c
> +++ b/drivers/raw/ifpga/afu_pmd_he_mem.c
> @@ -14,7 +14,6 @@
>
> #include <rte_eal.h>
> #include <rte_malloc.h>
> -#include <rte_memcpy.h>
> #include <rte_io.h>
> #include <rte_vfio.h>
> #include <bus_pci_driver.h>
> @@ -126,7 +125,7 @@ static int he_mem_tg_config(struct afu_rawdev *dev,
> void *config,
> if (config_size != sizeof(struct rte_pmd_afu_he_mem_tg_cfg))
> return -EINVAL;
>
> - rte_memcpy(&priv->he_mem_tg_cfg, config, sizeof(priv-
> >he_mem_tg_cfg));
> + memcpy(&priv->he_mem_tg_cfg, config, sizeof(priv-
> >he_mem_tg_cfg));
>
> return 0;
> }
> diff --git a/drivers/raw/ifpga/afu_pmd_n3000.c
> b/drivers/raw/ifpga/afu_pmd_n3000.c
> index 67b394126595..9236c0b15371 100644
> --- a/drivers/raw/ifpga/afu_pmd_n3000.c
> +++ b/drivers/raw/ifpga/afu_pmd_n3000.c
> @@ -1867,8 +1867,8 @@ static int n3000_afu_config(struct afu_rawdev *dev,
> void *config,
> if ((cfg->nlb_cfg.end < cfg->nlb_cfg.begin) ||
> (cfg->nlb_cfg.end > MAX_CACHE_LINES))
> return -EINVAL;
> - rte_memcpy(&priv->nlb_cfg, &cfg->nlb_cfg,
> - sizeof(struct rte_pmd_afu_nlb_cfg));
> + memcpy(&priv->nlb_cfg, &cfg->nlb_cfg,
> + sizeof(struct rte_pmd_afu_nlb_cfg));
> } else if (cfg->type == RTE_PMD_AFU_N3000_DMA) {
> if (cfg->dma_cfg.index >= NUM_N3000_DMA)
> return -EINVAL;
> @@ -1887,8 +1887,8 @@ static int n3000_afu_config(struct afu_rawdev *dev,
> void *config,
> cfg->dma_cfg.length);
> }
> }
> - rte_memcpy(&priv->dma_cfg, &cfg->dma_cfg,
> - sizeof(struct rte_pmd_afu_dma_cfg));
> + memcpy(&priv->dma_cfg, &cfg->dma_cfg,
> + sizeof(struct rte_pmd_afu_dma_cfg));
> } else {
> IFPGA_RAWDEV_PMD_ERR("Invalid type of N3000 AFU");
> return -EINVAL;
> diff --git a/drivers/raw/ifpga/ifpga_rawdev.c
> b/drivers/raw/ifpga/ifpga_rawdev.c
> index f89bd3f9e2c3..d5d47e14dd0e 100644
> --- a/drivers/raw/ifpga/ifpga_rawdev.c
> +++ b/drivers/raw/ifpga/ifpga_rawdev.c
> @@ -14,7 +14,6 @@
> #include <rte_log.h>
> #include <rte_malloc.h>
> #include <rte_devargs.h>
> -#include <rte_memcpy.h>
> #include <rte_pci.h>
> #include <bus_pci_driver.h>
> #include <rte_kvargs.h>
> @@ -258,7 +257,7 @@ static int ifpga_rawdev_fill_info(struct ifpga_rawdev
> *ifpga_dev)
> if (point < 12)
> return -1;
> point -= 12;
> - rte_memcpy(ifpga_dev->parent_bdf, &link[point], 12);
> + memcpy(ifpga_dev->parent_bdf, &link[point], 12);
>
> point = strlen(link1);
> if (point < 26)
> @@ -948,10 +947,10 @@ ifpga_rawdev_pr(struct rte_rawdev *dev,
> if (ret)
> return ret;
>
> - rte_memcpy(&afu_pr_conf->afu_id.uuid.uuid_low, uuid.b,
> - sizeof(u64));
> - rte_memcpy(&afu_pr_conf->afu_id.uuid.uuid_high, uuid.b
> + 8,
> - sizeof(u64));
> + memcpy(&afu_pr_conf->afu_id.uuid.uuid_low, uuid.b,
> + sizeof(u64));
> + memcpy(&afu_pr_conf->afu_id.uuid.uuid_high, uuid.b + 8,
> + sizeof(u64));
>
> IFPGA_RAWDEV_PMD_INFO("%s: uuid_l=0x%lx,
> uuid_h=0x%lx\n",
> __func__,
> --
> 2.43.0
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
@@ -15,7 +15,6 @@
#include <rte_eal.h>
#include <rte_malloc.h>
-#include <rte_memcpy.h>
#include <rte_io.h>
#include <rte_vfio.h>
#include <bus_pci_driver.h>
@@ -314,7 +313,7 @@ static int he_hssi_config(struct afu_rawdev *dev, void *config,
if (cfg->port >= NUM_HE_HSSI_PORTS)
return -EINVAL;
- rte_memcpy(&priv->he_hssi_cfg, cfg, sizeof(priv->he_hssi_cfg));
+ memcpy(&priv->he_hssi_cfg, cfg, sizeof(priv->he_hssi_cfg));
return 0;
}
@@ -15,7 +15,6 @@
#include <rte_eal.h>
#include <rte_malloc.h>
-#include <rte_memcpy.h>
#include <rte_io.h>
#include <rte_vfio.h>
#include <bus_pci_driver.h>
@@ -363,7 +362,7 @@ static int he_lpbk_config(struct afu_rawdev *dev, void *config,
if ((cfg->end < cfg->begin) || (cfg->end > MAX_CACHE_LINES))
return -EINVAL;
- rte_memcpy(&priv->he_lpbk_cfg, cfg, sizeof(priv->he_lpbk_cfg));
+ memcpy(&priv->he_lpbk_cfg, cfg, sizeof(priv->he_lpbk_cfg));
return 0;
}
@@ -14,7 +14,6 @@
#include <rte_eal.h>
#include <rte_malloc.h>
-#include <rte_memcpy.h>
#include <rte_io.h>
#include <rte_vfio.h>
#include <bus_pci_driver.h>
@@ -126,7 +125,7 @@ static int he_mem_tg_config(struct afu_rawdev *dev, void *config,
if (config_size != sizeof(struct rte_pmd_afu_he_mem_tg_cfg))
return -EINVAL;
- rte_memcpy(&priv->he_mem_tg_cfg, config, sizeof(priv->he_mem_tg_cfg));
+ memcpy(&priv->he_mem_tg_cfg, config, sizeof(priv->he_mem_tg_cfg));
return 0;
}
@@ -1867,8 +1867,8 @@ static int n3000_afu_config(struct afu_rawdev *dev, void *config,
if ((cfg->nlb_cfg.end < cfg->nlb_cfg.begin) ||
(cfg->nlb_cfg.end > MAX_CACHE_LINES))
return -EINVAL;
- rte_memcpy(&priv->nlb_cfg, &cfg->nlb_cfg,
- sizeof(struct rte_pmd_afu_nlb_cfg));
+ memcpy(&priv->nlb_cfg, &cfg->nlb_cfg,
+ sizeof(struct rte_pmd_afu_nlb_cfg));
} else if (cfg->type == RTE_PMD_AFU_N3000_DMA) {
if (cfg->dma_cfg.index >= NUM_N3000_DMA)
return -EINVAL;
@@ -1887,8 +1887,8 @@ static int n3000_afu_config(struct afu_rawdev *dev, void *config,
cfg->dma_cfg.length);
}
}
- rte_memcpy(&priv->dma_cfg, &cfg->dma_cfg,
- sizeof(struct rte_pmd_afu_dma_cfg));
+ memcpy(&priv->dma_cfg, &cfg->dma_cfg,
+ sizeof(struct rte_pmd_afu_dma_cfg));
} else {
IFPGA_RAWDEV_PMD_ERR("Invalid type of N3000 AFU");
return -EINVAL;
@@ -14,7 +14,6 @@
#include <rte_log.h>
#include <rte_malloc.h>
#include <rte_devargs.h>
-#include <rte_memcpy.h>
#include <rte_pci.h>
#include <bus_pci_driver.h>
#include <rte_kvargs.h>
@@ -258,7 +257,7 @@ static int ifpga_rawdev_fill_info(struct ifpga_rawdev *ifpga_dev)
if (point < 12)
return -1;
point -= 12;
- rte_memcpy(ifpga_dev->parent_bdf, &link[point], 12);
+ memcpy(ifpga_dev->parent_bdf, &link[point], 12);
point = strlen(link1);
if (point < 26)
@@ -948,10 +947,10 @@ ifpga_rawdev_pr(struct rte_rawdev *dev,
if (ret)
return ret;
- rte_memcpy(&afu_pr_conf->afu_id.uuid.uuid_low, uuid.b,
- sizeof(u64));
- rte_memcpy(&afu_pr_conf->afu_id.uuid.uuid_high, uuid.b + 8,
- sizeof(u64));
+ memcpy(&afu_pr_conf->afu_id.uuid.uuid_low, uuid.b,
+ sizeof(u64));
+ memcpy(&afu_pr_conf->afu_id.uuid.uuid_high, uuid.b + 8,
+ sizeof(u64));
IFPGA_RAWDEV_PMD_INFO("%s: uuid_l=0x%lx, uuid_h=0x%lx\n",
__func__,