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 3E4F6A0350 for ; Mon, 28 Feb 2022 22:22:16 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 392EC40140; Mon, 28 Feb 2022 22:22:16 +0100 (CET) Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by mails.dpdk.org (Postfix) with ESMTP id A7C5941181 for ; Mon, 28 Feb 2022 22:22:13 +0100 (CET) Received: by mail-wm1-f43.google.com with SMTP id i66so245102wma.5 for ; Mon, 28 Feb 2022 13:22:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MSlQpnhGspSPbxZ42+2zVqcoNSvz3fvXGRJ7oE1vJWY=; b=T0iNrIwYolEy3ZxXFRVGU4TUuG053rjwKCeBj9SDtUU+NiebIvxS4DI4IRKB0JGDC0 ZDonzTw1t/mBRRF21Der2kJRQq+zaqXyBONIwE/mEVi04MeB9tkuOAXNLp69UUnKwFLC HZfDtTuBX2kRYx5B0tHNEFnMTaFDZ1V5dbAgQAGe4V8RBoFi072pvbXsRaA6Lwne2XNf hR4ba7++El3+aTwH7AU8gR2m8Qa41v7r1bpFrSI8M6eDySi8IKVsLpdbnYV0xlI8wGG2 H5tNiewt8AzYlij7qUnQEwRk58CwNRFObNP7ytQlLRuyAALdOSgwgliR7JdmM+zL0E7Y 8nJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MSlQpnhGspSPbxZ42+2zVqcoNSvz3fvXGRJ7oE1vJWY=; b=e0Nhcnxlg8yUOXtRHhl1VTzGhr/yUBPoy7tJyo3ld2QSyHj0bXrY17r/soF4a4w2KB 9LsoBsmPu/yzC/momGfI8tZKSSdDpHj22V98Qxn6esfQijFjmKOf0R+Bp4doJAntyPSj mZpZPCWB4ljGWdfmsIgmy+2IOkfBepSulo5Jh0atcXRa3zzM3fSS+nD3WNP6RF+xF31A sJvD8f9eOspcnrOm/UopxlXtv+nmcElwRfuWWJRIttzxgCTYEhuED9Oks9QjUkQcBFXr E8Gs2vBLHr2ymJ038Zr6oBCZJruaYfIOyWaVuieX1/A5NRDOJXQN70Qm9BSL3scrz+wU Ugnw== X-Gm-Message-State: AOAM530DjZ72pxCR0YDAlqTBhUJAZaTE5oOc2ANhuIsZPuUy5UFgve7l NWuS+U+E3CIhyNkq9qbX25SL+OOgET1nbw== X-Google-Smtp-Source: ABdhPJwC+9cW3mChOxZOeeF7U98eood7Eve0dkk1KtpWNVBaW4wQWhBkFbnbobk74cQt9EdAm1kYtg== X-Received: by 2002:a05:600c:4ed1:b0:37b:bb72:9ecd with SMTP id g17-20020a05600c4ed100b0037bbb729ecdmr14608895wmq.177.1646083333436; Mon, 28 Feb 2022 13:22:13 -0800 (PST) Received: from localhost ([2a01:4b00:f41a:3600:360b:9754:2e3a:c344]) by smtp.gmail.com with ESMTPSA id r1-20020a05600c2f0100b00381821b4dbdsm512326wmn.6.2022.02.28.13.22.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 13:22:12 -0800 (PST) From: luca.boccassi@gmail.com 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 20.11.5 Date: Mon, 28 Feb 2022 21:20:24 +0000 Message-Id: <20220228212047.3341966-28-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220228212047.3341966-1-luca.boccassi@gmail.com> References: <20220218123931.1749595-122-luca.boccassi@gmail.com> <20220228212047.3341966-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 20.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 03/02/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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/b1b1cd71e95f12cc41e70595a9a9e8aaeb32d279 Thanks. Luca Boccassi --- >From b1b1cd71e95f12cc41e70595a9a9e8aaeb32d279 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 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index eaf93695ec..efe7b80e7a 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -1125,7 +1125,7 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, if (ret) { 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; } @@ -1141,26 +1141,27 @@ 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; } #if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG) ret = rte_pktmbuf_alloc_bulk(rxq->umem->mb_pool, fq_bufs, reserve_size); if (ret) { AF_XDP_LOG(DEBUG, "Failed to get enough buffers for fq.\n"); - goto err; + goto out_xsk; } #endif 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.30.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-02-28 21:17:56.205101557 +0000 +++ 0028-net-af_xdp-ensure-socket-is-deleted-on-Rx-queue-setu.patch 2022-02-28 21:17:53.916930897 +0000 @@ -1 +1 @@ -From b26431a617e4039e6c0f65c5ee56f62f347b686b Mon Sep 17 00:00:00 2001 +From b1b1cd71e95f12cc41e70595a9a9e8aaeb32d279 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit b26431a617e4039e6c0f65c5ee56f62f347b686b ] + @@ -16 +17,0 @@ -Cc: stable@dpdk.org @@ -20,2 +21,2 @@ - drivers/net/af_xdp/rte_eth_af_xdp.c | 17 +++++++++-------- - 1 file changed, 9 insertions(+), 8 deletions(-) + drivers/net/af_xdp/rte_eth_af_xdp.c | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) @@ -24 +25 @@ -index 2477f31c7b..7d5e2887b8 100644 +index eaf93695ec..efe7b80e7a 100644 @@ -27 +28 @@ -@@ -1301,7 +1301,7 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, +@@ -1125,7 +1125,7 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, @@ -35,2 +36,2 @@ - cfg.libbpf_flags = XSK_LIBBPF_FLAGS__INHIBIT_PROG_LOAD; -@@ -1318,7 +1318,7 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, + } +@@ -1141,26 +1141,27 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, @@ -44,11 +45 @@ - /* insert the xsk into the xsks_map */ -@@ -1330,7 +1330,7 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, - &rxq->xsk_queue_idx, &fd, 0); - if (err) { - AF_XDP_LOG(ERR, "Failed to insert xsk in map.\n"); -- goto err; -+ goto out_xsk; - } - } - -@@ -1338,7 +1338,7 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, + #if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG) @@ -62,10 +52,0 @@ - -@@ -1346,20 +1346,21 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, - ret = configure_preferred_busy_poll(rxq); - if (ret) { - AF_XDP_LOG(ERR, "Failed configure busy polling.\n"); -- goto err; -+ goto out_xsk; - } - } -