From patchwork Tue Oct 29 09:04:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13854546 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2041.outbound.protection.outlook.com [40.107.21.41]) (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 5F05C1DEFFD for ; Tue, 29 Oct 2024 09:19:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730193555; cv=fail; b=BpSN1y6LQBtFU0EEb/DmNXoNUl/u7PfT/36LuRucAJMqnJV6GAIOEP/obkvlbAKYpWDpQfZcyz/bJgEamoTRigWUVJyidY9AYVRnaJnSg+7Fs0bwnd0WHT7NCizMOsCEJme1ZAp3L5G6wPb8vZ9czlI+BpJA5Q3YRNPxRVdEndU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730193555; c=relaxed/simple; bh=vXgipNSSz/OST9DZqCro/ViqJm5FIupoIF+e02kDDAM=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=sfuYqPF04ZWknhsZSnIFn+HSLIhQG6YT1x6ys8lLTbvYnnsHLegK/TtzBxo+jHXhJpShW/GC0H/j7fB0L5O8ivm5+MD5KCE1TQ1gQyzXMpradDU4YGNm6c6gx7aAfjzYnIIatMbpNDmT+d0j6QbQx8hAYdTZSgmXJW6IPN/DqsU= 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=j50kJLm5; arc=fail smtp.client-ip=40.107.21.41 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="j50kJLm5" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=L8kmmAf5GLRB4ph9RGXKj6BGMhJdCOLm+3AHrRZSrjbu+quMRA7nHr3q/gQIC6OikORQ9SwyAlwgQ9/mpuDh4Ckta3iYvkV0H8t+PmmLhEWFNqKjPYlktFjBfI9/1M9Ld9PiDFjw12G90Bewxm2gNCUBOMgQKghqAdkVgLOKUHCApFhuxm5j1tDh2Z7Fiebonw1juClz1hEvvi/aYxDngRN8IH7GjrDFBgJMost2NZ/sUHDI0K5yJbt/Pee5Sa4Irsr8iBogCadDBCLonh5wrMLh0GrJIvq6flzOnHNnACzhDGPI0A3/k/Zzkygw8kABkmB/2G5YcCXJ8nq/fvKxhw== 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=8q9M/gXiSbRS0ll4fcer1vDPVDFaxVhRabq849YTYOs=; b=bauBvxCliDjtFCwcZNZ8Alev2+Qgg3R303brdxGFSC3QOvNK37mgQjg2cUguZ1CJGTU+Wf3mGWTFh3PFWLYT/YVX7fCLGgv1gh9soBQFU6rjIAC+8rK4QE27y7f8U5U7CPI+QtpQtxtZ/8GondbEj3FN1srQvbiIINjNkn9P1kNMhTc9zrNkg1aX+Yn6HWWR68PXkRIulFWfjbFGQXIdgIMkGVmlv1Dkiig/hP9gY0YJpOl1GMb5ko8QNJtk+q42PFXceFlFB6ehWJKYgwNmXBMWyriHOdQ7/tpRJ7B0++6qBYO/koVI+5LXB+GSVC5Xa1PvyEoevATNlYpGKGXBtg== 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=8q9M/gXiSbRS0ll4fcer1vDPVDFaxVhRabq849YTYOs=; b=j50kJLm5E1cDzICsxKpqzLwnE8jVFQOGpPTtvQRsqcImz6UMeBMv6UwRpGTZRb8C3bn572Sre3cWMCdDIcrzL5iid1A/GpIxrLbrC6sMVXWzn1CYubAOITVJFtgx5zfr9tow1G5FPybvhBUUdRqVq8nPdgH3m6it85g1zu7pKkz0CT2AI36rUEhUgZ0DtxKRY9PLxqQM99+FKfAy0FEj+aG04//c11NzVkE5vTcDmt60Bwx1ztFLMwyRaMdJzEYCkPbduzmIRvkisnhvR5T3kzHyHni+MVOcN7rULmwhmWM13DhyxdDSPZK7jpdpc87oY4xYXG1IxJjW729kyyougA== 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 DU2PR04MB8662.eurprd04.prod.outlook.com (2603:10a6:10:2dd::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.29; Tue, 29 Oct 2024 09:19:10 +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.027; Tue, 29 Oct 2024 09:19:09 +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 v2 net] net: enetc: set MAC address to the VF net_device Date: Tue, 29 Oct 2024 17:04:06 +0800 Message-Id: <20241029090406.841836-1-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SGXP274CA0010.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::22) 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_|DU2PR04MB8662:EE_ X-MS-Office365-Filtering-Correlation-Id: 9ff24ef4-79c5-4725-6b89-08dcf7fabee3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: socKcnhgHUYj2GPzXqN4ky1vdOmDcdGMXv57g+e6axpChEgdVrsCbQkvrO7BdDqfic2uK6CRIFkn6dFIRBuPEjfb0786i3AlC9tfFg8Kz9n7/SbKzO7NkFuXqVtEMuZThSenl5xyZEtB8uF/Lpv5OuiItdSRFGjUn2qhGURDGUtpb1K8Fm4/LOo1ZHDoeYADX3nuxQJSDWJ+r8PBNv5XAw+9u6ARNVdmVw5dxciKovAgUZ+cbuWUhO0JbcIWP3T1tuR4aVLyjsxwy6+SvrgCFgkye/cgfn0lttAtqTko5XMhrGQYuPZC++Kk6QolZUQxaoM+tf5fONmzwlVWZJgSqWfwABqg3Zd5ioKzF1rtlX/IQ8Noaex6GV7hpEqevKqxQnhQrBtWXIHjzoI2mg2+l2Nc+q894sPfwj4QRv6CuZ+wi+Egds+qu6D/RLrwnKeInwjZcgdEkAJ2fTfe45lMUDPtGttwR3nsDiIcpWdHV7Pl7Dd5KYs+X52jUAgCof+Klx5Ch9OBX4/5EwMAV78ZtMuO5jw89yyWbrcueqARjldzgXEqRKXFQw/0uXzJ6WavB1ndPad5/XVZj7uY2XteeLKpSXVqyalmTE8owJUrRGyh+Zve4210GPmb+0+GTaAsttuqqnXveufg92bNc4ZR/8r3cheIStYF6YKbfxXi8HWv1tmYMj2WQgPJnuqH8JV96/ZikOO9bLunVmsm/zvsh6CFL3U9HGGFt7eKrnGAY1DwxYrSWqt7/6M2DUZG5CJtunRXSWd5ox+tunEE/aiPKtdThLOWGsdes2hKj0b/2JoK61tOtv2uybs3zsa++ZXFBnIaEpQCNIJbLlWpMkaOP0alXP6WlNf4Z02DTSIyxEgV0Ja8wePJEnhLTsVov8p+nLdwCWs9v2NDhwuuUZY3zCV9MX9xdwiTAUxcZQyhxeSFGP7uYJPa0Bdn2ecFcnE8T9f/OdCbLcQ5nw1Cpst6eslyVCwHMJ5Y99AWAnyoU0mJSpVDrDbYydqdIMGkgX4e0U6Z8Mksse/DBJzG2yMtIPMDFnAGhQRC6w1qiXFItQad+SuGKMNHoIXe8xY/oDi5APV1uKBgwKcMS+8piQTqOD6lGFv0I+HWYo6YMEsmYtELI4DxF4JMunYk7znKJI1IWDLAF1AnBIYG0kkCYFmspeRiiZGv96ouPxPUKvojq/6Els6DxlNv8wiOq5u/JQOBNL32Oqwae4fKjeUlYR76yqS/seFy1oMkqxri06wbhWzZ/WcjawU9oP0jVNanbUkNCtUdJxsVRuie7Jt+2fncKTsaNtOKr6yddLf3QLCWhtRgCfZomiUKGkWICP+xskPJQ+r1Ku2h0Ho1mEm/bOYMaLWI+IdGbDSvpq+Hq7625drbwym6SpR0uYbclDBZQn1W 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)(52116014)(376014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RS8XbBIOc6sgx2YWcAslVtVmj6Wx+1itEvKwN8cJW80r/+J4gJfbmITCz64PECcXLb0b743LVnFhzUW613I1IOzT5t3evxCTCCmHcB9Ab1wM1qKkYWiVTW35RUpdpXc94Au/r+9q5l2TFEioTrOq1L+fquQzpFnUfX4HC+jA16MUSQqtxmy0LDPEwfGgu0aRtezY7/IBR+WK70FcgT4jIYZEsjzgBLnnO+ejcvDYyXx8Cwu7enSLnh6kW/37im+xPbjtO5gX/eqY1ah2tlN4qylj4UMnxJU3TTB+yK94TxqXXoobhN8scteozDQjR3D3whoFEAoUW3r5gAjy+zfCh8wt5RFtWI9u3woj8t0V2VRt1QI9Owwd/6XwxDP/syrTr8SyrwuJPqESrQm/ZsD2IB86hHslzANsHeCmwxGOY+JOcbJW+g5LbrftZvuwBXeDTzS2W1qTOGmyKsgyfBVKezFH8qB3FhPk3iDJGGkRvb+ctUwq/NP6wDJsWiDcUhZpm4K4RGIG0EZkrDbjS7DRUGbucWlGIcxX1YYIu0wjL994q+2ac/agQLSdbckNMl1JHYPrrP0OraFB8rV61m3U425sXWjlxzSXxR7RW7gkdQPuGge07PmOLM/SVgx8LkMV3kD/I0xg3FrChOka065NL28+5tp7+A4G3h/qsM8KbOjl2GPKZZUssPg/OEStLVH28mfRHyYfiNnjlyr1I/RAbjGDY9e0a1JhQl4L1hUDhcx8gb7WLd2VmMMO6yI8xuT6pr0JasCPPQdvAgmrNE/GOVzS6VjMVyn5FzTZP1hSoyVegEvAOCQvRWbremp8InUzUK7NitpZRZ1oXuWVvFfWpS8NQabims3QfiEd7pntGH59q7pbQwaslz+zowkTmYx40uG3uD/aDgRa8MxVtD6th7731shNVlF9qUeCwS9thBnKFuPJh9ljKUGYLAfynl5BMC3URckhtgXVrUJ0jixUpn8bckS7PJQiS6V8eEiHNn6CmUZLCJDy+zjSERemFGCG7+yzoT3vyGbZ0LCGMgxDlo7EaeX7KzSsnhvGatJtH/rZJgS4QQV+XLKRMS+QoWa2DAr2Fhyu1FMcJX2Z0usrLfQCOhplCac6HCC3F19d+diJkIGUg+UrOegqfogDHITGE7hcFsTWQpEzI1ey67lbcrjoUa5utfrLlfuSaWaJXmgplXPMN8JP2UxXnSa1esVrEyfMrEjPrgYtEDNxPS2knE93DyxqZPqiLx4fFxqUgzyIlTe69Dxs5c575xPugRRzhXphXMH8PCtb/NbWLBEfQ5U29GPbYDIxQl7BDr8o0jn9hh3QY6SqoU7Vb3XoNm3rstWBHyV08RU3baeMphVxVP9gjLcI00m6zUzWSVvcG7Iy8qJPtZhQ32kyXFHYApJUblt+EsQpGvtfd67mlkpntAlqkQzym1PtM2a7a0eCi3DGkZsyWN+cKmZuHsXoiYPBa5fxnpU4YPgaDK9NuaS55hBmrplFhogsQZtZJHyrgr84vleS04+t8Gspvl7xAIHX/+LqAQEEUzVnG4x1lGRsQgu57+iSbtTGSx8cFc4Aqk7uKwbhlIDf1Wt+5tpHwVcy X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9ff24ef4-79c5-4725-6b89-08dcf7fabee3 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2024 09:19:09.8683 (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: Yh4z13tMJILpBbgbS/yOX++tnE7s2X8f6BMNa7q4X61BYZEAUnCQZ0uhsCDbTJiSojGu+IwbqBWpcluj5b9dYw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8662 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" command and 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 --- v1 Link: https://lore.kernel.org/imx/20241028085242.710250-1-wei.fang@nxp.com/ v2 changes: 1. Fix a typo in the commit message 2. Add Reviewed-by tags --- 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,