From patchwork Tue Apr 2 21:50:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 139057 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F278243DC8; Tue, 2 Apr 2024 23:58:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8274440EE4; Tue, 2 Apr 2024 23:56:17 +0200 (CEST) Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by mails.dpdk.org (Postfix) with ESMTP id 721C440DCA for ; Tue, 2 Apr 2024 23:56:02 +0200 (CEST) Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1e034607879so45947735ad.0 for ; Tue, 02 Apr 2024 14:56:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1712094961; x=1712699761; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JT1+LxSV8JgSBxCPehFAlyvD29BqgR4SjbJ3MvTdQkU=; b=dwrAkmKNZnlJlsj3mRZn19OsMwmO17v+RPgZxLhZ0Zfvymv1M/IzTQw/ZvvqP0Psix ar4otf1Zs9pMPHebOXr38SNP8NKsBmq2D0sw/nXL0pAyrvOx4uR88Vk6YjE66QIJBlST 6t6/Yu4gxckhtSBVLuSWsEGKqKviLZa7CqJfKcPeb6y2dXreOZhAz93pqOyDjxT4XyPr 4e6eniupV24cffr6qyYMKyv1gUCOM/rChgKdHw8Ga3BYd2t0iQOl0uvH0aP1UGM0kz21 cY2cYEYwOqTlvd9u8zU5F0SoApmrUD7qiG7WWRQjUIvl4Oxm7aShtoftrPwnfnE7i6QX Nkiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712094961; x=1712699761; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JT1+LxSV8JgSBxCPehFAlyvD29BqgR4SjbJ3MvTdQkU=; b=wk7Z9MjEzZez4b4ngMl49JhssBacaoR95cqe555lNFr/tdU2cMDunjT+CM5u4lcEgS GY9ECbS78F5mscvBWkbVjMGKMaShXFlgYQoorqUnDuYYG3vTkv6oAzsUopYahA1GKPAg xDq8DxzqRQKyQaObad3Bu4M2WLyFvNobsjnxSt799elEjRnIAt1/tC5ev0qwBHBdgnqZ aCg83kOHDWV5179SWessWr3WFejQNk5Qd/2o+/yckoo3291vlTYq36rR1PnMn1ptmLZG gHMtCB8+SG1Mu2U1Fca/c7YMrABDho3mu1lnC+2KNr0N/7CvG6YuqLZBC5psaESRth5t F8uQ== X-Gm-Message-State: AOJu0Yw+rZBBa4RSjBDpADadg1GnsX+fhuZmA8l63IS1pntBbKDc+dKy Jd5wiTNeqAMQkdlAB/YQdPcWTHGALsuhyu+rqyRBtGDzUi4aFG1tUSKWXEAv+mx2cHGa+A3deT6 eTPU= X-Google-Smtp-Source: AGHT+IEaL/qsqWXqfRCU1zC8l0ZYzIHe2KeB4jcDy+DgkXjzcrcNRvnp5CzoBDLKM7/x0x4cmCv6Hw== X-Received: by 2002:a17:902:c94a:b0:1e0:e11:c626 with SMTP id i10-20020a170902c94a00b001e00e11c626mr16149166pla.47.1712094961613; Tue, 02 Apr 2024 14:56:01 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id x15-20020a170902820f00b001dddf29b6e8sm11609381pln.299.2024.04.02.14.56.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 14:56:01 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Srikanth Yalavarthi Subject: [PATCH v3 23/30] ml/cnxk: replace use of fixed size rte_memcpy Date: Tue, 2 Apr 2024 14:50:39 -0700 Message-ID: <20240402215502.278838-24-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240402215502.278838-1-stephen@networkplumber.org> References: <20240229225936.483472-1-stephen@networkplumber.org> <20240402215502.278838-1-stephen@networkplumber.org> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger --- drivers/ml/cnxk/cn10k_ml_model.c | 8 +++++--- drivers/ml/cnxk/cn10k_ml_ops.c | 11 +++++++---- drivers/ml/cnxk/cnxk_ml_ops.c | 2 +- drivers/ml/cnxk/mvtvm_ml_model.c | 8 +++++--- drivers/ml/cnxk/mvtvm_ml_ops.c | 8 +++++--- 5 files changed, 23 insertions(+), 14 deletions(-) diff --git a/drivers/ml/cnxk/cn10k_ml_model.c b/drivers/ml/cnxk/cn10k_ml_model.c index 0325cd54f1..4e39a584fa 100644 --- a/drivers/ml/cnxk/cn10k_ml_model.c +++ b/drivers/ml/cnxk/cn10k_ml_model.c @@ -560,7 +560,7 @@ cn10k_ml_model_info_set(struct cnxk_ml_dev *cnxk_mldev, struct cnxk_ml_model *mo /* Set model info */ memset(info, 0, sizeof(struct rte_ml_model_info)); - rte_memcpy(info->name, metadata->model.name, MRVL_ML_MODEL_NAME_LEN); + memcpy(info->name, metadata->model.name, MRVL_ML_MODEL_NAME_LEN); snprintf(info->version, RTE_ML_STR_MAX, "%u.%u.%u.%u", metadata->model.version[0], metadata->model.version[1], metadata->model.version[2], metadata->model.version[3]); @@ -579,7 +579,8 @@ cn10k_ml_model_info_set(struct cnxk_ml_dev *cnxk_mldev, struct cnxk_ml_model *mo /* Set input info */ for (i = 0; i < info->nb_inputs; i++) { - rte_memcpy(input[i].name, io_info->input[i].name, MRVL_ML_INPUT_NAME_LEN); + memcpy(input[i].name, io_info->input[i].name, + MRVL_ML_INPUT_NAME_LEN); input[i].nb_dims = io_info->input[i].nb_dims; input[i].shape = &io_info->input[i].shape[0]; input[i].type = io_info->input[i].qtype; @@ -590,7 +591,8 @@ cn10k_ml_model_info_set(struct cnxk_ml_dev *cnxk_mldev, struct cnxk_ml_model *mo /* Set output info */ for (i = 0; i < info->nb_outputs; i++) { - rte_memcpy(output[i].name, io_info->output[i].name, MRVL_ML_INPUT_NAME_LEN); + memcpy(output[i].name, io_info->output[i].name, + MRVL_ML_INPUT_NAME_LEN); output[i].nb_dims = io_info->output[i].nb_dims; output[i].shape = &io_info->output[i].shape[0]; output[i].type = io_info->output[i].qtype; diff --git a/drivers/ml/cnxk/cn10k_ml_ops.c b/drivers/ml/cnxk/cn10k_ml_ops.c index 834e55e88e..e53ada7b1c 100644 --- a/drivers/ml/cnxk/cn10k_ml_ops.c +++ b/drivers/ml/cnxk/cn10k_ml_ops.c @@ -668,11 +668,13 @@ cn10k_ml_layer_load(void *device, uint16_t model_id, const char *layer_name, uin } /* Copy metadata to internal buffer */ - rte_memcpy(&layer->glow.metadata, buffer, sizeof(struct cn10k_ml_model_metadata)); + memcpy(&layer->glow.metadata, buffer, + sizeof(struct cn10k_ml_model_metadata)); cn10k_ml_model_metadata_update(&layer->glow.metadata); /* Set layer name */ - rte_memcpy(layer->name, layer->glow.metadata.model.name, MRVL_ML_MODEL_NAME_LEN); + memcpy(layer->name, layer->glow.metadata.model.name, + MRVL_ML_MODEL_NAME_LEN); /* Enable support for batch_size of 256 */ if (layer->glow.metadata.model.batch_size == 0) @@ -748,11 +750,12 @@ cn10k_ml_model_load(struct cnxk_ml_dev *cnxk_mldev, struct rte_ml_model_params * model->subtype = ML_CNXK_MODEL_SUBTYPE_GLOW_MRVL; /* Copy metadata to internal buffer */ - rte_memcpy(&model->glow.metadata, params->addr, sizeof(struct cn10k_ml_model_metadata)); + memcpy(&model->glow.metadata, params->addr, + sizeof(struct cn10k_ml_model_metadata)); cn10k_ml_model_metadata_update(&model->glow.metadata); /* Set model name */ - rte_memcpy(model->name, (char *)model->glow.metadata.model.name, 64); + memcpy(model->name, (char *)model->glow.metadata.model.name, 64); /* Enable support for batch_size of 256 */ if (model->glow.metadata.model.batch_size == 0) diff --git a/drivers/ml/cnxk/cnxk_ml_ops.c b/drivers/ml/cnxk/cnxk_ml_ops.c index 971362b242..f9d0f50e1f 100644 --- a/drivers/ml/cnxk/cnxk_ml_ops.c +++ b/drivers/ml/cnxk/cnxk_ml_ops.c @@ -1400,7 +1400,7 @@ cnxk_ml_model_info_get(struct rte_ml_dev *dev, uint16_t model_id, } info = (struct rte_ml_model_info *)model->info; - rte_memcpy(model_info, info, sizeof(struct rte_ml_model_info)); + memcpy(model_info, info, sizeof(struct rte_ml_model_info)); model_info->input_info = info->input_info; model_info->output_info = info->output_info; diff --git a/drivers/ml/cnxk/mvtvm_ml_model.c b/drivers/ml/cnxk/mvtvm_ml_model.c index e3234ae442..99b4774a2e 100644 --- a/drivers/ml/cnxk/mvtvm_ml_model.c +++ b/drivers/ml/cnxk/mvtvm_ml_model.c @@ -310,7 +310,7 @@ mvtvm_ml_model_info_set(struct cnxk_ml_dev *cnxk_mldev, struct cnxk_ml_model *mo goto tvm_mrvl_model; metadata = &model->mvtvm.metadata; - rte_memcpy(info->name, metadata->model.name, TVMDP_NAME_STRLEN); + memcpy(info->name, metadata->model.name, TVMDP_NAME_STRLEN); snprintf(info->version, RTE_ML_STR_MAX, "%u.%u.%u.%u", metadata->model.version[0], metadata->model.version[1], metadata->model.version[2], metadata->model.version[3]); @@ -327,7 +327,8 @@ mvtvm_ml_model_info_set(struct cnxk_ml_dev *cnxk_mldev, struct cnxk_ml_model *mo /* Set input info */ for (i = 0; i < info->nb_inputs; i++) { - rte_memcpy(input[i].name, metadata->input[i].name, MRVL_ML_INPUT_NAME_LEN); + memcpy(input[i].name, metadata->input[i].name, + MRVL_ML_INPUT_NAME_LEN); input[i].nb_dims = metadata->input[i].ndim; input[i].shape = &model->mvtvm.info.input[i].shape[0]; input[i].type = model->mvtvm.info.input[i].qtype; @@ -338,7 +339,8 @@ mvtvm_ml_model_info_set(struct cnxk_ml_dev *cnxk_mldev, struct cnxk_ml_model *mo /* Set output info */ for (i = 0; i < info->nb_outputs; i++) { - rte_memcpy(output[i].name, metadata->output[i].name, MRVL_ML_OUTPUT_NAME_LEN); + memcpy(output[i].name, metadata->output[i].name, + MRVL_ML_OUTPUT_NAME_LEN); output[i].nb_dims = metadata->output[i].ndim; output[i].shape = &model->mvtvm.info.output[i].shape[0]; output[i].type = model->mvtvm.info.output[i].qtype; diff --git a/drivers/ml/cnxk/mvtvm_ml_ops.c b/drivers/ml/cnxk/mvtvm_ml_ops.c index e825c3fb23..fca7e0c3c0 100644 --- a/drivers/ml/cnxk/mvtvm_ml_ops.c +++ b/drivers/ml/cnxk/mvtvm_ml_ops.c @@ -194,7 +194,7 @@ mvtvm_ml_model_load(struct cnxk_ml_dev *cnxk_mldev, struct rte_ml_model_params * /* Copy mod.so */ model->mvtvm.object.so.addr = mz->addr; model->mvtvm.object.so.size = object[0].size; - rte_memcpy(model->mvtvm.object.so.name, object[0].name, TVMDP_NAME_STRLEN); + memcpy(model->mvtvm.object.so.name, object[0].name, TVMDP_NAME_STRLEN); rte_memcpy(model->mvtvm.object.so.addr, object[0].buffer, object[0].size); rte_free(object[0].buffer); @@ -203,7 +203,8 @@ mvtvm_ml_model_load(struct cnxk_ml_dev *cnxk_mldev, struct rte_ml_model_params * RTE_PTR_ADD(model->mvtvm.object.so.addr, RTE_ALIGN_CEIL(model->mvtvm.object.so.size, RTE_CACHE_LINE_MIN_SIZE)); model->mvtvm.object.json.size = object[1].size; - rte_memcpy(model->mvtvm.object.json.name, object[1].name, TVMDP_NAME_STRLEN); + memcpy(model->mvtvm.object.json.name, object[1].name, + TVMDP_NAME_STRLEN); rte_memcpy(model->mvtvm.object.json.addr, object[1].buffer, object[1].size); rte_free(object[1].buffer); @@ -212,7 +213,8 @@ mvtvm_ml_model_load(struct cnxk_ml_dev *cnxk_mldev, struct rte_ml_model_params * RTE_PTR_ADD(model->mvtvm.object.json.addr, RTE_ALIGN_CEIL(model->mvtvm.object.json.size, RTE_CACHE_LINE_MIN_SIZE)); model->mvtvm.object.params.size = object[2].size; - rte_memcpy(model->mvtvm.object.params.name, object[2].name, TVMDP_NAME_STRLEN); + memcpy(model->mvtvm.object.params.name, object[2].name, + TVMDP_NAME_STRLEN); rte_memcpy(model->mvtvm.object.params.addr, object[2].buffer, object[2].size); rte_free(object[2].buffer);