From patchwork Thu Nov 18 13:07:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 12626975 X-Patchwork-Delegate: kuba@kernel.org 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA3F1C433F5 for ; Thu, 18 Nov 2021 13:08:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8E32B61ABA for ; Thu, 18 Nov 2021 13:08:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230088AbhKRNLZ (ORCPT ); Thu, 18 Nov 2021 08:11:25 -0500 Received: from mail-dm6nam12on2116.outbound.protection.outlook.com ([40.107.243.116]:35937 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229926AbhKRNLX (ORCPT ); Thu, 18 Nov 2021 08:11:23 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LrHBN90DRhQMIbmGF6/XeMKcoRYIyyN0ouuFcLtB+9wpH3APEsTnLPv9n8L4aHYhBBZl3lkYfbPLQS5fG0zqOcuuqhktarAvBIwiSkXxpQSDLX4vK8S7EkqymSpS7Fu0uZ7odQkktTwrU4CftYFexfTqR3RM8vrcppakJzCEHJdaoWH6atGVrwye81mllpaXXKCu/LnXoOhehOmX3QJrGqyuu8275lcGj3iGWsXozwEse8Zy/yqWYopuSfMUcDLJ+iyYwAPMtzKoMXsCEuoyFjSQ4AylZfB2piYfbMdCoXPoFKTc1/OeU2hO/alRCapBygr8O1XSOzDZRENZTrtFNA== 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=IKgMD78T+BBXTZoPJgrErs2iq9YAMppak90n+eVV24w=; b=O7lDa3o9e+PLFTILthreRXB2FXnhZ66zK0qIZTzUplgtLBO6OBkPgwPvvASOMECuB+O92LjefbndktwtPVE1nDHfwEBk53PgRuIWD5d/ehA/HrSPe3/H9trUIW6OrBOgY28Ea73PuIdZjVQ7E+0gKiA6TuzC1f8cxlYII0EZRurDYYfMpzRLn2/H9gMBQHE4FvERgaYIOWRWLHS0ZuHDKeBueJaGv46FwANjipBNbXmqjD3RrMyT4RYsiQPcHHKI3LoTyxYuVUSS0gLKVIOIdw2Y8zoFftMQ4xZFV98zRktc53lG8sYq+YigfuW7/WOziGTSvFrIFG3eLI+y6BGImQ== 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=IKgMD78T+BBXTZoPJgrErs2iq9YAMppak90n+eVV24w=; b=nDIFBtr5ghBA6SYV+InesC7lZv1IoyaebNo8LZp3TZeRSslI14R/HvGjWrf4uDni5AIoEYNUhwJtJAC5nzoucSJ2K4WzUG8Z2yEtIJafYqKkA/RW97K8H9GSQsJS01jAqNPESu3XOixw7b8zZMYiNf6lwBdcJEbN+QG9+ONQTfA= 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 PH0PR13MB5422.namprd13.prod.outlook.com (2603:10b6:510:128::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.10; Thu, 18 Nov 2021 13:08:22 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::3152:9426:f3b1:6fd7]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::3152:9426:f3b1:6fd7%7]) with mapi id 15.20.4713.016; Thu, 18 Nov 2021 13:08:22 +0000 From: Simon Horman To: netdev@vger.kernel.org Cc: Cong Wang , Ido Schimmel , Jamal Hadi Salim , Jiri Pirko , Oz Shlomo , Roi Dayan , Vlad Buslov , Baowen Zheng , Louis Peens , oss-drivers@corigine.com Subject: [PATCH v4 02/10] flow_offload: reject to offload tc actions in offload drivers Date: Thu, 18 Nov 2021 14:07:57 +0100 Message-Id: <20211118130805.23897-3-simon.horman@corigine.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211118130805.23897-1-simon.horman@corigine.com> References: <20211118130805.23897-1-simon.horman@corigine.com> X-ClientProxiedBy: AM4PR0202CA0021.eurprd02.prod.outlook.com (2603:10a6:200:89::31) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 Received: from madeliefje.horms.nl (2001:982:7ed1:404:a2a4:c5ff:fe4c:9ce9) by AM4PR0202CA0021.eurprd02.prod.outlook.com (2603:10a6:200:89::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Thu, 18 Nov 2021 13:08:20 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 73b484cd-cb25-4906-63a4-08d9aa947f67 X-MS-TrafficTypeDiagnostic: PH0PR13MB5422: 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: dpddt4zat/oFi5KSsK4Fk/1KgkWC2qwjQxMpzgzIrFCYN/0Q7jfwxO03rsoHNKz3zYNU/4n6cYv4oaPz7T6E8BY6rRAlj8GTXZnl10AXuxHl17bRZE6GiR8LXlcbzIxgswztuMYAm9+FCxHqNhhItzSJmkrJfhYKvA8Cqy2cGyOyt7qH9Xnes/Irc7CLzuoemvENnWpf04ayxcW5tLNabdgqxPN77b9GjleiiREew0bkz5oAXsOPGq6+o+czAW/EckCxjixywLzO3rJzDWQp+NoGenVmCRdT+JFDDBotSfFbLnKI22Tc1NXZXVBxrnP4hky1Ujd+ISRn9J7wjAxhymvkCE1mxrDIRee1fQqwV/8tdjxmMUDrAAZnAAFn6xqFhJvng9ne/FC2L93dAmXgpnG6k2h9vza65yxkQIMtYDU5M5zmhwg3ndNAULK/ZhrbZTpVuxCJS+NhVDsbL+yYKswitIeNfIoPSsjwWnr2c/ZqLBs9REmxqn/ZrcYPSkeH8GY0fPPPE//IDc3JbLgGRUfKmx6uNxwya/ZxM7K4kkWRCZMYhzjFUnOFpXrPSaL8PMtzE2+Iyj8eVpkOUdUJs9wI/EgwGLuK07fBOrmvOdLKWPUu9A9YaRIo7BqlkeuUxmwMe3RihxmlFi4967BXhw== 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:(396003)(366004)(39830400003)(136003)(376002)(346002)(6486002)(2906002)(54906003)(6666004)(316002)(86362001)(52116002)(6506007)(1076003)(38100700002)(186003)(6916009)(107886003)(2616005)(44832011)(5660300002)(4326008)(8676002)(508600001)(66946007)(8936002)(36756003)(83380400001)(6512007)(66556008)(66476007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ijqAqwPR+N1l4HDKXDEZgGdecBn8yW5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Fj88C9iZztD6IpeLB49pIYnLoxdiDq/JRnmpxU2SckqOT6ONqPrh+4Sjxg/ulL0C2FiWwZhDf6NlSWwOeHk3CIqi9cgAUEFjcZr55ddBEmfLnK5Ldz7biCWxnaXkHckiTGOIL8exrCHNrcwZsITCC9qGwhuPyGgAokO+9I7MwWpHIZD4SnSmwCsrC+iYN8xvPWioGtsFgI+iXTw9tMzv4eSIkveqqWwGUqSlTbrzib8gMS+OHs/Z9VZUb8SUnhmksxM5WKf+0mBwa/1m6yo+6v6keWzeKylx3J0bxArs3C7oW4ZF7oZZ1mkyBg8t+EBEDtCVT4LlLnIaTypPNCZyiOfZEBnJLwImnQejMST/c4kFM2oKGBKF5/WaE5mVz3jBraCf3TXJP6ASJufqNVosOu0jV/ojoncuxngPwrL3KuWw97vEsBvQZ10MW+qgXzd9r9ImLuQecq2tkkxokCH3X4CsUmm2zKmTqgpJUj7RBwu78MWBEvBFVsNHzQRPkfJQku1QMRgzffYzH0UXn9m0y8yVdWLs9Oynzlvbg2WmFDXfwMDXvGTPD8xsNXkNHXPMQfdrlRL7PNEpTfXpzfAqVBkp5S2ZAt4FTxL+2Cspa1qtmQwREoKQK9We4djNbyuz9XJkmCMfNc/R1Pr9ntPG5JE1MtuUpqZbE= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 73b484cd-cb25-4906-63a4-08d9aa947f67 X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 13:08:22.1468 (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: h7sYyinFqjNFzAgAphzYjTHdMV9v3BjGf0FUmYrCmIJUWcJooRcVUDOcpGczENdmYp9/FGgd/eymVnfgGjWw0e5PevkTe49I5a4zT/btsrU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR13MB5422 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@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 --- 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 e6a4a768b10b..8c9bab932478 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;