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 AE4594237D; Mon, 9 Jan 2023 11:36:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9327B40687; Mon, 9 Jan 2023 11:36:54 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 796134067C for ; Mon, 9 Jan 2023 11:36:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673260613; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N7zbBEwBvxjTjxeudgzzybXbdS2rxpKIAzaKwS1Pi1c=; b=UBFhTtfxNMWQyt08Mo3h8h0arNyxYd9eAnvyj8B5UodOWV8T/A8i1+ZZJBTtF1z24sqk0Z ovlaF401Upxf5BTdQK5tOt7GYPr0FxE/pzdZqaiTCyvGw0PdCiK5f/Y1P5oppzqCQhz3z7 HUsWUfiBUbO2vJJ9xXmbeAmqLbpjB5Q= Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-425-qtiq_9jqOOCXYCAloXWHIw-1; Mon, 09 Jan 2023 05:36:51 -0500 X-MC-Unique: qtiq_9jqOOCXYCAloXWHIw-1 Received: by mail-pf1-f199.google.com with SMTP id ay33-20020a056a00302100b00586ad46edf9so1728087pfb.20 for ; Mon, 09 Jan 2023 02:36:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N7zbBEwBvxjTjxeudgzzybXbdS2rxpKIAzaKwS1Pi1c=; b=YEXiG2lxgVwmHRee4Rc5x/ukmXN1Vx5jyNSESA8JnsaQkQpGDZeqxbvSARM7jH3XgL Qzsb1HwrMeRSoUJ4nvcQiyfnJrHrQo7VL8gPxZpxenqS8ROpkH5/2q8G+GxOJJC2xL8f pUW7K1XW07a2NzSuY8BLB0mnJ3AszT50SDaU0dmeFU91t/c6qLx0vEffYbBS+DjVm6t4 0oaTs1A1Hok9lCRjnH7juqaHigIdmInEb+bxtClXjFyQNT8yzu0RTx1Qlr+tYgqSFDfO iIwsUfPnhSiTrVDgklGSSKAs/HztuNq0gSbXVwau2NMJUk9o/DENpAuwsYCO1Iv3H8hG rEBw== X-Gm-Message-State: AFqh2kpnendZkZYHu2kPpuHYWw7IbjzbhyfeFopAnKVdHUGEe6/Ggbiv beiMLFakwjJKz9fTd8ZywKfyT55uLCUMNbx7az6ZVrhlNTIj0+M0SOto5qyvywn/inEf9soDHQs t/Z9KLH7SzQatfYhm0EI= X-Received: by 2002:a63:a23:0:b0:484:83e4:4ca1 with SMTP id 35-20020a630a23000000b0048483e44ca1mr2451936pgk.178.1673260610597; Mon, 09 Jan 2023 02:36:50 -0800 (PST) X-Google-Smtp-Source: AMrXdXurnz2aPzor5CJwfAg7yX5zuD3MVxDj5V1ADhWS3wRBU1xJJuGN1k1+NMbes/pfD9SZHyuiNFf4Kz3vtoakNB8= X-Received: by 2002:a63:a23:0:b0:484:83e4:4ca1 with SMTP id 35-20020a630a23000000b0048483e44ca1mr2451923pgk.178.1673260610283; Mon, 09 Jan 2023 02:36:50 -0800 (PST) MIME-Version: 1.0 References: <20221202153432.131023-1-mb@smartsharesystems.com> <20221228151019.101309-1-mb@smartsharesystems.com> <20221228151019.101309-2-mb@smartsharesystems.com> <98CBD80474FA8B44BF855DF32C47DC35D8760F@smartserver.smartshare.dk> <20221228090320.5fd76919@hermes.local> <98CBD80474FA8B44BF855DF32C47DC35D87610@smartserver.smartshare.dk> In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35D87610@smartserver.smartshare.dk> From: David Marchand Date: Mon, 9 Jan 2023 11:36:39 +0100 Message-ID: Subject: Re: [PATCH v5 2/4] net/bnx2x: fix warnings about rte_memcpy lengths To: Rasesh Mody , Shahed Shaikh Cc: =?UTF-8?Q?Morten_Br=C3=B8rup?= , Stephen Hemminger , =?UTF-8?Q?Stanis=C5=82aw_Kardach?= , dev , Tyler Retzlaff , timothy.mcdaniel@intel.com, matan@nvidia.com, viacheslavo@nvidia.com, Ruifeng Wang , Min Zhou , David Christensen , Bruce Richardson , Konstantin Ananyev X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 Hello bnx2x maintainers, On Wed, Dec 28, 2022 at 6:37 PM Morten Br=C3=B8rup wrote: > > > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > > Sent: Wednesday, 28 December 2022 18.03 > > > > On Wed, 28 Dec 2022 17:38:56 +0100 > > Morten Br=C3=B8rup wrote: > > > > > From: Stanis=C5=82aw Kardach [mailto:kda@semihalf.com] > > > Sent: Wednesday, 28 December 2022 17.14 > > > > On Wed, Dec 28, 2022, 16:10 Morten Br=C3=B8rup > > wrote: > > > > > Bugfix: The vlan in the bulletin does not contain a VLAN header, > > only the > > > > > VLAN ID, so only copy 2 byte, not 4. The target structure has > > padding > > > > > after the field, so copying 2 byte too many is effectively > > harmless. > > > > It is a small nitpick but why use rte_memcpy for a 2 byte / half- > > word copy? Shouldn't assignment with casts be enough? > > > > > > Absolutely. It would also have prevented the bug to begin with. > > > But in order to keep the changes minimal, I kept the rte_memcpy(). > > > > For small fixed values compiler can optimize memcpy into one > > instruction. > > Not so with current rte_memcpy > > Good point, Stephen. > > I took another look at it, and the two byte rte_memcpy() is only used in = a slow path function, so no need to optimize further. > > If the maintainers disagree, and want to optimize anyway, here's a propos= al: > > /* check the mac address and VLAN and allocate memory if valid */ > if (valid_bitmap & (1 << MAC_ADDR_VALID) && !rte_is_same_ether_addr( > (const struct rte_ether_addr *)&bull->mac, > (const struct rte_ether_addr *)&sc->old_bulletin.mac)) > rte_ether_addr_copy((const struct rte_ether_addr *)&bull->mac, > (struct rte_ether_addr *)&sc->link_params.mac_add= r); > if (valid_bitmap & (1 << VLAN_VALID)) > bull->vlan =3D sc->old_bulletin.vlan; > Please review/advise. Thanks. --=20 David Marchand