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 657BDA0560; Tue, 18 Oct 2022 13:30:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B842842685; Tue, 18 Oct 2022 13:28:28 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2113.outbound.protection.outlook.com [40.107.93.113]) by mails.dpdk.org (Postfix) with ESMTP id 3AD6F42BAF for ; Tue, 18 Oct 2022 13:28:26 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eYHZRlPFz4Rdj6zyRH65EQeQyl1ygkOzRJi5vEw4XC0nTQLK0e15ouWT4PpADfyxa7THf7httLfGFHFTHhid+iZK9+fIalJI00MHkPmKT1ewC7s5XBNzJ+aIlo/e3WPTHwf2hqddie+L76Rsz5m2aUdHAVt3icAglBUvns+8IDgkapls2PB8PeyEFZkiEtRKvU28fwPGTvDRr6DSjNpfd+HIeykGefnggJ5GCcMd/ZEcSBw5Zg+/ChID2pfc+UJq/mgPdt5Uxh1zKSg6ebLhH4l/wKKf2QXsB8JptqOZcug3uHyKvwhWtXTTjhJEBBy57H59zNwEuWQMJjvJen7+Iw== 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=IXUrQjV41P9lPRlXPhaV0b/Kxc6YLFKyrl7AkB/546k=; b=lPxkCHfVaBUEHNYYoHAyXVHandXDSpprgPrn6v2JNv1zFup283uKGaJyRfmm2URz9StMMgqP4C9OG3srtSOdp0J5F3LmDLJHRV1gcz9MngdZLoiOwuOIN789rz/aPOn5+IvB3W5hdLXNENEGv6K6YaRrjQUxS7a8AszAROvgy45o1f8AnnrCDaTT0U9bsN+TjI0shznr0iWQDfTKApU2EPguvCLw3kwElE0bS+efcQqjJqSpRtUtlHU1U7Qoc/TEJLpUaj79TcOmsO4lU1ahmxeJJ4nigZaZLK1GsQxNSSuEAXlH5oiCXXAvcfpHUN+QoHlm+UkJDX/nwZqlkKg0Rg== 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=IXUrQjV41P9lPRlXPhaV0b/Kxc6YLFKyrl7AkB/546k=; b=UFn6pKO4AqLNdb3SFY8sjfb6c4kpgIZD7lG213xKoDPXv6oB7q3r+oMb1Z9mXSWEFU1HC53BUVNKqbKvcBZ5BG/F+6L/HfbnBMx8TEocJWaBpTuE1kXkioGO3SkZgw4HwRFrhYVvslt9/1g78TmEq23cDJVwVjytOZHwSYut1Wc= 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:24 +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:24 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v4 23/25] net/nfp: support TTL flow action Date: Tue, 18 Oct 2022 19:27:12 +0800 Message-Id: <1666092434-10357-24-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: b1fd4696-d952-4335-4b64-08dab0fbde48 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wsqJeDvy++ChTnlIgiH9qu50bLJrgzWn1H08MFlyUlCHx/S1yijc1kuRaTMGjlwOJFlIlxMxGBzQoCMoqH65S8SZo6tVAQ3t+xI4Z1AeT40H4iaiNhz7E24bftfMgTbioK59txjweRmCsguUFi8KT6+O5XMrA7ufNsArfIRuXh7hwYMNQ4tHZzWrDuEb9iCREmbsUGneQTX335cWHSUEDV4MaTtDQdehdZT52DA7o1AGqDLjmpnw+Vt3FgK/mJsY01u2xODfM/IogZGEppM6eEBMRRzyiGBGZ6P0kxvJuWuk40s439zgTNvNjZShXlCc8kTpaQ4HHtEpo9KC+pwWytqC8XPzc9D0WgvVdNynKmjlA7IfpGDlgWFSDJPIyE74liMStwe/AeCwdubh0MRhmDwOwbKuiZ8mQFAYqBwaFdvSwmyAdfuxXFJlLiKZhasuEIa3PA6VrswKHKeBFKo50v7jvp/KLpWVgWpNMB1KkbpJ+/wuploYfF9BlPkx3SFIeurXwp3B7v5EnhglIGOqgNZjjVHCNhUWkKqFoXnl1y+rHSJh1aljLbXpscw8lHpW56c2obke4fiRgjkS9YsP8ZfD3k/rEChoYPUMuDG00IHArENb4fAwPgN+G6swMAQG0FFGjt7s4sl3FWiePWn5i+ejzMt0M/US5w4uRrF9w/nWk9uE2FP6pvkBpNqreiuWJtn+v4k3kYx5chprmQ8OW6BcuApden0ckLA0dm3Ko24doNwWSFwBFgiNUSggUyXyB9ctxGaoe+SlVzv0QFoC4avZKwYtINUow6dSRpZXF0OoBgRSZp6tJaYismB4Nnh3 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)(66574015)(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?U2VvMXZ4cUdhZEJsTy8wVGxlRXlZSzd1cDFPNm8vQU1PdlRNNTJMS0NmQUUv?= =?utf-8?B?V0FKUCt6aHpJdTc3WXRQUWp1OVY5OWVtNkpKZFplcEd2MWhsVnpXTERWNGRP?= =?utf-8?B?NDVPdFA5ZVZGWXVPU1NvSjREV0FzcWlnN1JpeU02SjdVcWFzcmV1RlpzUUR4?= =?utf-8?B?RHVKR3M4WU9SYVJjbmkvaFdXU3JBWUVEQkZrTzlubWo2eDhkNVJ5NGlOSTRZ?= =?utf-8?B?T2dNYUVORnU4WmtIUW1CV3lSb2JZN3hHUi9lVVJ2RTUza2V4T2x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?B?eHdrWEU1ZkZFRzVDWTVTeG9uUy9EQTEwalZqNjZsYkdxLzUwUnpidkFFam9w?= =?utf-8?B?YWx0eDErNCtGbE5zKzRPZTZzOExJekc4WVhlVVBYN1ZkU1BYSS9lMFVlV01H?= =?utf-8?B?clE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: b1fd4696-d952-4335-4b64-08dab0fbde48 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:24.4530 (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: /1LrlRJaTlqhFIqhDjNOiqdepxwjMEJKFAU4IQ4Xf3Zfk9mfyaYANuZzHlY5vPme/hGWlRUt6sWttDi29ngulkDbjQv/GUdNTb4I2JKrl9M= 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 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 eb7fb15..2e79935 100644 --- a/doc/guides/nics/features/nfp.ini +++ b/doc/guides/nics/features/nfp.ini @@ -53,3 +53,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 6fe4e6c..2f737b3 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -573,9 +573,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) { @@ -672,6 +674,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; @@ -1449,6 +1467,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[], @@ -1457,17 +1521,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) { @@ -1577,6 +1645,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