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 E1E6EA0032; Fri, 21 Oct 2022 10:06:25 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A8CF142C62; Fri, 21 Oct 2022 10:03:20 +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 828AF42BCE 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=E6+O/yUl8QvjCWFC12GUS999RlGAnpLwRNgcp5eT9/Otr1r6+QWF1tL2NaLIOu1rbMH1bMroMGUrS9S2dC4Dde1ZiW/iuLvS++AIxx/srVSPsH1zWlA2uoU2QFiH3fNOcGwolxcbC3i60fRqc/YRcZS8B5fCImwiTMlNKG1bVic+696E+sxd9bAcGvqwDGjYdjRGWpUp50npMPOZzDjpwcB+hhyrbAjr8kmTSDL8HgJ86UkxMqaUqyDBXltZ1CRV0jYyPzVTsM0+QBSkBgSERs9878lNDY96g4Xza2MZ2uhBmu4VLDfvCiDpZ/Clh3AvhPqYhfAToqmbyZ1va6+2UA== 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=UvgIm79OHRuywVETEDajV1+jJ4cpXi87MmNMw80vmJY=; b=Xa4BWXUXCiicCCMxTnuijI24nW+CbQ7duVbvzUTo81PJ6pkgCMN9RNgpK9vVfV9/Qr9IkoMWNvL/zzr8xCKq6agZPNAxquSmVKbNuMT+TZIV1SSPM/cY80zroAWPjdSI29efswl6K/z491AT0l/kqEJxs73GSd88EseHRm9AahPb86BlVGxwOB4KN30Fgrd6Qk0TDBt/Se1hqAHKk6aSWpSpm+jknTrGFfwLeT6YW5nsoD4GnGrAt3HzOs+1WkEhzmLCiyCIEwYCjjMWl0VBTshzUlI/0Hp5EDzwQrvxafIWji6SpcijPhR7FvhSugwmOcilgdRjxae6H8LFcG5PPg== 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=UvgIm79OHRuywVETEDajV1+jJ4cpXi87MmNMw80vmJY=; b=jQe/tBVCWOWEtY9l+xfMXfe+EK7EJdqRxJ40vDZJgXdHZQakC9FDnj0ROg7VYs0wZfqhrs1/L6XVWBe6OpyYm1Jb+PAO8Q2DKOReRN0g/1lWlIjWPbOTVbszROIHdfS50nxLAVmK//HNHKcCqJk9+RF7jm+mHfAAbG72Z4GU4KU= 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:12 +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:11 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v6 25/27] net/nfp: support TTL flow action Date: Fri, 21 Oct 2022 16:02:01 +0800 Message-Id: <1666339323-24016-26-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: 69d4e8c2-2099-4d5c-42ed-08dab33ab2b8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qzZPjjImlGl/QBTP0/uASiLGNiIgnVpOYzpuzlx6Q1Eb3/0aGP+Ly3Y1ifvPoYLztSSdOMaXYHk1oTuIHFyuLk9FKm6Klq7SCEJ7zqxcWtL6oVBWnZdpsymmKd1ohyYu0ck4xVgtYjMB8GU/LUbtBv0x5DaS+Bs+ttfGU75Ji85ZfHHwqVLRdPIdf1f6XyAI/O9XmGAT6EM8DlYwKin90+xliE/fTAJFaxazVit4L1llrhUeJLND275hKxpMagquyme8e2zxm5gdesrsWgE8i/WyppzFhuUWLmtRI/PVGgv3LEICNErIvJ52BMbDnxQ2wUbsDNSUTRFkbjRfwgV4ktjR6fXDFT38gPCxTr+ONitZKV/EQ7yVyS4oeoBDhJDGYqmOxQNP5HkMbSAjgOSSQQHdNL8NwNq3dqjxBgv//vyNszNukx4EFTVKok9wl5B+4HHt2TCFHvSo/CD0lgMGAsn6UveWq5usMkStLpFHz9abL9ydwGwat3LVx8EEXnm64kzVUGd/vGgP5C3q1q0BgHfzEY6616KA4V3NgC16udIc8XEmvTmyLG7tJjanJXCqHHMzuny0tREwkREzsAjrktKzSfYb0/w9K9B5hH8Z/TMzq039nL4GI3NzYFw8XF/HFRpUhVXY3djWt3ZRika2AVSQTOk5a7hBAmas+nyZ75Eoi/Dfx4ZZyC3D3datsG2J9ju8Ojt6HkxRCPwe/DwwBgxWr0scg9L40G0nbS4NklQvwklxRl4uYln05XJh0ONyC9NcuoHPRhC9vQdt1rJLBw== 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)(66574015)(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?SkphVE56dU9Jd3dDSGNxMGlCR2htZkhxOGFPVkNDTTdKTUR4QUxXUnZSSnBT?= =?utf-8?B?bndBZ3VKZW14aGpPanlWUmRGVlY5cVVXbHZxNkF2UjN2YWM4WTRSdmJwc0Uv?= =?utf-8?B?WWlTQ1N3L095TVEzQXRDbGUyZFFVOHpGdnNGRGVLeHo1V0VlbC83am1Zb0R1?= =?utf-8?B?OUxGQ3dhSmFJbDFXL29SVGtabExEYTg1WUdhTHgxajB1a3NRaTB5QVJCZkdt?= =?utf-8?B?UnNHc0lsZmIrWTBpWUdjSWRIZk5mM0svZVBuNzhLRHZKaE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RRVTdJVVFWWDUra0RSYjl2enNSdlBEdkxPbWlJaWpE?= =?utf-8?B?cFVKcEdoU3dZZlVXYUlCRUp6andPeWJPQzV6WjlxZG40bVVJcTZwR3hHYWNi?= =?utf-8?B?cHc9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 69d4e8c2-2099-4d5c-42ed-08dab33ab2b8 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:11.7366 (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: 8lrmRRIOjVpipiNW5c/GxYkG/ziITi1KTqllOXHRf+TbHNV2/lX+PpMe8ST/zXASqmS3oAy9I556MNkQ8SVnccR7co/J3qgXkU1az/Z8ObI= 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 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 666dd8c..a4c14d3 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) { @@ -654,6 +656,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; @@ -1431,6 +1449,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[], @@ -1439,17 +1503,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) { @@ -1553,6 +1621,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