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 11090606A31A for ; Tue, 1 Dec 2026 19:33:43 +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=YAKwTB6t Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0C3A0406FF; Tue, 1 Dec 2026 20:32:56 +0100 (CET) Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by mails.dpdk.org (Postfix) with ESMTPS id 1CA6F4068E for ; Tue, 1 Dec 2026 20:32:54 +0100 (CET) Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-2f0464dd6b6so74624155ad.1 for ; Tue, 01 Dec 2026 11:32:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20260707.gappssmtp.com; s=20260707; t=1796153572; x=1796758372; 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=YAKwTB6tEI09V+/501qwyxarBuTtO2mDsCK74msXquxrKWqFegzq2OGbtN7aScdlA6 1DSqDjPEqCpS4XM63Atja/9pqk3RLOmg5P6dEtxHRcj23Toim0pPoqcz/zdcPWWR2JUK gRMnOznadqHN77EP2g8Jk7qUdUn3xv3OeQv1eG9u2v5yhDvhW5CAy9Hu+Dxg55CsJLh9 K4FmsnDeXLXcbi9z7oqv29nGWw2+q99fVc+EvPkcbGv85O9vEGoIVqq46p9Zeh+j7XAV tEYLvF6Z4yiiUB4ZyauJSX8+rK3Une9Rmc5zLf9Os/fBpVd0aBc+xU23Wl9JZ9zoz0NQ DUIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796153572; x=1796758372; 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=FPGyr2000DzZoRcAXqpwnE2Jvu7VhGWz5zC9oQfc2iP56hvZi31jZt0OiWB09vuBy/ //PyDgFpUF3+uAz+uJArHxMknT6gR+Ey8eK5hDaOd3FCw1jWSUUnF/ffIgThbU9m/i/V UH0ta4FhkDEaRnMNZkjp1fI6ApYJ6jWeGRgaH41EQNNKOaxtSyLp6zXmpxjNXFX8pB8N h92kOTuSaL7Dmj9ji36fykVc9KUpb8IB/LUxctCWXQqGe9nCkgWOEn+k73guCJhPdWYD mRBb0x0+9ZlKvMqyjKgVREmy5TTYnW0QJtj3+SMq0D4vY9EtXWbfPUQSJILfZ+sZsYwO 4uSQ== X-Gm-Message-State: APuU4Z9kKrrnjkze4HQKj5F0DcvHyY7QsiwvfuNFnToD6FGbgu/W29Y5 /NsHN3K9Sh4T5SbP/4l1WFFqNgqar/BPc3qN0PJbV9MQ0kw43+rx5w5DZhKCLMtQYPVKcCRHnJ9 ZWBdL X-Gm-Gg: AZFdTZd6xhm31SG9RDtNEhtJ1QWiPxzpHs8YBxTYWvbXZA2wlKsYizoZNSnBFQcxMlE 0htzHCT+L2z2vJWgoaWkzCV1efXjVDkAo2oK9BMhc9JRllHHdXVbHGxSw1PVxc5BOiL9zpcBMAp PV9QI1ztCfUAdAQkyLykVNoXZu2Lc8fkFD9xPx1+iSrehrvN++8LHNcFFJUF1/aHfV0bKE1+JHx 61NLEOi55z0JTSxImsXXAj7Tjevp396SNTSxc2faA1njicEf5w/5X8YOgvEsvuACTp1f/M3tqsP Z0ac8qrIHqchAyA7Okq5EGU1tUeepM4YPP6URyKU/BE8MD8o6das40ar+ewRXxSbLKMQF5zRkkl h5RKe2vgNToginsZXqiTzsGbBP8vseLLY0hbUUm4NeW20yw+1ZHiBiDKbaO1VRh4hPfT3Hx7hAB 1PAJXgLKqbanUz8u4SiMV/ckpNSjOn9ybNYtTiIb1kyrBtT5Az1RPcdoouDn2maxylVkoWoUlyI 4AsXTKCnsbgHYEwwvtQ8s+G5cTJ8GrFPxvV3Oi2VU7qzQdtjYYF3M+dDh664LaCBrnFx36sAoP6 PpjDE3mnVyhS0NqYiDHG0REj1LGuuBAm+0lXIXIgHJx1RyEGQ7pR4BcffDWyJqYNT76/ X-Received: by 2002:a17:90b:4ec4:b0:3ac:7116:434a with SMTP id 98e67ed59e1d1-3b41c900858mr35131620a91.15.1796153572431; Tue, 01 Dec 2026 11:32:52 -0800 (PST) Received: from phoenix.lan (204-195-112-43.wavecable.com. [204.195.112.43]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b44b21e19fsm23264700a91.0.2026.12.01.11.32.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 11:32:51 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , stable@dpdk.org, Reshma Pattan , Konstantin Ananyev Subject: [PATCH v3 7/8] pdump: report secondary process failures Date: Tue, 1 Dec 2026 11:31:16 -0800 Message-ID: <20261201193243.1008280-8-stephen@networkplumber.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261201193243.1008280-1-stephen@networkplumber.org> References: <20261028141750.310963-1-stephen@networkplumber.org> <20261201193243.1008280-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