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 95193A0032; Sat, 22 Oct 2022 10:25:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3AA00410D0; Sat, 22 Oct 2022 10:24:56 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2118.outbound.protection.outlook.com [40.107.92.118]) by mails.dpdk.org (Postfix) with ESMTP id D82A6400D6 for ; Sat, 22 Oct 2022 10:24:53 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HnkGNlMWt9htD+T6lqCIPgoGr4Q+VKwCo86YlvX3xsZ729dWIky19VMAqhKYmzAUIVqqdDZEwytGMsIIu6aybH6/BO/2K9x2zhpVXCZFmwqe3MwmJ+32x+6Q/InjA+1FPyoap+liBrbJHL+iTLWp5qGEY7bQ6a//XXWCh18SAJv+PdOufsY6TbLh+aC/Y2GxSJFCzl+uI/YbapI52uLQ4a0yYKZR7jrM0ZEaMhq3+pPdOy9aHizzd6XU+YS688EkVfDOmbsRhoGlApKHReMW5+OxBsF+up7qE43reltFzWOFtUvM8Do4a2KIiHA/5yk6zOIySoojnpjT4IfSj9rCxA== 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=ylIX9qxb7o2h9IHt69irR52TEVeukdweLaRvfkCfgd0=; b=lT7ioPfh9gE7N2lGh/M0Wia3BvKkcffk0vpy+LAihuLHI3mlvFzlACwNWxNmUPZtvU+UwHpXyk8y/ZpB0YGu7gR/A4Hs4PvzsrzDQgcDlReQn+EmoFVDtGkOU1NZ62XANJBVwEgz5QDnEX2RxmftaMNsmKd4jq93lhQCKYAL2i63Aq8us7syqfClxUy89ftcucHEi0uL9OXZC1LtHYLG+A6aOraInXyAEBLRjmI2bch0HW382lsFY2ByIodbYwaKPhALgKeSEfoqVngvP3j3J6wa+DFsS97m0SWu7FiyQY8R0dubgK3npEIiqe1b8RvbUIebcdWwfeTMe72gzfMjcQ== 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=ylIX9qxb7o2h9IHt69irR52TEVeukdweLaRvfkCfgd0=; b=r8vysjvhHXCtW1cUJkWfPKxXD/eHbNrMmlV3IJBBRJQMptW/e3QmJX30BAjJBFzGM2IU3PQNXUK1DA3Kflm9kHTG5H+Fcryi1nJ4WfnhrA+CJ2k15MYhM5yxp4kBC9ZL1klU8yvmT3wafr0sOMUMApoL8qxbtYEYmxveptwd0xY= 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 CH2PR13MB3848.namprd13.prod.outlook.com (2603:10b6:610:9d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.20; Sat, 22 Oct 2022 08:24:50 +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; Sat, 22 Oct 2022 08:24:50 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v2 02/25] net/nfp: support IPv6 VXLAN flow item Date: Sat, 22 Oct 2022 16:24:06 +0800 Message-Id: <1666427069-10553-3-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1666427069-10553-1-git-send-email-chaoyong.he@corigine.com> References: <1666063359-34283-1-git-send-email-chaoyong.he@corigine.com> <1666427069-10553-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2PR02CA0056.apcprd02.prod.outlook.com (2603:1096:4:54::20) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|CH2PR13MB3848:EE_ X-MS-Office365-Filtering-Correlation-Id: 416fbd37-67bb-4e89-cf6e-08dab406e33d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z9db9++WBo5+JivAd8TyqLHiQqxO2h6XeRCHtzxPo9yLh5CgQD2bRN6ppiNVo5hcKXIp8Qv2ArHASECWpXiQJ6ZuVUDX6wnSH7UXcPB7A+shHb2jgpjfs4HY9DDAHWTLzdOOwJ6REKDoUs6bi88nzKhdVxXhVJLXU11Co/5ZlKJ6bLgCirlsmJ6WrYXFcTcirWiQF3px5FLOn1dMa410bQA3oRW1vaYX0io73+66SyLZgqfc3SabS5LEDiG/jIvP+K7MBvdA9JhOmLvXvje3Q/iP6ei8gFE6l+TxBMNmWppkl4HkGCcIlA4j2bSOUpa04fjmU4Zh+VcwNnD6dTT7PCk34gqXKh1ECUVx1lodzwQAeSk/esSphlTLTnsJB6DvFdFYFAR9Pvc9isq2DxWPF6FKig8fVyIVE0f7Ys0peVixeiByiUYI/oWDsyI7xzYQsvxARtpDPtCI5kQf9uNMQTfruwHeA/JQJ35aK5WtsPK2Uof8MJtjmirWjVqoJ51f9VHUHrptSmPSNMSIZ7GT2K33Fa1zQaH5oI6fV1nPHQAhzPmm712sCKkUy98TdFoFdNk1EbceBSQNQ2PJqB7G9gQPIzNiIm+y/WoKYWJRL/OgdyhnIqOPvGbdCt1Po8HGtZhdpS0xyto++LRui6nQ8+cWTJGOjBg5ucSNfbBuODs9iwpTUew84J4n9I05NYz8QogCHh3JRinNq/zO/tWc4A3VPYQov2fmv733888ucoG8/7lS3ZUvPP/0uKYbvlscRYXsMTh8bPVa8f7RP560tQ== 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)(366004)(396003)(39830400003)(346002)(376002)(451199015)(4326008)(107886003)(36756003)(38100700002)(66946007)(66556008)(316002)(6512007)(83380400001)(52116002)(66476007)(8676002)(44832011)(66574015)(6666004)(6506007)(38350700002)(5660300002)(8936002)(6916009)(2616005)(478600001)(186003)(41300700001)(26005)(6486002)(86362001)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?R1E1YlVFbWNlUTdweVlvM0RVMVEySFMwSkFxc0ltdlFrOFh3MEJIakhobllN?= =?utf-8?B?UzJkOTdvRHU3eDZJakZ5ZzBwanZobEp1aGp0K1NFRGswSHpJeWpkcUJWQStR?= =?utf-8?B?R3FJWE9rOFpZYmRhWE1Jc3UvbU1EdUV5V3p4d3YxWWlJZWNhRW9Da2RiY3FD?= =?utf-8?B?bHlBUnVuMXE1QnlpdEdyVGczWHhmNDg2bTZqeVk0ZFJIUUR0OS9jclAxVE9z?= =?utf-8?B?WGE5VTJxZExIRHF2cFk5ZVY0aTZxTFd0YXlNMmlwTkRzeWJxeX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YTlZbjYvOUtLbThoR3I5d29MMWJONFBYTFRkZ2xWa3B3TGpL?= =?utf-8?B?VW9OaWQxc0RvNGFsYXVhUmc4VHRHeXI5cVFrcW5uRkpxclZ6bDVzakpORXN0?= =?utf-8?B?blE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 416fbd37-67bb-4e89-cf6e-08dab406e33d X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2022 08:24:50.2878 (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: LDgrITUWpNyzbSzv9SDKYm8iePChhWS/a0+oQFTqu5R0eLFNWf0SrhUKanw0ofSczWMCopVxyB2yKBNyxzfi31ybfLHojzGJ7cGOryMIQb8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR13MB3848 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 IPv6 VXLAN item. Signed-off-by: Chaoyong He Reviewed-by: Niklas Söderlund --- drivers/net/nfp/flower/nfp_flower_cmsg.h | 42 ++++++++++++ drivers/net/nfp/nfp_flow.c | 113 ++++++++++++++++++++++++------- 2 files changed, 129 insertions(+), 26 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.h b/drivers/net/nfp/flower/nfp_flower_cmsg.h index 08e2873..996ba3b 100644 --- a/drivers/net/nfp/flower/nfp_flower_cmsg.h +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.h @@ -329,6 +329,11 @@ struct nfp_flower_tun_ipv4 { rte_be32_t dst; }; +struct nfp_flower_tun_ipv6 { + uint8_t ipv6_src[16]; + uint8_t ipv6_dst[16]; +}; + struct nfp_flower_tun_ip_ext { uint8_t tos; uint8_t ttl; @@ -359,6 +364,43 @@ struct nfp_flower_ipv4_udp_tun { rte_be32_t tun_id; }; +/* + * Flow Frame IPv6 UDP TUNNEL --> Tunnel details (11W/44B) + * ----------------------------------------------------------------- + * 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 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ipv6_addr_src, 31 - 0 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ipv6_addr_src, 63 - 32 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ipv6_addr_src, 95 - 64 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ipv6_addr_src, 127 - 96 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ipv6_addr_dst, 31 - 0 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ipv6_addr_dst, 63 - 32 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ipv6_addr_dst, 95 - 64 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ipv6_addr_dst, 127 - 96 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Reserved | tos | ttl | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Reserved | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | VNI | Reserved | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ +struct nfp_flower_ipv6_udp_tun { + struct nfp_flower_tun_ipv6 ipv6; + rte_be16_t reserved1; + struct nfp_flower_tun_ip_ext ip_ext; + rte_be32_t reserved2; + rte_be32_t tun_id; +}; + struct nfp_fl_act_head { uint8_t jump_id; uint8_t len_lw; diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c index 0e1e5ea..bbd9dba 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -493,6 +493,7 @@ struct nfp_mask_id_entry { { struct rte_eth_dev *ethdev; bool outer_ip4_flag = false; + bool outer_ip6_flag = false; const struct rte_flow_item *item; struct nfp_flower_representor *representor; const struct rte_flow_item_port_id *port_id; @@ -535,6 +536,8 @@ struct nfp_mask_id_entry { PMD_DRV_LOG(DEBUG, "RTE_FLOW_ITEM_TYPE_IPV6 detected"); key_ls->key_layer |= NFP_FLOWER_LAYER_IPV6; key_ls->key_size += sizeof(struct nfp_flower_ipv6); + if (!outer_ip6_flag) + outer_ip6_flag = true; break; case RTE_FLOW_ITEM_TYPE_TCP: PMD_DRV_LOG(DEBUG, "RTE_FLOW_ITEM_TYPE_TCP detected"); @@ -553,8 +556,9 @@ struct nfp_mask_id_entry { break; case RTE_FLOW_ITEM_TYPE_VXLAN: PMD_DRV_LOG(DEBUG, "RTE_FLOW_ITEM_TYPE_VXLAN detected"); - /* Clear IPv4 bits */ + /* Clear IPv4 and IPv6 bits */ key_ls->key_layer &= ~NFP_FLOWER_LAYER_IPV4; + key_ls->key_layer &= ~NFP_FLOWER_LAYER_IPV6; key_ls->tun_type = NFP_FL_TUN_VXLAN; key_ls->key_layer |= NFP_FLOWER_LAYER_VXLAN; if (outer_ip4_flag) { @@ -564,6 +568,19 @@ struct nfp_mask_id_entry { * in `struct nfp_flower_ipv4_udp_tun` */ key_ls->key_size -= sizeof(struct nfp_flower_ipv4); + } else if (outer_ip6_flag) { + key_ls->key_layer |= NFP_FLOWER_LAYER_EXT_META; + key_ls->key_layer_two |= NFP_FLOWER_LAYER2_TUN_IPV6; + key_ls->key_size += sizeof(struct nfp_flower_ext_meta); + key_ls->key_size += sizeof(struct nfp_flower_ipv6_udp_tun); + /* + * The outer l3 layer information is + * in `struct nfp_flower_ipv6_udp_tun` + */ + key_ls->key_size -= sizeof(struct nfp_flower_ipv6); + } else { + PMD_DRV_LOG(ERR, "No outer IP layer for VXLAN tunnel."); + return -EINVAL; } break; default: @@ -884,42 +901,61 @@ struct nfp_mask_id_entry { const struct rte_flow_item *item, const struct nfp_flow_item_proc *proc, bool is_mask, - __rte_unused bool is_outer_layer) + bool is_outer_layer) { struct nfp_flower_ipv6 *ipv6; const struct rte_ipv6_hdr *hdr; struct nfp_flower_meta_tci *meta_tci; const struct rte_flow_item_ipv6 *spec; const struct rte_flow_item_ipv6 *mask; + struct nfp_flower_ipv6_udp_tun *ipv6_udp_tun; spec = item->spec; mask = item->mask ? item->mask : proc->mask_default; meta_tci = (struct nfp_flower_meta_tci *)nfp_flow->payload.unmasked_data; - if (spec == NULL) { - PMD_DRV_LOG(DEBUG, "nfp flow merge ipv6: no item->spec!"); - goto ipv6_end; - } + if (is_outer_layer && nfp_flow_is_tunnel(nfp_flow)) { + if (spec == NULL) { + PMD_DRV_LOG(DEBUG, "nfp flow merge ipv6: no item->spec!"); + return 0; + } - /* - * reserve space for L4 info. - * rte_flow has ipv4 before L4 but NFP flower fw requires L4 before ipv4 - */ - if (meta_tci->nfp_flow_key_layer & NFP_FLOWER_LAYER_TP) - *mbuf_off += sizeof(struct nfp_flower_tp_ports); + hdr = is_mask ? &mask->hdr : &spec->hdr; + ipv6_udp_tun = (struct nfp_flower_ipv6_udp_tun *)*mbuf_off; + + ipv6_udp_tun->ip_ext.tos = (hdr->vtc_flow & + RTE_IPV6_HDR_TC_MASK) >> RTE_IPV6_HDR_TC_SHIFT; + ipv6_udp_tun->ip_ext.ttl = hdr->hop_limits; + memcpy(ipv6_udp_tun->ipv6.ipv6_src, hdr->src_addr, + sizeof(ipv6_udp_tun->ipv6.ipv6_src)); + memcpy(ipv6_udp_tun->ipv6.ipv6_dst, hdr->dst_addr, + sizeof(ipv6_udp_tun->ipv6.ipv6_dst)); + } else { + if (spec == NULL) { + PMD_DRV_LOG(DEBUG, "nfp flow merge ipv6: no item->spec!"); + goto ipv6_end; + } - hdr = is_mask ? &mask->hdr : &spec->hdr; - ipv6 = (struct nfp_flower_ipv6 *)*mbuf_off; + /* + * reserve space for L4 info. + * rte_flow has ipv4 before L4 but NFP flower fw requires L4 before ipv6 + */ + if (meta_tci->nfp_flow_key_layer & NFP_FLOWER_LAYER_TP) + *mbuf_off += sizeof(struct nfp_flower_tp_ports); + + hdr = is_mask ? &mask->hdr : &spec->hdr; + ipv6 = (struct nfp_flower_ipv6 *)*mbuf_off; - ipv6->ip_ext.tos = (hdr->vtc_flow & RTE_IPV6_HDR_TC_MASK) >> - RTE_IPV6_HDR_TC_SHIFT; - ipv6->ip_ext.proto = hdr->proto; - ipv6->ip_ext.ttl = hdr->hop_limits; - memcpy(ipv6->ipv6_src, hdr->src_addr, sizeof(ipv6->ipv6_src)); - memcpy(ipv6->ipv6_dst, hdr->dst_addr, sizeof(ipv6->ipv6_dst)); + ipv6->ip_ext.tos = (hdr->vtc_flow & RTE_IPV6_HDR_TC_MASK) >> + RTE_IPV6_HDR_TC_SHIFT; + ipv6->ip_ext.proto = hdr->proto; + ipv6->ip_ext.ttl = hdr->hop_limits; + memcpy(ipv6->ipv6_src, hdr->src_addr, sizeof(ipv6->ipv6_src)); + memcpy(ipv6->ipv6_dst, hdr->dst_addr, sizeof(ipv6->ipv6_dst)); ipv6_end: - *mbuf_off += sizeof(struct nfp_flower_ipv6); + *mbuf_off += sizeof(struct nfp_flower_ipv6); + } return 0; } @@ -1088,7 +1124,7 @@ struct nfp_mask_id_entry { } static int -nfp_flow_merge_vxlan(__rte_unused struct rte_flow *nfp_flow, +nfp_flow_merge_vxlan(struct rte_flow *nfp_flow, char **mbuf_off, const struct rte_flow_item *item, const struct nfp_flow_item_proc *proc, @@ -1097,8 +1133,15 @@ struct nfp_mask_id_entry { { const struct rte_vxlan_hdr *hdr; struct nfp_flower_ipv4_udp_tun *tun4; + struct nfp_flower_ipv6_udp_tun *tun6; + struct nfp_flower_meta_tci *meta_tci; const struct rte_flow_item_vxlan *spec; const struct rte_flow_item_vxlan *mask; + struct nfp_flower_ext_meta *ext_meta = NULL; + + meta_tci = (struct nfp_flower_meta_tci *)nfp_flow->payload.unmasked_data; + if (meta_tci->nfp_flow_key_layer & NFP_FLOWER_LAYER_EXT_META) + ext_meta = (struct nfp_flower_ext_meta *)(meta_tci + 1); spec = item->spec; if (spec == NULL) { @@ -1109,11 +1152,21 @@ struct nfp_mask_id_entry { mask = item->mask ? item->mask : proc->mask_default; hdr = is_mask ? &mask->hdr : &spec->hdr; - tun4 = (struct nfp_flower_ipv4_udp_tun *)*mbuf_off; - tun4->tun_id = hdr->vx_vni; + if (ext_meta && (rte_be_to_cpu_32(ext_meta->nfp_flow_key_layer2) & + NFP_FLOWER_LAYER2_TUN_IPV6)) { + tun6 = (struct nfp_flower_ipv6_udp_tun *)*mbuf_off; + tun6->tun_id = hdr->vx_vni; + } else { + tun4 = (struct nfp_flower_ipv4_udp_tun *)*mbuf_off; + tun4->tun_id = hdr->vx_vni; + } vxlan_end: - *mbuf_off += sizeof(struct nfp_flower_ipv4_udp_tun); + if (ext_meta && (rte_be_to_cpu_32(ext_meta->nfp_flow_key_layer2) & + NFP_FLOWER_LAYER2_TUN_IPV6)) + *mbuf_off += sizeof(struct nfp_flower_ipv6_udp_tun); + else + *mbuf_off += sizeof(struct nfp_flower_ipv4_udp_tun); return 0; } @@ -1122,7 +1175,8 @@ struct nfp_mask_id_entry { static const struct nfp_flow_item_proc nfp_flow_item_proc_list[] = { [RTE_FLOW_ITEM_TYPE_END] = { .next_item = NEXT_ITEM(RTE_FLOW_ITEM_TYPE_ETH, - RTE_FLOW_ITEM_TYPE_IPV4), + RTE_FLOW_ITEM_TYPE_IPV4, + RTE_FLOW_ITEM_TYPE_IPV6), }, [RTE_FLOW_ITEM_TYPE_ETH] = { .next_item = NEXT_ITEM(RTE_FLOW_ITEM_TYPE_VLAN, @@ -1395,6 +1449,7 @@ struct nfp_mask_id_entry { char *mbuf_off_exact; bool is_tun_flow = false; bool is_outer_layer = true; + struct nfp_flower_meta_tci *meta_tci; const struct rte_flow_item *loop_item; mbuf_off_exact = nfp_flow->payload.unmasked_data + @@ -1404,6 +1459,12 @@ struct nfp_mask_id_entry { sizeof(struct nfp_flower_meta_tci) + sizeof(struct nfp_flower_in_port); + meta_tci = (struct nfp_flower_meta_tci *)nfp_flow->payload.unmasked_data; + if (meta_tci->nfp_flow_key_layer & NFP_FLOWER_LAYER_EXT_META) { + mbuf_off_exact += sizeof(struct nfp_flower_ext_meta); + mbuf_off_mask += sizeof(struct nfp_flower_ext_meta); + } + /* Check if this is a tunnel flow and get the inner item*/ is_tun_flow = nfp_flow_inner_item_get(items, &loop_item); if (is_tun_flow) -- 1.8.3.1