From patchwork Wed Jan 24 15:19:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Peens X-Patchwork-Id: 13529320 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2127.outbound.protection.outlook.com [40.107.100.127]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 133A877656; Wed, 24 Jan 2024 15:19:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.127 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706109575; cv=fail; b=r3GgpLoUluTqKWX7ZDVmRupEtffLLMu8Iughht3ORooIku7g/9+Brv3gvNG2tkZwhXoFGKtzl8k4fhXvRC1NIuvJPvHJ8dnQA5QuuU6maIqpwmXjpAJtTbDxxqWoaWtQIawp72wj1cPA93z2sSAOVRHohsiOWV0z6F+G5o8eBXI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706109575; c=relaxed/simple; bh=fcU4lQ2gYYSVqnOSX9jyZwcA2BpUR5OdM1iGHTaWkWs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=hBd9oif+Za653VlT0iunt9tDtQ0uMmAHmb+KCjkM1LeB76TMSL1vRnxQNQXSaCMpNVvR3OZvY9cQN6PXw3P4qs4Nkr2PMpWSyQK/+iIEcxjNNXthrR6owASh/FrjGcJdsyVEvpHNJaLU3n5y5yZrrJZA62y244gFEFunx1bkWRo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=corigine.com; spf=pass smtp.mailfrom=corigine.com; dkim=pass (1024-bit key) header.d=corigine.onmicrosoft.com header.i=@corigine.onmicrosoft.com header.b=PHAUUD0Y; arc=fail smtp.client-ip=40.107.100.127 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=corigine.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=corigine.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=corigine.onmicrosoft.com header.i=@corigine.onmicrosoft.com header.b="PHAUUD0Y" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JPbb6gYdZ481kZdGlI4pHVMxLACM+aaYnVdpz3gBSwU1Z2OWGZKUk8YLHSli0RyRjukHx0ZA5NpuqiWxgxjzLFRV9phXEBBJ3pn2gkjKTvt2pIVtZOKsTZNLRVi5PyEGxgV7GB48u0VkisDU2EQ9Z5FFbR++LAEDVU9ilOm1iJngQJUi3cxrZu/QSyxGflIo51GqycMem0cdf0kyIJOPPDepakQUAgV3gvVLl32cyi32uLgLPztE+QN57iadaj7ClYRjxGIh2etsEp5xhd4V04b6825dvcfoSPutxCOvZwTAecu0qAwZ+Q9eKAsUGXc4bfWcdz6C6vsrCnKnfdKILw== 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=EEpBvXnyauIOGnyEmZYRwrA3SaIYkh6TAxeS2PiiHIA=; b=M9/P3zhm6kuB/1tNjIizZCqLnJDF2V1yfWRT/n71rwJpSPApGlEClEOWNzBml2YaqyeCzfHRBU6p9OcD/C73aGCFuIa/7L9FdCR3QDjHTtcOugFEBMEPgXfCAjR4aOG+RCEPyOPPXvVjyk/tc4xpONbioWSjc8dsRdY4mdhTA+W9FKgrLXQei+uqcgVX1XKH0FiyE7p6l0sfjr4SxeGwLM5YR2BaohqGB81gp5m8c1mNqoLe8VTTKHkt0gvm4p81xAAMiUpFYb3DHO4k7KjSDyqmoAkshaoQOxqxA5Otalft1B/De5/ilkozPsG8zEO7LAzi/EhjX4ZTrcw3UVF2Gw== 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=EEpBvXnyauIOGnyEmZYRwrA3SaIYkh6TAxeS2PiiHIA=; b=PHAUUD0YPR3j24yhT8UBtePtvzmVccesRMcCQ9YOpa0xVaAxHtPa2iv+Mc0UPHGd6X9n7kWDzhPHS2BFhPMlClucX7Ju464STE7qNWrC8RQNWbzC0j2wWDzPAm6Zv73dTV7+Og0TXwMW/rtVeUBzqA8UP86/GK4+7P+y/jI9SMI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from BL0PR13MB4403.namprd13.prod.outlook.com (2603:10b6:208:1c4::8) by DM6PR13MB4132.namprd13.prod.outlook.com (2603:10b6:5:2ad::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.22; Wed, 24 Jan 2024 15:19:31 +0000 Received: from BL0PR13MB4403.namprd13.prod.outlook.com ([fe80::8d5e:10cf:1f9e:c3aa]) by BL0PR13MB4403.namprd13.prod.outlook.com ([fe80::8d5e:10cf:1f9e:c3aa%7]) with mapi id 15.20.7228.022; Wed, 24 Jan 2024 15:19:31 +0000 From: Louis Peens To: David Miller , Jakub Kicinski , Paolo Abeni Cc: Hui Zhou , netdev@vger.kernel.org, stable@vger.kernel.org, oss-drivers@corigine.com Subject: [PATCH net v2 1/2] nfp: flower: add hardware offload check for post ct entry Date: Wed, 24 Jan 2024 17:19:08 +0200 Message-Id: <20240124151909.31603-2-louis.peens@corigine.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240124151909.31603-1-louis.peens@corigine.com> References: <20240124151909.31603-1-louis.peens@corigine.com> X-ClientProxiedBy: JN3P275CA0006.ZAFP275.PROD.OUTLOOK.COM (2603:1086:0:70::16) To BL0PR13MB4403.namprd13.prod.outlook.com (2603:10b6:208:1c4::8) 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: BL0PR13MB4403:EE_|DM6PR13MB4132:EE_ X-MS-Office365-Filtering-Correlation-Id: 8d16391d-6bc5-4bdf-b07a-08dc1cefdd3a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +e89A0PmvNHS5BLtNQF1TIGo28rkDam/BHVCLyiv7yOuDUYXqqtwVpS5P8YMf8xSyaIsFOh+DbRN7WOeWAjnHeL4lqO+Uvn7O8eFTYPjUi1fiJJfCjqPQS6LklLzVCWoRi3w59TdxC0Ahot2iUxrnQBtaFQ99TJPQh71UzXbIfoSPE8QI2e6rjjNZztzfhI/NAn7U0JK0LLNN75izvPYchgfxvJzrf6FIW853BTVFfYJNMhc8ft7DQz6DjZWXg7xd+PC2UPRtz6LjUodmrstgWBXjvgjkNlEqysCnaBRv7qBz6cSgzPCg8EcFjo6orZ7IpFGACbr0lid0G1iBP5AbIufNhJF6Yc/9dtKU+1gW4wWCdBRE0gbyWRwBdZ+PdsmVGrpuGmoAKEX7jZHQNqE4YMa9Lef3tNRdri+e5ierip4VrKNAnfccZ8T5uf4a5fseflixdR/LIIkEyyLU1oYImecd1d7xw7Mjvyka5Rj3K/PWlLapzT43WLkAD+jtQTPiB3YiD59buderMq/EyMV8v9638vCUOPiQsoN0XDCVZKeSX47jUWOcvn8CcxhxqKtkwktzNP7WJOLA7IIdsAYyu1w1VJDKpYCLdgz2zYZxRrJiuWJQ2NjmIPAwOD3wg0j X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR13MB4403.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(346002)(136003)(396003)(39840400004)(376002)(230922051799003)(64100799003)(1800799012)(186009)(451199024)(66946007)(4326008)(8936002)(8676002)(6486002)(44832011)(5660300002)(86362001)(66476007)(316002)(2906002)(110136005)(66556008)(36756003)(6666004)(38100700002)(38350700005)(52116002)(55236004)(83380400001)(6506007)(478600001)(6512007)(26005)(2616005)(1076003)(41300700001)(107886003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ItpdMYg5WEt8zgfHmpQA1qzMM2t3JMBEDv+0TxrJrqYdEbWrX9mf6ybBHE5IKAmK0zdhptevNQbOQaYINTxfhVN6a6vNvzOl46sdDmbXuvngwvkVfUWG8rBWy5df8tjtydvzzcl/8hjXoOe6VT9JPOLPwResgUlYFz0j7x+j9LOFYl/LOwO6UWhxDKoLM6JI1G8ybwHdmnh6QHj/CXFfr8vIoLd4Z5+wodxjG5en5GYQNcDhLD0agxeYdU6LwIrjI/jK8vEFW9Ltb4qCCCaXa/n/aaXNuiOmxHWxi7OeOlBWdS12Ctw48ptMCCfBPCfMRJT797m8tp+M/OzBRvKOYNYKprc/Agpr+i/u7d7UNlLnbDs/5AJ7BsJhr00+aBytfy6Upz1avrImIltuJEqWjSuiEyl6iz9z8N8wLOwlOv8Zyw5Hw6dDhHue+GLQO/xIbMY+zK3FJhYeryviEogLIp/sLafKGGYogu2o8NuKL9ZrGMvcvBgBOI1Fvl4LUlO8AxLNuiDY2p7JcIaxTe/5/rFfPNqCufTQOQYPTQ4UGXs0DInunzEQ7pcFFgjZpp+wckXtTnCdyZpHkZEVCCfNJOXRRZINp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f-b07a-08dc1cefdd3a X-MS-Exchange-CrossTenant-AuthSource: BL0PR13MB4403.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jan 2024 15:19:31.5502 (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: 7cWFdKDXoPjVNOXqKh/bZzhmyn1cvVyY9NBse3BeamubwD0iJ/6NABQd/VRi2suCfBNciTk7qBQaEy0+iunQz3L63vQ7cM6NZjEwXxf1ZFg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR13MB4132 X-Patchwork-Delegate: kuba@kernel.org From: Hui Zhou The nfp offload flow pay will not allocate a mask id when the out port is openvswitch internal port. This is because these flows are used to configure the pre_tun table and are never actually send to the firmware as an add-flow message. When a tc rule which action contains ct and the post ct entry's out port is openvswitch internal port, the merge offload flow pay with the wrong mask id of 0 will be send to the firmware. Actually, the nfp can not support hardware offload for this situation, so return EOPNOTSUPP. Fixes: bd0fe7f96a3c ("nfp: flower-ct: add zone table entry when handling pre/post_ct flows") CC: stable@vger.kernel.org # 5.14+ Signed-off-by: Hui Zhou Signed-off-by: Louis Peens --- .../ethernet/netronome/nfp/flower/conntrack.c | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/netronome/nfp/flower/conntrack.c b/drivers/net/ethernet/netronome/nfp/flower/conntrack.c index 2967bab72505..726d8cdf0b9c 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/conntrack.c +++ b/drivers/net/ethernet/netronome/nfp/flower/conntrack.c @@ -1864,10 +1864,30 @@ int nfp_fl_ct_handle_post_ct(struct nfp_flower_priv *priv, { struct flow_rule *rule = flow_cls_offload_flow_rule(flow); struct nfp_fl_ct_flow_entry *ct_entry; + struct flow_action_entry *ct_goto; struct nfp_fl_ct_zone_entry *zt; + struct flow_action_entry *act; bool wildcarded = false; struct flow_match_ct ct; - struct flow_action_entry *ct_goto; + int i; + + flow_action_for_each(i, act, &rule->action) { + switch (act->id) { + case FLOW_ACTION_REDIRECT: + case FLOW_ACTION_REDIRECT_INGRESS: + case FLOW_ACTION_MIRRED: + case FLOW_ACTION_MIRRED_INGRESS: + if (act->dev->rtnl_link_ops && + !strcmp(act->dev->rtnl_link_ops->kind, "openvswitch")) { + NL_SET_ERR_MSG_MOD(extack, + "unsupported offload: out port is openvswitch internal port"); + return -EOPNOTSUPP; + } + break; + default: + break; + } + } flow_rule_match_ct(rule, &ct); if (!ct.mask->ct_zone) { From patchwork Wed Jan 24 15:19:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Peens X-Patchwork-Id: 13529321 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2127.outbound.protection.outlook.com [40.107.100.127]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1857B7A72F; Wed, 24 Jan 2024 15:19:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.127 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706109577; cv=fail; b=f5AyteDpqV17Yv14iKTcNIJfjaRcjiiq9wgF81m88Nir+/hZ/ZQ6KZvFVK7nri/PeVxC5aGTsBXvV96KGALlxsMmVDVCFVDtLLkHFoJHRASsz01k+hUGMMZudMRPCTUtglW6tV9hpq7mtUX9YF2+CTLgtUNfA9etaGk00S0DqAI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706109577; c=relaxed/simple; bh=Io1rQLMKPM0qz0lJ9tyIFKnOBSH1B/UdOAroifxCwE8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=UCWtcmYvPw2K01Jjpt3DmGyoqHYcjSrrcew7yb8KUI8kPHRoQqbki4/wcby2M9xZ1QzfbvPUQDy1fEujc7itzY2xa5gmVPQXl7XlB8vv9OEb+as5t+girPDbQgJ9fOb6joZNEDDbt/2HWzzTbT6ZE79MjFbO6SSAf+cEsJXV4Go= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=corigine.com; spf=pass smtp.mailfrom=corigine.com; dkim=pass (1024-bit key) header.d=corigine.onmicrosoft.com header.i=@corigine.onmicrosoft.com header.b=MqBn7XgU; arc=fail smtp.client-ip=40.107.100.127 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=corigine.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=corigine.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=corigine.onmicrosoft.com header.i=@corigine.onmicrosoft.com header.b="MqBn7XgU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b7A/leO8QY3X7G2I+Xz7e0JYMIthUTNbccWO+roJ5V8E4H7GW1beY2CfPiBhG5WFYeTB5IenkCtZ6hei4HzGzsAIhF2c1WEbhriijFANnsX8SCUVYnuzrhHlHoVjQbCuEX3K/shhH3FF6BsN7XusVxa0LTSHk6639sexz1ohJSL/40jNGsQEOLNu5pYF84Bgn6ynomnOG/aZ9oivo/M+7SJVi1a2nj7Zjs9XcoEud1Csd5WdiUh4plO2Aiu+wXZ1Eqhw/HDUSVYSIyrQVbNqpC5uv9ivL5ynDVq5ukbycYiYGlnFKVxrY3IqEqv6P5L3GKNPzfEziQvvOEmrC6Kzcw== 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=3iT2c+p51U9vMAFkNBlBHqu6TJ8OkRp3TONAioJMr54=; b=g3uP2Km8F02C8auUTriDccQK3XbMY9O1hW6smVq9XtidO538wD46Shh/SKNsJdx6qlu6A/Yf7fqQpPbf356H0q6OysLUW0rarrem8NNYI6hhjPhi/6J2WHMuASrvn9nIE43e54ucLfejQeT6fLojUwGLdkpsi64vJV4NtuM1H4LW1t3YhOd2zMxrzP8Nly/hLHEmseLnIDh2zssTD5s/BVIy3rZxs5zouFLUTR2T/tuNNBPLspo+RV6liPBjSwP2+b1dOUa4FxeaE5crpz61+1UjijxjvHgRW7yP5pYqgT/sNtRR7LjKmibfPpbR4C5LD8xAaRsEPcaJFw0x0Gad6g== 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=3iT2c+p51U9vMAFkNBlBHqu6TJ8OkRp3TONAioJMr54=; b=MqBn7XgUOmlzCtjoeRUTl1g1Vrv47pEkArhrLtfliLFEgSU+BO3mzISaf++4oalVEQhHBAfdYUlZcGEvyct1aTWihoZo+8Mz10otZLURE6HS5WUb38ur1gPzVswUer8TqibHkpHQDWGAmmQVVSZSuTBsF7YlDwRsByCe8fod1jA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from BL0PR13MB4403.namprd13.prod.outlook.com (2603:10b6:208:1c4::8) by DM6PR13MB4132.namprd13.prod.outlook.com (2603:10b6:5:2ad::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.22; Wed, 24 Jan 2024 15:19:34 +0000 Received: from BL0PR13MB4403.namprd13.prod.outlook.com ([fe80::8d5e:10cf:1f9e:c3aa]) by BL0PR13MB4403.namprd13.prod.outlook.com ([fe80::8d5e:10cf:1f9e:c3aa%7]) with mapi id 15.20.7228.022; Wed, 24 Jan 2024 15:19:34 +0000 From: Louis Peens To: David Miller , Jakub Kicinski , Paolo Abeni Cc: Hui Zhou , netdev@vger.kernel.org, stable@vger.kernel.org, oss-drivers@corigine.com Subject: [PATCH net v2 2/2] nfp: flower: fix hardware offload for the transfer layer port Date: Wed, 24 Jan 2024 17:19:09 +0200 Message-Id: <20240124151909.31603-3-louis.peens@corigine.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240124151909.31603-1-louis.peens@corigine.com> References: <20240124151909.31603-1-louis.peens@corigine.com> X-ClientProxiedBy: JN3P275CA0006.ZAFP275.PROD.OUTLOOK.COM (2603:1086:0:70::16) To BL0PR13MB4403.namprd13.prod.outlook.com (2603:10b6:208:1c4::8) 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: BL0PR13MB4403:EE_|DM6PR13MB4132:EE_ X-MS-Office365-Filtering-Correlation-Id: ce29f297-79d5-4ff3-dca6-08dc1cefdf1e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xATZ/Ep66TR1zeLZNypJ/JEnFWeaVJzfhDD4Xwi71rW0PAJTqp1nXL94p4DJIg4PHncjSAWOcoEq8UpgU1iDw/w/qnNduuzq1ErI/OeShrvSshxxmX/JpXRIBo6z+iFgX3ef96jqwmUH+NYGq5ym6r+w4YASBs9fgWElSBv5f2AOMa5G/KmUjFWgTRlsV3nic85jHLv5cU84BI+vOvOw+MfR1AWhg8/keDDK/j7XJH+45gY5Xwr/NFExo1kmSwZiuhoCkmu1womcP/aMFUQhL2TXAra150NoFL/9dIPh3PYA2eTal1to0sW3hIk88RAUNFJ8G0KB4jNg3SZPVT8zQ467KFruu8cA41UMJMG2y3MbOPjNvegyNzxt7lLW4EVo7OcXmH6QusfE6MoXsqRfltGrQzJqBSROdc6J4T7P2pr0gu1EMAd/0Ar/waRJQyD/zdfxFnomGGhitD2Hfx4e82gisSp+AL1PLLdCu+J6LdJTqrEdsIZppBCzCR7t0KtDb2EQ6FvG7lBXQauJZ4c60OzT7fPxhcgj5bkNUf6IGox9AYfEIAUqwROgBAsSC+SXMdhV7YuoZpAMn3Z4PR+8cqqaNC7GRmmGogZLyK7nXDC9GWZ8yDvXbwsq3c+juKQh X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR13MB4403.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(346002)(136003)(396003)(39840400004)(376002)(230922051799003)(64100799003)(1800799012)(186009)(451199024)(66946007)(4326008)(8936002)(8676002)(6486002)(44832011)(5660300002)(86362001)(66476007)(316002)(2906002)(110136005)(66556008)(36756003)(6666004)(38100700002)(38350700005)(52116002)(55236004)(83380400001)(6506007)(478600001)(6512007)(26005)(2616005)(1076003)(41300700001)(107886003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hwCF+kDCX7J8I06rElXBp4MsGohA787T1Mh2SlXGVC6PvPmiC3QYjxUsin0h9G+9Qj8p9GbyUra/SihjspqUTTwE7ozXnE0WriairmHmczipBnUflDPRnCeVhRSXxFwklh7+UgIMTKAuuv+xcmgEMsegDwpQUd8wGVcjMOC+39N8f7L1bLIwaHVameglBTPeaqMn7ahMYOffLo5Gw0gHZLnjMnqLR32o8Or24RjiMS83Xi2FRncdAZ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bYwwBEnhGjcXue76YWxASgibl9NSc7I46y1FyuxzeK6/U8+Qk4k75i3ZoCMPPuZo3E+EuBysNVtOJ3iAqUYvrypimrXSuWjqfJn6R6DS7eWKJLubER0JzxrxB72CPeC1ih1uRU2NAhLLhIC/r1pPbjIGyXy0DwpzjhPhFfpMp7PxcJKqtLqhNg/j6chHo2Leq7xOZ0kgmFMlPEidld0cWyc+AnzeuKmhwGD0rHdWZawph0cmeFPA+ZcleSCobyO9t62XQd6nlxD+5Fdc8ztCplqmrPB2MbFssvHasuTE4xRuWEyHg== X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce29f297-79d5-4ff3-dca6-08dc1cefdf1e X-MS-Exchange-CrossTenant-AuthSource: BL0PR13MB4403.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jan 2024 15:19:34.7412 (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: 3Xe6EFkSQQtZlY2yt1gSdN15oyVnCrXqBnomzUFoibCD+3HlgK9400ZAQ5Ni+/cglnRlXEFZsnJuFGeF6gUc6+3Oqc81I+WjC/X3r4RQgNU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR13MB4132 X-Patchwork-Delegate: kuba@kernel.org From: Hui Zhou The nfp driver will merge the tp source port and tp destination port into one dword which the offset must be zero to do hardware offload. However, the mangle action for the tp source port and tp destination port is separated for tc ct action. Modify the mangle action for the FLOW_ACT_MANGLE_HDR_TYPE_TCP and FLOW_ACT_MANGLE_HDR_TYPE_UDP to satisfy the nfp driver offload check for the tp port. The mangle action provides a 4B value for source, and a 4B value for the destination, but only 2B of each contains the useful information. For offload the 2B of each is combined into a single 4B word. Since the incoming mask for the source is '0xFFFF' the shift-left will throw away the 0xFFFF part. When this gets combined together in the offload it will clear the destination field. Fix this by setting the lower bits back to 0xFFFF, effectively doing a rotate-left operation on the mask. Fixes: 5cee92c6f57a ("nfp: flower: support hw offload for ct nat action") CC: stable@vger.kernel.org # 6.1+ Signed-off-by: Hui Zhou Signed-off-by: Louis Peens --- .../ethernet/netronome/nfp/flower/conntrack.c | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/flower/conntrack.c b/drivers/net/ethernet/netronome/nfp/flower/conntrack.c index 726d8cdf0b9c..15180538b80a 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/conntrack.c +++ b/drivers/net/ethernet/netronome/nfp/flower/conntrack.c @@ -1424,10 +1424,30 @@ static void nfp_nft_ct_translate_mangle_action(struct flow_action_entry *mangle_ mangle_action->mangle.mask = (__force u32)cpu_to_be32(mangle_action->mangle.mask); return; + /* Both struct tcphdr and struct udphdr start with + * __be16 source; + * __be16 dest; + * so we can use the same code for both. + */ case FLOW_ACT_MANGLE_HDR_TYPE_TCP: case FLOW_ACT_MANGLE_HDR_TYPE_UDP: - mangle_action->mangle.val = (__force u16)cpu_to_be16(mangle_action->mangle.val); - mangle_action->mangle.mask = (__force u16)cpu_to_be16(mangle_action->mangle.mask); + if (mangle_action->mangle.offset == offsetof(struct tcphdr, source)) { + mangle_action->mangle.val = + (__force u32)cpu_to_be32(mangle_action->mangle.val << 16); + /* The mask of mangle action is inverse mask, + * so clear the dest tp port with 0xFFFF to + * instead of rotate-left operation. + */ + mangle_action->mangle.mask = + (__force u32)cpu_to_be32(mangle_action->mangle.mask << 16 | 0xFFFF); + } + if (mangle_action->mangle.offset == offsetof(struct tcphdr, dest)) { + mangle_action->mangle.offset = 0; + mangle_action->mangle.val = + (__force u32)cpu_to_be32(mangle_action->mangle.val); + mangle_action->mangle.mask = + (__force u32)cpu_to_be32(mangle_action->mangle.mask); + } return; default: