From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 596C9A0548; Tue, 7 Jun 2022 19:18:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 509EB41614; Tue, 7 Jun 2022 19:17:54 +0200 (CEST) Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by mails.dpdk.org (Postfix) with ESMTP id A32CB427EA for ; Tue, 7 Jun 2022 19:17:52 +0200 (CEST) Received: by mail-pj1-f53.google.com with SMTP id k5-20020a17090a404500b001e8875e6242so5233365pjg.5 for ; Tue, 07 Jun 2022 10:17:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VJ2qs1w+QRFvTTzQK7naJuAKpLa19aMOJsC5C5/ZYp4=; b=vmdOFR3XG9a8Uq1l+7SBO/SCyhyAMggghBuaw38LC6g79BrC0xQwKaF3JD0L7H4WS/ gMUVizX+DGXc28BqyWobR18+/6OCJlDErWhvr2RECo8GIuYVXJctiZppLc7fmjFXLiu0 BXb4gZjF/E9gChAj3NOucS2RbaOv4qv4tf9RQn96bb0H8SWH6YO5RlgKQSbgm0al14ha m7A+NSuAgRyntrT2HPeU8LGoGW5ouBJpdikvS2z0H71tQLSrw7rsJ0h+5fX5BQdm6lS7 KTkyxKC47rKUjQDQEr8AFY6C+9LtxPNJUS8fQDvbL3gcQD1L769fRFvpcSm7H6coP6Je sGZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VJ2qs1w+QRFvTTzQK7naJuAKpLa19aMOJsC5C5/ZYp4=; b=6HMhwsTwVmD14SO2/D+6K0nceGMsBs5QCVWlkT/DonkLMpCDQ8MXXuGdKj1qeojn7t +kmvAp0heEYjvjcnmta/YDxS/aTKGnl/TeKsYwsAASHGhwJ/nXpN92UoJ8DTzhKzGJq9 yR+pa4zdmWLUbQtr/54l+8gJHWZnc8ngomz0fotMKcqAaZAx9gJhbVHhmVg5xwIkitch pXJgtffikZ+waKNXSMF52Dw8RQbVwY/+bbDJ3ieB49zP7oSTyMEoRl4CrqoefBHqbQyT ydFBXd6aciSlrHbY5apVMas9S7oJohhzkD+7h4BsRVi9BEUaE93cL+Vb3f3LNmeH6wti eqHQ== X-Gm-Message-State: AOAM530cYE76wmpTxXxIeU6WBerKYv+4Dd6xXA+XfLuCBCIRUUSidKJ7 ZLLgoRVFe3mmLS6QO+vm92KfKndXKiBVyg== X-Google-Smtp-Source: ABdhPJxZTPgqJJT1w2h3J8R9VzXuRyK/QVqt4bpDS2QekUc7H/WCmk+a8nMceOZ6qNI7OfgVKYsIAg== X-Received: by 2002:a17:903:41c6:b0:164:1050:49ac with SMTP id u6-20020a17090341c600b00164105049acmr30201545ple.138.1654622271298; Tue, 07 Jun 2022 10:17:51 -0700 (PDT) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id x2-20020a627c02000000b005087c23ad8dsm13185281pfc.0.2022.06.07.10.17.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 10:17:50 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Rasesh Mody , Devendra Singh Rawat Subject: [RFC 2/8] net/qede: fix gcc-12 rte_memcpy warnings Date: Tue, 7 Jun 2022 10:17:40 -0700 Message-Id: <20220607171746.461772-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220607171746.461772-1-stephen@networkplumber.org> References: <20220607171746.461772-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 The x86 version of rte_memcpy can cause warnings. The driver does not need to use rte_memcpy for everything. Standard memcpy is just as fast and safer; the compiler and static analysis tools treat memcpy specially. Signed-off-by: Stephen Hemminger --- drivers/net/qede/base/bcm_osal.h | 3 +-- drivers/net/qede/qede_ethdev.c | 2 +- drivers/net/qede/qede_filter.c | 16 ++++++---------- drivers/net/qede/qede_main.c | 13 ++++++------- drivers/net/qede/qede_sriov.c | 6 +++--- 5 files changed, 17 insertions(+), 23 deletions(-) diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h index c5b53992822b..9ea579bfc849 100644 --- a/drivers/net/qede/base/bcm_osal.h +++ b/drivers/net/qede/base/bcm_osal.h @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -99,7 +98,7 @@ typedef intptr_t osal_int_ptr_t; } while (0) #define OSAL_VFREE(dev, memory) OSAL_FREE(dev, memory) #define OSAL_MEM_ZERO(mem, size) bzero(mem, size) -#define OSAL_MEMCPY(dst, src, size) rte_memcpy(dst, src, size) +#define OSAL_MEMCPY(dst, src, size) memcpy(dst, src, size) #define OSAL_MEMCMP(s1, s2, size) memcmp(s1, s2, size) #define OSAL_MEMSET(dst, val, length) \ memset(dst, val, length) diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index ea6b71f09355..a4923670d6ba 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -358,7 +358,7 @@ qede_assign_rxtx_handlers(struct rte_eth_dev *dev, bool is_dummy) static void qede_alloc_etherdev(struct qede_dev *qdev, struct qed_dev_eth_info *info) { - rte_memcpy(&qdev->dev_info, info, sizeof(*info)); + qdev->dev_info = *info; qdev->ops = qed_ops; } diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c index 440440423a32..ca3165d97210 100644 --- a/drivers/net/qede/qede_filter.c +++ b/drivers/net/qede/qede_filter.c @@ -388,10 +388,8 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, ip6->vtc_flow = rte_cpu_to_be_32(QEDE_FDIR_IPV6_DEFAULT_VTC_FLOW); - rte_memcpy(&ip6->src_addr, arfs->tuple.src_ipv6, - IPV6_ADDR_LEN); - rte_memcpy(&ip6->dst_addr, arfs->tuple.dst_ipv6, - IPV6_ADDR_LEN); + memcpy(&ip6->src_addr, arfs->tuple.src_ipv6, IPV6_ADDR_LEN); + memcpy(&ip6->dst_addr, arfs->tuple.dst_ipv6, IPV6_ADDR_LEN); len += sizeof(struct rte_ipv6_hdr); params->ipv6 = true; @@ -821,12 +819,10 @@ qede_flow_parse_pattern(__rte_unused struct rte_eth_dev *dev, const struct rte_flow_item_ipv6 *spec; spec = pattern->spec; - rte_memcpy(flow->entry.tuple.src_ipv6, - spec->hdr.src_addr, - IPV6_ADDR_LEN); - rte_memcpy(flow->entry.tuple.dst_ipv6, - spec->hdr.dst_addr, - IPV6_ADDR_LEN); + memcpy(flow->entry.tuple.src_ipv6, + spec->hdr.src_addr, IPV6_ADDR_LEN); + memcpy(flow->entry.tuple.dst_ipv6, + spec->hdr.dst_addr, IPV6_ADDR_LEN); flow->entry.tuple.eth_proto = RTE_ETHER_TYPE_IPV6; } diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c index ad101194d613..03039038ad3d 100644 --- a/drivers/net/qede/qede_main.c +++ b/drivers/net/qede/qede_main.c @@ -372,7 +372,7 @@ qed_fill_dev_info(struct ecore_dev *edev, struct qed_dev_info *dev_info) dev_info->mtu = ECORE_LEADING_HWFN(edev)->hw_info.mtu; dev_info->dev_type = edev->type; - rte_memcpy(&dev_info->hw_mac, &edev->hwfns[0].hw_info.hw_mac_addr, + memcpy(&dev_info->hw_mac, &edev->hwfns[0].hw_info.hw_mac_addr, RTE_ETHER_ADDR_LEN); dev_info->fw_major = FW_MAJOR_VERSION; @@ -440,7 +440,7 @@ qed_fill_eth_dev_info(struct ecore_dev *edev, struct qed_dev_eth_info *info) info->num_vlan_filters = RESC_NUM(&edev->hwfns[0], ECORE_VLAN) - max_vf_vlan_filters; - rte_memcpy(&info->port_mac, &edev->hwfns[0].hw_info.hw_mac_addr, + memcpy(&info->port_mac, &edev->hwfns[0].hw_info.hw_mac_addr, RTE_ETHER_ADDR_LEN); } else { ecore_vf_get_num_rxqs(ECORE_LEADING_HWFN(edev), @@ -471,7 +471,7 @@ static void qed_set_name(struct ecore_dev *edev, char name[NAME_SIZE]) { int i; - rte_memcpy(edev->name, name, NAME_SIZE); + memcpy(edev->name, name, NAME_SIZE); for_each_hwfn(edev, i) { snprintf(edev->hwfns[i].name, NAME_SIZE, "%s-%d", name, i); } @@ -513,10 +513,9 @@ static void qed_fill_link(struct ecore_hwfn *hwfn, /* Prepare source inputs */ if (IS_PF(hwfn->p_dev)) { - rte_memcpy(¶ms, ecore_mcp_get_link_params(hwfn), - sizeof(params)); - rte_memcpy(&link, ecore_mcp_get_link_state(hwfn), sizeof(link)); - rte_memcpy(&link_caps, ecore_mcp_get_link_capabilities(hwfn), + memcpy(¶ms, ecore_mcp_get_link_params(hwfn), sizeof(params)); + memcpy(&link, ecore_mcp_get_link_state(hwfn), sizeof(link)); + memcpy(&link_caps, ecore_mcp_get_link_capabilities(hwfn), sizeof(link_caps)); } else { ecore_vf_read_bulletin(hwfn, &change); diff --git a/drivers/net/qede/qede_sriov.c b/drivers/net/qede/qede_sriov.c index 0b99a8d6fe9c..937d339fb802 100644 --- a/drivers/net/qede/qede_sriov.c +++ b/drivers/net/qede/qede_sriov.c @@ -203,10 +203,10 @@ void qed_inform_vf_link_state(struct ecore_hwfn *hwfn) if (!hwfn->pf_iov_info) return; - rte_memcpy(¶ms, ecore_mcp_get_link_params(lead_hwfn), + memcpy(¶ms, ecore_mcp_get_link_params(lead_hwfn), sizeof(params)); - rte_memcpy(&link, ecore_mcp_get_link_state(lead_hwfn), sizeof(link)); - rte_memcpy(&caps, ecore_mcp_get_link_capabilities(lead_hwfn), + memcpy(&link, ecore_mcp_get_link_state(lead_hwfn), sizeof(link)); + memcpy(&caps, ecore_mcp_get_link_capabilities(lead_hwfn), sizeof(caps)); /* Update bulletin of all future possible VFs with link configuration */ -- 2.35.1