Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp5253884rwb; Wed, 9 Aug 2023 00:43:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE2aMJdcMU++deTFBXgrIhtPmC9juf5jWPRBvCu7OIZtZOVxiqE59b4B3Ava7FdAe5G3UYe X-Received: by 2002:a05:6512:3e15:b0:4f8:69f8:47a0 with SMTP id i21-20020a0565123e1500b004f869f847a0mr1399713lfv.29.1691567033829; Wed, 09 Aug 2023 00:43:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691567033; cv=pass; d=google.com; s=arc-20160816; b=vasDsU724irIYNKowy3SQEASTPQSHz1NKNOJDInL4uH2DqoFbaTdnVd3wdZh87gpqb LNavHnXtPDndrbf9Zq1t8fiaEXP43VCO0NSRkcHHuLxr4oQALCKWWojwkEpc6G1o3mRR quF2Urmq22e37ihUP7QAI+PxfNoUTNF8PDcbT61ekCLFnAtfax4EGjWGZ23jg2gLusHq qklkUs+20XfEItRcBwP331DXDDL/VdCfEG5jbREsg2doDOR5BBl4aEUMblmAnGVgOGwR 2ZG2TvNDueeYF+8oRm23CqCMEl0wMFtOymGv43L3052i9HlckP0MmnWbmhPdc09UrjqY z7aw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:content-language:references:cc:to:subject:from :user-agent:date:message-id:dkim-signature; bh=AXPREfVea3KIRSg1pxvO6wJvu8FSO9qcSikQRZ2ZbWE=; fh=bQR/ZXAfT73CO109Q9hM77mg9hJWnQlQpoDqfu94MNU=; b=aUALPl9TQAc+Bln93QqsJL1aD3OAqARcQ65m0CR/VBqvR37y7RTZEmR3MhENlP7Lfg Cb14iX6u4/79NDOdj+JxyyEy6TQKAN9QyJOfapxxjvq0/TIQhzhgfdjGdU5q/n9uSoZ3 q4h7EI5hm1D0scAWbcfnUuFi5IoATa9guOkDYhiAywZsJbGIQOEjzoLisru/b0/6ERsQ psZalcC8U6q57mjRmuNoZsDLT5EEPICxCYhLvP0zAG5ebMzotIJtrmzhKx4Ob/COKGP/ i8iD4Yb4W9kK05DNc1q5GlQM1FQuz1l4SIS++ZtBqALp8EhYD6q/oKsjM05u0Nmy2YMu knlw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=fTTYm78R; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n20-20020aa7d054000000b005233f9be637si3312260edo.554.2023.08.09.00.43.29; Wed, 09 Aug 2023 00:43:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=fTTYm78R; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230093AbjHIGig (ORCPT + 99 others); Wed, 9 Aug 2023 02:38:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbjHIGif (ORCPT ); Wed, 9 Aug 2023 02:38:35 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2086.outbound.protection.outlook.com [40.107.22.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6827710CF; Tue, 8 Aug 2023 23:38:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IN6AFbzYribLEZec4abH0eLnDjborAri1063g5sByA+tCWEfeHr+nfIqyf3kqNDzzWl1I/MKRsLG7NvDcsXBEbaOKvuEmDeQWZNS3VQYz/OMTKMdaNgPpVH1e3rHd6Afhw0m4NUHIo3786p/uuDc95ffj4xbV00FIce/PKXeQ8ZUzs/JN3gu0qKb3DiNZBRLASIwBuvIpx3OqujZUK+ma6E5usQYm5ytszwrI8ZUk7FPmd1dePmp+GWaZIy3cOa/RIsPQEwgPAb05zLNXrbTbL/6YzRGN9LKBiBy5INqd6Wl2MZsrAWreW1EK8Qd+NzK2EzFHW3hjuO7gKqTCN4pwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=AXPREfVea3KIRSg1pxvO6wJvu8FSO9qcSikQRZ2ZbWE=; b=fb3+Xe+5QZKzK6HmZHlefUomSGCrb2ZbOeKhBEVdNikRARErYBTpCt4grqcpATlEo3R59XVYlmh0N1Tyoj51uVZh2TgA9QUSlGSSsK67MyQHIbQNSBtOBAX0+2JYJ68p9sftdDDYixJ7V0/5Qv6js3Pm6d54opVC6Y15yUD8va3MfDkBgFCpnxNorV1F7wnSlRT/0OHsoT5Fw2vaDdkUoBYaDGvI7cj4nj6pcMU0ZaYkaE4vfSs0wH84uk9E/IDTeG7qW4EhpR6NdPRsaXtN71q5b+EYl/qvyPtu8MoT5Awvc9mroxXQbUK6cjpHoOOqIrgBSyfm5ibIDvQumZJyiw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AXPREfVea3KIRSg1pxvO6wJvu8FSO9qcSikQRZ2ZbWE=; b=fTTYm78RN5ZRmU/m1AgCvE7ScqGexOORnFam5RjDbSnNXOZoS1PeA8lhYZBL6KMQNoLQPcOYsy0gvASpEtAKW78JMxC3mGxg6lSZTNGmo2lbvkaG/fTEzQZT8zE8AKQJLxY2bGtmgta4plUr+qKEmv0u+TsSn8Kz7KD228Lg1ao= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from AM9PR04MB8954.eurprd04.prod.outlook.com (2603:10a6:20b:409::7) by DB9PR04MB10067.eurprd04.prod.outlook.com (2603:10a6:10:4c8::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.28; Wed, 9 Aug 2023 06:38:29 +0000 Received: from AM9PR04MB8954.eurprd04.prod.outlook.com ([fe80::2545:6d13:5905:bf50]) by AM9PR04MB8954.eurprd04.prod.outlook.com ([fe80::2545:6d13:5905:bf50%4]) with mapi id 15.20.6652.022; Wed, 9 Aug 2023 06:38:28 +0000 Message-ID: Date: Wed, 9 Aug 2023 09:37:40 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 From: "Radu Pirea (OSS)" Subject: Re: [PATCH] net: macsec: use TX SCI as MAC address To: Sabrina Dubroca Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230808141429.220830-1-radu-nicolae.pirea@oss.nxp.com> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: VI1PR04CA0052.eurprd04.prod.outlook.com (2603:10a6:802:2::23) To AM9PR04MB8954.eurprd04.prod.outlook.com (2603:10a6:20b:409::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8954:EE_|DB9PR04MB10067:EE_ X-MS-Office365-Filtering-Correlation-Id: 4d7fba66-8b6f-4d4e-3671-08db98a33da8 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KKszF/ptHX3VsQ4JMZ1o1w8cIum81KylwjUKOxjDj9myvBekhcRXvByGVKVA4pHD+Ot54xyFoAELpxsfRHOV7bCIhOPQWy8MrdqqPeHJeVqi+tcRLLSivj4CTIgnvb0wla+VgGzpsYBaWEVVEloIecBO7KyFzU8XXnfaXYklRVWNd4qQK51I/DL6ej1IeM3KGIfEHFvGOxZ3IK+UpYGanobTUJR717K5f24n7BTZW91IQTMA8MornG71v/RdKd/8AjFgCTs4MMCX/4TA4UQtnWRGWrBU0p90fCjC51pl2cnWcFBKSmQE3ZihwHyIh/5CHWAJ6BGlFGBt3DA6C2htnXTzKCJ0GBRujzZabvts00cX3O6s+llOLSX9emYX6qYSsZJz1PBWeAJm0DgVeQviivGVGaM9cJbZQWn/QdfODl7+AyprSQ+MrFsykgRxQdGGXc8oEepf0syzn2u9jrMfTM+snZEtaakEpAdsOPtabxh8ru3F0VFG1eZqZiI7+wVEaeTHrVrsGcXA9/Sd9yMHJG4aFebbdyTXZQH5S4esUc0hQoV/fW5MZuc9n81do8Sx1Pww/Qyz7M5v2LZYnYa4xm+UOFI2DX0R1xuXSqtgVXzSzr4pojBTdfluTH3q8dSE851C2MyLxmbYq8DR1o+KOg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8954.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(396003)(366004)(39860400002)(346002)(376002)(1800799006)(186006)(451199021)(6512007)(26005)(6506007)(53546011)(38100700002)(5660300002)(86362001)(31696002)(2906002)(4326008)(6916009)(66476007)(66556008)(66946007)(8676002)(8936002)(41300700001)(316002)(6666004)(6486002)(478600001)(2616005)(83380400001)(31686004)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Mi9KbEgxcTlrWVVuL2FSOEYyK0hZY2swMm11NUo1RTliS1d5eDI1a3g5TWVq?= =?utf-8?B?SlNLK0NIUVI0cjg1cCtlZVVVSU4rZ2owVTNwNG1BS0NKNms1ZE5jcDVQNHh4?= =?utf-8?B?N1NxUjRLUlFIUFlWdEl5c2QreEZKVGpaU3ZtcjBCb1NlOVVodGdlcnN5cDJV?= =?utf-8?B?MmZMVVJLOVY1bHVuR1JuMnlPRmpleFVWK3U0azd2QVhOZ0t1MzdtRU15RDJM?= =?utf-8?B?b0ZlN0FZbG0wYi82M1RiNlJaYnZWekZxdmVWNzZrZWxhQ2xkSVhsV28xWGZX?= =?utf-8?B?K2tZUHREMG82SnNwUVRNeWNWbFV0MXdpQ2dKaElwNjBmVDZDUFAzQkMvOExN?= =?utf-8?B?dkpyaTh0cWpqRWY1d21vS24vazJEMkhteE9xYTZqU25nd2VXdUN5L0MyZmlo?= =?utf-8?B?YjFxc2gwazZMaDFoR0dKOS9wZHYxODExamdTOFppV09uMXdHd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ant-AuthSource: AM9PR04MB8954.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2023 06:38:28.6687 (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: w1EkCbOu0u6SCI+5d1Qkd+05PUjPj9mJBFjSaFm8ywFpAZ+8RPf0ECabL999l1BePrEkDIyYhBOxEPtj05mQhoUr/cfIaT+ndwEDHIC0SKg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB10067 X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08.08.2023 18:22, Sabrina Dubroca wrote: > 2023-08-08, 17:14:29 +0300, Radu Pirea (NXP OSS) wrote: >> According to IEEE 802.1AE the SCI comprises the MAC address and the port >> identifier. > > I don't think the SCI needs to be composed of the actual device's MAC > address. 8.2.1 says that the MAC address *can* be used to compose the > SCI, but doesn't mandate it. I used IEEE 802.1AE-2018 as documentation and the text is slightly different. However, the purpose of this patch is not to force this match between the MAC address and the SCI, is just to have different MAC addresses when the interfaces are created with an specific SCI. For example, the following command will not set 00:01:be:be:ef:17 as MAC address for the new interface. Would you expect that? ip link add link enet_p2 macsec0 type macsec address 00:01:be:be:ef:17 port 1 encrypt on > > If you want the SCI to match the device's MAC address, why not use > IFLA_MACSEC_PORT instead? In this case, if no MAC address is specified, it makes sense to inherit the MAC address from the real netdev. > >> If a new MACsec interface is created with a specific TX SCI, use that >> SCI to set the MAC address of the new interface. >> >> Signed-off-by: Radu Pirea (NXP OSS) >> --- >> drivers/net/macsec.c | 8 +++++--- >> 1 file changed, 5 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c >> index 984dfa5d6c11..6db69daf880d 100644 >> --- a/drivers/net/macsec.c >> +++ b/drivers/net/macsec.c >> @@ -4103,12 +4103,14 @@ static int macsec_newlink(struct net *net, struct net_device *dev, >> /* need to be already registered so that ->init has run and >> * the MAC addr is set >> */ >> - if (data && data[IFLA_MACSEC_SCI]) >> + if (data && data[IFLA_MACSEC_SCI]) { >> sci = nla_get_sci(data[IFLA_MACSEC_SCI]); >> - else if (data && data[IFLA_MACSEC_PORT]) >> + eth_hw_addr_set(dev, (u8 *)&sci); >> + } else if (data && data[IFLA_MACSEC_PORT]) { >> sci = dev_to_sci(dev, nla_get_be16(data[IFLA_MACSEC_PORT])); >> - else >> + } else { >> sci = dev_to_sci(dev, MACSEC_PORT_ES); >> + } >> >> if (rx_handler && sci_exists(real_dev, sci)) { >> err = -EBUSY; >> -- >> 2.34.1 >> > -- Radu P.