From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F3D9606A33E for ; Wed, 2 Dec 2026 18:09:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20260707.gappssmtp.com header.i=@networkplumber-org.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=UFm/MtlX Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6BE6040A70; Wed, 2 Dec 2026 19:08:33 +0100 (CET) Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by mails.dpdk.org (Postfix) with ESMTPS id 5425D40689 for ; Wed, 2 Dec 2026 19:08:30 +0100 (CET) Received: by mail-pj1-f48.google.com with SMTP id 98e67ed59e1d1-3b421e8d111so8441231a91.3 for ; Wed, 02 Dec 2026 10:08:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20260707.gappssmtp.com; s=20260707; t=1796234909; x=1796839709; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ysFRpeSySdmPaUIjD2OCFwarCQSYKi8e3wyr0oA/mJs=; b=UFm/MtlXOnKcA1UWjE1Z/E4n96bA2bPS1+Z/2tHvlWdjnD55t86zcCe6coOiFaC+HT qUvpjCg/SoCP5P+ijvOqAEGQleKJ+8rBl/wB3mzLN0CwkgEBkFe3XNMT6hiHF3Uv+2D0 8ICsUXMyP+9MdZN2M/PiI6K/7MBAK1TEPZwKf2Njr/F5y6MnLkZ4n5GQnxsIu4hcxUKo r/r6Xwtt52LdSMtaaCGbysZ9u7hVUsEak6cDC1NahjK1nUYwsyeC1zOvWN+/8ORkSZL7 +BCwLaF9M27nBEej+fnAZWBtUPWzhY2t6m/63pvsedSLzRTE5XjdVbIXImuOnfM9LxUK //ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796234909; x=1796839709; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=ysFRpeSySdmPaUIjD2OCFwarCQSYKi8e3wyr0oA/mJs=; b=kAT2D8msii8g1OHDqsMRjgYc4UeIaWBzcC9FwEG6WuTv5oBMPld2r9J61GdMRbjVky idjjv7HFMchNbum1XMdgeXc/ICyc83RP3p066BRFYK8XWxqkkaa7E6NYlP274wcioH/s yrEzANfAlgqyz1BDOq+FXwQw6ZUAJ+FEjcP789cykrZ5g+IPamY6iieRkAG1YadScDH6 +737iwITZQh9aFTYn+uJb5rOWMk8d0AaIW4B6a3mEL7w7XgG307uFt2ScwCNv+DaPqKi FJU0jp0jJXR1c0PAVFE7TI/7EHNRpNuCuxZRWVbcqRcwXCUeTk0nUMvWLIW9GOFs+osV fhYg== X-Gm-Message-State: APuU4Z+wzk4mIgNuFor/B46LNQMPUd8ai99ZIZKjvTaQmdP91Rq3FZOV FpshhEq0OHme3LjVpJu39U0k+klxFbIi6GhHZWJ981zJa1EtE/lniTGFK3FVbNqwY8Re6Daex25 iFfELoFY= X-Gm-Gg: AZFdTZf9GB/jALnAOsbnpjsNZ/bT03G2/OjG849NfgkI7Bs2wHn+Pl2kc9MISJD+vyZ PgLcJW6BZhPb2RIeCe1GaNxlLH/7kDyRyTzPcyOMNZVu0Fuf9n6ZpNISzDpzHojqygkUa0XpMsX D3Be+9kYj59h6ApzJRBz2/aXzpsnU16Ld/R4eeIj+BetRpauX2Ed5eigEdVsWgxXQqDNkklzHwD cXj1ylRxQcBYdmFLlJ904AB9AWMpzlKPWT2+TRCNYKjU5VHVdY4PV2FdXjTKf6DrveuYnu6wlBj pCj2n3N0jDzGACqby42u4XHuo4iaZyIfl3EodZw2BJR7+Bdvuf4jMSN0N6JkS+RtssH88oWrYzx DPjxkJBCLTNEoTgCQ0kwkWxjJWbODPa+qoDaKUPirJ0xpjqu4scQlPI/zP28RUkHx2eym9e+n2Y PGyORmdydqBGHOSyaZSfcX0QHIYXDfpJsTq3kWAVxwv8niGexjQvdhxrYaKGYK54qS7q8v0d+k8 SfWZIdqo7hj+MkrxULqB074Ea0T6si4N/ySn6F9r+3/q+I1dzHLqJ4kBtEPVFS0Ti44g/kWzPa1 Pir20OSq0RPFUj7q3i3zl1mK9rsTvaEOqjxPG0nEIS5X7JKQW5+you4hu9HvvIIgA12O X-Received: by 2002:a17:90b:2742:b0:3b5:32c9:35d7 with SMTP id 98e67ed59e1d1-3b532c93948mr22385204a91.51.1796234908725; Wed, 02 Dec 2026 10:08:28 -0800 (PST) Received: from phoenix.lan (204-195-112-43.wavecable.com. [204.195.112.43]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b5c7d65000sm214204a91.11.2026.12.02.10.08.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 10:08:28 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , stable@dpdk.org, Reshma Pattan , Konstantin Ananyev Subject: [PATCH v4 7/8] pdump: report secondary process failures Date: Wed, 2 Dec 2026 10:07:40 -0800 Message-ID: <20261202180820.4107462-8-stephen@networkplumber.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261202180820.4107462-1-stephen@networkplumber.org> References: <20261028141750.310963-1-stephen@networkplumber.org> <20261202180820.4107462-1-stephen@networkplumber.org> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 The primary broadcasts an enable to every secondary but ignored the replies, so a secondary that could not install its callbacks only logged the error. The client was told the enable succeeded and had no reason to clean up. Return the first error from the enable replies. Disable the processes that did enable, so a failed request leaves nothing holding the ring. The undo carries the request's ring, so it only removes the callbacks that this request installed, and a secondary with none left is not an error. A secondary need not own every port. Report a missing port as ENODEV and let the secondary handler treat that as nothing to do, otherwise a process started with a different set of devices would fail the enable for the processes that did install callbacks. The client has to wait longer than the primary can take, which is the enable broadcast plus the undo broadcast. A disable reply is not propagated. The primary has already removed its own callbacks and a secondary started after the enable never had any. This depends on the IPC change earlier in this series. Without it a secondary that never called rte_pdump_init() does not reply at all, the broadcast times out, and every enable fails. Both patches have to be backported together. Fixes: 278f945402c5 ("pdump: add new library for packet capture") Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger --- lib/pdump/rte_pdump.c | 85 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 71 insertions(+), 14 deletions(-) diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c index 6b1de5c3ad..b57e4a7a33 100644 --- a/lib/pdump/rte_pdump.c +++ b/lib/pdump/rte_pdump.c @@ -261,7 +261,7 @@ pdump_tx(uint16_t port, uint16_t queue, */ static int pdump_check_queues(uint16_t port, uint16_t queue, uint16_t end_q, - bool rx, uint16_t operation) + bool rx, uint16_t operation, const struct rte_ring *ring) { struct rte_eth_dev *dev = &rte_eth_devices[port]; bool all = queue == RTE_PDUMP_ALL_QUEUES; @@ -297,7 +297,11 @@ pdump_check_queues(uint16_t port, uint16_t queue, uint16_t end_q, return -EEXIST; } if (operation == DISABLE && cbs->cb == NULL) { - if (all) + /* + * An undo carries the ring of the failed request and + * only has to remove what that request installed. + */ + if (all || ring != NULL) continue; PDUMP_LOG_LINE(ERR, "no existing %s callback for port=%u queue=%u", @@ -486,7 +490,7 @@ set_pdump_rxtx_cbs(const struct pdump_request *p) PDUMP_LOG_LINE(ERR, "failed to get port id for device id=%s", p->device); - ret = -EINVAL; + ret = -ENODEV; goto free_filter; } @@ -534,13 +538,13 @@ set_pdump_rxtx_cbs(const struct pdump_request *p) /* check all queues before changing any */ nb_queues = 0; if (flags & RTE_PDUMP_FLAG_RX) { - ret = pdump_check_queues(port, queue, nb_rx_q, true, operation); + ret = pdump_check_queues(port, queue, nb_rx_q, true, operation, ring); if (ret < 0) goto free_filter; nb_queues += ret; } if (flags & RTE_PDUMP_FLAG_TX) { - ret = pdump_check_queues(port, queue, nb_tx_q, false, operation); + ret = pdump_check_queues(port, queue, nb_tx_q, false, operation, ring); if (ret < 0) goto free_filter; nb_queues += ret; @@ -602,12 +606,13 @@ set_pdump_rxtx_cbs(const struct pdump_request *p) return ret; } -static void +static int pdump_request_to_secondary(const struct pdump_request *req) { struct rte_mp_msg mp_req = { }; struct rte_mp_reply mp_reply; struct timespec ts = {.tv_sec = MP_TIMEOUT_S, .tv_nsec = 0}; + int ret = 0, i; PDUMP_LOG_LINE(DEBUG, "forward req %s to secondary", pdump_opname(req->op)); @@ -615,14 +620,34 @@ pdump_request_to_secondary(const struct pdump_request *req) strlcpy(mp_req.name, PDUMP_MP, sizeof(mp_req.name)); mp_req.len_param = sizeof(*req); - if (rte_mp_request_sync(&mp_req, &mp_reply, &ts) != 0) - PDUMP_LOG_LINE(ERR, "rte_mp_request_sync failed"); + if (rte_mp_request_sync(&mp_req, &mp_reply, &ts) != 0) { + PDUMP_LOG_LINE(ERR, "rte_mp_request_sync failed: %s", + rte_strerror(rte_errno)); + return -rte_errno; + } - else if (mp_reply.nb_sent != mp_reply.nb_received) - PDUMP_LOG_LINE(ERR, "not all secondary's replied (sent %u recv %u)", - mp_reply.nb_sent, mp_reply.nb_received); + /* + * A secondary that failed has already undone its own callbacks. + * A process without pdump registered is skipped by the IPC layer + * rather than counted as a reply, so every reply here is from a + * process that ran the request. + */ + for (i = 0; i < mp_reply.nb_received; i++) { + const struct pdump_response *resp = + (const struct pdump_response *)mp_reply.msgs[i].param; + + if (resp->err_value != 0) { + PDUMP_LOG_LINE(ERR, "secondary failed to %s: %s", + pdump_opname(req->op), + rte_strerror(-resp->err_value)); + if (ret == 0) + ret = resp->err_value; + } + } free(mp_reply.msgs); + + return ret; } /* Allocate temporary storage for passing state to the alarm thread for deferred handling */ @@ -682,6 +707,17 @@ pdump_handle_primary_request(const struct rte_mp_msg *mp_msg, const void *peer) /* Can just do it now, no need for interrupt thread */ ret = set_pdump_rxtx_cbs(req); + + /* + * Not every secondary owns every port. A process that does + * not have this one has nothing to install and must not fail + * the request for the processes that do. + */ + if (ret == -ENODEV) { + PDUMP_LOG_LINE(DEBUG, "port %s not present, nothing to do", + req->device); + ret = 0; + } } return pdump_send_response(req, ret, peer); @@ -701,10 +737,30 @@ __pdump_request(void *param) PDUMP_LOG_LINE(DEBUG, "primary pdump %s", pdump_opname(req->op)); ret = set_pdump_rxtx_cbs(req); + if (ret != 0) + goto respond; /* Primary process is responsible for broadcasting request to all secondaries */ - if (ret == 0) - pdump_request_to_secondary(req); + ret = pdump_request_to_secondary(req); + + if (req->op != ENABLE) { + /* + * The primary already removed its callbacks. A secondary + * started after the enable never had any, so its failure + * does not mean the capture is still live. + */ + ret = 0; + } else if (ret != 0) { + /* Undo the processes that did enable, the rest have nothing */ + struct pdump_request undo = *req; + + undo.op = DISABLE; + undo.prm = NULL; /* no filter needed to remove callbacks */ + set_pdump_rxtx_cbs(&undo); + pdump_request_to_secondary(&undo); + } + +respond: pdump_send_response(req, ret, bundle->peer); free(bundle); @@ -883,7 +939,8 @@ pdump_prepare_client_request(const char *device, uint16_t queue, int ret = -1; struct rte_mp_msg mp_req, *mp_rep; struct rte_mp_reply mp_reply; - struct timespec ts = {.tv_sec = MP_TIMEOUT_S, .tv_nsec = 0}; + /* the primary may broadcast an enable and then an undo */ + struct timespec ts = {.tv_sec = 2 * MP_TIMEOUT_S + 1, .tv_nsec = 0}; struct pdump_request *req = (struct pdump_request *)mp_req.param; struct pdump_response *resp; -- 2.53.0