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 2BB3BA00C2 for ; Tue, 10 May 2022 14:30:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 25FBD42835; Tue, 10 May 2022 14:30:36 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 444E24069D for ; Tue, 10 May 2022 14:30:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652185833; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oluSAsDMXov1KpifXu3PtfHwR0Bv4yClciETfO6xUxU=; b=cG/GmyfSgSGsdKiMPnG5zYJWc5p/AbZNbvnfiNc9EMp4b7foIr+9Ny2QsmKrGNBdmQmzlO 9IbalmUl3lobkbDzUN8Y8Kib+u7no/SQqQM8yJTxc0yETJjdDmpA2LI7vX3d+3dLfocZpA 7ZiiP93JZovqQRtYFaHqSVWY1ugIG5s= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-121-CWAE5iRhNl6bJAdILaI5zw-1; Tue, 10 May 2022 08:30:30 -0400 X-MC-Unique: CWAE5iRhNl6bJAdILaI5zw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5450B185A794; Tue, 10 May 2022 12:30:30 +0000 (UTC) Received: from rh.Home (unknown [10.39.195.199]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4906C400E89C; Tue, 10 May 2022 12:30:29 +0000 (UTC) From: Kevin Traynor To: Qi Zhang Cc: Xu Ting , dpdk stable Subject: patch 'net/ice: refactor parser usage' has been queued to stable release 21.11.2 Date: Tue, 10 May 2022 13:29:45 +0100 Message-Id: <20220510123010.159523-8-ktraynor@redhat.com> In-Reply-To: <20220510123010.159523-1-ktraynor@redhat.com> References: <20220510123010.159523-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/aedf24edbb04a77fe2fcde21967a47a2c306515e Thanks. Kevin --- >From aedf24edbb04a77fe2fcde21967a47a2c306515e Mon Sep 17 00:00:00 2001 From: Qi Zhang Date: Thu, 7 Apr 2022 12:06:14 -0400 Subject: [PATCH] net/ice: refactor parser usage [ upstream commit 531d2555c8a644030f1ee7d3c9edf1db9c35d6ef ] Not necessary to create / destroy a parser instance for every raw packet rule. A global parser instance will be created in ice_flow_init and be destroyed in ice_flow_uninit. Also, ice_dev_udp_tunnel_port_add has been hooked to perform corresponding parser configure. This also fix the issue that RSS engine can't support VXLAN inner through raw packet filter. Fixes: 1b9c68120a1c ("net/ice: enable protocol agnostic flow offloading in RSS") Signed-off-by: Qi Zhang Acked-by: Xu Ting --- drivers/net/ice/ice_ethdev.c | 10 ++++++++++ drivers/net/ice/ice_ethdev.h | 1 + drivers/net/ice/ice_fdir_filter.c | 14 ++++---------- drivers/net/ice/ice_generic_flow.c | 8 ++++++++ drivers/net/ice/ice_hash.c | 9 ++++----- 5 files changed, 27 insertions(+), 15 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 2ae25b16f6..ab3976a319 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -5455,4 +5455,6 @@ ice_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, int ret = 0; struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct ice_adapter *ad = + ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); if (udp_tunnel == NULL) @@ -5462,4 +5464,7 @@ ice_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, case RTE_ETH_TUNNEL_TYPE_VXLAN: ret = ice_create_tunnel(hw, TNL_VXLAN, udp_tunnel->udp_port); + if (!ret && ad->psr != NULL) + ice_parser_vxlan_tunnel_set(ad->psr, + udp_tunnel->udp_port, true); break; default: @@ -5479,4 +5484,6 @@ ice_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, int ret = 0; struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct ice_adapter *ad = + ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); if (udp_tunnel == NULL) @@ -5486,4 +5493,7 @@ ice_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, case RTE_ETH_TUNNEL_TYPE_VXLAN: ret = ice_destroy_tunnel(hw, udp_tunnel->udp_port, 0); + if (!ret && ad->psr != NULL) + ice_parser_vxlan_tunnel_set(ad->psr, + udp_tunnel->udp_port, false); break; default: diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h index c0d1baa1ec..56e53a6df3 100644 --- a/drivers/net/ice/ice_ethdev.h +++ b/drivers/net/ice/ice_ethdev.h @@ -537,4 +537,5 @@ struct ice_adapter { /* True if DCF state of the associated PF is on */ bool dcf_state_on; + struct ice_parser *psr; #ifdef RTE_ARCH_X86 bool rx_use_avx2; diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c index ff1cee1195..99053978a9 100644 --- a/drivers/net/ice/ice_fdir_filter.c +++ b/drivers/net/ice/ice_fdir_filter.c @@ -1829,5 +1829,4 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, struct ice_fdir_v6 *p_v6 = NULL; struct ice_parser_result rslt; - struct ice_parser *psr; uint8_t item_num = 0; @@ -1864,4 +1863,7 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, switch (item_type) { case RTE_FLOW_ITEM_TYPE_RAW: { + if (ad->psr == NULL) + return -rte_errno; + raw_spec = item->spec; raw_mask = item->mask; @@ -1875,5 +1877,4 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, unsigned char *tmp_mask = (uint8_t *)(uintptr_t)raw_mask->pattern; - uint16_t udp_port = 0; uint16_t tmp_val = 0; uint8_t pkt_len = 0; @@ -1924,13 +1925,6 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, pkt_len /= 2; - if (ice_parser_create(&ad->hw, &psr)) + if (ice_parser_run(ad->psr, tmp_spec, pkt_len, &rslt)) return -rte_errno; - if (ice_get_open_tunnel_port(&ad->hw, TNL_VXLAN, - &udp_port)) - ice_parser_vxlan_tunnel_set(psr, udp_port, - true); - if (ice_parser_run(psr, tmp_spec, pkt_len, &rslt)) - return -rte_errno; - ice_parser_destroy(psr); if (!tmp_mask) diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c index 406a0a953f..f9be3a5c94 100644 --- a/drivers/net/ice/ice_generic_flow.c +++ b/drivers/net/ice/ice_generic_flow.c @@ -1827,4 +1827,7 @@ ice_flow_init(struct ice_adapter *ad) rte_spinlock_init(&pf->flow_ops_lock); + if (ice_parser_create(&ad->hw, &ad->psr) != ICE_SUCCESS) + PMD_INIT_LOG(WARNING, "Failed to initialize DDP parser, raw packet filter will not be supported"); + RTE_TAILQ_FOREACH_SAFE(engine, &engine_list, node, temp) { if (engine->init == NULL) { @@ -1881,4 +1884,9 @@ ice_flow_uninit(struct ice_adapter *ad) rte_free(p_parser); } + + if (ad->psr != NULL) { + ice_parser_destroy(ad->psr); + ad->psr = NULL; + } } diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c index afbb357fa3..f35727856e 100644 --- a/drivers/net/ice/ice_hash.c +++ b/drivers/net/ice/ice_hash.c @@ -654,5 +654,4 @@ ice_hash_parse_raw_pattern(struct ice_adapter *ad, struct ice_parser_profile prof; struct ice_parser_result rslt; - struct ice_parser *psr; uint8_t *pkt_buf, *msk_buf; uint8_t spec_len, pkt_len; @@ -661,4 +660,7 @@ ice_hash_parse_raw_pattern(struct ice_adapter *ad, int i, j; + if (ad->psr == NULL) + return -rte_errno; + raw_spec = item->spec; raw_mask = item->mask; @@ -714,9 +716,6 @@ ice_hash_parse_raw_pattern(struct ice_adapter *ad, } - if (ice_parser_create(&ad->hw, &psr)) + if (ice_parser_run(ad->psr, pkt_buf, pkt_len, &rslt)) return -rte_errno; - if (ice_parser_run(psr, pkt_buf, pkt_len, &rslt)) - return -rte_errno; - ice_parser_destroy(psr); if (ice_parser_profile_init(&rslt, pkt_buf, msk_buf, -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:21.796636308 +0100 +++ 0008-net-ice-refactor-parser-usage.patch 2022-05-10 13:24:21.569646315 +0100 @@ -1 +1 @@ -From 531d2555c8a644030f1ee7d3c9edf1db9c35d6ef Mon Sep 17 00:00:00 2001 +From aedf24edbb04a77fe2fcde21967a47a2c306515e Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 531d2555c8a644030f1ee7d3c9edf1db9c35d6ef ] + @@ -15 +16,0 @@ -Cc: stable@dpdk.org @@ -28 +29 @@ -index 73e550f5fb..8bb34b874b 100644 +index 2ae25b16f6..ab3976a319 100644 @@ -31 +32 @@ -@@ -5622,4 +5622,6 @@ ice_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, +@@ -5455,4 +5455,6 @@ ice_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, @@ -38 +39 @@ -@@ -5629,4 +5631,7 @@ ice_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, +@@ -5462,4 +5464,7 @@ ice_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, @@ -46 +47 @@ -@@ -5646,4 +5651,6 @@ ice_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, +@@ -5479,4 +5484,6 @@ ice_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, @@ -53 +54 @@ -@@ -5653,4 +5660,7 @@ ice_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, +@@ -5486,4 +5493,7 @@ ice_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, @@ -62 +63 @@ -index 3ab310628f..3d8427225f 100644 +index c0d1baa1ec..56e53a6df3 100644 @@ -65 +66 @@ -@@ -562,4 +562,5 @@ struct ice_adapter { +@@ -537,4 +537,5 @@ struct ice_adapter { @@ -72 +73 @@ -index 7954c6d8ea..0982478feb 100644 +index ff1cee1195..99053978a9 100644 @@ -75 +76 @@ -@@ -1827,5 +1827,4 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, +@@ -1829,5 +1829,4 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, @@ -81 +82 @@ -@@ -1862,4 +1861,7 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, +@@ -1864,4 +1863,7 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, @@ -89 +90 @@ -@@ -1873,5 +1875,4 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, +@@ -1875,5 +1877,4 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, @@ -95 +96 @@ -@@ -1922,13 +1923,6 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, +@@ -1924,13 +1925,6 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, @@ -111 +112 @@ -index 53b1c0b69a..57eb002bde 100644 +index 406a0a953f..f9be3a5c94 100644 @@ -114 +115 @@ -@@ -1832,4 +1832,7 @@ ice_flow_init(struct ice_adapter *ad) +@@ -1827,4 +1827,7 @@ ice_flow_init(struct ice_adapter *ad) @@ -122 +123 @@ -@@ -1886,4 +1889,9 @@ ice_flow_uninit(struct ice_adapter *ad) +@@ -1881,4 +1884,9 @@ ice_flow_uninit(struct ice_adapter *ad)