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 883BB606A68E for ; Wed, 2 Dec 2026 18:09:15 +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=RkA13hP4 Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7B005406BA; Wed, 2 Dec 2026 19:08:32 +0100 (CET) Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) by mails.dpdk.org (Postfix) with ESMTPS id 7BAC040678 for ; Wed, 2 Dec 2026 19:08:29 +0100 (CET) Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-cdb9f760337so57690a12.0 for ; Wed, 02 Dec 2026 10:08:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20260707.gappssmtp.com; s=20260707; t=1796234908; x=1796839708; 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=W8AfjfUQ90d7AY/RTb2JPJPUGyi5+IqIzSFfud7LP4c=; b=RkA13hP4WqDDkqvHNtZZmhV/fN/8qMRIM3JZyLG9+Bzrx00qgsi4lO/bfSN1CqfbSm XzU2KTwKsW0+3mIL4/0WLpgdZ4G0ND2ru2sFXkCJKR7ScVxrtOUv+pS3a5WczQWW2e8K 3lnv18maihRJquUnSQEBgfRE6AST8Jh2DKML94UBKFU+V9yGIiWfsMWzOZBgfphc6Ias YBjDnb6rNsKYbF87i5y5MW3vUa/W8lfV6QNDOQp6MFpBKw9o3F+w8V4KKFruJEscGkmh Qhc0Z5RcU18PpvmCHBSjODm3yN6ExjiF76H0Wi5+VLFjf0ycQF+o+1YmZaGFiJzMV5aA 808Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796234908; x=1796839708; 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=W8AfjfUQ90d7AY/RTb2JPJPUGyi5+IqIzSFfud7LP4c=; b=1yc/3P+KTiICRhsvTIc29C7ht7BtNGrQkk/ivHKKUkzyTx9tELRI2VeghPKt40vMNr i2XFEbNb1Ji9n+43TVUBfcQePA6tFy0gxDh0CkWA+rWqG6F98qfT1Xv9cPnXCivu8Pe7 n0AFIiiqbjCk9dv5zPv+GiSBbgH/j9uTzhd361Vz3UL0prK290K8dHJVTB/wp3UMBOyy E/vsBWtFSqGeBPIe9Wz3nP2UheLfVmaSnfe5lBIn4xCZe3Yg0knofb45q6o6i9appBxK gkCbEg1J5hipLQcA7epbwR2M/GBprnhOvh069TKaK0W1m3EVYfZu5blt5Lp5AdTx/lhx Kv0Q== X-Gm-Message-State: APuU4Z9BfYWPaoGJLbHjgJH0wH5ZHFzh/rRYfMO3YxOqrvjV6xqJAVAs 9KiA2spVBZhNLF9w9QqV4VfI1YtZgJYWA5Rxn7OO6lUj4LBedaOZEFPbyS6DDpmDwOZEWX0apAT VhvmlM90= X-Gm-Gg: AZFdTZfYtRWovY8siKxjTt0hdEXimL2qy6VDEAEINiRkkCDTsj2IHF4UFd3VMd7TChj jxKbX4r9W2/nmRh5WsB1H6JWZPHHfTbV+sr1SQypmPh+gamlNS7ahSZpyAUTYGtOOgtQgjtz1ZY aNB0OXKpj2DArd+6Gs5PAvxqR0+mOpvx4i4Ng1/hs0N9TI1J1d6zAbuqIJVDzDUaF7kATBdr4tP 1Gwke03g/JUsKrbKyOOSLrvhsgwsR/JGte/V/klwbRHK4FB2Vv8YhD2/9w5ty1VavS5rEHJQdi9 +2lRuFgVkFAI47pifpzUk0iYBo+uj9wKLzdzweLbYZ6NRhbuMj68AgNO18TyD/U+Wd980rMXp5k 9R2WReWySCAalALs1gkvkIu9fX4ShRYznNBP35vpEnlbvHVICCHX/YXQ8CwZ3UEgdWvb4+5Wz9F ujjTiGbJZ5DiA3LV4PU07bJtmZSlmt1rZx4OEA64oXDkOgstTs9d798MbOVHbi02M8F12K2VadT gto5GW+JIPXEPLYnVUNWlZr+cbEJu9mrLX5SFjsWg3IgfMFxyHFLokLXh1zr3AaAWMaBcFVW/Of JTToSVg8FY6zQbZdRkEN+tWNlyQEfqLcLsqVL3Mkoe0xU23xcfo/E3HHNYAs5tgC89tP X-Received: by 2002:a17:90b:2e4b:b0:3ab:330d:6e47 with SMTP id 98e67ed59e1d1-3b41c8e0ce5mr27650375a91.10.1796234907944; Wed, 02 Dec 2026 10:08:27 -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.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 10:08:27 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Anatoly Burakov Subject: [PATCH v4 6/8] test/mp: check request with no registered handler Date: Wed, 2 Dec 2026 10:07:39 -0800 Message-ID: <20261202180820.4107462-7-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 Add coverage for requests the peer has no action for. The secondary asks the primary for an action nobody registered and checks that the call fails with ENOTSUP rather than blocking until the timeout. The async form of the same request is checked as well. Its callback has to run even though no reply comes back, reporting the request as sent and nothing received. The MP_IGN direction is not covered here. That needs a primary broadcasting to a secondary which did not register the action, and the test primary is blocked waiting for the secondary to exit. Signed-off-by: Stephen Hemminger --- app/test/test_mp_secondary.c | 85 +++++++++++++++++++++++++++++++++++- 1 file changed, 84 insertions(+), 1 deletion(-) diff --git a/app/test/test_mp_secondary.c b/app/test/test_mp_secondary.c index d89419c253..8101c2cafc 100644 --- a/app/test/test_mp_secondary.c +++ b/app/test/test_mp_secondary.c @@ -53,6 +53,7 @@ test_mp_secondary(void) #endif /* RTE_LIB_LPM */ #include +#include #include "process.h" @@ -197,6 +198,85 @@ run_object_creation_tests(void) return 0; } +#define NO_SUCH_ACTION "test_mp_no_action" +#define MP_WAIT_S 5 + +static int async_replied; +static int async_nb_sent; +static int async_nb_received; + +static int +unsupported_async_reply(const struct rte_mp_msg *request __rte_unused, + const struct rte_mp_reply *reply) +{ + async_nb_sent = reply->nb_sent; + async_nb_received = reply->nb_received; + async_replied = 1; + return 0; +} + +/* + * Run in the secondary to check requests the primary has no handler for. + * The primary answers MP_ERR, so the request fails right away instead of + * waiting for the timeout. + */ +static int +run_unsupported_request_tests(void) +{ + struct timespec ts = { .tv_sec = MP_WAIT_S, .tv_nsec = 0 }; + struct rte_mp_msg msg = { .len_param = 0, .num_fds = 0 }; + struct rte_mp_reply reply = { }; + time_t start; + int ret; + + printf("### Testing request with no handler in primary:\n"); + + strlcpy(msg.name, NO_SUCH_ACTION, sizeof(msg.name)); + + start = time(NULL); + ret = rte_mp_request_sync(&msg, &reply, &ts); + if (ret == 0 || rte_errno != ENOTSUP) { + printf("Error: rte_mp_request_sync() returned %d errno %d, expected -1/ENOTSUP\n", + ret, rte_errno); + free(reply.msgs); + return -1; + } + /* a dropped request would have cost the full timeout */ + if (time(NULL) - start >= MP_WAIT_S) { + printf("Error: rte_mp_request_sync() waited for the timeout\n"); + return -1; + } + printf("# Checked rte_mp_request_sync() returns ENOTSUP\n"); + + async_replied = 0; + if (rte_mp_request_async(&msg, &ts, unsupported_async_reply) != 0) { + printf("Error: rte_mp_request_async() failed: %s\n", + rte_strerror(rte_errno)); + return -1; + } + + /* the callback runs on the interrupt thread */ + for (int i = 0; i < MP_WAIT_S * 10 && !async_replied; i++) + rte_delay_ms(100); + + if (!async_replied) { + printf("Error: rte_mp_request_async() callback never ran\n"); + return -1; + } + /* + * The request was sent and answered with an error, so the callback + * must see it as sent but carrying no reply. + */ + if (async_nb_sent != 1 || async_nb_received != 0) { + printf("Error: async reply sent %d received %d, expected 1/0\n", + async_nb_sent, async_nb_received); + return -1; + } + printf("# Checked rte_mp_request_async() callback runs with no reply\n"); + + return 0; +} + /* if called in a primary process, just spawns off a secondary process to * run validation tests - which brings us right back here again... * if called in a secondary process, this runs a series of API tests to check @@ -211,7 +291,10 @@ test_mp_secondary(void) printf("IN SECONDARY PROCESS\n"); - return run_object_creation_tests(); + if (run_object_creation_tests() < 0) + return -1; + + return run_unsupported_request_tests(); } #endif /* !RTE_EXEC_ENV_WINDOWS */ -- 2.53.0