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 B6D82A0560; Tue, 18 Oct 2022 05:23:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 76A1241133; Tue, 18 Oct 2022 05:23:06 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2131.outbound.protection.outlook.com [40.107.223.131]) by mails.dpdk.org (Postfix) with ESMTP id 89C004021E for ; Tue, 18 Oct 2022 05:23:04 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lkGDSHlDPRJcbYroT241z0YqCxgcXPPlgLb8Wk20VmkWANGsjrcizuT5vjAF1cyE18Lr8lvQhsy7u3KmIDlZB67cdRCLHFWb3ooJG+aWTy93bhbrrMuu0kcHWHbjkoLG0DGyxAYqECeC6sWWJEHiUNo7XN4vLk9wfAfELjSQgwZtETX/viW+dbK4a0FlfaXXAYjJRlu3m+CLozr5FtiNfFrqP8eSCWBzD5PMd9W9XhGA2dvZuntK356dNkbXVwPq5PIaoN24y7wYJE0rv25XWet41RdWJ20cLyfv7uA4zDwWt6EVVYrglITvSZMROtLC1YfxujqufKH/94+8GfndBg== 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=I1WC60XuYa5k+UGDbpEwLcW6dcyKdsZS7XnnDKfgbPs=; b=U1O9HX0Rl01kyaxZLTGrJc0qDsexex324F6cS757CsQ6lik1L+XRHj0sno5YDHJiGpKHfz1Fju++OqHIZItK1suaC39vbeSU1EpA2lRbzr7IdXfwpArQIS11c+lpaXEHkXT4503z4IpLaPM1DJlq87YwXx6ojpKhJRwKGUJiwzWTMcW43DXBZUsauODfliat345J+PtH8CcrG2XxUavndxvpL20mCLhbXMgFWVBQW8ertuZHjMhshfvej5SbcIz+AeIjUgvy2tXWQnil45ETzZzmyGzBfsTaFClqyKSkVBAOQut6QwHtlVFLTqXQblDSeZMSFNCwMSwvDCS3WUE2wA== 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=I1WC60XuYa5k+UGDbpEwLcW6dcyKdsZS7XnnDKfgbPs=; b=NsSZ3YG31C7scdpNvr5xx4yKql35cpWB8Hy0o18RL9Kawxc2IxPgLyxiDdqnrWc75Y0pn9O+P6XHRcFK0HJnH9pyOJRUvN5Q4n3bd79vfd+gYTXVKOfKyFGob151L1q4T562Jk0ipyRlhJIZ70P0qyujwTX2q3/J/cQxzhd99v8= 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 MN2PR13MB4149.namprd13.prod.outlook.com (2603:10b6:208:24f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.20; Tue, 18 Oct 2022 03:23:03 +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 03:23:03 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH 02/25] net/nfp: add the offload support of IPv6 VXLAN item Date: Tue, 18 Oct 2022 11:22:16 +0800 Message-Id: <1666063359-34283-3-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1666063359-34283-1-git-send-email-chaoyong.he@corigine.com> References: <1666063359-34283-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2PR01CA0184.apcprd01.prod.exchangelabs.com (2603:1096:4:189::9) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|MN2PR13MB4149:EE_ X-MS-Office365-Filtering-Correlation-Id: e72dab46-af75-447d-5066-08dab0b810c5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6HajEuE9GoFY99hK8TeeJouHWqr3z+yPSKkQGQ31n4JTuyayVR66IKzDPHDxxM4VvbIpBYj+LETIlCfL54e7jeHHzGvbrxLZh1z8IkE0QuX6X12C7simq7Rpb5J8olLK+WzEM+Hqivl0M0KPUWO4pricH7S7U/53HWic/nEGnmtuoWE6wZ9qz2B5T9QrrzXti5wTcoiXRHEIDaoy0iUPrVkO8fpyJ65VPl482uoPwGFpRzGNoRIZTzglh8Vm3x9V6RgoY8DyvffPSSQM867n/oVuatRZmp+MyrGp6DAFW66Py4MVHJXP8gOgT/u+D7Em0AqBAoFiOVl10n9WEfkYsCHJexCvBatMMNiuEUncgev2TW72fBh/gil5ToSFwgTHyC4iQaIxlDZ5hp7eBfzW0hUo6eR4GIObc4zp2V7VV3msYpVF6pU/TnHWmi8P2BLIj8UClmDEyuHSiJAmb6VBtTkLzE9ae3D63nzsiPTDYoZNrpq1I6dhNWBQIVW/iRljj+IKrJHDqfvWxrM3BbV4V8R6kfzaV11Dtcv+C4NYyIU4pJJy7JD0tIUu0uGazbwln21gX3ZoGTwNxZEHyBF+Bb2egZ7AjoobSBaQNooQTeQasJmhggL92ijJH7RccUNX9WnJgw5oDm/o9uAIBP5ZyqfKUn6EQ8sNSstEspMqgC/AfVoFP9WcQdZjkqHO9dOk4LGoG9YaD333zuNtdykoqQfp1WDh9//Lp3sz8XfkAmUv8teB2VsB1Ayounm7rnmp+yLZCuE2owxLz43tgFhqD/y5WuZOJSnvJsjsyQsKwScEb/gUi6JYRAoW9kE110rX 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)(346002)(376002)(396003)(39840400004)(451199015)(38350700002)(86362001)(38100700002)(36756003)(83380400001)(66574015)(5660300002)(52116002)(6506007)(2616005)(26005)(6512007)(186003)(6666004)(2906002)(6916009)(316002)(6486002)(107886003)(4326008)(66946007)(66556008)(478600001)(8936002)(44832011)(41300700001)(8676002)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?WlVDY1RDa05NeXdkTC9ueGZCbmVMZHdpTnREcE5wQjFuQUx5RjB2VDdMKzBR?= =?utf-8?B?aGtGVHFUU05zMmZxQWovSlJTNElvVjRVbzBHeE13K1hiclFhTVpkdGpKNGh2?= =?utf-8?B?V1BnMk1UdUJ6MFR0VkdaTVRJMk41Uzd5cGR1RkQzYVhaVjAxMHJrd0RkSVhy?= =?utf-8?B?UGZSZUlENi9tanZTeTVhZWNVQUFEZkNxNS9hd3poaWpwd1ZzUjBQQWF3Q3Y5?= =?utf-8?B?SCt5U1kwd2dQd0ZMSS9lUVl2cEMrMk5YNldOTlVEV3RJQi8vOUpuc2hJWkdv?=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5d29pZjdFYXAxY1FJa3ErTzBmeVNYQS9MVjNxSzhu?= =?utf-8?B?Q21Ta1dSSGI3WmNVTldsRDhaSWtEamRoQytBRHRqdVdaVzhDUXdsSUowcUcv?= =?utf-8?B?dUE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: e72dab46-af75-447d-5066-08dab0b810c5 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 03:23:02.9746 (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: 5522Tnt+mueRBDKBND2zEMzEP7UN4BPY3j3Qfy/gQcroLnylj7Il9WyxggtBmIlgbau1XVdhIiIjlM3K8fW85gSdYvK/XMA8W3MLoS0NGbw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR13MB4149 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 5f6f800..1673518 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -505,6 +505,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; @@ -547,6 +548,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"); @@ -565,8 +568,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) { @@ -576,6 +580,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: @@ -902,42 +919,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; } @@ -1106,7 +1142,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, @@ -1115,8 +1151,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) { @@ -1127,11 +1170,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; } @@ -1140,7 +1193,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, @@ -1413,6 +1467,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 + @@ -1422,6 +1477,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