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 69C2AA0560; Tue, 18 Oct 2022 13:30:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CBFEF42BB8; Tue, 18 Oct 2022 13:28:26 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2103.outbound.protection.outlook.com [40.107.223.103]) by mails.dpdk.org (Postfix) with ESMTP id BF1C4410F2 for ; Tue, 18 Oct 2022 13:28:24 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mMlUZFp70NAnUtzfqWojIOXQubmxrlKnEJZbTzJHXNNjVP+mf2K3Y9JxUsDD+I//4KD1aY80wdDadAYoyH+IjkCNpeeQfRVWrp+UGkFReyFyGJ2rZPENoxBGR862uqAjlYovf2THtS5FAPBXZeT+g1sx09UbCC0Cp63Nkec1oDH1jE32BGxKAUXWRc/ta9PT9Q/jFJjKgvdNzwAv/cnn6i4ruBL73+uLNfVUleUVUSvbxSFWbn443YXtA5eokiB4VtV2ne2aco7X2qVTL+zD8SSiT21eYVj/SeGBHeJbWpEJI5jPYoWqZ6HJaynKUivYTgb+WHJVIeqQ9O1gsWJFKA== 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=ijNc7vtKbG/s1UzR2BXGDSU0YnA9n1phvY8OTmR+Whk=; b=iLOMr09Mguv2mZvHd0VYpBNKoagGLDJfI2jjnM62CTuM6B3CeQ2hZs1gR5ADz12k+wHTX9npCe9KpgTndX3abYeR3127HW+zWDvBaPkm5eoHqBeYTLPeN7Uu1szxsE2iCF5Pc3yJ7pkOwUoOVh/+/VDgwAhlcwHtWh/Pjl12+JEP/tUA02xgngCMGpSi5RR0p6/GdB56RE2ZxHCEYAn89GIffeYsO1GPCERyzAQao7MRutspoy14fjyqz8gpPbz55djw0gFaQlDCQ1+DeKjCIxAOd5PkQVtJiKPFGXQ/vj4tNfSvBdcF04fqYsbUvhgjq5gQMVNBtKRW5hV2ezXlMg== 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=ijNc7vtKbG/s1UzR2BXGDSU0YnA9n1phvY8OTmR+Whk=; b=XlJXjIkSFRsDpdaAvNl4wNjKSoRpc42L2vjkkpSGzlGj9sgFOSMcYHI5PsEbHBJSre9M5aY2FIIpeVUQAuVm0Q2nMdC12CCqwRKBjl7ja2kkNTFlAzI0AB0pRhtJO/epttbA+IQbcVDgSUeyVq7QgCW/ntzgI5xhTRaoC3UuTic= 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 SA0PR13MB4160.namprd13.prod.outlook.com (2603:10b6:806:93::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.20; Tue, 18 Oct 2022 11:28:19 +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; Tue, 18 Oct 2022 11:28:19 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v4 21/25] net/nfp: support TP SRC flow action Date: Tue, 18 Oct 2022 19:27:10 +0800 Message-Id: <1666092434-10357-22-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1666092434-10357-1-git-send-email-chaoyong.he@corigine.com> References: <1666092434-10357-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2PR02CA0052.apcprd02.prod.outlook.com (2603:1096:4:54::16) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SA0PR13MB4160:EE_ X-MS-Office365-Filtering-Correlation-Id: be667747-e95b-4e8b-291d-08dab0fbdb86 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: X5YdOfJAIRKxulWzH8Ql7WPHN3nqfOoXHEtiKRXvsYnLhKkrSvolGggSM3cKFr+MnEjuv4RnIsGVzK9M8U1eUs9b8Avmi8xMQ/8ZWJ6eLp3IwSttaDogjbZbmqpIgajahHw1RUEBmap3rtoLSBucTTmGHgmKsxG32Q+LjKIz19YvLdh/2HwmDRCKTecRpPdc6WgfWhUgoyoOj0CuyUks6zSdWVkY9Iu4WYuZfsbImitt+LDhduKvNqMFYN+H1anIIPq6zTvqdk0aXXXfl3WUz4m5kqddTOMfLSzDUcCneXTsl4N9TNOz+aHjxMC93Umt2jBxr+2hbo5Xhi4ABTQ3ZV3MrPe5Y0ppc17j3khsjRWGDXTDHBDgv21i6zZViHfRu/zuvk0MiZc5HDVBvkZIa7hvwOiDZkFeI/dvWbjuUDCb5IhXbToJxb6972fExcoWqZ0fnclqrWexCraMHO4XnIR/UDY51ApPQjYvIhxXCC+UT4TF92/xTIwoBCtgvWavfipGN9asFH0o1+qzFe7rVQL3dHuB8ubPwm71h3CAKuGwhu13tWaMfVKpwXVz6jJ7nlaXwF8xPfQAI303iCK0gISPDHM6N2esWyKnuW/nauOp1kVGeO29OG34tmf9QNIfKSLpcax1m0j0Riq6E4i0x4zHt1gQyqgRl1Xvumj/niJ/73r+JSPGAqHjjNKc8UNiH1zXD6sFWOS9xF19peAnxUjiGJWL8ylAmDtpb2N/1KDcTAMt4iy6k4Wf6MQDSPUH2MPeWModyIIQKd2CvaZbme7BRyJsuoD/JzAE/OEUZ0hcnmyOvkVSYLjfsKyViIrZ 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)(39840400004)(346002)(396003)(366004)(451199015)(6486002)(36756003)(41300700001)(4326008)(38350700002)(8676002)(66556008)(66946007)(107886003)(6506007)(6512007)(66476007)(5660300002)(2616005)(6666004)(44832011)(8936002)(26005)(478600001)(86362001)(186003)(6916009)(52116002)(83380400001)(316002)(2906002)(38100700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?N29BTy9GVTZvOHZaQWxFM2JHM0U2SGdtdFRRa0pZajJ0MGRtREk5WHpmQk9J?= =?utf-8?B?ZTJ1VUtvQUs1dlY4K0xheVZRc1NjbVhiZkJXQ3VUU2RPWFNqS2pqMW82L1dk?= =?utf-8?B?L1l4VlRwRUhsT2JmSkJQaUltQ3JnblVVWDZzMHlrSFdKRGgrdmJ2NXZFMGdv?= =?utf-8?B?VnN4NG01QjlEdmNybDB6ZnVZeFVrdXRWaXArcVM0QXZRclpZQ1ZVQTVyUUdj?= =?utf-8?B?bWJFek80NlE1bjArQ1p6Ti96aj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?utf-8?B?WDlhc2ZoZTExZkVlS2ZaY1FKbnd5NzljMEtYYVg4d2h0Qnk4TEtRM1VxU1dD?= =?utf-8?B?Vk8zeUlDSVFCOS9ac1ZhaThpVHJ4U2dIS2hHeUJlR0l4MkJhRWxCMW4ySGVs?= =?utf-8?B?OHc9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: be667747-e95b-4e8b-291d-08dab0fbdb86 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 11:28:19.5752 (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: 4vJsKaWrS4qwo2ejQmMCxXsS+l+oHr1Po3nf9krLCe1gaFYQCa8PjzPbimjYsy+fAx2zJCfFnoyRIAdLHMuCGMKRPupRz7GL1XrwnwY2soc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR13MB4160 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 67c3ebe..f40a995 100644 --- a/doc/guides/nics/features/nfp.ini +++ b/doc/guides/nics/features/nfp.ini @@ -51,3 +51,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 2cf82ce..dc37769 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