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 B0B4BA0A02; Thu, 20 Oct 2022 04:23:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D0A0542CDD; Thu, 20 Oct 2022 04:21:47 +0200 (CEST) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2121.outbound.protection.outlook.com [40.107.101.121]) by mails.dpdk.org (Postfix) with ESMTP id C2F5F40A7D for ; Thu, 20 Oct 2022 04:21:45 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C+hEeJLKjyBdOaOB7ETwXM4sxDPgypknSQeROBYyqswhtb34rKOzW36q6jufRiqmhQEe2F7GK8Okw1+vjyYppjhZshoNOVAyxxJiF29TqxPeS5y+wWj6LRGwNo4dsx8aIbzRRuKYZ0FY5y1UCBnSB1488j9gLOzVtnuQXaFoZ1257GexhLWgqnxPUPhLjsnP98a/xo+okGkdodUstHnrrCQiccVvIn0ewP3/gaH2+Vvh7hlFvcREwAR2HhmzGOiSakJva8wveWHNa/uMdjaH/nyY1KvBBQfuWhLJRJ5F37aJ5Kccp6EfJj4ZLoEuoUGYBQpDXZ6FRdRb9FSLRJ7Ndg== 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=4FwMDBboTQWmBS4PDeCLzcIiRQthilhMA85yw5zaQYI=; b=OM6JPnAJe90My0J5IICr1bAnUf+RuGR/nBq31Z3d2gF2ZtmsjdzyBz7ogHC0mc46TkJQKM1K6hcJrTj8kMMi74szu0SqXTtn5fvkTHzXO5X75H4YNVYxgk9HIn0nnSc9V6E+dCeMDoVJbsnnOM7w1mNOBws/dXBnwPfuAxp5cEIBNTHuEJdvQETQFlyDwuKSi0OQbAV/bol1slRnNdGQ3WihXQ5B8ezyS1Qld+nV8s1l14EOOhvnyz1BMCHl2jfJnMh3Sz0Lhzh2VW52EZy1PJQpnpazkded/p3k1yT+4sVDtwKmHhypo+rGWfT5K/5BIf/kKHue2G2QsxZly2oT7A== 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=4FwMDBboTQWmBS4PDeCLzcIiRQthilhMA85yw5zaQYI=; b=gAwNsuGl2sKBjVUpfXDUY3unS1lqzrs6kwzjedMv21Nk+8YwNY+ACMjWetoyLY7hLBDZOoFy4scYxBMmIBAPo/6J9814piNe9ML0SIexCXzL/RRA6h9AtlQTw1HIE2jDZlxlCLUeFiFy2TMpjcA4ArqvIzc8ciS8ba7pMTRw3/U= 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 CO3PR13MB5784.namprd13.prod.outlook.com (2603:10b6:303:167::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.20; Thu, 20 Oct 2022 02:21:44 +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; Thu, 20 Oct 2022 02:21:44 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v5 24/25] net/nfp: support IPv4 DSCP flow action Date: Thu, 20 Oct 2022 10:19:50 +0800 Message-Id: <1666232391-29152-25-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1666232391-29152-1-git-send-email-chaoyong.he@corigine.com> References: <1666092434-10357-1-git-send-email-chaoyong.he@corigine.com> <1666232391-29152-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR02CA0048.apcprd02.prod.outlook.com (2603:1096:4:196::23) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|CO3PR13MB5784:EE_ X-MS-Office365-Filtering-Correlation-Id: 8bf08158-e1d3-47b0-1e27-08dab241d4de X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aAA+yOH5VfzhXKernv2wGSLwPHzOpRF8RgBW6pQSsDBCk5MD684NOcg6dPFpunx8NizO4jMZsrJmnCBqP2Yb5vNsF5W7v1rzbc5wfwebBnYut/eOk7DbZnlQFxYWbok7cSVYsAfGCXXyrsBCi2toFQ8Shurj4i/w6/jmoMAXrcG4octB2iXsvwubTPyGwqOek/twds5m7QRQ8av+FmWWep4/Ep536a2BKkU552UxOHawSaGI/7YXMWh4vZoCGqWdbpvU9504lvFdOkWe12j1eAtnvWAGIeYfAhCoc5+r8AfTt3hZzeH4wwV5w7LZ6d54zUl6xE8peVXABssjtjsdyRzvMZQV9+GBrANf+VXBHIX/1ZDJsCs1fmX2cGtlVKE0D0rnCRFZOuuQRSTn6ueVlGxHWUURQT5k9h2LhV8GVDuc5uED3f3O2OpbM1cxFkrHdoAoZPSATbqGidgXw19vnmeSwHc+9ZLcVSHmG/r8RlKpnwO1bbcrsFPWeL4xdOtu9ph9PazeDp/YBQAC2iOS6hwyX8/NYrLBFtJNuO+obxRgvYZkYzuzAwjV0xmr37YwDNa9qqJ93wVSCTsoTNjL4rQDsoxEgSdQ7nHwtihNbZMkwONaVDbPOM9c0BLzGdRZfOsHehr5yPcfv8XnEeOuwgYxfX5fmiqx+mzsWr+VUG1bwvMG7kwkOM7KkYCuxxpOl2QHiYvfEj1IONK5qDDL4lcesKzWApAG5dN5oUg5531p/2JMS9XjUcBmh9jb9fxuZ2+uVRVx7VHGq+UOkmlEJQ== 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)(346002)(396003)(39840400004)(366004)(376002)(451199015)(6916009)(44832011)(2906002)(316002)(8676002)(478600001)(41300700001)(66556008)(66476007)(6486002)(36756003)(4326008)(66946007)(5660300002)(38100700002)(8936002)(38350700002)(2616005)(6512007)(52116002)(186003)(86362001)(6506007)(6666004)(107886003)(83380400001)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?TGViT1dKTHRJUnN0cDYrWVJHZ1VLS3BkRDZZcnpKUTNFMTNpdkxVK0Vpc2lX?= =?utf-8?B?TWFVUFlUak5aeHdSWjJlT0ZReXZEMW0rOEdVbnNWamo2NnFjaGZzdFNSNFFZ?= =?utf-8?B?SzU0eXNIQW5RRWRyNE00aXZ2UDRxbHVnZXJ1ZlpZU09zQVpGZzYxUTdJampo?= =?utf-8?B?K3dMbzZCbWVpbm5YL2Ria3lPdEQrSWMxNU1kNUE1WHM1MVNKaVNCaEdLZG93?= =?utf-8?B?M2RSWjB6STFPcWJ2WGd6WVNPN3l2QTIvTi9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kVKTC90?= =?utf-8?B?MVB2bExWby9GcXppWTRRTVlEK3V3SEdTcWZDWUFOTUNyWHpHaThMS2pGZEw0?= =?utf-8?B?SmEzaldZRWpLcjF5VU42OElET05iR25ROTNjVDNVejZUdFVJOVJ3NFBCMjVD?= =?utf-8?B?bFE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8bf08158-e1d3-47b0-1e27-08dab241d4de X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2022 02:21:44.3415 (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: Up3sQQlXEbVczSeTV47sGDudGmdxeg1LrpisFh3u7skObFclqQ+12lsZSgoT9QI+yl2b+HwDMejsOTt2cQ0+tHnpsP2JrHKs7QEyzFNw+/c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO3PR13MB5784 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 9b1e8dd..dfcd784 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -678,6 +678,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; @@ -1501,6 +1509,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[], @@ -1649,6 +1680,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