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 E377CA034F for ; Tue, 1 Mar 2022 11:45:16 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DB482426E1; Tue, 1 Mar 2022 11:45:16 +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 9F16240DF6 for ; Tue, 1 Mar 2022 11:45:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646131515; 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=OVuE0/YQ6v/nF0xPgG0SCwjgpLc/XcZepa3BSS9lgQo=; b=CfLNhaMHC9yStuqIqOsDEHZNTy22XbTEcrws9+4a1hmnwSE9uosHLvFsdrZ7ipIAOjIagm ro0MCxKsTSREyGZ4ce5Gs8/1g8ZHhRo/cAI716QbROVl+FJfsYSIej/42/PztxAEDeVr7d p/b0Pc11Q+ZaRS+6tZRYhPi6NLQTf9M= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-656-Zu8C0a-2M4CGwcbwumGTlw-1; Tue, 01 Mar 2022 05:45:12 -0500 X-MC-Unique: Zu8C0a-2M4CGwcbwumGTlw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3BD991868335; Tue, 1 Mar 2022 10:45:11 +0000 (UTC) Received: from rh.Home (unknown [10.39.194.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 62331752D2; Tue, 1 Mar 2022 10:45:10 +0000 (UTC) From: Kevin Traynor To: Ciara Loftus Cc: dpdk stable Subject: patch 'net/af_xdp: ensure socket is deleted on Rx queue setup error' has been queued to stable release 21.11.1 Date: Tue, 1 Mar 2022 10:42:16 +0000 Message-Id: <20220301104300.334382-60-ktraynor@redhat.com> In-Reply-To: <20220301104300.334382-1-ktraynor@redhat.com> References: <20220301104300.334382-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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-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.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/06/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/a628e2bf191fcceceab538aa40750d75fec4f5fd Thanks. Kevin --- >From a628e2bf191fcceceab538aa40750d75fec4f5fd Mon Sep 17 00:00:00 2001 From: Ciara Loftus Date: Fri, 18 Feb 2022 11:20:36 +0000 Subject: [PATCH] net/af_xdp: ensure socket is deleted on Rx queue setup error [ upstream commit b26431a617e4039e6c0f65c5ee56f62f347b686b ] The Rx queue setup can fail for many reasons eg. failure to setup the custom program, failure to allocate or reserve fill queue buffers, failure to configure busy polling etc. When a failure like one of these occurs, if the xsk is already set up it should be deleted before returning. This commit ensures this happens. Fixes: d8a210774e1d ("net/af_xdp: support unaligned umem chunks") Fixes: 288a85aef192 ("net/af_xdp: enable custom XDP program loading") Fixes: 055a393626ed ("net/af_xdp: prefer busy polling") Fixes: 01fa83c94d7e ("net/af_xdp: workaround custom program loading") Signed-off-by: Ciara Loftus --- drivers/net/af_xdp/rte_eth_af_xdp.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index d7e46c0aa5..958f18e6d5 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -1277,5 +1277,5 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, AF_XDP_LOG(ERR, "Failed to load custom XDP program %s\n", internals->prog_path); - goto err; + goto out_umem; } internals->custom_prog_configured = 1; @@ -1294,5 +1294,5 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, if (ret) { AF_XDP_LOG(ERR, "Failed to create xsk socket.\n"); - goto err; + goto out_umem; } @@ -1306,5 +1306,5 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, if (err) { AF_XDP_LOG(ERR, "Failed to insert xsk in map.\n"); - goto err; + goto out_xsk; } } @@ -1314,5 +1314,5 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, if (ret) { AF_XDP_LOG(DEBUG, "Failed to get enough buffers for fq.\n"); - goto err; + goto out_xsk; } #endif @@ -1322,5 +1322,5 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, if (ret) { AF_XDP_LOG(ERR, "Failed configure busy polling.\n"); - goto err; + goto out_xsk; } } @@ -1328,12 +1328,13 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, ret = reserve_fill_queue(rxq->umem, reserve_size, fq_bufs, &rxq->fq); if (ret) { - xsk_socket__delete(rxq->xsk); AF_XDP_LOG(ERR, "Failed to reserve fill queue.\n"); - goto err; + goto out_xsk; } return 0; -err: +out_xsk: + xsk_socket__delete(rxq->xsk); +out_umem: if (__atomic_sub_fetch(&rxq->umem->refcnt, 1, __ATOMIC_ACQUIRE) == 0) xdp_umem_destroy(rxq->umem); -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-03-01 10:41:03.033249882 +0000 +++ 0060-net-af_xdp-ensure-socket-is-deleted-on-Rx-queue-setu.patch 2022-03-01 10:41:01.346244106 +0000 @@ -1 +1 @@ -From b26431a617e4039e6c0f65c5ee56f62f347b686b Mon Sep 17 00:00:00 2001 +From a628e2bf191fcceceab538aa40750d75fec4f5fd Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit b26431a617e4039e6c0f65c5ee56f62f347b686b ] + @@ -16 +17,0 @@ -Cc: stable@dpdk.org @@ -24 +25 @@ -index 2477f31c7b..7d5e2887b8 100644 +index d7e46c0aa5..958f18e6d5 100644 @@ -27 +28 @@ -@@ -1302,5 +1302,5 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, +@@ -1277,5 +1277,5 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, @@ -34 +35 @@ -@@ -1319,5 +1319,5 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, +@@ -1294,5 +1294,5 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, @@ -41 +42 @@ -@@ -1331,5 +1331,5 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, +@@ -1306,5 +1306,5 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, @@ -48 +49 @@ -@@ -1339,5 +1339,5 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, +@@ -1314,5 +1314,5 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, @@ -55 +56 @@ -@@ -1347,5 +1347,5 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, +@@ -1322,5 +1322,5 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, @@ -62 +63 @@ -@@ -1353,12 +1353,13 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, +@@ -1328,12 +1328,13 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq,