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 D8621A0032; Fri, 21 Oct 2022 10:06:37 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 74DBB42C75; Fri, 21 Oct 2022 10:03:21 +0200 (CEST) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2136.outbound.protection.outlook.com [40.107.212.136]) by mails.dpdk.org (Postfix) with ESMTP id E19AC42C12 for ; Fri, 21 Oct 2022 10:03:14 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uq+iOPMPuYCUApR6lMeL7V2wo0lhHpDESd9C8RlmR6euld3JxglpAq+98yMVFRGcE+I+5bJS6rtn4A6SO5yR/LgfHGITjP0q0+BSRjxyIigYcJ7iWtO/c1si2iyYeF7MuOPPx3cPh8mFwAi1rDctL68yRsy50lag7evOhHP4HASjUGE7Btj9JrQnvduCEj8Zz+BvOWcttFYH5MWSqZIzMH+0COb+QW01Rr5omRRWJAU3UHt7xod0XlOnzZpm9rLTDZmUEA657BMChDD+adp1BSHROdlz7LNNp0nbkOAT2fxa9GPF6NePTyKo04Iqq8ZzK2n7Ac4lPIDHp5p87R/5Ww== 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=SYaAwLbcD4qW2uXigv+RCMyG6CUaI282CvBow6cWAaA=; b=az3jDxsVuqwCHddtjyhTgr57CIrWIr42TOcpy19AbZShrBPIjO1eqhlAzYNV5oIiLnbe1Qpjw3mSYaqvHLj4UAEa2LDEe4N1el70dEO0qB5qfFZwT/6iqPrW998c1O74qb1ROPkwTcts683/ElS0qxhF7YjzvtgrpMm56hEgVIrMUkb1eaKcM9qwRkJrmonRP9cU1A5v90EsG9LI8x2uOMHI84rSIScpIFv92E8f9hKu/Bfxco1I8VnqEqjs7+jbuXLCFUJmfUrNj8sFG7PsTo4nptrMEamrvucaoatfIg3522Y+7O0TkVU8gLXzJNsLR9NErmJQChrPRz2WW6jrlw== 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=SYaAwLbcD4qW2uXigv+RCMyG6CUaI282CvBow6cWAaA=; b=pkeoh73oedwYDI3MnXlHrb9iFw7xkR6nsWk8ECopRRcVubMlQg9aj1Bw8PYJcL0xScVRAZyzNtY7OfRYZ622eBrzzaZHa4OeIT3FKmNF1r2ZX3IvyWnyhDMxWVLWqFBu0rQRtOUQhroBJ5f2PLEsPvP+BSaBbMputb7ZpeqzdXc= 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 MW5PR13MB5535.namprd13.prod.outlook.com (2603:10b6:303:196::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.20; Fri, 21 Oct 2022 08:03:13 +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:13 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v6 26/27] net/nfp: support IPv4 DSCP flow action Date: Fri, 21 Oct 2022 16:02:02 +0800 Message-Id: <1666339323-24016-27-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_|MW5PR13MB5535:EE_ X-MS-Office365-Filtering-Correlation-Id: 7a418b2e-ff66-4fa5-331e-08dab33ab3f3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j3QSquxEuG4VWT1IlL0H6LPDf/k13X2LWv59gIXQdCNkDzumvvwzpPZzMohpk76jdXmw4yL2560O9Cx8Ww8RGf/WTeM0nCeMKAVzcw5YCNcJV6O1m6N/d/0J/DsyYu5uBGv4bSbpWxE4hNXOoHAe5MOH/KpVDVBSs1SutebkcoCXSO5nFyZ7xw4FRyycsUpMaFRhNkxmb4CTLDksyV5b2i+oIAJwsgdSZlnvRBzFFG8rX4OcGDD1NaLkau2wxW7Rr2tMtAX5bZK4oqhuVM/jgen6r28uKkXZfi5zZeZtD9t/V1yMBZVYn4PpiIO1OgVG+4Bj5L7JI1xcCCxBVMgei4i+MDErvPb3CMTu4S8Nu7Pgy3pxaeyPavg1LnC28DyvM6TNTfaXe6E3Op3Vy/yqppt+b85jPG5YP09XSQWwBlTEjv3Mkc6KotDZOa/y/v99hjCS5QwEmhMiLM0u9l13+pAglS3+32KBpAKFbddXVmUcw69H/81OjcL+SEuodPEjcUFum5yxFhzie14EoNBaHKpdKx9Cj1brQl7jGSMRb+/pu8yF8qWZhtixgojuHwtnQ2ppjUCann7NZ570psQPDyXlgMzaoYbZEHbMpud/AFWrpHdwBBl6tEu4LPZsb22aP0U+mOTz7DuPLaTrDs1WapJUVENfofMLdfXXT34O+k+13n2Fv5mKB6P+59ps9zvN1UpSfVluzcGWoC2fJGUDGgUJ7vZXUbtBP2P74OWRa07gqzly75Y6qIQFFZNcEoimAwho+ghZv08EcwLJWt2AkQ== 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)(366004)(136003)(39840400004)(346002)(451199015)(5660300002)(6486002)(478600001)(83380400001)(36756003)(41300700001)(2906002)(86362001)(8936002)(44832011)(66946007)(66556008)(6916009)(6506007)(316002)(66476007)(26005)(186003)(107886003)(6666004)(6512007)(52116002)(8676002)(2616005)(4326008)(38100700002)(38350700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?R243WGR3d1JhY2h2Zm00TzY4Yk5ZcVJDaDN5ZTd2c2lTemFDTVNFVmcvclVP?= =?utf-8?B?OTA1d01IR3NnMEJJWkt2dHlYcHFlTUxEYVNTa2wvUTFzZGJXM1h5MGVBVmhV?= =?utf-8?B?TldLU2UyT3doY2dEdk4vU01LUjZ6SXllQjBERjMweWd0UGpNYlc0eFNpclZo?= =?utf-8?B?Mzd1Q2RFZGxXY0xlUXgwOG9UMVM3b0JFVEQ2QzJEbU1pS2I4UGNvNGw4OGJl?= =?utf-8?B?V0RBNjlSQ3JQNDIrOVp6S1M3UU9uT1lWYUcycXErYkQ2YmVMM2EySz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p0VjJScCtQU1VuRE1BQnVD?= =?utf-8?B?QzA0dTBzSWt5WjF2dUhRL1VrVWp0c0lTbHp1bEl2eUwzam1FbXFGYWt5dE9a?= =?utf-8?B?OFE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7a418b2e-ff66-4fa5-331e-08dab33ab3f3 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:13.8162 (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: zKlpOYCOKS3lGEc9uA54QavCBhdidVYtSL7Mx9byzaOeDP9g2OLntUPFMBSq1GXpE0dvF8iCTKRdvBlkyeBrNCZzh5QDRExcENEPUKeiB2Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR13MB5535 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 logics to support the offload of set IPv4 DSCP action. Signed-off-by: Chaoyong He Reviewed-by: Niklas Söderlund --- doc/guides/nics/features/nfp.ini | 1 + drivers/net/nfp/nfp_flow.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/doc/guides/nics/features/nfp.ini b/doc/guides/nics/features/nfp.ini index 1283583..596589f 100644 --- a/doc/guides/nics/features/nfp.ini +++ b/doc/guides/nics/features/nfp.ini @@ -44,6 +44,7 @@ of_push_vlan = Y of_set_vlan_pcp = Y of_set_vlan_vid = Y port_id = Y +set_ipv4_dscp = Y set_ipv4_dst = Y set_ipv4_src = Y set_ipv6_dst = Y diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c index a4c14d3..c2f598c 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -672,6 +672,14 @@ struct nfp_mask_id_entry { } } break; + case RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP: + PMD_DRV_LOG(DEBUG, "RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP detected"); + if (!ttl_tos_flag) { + key_ls->act_size += + sizeof(struct nfp_fl_act_set_ip4_ttl_tos); + ttl_tos_flag = true; + } + break; default: PMD_DRV_LOG(ERR, "Action type %d not supported.", action->type); return -ENOTSUP; @@ -1495,6 +1503,29 @@ struct nfp_mask_id_entry { tc_hl->reserved = 0; } +static void +nfp_flow_action_set_tos(char *act_data, + const struct rte_flow_action *action, + bool ttl_tos_flag) +{ + size_t act_size; + struct nfp_fl_act_set_ip4_ttl_tos *ttl_tos; + const struct rte_flow_action_set_dscp *tos_conf; + + if (ttl_tos_flag) + ttl_tos = (struct nfp_fl_act_set_ip4_ttl_tos *)act_data - 1; + else + ttl_tos = (struct nfp_fl_act_set_ip4_ttl_tos *)act_data; + + act_size = sizeof(struct nfp_fl_act_set_ip4_ttl_tos); + ttl_tos->head.jump_id = NFP_FL_ACTION_OPCODE_SET_IPV4_TTL_TOS; + ttl_tos->head.len_lw = act_size >> NFP_FL_LW_SIZ; + + tos_conf = (const struct rte_flow_action_set_dscp *)action->conf; + ttl_tos->ipv4_tos = tos_conf->dscp; + ttl_tos->reserved = 0; +} + static int nfp_flow_compile_action(__rte_unused struct nfp_flower_representor *representor, const struct rte_flow_action actions[], @@ -1637,6 +1668,14 @@ struct nfp_mask_id_entry { } } break; + case RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP: + PMD_DRV_LOG(DEBUG, "Process RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP"); + nfp_flow_action_set_tos(position, action, ttl_tos_flag); + if (!ttl_tos_flag) { + position += sizeof(struct nfp_fl_act_set_ip4_ttl_tos); + ttl_tos_flag = true; + } + break; default: PMD_DRV_LOG(ERR, "Unsupported action type: %d", action->type); return -ENOTSUP; -- 1.8.3.1