From patchwork Mon Oct 28 08:52:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13853181 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2059.outbound.protection.outlook.com [40.107.105.59]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 913971925A3 for ; Mon, 28 Oct 2024 09:08:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730106491; cv=fail; b=k7a4DWr+cwK4d6o++ESUQxNV38M5S9kV/6O+0eXqFI+OwhdbUGG2M/bqdG69pJsySr155tlP/E+SE/rOC/820cGrNLOOozSedWkBQdGMTsZ5tFhyA6RbnOKUWidTyT0ADVThbi3zAGAhUqmcnbqWQkzJGCGeMcazdM+OR3jQK9A= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730106491; c=relaxed/simple; bh=5GgFHuwb4sJqRpXWbsAUqxri0laIKklNEQrJaVvGiv8=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=TP0p9uJIDYfXYh/ze6k1IE+ChZrXrUwKBcLEtgslKwmdEQ7sAycB0mkkJcK3x32HU+L6QH6zhxtpQhkYmFUiclv/CKsuOyCVLH+GUMREcXvg8rSc6tXL/O2If+7+eOtw0hxIpMbYWI9MjkfbIhlvNbxYCVzVMc5R2Vq7s1ip2sw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=Vpm95E5F; arc=fail smtp.client-ip=40.107.105.59 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="Vpm95E5F" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uP2MZc7M6Qa64TNTO5+hQUltK3rDVcusqxPaJauDqasLUZD96on0rbqh13TR3LzY+1N5Yu9C6fDiZAeu8G9rnwkGojX57R3xg77mGoRqdAZAeubjhHcT1Yo3oOAeSpi+T4WEzQNDaRcHNX1fwSgQ07wFuZFGCkSy47OZpHRhNhsf8TghdqlKumgU9wKEv+76CU3cUgYYuW2P3VSQxyrFgD1eoVsSZXtXezCHJ2HG40i1FRmdHN5UfBnYNasOnqWN17CBMzldsoFPqnepvNaRoaBQqbVIHfNqDoj13Abr9HjujPGe3gAznXfBz7iPeusUqU7OC9AWiwreMsZZebOhUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Qk6ThNSqKzj6ZB65rHIlgg/MRlXL3XwHS/Owh8MvgcA=; b=gsJTjKQJABD9Gn+jQaEXRsfNT1GFO2wZWHsE7MG1bVSmh8RBp53IDGXJ8aHMlfzy70N3fbWzcgfGdjgFTNScxL7/0Vrjn79L05vkHJWhhdZRpX8qg9EJt20CWx7KT38Nil5T81JiFGEfqJ+K7d0/u4dlaiKZgs1qdCVURjMBivjbZyN5/XNoal/n2UNUuzIP72TYVFDYchyl9GC92TgGgFeXctthh4yPJvC16o/QU6l9DJ688LfILcCcJmE3pnYoXBDcdfRvI3yVAZuOVT/rCRXABHn1ZWGAclZSCoe2RbKG1VZAbL04F2kbf+STmsghzol++lPFiKJa4Y/Z0gn0Jw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Qk6ThNSqKzj6ZB65rHIlgg/MRlXL3XwHS/Owh8MvgcA=; b=Vpm95E5Fa9umL07Bx6FiTERE9vZSWN4VrgS8OXJpAWgO4V3oWw5lpgeD5g6fKvxJHLT2L3rTO/riOfWI4InKqoUyQ89PpjFNOrvECq/5a+TTs8I5w6qYrNl7z8ET/TNRT7FjxoFujy+DGtfW4sS/dk1/JGIU0tAEWpO/huQ6CFZ4TviHrJu43BXJpdpXNR5U6UeEdvLHnT4LGs/kBQupsfD2acQKyn/dW4VeghE5t0r1DL/Jxj3Cj1c3BE3qeOh8nrvcKrDWw2K1dMkrsBLdsr2U7auwZwhFTQ+H3uIl+sOLLaZlpi9N9/tOJJcdyYdyR5Qj1NDUQOEr9wBMLy+rTw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by VI2PR04MB10642.eurprd04.prod.outlook.com (2603:10a6:800:27f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.24; Mon, 28 Oct 2024 09:08:05 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8093.024; Mon, 28 Oct 2024 09:08:05 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch, claudiu.manoil@nxp.com, vladimir.oltean@nxp.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev Subject: [PATCH net] net: enetc: set MAC address to the VF net_device Date: Mon, 28 Oct 2024 16:52:42 +0800 Message-Id: <20241028085242.710250-1-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SG2PR01CA0145.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::25) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|VI2PR04MB10642:EE_ X-MS-Office365-Filtering-Correlation-Id: 1c69b3b0-90fb-4dd8-5fea-08dcf7300879 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: 3XqrXoQcq+0RITuvdErYdy5+ZDYrBHKK8/B1WCksdYUlNnycrKk8zBXQ/AuL9YmNWqkMeAMuxAmes62cYOn7ORp2I00dPftE7zXaHVAKE6AL9oqo7OuEE3n8U/33EGHBh48L2ATpVXFJ+Oai1Cth2XzczG6O7fYJd2T8D4ulIyw+YsKzxpcoSeMjViXqP3iUOxgKDGCHvYXiQEf2sEEbohG4BhzOH8kxZygEjgjj3CD5H8lRSYqKbI24XYIOh1AFIrEoZCnEsPboZEbf/DzectF9YHcTylknMhgxzXCIfltRofCM7dn4O7khY2Ul655mmVA/CWPfcSHIm+IR11blECvdCPmsCQz59iFEdGfxcbKnP7bC5cQ9WtYTtxsXkdy7byfOu/fJFlgTYkQ/0ByaMgR4rZl1Tr9Iv8HHr4Yi85QVoTUm0BZAEpzI0dfHndyqq9KvhnWwik8fvekE5gcAqgMckWHt5TWEC55vfeg9o0fREZW0jfcSh8d5rmaA/dT3DkPVNf28DCFt7oCvyTNnoUsDw+dHSLg10Qc1OVKKCXYF1bpR6V4UIN/r3xHJ4mNCd6pxon5QrMgv3AEVmmG9GzYPfdJG7v9wRIQGe39RjelLHsqlpoLZpNTuGJ99eeDv70fZmKUIIWWv7Xqm42UXdFOwDoUbWaccdv4fEtvC6gtcfmnSwXlSAlECAkV7AE1ZLT0i17r0uCjn36HtHmbzlnIJOO1kgG1mphytKc/lHa0chvx/MQunQRzOVtHJDnvZzMKjBnYnqLzqxb476PMFDOq3DT/5BlvjPp9Z3uvSIa1sFaAYX7jIGUtMI7VE6qP2qMRXrGRkQ1ZbH2FjcAm1Ot8Y1nwcL+2EXjQ79EJWTPLVaNsIzwcJ43gHLgBU/NoelXwGEgx2+B8+aLf1VVarzGVBaX7xb7lodJTf4NBjxzehH+uFFuKEBGWpohtwXdZKGb6wEAowW214xfKRawY0+voArwVLDXye7cXYrh0O9RSrlxugeFy4TgIAizwqwHRDNClq7kF5fT9jS48Rs4n3Mfd2ixhdE66WF/QrQVg2v1M9cLJOmAPey3dH4xkK8ptCEiEBPr5SE58IrryV0VoHUDLyli31oZkB2dRTim1iCthoW3Qoa3s9nTTUAIRlA35Hb5VL8RNviJ3/1lh6DWNHOvsczAMP+AacVpckZuR/lileIfvzBzCHLUpQMM4vR2enwE4jXGVqzttsjP6SGv4zwRUIge2rl04MyrH+f+J4GxTDljYrRtPz51x8FSixlrzB3sS9Bagbgzc6+2M4IS2ULNBwFsPJZTaUXrJ/QwXy6RDredDRSs6V1K+X0nCIWo5F3BUR1VBSTrmy6rVHHBc7AC07h4K+qyZvligmInC0bT8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(52116014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange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wuEBzvAEanO4Xo5e9mdbNEKY5ESlYuu1ivQcwIrXiCwPeCqVC2Jh05c+ZPWvbZw6dlnrcF/ekTMuLsaQ0TDD2syL94Ve6Dqgk49yR8ZytSHrk+x+g7CVa/eCYwkeUN5o4JkEomxbuM7dYgrKiCPYg/a43DubS3SkEyTTqm38vLSM3+qP+pQxktJi6Sk5lb42exPjJGjnNjTj4PXm1U90y6cKXpTQDdIKhfj7cHf9ZAFnqh/9a6evC6iQiEBqqVHzvSyF0oCWSbhm0GUEiTh+CV3VtmU4EME0pK6CZcgunMB7/ERrAjqgAL2yVKXVcikYH2JjovDplwWc10FJeKxNTTkQrD5JHCblk9G1KmctpntbJEh+FRut6mA3HtPu99MIpOMb7aoSHvyPkpW8zPywtyNYKR9cyUza1fu9lB9AH/fFSMfReLXyeE3pzp1dftpriDdVonlI5WxtoqeLJSTBqC4ycGUE4I+RJbIBbQKn7pUbAQIBjlMzxIucei/s5DOolOgVP0a6LAUQwSRpDw21tBcBJmphQP6kU4OYXrvGsepjYPBhGktIZKvTj6GjYh3W X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1c69b3b0-90fb-4dd8-5fea-08dcf7300879 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 09:08:05.4701 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 98UGRf3Uz2MkRMTww3Bm7t0MLADRkjWtnph2vNoWVCuh4/rTD1KUD2vUNxIKR/oRQhUm6dcNcH/1l5RE3vnndg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI2PR04MB10642 The MAC address of VF can be configured through the mailbox mechanism of ENETC, but the previous implementation forgot to set the MAC address in net_device, resulting in the SMAC of the sent frames still being the old MAC address. Since the MAC address in the hardware has been changed, Rx cannot receive frames with the DMAC address as the new MAC address. The most obvious phenomenon is that after changing the MAC address, we can see that the MAC address of eno0vf0 has not changed through the "ifconfig eno0vf0" commandand the IP address cannot be obtained . root@ls1028ardb:~# ifconfig eno0vf0 down root@ls1028ardb:~# ifconfig eno0vf0 hw ether 00:04:9f:3a:4d:56 up root@ls1028ardb:~# ifconfig eno0vf0 eno0vf0: flags=4163 mtu 1500 ether 66:36:2c:3b:87:76 txqueuelen 1000 (Ethernet) RX packets 794 bytes 69239 (69.2 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 11 bytes 2226 (2.2 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 Fixes: beb74ac878c8 ("enetc: Add vf to pf messaging support") Signed-off-by: Wei Fang Reviewed-by: Vladimir Oltean Reviewed-by: Claudiu Manoil --- drivers/net/ethernet/freescale/enetc/enetc_vf.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_vf.c b/drivers/net/ethernet/freescale/enetc/enetc_vf.c index dfcaac302e24..b15db70769e5 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_vf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_vf.c @@ -78,11 +78,18 @@ static int enetc_vf_set_mac_addr(struct net_device *ndev, void *addr) { struct enetc_ndev_priv *priv = netdev_priv(ndev); struct sockaddr *saddr = addr; + int err; if (!is_valid_ether_addr(saddr->sa_data)) return -EADDRNOTAVAIL; - return enetc_msg_vsi_set_primary_mac_addr(priv, saddr); + err = enetc_msg_vsi_set_primary_mac_addr(priv, saddr); + if (err) + return err; + + eth_hw_addr_set(ndev, saddr->sa_data); + + return 0; } static int enetc_vf_set_features(struct net_device *ndev,