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 D533C45C0D; Wed, 30 Oct 2024 02:55:45 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C122442FB9; Wed, 30 Oct 2024 02:55:45 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2043.outbound.protection.outlook.com [40.107.93.43]) by mails.dpdk.org (Postfix) with ESMTP id D296342EC5 for ; Wed, 30 Oct 2024 02:55:44 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aTimNPIjxAhtdwYu1aHowc1clvT5UHp0mtu1zji2eVW5Ui/7ZQN2ClzFkXE+WhOp6l7E47GcZcheXBGmTE+RVBFOgY8DT8oPJH9DnADaYMEAVpwyOPfFTO+Xr7Uvj0OjL22HjCikcPNBvGYVIaNRhUAj/eLpKWV8tv184at69hIkj/ZLaIS/Fc/Qwi4Nhln0+Kyk8/pBW9dTybqNvEDqrSPgFlmiVNg99RDUk1YH1yUxR3J/nG2vcmNq8ZH5W7GGke9k27/Zzl1VSU20ll/lKsLDRjPJ7u13UA1ekNm0lpgGsp3ZqiGDjn9RFrnbe4Rdfgt2RXYUCPDxJ4k9ykysNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=V6mUA4iNPvsqo3iNtd3kLY3dIlcWhq52IU4RFBv9L5Q=; b=iGdqv8zaithjO7Wveo9wtoqIlFEGHDH/OHJa6gDPGZQ+F0wiXQ6g3fHNXtlMZfelgZG8BxGF6nmDPIy/8zqpX7moooXRqimlhYxKxI5INTxZIVqcbeXm0Qlw4532LWSQjE2UrBRIb56Qjdo7Tyx8qs3z+WSR04F1v00AG+giizBNdEwvW4dd4vvtGxMBVHWrtckoXc92VoHra2N6SWJLrR0JRk9x6VVUIJ0lzCe4U2RIt7TvzwiAxgmj1ykcYHOKH+GbmPlQxIBg6/wsFxXlNuY0j3It/FIv91COjTGnasXj+Wk0LS2unhwbqKGfSUjae+9JWhQAfrG5j7MgxgqZWw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=V6mUA4iNPvsqo3iNtd3kLY3dIlcWhq52IU4RFBv9L5Q=; b=WapyXUvKuSqnCuX8btI76DLC/nCdA6xtykELqtRMm+Gwd0qjLLNWPOzFuw8f/YsO6JJPgoQfYidDqg/Op1bVUehxYdk4rl1A7nxt5vkT+LKkV86ab9Dr3+uWKZclipmk/LNgwIuZO70McL0I1Fc7XvIRTjUmb4ub7NioKsNRgUQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from SJ2PR12MB8830.namprd12.prod.outlook.com (2603:10b6:a03:4d0::9) by DM4PR12MB6062.namprd12.prod.outlook.com (2603:10b6:8:b2::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Wed, 30 Oct 2024 01:55:43 +0000 Received: from SJ2PR12MB8830.namprd12.prod.outlook.com ([fe80::c3eb:df02:eaa9:2055]) by SJ2PR12MB8830.namprd12.prod.outlook.com ([fe80::c3eb:df02:eaa9:2055%4]) with mapi id 15.20.8093.024; Wed, 30 Oct 2024 01:55:43 +0000 Message-ID: <4b4de3d7-0629-4412-b845-f31cc37ef02a@amd.com> Date: Wed, 30 Oct 2024 01:55:36 +0000 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 15/86] net/ntnic: add item IPv4 To: Serhii Iliushyk , dev@dpdk.org Cc: mko-plv@napatech.com, ckm@napatech.com, andrew.rybchenko@oktetlabs.ru, stephen@networkplumber.org References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241029164243.1648775-1-sil-plv@napatech.com> <20241029164243.1648775-16-sil-plv@napatech.com> Content-Language: en-US From: Ferruh Yigit In-Reply-To: <20241029164243.1648775-16-sil-plv@napatech.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0103.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:191::18) To SJ2PR12MB8830.namprd12.prod.outlook.com (2603:10b6:a03:4d0::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR12MB8830:EE_|DM4PR12MB6062:EE_ X-MS-Office365-Filtering-Correlation-Id: 385ec5bf-c4ad-4fb1-15c2-08dcf885f676 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: =?utf-8?B?NHNUOGY3YlVaV3lnVE55c3Q0bHB4QjZnaFBvWXp2RDJLMzd6WlJVbkwrMUpU?= =?utf-8?B?Z1VyKzBQWW4wWnZ3Q3VnMGVZMVl4cGNmRlBpSDhGWFovaFpKY0lBV25Bb2ZV?= =?utf-8?B?bXRMODlsZFRiL2hCTFdLRTZDMERwRk1JTFlOemRpamh5U3BVVk90MXRMZ09w?= =?utf-8?B?SFhuQlVFWlFQeDBBRlMrVHlOT3VKRngvR2hkbzQrR3JkZDMzYXd3T2trSjRJ?= =?utf-8?B?QjZxaCtSVzBWeFhBRkE3aWVqNGI5ZkN6Z3R6YVJMR3NNeHlJZGtTWHV5NnYv?= =?utf-8?B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0bzdS?= =?utf-8?B?UDdESlZvalZDSmdtMTVRdTRQOUsxY25qWkJVeEs5Qkp4enVMTHZqVlIzdGJB?= =?utf-8?B?aEVaK3d3L3FIOFRmZTdONXhodzRnWVFXRzg1a3cvRS83UHFTNDI4bXUxVEZX?= =?utf-8?B?aURicXlEeS9PNWt1d29IT2RsNmZ4b0xCWnRVNEJqVjJQcXB5eUVFbnFtcXJw?= =?utf-8?B?Wm44eDhEMGVqeEU2b0lqZUZzNGZ5dTl1cE5YUW5heC9vMHhPbWNqSmw0emk1?= =?utf-8?B?QzJoT2ZpTmhNY0dnSE50SXc1bXRUdGdKYmduQzhqVk4xTWxoOXdqSzhtTmcx?= =?utf-8?B?WldMMXUyV215QkFSaTZBb3Bja293U0E0UVNNZlBvdDRidHBPNHdRRmFaclpr?= =?utf-8?B?RVVHTkE1TjVNNFgydDlPa3pyRGlRaTRvTnJyYS9oWW9HMytMZjJQcWR1QjJt?= =?utf-8?B?TTVjVmN3bW12V2Y0VXlDaGIxVjVFR0hxZ3crWTdMYis4dDJ1UmRZUzA4MHNa?= =?utf-8?B?dit2U0xkSlRBS0lIcFJTZmpYMGlJVXRISW5ZZUwxQ2Z5ZE9KeHlmY2Jhbkdh?= =?utf-8?Q?FrVHujImXuqvXwRuPoBV46LUO6/LvC4pZDr5j6F?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ2PR12MB8830.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(376014)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ZXRBSjgzSytzN204Y1RsVzRmVFgvL2xJQTRQcERpTWJ2Yng2YTlkc2dpY1V1?= =?utf-8?B?UW1Ja2FqSjFCRm92T3RyQkRmNFhGbWdROHREc3VMSXF2MlorQWFhT0NDRjFx?= =?utf-8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nUkdBS3Fk?= =?utf-8?B?c1dYNERob0sxMHNvZVN3MWdQTE41NmZxSHpjaEllY3lKUE03Z2NHM1l0cDhC?= =?utf-8?B?ejlNWHNXUzFyRlY4azVSK3BqK0hRT1FCYW9XZ3BEcTkvS3ozZG92R3RONFpm?= =?utf-8?B?aGNQN2xEMy9JNkNOQms2Y3VpSEhGU3U2ZmdVa0JUZXpsNm1DeDJhbjJOMi9F?= =?utf-8?Q?t0VJk2zVC7tRR3z3mMSlnL3fY?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 385ec5bf-c4ad-4fb1-15c2-08dcf885f676 X-MS-Exchange-CrossTenant-AuthSource: SJ2PR12MB8830.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 01:55:42.9727 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: pMIExk3gRfw9kXz5o32LDaPIkS/XkrLgaNBY3soTns1whJbzDIKMhxeI9yUZ2TOK X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6062 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 On 10/29/2024 4:41 PM, Serhii Iliushyk wrote: > Add possibility to use RTE_FLOW_ITEM_TYPE_IPV4 > > Signed-off-by: Serhii Iliushyk > --- > doc/guides/nics/features/ntnic.ini | 1 + > .../profile_inline/flow_api_profile_inline.c | 162 ++++++++++++++++++ > 2 files changed, 163 insertions(+) > > diff --git a/doc/guides/nics/features/ntnic.ini b/doc/guides/nics/features/ntnic.ini > index 36b8212bae..bae25d2e2d 100644 > --- a/doc/guides/nics/features/ntnic.ini > +++ b/doc/guides/nics/features/ntnic.ini > @@ -16,6 +16,7 @@ x86-64 = Y > [rte_flow items] > any = Y > eth = Y > +ipv4 = Y > > [rte_flow actions] > drop = Y > diff --git a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c > index 93f666a054..d5d853351e 100644 > --- a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c > +++ b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c > @@ -664,7 +664,169 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev, > > break; > > + > + case RTE_FLOW_ITEM_TYPE_IPV4: > + NT_LOG(DBG, FILTER, "Adap %i, Port %i: RTE_FLOW_ITEM_TYPE_IPV4", > dev->ndev->adapter_no, dev->port); > + { > + const struct rte_flow_item_ipv4 *ipv4_spec = > + (const struct rte_flow_item_ipv4 *)elem[eidx].spec; > + const struct rte_flow_item_ipv4 *ipv4_mask = > + (const struct rte_flow_item_ipv4 *)elem[eidx].mask; > + > + if (ipv4_spec == NULL || ipv4_mask == NULL) { > + if (any_count > 0 || fd->l3_prot != -1) > + fd->tunnel_l3_prot = PROT_TUN_L3_IPV4; > + else > + fd->l3_prot = PROT_L3_IPV4; > + break; > + } > + > + if (ipv4_mask->hdr.version_ihl != 0 || > + ipv4_mask->hdr.type_of_service != 0 || > + ipv4_mask->hdr.total_length != 0 || > + ipv4_mask->hdr.packet_id != 0 || > + (ipv4_mask->hdr.fragment_offset != 0 && > + (ipv4_spec->hdr.fragment_offset != 0xffff || > + ipv4_mask->hdr.fragment_offset != 0xffff)) || > + ipv4_mask->hdr.time_to_live != 0 || > + ipv4_mask->hdr.hdr_checksum != 0) { > + NT_LOG(ERR, FILTER, > + "Requested IPv4 field not support by running SW version."); > + flow_nic_set_error(ERR_FAILED, error); > + return -1; > + } > + > + if (ipv4_spec->hdr.fragment_offset == 0xffff && > + ipv4_mask->hdr.fragment_offset == 0xffff) { > + fd->fragmentation = 0xfe; > + } > + > + int match_cnt = (ipv4_mask->hdr.src_addr != 0) + > + (ipv4_mask->hdr.dst_addr != 0) + > + (ipv4_mask->hdr.next_proto_id != 0); > + > + if (match_cnt <= 0) { > + if (any_count > 0 || fd->l3_prot != -1) > + fd->tunnel_l3_prot = PROT_TUN_L3_IPV4; > + else > + fd->l3_prot = PROT_L3_IPV4; > + break; > + } > + > + if (qw_free > 0 && > + (match_cnt >= 2 || > + (match_cnt == 1 && sw_counter >= 2))) { > + if (qw_counter >= 2) { > + NT_LOG(ERR, FILTER, > + "Key size too big. Out of QW resources."); > + flow_nic_set_error(ERR_FAILED, > + error); > + return -1; > + } > + > + uint32_t *qw_data = &packet_data[2 + 4 - qw_counter * 4]; > + uint32_t *qw_mask = &packet_mask[2 + 4 - qw_counter * 4]; > + > + qw_mask[0] = 0; > + qw_data[0] = 0; > + > + qw_mask[1] = ipv4_mask->hdr.next_proto_id << 16; > + qw_data[1] = ipv4_spec->hdr.next_proto_id > + << 16 & qw_mask[1]; > + > + qw_mask[2] = ntohl(ipv4_mask->hdr.src_addr); > + qw_mask[3] = ntohl(ipv4_mask->hdr.dst_addr); > + > + qw_data[2] = ntohl(ipv4_spec->hdr.src_addr) & qw_mask[2]; > + qw_data[3] = ntohl(ipv4_spec->hdr.dst_addr) & qw_mask[3]; > + > + km_add_match_elem(&fd->km, &qw_data[0], &qw_mask[0], 4, > + any_count > 0 ? DYN_TUN_L3 : DYN_L3, 4); > + set_key_def_qw(key_def, qw_counter, any_count > 0 > + ? DYN_TUN_L3 : DYN_L3, 4); > + qw_counter += 1; > + qw_free -= 1; > + > + if (any_count > 0 || fd->l3_prot != -1) > + fd->tunnel_l3_prot = PROT_TUN_L3_IPV4; > + else > + fd->l3_prot = PROT_L3_IPV4; > + break; > + } > + > + if (ipv4_mask->hdr.src_addr) { > + if (sw_counter >= 2) { > + NT_LOG(ERR, FILTER, > + "Key size too big. Out of SW resources."); > + flow_nic_set_error(ERR_FAILED, error); > + return -1; > + } > + > + uint32_t *sw_data = &packet_data[1 - sw_counter]; > + uint32_t *sw_mask = &packet_mask[1 - sw_counter]; > + > + sw_mask[0] = ntohl(ipv4_mask->hdr.src_addr); > + sw_data[0] = ntohl(ipv4_spec->hdr.src_addr) & sw_mask[0]; > + > + km_add_match_elem(&fd->km, &sw_data[0], &sw_mask[0], 1, > + any_count > 0 ? DYN_TUN_L3 : DYN_L3, 12); > + set_key_def_sw(key_def, sw_counter, any_count > 0 > + ? DYN_TUN_L3 : DYN_L3, 12); > + sw_counter += 1; > + } > + > + if (ipv4_mask->hdr.dst_addr) { > + if (sw_counter >= 2) { > + NT_LOG(ERR, FILTER, > + "Key size too big. Out of SW resources."); > + flow_nic_set_error(ERR_FAILED, error); > + return -1; > + } > + > + uint32_t *sw_data = &packet_data[1 - sw_counter]; > + uint32_t *sw_mask = &packet_mask[1 - sw_counter]; > + > + sw_mask[0] = ntohl(ipv4_mask->hdr.dst_addr); > + sw_data[0] = ntohl(ipv4_spec->hdr.dst_addr) & sw_mask[0]; > + > + km_add_match_elem(&fd->km, &sw_data[0], &sw_mask[0], 1, > + any_count > 0 ? DYN_TUN_L3 : DYN_L3, 16); > + set_key_def_sw(key_def, sw_counter, any_count > 0 > + ? DYN_TUN_L3 : DYN_L3, 16); > + sw_counter += 1; > + } > + > + if (ipv4_mask->hdr.next_proto_id) { > + if (sw_counter >= 2) { > + NT_LOG(ERR, FILTER, > + "Key size too big. Out of SW resources."); > + flow_nic_set_error(ERR_FAILED, error); > + return -1; > + } > + > + uint32_t *sw_data = &packet_data[1 - sw_counter]; > + uint32_t *sw_mask = &packet_mask[1 - sw_counter]; > + > + sw_mask[0] = ipv4_mask->hdr.next_proto_id << 16; > + sw_data[0] = ipv4_spec->hdr.next_proto_id > + << 16 & sw_mask[0]; > + > + km_add_match_elem(&fd->km, &sw_data[0], &sw_mask[0], 1, > + any_count > 0 ? DYN_TUN_L3 : DYN_L3, 8); > + set_key_def_sw(key_def, sw_counter, any_count > 0 > + ? DYN_TUN_L3 : DYN_L3, 8); > + sw_counter += 1; > + } > + > + if (any_count > 0 || fd->l3_prot != -1) > + fd->tunnel_l3_prot = PROT_TUN_L3_IPV4; > + > + else > + fd->l3_prot = PROT_L3_IPV4; > + } > + > + break; > break; Redundant 'break'. > > default: