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 35216A0543; Tue, 25 Oct 2022 10:00:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 75D2142BC8; Tue, 25 Oct 2022 10:00:02 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2100.outbound.protection.outlook.com [40.107.236.100]) by mails.dpdk.org (Postfix) with ESMTP id 1035F42BCC for ; Tue, 25 Oct 2022 10:00:01 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TXi5yFylNa3s4nnY4O4sdaYZcJ/HiH1xDe6umDooYraE/jiYD30czb9xTvfym5BvwtpIRdiRo4xRX+n/j/Ttc8VeKo5/dloNYumfqwj0dvkF4ipDrhud7bY9RsBUFgx+T1UEUSA0bcCefPA0P7qJzPP4PHDyN1RsnzaXCkHMWGMUZ5DtOFEknSCgtCFQun9AbtsNiK8pDEvo/P65gtQJidf34FZA5iC+P7SRaBJ1eQ9G3l8ldWOORZheg/Xv57BaO0DXbjmQlZRv//zFOCOHsCocKBPu4V8HBnXbAkfQ27I+SJvgW3lnriMgQp/I/hUPf38U/IAYFxRy37789y3A6Q== 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=ZMhtGykeFGGi733dMMPy9ZTaq8ctP2m9vOJZNQzWVYs=; b=Vc8gQxe3Mli8kx53Al/6bqq+yciRHuMMpNrlYdFX0gN/hyRfpmawr990EQm6TP7tc3gXt/1ebUi03uxI9g/aR8x8wvhvwal04sac2NwxJo8CC3FUx1iNbbkKqvWe/G072gFZA8Wacm+Jd5dypicl7ezZBG2mNjw5+gut1gRvTt//BWIvEBzxxexbCcYsJvb0q36tLYbdMTe6Re7DpxKnJMfzkC1nzFh8u3ywFHQhZ3k9H7K7pVYRDJnZ/v2TTDiWYJsVRRZLdwKxWWhsbduIBbUOYCAPJgFGJxIjaQdjxo4wxEJj5nlzQfRZPpO2YqK62HXJ2SIZC8Pr3AvPYx3f/w== 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=ZMhtGykeFGGi733dMMPy9ZTaq8ctP2m9vOJZNQzWVYs=; b=TQBPxZvPuILDE/C4Dn6WLJuCUFp0KLITiJFCkqF2pPhxkzeugOhEQJr4CiWgoLW7RC0IKWaqNuqLJhsa9p8QaaFCWICuIFS0QlrhitmdXXaoMlce6xZXZOrmlcDm+mg8sb4CNGiByAmeqGcsPUDUryjjlCG2jAy9cZjYKCsFf/E= 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 BY5PR13MB4405.namprd13.prod.outlook.com (2603:10b6:a03:1d4::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.28; Tue, 25 Oct 2022 07:59:57 +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, 25 Oct 2022 07:59:57 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v3 03/26] net/nfp: support IPv6 VXLAN flow item Date: Tue, 25 Oct 2022 15:58:55 +0800 Message-Id: <20221025075918.7778-4-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.29.3 In-Reply-To: <20221025075918.7778-1-chaoyong.he@corigine.com> References: <1666427069-10553-1-git-send-email-chaoyong.he@corigine.com> <20221025075918.7778-1-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2PR01CA0142.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::22) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|BY5PR13MB4405:EE_ X-MS-Office365-Filtering-Correlation-Id: 92ffbb21-f077-440c-08b9-08dab65ee882 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: urgnt31LV1Yt3BWhDNt7A6FQ4zptDEsz83IKXVbJb+Hh81HudwJOuywKuox8C84voZG1mPysqA+uLw8IRSXeimKcGYHzZiyksN37rfkc+6kZAdVy+FKH6c3qkRKTRxPUfhSIduf5Pie5UAsmVoifBPssETSsqSNABjIAbxBLNEqjdjJWxGoEhKqFKMUPEiUjOIVCAx6BSUllClzlrfJFWUXuHn8OXo5wC4QU5AitHPy30tM1+zzCEZxO4/d6rUUKrX5xaBalq7T5Rv7uIV5Tku4xXsJ0vUuawY+bty+vAAZk/dL48FQalmtjIVJhXJtRXGOAlZRNFGhjxsH9YMJanRFiOWNT26XCmjw/PNd0ofKZ+DZaT9RaUwUKWpMSXrzGzhDYe2S9OW1hiG+aixRmX5Cf/xP6WhTZGLmY4K1PUCY3j6v/ySUyh3CJ6eCd6O/cGcyB4QpUlOWlklCDDmEDcmeWoMZhpBPTmNFumsVj/ObZAI6+FoBh6pK4620WTy86HDpGIvxhpYqRfnf3AWCKM2ZM7VRsWXDTdPqvDKBFpnHcplWbvsHHouesd5HsUyAKTWcGXZN1PfzRMNciV9z3Pqs6mrVSz3kClzGldl2h4QloBpmp7k/tF+AwKgV6xSETmBk2VBLGGS7bRx6XUangeQcb6s+lFwEdmf0BHzyasLbclauxFUwitVx7kWXoFQamTcXTLKM/s0ro682bsKjP7JKz1emSRdNr5FhoDFk6dl4QwdAVLg2rWCzMekfJoqnljgpPDN+tH/fSk1WEktWcwg== 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)(39830400003)(346002)(136003)(376002)(366004)(396003)(451199015)(36756003)(6486002)(5660300002)(30864003)(66946007)(66476007)(8936002)(38350700002)(38100700002)(66556008)(83380400001)(66574015)(86362001)(44832011)(6916009)(2616005)(26005)(107886003)(186003)(6512007)(1076003)(316002)(478600001)(52116002)(8676002)(41300700001)(4326008)(2906002)(6506007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?cDZvUHRkUHY5Ui9BQkV1WXhyV3ExV2ErMWw2Uzc2aitLMCtGbEpacW5RR3Nx?= =?utf-8?B?Nm56OGtER3FsczZMTEhNRnFRRTdHbnZJZGdPemdWUnhmVUllQ3BZOUFzbnQ4?= =?utf-8?B?RE5tV1Blc2pObHdSbUtLQ0FvQzM5WWlvcVVZZmUxOGh6clhKTEFJUEVYNEU4?= =?utf-8?B?MU5ZOHp5ZkV6eWlCcEVBdnE0aHIrUnhwaWpSRHlIWFkrY1hRM0NQNW41b2dF?= =?utf-8?B?Q2QxRlg0VEREaCs4UG1KY1AzRFJxSm05aFZ1dThPRn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nhkb3MxbTNMRHNxTVk3VnlHejVjK3BkdzBnRk5Zb3B1Vm80?= =?utf-8?B?bmx2bW5ydExrV3NBYitFT095SDlIMDlISVlRSWh5aDlQZUIrQXcxbSsxNjIz?= =?utf-8?B?SlE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 92ffbb21-f077-440c-08b9-08dab65ee882 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2022 07:59:57.3175 (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: 5YIg/UAXYPSr/IwjPsLBtZn3oCb1kBrmrjqDgLOrnu7L/Cz847MocUYdqwyXWVnC7IB4VtW/nMYTGQOjYyxy78rFiVDsmbeZHuUKUD98YXk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR13MB4405 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 08e2873808..996ba3b982 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 0e1e5ea6b2..bbd9dbabde 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -493,6 +493,7 @@ nfp_flow_key_layers_calculate_items(const struct rte_flow_item items[], { 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 @@ nfp_flow_key_layers_calculate_items(const struct rte_flow_item items[], 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 @@ nfp_flow_key_layers_calculate_items(const struct rte_flow_item items[], 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 @@ nfp_flow_key_layers_calculate_items(const struct rte_flow_item items[], * 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 @@ nfp_flow_merge_ipv6(struct rte_flow *nfp_flow, 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 @@ nfp_flow_merge_sctp(struct rte_flow *nfp_flow, } 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 @@ nfp_flow_merge_vxlan(__rte_unused struct rte_flow *nfp_flow, { 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 @@ nfp_flow_merge_vxlan(__rte_unused struct rte_flow *nfp_flow, 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 @@ nfp_flow_merge_vxlan(__rte_unused struct rte_flow *nfp_flow, 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 @@ nfp_flow_compile_items(__rte_unused struct nfp_flower_representor *representor, 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 @@ nfp_flow_compile_items(__rte_unused struct nfp_flower_representor *representor, 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) -- 2.29.3