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 71FF445B96; Mon, 21 Oct 2024 23:07:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 953F440DDC; Mon, 21 Oct 2024 23:06:02 +0200 (CEST) Received: from egress-ip42a.ess.de.barracuda.com (egress-ip42a.ess.de.barracuda.com [18.185.115.201]) by mails.dpdk.org (Postfix) with ESMTP id 47CFC40696 for ; Mon, 21 Oct 2024 23:05:49 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2105.outbound.protection.outlook.com [104.47.17.105]) by mx-outbound46-162.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 21 Oct 2024 21:05:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=n5c5tDwtBhSwcfi7UMRGivdtOkKReZrSNVcx4CBe9rv3HSwhYMze6D9O4baTv3kkWyt2awTobL4696BTlBALy8FUhWQPku4bH9HyUK94hARrr5b7JFGNRTwR18jChSTFy1ocRKt2cy27FbIZZpvT+zZHw3ycKqGNFm8E4wzGx4Y5oTvyZ35uyzVNTWKqzeBzslrv3+F2eQWXvQrweqwK35BeRflotUNsH05ym+IolTdCkaH36k04wAcKKFP9elIl9otOPMuKdv2ytHXkQSOyAXNTtPY5+mhWE6e7s00Ova26cyGa25pd2he5MUDOAaSCDEX2ncp44ZL+Tb6wbXD51Q== 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=Pgsv0vfN5WKnVhdWWbMVOVguHSazu4OqzYDzOmFe194=; b=t2iZRzZ5LVYuZJf400C0CBZaxAdEcbpa6H4Vyn99U9sUjxV7+45tBpNo8GVKCSrNFTn1YG6HezKtZfB8MdwW7AHEnPK3ves/9sy6yTZdS8KJFWGs7MW3AClC3zEPeeImOhZSznyvSILTrlQYnyUe3HdBKlIdt1pKYY+vXC0PAzPCFMP4sftKAVspSDl9SiG2mo6AxSuxoiuc94Z26+KgjbnZIpj8rI5bAfaiU7mhJERdsC6wmHUc7LoNISlxVWmNOn6FP2n6sC39GM7bsTknsCAkD4fR1AfPhVxichGcwPv/boU804jtOQ2rzCPWKqpze2hg906eUTTR/sKFAgssxQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 178.72.21.4) smtp.rcpttodomain=dpdk.org smtp.mailfrom=napatech.com; dmarc=fail (p=reject sp=reject pct=100) action=oreject header.from=napatech.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=napatech.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Pgsv0vfN5WKnVhdWWbMVOVguHSazu4OqzYDzOmFe194=; b=AmzBwuOwO8fql/8GP/iUKOFrDY4FVpyP81/Lh2xyScthTmPrmZxPrrp29xBEzB2Zqwr0Kkff8z8mmboNNZwllywdXRZbg3yEZ36+ReFtJWccgw0bl6bjatprg4PPPS19PR7kELONnWa9Ss6UpP/9P5vRfbqN1okbLuJZ3aagBZQ= Received: from AS9PR04CA0143.eurprd04.prod.outlook.com (2603:10a6:20b:48a::24) by GVXP190MB2073.EURP190.PROD.OUTLOOK.COM (2603:10a6:150:157::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Mon, 21 Oct 2024 21:05:41 +0000 Received: from AMS0EPF000001A8.eurprd05.prod.outlook.com (2603:10a6:20b:48a:cafe::8f) by AS9PR04CA0143.outlook.office365.com (2603:10a6:20b:48a::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29 via Frontend Transport; Mon, 21 Oct 2024 21:05:41 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 178.72.21.4) smtp.mailfrom=napatech.com; dkim=none (message not signed) header.d=none;dmarc=fail action=oreject header.from=napatech.com; Received-SPF: Fail (protection.outlook.com: domain of napatech.com does not designate 178.72.21.4 as permitted sender) receiver=protection.outlook.com; client-ip=178.72.21.4; helo=localhost.localdomain; Received: from localhost.localdomain (178.72.21.4) by AMS0EPF000001A8.mail.protection.outlook.com (10.167.16.148) with Microsoft SMTP Server id 15.20.8093.14 via Frontend Transport; Mon, 21 Oct 2024 21:05:41 +0000 From: Serhii Iliushyk To: dev@dpdk.org Cc: mko-plv@napatech.com, sil-plv@napatech.com, ckm@napatech.com, andrew.rybchenko@oktetlabs.ru, ferruh.yigit@amd.com Subject: [PATCH v1 14/73] net/ntnic: add item eth Date: Mon, 21 Oct 2024 23:04:16 +0200 Message-ID: <20241021210527.2075431-15-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241021210527.2075431-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF000001A8:EE_|GVXP190MB2073:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 97f97706-d123-438d-ed67-08dcf2141f39 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?M6OjdKgz73abPRbIUgovKq8VhxwY0HKFgnCqmVo63/Z3ZhsI54UNzFQYk9QG?= =?us-ascii?Q?LOwBl9Zwhe8vjBrxGMHhxnLGOFHz1SVdDy34E1aGpeKiIWaM195KcIcwygOn?= =?us-ascii?Q?Q2KODpawSaSmURj+woITClZI6IBDR6BmUpn8KVinuyn8NgAzK7I62FB4SUDa?= =?us-ascii?Q?VTy2nBWd/ZU5eL06d4g3nBQxdu7zRNkXYooHXU5VWNH/iQxlbKRbc0GOCuc8?= =?us-ascii?Q?aMvSwWiDa2UMV7sPWGbJJ8YTTJs1Xq3BIodtmyw2+CVAqWGlftTOLKQNZ5Pv?= =?us-ascii?Q?4oWZDjTzB0jH6WMD1FB4wZuAHCxFIZW7nc2gkZA7h2sGVuovv9SIQWL2rhzZ?= =?us-ascii?Q?YRexJmaiIwI6kOVMtVmUiIZwiFjhDfgZBVmI8JoLxk58ZHlnpG86FSpEhiHI?= =?us-ascii?Q?kGGEA0LRfFy/EHOCfACOI+v1HP8QWrkH/owYQeiyAVHhDlHXDP5uFxhfJOmX?= =?us-ascii?Q?NHLxMnLKA6jhhOmvq7IYqk3fbPnVDwSjDiSX1XbtYU1U9XIsVhfLGbeBMRsF?= =?us-ascii?Q?R9uxGe4AkD1ES+IGpMNQz2BC8Qq7kkm3sEzGD0XDMp6ZLbuM7ALRhS89h1ma?= =?us-ascii?Q?muSTcG00mAHruNRHmv707PMH/YlwgVnELrOZDUz3SaQ0BnU6rO0l6Wv2P7wu?= =?us-ascii?Q?lNfgFcXWci/c4c5/ZSgmckzmRq2nMUpw/GI6/O/14U1VvSHtxQfg5f4zUGbg?= =?us-ascii?Q?P7q/vsnqyr9cQX02NzUKYjDQgwfOf72ZFVqOAKfC76e5r2w143v+UMseRPP1?= =?us-ascii?Q?SKQX8OW5OqR3ruulOxGkIsBYnGnbaKLtA+t4/vzwlYbK2QArnhOOcHViu75j?= =?us-ascii?Q?zWXgBBC2mXEo7a3o3xsml54I24qK8IEi1dyAWi+pGCKd46xbr/ztd53w1Nf9?= =?us-ascii?Q?AJmQXOpM4MFJ9xrg42rwB9ABXxNGmP2oOsRdKPIJJ1JFvMFVnJFPmgteb3Q5?= =?us-ascii?Q?5j6vto/XFjxznnLdRpI6m+HQ2tmziVIA+7GDpXT12XDoZ4xIpt5/K5Js95HN?= =?us-ascii?Q?RMZRNBztyBvg0Y+RayvlSd5AwnN1fLBZNgQQzoHHyi7qLOUxPJcQx+lu6S4V?= =?us-ascii?Q?KuBAmNYu5X6ZIjaSGe1lb5gPcHKefAolFW85eP/nYOU+cYSc7mmyloXd+HYm?= =?us-ascii?Q?Kk2TJvSIVb1NHCJxJrhX+bF/D0I+gobdABcLt8IFa3zWXyWXsBQJ7SOCmTkS?= =?us-ascii?Q?0yjAR0KisKMxXOalRnAf7Kbu5w2cODZRMY0n6nAjo96PM2xLqqf+dpzGk7Ps?= =?us-ascii?Q?LOkhZgCMCG18/Xg+uuVVw/Ins4bg0+l0aaFtILiGT79KwHc7ozTK3qUT9bni?= =?us-ascii?Q?9mtBHAiAY+9+gh4VZ5O6Qo+1K15XLgCjMfoGW9NlPMJF6qz8ldl3LeG9B3Gx?= =?us-ascii?Q?AInVR9MWXX/c6Px7VVWTZik2sx5fIG6d0xhrtVUBW2v0bFLABQ=3D=3D?= X-Forefront-Antispam-Report: CIP:178.72.21.4; CTRY:DK; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:localhost.localdomain; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(36860700013)(376014)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: AbP9l+ygbhHNgjRROIXXBXZg8QeR4FtmQdaswP3COgd674dNmz4xpJ/r7PjInKSOk0qG8nLFES7a/NtahOhC+wLU7hZkQDU3ohSYrrmMl3W+cz+e+/8AE4V/osiIxlregCaUFafqlv/Dg0bYkSGF48G37qM/4NASzsnUg3OcjZdU7hYJ2okTrxdl5HycUwaAbklBE1HKUvEJGtbCHyYwOYtRsYLG95+qAUEgspFTLP7m/br5ecR6LFSpndtlCkMQyQ8mXEiyPP86lE0RcfWXzTWhHnSZQWg+T4ZGKuh1SkXi8ySN44MRFhloc3zsPOs+8rPyZfV258ZCEljNIkftcOLNg++O/n+T+hs2EGe6+sk5dG33P2zliz+R9Ykrxx2VfnIcgORA2MUtgueMGvWRJJgQ4eUEh//TlIiAYjpouFXCIO+UrWBaTSAXmHOjqlwTWsAlIJwERQKhXVhpZaDJPP501D0foGkYnbcPrmVkhNTRTMij9tLix/fULNUBX2/6VejUcz6vB8NLhjlYwWtMClR3007n8JBeHVz6VAvGksh9Qkb728MoaA8uIWUK+wSqqgAxyUvFaluHknY1Tf7QZ2XQRI6CN2+uDkijIasFtA/FA6o8pKdyGSzN1PLLrykyPBAKbapCU8wU006aArKN+EgDagIjq+XEvWxJSFPqDiA= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 21:05:41.5519 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 97f97706-d123-438d-ed67-08dcf2141f39 X-MS-Exchange-CrossTenant-Id: c4540d0b-728a-4233-9da5-9ea30c7ec3ed X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=c4540d0b-728a-4233-9da5-9ea30c7ec3ed; Ip=[178.72.21.4]; Helo=[localhost.localdomain] X-MS-Exchange-CrossTenant-AuthSource: AMS0EPF000001A8.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXP190MB2073 X-BESS-ID: 1729544745-311938-13027-41078-2 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.105 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVhaG5sZAVgZQ0CQ5OS0lyTjV3D jJPM0iMTnZ0iQl1cLcxNDM1DAlMdVEqTYWAIKe8HlBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259883 [from cloudscan17-111.eu-central-1b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 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 possibility to use RTE_FLOW_ITEM_TYPE_ETH Signed-off-by: Serhii Iliushyk --- doc/guides/nics/features/ntnic.ini | 1 + drivers/net/ntnic/include/hw_mod_backend.h | 23 +++ .../profile_inline/flow_api_profile_inline.c | 180 ++++++++++++++++++ 3 files changed, 204 insertions(+) diff --git a/doc/guides/nics/features/ntnic.ini b/doc/guides/nics/features/ntnic.ini index 372653695d..36b8212bae 100644 --- a/doc/guides/nics/features/ntnic.ini +++ b/doc/guides/nics/features/ntnic.ini @@ -15,6 +15,7 @@ x86-64 = Y [rte_flow items] any = Y +eth = Y [rte_flow actions] drop = Y diff --git a/drivers/net/ntnic/include/hw_mod_backend.h b/drivers/net/ntnic/include/hw_mod_backend.h index 99b207a01c..0c22129fb4 100644 --- a/drivers/net/ntnic/include/hw_mod_backend.h +++ b/drivers/net/ntnic/include/hw_mod_backend.h @@ -120,6 +120,29 @@ enum { } \ } while (0) +static inline int is_non_zero(const void *addr, size_t n) +{ + size_t i = 0; + const uint8_t *p = (const uint8_t *)addr; + + for (i = 0; i < n; i++) + if (p[i] != 0) + return 1; + + return 0; +} + +enum frame_offs_e { + DYN_L2 = 1, + DYN_L3 = 4, + DYN_L4 = 7, + DYN_L4_PAYLOAD = 8, + DYN_TUN_L3 = 13, + DYN_TUN_L4 = 16, +}; + +/* Sideband info bit indicator */ + enum km_flm_if_select_e { KM_FLM_IF_FIRST = 0, KM_FLM_IF_SECOND = 1 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 664f9c337e..0f47f00e64 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 @@ -54,6 +54,36 @@ struct flm_flow_key_def_s { /* * Flow Matcher functionality */ +static inline void set_key_def_qw(struct flm_flow_key_def_s *key_def, unsigned int qw, + unsigned int dyn, unsigned int ofs) +{ + assert(qw < 2); + + if (qw == 0) { + key_def->qw0_dyn = dyn & 0x7f; + key_def->qw0_ofs = ofs & 0xff; + + } else { + key_def->qw4_dyn = dyn & 0x7f; + key_def->qw4_ofs = ofs & 0xff; + } +} + +static inline void set_key_def_sw(struct flm_flow_key_def_s *key_def, unsigned int sw, + unsigned int dyn, unsigned int ofs) +{ + assert(sw < 2); + + if (sw == 0) { + key_def->sw8_dyn = dyn & 0x7f; + key_def->sw8_ofs = ofs & 0xff; + + } else { + key_def->sw9_dyn = dyn & 0x7f; + key_def->sw9_ofs = ofs & 0xff; + } +} + static uint8_t get_port_from_port_id(const struct flow_nic_dev *ndev, uint32_t port_id) { struct flow_eth_dev *dev = ndev->eth_base; @@ -459,6 +489,11 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev, (void)fd; (void)implicit_vlan_vid; + uint32_t any_count = 0; + + unsigned int qw_counter = 0; + unsigned int sw_counter = 0; + *in_port_id = UINT32_MAX; memset(packet_data, 0x0, sizeof(uint32_t) * 10); @@ -474,6 +509,28 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev, int qw_reserved_mac = 0; int qw_reserved_ipv6 = 0; + for (int eidx = 0; elem[eidx].type != RTE_FLOW_ITEM_TYPE_END; ++eidx) { + switch (elem[eidx].type) { + case RTE_FLOW_ITEM_TYPE_ETH: { + const struct rte_ether_hdr *eth_spec = + (const struct rte_ether_hdr *)elem[eidx].spec; + const struct rte_ether_hdr *eth_mask = + (const struct rte_ether_hdr *)elem[eidx].mask; + + if (eth_spec != NULL && eth_mask != NULL) { + if (is_non_zero(eth_mask->dst_addr.addr_bytes, 6) || + is_non_zero(eth_mask->src_addr.addr_bytes, 6)) { + qw_reserved_mac += 1; + } + } + } + break; + + default: + break; + } + } + int qw_free = 2 - qw_reserved_mac - qw_reserved_ipv6; if (qw_free < 0) { @@ -486,6 +543,129 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev, switch (elem[eidx].type) { case RTE_FLOW_ITEM_TYPE_ANY: NT_LOG(DBG, FILTER, "Adap %i, Port %i: RTE_FLOW_ITEM_TYPE_ANY", + dev->ndev->adapter_no, dev->port); + any_count += 1; + break; + + case RTE_FLOW_ITEM_TYPE_ETH: + NT_LOG(DBG, FILTER, "Adap %i, Port %i: RTE_FLOW_ITEM_TYPE_ETH", + dev->ndev->adapter_no, dev->port); + { + const struct rte_ether_hdr *eth_spec = + (const struct rte_ether_hdr *)elem[eidx].spec; + const struct rte_ether_hdr *eth_mask = + (const struct rte_ether_hdr *)elem[eidx].mask; + + if (any_count > 0) { + NT_LOG(ERR, FILTER, + "Tunneled L2 ethernet not supported"); + flow_nic_set_error(ERR_FAILED, error); + return -1; + } + + if (eth_spec == NULL || eth_mask == NULL) { + fd->l2_prot = PROT_L2_ETH2; + break; + } + + int non_zero = is_non_zero(eth_mask->dst_addr.addr_bytes, 6) || + is_non_zero(eth_mask->src_addr.addr_bytes, 6); + + if (non_zero || + (eth_mask->ether_type != 0 && 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_data[0] = ((eth_spec->dst_addr.addr_bytes[0] & + eth_mask->dst_addr.addr_bytes[0]) << 24) + + ((eth_spec->dst_addr.addr_bytes[1] & + eth_mask->dst_addr.addr_bytes[1]) << 16) + + ((eth_spec->dst_addr.addr_bytes[2] & + eth_mask->dst_addr.addr_bytes[2]) << 8) + + (eth_spec->dst_addr.addr_bytes[3] & + eth_mask->dst_addr.addr_bytes[3]); + + qw_data[1] = ((eth_spec->dst_addr.addr_bytes[4] & + eth_mask->dst_addr.addr_bytes[4]) << 24) + + ((eth_spec->dst_addr.addr_bytes[5] & + eth_mask->dst_addr.addr_bytes[5]) << 16) + + ((eth_spec->src_addr.addr_bytes[0] & + eth_mask->src_addr.addr_bytes[0]) << 8) + + (eth_spec->src_addr.addr_bytes[1] & + eth_mask->src_addr.addr_bytes[1]); + + qw_data[2] = ((eth_spec->src_addr.addr_bytes[2] & + eth_mask->src_addr.addr_bytes[2]) << 24) + + ((eth_spec->src_addr.addr_bytes[3] & + eth_mask->src_addr.addr_bytes[3]) << 16) + + ((eth_spec->src_addr.addr_bytes[4] & + eth_mask->src_addr.addr_bytes[4]) << 8) + + (eth_spec->src_addr.addr_bytes[5] & + eth_mask->src_addr.addr_bytes[5]); + + qw_data[3] = ntohs(eth_spec->ether_type & + eth_mask->ether_type) << 16; + + qw_mask[0] = (eth_mask->dst_addr.addr_bytes[0] << 24) + + (eth_mask->dst_addr.addr_bytes[1] << 16) + + (eth_mask->dst_addr.addr_bytes[2] << 8) + + eth_mask->dst_addr.addr_bytes[3]; + + qw_mask[1] = (eth_mask->dst_addr.addr_bytes[4] << 24) + + (eth_mask->dst_addr.addr_bytes[5] << 16) + + (eth_mask->src_addr.addr_bytes[0] << 8) + + eth_mask->src_addr.addr_bytes[1]; + + qw_mask[2] = (eth_mask->src_addr.addr_bytes[2] << 24) + + (eth_mask->src_addr.addr_bytes[3] << 16) + + (eth_mask->src_addr.addr_bytes[4] << 8) + + eth_mask->src_addr.addr_bytes[5]; + + qw_mask[3] = ntohs(eth_mask->ether_type) << 16; + + km_add_match_elem(&fd->km, + &qw_data[(size_t)(qw_counter * 4)], + &qw_mask[(size_t)(qw_counter * 4)], 4, DYN_L2, 0); + set_key_def_qw(key_def, qw_counter, DYN_L2, 0); + qw_counter += 1; + + if (!non_zero) + qw_free -= 1; + + } else if (eth_mask->ether_type != 0) { + if (sw_counter >= 2) { + NT_LOG(ERR, FILTER, + "Key size too big. Out of SW-QW 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] = ntohs(eth_mask->ether_type) << 16; + sw_data[0] = ntohs(eth_spec->ether_type) << 16 & sw_mask[0]; + + km_add_match_elem(&fd->km, &sw_data[0], + &sw_mask[0], 1, DYN_L2, 12); + set_key_def_sw(key_def, sw_counter, DYN_L2, 12); + sw_counter += 1; + } + + fd->l2_prot = PROT_L2_ETH2; + } + + break; + dev->ndev->adapter_no, dev->port); break; -- 2.45.0