From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DF9A4A0544; Mon, 10 Oct 2022 08:11:41 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8FB0142BC5; Mon, 10 Oct 2022 08:10:02 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2100.outbound.protection.outlook.com [40.107.236.100]) by mails.dpdk.org (Postfix) with ESMTP id 5814542BC7 for ; Mon, 10 Oct 2022 08:10:01 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CUCke6kEAeMhtG7WbyFSwjKTaTiZ+dSvVXmueabw+Amot2y8o9uWMs4nsl9KiLqYkKQOdZMF59wMzHrWuOrc8+Xf5iEM24UXhG/GtWNQmgx6+eye3BL7xvGitJe0ak55UQ42mCgFAnZ4JmlFwqcPQPmYaESAReDimkpWig00t+HiPWWMzvG+Ogvzku/NXw00IFueNpjiQpQh03LNogkhObGbfhRVuQ3UzVR3PzDa0RTnBrlcRcORLI2YWZWb1JTIMm4OF8J5p9TbLuQm41r3Hm7MfT19TjIhW4cmAa0gqAcVMTsL6q15+kFIPAqA35A1iSPQ/JV/16l4/dRCiQ8dQA== 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=LHgulSVzepzvVDJabWwVp3Hzbwc4pfdmlMmXSCHwnuI=; b=HIRZkZsu+4W0coBPLkvtwv4f4el+poTyNXbw+Tr+J+74NXPeS+K0GZR3rHy5z4R+gjhJXuHK0jvhVyrQU2rORmCTJnhbimV+lvjEtf6J/WYvqcl0AQHqAXdQiQddn+uYU/AWBMAklO0/TkJQTiqsh890QLTziWn0xi5Hl/H4IzgDcmtVcjC16M0mizO0r9lTfA10v+pOGkl+UXR3POjJmDLb+X7DZTAzLv+T++EN+UZa1kbpZP/dWsZxPZVB+GZzISWxpl+YysWIGtaz4xa8mMj8cVWoRAVoXOl4liHcrAfiapGKKLzp3HrFSfDUw3B2+tzVvlqSVtL3eQkhB/GbNA== 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=LHgulSVzepzvVDJabWwVp3Hzbwc4pfdmlMmXSCHwnuI=; b=Z74GrrLbxDBKH+DgLZiXyUF1XxxCue5/UyCad9Uc2Cd1pWMTzJVBWVvh1IZBXTntGBABIpJX1wJ39NB/GUs3EJrRIfE5zZzw+V47kRxE4G0EobgtK54uSq7A8QUpGxvrSsf3jTbiaCzLRUvnRfS4fdjMhIvYGjqKh2JDiT8G2lA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by CH2PR13MB3877.namprd13.prod.outlook.com (2603:10b6:610:91::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.14; Mon, 10 Oct 2022 06:09:59 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7c26:1a0b:2825:6f4b]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7c26:1a0b:2825:6f4b%4]) with mapi id 15.20.5723.014; Mon, 10 Oct 2022 06:09:59 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v2 20/24] net/nfp: add the offload support of set TP SRC port action Date: Mon, 10 Oct 2022 14:08:58 +0800 Message-Id: <1665382142-21684-21-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1665382142-21684-1-git-send-email-chaoyong.he@corigine.com> References: <1665382142-21684-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR01CA0051.apcprd01.prod.exchangelabs.com (2603:1096:4:193::6) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|CH2PR13MB3877:EE_ X-MS-Office365-Filtering-Correlation-Id: c9c179f7-3cfa-44d6-a2ae-08daaa860fe9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zmTOeJRa5/kaFK+qpyZ+N8D85z02TPJnXSZilMAVDAQ60dW/JMWuCZopdL4WivmP2OUzXZm7WDFLq/ERcuuO3D1ekPJ4Kx75JoFH5ZMrJAK2X/FtfFsc0xnHRd26LauCj6JxwZzAU9CRzVG9B3ytZCgWJiAQHcOQhfT93shA42ej+bcHVBH9VEvQ2JsxYz65FCyZn7hmG1adFT2gydUGO3mxp6FZbPwvWMa20MNbLEcz7QZfVmVVN0GDTG+8bkrpdYhKE6cZEWhAwtSlB3wQgngRD3M9oxE25yw+sB4ytSjeKnzz3bpnagQX9LmTJ931NbprSriCtWknkzjEv51U6+OKw6hHtm985rYWZGNqcVpRXLqaeY3iytAvQPsRRZmKKiHXdDhOXisoepf8O8NMQPq/lCDq96xp4AyUMRL3/PCUUZdr8JFOCpGhUbUH1U90vdXP+EUoAaLozVMEqp+gaopkAtdMDDp5Df/qbYp28w+s4ltBKwMGVl7iBeQtxxAJ7hfgROoWf7jAFT3yUpG0PktAFB4oa4Fozd9wnYMHTtniVi1YVElpsGU+eNF+4AtbREY0Vk2hnt1y5DkE+/8Amn1kBqMjlzIT8r3NjQEFIGdwg2stdGNHsX14Tr/UoZjU5W0BXGw0pqWkBaOIy2v0RYp8O9iLxIKn9ys5dHeD0bHGz5AXDb3HL5OfxAkoGzENXdxG1FnzEJnaqduDkxcqfEKlFTtnOP2KDp/fEZv0fE1xSs/l0sa2Ec+eI5OMDP3LC6JdgsDCxytO/v/76JF3EWNbD+Bu7YwyQErMyMXT8M3/ERjMnSA06sUQ5Km6y/a9 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(136003)(376002)(366004)(39830400003)(346002)(396003)(451199015)(36756003)(4326008)(2906002)(8936002)(44832011)(5660300002)(41300700001)(83380400001)(52116002)(2616005)(107886003)(26005)(6512007)(86362001)(8676002)(66476007)(66556008)(6486002)(478600001)(6916009)(66946007)(316002)(6506007)(38350700002)(186003)(38100700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ZFpJam1VcFUyME9HN1ErOUJzV0h1RDJJbEJhNXJLbXk3aXZGay8vNVBIalhU?= =?utf-8?B?V2h1Nkkrbk94eStHeHd1NFhjQm42SnpEczJiN29pQy9NNzFNdXZVeGFvcVQ5?= =?utf-8?B?c0EzbTdrY0NlejRQRHd1Q1NSUTMrUkRZSTM3WEhVaEd4aUkrZEhtRWpBSkxI?= =?utf-8?B?WlMxYzdIRVNjdVVsUG90R3NWL2FCYmYyRHQzNmdUaHNCek9wWWt5OW9OVzkw?= =?utf-8?B?bDYvK2lMZkNVMlBxV2xBTDla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Y2xxY09B?= =?utf-8?B?aGM4YzJhZW5iS2pQa0FSbmViKzhFcWp1V2tMN24rQ29oSUZvSU91bFFTaWZK?= =?utf-8?B?cU5XUmIvbEdRVGdnWDc1TVk5NzVlU1BSVmJvd05Fc3lCUWNHcEdMN1BLNG1N?= =?utf-8?B?L2c9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: c9c179f7-3cfa-44d6-a2ae-08daaa860fe9 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2022 06:09:59.8467 (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: oF8ZOptUZmkX0vcjIPs7/uQsjRI6YXP/uSHj84OfeLSjtsOxPR+EWoLHghvRtUdNclkMXbkTajnY9+zFvikDnz/H3J65BqELKinZ7S8AVZU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR13MB3877 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add the corresponding data structure and logics, to support the offload of set TP source port action. Signed-off-by: Chaoyong He Reviewed-by: Niklas Söderlund --- doc/guides/nics/features/nfp.ini | 1 + drivers/net/nfp/flower/nfp_flower_cmsg.h | 21 +++++++++++++++ drivers/net/nfp/nfp_flow.c | 44 ++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) diff --git a/doc/guides/nics/features/nfp.ini b/doc/guides/nics/features/nfp.ini index 16fdf87..68f5b89 100644 --- a/doc/guides/nics/features/nfp.ini +++ b/doc/guides/nics/features/nfp.ini @@ -52,3 +52,4 @@ set_ipv6_dst = Y set_ipv6_src = Y set_mac_dst = Y set_mac_src = Y +set_tp_src = Y diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.h b/drivers/net/nfp/flower/nfp_flower_cmsg.h index 45e50dd..26de8b1 100644 --- a/drivers/net/nfp/flower/nfp_flower_cmsg.h +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.h @@ -432,6 +432,27 @@ struct nfp_fl_act_set_ipv6_addr { } ipv6[4]; }; +/* + * TCP/UDP/SCTP + * 3 2 1 + * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | - |opcode | |jump_id| - | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | src_mask | dst_mask | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | src | dst | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ +struct nfp_fl_act_set_tport { + struct nfp_fl_act_head head; + rte_be16_t reserved; + rte_be16_t src_port_mask; + rte_be16_t dst_port_mask; + rte_be16_t src_port; + rte_be16_t dst_port; +}; + int nfp_flower_cmsg_mac_repr(struct nfp_app_fw_flower *app_fw_flower); int nfp_flower_cmsg_repr_reify(struct nfp_app_fw_flower *app_fw_flower, struct nfp_flower_representor *repr); diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c index 6c53fba..96bb69d 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -575,6 +575,7 @@ struct nfp_mask_id_entry { int ret = 0; bool mac_set_flag = false; bool ip_set_flag = false; + bool tp_set_flag = false; const struct rte_flow_action *action; for (action = actions; action->type != RTE_FLOW_ACTION_TYPE_END; ++action) { @@ -657,6 +658,13 @@ struct nfp_mask_id_entry { PMD_DRV_LOG(DEBUG, "RTE_FLOW_ACTION_TYPE_SET_IPV6_DST detected"); key_ls->act_size += sizeof(struct nfp_fl_act_set_ipv6_addr); break; + case RTE_FLOW_ACTION_TYPE_SET_TP_SRC: + PMD_DRV_LOG(DEBUG, "RTE_FLOW_ACTION_TYPE_SET_TP_SRC detected"); + if (!tp_set_flag) { + key_ls->act_size += sizeof(struct nfp_fl_act_set_tport); + tp_set_flag = true; + } + break; default: PMD_DRV_LOG(ERR, "Action type %d not supported.", action->type); return -ENOTSUP; @@ -1374,6 +1382,33 @@ struct nfp_mask_id_entry { set_ip->ipv6[i].exact = set_ipv6->ipv6_addr[i]; } +static void +nfp_flow_action_set_tp(char *act_data, + const struct rte_flow_action *action, + bool tp_src_flag, + bool tp_set_flag) +{ + size_t act_size; + struct nfp_fl_act_set_tport *set_tp; + const struct rte_flow_action_set_tp *set_tp_conf; + + if (tp_set_flag) + set_tp = (struct nfp_fl_act_set_tport *)act_data - 1; + else + set_tp = (struct nfp_fl_act_set_tport *)act_data; + + act_size = sizeof(struct nfp_fl_act_set_tport); + set_tp->head.jump_id = NFP_FL_ACTION_OPCODE_SET_TCP; + set_tp->head.len_lw = act_size >> NFP_FL_LW_SIZ; + set_tp->reserved = 0; + + set_tp_conf = (const struct rte_flow_action_set_tp *)action->conf; + if (tp_src_flag) + set_tp->src_port = set_tp_conf->port; + else + set_tp->dst_port = set_tp_conf->port; +} + static int nfp_flow_action_push_vlan(char *act_data, const struct rte_flow_action *action) @@ -1417,6 +1452,7 @@ struct nfp_mask_id_entry { char *action_data; bool drop_flag = false; bool ip_set_flag = false; + bool tp_set_flag = false; bool mac_set_flag = false; uint32_t total_actions = 0; const struct rte_flow_action *action; @@ -1518,6 +1554,14 @@ struct nfp_mask_id_entry { nfp_flow_action_set_ipv6(position, action, false); position += sizeof(struct nfp_fl_act_set_ipv6_addr); break; + case RTE_FLOW_ACTION_TYPE_SET_TP_SRC: + PMD_DRV_LOG(DEBUG, "Process RTE_FLOW_ACTION_TYPE_SET_TP_SRC"); + nfp_flow_action_set_tp(position, action, true, tp_set_flag); + if (!tp_set_flag) { + position += sizeof(struct nfp_fl_act_set_tport); + tp_set_flag = true; + } + break; default: PMD_DRV_LOG(ERR, "Unsupported action type: %d", action->type); return -ENOTSUP; -- 1.8.3.1