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 BBD98A0A02; Thu, 20 Oct 2022 04:23:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0393142CD9; Thu, 20 Oct 2022 04:21:47 +0200 (CEST) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2105.outbound.protection.outlook.com [40.107.101.105]) by mails.dpdk.org (Postfix) with ESMTP id F3FD842CD3 for ; Thu, 20 Oct 2022 04:21:43 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CpubECGMgKMTZQbM4px/lnWgrdmcQa9MGJnJ9+LS7KmhqudcMOVYLoIE47nlQ6mkyY+WkfZeeEHthTUdrSJLogZ7BYTYc7H7yw6+JPO/nGTKNjMtCrrVqypYUU8TkWnCYYdMwdOoxp5aVxmO3jZIscQP1vgQtQgITJz6D5GF8Y/ZP5STfn4ZGITm3mBH41nNKAKVBZf38lDKI7CBShA9Z535IGBrVYKxG52Mv2wFSWAfm/oEaY4baJjFCNG0xQ7Wdwgx6wx5JjyL2EMr1S+NdzdcFSW+KaMcE8d+jQbZ3HtzCj9HMw02NH3ROUw/oDv3x+YFUrTH4P+/uXmTjate0g== 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=8+vrubmbHQbjKMZICC6TX38pDcz2IPoC9Ix3RNdzdmw=; b=GZoB579MwGGFaRFDn3Tce8yR3ABKPoTXr44XCh7ZGK3TQyJg9t68lyUluX4zqDhOzhEfmQNmCx3qwgNW8UljKjSj/Wh0VVOhtfO7cT5SOpKAwAs4s+ywzv9IWY+X8hyAB/aXKIMJEyKWKwjQSx7Fz4u48Kt/wsflsKddMU8kfYuxWg4nOFyykNwu2KNA9BpXnYEG1M7BhVZ/F6E21ECr5fEnid847EyRB60IUq79XjXdabQqyE4dEA0PeEWbiIG7pXblupOgz0AMXG+BpPvy2/1UKMgAvvDrCYZh0tmWV+2v6/Opyw/1KAdBCxxsqCYLqOBKQkugnxa1SGtOr8Jvdw== 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=8+vrubmbHQbjKMZICC6TX38pDcz2IPoC9Ix3RNdzdmw=; b=hfLsu4BFwt74cLNk3EgryHp7qj5M9/rWtZ1jHd8KWxRfWB9Jzn4c9WKS1NL/kpo831s727+Q1HUWrJDt1PPbN8XrcK2B9dGaLgMODv2TYqmrVuJtbjCi/Bos8VR7/c6n0ir4gGL16UOia2DlM+O0ly02OwRuZJjBe+9rwlQ1LVA= 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:42 +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:42 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v5 23/25] net/nfp: support TTL flow action Date: Thu, 20 Oct 2022 10:19:49 +0800 Message-Id: <1666232391-29152-24-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: bf9ff67e-4a20-422c-bb04-08dab241d3b3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hpl0Ujz6Yi1ElWui3QglSQMpozSjKvbsmqugoghS5f7sHbD4CbP+gn4Heb1kJiMQiMmeWevz3cmUzyEUuH5rweUPNd/8NFHo7CF4ulLQbh02hdgqF+v1UURSgx0Pe6hMo0JWy82nZ/1gd4v6TWPKpw3UqMTiUWI5nJCVn/JBcU4dek+dgRR0bycOlIikJyC6UZw/Jqtt0DXRnTJTvG+L/tv1vJNUUX4NahHVf4iDlyKv6SF9uYqeOJWohT0/OSdtCTAOvgUeF/tUkdks7vQRlmeAXyGn0wU8TNR4t8CWH/G+vSi1zNEAZTSCc8J7gDEz7BXB2eYNiA4gL4OjaVU+XSzHjVBNbus/PmNpjsXL7fMkWW6GhlnaQgMgEYTj/UXZ4GZwO+YjXxDjZ/53MOfQQWRnEE1AZ8sjzeJwzLI5lOlGl4zOjvxq4Mb8M8+KeRMJgdC+F5fpyIRM6zO4fMgxIY2J3LjdXzYJ0OE8aQUBeC0Y9/DsBK/rB7wt77Xbf4CQUBRtB7u5VgY7gZp2Lu2RQtE+AOe9yzHjxGVSQt2fFVCUQRVEgT+HUrQ2UXPzwDMQtBKaO5CYJMD9MtfSmzr7lHR+QnM2ir69DlJUMoiXXm7cM3B8c7L5oKAWSJg5Qo5ewfD+/OI8vnlBWLTCUjPXvXwsoxD80rBVHThwEPupBu4RTsc8yrJImNQaVMHInhPOeLAb4kAFNQK4YryLDR4aPgdTMJpbSgqHbp9Ya+ekS652uXKHCDOmQMGhLPFAeQwYgMRFzMY9uF+sCp6gzflh+A== 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)(66574015)(2616005)(6512007)(52116002)(186003)(86362001)(6506007)(107886003)(83380400001)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?TUdoeFNvTjQvOUR1Z3V0UHNpM0Z0bUlhNXRKdXlhNnNkaVNreEtaQVdXM1Nq?= =?utf-8?B?Zzdva24zaFVyOTlBYjcyWG5lVWFpK3ZBTFlSSjVSaFdzZ3AwditTRUtteStD?= =?utf-8?B?TTJVWktEMzZPc2dJRzB3bkxtYnpNczhlWThMWitnYllVSlhFWTczSHRkWFlY?= =?utf-8?B?aWFka01HbW9RYVYvNmp1VDdITnlLRE1zYm9nVm5nNHl2NE9OYnRkWU1XdlVi?= =?utf-8?B?d3d1WlNXZ0Vy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?RHExaDd0WDdXcjVoSTdBODB3WDZFaFh6ckxBN3U5UXFuYng2V1VzUFFqUjAv?= =?utf-8?B?NTNsdWZ3VUMwcmMxY3hGR01FVG1XVnYvcmVyM2xoWVZJY1RQN0ZqWFo4VG1G?= =?utf-8?B?ZWc9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: bf9ff67e-4a20-422c-bb04-08dab241d3b3 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:42.2298 (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: U2VSvWcEzOB8mjD5ihss1XGfdM8/o+LpK0nFAJRCWGBsJOU01Vsp4jyO98S7JcIdvl8bq6sVAD9K2zxxgMNXBMazZ/XVEQMmkVyhP5oG4z4= 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 data structure and logics, to support the offload of set TTL 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 | 44 +++++++++++++++++ drivers/net/nfp/nfp_flow.c | 84 ++++++++++++++++++++++++++++++++ 3 files changed, 129 insertions(+) diff --git a/doc/guides/nics/features/nfp.ini b/doc/guides/nics/features/nfp.ini index e8ccd6a..1283583 100644 --- a/doc/guides/nics/features/nfp.ini +++ b/doc/guides/nics/features/nfp.ini @@ -52,3 +52,4 @@ set_mac_dst = Y set_mac_src = Y set_tp_dst = Y set_tp_src = Y +set_ttl = Y diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.h b/drivers/net/nfp/flower/nfp_flower_cmsg.h index 26de8b1..6bf8ff7 100644 --- a/drivers/net/nfp/flower/nfp_flower_cmsg.h +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.h @@ -400,6 +400,25 @@ struct nfp_fl_act_set_ip4_addrs { }; /* + * IPv4 ttl tos + * 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| ttl_mask | tos_mask | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ttl | tos | 0 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ +struct nfp_fl_act_set_ip4_ttl_tos { + struct nfp_fl_act_head head; + uint8_t ipv4_ttl_mask; + uint8_t ipv4_tos_mask; + uint8_t ipv4_ttl; + uint8_t ipv4_tos; + rte_be16_t reserved; +}; + +/* * IPv6 addr * 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 @@ -433,6 +452,31 @@ struct nfp_fl_act_set_ipv6_addr { }; /* + * ipv6 tc hl fl + * 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| tclass_mask | hlimit_mask | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | 0 | tclass | hlimit | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | 0 | flabel_mask | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | 0 | flabel | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ +struct nfp_fl_act_set_ipv6_tc_hl_fl { + struct nfp_fl_act_head head; + uint8_t ipv6_tc_mask; + uint8_t ipv6_hop_limit_mask; + rte_be16_t reserved; + uint8_t ipv6_tc; + uint8_t ipv6_hop_limit; + rte_be32_t ipv6_label_mask; + rte_be32_t ipv6_label; +}; + +/* * 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 diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c index 93f4c04..9b1e8dd 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -561,9 +561,11 @@ struct nfp_mask_id_entry { struct nfp_fl_key_ls *key_ls) { int ret = 0; + bool tc_hl_flag = false; bool mac_set_flag = false; bool ip_set_flag = false; bool tp_set_flag = false; + bool ttl_tos_flag = false; const struct rte_flow_action *action; for (action = actions; action->type != RTE_FLOW_ACTION_TYPE_END; ++action) { @@ -660,6 +662,22 @@ struct nfp_mask_id_entry { tp_set_flag = true; } break; + case RTE_FLOW_ACTION_TYPE_SET_TTL: + PMD_DRV_LOG(DEBUG, "RTE_FLOW_ACTION_TYPE_SET_TTL detected"); + if (key_ls->key_layer & NFP_FLOWER_LAYER_IPV4) { + if (!ttl_tos_flag) { + key_ls->act_size += + sizeof(struct nfp_fl_act_set_ip4_ttl_tos); + ttl_tos_flag = true; + } + } else { + if (!tc_hl_flag) { + key_ls->act_size += + sizeof(struct nfp_fl_act_set_ipv6_tc_hl_fl); + tc_hl_flag = true; + } + } + break; default: PMD_DRV_LOG(ERR, "Action type %d not supported.", action->type); return -ENOTSUP; @@ -1437,6 +1455,52 @@ struct nfp_mask_id_entry { return 0; } +static void +nfp_flow_action_set_ttl(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_ttl *ttl_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; + + ttl_conf = (const struct rte_flow_action_set_ttl *)action->conf; + ttl_tos->ipv4_ttl = ttl_conf->ttl_value; + ttl_tos->reserved = 0; +} + +static void +nfp_flow_action_set_hl(char *act_data, + const struct rte_flow_action *action, + bool tc_hl_flag) +{ + size_t act_size; + struct nfp_fl_act_set_ipv6_tc_hl_fl *tc_hl; + const struct rte_flow_action_set_ttl *ttl_conf; + + if (tc_hl_flag) + tc_hl = (struct nfp_fl_act_set_ipv6_tc_hl_fl *)act_data - 1; + else + tc_hl = (struct nfp_fl_act_set_ipv6_tc_hl_fl *)act_data; + + act_size = sizeof(struct nfp_fl_act_set_ipv6_tc_hl_fl); + tc_hl->head.jump_id = NFP_FL_ACTION_OPCODE_SET_IPV6_TC_HL_FL; + tc_hl->head.len_lw = act_size >> NFP_FL_LW_SIZ; + + ttl_conf = (const struct rte_flow_action_set_ttl *)action->conf; + tc_hl->ipv6_hop_limit = ttl_conf->ttl_value; + tc_hl->reserved = 0; +} + static int nfp_flow_compile_action(__rte_unused struct nfp_flower_representor *representor, const struct rte_flow_action actions[], @@ -1445,17 +1509,21 @@ struct nfp_mask_id_entry { int ret = 0; char *position; char *action_data; + bool ttl_tos_flag = false; + bool tc_hl_flag = false; 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; + struct nfp_flower_meta_tci *meta_tci; struct nfp_fl_rule_metadata *nfp_flow_meta; nfp_flow_meta = nfp_flow->payload.meta; action_data = nfp_flow->payload.action_data; position = action_data; + meta_tci = (struct nfp_flower_meta_tci *)nfp_flow->payload.unmasked_data; for (action = actions; action->type != RTE_FLOW_ACTION_TYPE_END; ++action) { switch (action->type) { @@ -1565,6 +1633,22 @@ struct nfp_mask_id_entry { tp_set_flag = true; } break; + case RTE_FLOW_ACTION_TYPE_SET_TTL: + PMD_DRV_LOG(DEBUG, "Process RTE_FLOW_ACTION_TYPE_SET_TTL"); + if (meta_tci->nfp_flow_key_layer & NFP_FLOWER_LAYER_IPV4) { + nfp_flow_action_set_ttl(position, action, ttl_tos_flag); + if (!ttl_tos_flag) { + position += sizeof(struct nfp_fl_act_set_ip4_ttl_tos); + ttl_tos_flag = true; + } + } else { + nfp_flow_action_set_hl(position, action, ttl_tos_flag); + if (!tc_hl_flag) { + position += sizeof(struct nfp_fl_act_set_ipv6_tc_hl_fl); + tc_hl_flag = true; + } + } + break; default: PMD_DRV_LOG(ERR, "Unsupported action type: %d", action->type); return -ENOTSUP; -- 1.8.3.1