From patchwork Tue Aug 23 09:01:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 12951936 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57D26C32772 for ; Tue, 23 Aug 2022 10:19:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354019AbiHWKTj (ORCPT ); Tue, 23 Aug 2022 06:19:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353077AbiHWKRh (ORCPT ); Tue, 23 Aug 2022 06:17:37 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2101.outbound.protection.outlook.com [40.107.244.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F3368053E for ; Tue, 23 Aug 2022 02:01:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KI+x/hQkvT7avadhF+2MW+TiUb4FTyF9F3VKg/4oQzvsB1dBvf272Zxo/1rJy/71EMaGWBkVsm34/o9HWw5vfW3obt5KfnMKTLsO/GQ4Xr+mQl5S91qeJTHGP/1u8VwwUlU8bmf4pTYhDmgE1DbqSmlq4aeTYD5402AHFWpxnido8VPOWSKs90VONopvAjGwvBYXMqlNvPkXIWgfzT/LFh8KyBW24il7UQNZQQIpWl3X9u3HQ/54QJ5nMgU9kZvr2K6FigWacxCm19Iqyz+qvq0NE+ljUI/Y/NXlDKQAvYkf3NSRCIjlDkKNFr72BZZI/A7jF/oWJk8jR/6Q8frsiA== 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=aU9+YOSNeKiT/kQBuU4012InrinoPF6NgSI0uf8XvR8=; b=BUKjmki/PBtglj1xAvdVfWkoNJFQjku4FbTzyr01m1CIcVMxkxLx6XTW67i6wPkcS1NADUVJdqNAi265yoB0gBOj2/Swfk6KdJW3lUD1caIQJC+Axv4pFL3Pt617kEshXoyCSgQxwZpXdEWQEcOuYwsluSykGCy5NwtdxUfv00aN08gil2awBi1Rzs2t1EIhIxYOU1pb6EOM+Fs6Mjg/0FN047v8DvGvbUT2/JDD3djJon7KCdoluE2+xWUt4TkgZRIipjjz4mQGS/5UMDitnEQYUBPPV+TAewK7jlg8aPkgBfAovWSGOjsMMspScPiXHzcPX9dwLG/+x8mzCdDsxg== 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=aU9+YOSNeKiT/kQBuU4012InrinoPF6NgSI0uf8XvR8=; b=nVPoYERzBBVou77htW8LcCVsk7vHYnQuZdQrvqco5BYQ0ghWGqrrEKxwQuL6amirjp1QbKEBEqThLlTlZP6iH7V0DSBpQ6vNqXhiYOamljVwzUJi83A4RHoeEDKTtlRrChIXeuds1c1ooEH9iG+Jf3DaPZzuWrKtG517ot0KuBI= 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 CH2PR13MB3320.namprd13.prod.outlook.com (2603:10b6:610:23::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.14; Tue, 23 Aug 2022 09:01:37 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::a1e6:3e37:b3f3:7576]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::a1e6:3e37:b3f3:7576%8]) with mapi id 15.20.5566.014; Tue, 23 Aug 2022 09:01:37 +0000 From: Simon Horman To: David Miller , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, oss-drivers@corigine.com, Wenjuan Geng Subject: [PATCH net-next] nfp: flower: support case of match on ct_state(0/0x3f) Date: Tue, 23 Aug 2022 11:01:22 +0200 Message-Id: <20220823090122.403631-1-simon.horman@corigine.com> X-Mailer: git-send-email 2.30.2 X-ClientProxiedBy: AS4P190CA0036.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:5d1::7) 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: 986216fd-1e5d-4a48-7b94-08da84e61634 X-MS-TrafficTypeDiagnostic: CH2PR13MB3320:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FpQyS6AfWJgMLaInMt6A8K3pSGWYYlHcmZzc9EYSaCiFU5wDcR7SLXbCk4gxoJqvTbXO412t2/MsbHW+MH2O+rWyyyMCU0s4JLdssRQEGgHAMqpZ+ZcPmk03vQxecS90oGmxr9GfSdM2xC0QLg8c57HHWOPlTIivfv4tOKC1rG/jWDksPUvyZiki6lB/Yw3ZgGU6z8Rx00ew5iX07YImj2XEZWvoDOlxTJcNSju2j/nMLRp93GZXQan/8vY0FpVE6zDhXKv1KiFoW4N2QINZb2GZvQjL08+NeMh7XmYXXcbDbOJBhFy0UaLAIx7V/nRxIXpSjaoQSKQy9NKp1HPt51JvL+LrczpZoFBFkxN/LfllU/CYMFf0k/OsJjjpFDQ2ra9Upl1ymI8ewHf0msyyv7ybfaDbyd8jRW46Jrz+mt4j4oglwbeLlIy1eyKvNksJhn1t6q62VJvMPNt6/R1NYV7dpthK21/niWvHdBxn0JYh174IYfRdxj4XrI41ZD41ibqtGXnkPPn3n8yCLqzyYEAY8r5FJ5LwYIWnObi8LSQqNQWr8yxX3x1bI78KncscbVoHJA45a5aQlrEan0znztKbZbBRSN9WAy4aEsnGU1yeSVr51YstLnKJWP/PrAll8+pHGXRPu6Sie4imAz4KXDEVgSfqnDkF8uW5j7GTSqx0Zl5xYO0RR3VK8DILj5pwPVvHHTVBi7Br7G1fv9pBnA== 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:(13230016)(4636009)(346002)(366004)(136003)(39830400003)(396003)(376002)(83380400001)(86362001)(38100700002)(66946007)(4326008)(6486002)(66556008)(66476007)(478600001)(8676002)(8936002)(5660300002)(316002)(110136005)(186003)(107886003)(1076003)(52116002)(6506007)(6666004)(6512007)(44832011)(41300700001)(2616005)(2906002)(36756003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: b4wSWMCy/IfQZfvJFHJ06jfGx4SR2DRogyFPizzeW4z29d5udQseAbTab+YECJsP1ly2Y+tbcfTwYMV49Ljfzp63DJ8l+XJb+k1R6W7ZNVhKyyq+cXmK1XfeuD5m3d+kHR/0OeazjesI3ogUo/+ZWOHk8wTNKgzkQnOCxRUOMFrMRi5v22x40Ptm4iq57JfM8qCOn5gZb/v90tZFZSid/H/d3VvhIQcsH3V+JQQFO9P4vTvfGLpfIK6cBkQ3YJ6RD6F0ZxhuCFalJOXbsK1wnfzB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wywKWB8dMZg4uxrNPQDY0WMMFqzmU+xeBswKn9whvddFd6+ru4zLnpQvX3iKt5TOO/KNiTd8neYgsFub/fgFSdxw42Wm8w21wFzDSMD8jgsPy3sVR88e0RItptoTG3zxoxy2dMeuMQwncMWRkkvQnCZjcfvzyymN+ac09Qrpm5CyB4AmWB/9piQBeEWHHwWQ2SzYlJy3FG1h7zza+uqtXNGj8L7j+5XD/+H+gvsHPjWPUk+0XgVOZUVomzuPWiZYcwH5L0uka5/7GXxZSQSjwk33/vxTHg7GAbSKg== X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 986216fd-1e5d-4a48-7b94-08da84e61634 X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2022 09:01:37.7614 (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: FxHZgCA1SaVd0EYczRNapvcKjrTzftFWrP9Ii2bOfWRKuXfbTc3k6TdzTZDXpGzoR+P+S6hRF1aHpimEEOhbHlq+wciDA2qQXbYM8OCxXl0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR13MB3320 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Wenjuan Geng is_post_ct_flow() function will process only ct_state ESTABLISHED, then offload_pre_check() function will check FLOW_DISSECTOR_KEY_CT flag. When config tc filter match ct_state(0/0x3f), dissector->used_keys with FLOW_DISSECTOR_KEY_CT bit, function offload_pre_check() will return false, so not offload. This is a special case that can be handled safely. Therefore, modify to let initial packet which won't go through conntrack can be offloaded, as long as the cared ct fields are all zero. Signed-off-by: Wenjuan Geng Reviewed-by: Louis Peens Signed-off-by: Simon Horman --- drivers/net/ethernet/netronome/nfp/flower/offload.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/flower/offload.c b/drivers/net/ethernet/netronome/nfp/flower/offload.c index 83c97154c0c7..3ab3e4536b99 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/offload.c +++ b/drivers/net/ethernet/netronome/nfp/flower/offload.c @@ -1301,9 +1301,14 @@ static bool offload_pre_check(struct flow_cls_offload *flow) { struct flow_rule *rule = flow_cls_offload_flow_rule(flow); struct flow_dissector *dissector = rule->match.dissector; + struct flow_match_ct ct; - if (dissector->used_keys & BIT(FLOW_DISSECTOR_KEY_CT)) - return false; + if (dissector->used_keys & BIT(FLOW_DISSECTOR_KEY_CT)) { + flow_rule_match_ct(rule, &ct); + /* Allow special case where CT match is all 0 */ + if (memchr_inv(ct.key, 0, sizeof(*ct.key))) + return false; + } if (flow->common.chain_index) return false;