From patchwork Fri Dec 17 18:16:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 12685475 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3EF9C433EF for ; Fri, 17 Dec 2021 18:17:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240182AbhLQSRU (ORCPT ); Fri, 17 Dec 2021 13:17:20 -0500 Received: from mail-mw2nam10lp2109.outbound.protection.outlook.com ([104.47.55.109]:6446 "EHLO NAM10-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229502AbhLQSRT (ORCPT ); Fri, 17 Dec 2021 13:17:19 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G4h8yAaJfDBYhJ/WsPE3UoWpSY9ALeG0+r1GSF0K1r13gomq4vUkrAwLtIHh7fr5BRu2eZPMCFppWszv4V9nIQfEbsz751qQK+1rbGSujj3NjPXVC6yc2HM1Mpg0f3vvT7z/pyhWH77ofdjKLjnSPhw0GSKiHx7JtOF+V4j24PWbzuk5mJZB//BMs6nhKAmzJivgXsbHYWaDJ2R4q3wW8gayElDvujLICJVqWEXW3oT55pxrxBs25kIQ2uiUAZmAJCmLIMmLOLXKWEvHWZjrZ8pQ8gZFmHGW2r+VxKCB/F/61yAF7M8VtAc3qBD/UXss7a3Qggt6RFoLrAGvwN59OA== 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=Hs+dKXZZSvKbfLQWptjH8Rwe19bdXbG1jYOuLoqdAlU=; b=W7qwANJ1FYLZZ0h/39bUsemjHkBmg0KyF88IisGdlK+sXsCtqPPM88RfDhlhJ72cmVpDBUEoiVTE1Sl0zXS1+AutC1RH0K4qqp8/o1P+9tz0g4gyqvjPkECkWCtmti8lD0Hce6Au4oWFzvJMds9udkgqOmoH7+KGt4uhd1vaTeczIfoKzs06VnQzc8nZX3LRMNNXgTf3cgkXo4zhDdhkhmOuIlJxvNcCI8JEpCb7gkJb0D81MUtVkAj8/rRRFpxaPTWQ1sHxfDLzaAMLc62QBFkX7gYy5M4NJq1RSIW4Vag3iPJvKpixhkN6K4hF+QJywce/DNV+0m704b5K8ylJyw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Hs+dKXZZSvKbfLQWptjH8Rwe19bdXbG1jYOuLoqdAlU=; b=k/i0GanZEZ5HEEPV0fjJ/MkK0cVCnxpb38fKoftWuAwAnNDDGIJvdtdESbWLZGq7Q6dFLaeP9FRCxceSv743Wt85C/cP/ERznMq7DdWeEbPE55YbZw75yf/ta7fvPG3HoI/n+JnFvhZP1WeNTaaD9RvBiN1XmF+vnDl0uAtQkY8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) by PH0PR13MB5004.namprd13.prod.outlook.com (2603:10b6:510:7b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.12; Fri, 17 Dec 2021 18:17:16 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::a01a:4940:c69a:e04c]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::a01a:4940:c69a:e04c%9]) with mapi id 15.20.4801.014; Fri, 17 Dec 2021 18:17:16 +0000 From: Simon Horman To: David Miller , Jakub Kicinski Cc: Alexandre Belloni , Andrew Lunn , Claudiu Manoil , Cong Wang , Florian Fainelli , Ido Schimmel , Jamal Hadi Salim , Jiri Pirko , Leon Romanovsky , Michael Chan , Oz Shlomo , Petr Machata , Roi Dayan , Saeed Mahameed , Vivien Didelot , Vlad Buslov , Vladimir Oltean , Baowen Zheng , Louis Peens , UNGLinuxDriver@microchip.com, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, netdev@vger.kernel.org, oss-drivers@corigine.com, Simon Horman Subject: [PATCH v8 net-next 02/13] flow_offload: reject to offload tc actions in offload drivers Date: Fri, 17 Dec 2021 19:16:18 +0100 Message-Id: <20211217181629.28081-3-simon.horman@corigine.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211217181629.28081-1-simon.horman@corigine.com> References: <20211217181629.28081-1-simon.horman@corigine.com> X-ClientProxiedBy: AM0PR06CA0097.eurprd06.prod.outlook.com (2603:10a6:208:fa::38) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 35b7d463-b0fe-4282-6f7f-08d9c189748b X-MS-TrafficTypeDiagnostic: PH0PR13MB5004:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: R706omUMCWnkWpOkZd9EljwXwbN1enVc1AP9wkVojKLS4XXtey5rcCyVkPSy0cV4c1wIMByyPlMigA8T5qNT8p/MBOadAajmSq6v4ZzwSBgoNsvyhmME3pB3sDvwhzn6jVrrgczQp+//UsBRuwVRIk3sp/JW6ca5f93o3eKcrdAdRrsiUcyAXyochmdoKoR5w0Ja/gPKsci8AAzu2arPZ85uea6OySUntrfdiPh39p7VsJgNmeShmjOrhOugPrSFFlNevR9hRic/YQMbj0Y+Cak/t59TZWyuBIT+12+Jzk+u1CxP1AU/A2T/m56SbT1giHRx+XBy3EN85WtCIQNCajksZT6sEH54TNGxP0/YtMcsi9/1GH6HLty4ysmTRVU46yXTYJyIwXOUhYT0L41wOmXbBQ/T/dvjSodhVShdrF9ysgodVtZwsboz8mUmqKnOFRAKNleIg6Y0gcJvtURWDpfkogWjwLSF4NDCW/WHVrHSzYoalsqxKyWOQmbP146bRvD0PgNO0/KUdQWMWTTiO8SZonoBXFFCKHYE1TrxEkBHccSxooBlfZ/dC7PH8CGv6QulyGDcIkHGXBmGjGJTUu697ctXJV/pAqHYTqZOd+aaQfL1uBv7vYpmvShp2khdAyTXdz8GVhakzM/Bk1XIcVI8E/pgDvwBBzHAlQW5J4aAtwfYpTihpvuqCUbtCWTdmfI/qgdj+cdkNTZyv80L2Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR13MB4842.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(136003)(396003)(346002)(39830400003)(376002)(366004)(508600001)(36756003)(6486002)(7416002)(5660300002)(186003)(6506007)(38100700002)(2906002)(44832011)(52116002)(6512007)(66476007)(83380400001)(8676002)(54906003)(110136005)(86362001)(107886003)(66556008)(1076003)(2616005)(4326008)(316002)(66946007)(8936002)(20210929001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QHvc1v8WU43aVf5i3Vh2erUS2RjYwTjM1mXh5aJDfLaplRmGVgoeZALvc0nvdkM3xsbufszxWwUlmOpV4jcNECtEBl4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UVu/FY/bauyA9zLr4ktvFER8QBqigHQDg6dQpWeIQiXUaTpuOdjNKGA36C+1GbnXDvhUefpae/x5ZnpLL2DMNHRoxRCxcEpGthooo1BVnUPM9Hr6QsZJCYNSd4cmP0BoZjF5CVQMfqwM1Lip5uIXU2MISsxjBfMMzcQMh1RU+Ehy5zKE59PeFSM7RlwOYL/YGBuBO+XvZJTSnbmB6mS49rtEXesyNk/OnnOykziJlcoW8v2UwSY6RlAtmOkCDyw+5vuLwy8W4wTiiuVMqHmFIZwgtuUkAGqivjeMC87bJSKHptHW3NsYj5eMy3ZYR4A9tKVAqLx7QP6NEzHts8QMJI9dNsi70U27H7Gq70O2cKOyikV5n6o2IEvYPmECWzRBnH96A9c1Hban3r723E49R3PoyM+PGCXxWTIk0qNE8RdGm5+25S/qOuHIUF7yga+TCAMcT1Au+EyeXvSnefN8XFkh1E0c94/CZnfi6z63p/mVaiR5Pu4mhVIBphdEJ6RVBF92ZEh9tQqwEDBXpn5QH0Fulp47Hrsh6E4vOmdD2m1k/0S8nk9FcsTG6cWgKA0ONVVAxK5Oly6MmyUolxdaPOnKyYVyUoQE= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 35b7d463-b0fe-4282-6f7f-08d9c189748b X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Dec 2021 18:17:16.1652 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: HATiuVADgdf+dXfo+Wdiaai53GFG64VHeGBKT1JA4pXZ5xvAuDydmYt4p9DPnI92Sh8VZyJgb7kqT56HMI0sLB8/obKXDtxan3pdWYEsHXw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR13MB5004 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Baowen Zheng A follow-up patch will allow users to offload tc actions independent of classifier in the software datapath. In preparation for this, teach all drivers that support offload of the flow tables to reject such configuration as currently none of them support it. Signed-off-by: Baowen Zheng Signed-off-by: Simon Horman Acked-by: Jamal Hadi Salim --- drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c | 3 +++ drivers/net/ethernet/netronome/nfp/flower/offload.c | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c index 1471b6130a2b..d8afcf8d6b30 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c @@ -1962,7 +1962,7 @@ static int bnxt_tc_setup_indr_cb(struct net_device *netdev, struct Qdisc *sch, v void *data, void (*cleanup)(struct flow_block_cb *block_cb)) { - if (!bnxt_is_netdev_indr_offload(netdev)) + if (!netdev || !bnxt_is_netdev_indr_offload(netdev)) return -EOPNOTSUPP; switch (type) { diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c index fcb0892c08a9..0991345c4ae5 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c @@ -517,6 +517,9 @@ int mlx5e_rep_indr_setup_cb(struct net_device *netdev, struct Qdisc *sch, void * void *data, void (*cleanup)(struct flow_block_cb *block_cb)) { + if (!netdev) + return -EOPNOTSUPP; + switch (type) { case TC_SETUP_BLOCK: return mlx5e_rep_indr_setup_block(netdev, sch, cb_priv, type_data, diff --git a/drivers/net/ethernet/netronome/nfp/flower/offload.c b/drivers/net/ethernet/netronome/nfp/flower/offload.c index 224089d04d98..f97eff5afd12 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/offload.c +++ b/drivers/net/ethernet/netronome/nfp/flower/offload.c @@ -1867,6 +1867,9 @@ nfp_flower_indr_setup_tc_cb(struct net_device *netdev, struct Qdisc *sch, void * void *data, void (*cleanup)(struct flow_block_cb *block_cb)) { + if (!netdev) + return -EOPNOTSUPP; + if (!nfp_fl_is_netdev_to_offload(netdev)) return -EOPNOTSUPP;