From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796133896; b=AcN6zrK91BKZPY5ljoXOrxtUBX5NyxED0SkribF9XboQOvPetgkQe90KmSrU+zvbKj+z 6176Vzu1Oxh2HB550FtiZPInCq61pApVJbJipc5FxxmC0gegkCbBRHmeqLS5vgOePI+DN DmQbxnO2Dbe972gequmj5Nd5+QhP5enMC8SDbbJjIADoYw3NOxFeth0AF+NDH5i+6ow3V 5z7N9rSYLwnelW99bm8qILIV9UwvKWEQCJWls4S3bfbFelLsjxJvl7KJUuPLjyLPAs+3z gS2tcC5HKmeNr0LUmXh8V1tGzOPE4CmmQ8Zlk0kTDqTCRQSwOtmaF3wqfhCt7SGN+sw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796133896; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=VPOw44n8c5RKXLhDY3jjfW0NYv6KrfLOtDPw0pRuT3M=; b=gU0EXKecRbNdklVDFGnt/3edZYZb/9VqwQlccJ1NuU1K7EAjLBm5PppSTZsX+5aVct9Y rXLyfVn+iH0kdTAID4RqdUt0E1LLIsr1VpJM/Cv2cO3Gv0bovtHK2mx8+8bGgxvPoJdbz 20sVD4DV5Jpym2U+IRcgjg6YD6s3U6PJJSyXNxmt5VL58Zds0revn5fnBLXsWo4IaNVS3 8Tygi0A1aDGW3xvjWLDhO44Ovhw+XhoAWYvxtzDhANF9sL3PsbsYWdb1p8H8PS7ZARAWp zYkoeyWLlP1Jc9FLYUvhQtJvwme6Gwq//uXlvKq0CFTBfwdcWKjjomdEus+dqYmqf8g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XW8fHMSN; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03600606A335; Tue, 1 Dec 2026 14:04:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XW8fHMSN Received: by smtp.kernel.org (Postfix) with ESMTPSA id 727351F000C1; Tue, 1 Dec 2026 14:04:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796133895; bh=VPOw44n8c5RKXLhDY3jjfW0NYv6KrfLOtDPw0pRuT3M=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=XW8fHMSNLIKI4fXjtDFGyuVHwO4WzOgxxImKqaoAZ6GFmQv1DP+ftcDZPpXuRLeVe qPLpxCbv0O7mw7I6mSR0IJwOIUmaPyOclfamuNcIu5jUq6djHvTgORSbyouT3jFn26 3lSDyD1g1vvaFSGgic9H4ENZ6Cg5tcFRuqZ7Des2bWFDBMQ+ggE3zaTup0GXYgEF/3 a4n8dKpVoZmhib4GkfO5JeJIJYJAqSZp3vK+niWeTb5iYRJxkbmntz+F5dOY1TEW/V GVmqQGsiVI0uLWMmSe24eyF8M1izCNY451iVimw9iGY2Zf1CwdiZ25JBb8gh4azTAT P9mSKydUujk5g== Subject: Re: [PATCH net-next v4 5/6] enic: manage V2 VF station and administrative MAC From: netdev-bot+sashiko@kernel.org To: satishkh@cisco.com Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, willemb@google.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, sebaddel@cisco.com, aradhana@cisco.com, rfaucett@cisco.com Date: Tue, 01 Dec 2026 14:04:54 +0000 Message-ID: <179613389400.3146.4727108812986852753@kernel.org> In-Reply-To: <20261130-b4-enic-sriov-v2-vf-receive-control-v4-5-5858d5a9ecb1@cisco.com> References: <20261130-b4-enic-sriov-v2-vf-receive-control-v4-5-5858d5a9ecb1@cisco.com> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] This patch changes the address-assignment type that userspace sees for a V2 VF with a provisioned (nonzero) MAC, and the commit… - [Low] Several new on-stack MAC buffers are plain `u8[ETH_ALEN]` arrays with no `__aligned(2)`. - [Low] This patch adds two driver paths that rewrite netdev->dev_addr in place on a registered netdev while holding only RTNL. -- enic: manage V2 VF station and administrative MAC This patch moves the V2 VF station address onto the mailbox MAC operation and treats the PF administrative MAC as authoritative. PF notifications are handled in a delayed worker, and policy is refreshed with CMD_GET_MAC_ADDR after registration. The station address is installed on open and removed on ordinary stop, and perm_addr is initialized from the address chosen at probe. > diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c > index 9c4b94a949809..a2186f65c74a8 100644 > --- a/drivers/net/ethernet/cisco/enic/enic_main.c > +++ b/drivers/net/ethernet/cisco/enic/enic_main.c [ ... ] > @@ -1064,6 +1067,501 @@ static int enic_set_mac_addr(struct net_device *netdev, char *addr) [ ... ] > +static void enic_vf_admin_mac_work(struct work_struct *work) > +{ > + struct enic *enic = container_of(to_delayed_work(work), struct enic, > + vf_admin_mac_work); > + u8 policy[ETH_ALEN]; > + u8 selected[ETH_ALEN]; [Severity: Low] Should policy[] and selected[] be marked __aligned(2)? They are passed to ether_addr_copy(), ether_addr_equal() and eth_hw_addr_set(). include/linux/etherdevice.h documents ether_addr_copy() with: * Please note: dst & src must both be aligned to u16. Without CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS, both ether_addr_copy() and ether_addr_equal() access the address through u16 pointer casts. A plain u8[ETH_ALEN] stack array is only guaranteed byte alignment. ENIC depends only on PCI, so it can be built for strict-alignment architectures, where this can trap or need slow fixups. The same applies to previous_policy[], random_addr[], selected[] and policy[] in enic_vf_admin_mac_refresh(). This patch already adds __aligned(2) to requested[] in enic_vf_station_addr_open() and to enic->vf_station_addr. These other arrays still lack the annotation at the end of the series. > + unsigned long delay = 0; > + u32 generation = 0; [ ... ] > + changed = !ether_addr_equal(enic->netdev->dev_addr, selected); > + enic_vf_station_sync_reset(enic); > + eth_hw_addr_set(enic->netdev, selected); [Severity: Low] Can a concurrent reader see a torn MAC address here? This worker runs asynchronously after ENIC_MBOX_PF_SET_ADMIN_MAC_NOTIF. It rewrites dev_addr in place on a registered netdev while holding only RTNL: enic_mbox_vf_handle_admin_mac() enic_vf_admin_mac_notify() enic_vf_admin_mac_work() eth_hw_addr_set() __dev_addr_set() /* memcpy into dev->dev_addr */ The core readers don't take RTNL. netif_get_mac_address() (SIOCGIFHWADDR) and address_show() (/sys/class/net/*/address) take only down_read(&dev_addr_sem) and rcu_read_lock(). The core writers dev_set_mac_address_user() and do_setlink() take down_write(&dev_addr_sem) for exactly this reason. Those two lock sets don't overlap. A reader that runs during a PF-driven change could therefore return a mix of old and new address bytes. enic_vf_admin_mac_refresh() does the same thing when called from __enic_open() and enic_admin_chan_reopen(). dev_addr_sem is declared only in the private net/core/dev.h, so the driver can't simply take it. [ ... ] > +static int enic_vf_admin_mac_refresh(struct enic *enic) > +{ [ ... ] > + changed = !ether_addr_equal(enic->netdev->dev_addr, selected); > + eth_hw_addr_set(enic->netdev, selected); > + if (!zero_policy || changed) > + enic->netdev->addr_assign_type = zero_policy ? > + NET_ADDR_RANDOM : NET_ADDR_SET; [Severity: Low] Is this change to addr_assign_type intended for a provisioned VF MAC? enic_probe() now calls enic_vf_admin_mac_refresh() before register_netdev(). For any nonzero CMD_GET_MAC_ADDR value, this sets NET_ADDR_SET. Probe then copies dev_addr into perm_addr by hand: enic_probe() { ... /* Record the initial address while preserving how it was assigned. */ ether_addr_copy(netdev->perm_addr, netdev->dev_addr); ... } Before this patch, enic_get_vnic_config() read the same firmware MAC and installed it with eth_hw_addr_set(). addr_assign_type stayed at NET_ADDR_PERM, and register_netdevice() filled perm_addr. /sys/class/net//addr_assign_type now changes from 0 to 3 for an address that nothing set through dev_set_mac_address(). The UAPI describes NET_ADDR_SET as "address is set using dev_set_mac_address()". Userspace that trusts only NET_ADDR_PERM addresses behaves differently. For example, systemd's net_id builtin stops producing ID_NET_NAME_MAC. With a zero policy, perm_addr is a newly generated random address on every probe. ETHTOOL_GPERMADDR then reports a different permanent address each time the driver loads. The commit message does disclose the random case: Initialize perm_addr from the selected probe address while retaining its assignment type, including NET_ADDR_RANDOM for a generated address. It doesn't mention that a provisioned address changes from PERM to SET. Could the commit message describe that change, or should the provisioned case keep NET_ADDR_PERM? [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130-b4-enic-sriov-v2-vf-receive-control-v4-0-5858d5a9ecb1%40cisco.com