From patchwork Thu Nov 16 18:28:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13458171 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="lFQudKU2" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09762D49 for ; Thu, 16 Nov 2023 10:29:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m0tn4OZqMAyuMJHVDzkOFRI5bS90DlASa1ZLPv1s2C0zFcpkTa2eOYa5QwgfgRK3jrnnYabVLFlBCoxCgFnt6h0uF4my+AZq7sNf1a9UON1/FwUvBmXjIZzyjm1Bp7/WmkHZqcPY3USBjg9up/SS7Xy65Iru/k+m97bRkevfiCO9GGVC1/SFf9ZF/XMTIIap/W9sV71mWZphqFb2hKWdAM4f3LIhryw1MfTyMiRxrBnf2MS4JTfQ0NaNbU+gswqoWwoodWx53LzujBI0xFXrxJsP5X3OhpOmJTAZGA2VKkustSqnM9waCjbcbQZ2U5ZeiYSbVvb2+UG3Sy4l8wzjOw== 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=RYCTzOpq3PCRcT6/0iN2pOWt8HagIDEcygN62WqT+tI=; b=LVhWWDeVkDYwm6lxS/W7/0xgPmJP5cGxpyOaE86XC8iZypFnb1HUnP/9kz6bscOhiWDGK7B/havXM4FvzPnQEjwQtQCJZ7DN8YFAmHcFmF9ufbdXqnz4JYL5qHZTvV11ERLmp+wp/DTPSUwhyHgAImLFHsee+ZT0FWuQvTqM6W+ORZkAl/UZZD6UjqzV0oVT3vqtZSirm47B7rayPQN5B2k5gAVxtbJe0n1gJRadUkebyXYqLuGZa4V5XcVFpAEA8inBVod9Yj03ygVruhL9NnphHTseYIb71j5Veg7Z4L7UwhnZH7j23QKR/+JtlPHxtrsZTlp2iJiY3mtw3bpApw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RYCTzOpq3PCRcT6/0iN2pOWt8HagIDEcygN62WqT+tI=; b=lFQudKU2slEkbZZ1O3fBgKetzdNldGslO/pmzOzwuZQq+WYwHSmNwr3D7F4Wkzf1sRYw2UZx8H2jP9ydk/U81K0C8A5p1M6hTCkuL8otcc4qUqHBHbAIv7gSbRBUDwQhohStbXCUzQiKEeWFBs/SQrT/3f3fkN54hKH0i3Y3MkAfLQT9d0TgaSK/ZXAeHLgggiy1nMdlRp5dG5IRty2iapM/p7Q1YR6C4iRMKKqcXx6TZFq2W3WechqZ5dzyYxns15Qqtaj+j/6+D0WcG3urz2md1bK2FpM4rcrYkfP6P+JtrAmjNtpP16jHNufKBBxYkL/5++9E6oMTpmupaMDY3g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by CH2PR12MB4088.namprd12.prod.outlook.com (2603:10b6:610:a5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.21; Thu, 16 Nov 2023 18:29:13 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::a24:3ff6:51d6:62dc]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::a24:3ff6:51d6:62dc%4]) with mapi id 15.20.7002.019; Thu, 16 Nov 2023 18:29:12 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org Cc: Leon Romanovsky , Saeed Mahameed , Gal Pressman , Tariq Toukan , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rahul Rameshbabu , Sabrina Dubroca Subject: [PATCH RFC net-next v1 1/3] macsec: Enable devices to advertise whether they update sk_buff md_dst during offloads Date: Thu, 16 Nov 2023 10:28:58 -0800 Message-Id: <20231116182900.46052-2-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231116182900.46052-1-rrameshbabu@nvidia.com> References: <20231116182900.46052-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: SJ0PR13CA0033.namprd13.prod.outlook.com (2603:10b6:a03:2c2::8) To BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR12MB2743:EE_|CH2PR12MB4088:EE_ X-MS-Office365-Filtering-Correlation-Id: 07bf0f2a-d9c0-4030-0093-08dbe6d1ee7f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: slLj+fFf2yN3zJNVGRApZ37zSAiSD9q0d8T5q28NyaIA1fN+B+U4aj21Nc5R1bPKDgcAju9AVIASuAoQveojBhSRLW8yX31vL3+YjrvQObohjfc05C+wGQaR8miFITVGrLLN/TDm7QkBQjl/b9PXljknC0iPZEFQYZtInumzX3T0CNSwOz6zfmBJY6fAjpncNLLmG6bIPxF4abF8e1eYdyXFEuzLOUB9ReCBT0Wf34nJOcRdQ+h4eAm+l/ipsFUo3mhu8ZbVPA/ejwHTY43Y8YNX1TDOsh5vj4UBPbu16YJH+t1pIjy2OL9rxxrahYlWHKH/EEO1z3BzAjJkpaoyMfhumCyu+adeQImQW2OmqtXT7ogcw5uX9VUQMgZYkyYKHqmzpEc/efaUj1KhmhB6g+Mv0baUFqDFwhIbO8oVGPJb9EjaNMY1VQ8fS5xvPQVpD/vd5AZ0pPqI78+ZlBbino0RKfshP5J7PwP4MhLheONmt2qYUwuuogSgr1hnx7tufd/JwEGWwMaSkDqXZnf8pT7nYWGehzd4YnYo9HA95fECwfyNgfoS024XVZuTNuPX X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB2743.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(136003)(366004)(376002)(346002)(39860400002)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(66946007)(41300700001)(66476007)(316002)(6916009)(66556008)(54906003)(8676002)(86362001)(5660300002)(2906002)(15650500001)(4326008)(8936002)(83380400001)(38100700002)(6666004)(6486002)(478600001)(36756003)(1076003)(2616005)(26005)(6506007)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KoHT47KKsQ+skKdTTW0mA9rnvcsExKdp6HkFbdmz+fH1gTUqCCDoQXVTy2mCBCLcN/nmTYPUb1hXkk9hrPNW+FkfoPl8vc19xLNb81LQ1XT3xYIIOd1HPXe/qHdfyVPO8gZZJioUCW9cRLkTNLjGdzdq7+Gb65VlWKXxMXjs1Xq5ZKihLhiYk4Yp6M2HHVWz5ssBkYxueC7ONh1/vJcoPw48PsYgFTA0xRCgpTWz71EQ664NbwmYztrmqTEKgCQ6nFheY46oVmmiu28CmU/nhi8n5yAbmFGLSsdID8XcCvgry9bP9lMSwqlZgmVrsvIegSDqNEo60fN6yxKuQf5JgSobf4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SZDTP2Ssk1AjYtkgNjyT/fSA1w/VH7tL+hPL09KjXShB/0ND7miXaYkhnxJSZ2q4oruTLYNdBpfzPjj2ncmU2xNhyoA2fcRmFDUvxiaAVxO8JOvxhWjKPz0XnuCbwZey+MclU5mDIvwILUSHEsTdBfLeYJpFktxKWHZd+S1T3Ri3O03J/w9iWRedbO7o1n+jDQ== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 07bf0f2a-d9c0-4030-0093-08dbe6d1ee7f X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2023 18:29:12.8909 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gd3O5JCOlp1MSWz/o3C1JDkwWKXGemzr6szvxgIvezDpP6l/2bvKi6z/hQ+mEwUBoLe0lyMRhKgVcyNAMPu+kg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4088 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Cannot know whether a Rx skb missing md_dst is intended for MACsec or not without knowing whether the device is able to update this field during an offload. Assume that an offload to a MACsec device cannot support updating md_dst by default. Capable devices can advertise that they do indicate that an skb is related to a MACsec offloaded packet using the md_dst. Cc: Sabrina Dubroca Signed-off-by: Rahul Rameshbabu --- drivers/net/macsec.c | 3 +++ include/net/macsec.h | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c index 9663050a852d..8c0b12490e89 100644 --- a/drivers/net/macsec.c +++ b/drivers/net/macsec.c @@ -93,6 +93,7 @@ struct pcpu_secy_stats { * @secys: linked list of SecY's on the underlying device * @gro_cells: pointer to the Generic Receive Offload cell * @offload: status of offloading on the MACsec device + * @offload_md_dst: whether MACsec device offload supports sk_buff md_dst */ struct macsec_dev { struct macsec_secy secy; @@ -102,6 +103,7 @@ struct macsec_dev { struct list_head secys; struct gro_cells gro_cells; enum macsec_offload offload; + bool offload_md_dst; }; /** @@ -3525,6 +3527,7 @@ static int macsec_dev_open(struct net_device *dev) } ctx.secy = &macsec->secy; + ctx.offload_md_dst = &macsec->offload_md_dst; err = macsec_offload(ops->mdo_dev_open, &ctx); if (err) goto clear_allmulti; diff --git a/include/net/macsec.h b/include/net/macsec.h index ebf9bc54036a..09ca118d2df6 100644 --- a/include/net/macsec.h +++ b/include/net/macsec.h @@ -255,6 +255,7 @@ struct macsec_context { }; enum macsec_offload offload; + bool *offload_md_dst; struct macsec_secy *secy; struct macsec_rx_sc *rx_sc; struct { From patchwork Thu Nov 16 18:28:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13458172 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="qOSpAH7n" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 625C31A8 for ; Thu, 16 Nov 2023 10:29:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WYzcKKxDIlrBoxDMgNMaPDERoISubDNlCeS3xKibs+s8MwoOMOG0K3JGVA0xVDqU5tzKHmBsA1RDtrwB73PbeSCobi6yz/tnp011fV9dRHL4ygzUlQ5/EmPfxppvDepP9xG69aB83J+DMZ8GHbOxhR+t20WJx3h5mnXgTmubcOOoWe+ZBBTFIFRb2biCUr6NTamnrjpf+lzqz65DljSDKZ3DLOdxdFWE82rcyy+YPhqBtnJI3a+qFQZgr9PNq/QFZOMqtPk7M2S9Eb55lXikQgljTH5OmPBjRvqyvrpiZ6YujV9GxsqCdua3c5UDFi49qzSA/yEnbDqrXu5Jgn8ZSg== 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=g9/8G4NNPOSL2c9MUONsG/xC8dRa5Vd6mhMZqNEvtho=; b=obXUq2d4groTcUeD/Y2dxhxCHEOC126OmnFgTNPEfhc0k0aaHvc4vgB6pBKCYG9MAfugwT4PVjEgZF3Lttgm93mO+a1cl3bfOMBsgzLstcxd5tyFNedD8hdhY3Ogcoau1urnh5h8ZIz2k+pnSinxy074sltvRT74Y81yt9ogT20a7MH2hSZQ4WyOscpUpa8Btxsu4pxbKGUwgBLtai1LtSV49Ad1tyQvOrx8m6WiFAsPA+n3SKjQJnR6+VCnKmx1p3sf+l8KZ2Hhau/0s3url7RtsATWC0vTu/BaAcqiNfoFhREkksTYusp9v+wdNJ8VbnXBFeR93uIuTAER0z6xYA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=g9/8G4NNPOSL2c9MUONsG/xC8dRa5Vd6mhMZqNEvtho=; b=qOSpAH7nre0J9l/GJGYyMuS+5szumcIznK9lBEaVhs4U6Gl7pAyK50KGlsLX6CkbjgbmCuQbcMOFdDwgHjYApq7NlcFW8+sfkxE4VurxA6gA7yh0aWfz17pbAATQWhJQ0HnWkwQgV+xFs4hph+8SHDU2xiVYHkykH0sSK1VLUufH2FY1WpiFi14icMY2S/pffrMHXpmX97QtNtUuh5T0PcZEnHmLos7kE5qKxo+a6ZgYV+jd72EmWC36wqcRaiJK65PyjldUhdytKdFwXWBMZF95WnvhrsEw7f79s0i+Q9a8VC6YSyrd6zqhQj3hBCtzyQ2Q6oRroafAsoR/SxheaQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by CH2PR12MB4088.namprd12.prod.outlook.com (2603:10b6:610:a5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.21; Thu, 16 Nov 2023 18:29:14 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::a24:3ff6:51d6:62dc]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::a24:3ff6:51d6:62dc%4]) with mapi id 15.20.7002.019; Thu, 16 Nov 2023 18:29:14 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org Cc: Leon Romanovsky , Saeed Mahameed , Gal Pressman , Tariq Toukan , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rahul Rameshbabu , Sabrina Dubroca Subject: [PATCH RFC net-next v1 2/3] macsec: Detect if Rx skb is macsec-related for offloading devices that update md_dst Date: Thu, 16 Nov 2023 10:28:59 -0800 Message-Id: <20231116182900.46052-3-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231116182900.46052-1-rrameshbabu@nvidia.com> References: <20231116182900.46052-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: SJ0PR03CA0286.namprd03.prod.outlook.com (2603:10b6:a03:39e::21) To BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR12MB2743:EE_|CH2PR12MB4088:EE_ X-MS-Office365-Filtering-Correlation-Id: 8324e4eb-16fc-4fed-a84e-08dbe6d1ef49 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XBFTxcz6j6cMD7lxhrjWcGYgYsSwtgbkQp0Megg151Lw+V69CtKNVtSEUwm1Jk09tus/W+2p+8z621ZFxBn1CxRdEfKZfKWjxjulfsDtzRX6zrmcCTnCOOf7YgTL4WduDPyAoSr5SRSxX9yD0TR4UV+IMUT01KcPpfCwZ2ORXwIKZG0RzehfVaR1OTWtO6RBaXvBKStVTn0iXzzyC07H0QhdHKewTUYemlErJuE7QWLpS2oJ0JdOFU8LVRN4fwdV2JiekVvo6uuAZClwGr/x6/78wiMpBvfps4ULUCZ6QvWY4zL+oH6T25iiNwue5uEiKyCYsk3Ek+XrPbd/qQ0gsqmOI9cGYXvSeY5w2nvtoM6jwe+gPQuYuVgSR7XF6Zzco18y8YDNCy1YHHqoY5FS6Komt+e6llr5M7ffi5CUtAj4gD8wO/NwYj/LHbNl5P6uwkO2PMCC+bs25GUadBTBAMyumc/Gnidw3UJqObG3WEE7Cmo4vhomBRRp96u/OrKXjztCZYRquwNjTcZ0vOomHpnXEV5OrtSg7e5saWttXoiMbGg1gCP8Io/0MkJ8ohLKWlqGwiHGaZpulJOVRsLIuhP6S1KOed5jvGjZ7NUEfDk= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB2743.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(136003)(366004)(376002)(346002)(39860400002)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(66946007)(41300700001)(66476007)(316002)(6916009)(66556008)(54906003)(8676002)(86362001)(5660300002)(2906002)(15650500001)(4326008)(8936002)(83380400001)(38100700002)(6666004)(966005)(6486002)(478600001)(36756003)(1076003)(2616005)(26005)(6506007)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kZbWcgfNPMUQIgUBugj0Zt0VH/OFCgldW3EySuRTMr+ByjiRIATgfpfeoZz2MFf2kQ8Uww5RaysWqa3+fDYKOBkn5AbqVNUMuCmpdflbUaVZ/BAbRkLwHWDfB9SpbfztzqxkcASejySqXN4STVZf1pfXowGuCmyCnK6G/u6XuZ05y9Qrk9gZ7gcaKa/nFgRLR7s8gjKTn9z6PXOG03iGkk6lhAUTfJoJy1EYwg2mMnfUNFJNwKBTY08Pl+Ld+a0C+E+GFVJgiBLUy/LIedFeEuRsaTdRxMSEtldfwSG0DPO9U421nLVXNrvg5gjasRm+iwQ9leZCxEJVCyaSiZA1b0FYfrc1LF/wVQrOmp6qQqCsJa9ayXIUewlbkpWuTD5YyWcOYGIN8iuRikCz/gDKbU6cgOBe1RNkrvAX+fhWyJLT4ZpB6ntz1tAAn8PvOZifjorPAHq3z+Ub9zFYB96XKvS7zYv8xeTqfXJxTLkvrNs04IFC0Zf6e8j7WpofUvABmwZ+WZ2Wg/s7/T5r5qLK9Xrsyb+egUlMoN+5/HXdxAqnHQVyYAqezo5Y2CubwLsOnOy9+iLQ3EZ8E9REI75m/lrXvxVRVUubqut61FlObgHBB2aGqVsT1gHjC8LWwSBx56IOpLFAy7CC1zdkuzsMLjfHsBTO8pRUyrcIxsdBINLn9Xq9FiKKyq+/x/qUx/q9N7uDUR4gDIN/VLhu0eCigbylingklXwmXBw8vHy4RezWggSgPTqfJ+Qgm3wFh+qfdhwOTDFzdLB50Sawr8xOv+35+CiP4QWXCsg8tmfYYbnF7QwC5c0JAEAtNBnMkewALngqUCY2GookBVSNju9RfZfIxdaIH12pwscS7O0m9QfQVgJql0W/WY6A2yCbUX1tGe0Gixnh4qL57W0WAycHCNQ3+PubNo3twm8QveM2g864E79Ql+3/FgN67nO3lFSM2KeUNDwLX3eWknBXqv/pNyJGJl3lHtrBcwBv8ER1JXvFqISz/CHp3w6ZEAcyBvwWK+09smMXSLxP6YlrMzY2igrDO+6EIamhQ8v+y4UAMi9CT9nGyP3RVKS3X0FEfanK+KgPFfIAKTHQzXCoXxv3d29E8ueTZk1E2A5b/K53TnrTloOO9Z803JzgfiNttjc5w+gHvS6sGz5uOcnkyd/k7uXl+ZIPPe+UQ3AsgRzNAsR2aMPCwYA/opbTVHYqTiEH1zd3OPyDlbNlkGUc7h7EbrIw0lJnSOpARCsQpAqiNnqF3YrUlrE10rm41vTFEbwnAjQ5/6CeG90fSm69srNumlpbdlwb2TZvnQhx/701F4bg+9yKS9scsRlMoHKju2XSPRBUXKEeBq9D0O3PqY7U2Gw9m0BLkg1QKWaAUaKJNANVvW78lzwti0w/1JfbAVWx4PMenGcRYwrugj7bovOLvU0ke+45bz3oIELBvQiDx8E5tUOoAZgZCBJSwSgmg/HrRES+u9Ea3jBSWZKBLd02x4fCOM/+Xf2KU6k+YXgF0sKZ3YfY2cZJOOCNNSAglEgNesAMWbu4H150rTQFCHGfNxZnw5bSD6crJNs80hson6drM89+dDUtZLhEZa1z/yBPLVEX1R9xM/0+WWXlozB2HA== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8324e4eb-16fc-4fed-a84e-08dbe6d1ef49 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2023 18:29:14.1977 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: aw3hklFtcKPkxaRXqwaY/3HCMmv9VltZ/oyOf8S1tS9BiP85eX8LuXu7I+DO8ue9gFnPhFzVvxtcxof3nnS5/w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4088 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC This detection capability will enable drivers that update md_dst to be able to receive and handle both non-MACSec and MACsec traffic received and the same physical port when offload is enabled. This detection is not possible without device drivers that update md_dst. A fallback pattern should be used for supporting such device drivers. This fallback mode causes multicast messages to be cloned to both the non-macsec and macsec ports, independent of whether the multicast message received was encrypted over MACsec or not. Other non-macsec traffic may also fail to be handled correctly for devices in promiscuous mode. Link: https://lore.kernel.org/netdev/ZULRxX9eIbFiVi7v@hog/ Cc: Sabrina Dubroca Signed-off-by: Rahul Rameshbabu --- drivers/net/macsec.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c index 8c0b12490e89..e14f2ad2e253 100644 --- a/drivers/net/macsec.c +++ b/drivers/net/macsec.c @@ -1002,6 +1002,7 @@ static enum rx_handler_result handle_not_macsec(struct sk_buff *skb) rcu_read_lock(); rxd = macsec_data_rcu(skb->dev); md_dst = skb_metadata_dst(skb); + bool is_macsec_md_dst = md_dst && md_dst->type == METADATA_MACSEC; list_for_each_entry_rcu(macsec, &rxd->secys, secys) { struct sk_buff *nskb; @@ -1014,10 +1015,13 @@ static enum rx_handler_result handle_not_macsec(struct sk_buff *skb) if (macsec_is_offloaded(macsec) && netif_running(ndev)) { struct macsec_rx_sc *rx_sc = NULL; - if (md_dst && md_dst->type == METADATA_MACSEC) + if (macsec->offload_md_dst && !is_macsec_md_dst) + continue; + + if (is_macsec_md_dst) rx_sc = find_rx_sc(&macsec->secy, md_dst->u.macsec_info.sci); - if (md_dst && md_dst->type == METADATA_MACSEC && !rx_sc) + if (is_macsec_md_dst && !rx_sc) continue; if (ether_addr_equal_64bits(hdr->h_dest, From patchwork Thu Nov 16 18:29:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13458174 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="a3U2F0a1" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DD14D49 for ; Thu, 16 Nov 2023 10:29:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d99NncSJS4LxbHSyt3yOGXu6gFIZqGbGQVAAstOqjVqO8balsMO4JwBrtoFMweW4rNo1p7jIXFRanyOP8lwkYyEEzK2ECp2kfQWUgFUX5/Ewi9QDpdDB/6o28vKa4acX4UhiXFit9y4XBg6mewJJJz40xiqtQ1QcETmjCT2ZgTLnJbuOpk7A1dLqwf67Gl+DghLbJXWhpdbQI/CB81nydbPOapyD6xzvCjmbQ9XLKlO44RjwG4KTBNp+VnMXsJydKqDi0tUwhH5km8LUc5PrjmHl8lvlAliswX6ZNi8EUkA5PL9u5fQC0hjIKayeJ0/65Xv//awqQuNQ13ycvkaiZw== 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=4mH9P2ikgRgP7yu/6cLxckBR8k6Z7LPcxRV7YAlTbGY=; b=HEjpPEe0T/24LrG0Gl5rdibHeuMhvpipRgZBI957dM3sXjLr2ZUdHJ7mT3mcG82PXS0hNXiblboZZp9++kvgXYBxFjf5mjJrlcCB/IAYmsyuMIcI/X7Ryz3Ti+1ffBpksDglhwF/BxrhViUtWMeNo3D3FMie/XtntI0Xxqswc3tWRvFIH35FyeiVFdEU/cb2qtsciHyLIBclsMQWgI8JguSc0u2ChFziQPS2Z5YF5avfxYicoltSQA83rgg5T7R+Nd9t5x9y4Qy8UhwLDFKzvjsIBmfdt5AGN4sW9noZz/mT99qu/PTehfb6L8abYSkN7W16PrfjCbyg4Asqzm4pJg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4mH9P2ikgRgP7yu/6cLxckBR8k6Z7LPcxRV7YAlTbGY=; b=a3U2F0a1wjgZqg2BMz2bi2gFOBqGcK/ZLl2nKSpuUlR6Vt8D4YpCYsbOuEZHimyA6XsuQBFRxa3YT2B6vXxEnKDkay3W9jv8FVzT9F6moab5xk8HxkpMY1HZrxEy6IQ19efF8Q6rZfqT5bnRX5TN8lZllAcvk0cn2CfogShZau2+fXjlqKm7a3FNx4BC+yMwB3FFkDr7dMHVylTYt0UVQw1SrQO3J/TupU3GV/fbA1bMdKONug1ZllyF5DcFtUYBdwaFfU5zsSg3T7Ti5OzhpfK7AybkbBdbDR/Q8X/TegpdP98WTTNl8u7Din1OvaBb//Fsnx8xvxP7ugFPSQ/FhQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by CH2PR12MB4088.namprd12.prod.outlook.com (2603:10b6:610:a5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.21; Thu, 16 Nov 2023 18:29:15 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::a24:3ff6:51d6:62dc]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::a24:3ff6:51d6:62dc%4]) with mapi id 15.20.7002.019; Thu, 16 Nov 2023 18:29:15 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org Cc: Leon Romanovsky , Saeed Mahameed , Gal Pressman , Tariq Toukan , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rahul Rameshbabu Subject: [PATCH RFC net-next v1 3/3] net/mlx5e: Advertise mlx5 ethernet driver updates sk_buff md_dst for MACsec Date: Thu, 16 Nov 2023 10:29:00 -0800 Message-Id: <20231116182900.46052-4-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231116182900.46052-1-rrameshbabu@nvidia.com> References: <20231116182900.46052-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: SJ0PR13CA0047.namprd13.prod.outlook.com (2603:10b6:a03:2c2::22) To BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR12MB2743:EE_|CH2PR12MB4088:EE_ X-MS-Office365-Filtering-Correlation-Id: ac0c8ddd-9961-4ebd-17d4-08dbe6d1efdb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KoJRZ7LFl1/5whtbKYZEJQVdhCQTkkxYojKgIGCBDp+r8RXnFElCwo6KQLjth3G64xO8+9aa/yF3IR1HtDPenlWmBENbUPIsYAtSg36DiYHjSXok0agI0b8bsvwbmAQZVXELibHG4nr5qklD+QVy4VHI1NlWqMnRKp4YMWfhpTFneb9gzXktXjsFcqa3TBL0C3F/2DNYXCJlPIVnmKUU845PHLrHfLQqzWmC8+CKH6FqfjEQav3xnJSzG1I8ZFbcBtYXhisSiUy54Q5pFzyZHLMU0foagbuixPL797AAeoBHnQnW/lmmyNB6vyS5ZKNF+5DeO/pfi/eIkpqZZqZ5qqzLKF6q8kDYp3sSuesjLHzfjRcjLHG1jOOf9qRVa8gr/FroGieoxqpl2x8GDJCTnX72aS++BqCw2iaEUhKLnMNeXzCdtlYeSWDMsrB1JdVshdWqxaS/I+a3eIJYvwgHwLMTrLo4xX2c/g3SDi82jVJMp40AOQ57DUXxW4OpbvNtKB9PvTQ7BVDePHyvHbHPU/HTOedjHVZVhhtk38Thyp72IvYfxrbGN2CqJiStc4lf X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB2743.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(136003)(366004)(376002)(346002)(39860400002)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(66946007)(41300700001)(66476007)(316002)(6916009)(66556008)(54906003)(8676002)(86362001)(5660300002)(2906002)(15650500001)(4326008)(8936002)(83380400001)(38100700002)(6666004)(6486002)(478600001)(36756003)(1076003)(107886003)(2616005)(26005)(6506007)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vlZ44kuM3scYxcHAFxG4XkO30VBlZB5QZgORYr+2EzyQDF3wa8v/CidlNYS098uiS8Cl0UxXngdo9NQHURIS0apsjAOf79ZwlNNcXNuVfjKubAcM58C1THXv23tMZoSKcFcmlI1N1F7YzLArb5R5V/12Ad6vXntU16yIIhjl+7Fnqr4gDhrbyvqgupcKENlSPjYtIdS0kabXFwBvG2eLGxlMNN7z3Tfm0Jx+hvFabV/WJA3AyXMaVIo+QlLdnn1cAIemNC+ZQgqUKQU+ABVyTpBX9MeoROSPmJIVKbL4ElmtQvLca4CuAU2ECw1DP97w4l0G9TO+vzC2ev0aEUerKQfYZARooyRfGlbeBp+9ewCZQyV10gKkSDLtMZplz+uHzMiQ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5UhT5W9WTFFpVnRxXRMFQ0T5Hif/we71ycBUxMzO9cyV/D8r3ZwzAEDW6OK8WZ3zDit0Eo8TtrRHqtQNOv5/Cx6D15tLI86iapioC6/KnWE/MzpHlNLm/mIINcE1xdTX/OjCYooGWrhW/rw== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: ac0c8ddd-9961-4ebd-17d4-08dbe6d1efdb X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2023 18:29:15.1197 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6a/o69SSibiZOKmn9KUZeSZPPCEZYBVYCWyIwwD7EfwHsnnjnvfsk4vE52lc+h0qi4paJeH6a1B/ZYXw+hfz4w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4088 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC mlx5 Rx flow steering and CQE handling enable the driver to be able to update an skb's md_dst attribute as MACsec when MACsec traffic arrives when a device is configured for offloading. Advertise this to the core stack to take advantage of this capability. Signed-off-by: Rahul Rameshbabu --- drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c index d4ebd8743114..0e5efe0d2c92 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c @@ -475,6 +475,13 @@ static void update_macsec_epn(struct mlx5e_macsec_sa *sa, const struct macsec_ke epn_state->overlap = next_pn_halves->lower < MLX5_MACSEC_EPN_SCOPE_MID ? 0 : 1; } +static int mlx5e_macsec_dev_open(struct macsec_context *ctx) +{ + *ctx->offload_md_dst = true; + + return 0; +} + static int mlx5e_macsec_add_txsa(struct macsec_context *ctx) { struct mlx5e_priv *priv = macsec_netdev_priv(ctx->netdev); @@ -1608,6 +1615,7 @@ static void mlx5e_macsec_aso_cleanup(struct mlx5e_macsec_aso *aso, struct mlx5_c } static const struct macsec_ops macsec_offload_ops = { + .mdo_dev_open = mlx5e_macsec_dev_open, .mdo_add_txsa = mlx5e_macsec_add_txsa, .mdo_upd_txsa = mlx5e_macsec_upd_txsa, .mdo_del_txsa = mlx5e_macsec_del_txsa,