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 2CBC743B91; Fri, 23 Feb 2024 03:42:59 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1BADF410F9; Fri, 23 Feb 2024 03:42:52 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2115.outbound.protection.outlook.com [40.107.244.115]) by mails.dpdk.org (Postfix) with ESMTP id A4469402ED for ; Fri, 23 Feb 2024 03:42:45 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IiU5gmZlo/K2B7BmIu2fSQisdqX6Ri8EjsG6k/UDbDfFy/zUsvydUjI+MSRIU3C4jm49jyGmfWwJmRbC0biEqz3IJb1YXqCJbJwU1+oEW0sTRqcfcK1rYFXli+txNfu/muIwxG/+paOY7kPBX69kv9iYRjrvoLxA20nnK15XV3b4+jwp4kz9C/C1/yFwSZLylkYY3tct8ZmTItBc6/AFPdFn0ar6lW7w+SrSwVarYhEEuCMC4QIww0psw77GRS2bAlp47TZOzf5LRaU1VNcNFWqoYrLR1xe4MYr3p4kWaZoZlg3wsTJA/JHs/VPBPMc1uEomMaqpX+DT5KwQ+x+UMg== 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=RO5HermtBHjS0CUvkN24+frgnYUMJcga2+bXZ5KFmcQ=; b=PlrTLrMdpoVzA9yPk79ZYwR8o6SIZbNpIKFbH5RqsQkSErKFnTpYV423OKOBLXX0GWi/CJRrSdzVCNHkdZ21yQWgJJB0ygxWALaOLpRloWTIWY17onFEGIWtb16IlpQzMPrfL18iMmCNG8cKjQvArcFQhBy2o+iNHiIeVZBTQ32zVzmZ4O58/piwjarZ7LOPUjF9dfo2Lit3nGiBX81Ca40BmJRRrSdrzmehll+ZnjyhCBAVTzeFQMbwCI9YJuf7736IK+EN1l865Oam/Wq/9AX2gVecAAzt6l7EcHJj9c4lCWIAeWBB5zgNmaqXGl3LtpdhL109fKUeHnMwGPRiNg== 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=RO5HermtBHjS0CUvkN24+frgnYUMJcga2+bXZ5KFmcQ=; b=YY6KdO7T4qCzYpBSIwaJgF09eoBezmK79OC0FdmpSl+SHcHJbOPzS8fIMr9HLOVEO4rN6SDLsip/HEllV1h3N10rYGIWyuRopxH5/RBMO4Q/+oY5R/IuTHQUeNTpGROzHapZJDvf9OYW7GlAVIpG3kCVfepQ2xqJ+osoyv95Cnk= 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 SA1PR13MB6645.namprd13.prod.outlook.com (2603:10b6:806:3e6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.24; Fri, 23 Feb 2024 02:42:41 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::8e02:f738:570a:f8aa]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::8e02:f738:570a:f8aa%7]) with mapi id 15.20.7316.023; Fri, 23 Feb 2024 02:42:41 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , Chaoyong He , Peng Zhang Subject: [PATCH v2 2/4] net/nfp: support MARK flow action Date: Fri, 23 Feb 2024 10:42:15 +0800 Message-Id: <20240223024217.3052031-3-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240223024217.3052031-1-chaoyong.he@corigine.com> References: <20240210104214.1248772-1-chaoyong.he@corigine.com> <20240223024217.3052031-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR13CA0040.namprd13.prod.outlook.com (2603:10b6:a03:2c2::15) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SA1PR13MB6645:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b391f75-d358-42ae-606b-08dc34191a56 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tSFO5D7wAFrRcy7ybO6QsjbPnDzgm6DQHSr4FdKk3Wj2/3GHPrfEcEHggo2f7Bvgo0DtswJPtUj7JbtyMIMmVpvPpxCyNj9gSG5n7VnhHaiMgbd05SN2O87w/1aE1zd20td9zPN/e2UMwkRsx6Lr6sWqGrz3Fc2lnBmnXdNWW3e5ORnNEI85NEpCS11762iY+NZFaAw1XpVxAgRvQpwTDmFOrWRkLKRxiSQOKwkyMw0DKB1xCr0Np/21fGRwYODNZKQrQB1qqYCnwNEV+fyxC13ZPg1lFDavtVU0lLmq9bfALkOObsb+aaexuK7awgAShYaIr1gDShadTBlLVdF+J+zrur2P+mbgWTbEIaVGuhDMPlxpXI2Ji6wy+1VYJqx9Eyd9TvuEEfOhiifijWUFSj1+kPKd0ddPxHNDc0S6uOWUvcQYphFkpmIk8uGMK6ohaoJxYw7ks08cMP1XEcBKHjpGzAzFV/wG03M5PyRKTaUVfilzv5/TY7Mv7SYYPYBoMDPFnlG1bvxAceuSVNmXjyMi/j5eVtYdr64s9b+14wQq3umQ4PrwiRxL3GPpDniVslwfZQSD1JmuOo2APOZWNbMDc7FG9txJN+4bVkEVH5Z4fvIFlBpbtm2KodBZXvsW 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:(13230031)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?TW21o/R0XhSxG1ECht86wzEgmS23jkUsZlN/ltgtI4BwFN1f7caGBPM2mwP7?= =?us-ascii?Q?kBGoJAtT/WXxMq1v1jBMW7homQ5pI/mk28xwb6gvwEXQXKmbOsLnfaSZt1Qm?= =?us-ascii?Q?pkNJh8ITN0ghdWMKwcuPmtMBjxJCPmqDGyPNkXaYExS+Qv68Id3kaEft0rfc?= =?us-ascii?Q?a3EuZIjVZWKlE7stUJjzTfZRoAwOGiSRB3wFlO1h7EC0XcFQEKkcnkE9KGa8?= =?us-ascii?Q?NYPwX5L1XyDjJ2erzBvysOnb8IYVe/MC74N2CFaS1o7VWeEv63vNW+7HSRT9?= =?us-ascii?Q?vlwi4Mg1wbiJO2FDrhAQHohMrGmulySEzPfTiNsblHSiMvurr+j5aX8WC9L5?= =?us-ascii?Q?gg83k1xAk5iV6z0z0d6QaJ9IAJv1VlsMkJpuOF5d/jpDeI96AT2IL7n1+QX3?= =?us-ascii?Q?pr5Lub1FQy/83315ZifMzvPVLHDw52dHBRo7gyiJ08TrAzQmWpvWI3vk9wso?= =?us-ascii?Q?XUcJzvwUkuu9rvnRistRmN4FSw/SLxMDR7bcFsI264GL91vKIOhA/13DdTem?= =?us-ascii?Q?nh2VjW/8eQlOeDRhVG0NSA1edWsuwQcJnrywtmGYn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QvDKDMHwLkDYsc70XX2RCEuUo+wTw9aw8/k27+8RZt9Qxfu6TW5cnxUxs9M?= =?us-ascii?Q?uzTMJfI2bwfci7QOzWoF36E7oN3WShzTjdvzoCCjeOwb20DXh5RvVwwZQy4a?= =?us-ascii?Q?GSVRv7YKk1u92MgmG1dl8tLBtjwKm+e+JNms7vUIX9wLihZDcD+wVvF9AGL9?= =?us-ascii?Q?GA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b391f75-d358-42ae-606b-08dc34191a56 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Feb 2024 02:42:40.3165 (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: 6Ki+tCRrCGmkagzP2SUTpk/B/V9m4MCph0v80+BMsr1UZ0hABV5iFzCZoljG4H2cBVuzGjeMixtwZXiPjXbWlia8vKRrPiHZSv7ne/Ys1XA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR13MB6645 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 From: Long Wu Add the corresponding logics to support the offload of MARK action. Signed-off-by: Long Wu Reviewed-by: Chaoyong He Reviewed-by: Peng Zhang --- drivers/net/nfp/flower/nfp_flower_cmsg.h | 16 ++++++++++++++ drivers/net/nfp/flower/nfp_flower_flow.c | 27 ++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.h b/drivers/net/nfp/flower/nfp_flower_cmsg.h index 8fb55f44a2..c94ea706bb 100644 --- a/drivers/net/nfp/flower/nfp_flower_cmsg.h +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.h @@ -959,6 +959,22 @@ struct nfp_fl_act_meter { rte_be32_t profile_id; }; +/* + * Mark + * 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 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | res | opcode | res | len_lw| reserved | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Mark | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ +struct nfp_fl_act_mark { + struct nfp_fl_act_head head; + rte_be16_t reserved; + rte_be32_t mark; +}; + 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/flower/nfp_flower_flow.c b/drivers/net/nfp/flower/nfp_flower_flow.c index 501a8d87bd..b3a2c1cdaf 100644 --- a/drivers/net/nfp/flower/nfp_flower_flow.c +++ b/drivers/net/nfp/flower/nfp_flower_flow.c @@ -83,6 +83,7 @@ #define NFP_FL_ACTION_OPCODE_METER 24 #define NFP_FL_ACTION_OPCODE_CT_NAT_EXT 25 #define NFP_FL_ACTION_OPCODE_PUSH_GENEVE 26 +#define NFP_FL_ACTION_OPCODE_SET_MARK 27 #define NFP_FL_ACTION_OPCODE_NUM 32 #define NFP_FL_OUT_FLAGS_LAST RTE_BIT32(15) @@ -1138,6 +1139,10 @@ nfp_flow_key_layers_calculate_actions(const struct rte_flow_action actions[], case RTE_FLOW_ACTION_TYPE_CONNTRACK: PMD_DRV_LOG(DEBUG, "RTE_FLOW_ACTION_TYPE_CONNTRACK detected"); break; + case RTE_FLOW_ACTION_TYPE_MARK: + key_ls->act_size += sizeof(struct nfp_fl_act_mark); + PMD_DRV_LOG(DEBUG, "RTE_FLOW_ACTION_TYPE_MARK detected"); + break; default: PMD_DRV_LOG(ERR, "Action type %d not supported.", action->type); return -ENOTSUP; @@ -3487,6 +3492,23 @@ nfp_flow_action_meter(struct nfp_flower_representor *representor, return 0; } +static void +nfp_flow_action_mark(char *act_data, + const struct rte_flow_action *action) +{ + struct nfp_fl_act_mark *fl_mark; + const struct rte_flow_action_mark *mark; + size_t act_size = sizeof(struct nfp_fl_act_mark); + + mark = action->conf; + + fl_mark = (struct nfp_fl_act_mark *)act_data; + fl_mark->head.jump_id = NFP_FL_ACTION_OPCODE_SET_MARK; + fl_mark->head.len_lw = act_size >> NFP_FL_LW_SIZ; + fl_mark->reserved = 0; + fl_mark->mark = rte_cpu_to_be_32(mark->id); +} + static uint32_t nfp_flow_count_output(const struct rte_flow_action actions[]) { @@ -3734,6 +3756,11 @@ nfp_flow_compile_action(struct nfp_flower_representor *representor, case RTE_FLOW_ACTION_TYPE_CONNTRACK: PMD_DRV_LOG(DEBUG, "Process RTE_FLOW_ACTION_TYPE_CONNTRACK"); break; + case RTE_FLOW_ACTION_TYPE_MARK: + PMD_DRV_LOG(DEBUG, "Process RTE_FLOW_ACTION_TYPE_MARK"); + nfp_flow_action_mark(position, action); + position += sizeof(struct nfp_fl_act_mark); + break; default: PMD_DRV_LOG(ERR, "Unsupported action type: %d", action->type); return -ENOTSUP; -- 2.39.1