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 A137FA0032; Fri, 21 Oct 2022 10:05:54 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 472F042C17; Fri, 21 Oct 2022 10:03:15 +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 0F98F42C4C for ; Fri, 21 Oct 2022 10:03:09 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WT8iIGHrygGBlZ2Bcg7sDw+cDQjYKpMWCHBTQuFnRuTZOqw5Et71JVyFuXdp46x6TrUX9kUxrEdHc483colVKU9RjSXfkBdaFcdK+NiC2m2LO6wxxbH+njKCiiesdnJRVjhM+nxd/Sb3L/M0y7QHteA8/g7jPsj9K5cjyQe4hY4TWpsseY26pMsunAaku0aM81bu18CcyrJIeZSLOKj4mHrkFXzDgd0ZSggtsEz83jnxVU8+lI5T16eWFn8tn8mxUaeo7KJXRfSLq6b8ZcAwpgZINX8xDIMDFQMnjjgh9YgGTOGTsFoYqY+sa1kwl1gvUHJO4s41Pud4yP3Ury7yFQ== 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=miJgoXVPGtkHJGicI0TZM6bbMw32Ch62UNdwSTtbi7w=; b=mxwoAAK+E1nBOu8+ANfj7KOVHRQWrj/Hd346/5O2C3/A/oWxGrBWyHbX60dqB0Av5QQyXUnk3ouPOH7S2Fw6SHPqC+MDn8ef2Rb1/d3PUXiw1UJDOjtKddCLnFNy5yOQujHdNCqAD6C7MtkvBolCdk38KLKZY/LV8eH21BSkgY45ozEpCpcpXJGyyen6Sy+l6cCgAg+dk0OBWJQLByzB1RyM05eRoEo2RlkCzwQQMPH1m8nyijB1KAqTNMNIQLpN8vlGSKJdiZDcaDni6PJoXqNB17BEaFJXSRuD5SSFgkXnYLlhb5BrhGTuc7w/Low2Gc1V87wDsoOfv/ASUbupVA== 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=miJgoXVPGtkHJGicI0TZM6bbMw32Ch62UNdwSTtbi7w=; b=bUlLNVYOekFE4umfwybu8JeBeXbo+UG4tV2Uc0VpBmCCzxaNunP5m535xPE6VT+WAOszVtG5rKN1KozPA/FPo1ZkqtLHNEOJE/c8lq8Rq8TAE4Z4j4kzw0KyV7f4edzK6payFgTKDza87YKugQQLUiid4s/pEaDT+L4nPHIQfIg= 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 BL3PR13MB5162.namprd13.prod.outlook.com (2603:10b6:208:339::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.17; Fri, 21 Oct 2022 08:03:07 +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; Fri, 21 Oct 2022 08:03:07 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v6 23/27] net/nfp: support TP SRC flow action Date: Fri, 21 Oct 2022 16:01:59 +0800 Message-Id: <1666339323-24016-24-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1666339323-24016-1-git-send-email-chaoyong.he@corigine.com> References: <1666232391-29152-1-git-send-email-chaoyong.he@corigine.com> <1666339323-24016-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_|BL3PR13MB5162:EE_ X-MS-Office365-Filtering-Correlation-Id: ee559658-7f8a-4ecf-4c1f-08dab33ab04c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ljhP8u8SajN+DhbjZ9EoJKmurvaoz1xtl3SO9twMkjBCLX12R9UIIUqnlZaOEbOuHrttwSuXuuj6s79ttQZftjP+XGm1END6iNR+BiYNkYxTzSWPwycUXf60pFweeFk1tIQvqKTjMA5wLumvNIxfcaBM4hPymlyGHJV2RJ2I9QBM6o4ymrrZVsv9lcAxHx9fSUiRY04NEkMVe7CI59EBnN0E3A9tkY9ceCcIU6NdrKi+PYoEHhfJnatKjZubPgCPuw8DEotWpJi9v1y8bKvHxVO9okmnLDgA925CPZD/TYAjDTT7zPj/Gy2L2vVGPRxVcnextSCuyXgwza8Pqp7t2iq6VDLPW8lXanelupcFafgq9rp2sa0xhKURxeWgSrMswTPMBdJY2OiXKSI3bk6UYEwBHFzcrXsC1xfCmW10MwxLVY1X/xn3PPSyADm5Pk47zaO4kw4mPSpq1H/SYJNk9QV58nUxryRVXRZ7A2UnFU/CjVvCL6vOKrnuOZCCxWWMRJJnxYWFso0ll7Bap93kWL/XDdJog8jM652m0GcS53gPCGbxwqDmEPiF8KKEPtuzvGOsVGA+lR5BMcQTosrOP2jVMTI56OnE87QTNO3Q4UUHmgpnxIHUpZIsETVj9+NQruMigHtxPOr6YEeAXX21zhKEpPoL4x52iilFmK6JOt/SG/W6AGyzLskgyeihA86fIiIKygCkCNoq1JhJRl9HaY7PT9+2si7RfuxBjz3Yk1GMd0C/cI45mdJ7vx5xuAs4KnvrxX4jWoBD5swxfHKyKA== 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)(376002)(396003)(346002)(136003)(39840400004)(366004)(451199015)(2616005)(6916009)(38350700002)(6512007)(6506007)(52116002)(8936002)(66946007)(4326008)(186003)(107886003)(8676002)(41300700001)(2906002)(66556008)(316002)(66476007)(38100700002)(44832011)(26005)(5660300002)(6666004)(83380400001)(478600001)(6486002)(86362001)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?RURxNE81UHhiNTgxaEkvT2kxQ25oaU5sTmMzeHpXNGpxb1hZeDdFSjFVSGRB?= =?utf-8?B?UmZRc0VrVmZKRm1oR0w0dG1qM3RQUHdEMVc4aFhhaThSZGhSa1RRZi84MFRL?= =?utf-8?B?aDJWZm1iVCtyYjhJbEVmek1PZEpnZzJ4WW9Yb1RnMkJ2NnFyTDczYmM1MUJk?= =?utf-8?B?dFFyUWZUcWJFTEE4Z3d5VG9NZjFhbm5xN0xoNDVUd0Y2S0NtNmRsd2l5cVly?= =?utf-8?B?cENrQmpqU2pPUy9acUhNSWpJZXEwbi9WUmQvTmNQbkRLL0YvQ054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UNUU1TzNJZURyRmQ2Z2pkYXE3TGhac3EvcW4xTmVFc2xr?= =?utf-8?B?eUc3Uk9xMVk2N0JFNE16a3p2Vk5yUTdYbGpsU1FFQ1FpeEMxYkltTkdpcGV4?= =?utf-8?B?aGc9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: ee559658-7f8a-4ecf-4c1f-08dab33ab04c X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2022 08:03:07.6579 (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: TmdXwGL/UWQNPxFAeM7stvxG6FGup7vdT98pr8y0hi7arU0wnQ22tc0L+9nguJi0/sGR3GIf4nurmcXQAx9GAeOMg9CBm4fNnZn5H8rQ7Hk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR13MB5162 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 5fcece7..f3ac51c 100644 --- a/doc/guides/nics/features/nfp.ini +++ b/doc/guides/nics/features/nfp.ini @@ -50,3 +50,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 e077ed3..9778020 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -563,6 +563,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) { @@ -639,6 +640,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; @@ -1356,6 +1364,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) @@ -1399,6 +1434,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; @@ -1494,6 +1530,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