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 43F0242ECF for ; Thu, 20 Jul 2023 17:26:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4030140685; Thu, 20 Jul 2023 17:26:12 +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 79F1B400D6 for ; Thu, 20 Jul 2023 17:26:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689866769; 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=cyVNPVsHRtRrvv9H+zKzkG70SZa4Y1bVIy57P+NK4ZA=; b=Fr3FYJebm+4kC2Ht3xizktMIIgCAWUB9UG/Huk6Ym2ucqDmc4YOPlTwJd4YVS5q/SOQMBC dQeSw9pVEEnb+4dBQBxJ/B6gS3F2j2/VRQ4ELD8V4MvPeDD9UX8+gUtIOu1/ZQfoC7+LHE AI6igoJ6mMh2cFg10+xdMRyXFpuiKmU= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-441-53epRBSSPxClPCw6wyb90g-1; Thu, 20 Jul 2023 11:20:58 -0400 X-MC-Unique: 53epRBSSPxClPCw6wyb90g-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 849D529A9D5A; Thu, 20 Jul 2023 15:20:30 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.192.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A279492C13; Thu, 20 Jul 2023 15:20:28 +0000 (UTC) From: Kevin Traynor To: Ivan Malov Cc: Andy Moreton , Andrew Rybchenko , dpdk stable Subject: patch 'net/sfc: stop misuse of Rx ingress m-port metadata on EF100' has been queued to stable release 21.11.5 Date: Thu, 20 Jul 2023 16:17:34 +0100 Message-ID: <20230720151942.262154-23-ktraynor@redhat.com> In-Reply-To: <20230720151942.262154-1-ktraynor@redhat.com> References: <20230720151942.262154-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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.5 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/25/23. 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/ed992acac3c02878f8150686df67e1540e13b13b Thanks. Kevin --- >From ed992acac3c02878f8150686df67e1540e13b13b Mon Sep 17 00:00:00 2001 From: Ivan Malov Date: Wed, 12 Apr 2023 17:57:57 +0400 Subject: [PATCH] net/sfc: stop misuse of Rx ingress m-port metadata on EF100 [ upstream commit 462c4f083c464e2d10391c78e7f67f178dbefb27 ] The driver supports representor functionality. In it, packets coming from VFs to the dedicated back-end Rx queue get demultiplexed into front-end Rx queues of representor ethdevs as per the per-packet metadata indicating logical HW ingress ports. On transmit, packets are provided with symmetrical metadata by front-end Tx queues, and the back-end queue transforms the data into so-called Tx override descriptors. These let the packets bypass flow lookup and go directly to the represented VFs. However, in the Rx part, the driver extracts the said metadata on every HW Rx queue, that is, not just on the one used by representors. Doing so leads to a buggy behaviour. It is revealed by operating testpmd as follows: dpdk-testpmd -a 0000:c6:00.0 -a 0000:c6:00.1 -- -i testpmd> flow create 0 transfer pattern port_representor \ port_id is 0 / end actions port_representor port_id 1 / end Flow rule #0 created testpmd> set fwd io testpmd> start tx_first testpmd> flow destroy 0 rule 0 Flow rule #0 destroyed testpmd> stop ---------------------- Forward statistics for port 0 ----------------- RX-packets: 19196498 RX-dropped: 0 RX-total: 19196498 TX-packets: 19196535 TX-dropped: 0 TX-total: 19196535 ----------------------------------------------------------------------- ---------------------- Forward statistics for port 1 ----------------- RX-packets: 19196503 RX-dropped: 0 RX-total: 19196503 TX-packets: 19196530 TX-dropped: 0 TX-total: 19196530 ----------------------------------------------------------------------- In this scenario, two physical functions of the adapter do not have any corresponding "back-to-back" forwarder on peer host. Packets transmitted from port 0 can only be forwarded to port 1 by means of a special flow rule. The flow rule indeed works, but destroying it does not stop forwarding. Port statistics carry on incrementing. Also, it is apparent that forwarding in the opposite direction must not have worked in this case as the flow is meant to target only one of the directions. Because of the bug, the first 32 mbufs received as a result of the flow rule operation have the said metadata present. In io mode, testpmd does not tamper with mbufs and passes them directly to transmit path, so this data remains in them instructing the PMD to override destinations of the packets via Tx option descriptors. Expected behaviour is as follows: ---------------------- Forward statistics for port 0 ----------------- RX-packets: 0 RX-dropped: 0 RX-total: 0 TX-packets: 15787496 TX-dropped: 0 TX-total: 15787496 ----------------------------------------------------------------------- ---------------------- Forward statistics for port 1 ----------------- RX-packets: 15787464 RX-dropped: 0 RX-total: 15787464 TX-packets: 32 TX-dropped: 0 TX-total: 32 ----------------------------------------------------------------------- These figures show the rule work only for one direction. Also, removing the flow shall cause forwarding to cease. Provided patch fixes the bug accordingly. Fixes: d0f981a3efd8 ("net/sfc: handle ingress mport in EF100 Rx prefix") Signed-off-by: Ivan Malov Reviewed-by: Andy Moreton Acked-by: Andrew Rybchenko --- drivers/net/sfc/sfc_dp_rx.h | 1 + drivers/net/sfc/sfc_ef100_rx.c | 18 ++++++++++++++---- drivers/net/sfc/sfc_rx.c | 3 +++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/net/sfc/sfc_dp_rx.h b/drivers/net/sfc/sfc_dp_rx.h index 246adbd87c..8a504bdcf1 100644 --- a/drivers/net/sfc/sfc_dp_rx.h +++ b/drivers/net/sfc/sfc_dp_rx.h @@ -70,4 +70,5 @@ struct sfc_dp_rx_qcreate_info { unsigned int flags; #define SFC_RXQ_FLAG_RSS_HASH 0x1 +#define SFC_RXQ_FLAG_INGRESS_MPORT 0x2 /** Rx queue size */ diff --git a/drivers/net/sfc/sfc_ef100_rx.c b/drivers/net/sfc/sfc_ef100_rx.c index 45253ed7dc..969878bb28 100644 --- a/drivers/net/sfc/sfc_ef100_rx.c +++ b/drivers/net/sfc/sfc_ef100_rx.c @@ -811,4 +811,7 @@ sfc_ef100_rx_qcreate(uint16_t port_id, uint16_t queue_id, rxq->flags |= SFC_EF100_RXQ_NIC_DMA_MAP; + if (info->flags & SFC_RXQ_FLAG_INGRESS_MPORT) + rxq->flags |= SFC_EF100_RXQ_INGRESS_MPORT; + sfc_ef100_rx_debug(rxq, "RxQ doorbell is %p", rxq->doorbell); @@ -877,9 +880,16 @@ sfc_ef100_rx_qstart(struct sfc_dp_rxq *dp_rxq, unsigned int evq_read_ptr, rxq->flags &= ~SFC_EF100_RXQ_USER_MARK; + + /* + * At the moment, this feature is used only + * by the representor proxy Rx queue and is + * essential for representor support, so if + * it has been requested but is unsupported, + * point this inconsistency out to the user. + */ if ((unsup_rx_prefix_fields & - (1U << EFX_RX_PREFIX_FIELD_INGRESS_MPORT)) == 0) - rxq->flags |= SFC_EF100_RXQ_INGRESS_MPORT; - else - rxq->flags &= ~SFC_EF100_RXQ_INGRESS_MPORT; + (1U << EFX_RX_PREFIX_FIELD_INGRESS_MPORT)) && + (rxq->flags & SFC_EF100_RXQ_INGRESS_MPORT)) + return ENOTSUP; rxq->prefix_size = pinfo->erpl_length; diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index cd58d60a36..d9a57ed80f 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -1222,4 +1222,7 @@ sfc_rx_qinit(struct sfc_adapter *sa, sfc_sw_index_t sw_index, rxq_info->rxq_flags = 0; + if (rxq_info->type_flags & EFX_RXQ_FLAG_INGRESS_MPORT) + rxq_info->rxq_flags |= SFC_RXQ_FLAG_INGRESS_MPORT; + rxq->buf_size = buf_size; -- 2.41.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-07-20 16:17:57.937591111 +0100 +++ 0023-net-sfc-stop-misuse-of-Rx-ingress-m-port-metadata-on.patch 2023-07-20 16:17:54.492749817 +0100 @@ -1 +1 @@ -From 462c4f083c464e2d10391c78e7f67f178dbefb27 Mon Sep 17 00:00:00 2001 +From ed992acac3c02878f8150686df67e1540e13b13b Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 462c4f083c464e2d10391c78e7f67f178dbefb27 ] + @@ -85 +86,0 @@ -Cc: stable@dpdk.org @@ -107 +108 @@ -index 16cd8524d3..37b754fa33 100644 +index 45253ed7dc..969878bb28 100644 @@ -140 +141 @@ -index 5ea98187c3..edd0f0c038 100644 +index cd58d60a36..d9a57ed80f 100644 @@ -143 +144 @@ -@@ -1226,4 +1226,7 @@ sfc_rx_qinit(struct sfc_adapter *sa, sfc_sw_index_t sw_index, +@@ -1222,4 +1222,7 @@ sfc_rx_qinit(struct sfc_adapter *sa, sfc_sw_index_t sw_index,