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 8CB9EA0560; Tue, 18 Oct 2022 13:30:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0769642BC3; Tue, 18 Oct 2022 13:28:32 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2131.outbound.protection.outlook.com [40.107.93.131]) by mails.dpdk.org (Postfix) with ESMTP id 12C0042685 for ; Tue, 18 Oct 2022 13:28:28 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HLwft7xlihvFl8gqq0icu9A4AEAo811J0A+UnMs5pheFBKS9mkLgH0qCcx52//q+D7ou3/OOXt8R13XsseMMjBVhS3M/oIs6UFNf9bUKjhgnWAqg7J6Bw8qLr4r2Vi3KKGaHctq2q36DF0cjvIADU1nclMHTbTdiHl/dpfn7X5i6vPH+S9xpGxxZZsg+pzWXxCilIIDkM2UR1hrTyb2BC6JbWLP+pxPkRAhC2tXata7JPfDdY77mQP3mogw2iirapCTDp207hCLkoOT9T2Z8icuszcwytxRW8HKmS0Pd6v/M35ypYiv85VcPwBXYYxKbNQsrJPITBD19bZXLPT+usQ== 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=1cy9wQMHXPV9ilherBHAapH/vhm3dcAnLxc/tuKvf58=; b=KSUErg//w99no1CRxYHy9AD+Lp3U/68qlMogUNYordnIllG0EDAVsoEcnehxYbAoJyfNCe+tKlGJv0VNIsT1BaeY8StO95lOi7IIVtkPy2VFvq811yj/j2Amivc1xkHlXf+NX4ID3iRH4P/QQlPUrbLs3/Si2mt5CblsqKcYq7rfsFQr7JgK/gEAk+tdZQIuGLDpn/smMwP/S8hsZK3j/eMc47bq+VGk89QSJz5zRvyWFoAWRchKtUafMFM+upRH/xlsEpxeA8DzOq5SOeq4y8med8+htp76ylh0VGh8uxXOXeWa6WsyP1ZiTdQ9j1hxnsISRH9vfpwodCOM2Ut3Vg== 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=1cy9wQMHXPV9ilherBHAapH/vhm3dcAnLxc/tuKvf58=; b=O1IggTA0A8nANahfXmaOBqQ0wr8j4l2whHuBz0xR7dQRJFCzo3V7qLEBXu6kEEG1V8yx0vPeEUaN6Lmi6Jf4+RHu22z3KfVPCPo+0x2uEP32Foih2TJm+wfV+wjwqDfAbXCI38VheqpgzPN/0aId6HJ2QnOWS4JyCH4d9TTBxnM= 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 PH0PR13MB5975.namprd13.prod.outlook.com (2603:10b6:510:16e::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.22; Tue, 18 Oct 2022 11:28:26 +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:26 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v4 24/25] net/nfp: support IPv4 DSCP flow action Date: Tue, 18 Oct 2022 19:27:13 +0800 Message-Id: <1666092434-10357-25-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_|PH0PR13MB5975:EE_ X-MS-Office365-Filtering-Correlation-Id: 758bc2df-1bc6-4085-18b0-08dab0fbdfd4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AyaKhZhZG320/dpVsK3XN1/TXi6WMruAJFIKhwMaAeicL8StTisVvpKZVFYOfuhSDzMaZ+NGomEJrbqXiv/YV4DJ3rlNw67rKDVdRG5/POk7zj1+5yhAihU3mLFJRGiMIXmV/UExRbv0WIiVVgmZkPQ4QLtzuDeKEx7i8GBNdDfUxwdz/CfZHuTgRJqi7vQM5gOiLXILPiOo07UxGta3dXH7HCMaeeBpWx/fT/8BkXPin38NFOuAJMpRrdHArOd/4p2NT2Z6XKkiaRJZeaQro7vasvsK4Hs8v/XVfcV+aQnL9ANPoJ0ZxlbzS51nqBC0HWjM70TiUjXjYTCN2KjUSu8R9/nncQJHWGiNfxx6eq5rNHbzHMVfWqyykd2IqvVF1e+A97dMPiznSmcACTYd2VcyavbUKzLoImyrOEalm0m5SX36zR17GF7IUAfnHhGtrPIJCJtqa1mI1qjJA37UNgbccpCgiA6rZUcIy5kVYA+w2swmDUrOjF9fenYPWJHjYMHGe6F1GV62oZN7qOWpzfZErei7yE0V6+VJG1G+B/xKTUADwtmmVCo/JjUWRIPOpPAkU9qIp4kbxRI3UYqBC9KvWhq0AukR54vxNlZaN4JYy+e2dneU3TD3833Z06uEJwrpFB9vpfDJiYb7pqcbjPCQ7BAXfYIXtmjXU3t6qmxCwf5gMfFufEOh7xc6W/nTB4Aka7n6PER9tOn7+U+4iMx7HXxEw4rrudjckZHpcrlGXK56NmbWWFcZ/xi2E/OR6jyQQHPHadUh6HzDWySegau+UMFYBuuCHTufic+Xhf3z183aaNbi7lEoH4/HKqRX 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)(366004)(396003)(376002)(136003)(39840400004)(346002)(451199015)(52116002)(86362001)(186003)(2616005)(83380400001)(26005)(107886003)(6506007)(6512007)(6666004)(44832011)(8676002)(316002)(41300700001)(478600001)(6916009)(2906002)(66476007)(66946007)(4326008)(38100700002)(36756003)(66556008)(5660300002)(6486002)(38350700002)(8936002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ZXFucVBoMCs3a05GMXVjbTE5QUVQdDdLM2IwQU1sK0xLdDFNSld2OUlYMEpU?= =?utf-8?B?RGNCWkx0ZlN4dTZaQS93VDd4d0NqcmFNZ0JyRlp0M0JUdnQxdHJpNUhSb0l2?= =?utf-8?B?alhQWGxKSytKN29OcGYybStxRmYveUZOV2tISE55WjFHVExRVHAzMzRqa0R0?= =?utf-8?B?VHlmY0c5Sm4zOTVDR2xDZzBoS1oyY3RZaWpvNFNJVTVUMkpKbVlEYXlFY3FZ?= =?utf-8?B?d0FjN3BPMWhzcE1XRjdUaW5NNjhWbmlBTVplOXpMYXNOU090OGlPOVg3V1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WpmelpzSHlVSlJ1NkFUL08yZkg5d1I4ckV2MTFsVi9iQk1scGlD?= =?utf-8?B?bFptMnNnQkx5TEJycFYvWitYZWxjVkY1RWQ0SW5VN2xjcTZ4L0Jlb2lrM3l0?= =?utf-8?B?aEE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 758bc2df-1bc6-4085-18b0-08dab0fbdfd4 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:26.7657 (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: CvqelFZpLiS8fa0op0DE6Ha/4j3y3ahnL5ZQg+5Ag4OHwUjePByXp4qme5LACJ3KTU1Lnoe4zyMKB0yKLIwpJ8D6YfaP5YCei+V6xoW1s/M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR13MB5975 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 2e79935..d2b4188 100644 --- a/doc/guides/nics/features/nfp.ini +++ b/doc/guides/nics/features/nfp.ini @@ -45,6 +45,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 2f737b3..6dff973 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -690,6 +690,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; @@ -1513,6 +1521,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[], @@ -1661,6 +1692,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