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 CC09A45DB9 for ; Wed, 27 Nov 2024 18:23:29 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C7E53402DE; Wed, 27 Nov 2024 18:23:29 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id AFBA8406BB for ; Wed, 27 Nov 2024 18:23:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732728207; 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=7taVzkHnf0av+OMFrST2qScbZaPIqYU9q3vezFl9JW0=; b=gI8t+2ZyDxP8kjlmdMHQ31zgLnkpB4gBK++CiQiYi84blCQsTOiu9CMEn6BcKMgA/TVPaG zabjeVRtMfuugvIcgbX+tACACGlZkCumM+oOUrxsFKhqaCW7MTYO19VjhJGQ4IBhhbmXy4 CiLjNtcWTyHkbf5Eqrgd9EokmfOQ5/Q= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-468-jFIgUnq8MbKZR2yMyN4hCg-1; Wed, 27 Nov 2024 12:23:23 -0500 X-MC-Unique: jFIgUnq8MbKZR2yMyN4hCg-1 X-Mimecast-MFC-AGG-ID: jFIgUnq8MbKZR2yMyN4hCg Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 31DD4195608D; Wed, 27 Nov 2024 17:23:22 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.192.52]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9E342300019E; Wed, 27 Nov 2024 17:23:20 +0000 (UTC) From: Kevin Traynor To: Vladimir Medvedkin Cc: Bruce Richardson , dpdk stable Subject: patch 'net/i40e: check register read for outer VLAN' has been queued to stable release 21.11.9 Date: Wed, 27 Nov 2024 17:18:59 +0000 Message-ID: <20241127171916.690404-112-ktraynor@redhat.com> In-Reply-To: <20241127171916.690404-1-ktraynor@redhat.com> References: <20241127171916.690404-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: hgwds56_JcPLqy6z1SJuStM7DmOPySZO7UF5MaFBKkU_1732728202 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.9 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 12/02/24. 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/b70507e59f9851e15707afd90b2eb8ccb3f2c4f7 Thanks. Kevin --- >From b70507e59f9851e15707afd90b2eb8ccb3f2c4f7 Mon Sep 17 00:00:00 2001 From: Vladimir Medvedkin Date: Fri, 15 Nov 2024 19:14:25 +0000 Subject: [PATCH] net/i40e: check register read for outer VLAN [ upstream commit c11c52dd5d2a19c97616ac32a1d4911c48f157d4 ] 'i40e_get_outer_vlan()' does not check 'i40e_aq_debug_read_register()' return value. This patch fixes this issue, by checking the return value and, on error, having the i40e_get_outer_vlan() function return that error back to the caller. This in turn requires a change in the return type of that function and updates to the places where it is called to: * handle the error, and * handle the tpid being returned as an "out" parameter rather than return code. Coverity issue: 445518 Fixes: 86eb05d6350b ("net/i40e: add flow validate function") Signed-off-by: Vladimir Medvedkin Acked-by: Bruce Richardson --- drivers/net/i40e/i40e_flow.c | 77 ++++++++++++++++++++++++++++++------ 1 file changed, 65 insertions(+), 12 deletions(-) diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index 5c7f445018..576a63f06f 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -2019,6 +2019,6 @@ i40e_flow_parse_attr(const struct rte_flow_attr *attr, } -static uint16_t -i40e_get_outer_vlan(struct rte_eth_dev *dev) +static int +i40e_get_outer_vlan(struct rte_eth_dev *dev, uint16_t *tpid) { struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -2027,5 +2027,5 @@ i40e_get_outer_vlan(struct rte_eth_dev *dev) uint64_t reg_r = 0; uint16_t reg_id; - uint16_t tpid; + int ret; if (qinq) @@ -2034,10 +2034,14 @@ i40e_get_outer_vlan(struct rte_eth_dev *dev) reg_id = 3; - i40e_aq_debug_read_register(hw, I40E_GL_SWT_L2TAGCTRL(reg_id), + ret = i40e_aq_debug_read_register(hw, I40E_GL_SWT_L2TAGCTRL(reg_id), ®_r, NULL); + if (ret != I40E_SUCCESS) { + PMD_DRV_LOG(ERR, "Failed to read from L2 tag ctrl register [%d]", reg_id); + return -EIO; + } - tpid = (reg_r >> I40E_GL_SWT_L2TAGCTRL_ETHERTYPE_SHIFT) & 0xFFFF; + *tpid = (reg_r >> I40E_GL_SWT_L2TAGCTRL_ETHERTYPE_SHIFT) & 0xFFFF; - return tpid; + return 0; } @@ -2059,4 +2063,6 @@ i40e_flow_parse_ethertype_pattern(struct rte_eth_dev *dev, const struct rte_flow_item_eth *eth_mask; enum rte_flow_item_type item_type; + int ret; + uint16_t tpid; for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) { @@ -2117,6 +2123,21 @@ i40e_flow_parse_ethertype_pattern(struct rte_eth_dev *dev, if (filter->ether_type == RTE_ETHER_TYPE_IPV4 || filter->ether_type == RTE_ETHER_TYPE_IPV6 || - filter->ether_type == RTE_ETHER_TYPE_LLDP || - filter->ether_type == i40e_get_outer_vlan(dev)) { + filter->ether_type == RTE_ETHER_TYPE_LLDP) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "Unsupported ether_type in control packet filter."); + return -rte_errno; + } + + ret = i40e_get_outer_vlan(dev, &tpid); + if (ret != 0) { + rte_flow_error_set(error, EIO, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "Can not get the Ethertype identifying the L2 tag"); + return -rte_errno; + } + if (filter->ether_type == tpid) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -2126,4 +2147,5 @@ i40e_flow_parse_ethertype_pattern(struct rte_eth_dev *dev, return -rte_errno; } + break; default: @@ -2399,4 +2421,5 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, uint8_t field_idx; int ret; + uint16_t tpid; memset(off_arr, 0, sizeof(off_arr)); @@ -2467,6 +2490,5 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, if (ether_type == RTE_ETHER_TYPE_IPV4 || - ether_type == RTE_ETHER_TYPE_IPV6 || - ether_type == i40e_get_outer_vlan(dev)) { + ether_type == RTE_ETHER_TYPE_IPV6) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -2475,4 +2497,20 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, return -rte_errno; } + ret = i40e_get_outer_vlan(dev, &tpid); + if (ret != 0) { + rte_flow_error_set(error, EIO, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "Can not get the Ethertype identifying the L2 tag"); + return -rte_errno; + } + if (ether_type == tpid) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "Unsupported ether_type."); + return -rte_errno; + } + input_set |= I40E_INSET_LAST_ETHER_TYPE; filter->input.flow.l2_flow.ether_type = @@ -2521,6 +2559,5 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, if (ether_type == RTE_ETHER_TYPE_IPV4 || - ether_type == RTE_ETHER_TYPE_IPV6 || - ether_type == i40e_get_outer_vlan(dev)) { + ether_type == RTE_ETHER_TYPE_IPV6) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -2529,4 +2566,20 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, return -rte_errno; } + ret = i40e_get_outer_vlan(dev, &tpid); + if (ret != 0) { + rte_flow_error_set(error, EIO, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "Can not get the Ethertype identifying the L2 tag"); + return -rte_errno; + } + if (ether_type == tpid) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "Unsupported ether_type."); + return -rte_errno; + } + input_set |= I40E_INSET_LAST_ETHER_TYPE; filter->input.flow.l2_flow.ether_type = -- 2.47.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-11-27 17:17:41.785873526 +0000 +++ 0112-net-i40e-check-register-read-for-outer-VLAN.patch 2024-11-27 17:17:38.344269990 +0000 @@ -1 +1 @@ -From c11c52dd5d2a19c97616ac32a1d4911c48f157d4 Mon Sep 17 00:00:00 2001 +From b70507e59f9851e15707afd90b2eb8ccb3f2c4f7 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit c11c52dd5d2a19c97616ac32a1d4911c48f157d4 ] + @@ -19 +20,0 @@ -Cc: stable@dpdk.org @@ -28 +29 @@ -index c6857727e8..cd598431e1 100644 +index 5c7f445018..576a63f06f 100644 @@ -31 +32 @@ -@@ -1264,6 +1264,6 @@ i40e_flow_parse_attr(const struct rte_flow_attr *attr, +@@ -2019,6 +2019,6 @@ i40e_flow_parse_attr(const struct rte_flow_attr *attr, @@ -40 +41 @@ -@@ -1272,5 +1272,5 @@ i40e_get_outer_vlan(struct rte_eth_dev *dev) +@@ -2027,5 +2027,5 @@ i40e_get_outer_vlan(struct rte_eth_dev *dev) @@ -47 +48 @@ -@@ -1279,10 +1279,14 @@ i40e_get_outer_vlan(struct rte_eth_dev *dev) +@@ -2034,10 +2034,14 @@ i40e_get_outer_vlan(struct rte_eth_dev *dev) @@ -65 +66 @@ -@@ -1304,4 +1308,6 @@ i40e_flow_parse_ethertype_pattern(struct rte_eth_dev *dev, +@@ -2059,4 +2063,6 @@ i40e_flow_parse_ethertype_pattern(struct rte_eth_dev *dev, @@ -72 +73 @@ -@@ -1362,6 +1368,21 @@ i40e_flow_parse_ethertype_pattern(struct rte_eth_dev *dev, +@@ -2117,6 +2123,21 @@ i40e_flow_parse_ethertype_pattern(struct rte_eth_dev *dev, @@ -96 +97 @@ -@@ -1371,4 +1392,5 @@ i40e_flow_parse_ethertype_pattern(struct rte_eth_dev *dev, +@@ -2126,4 +2147,5 @@ i40e_flow_parse_ethertype_pattern(struct rte_eth_dev *dev, @@ -102 +103 @@ -@@ -1642,4 +1664,5 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, +@@ -2399,4 +2421,5 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, @@ -108 +109 @@ -@@ -1710,6 +1733,5 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, +@@ -2467,6 +2490,5 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, @@ -116 +117 @@ -@@ -1718,4 +1740,20 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, +@@ -2475,4 +2497,20 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, @@ -137 +138 @@ -@@ -1764,6 +1802,5 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, +@@ -2521,6 +2559,5 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, @@ -145 +146 @@ -@@ -1772,4 +1809,20 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, +@@ -2529,4 +2566,20 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,