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 A94AB606A31A for ; Tue, 1 Dec 2026 19:33:36 +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=GMg4MdPv Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3C283406A2; Tue, 1 Dec 2026 20:32:55 +0100 (CET) Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) by mails.dpdk.org (Postfix) with ESMTPS id C563A402B8 for ; Tue, 1 Dec 2026 20:32:52 +0100 (CET) Received: by mail-pg1-f180.google.com with SMTP id 41be03b00d2f7-cdebab6fdb3so2851131a12.2 for ; Tue, 01 Dec 2026 11:32:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20260707.gappssmtp.com; s=20260707; t=1796153571; x=1796758371; 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=GMg4MdPvnRkvmmrXghcwHlAJ5cLjHZCRDJgrb9KQXnMt9OuG2mhG3Tro0zjTImuu6H P4xtNqoE1mlU+EvpXDSgWzm/RipVTacpCRZ+ceEiGmfYR/SrGtTkXcOZHpwBFKnU0eZH OzF6ykGwbWNF3+pNqcTLRPhUW+G4ELXK0NvddG3szAXp7uWLUFuddsIklZBxy1j3KQ/q p8uKq1//nhDuJJYK2VHTMlXbHroNrYQT/cBr70clfVXQn9I62BjPkkmsfVAvsW3M+5rp yOjgZ5EFxUL2C82eXAyKjT2oEy45eXEGtBDWDlIU7DkeTUaJMN+YK9L5vS0D1HOn28KV 03pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796153571; x=1796758371; 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=KUsoW8Y/y2oUGkxA+EEVsqauccH+6BWz0Wz89FDu3CsdUL327sRs04Euwlehdy1v0z R0PmBMZv4fWX4OzkG/OAEdi2afCXdhLPpfD7isTansAVkPA1Zmpd4hYTMupdloFAiKT0 S7MbOQIKnNHEw4yn/dJ5I4oDg+UrqTRD776BPbFy2+NQE4XczJnzrli0n3MwfmteOzyU CprCBacCj781nPd5z/RS/slcfryniUW5rR4Rkdf7Wzxgw3a+McIx32L1uuC0fkBAWHBu HXdEOyOnWNfNP5CCar+aUnc/AhoxnEUO7qg8HKQ8lhsxL4iqT6020lcZCMQcBdgoMgLJ ETsA== X-Gm-Message-State: APuU4Z9TngiL5pcnv82AoShLequhjgv9iwJpY1PoDgRPRDM5DjTeG1Hl TN0SrS7dU9NaU8q6y1KquwpaCKOTagAyWbTgJJHpi65bUZLNWSnewRQmbbIGTOYCAPeNDEwV3Wo JklMP X-Gm-Gg: AZFdTZc+yETQoc4Ry2CSwHO0uKBR+OKOOnHP52PZdUawMARHqp8Fy75GrcUiNq8nSQX SEe4ibEOgiGX+0dukglRU0e7NwIhyGPQ1SQK4kRuKQF85Z4lezmoNpJNMwehZn6dTB01qHqFK16 bUL3rek+OxGjlSKpQ0ttdYZ2/1C/T2aFBy/5NJ4hWLSLeKE5SplqSthV8Z3ZrnpB939wMu/h8d8 wwPco5CUGCSy6fNu4DMKhHUFDl4Vy7yNyyP28HOJSu6tg1eu9iG2GQf1+FUnGVktN+s3QWmHzka Lv50jDE1wYR6egoLynXF7TngFGdiCPNf8x4B1Rkj4GB5MhGNf6knxeU4E06F1InMeB2JharyHau uGMk1omkBCAtLjq/+BgIzP8jrRvViAMD+1QLzx/nALGbcyGjlZeE0vVRTZIsKZlK4QJuU7TAx1A xR1faF60Ut5mHjbm1bJCNiYLp/4RYuhJwtz7woHf1DwRLznmXsbL5KecgYE4SUEPcDxqN6/xvxF 8DOcp71wL2v/98noEoU/ORYcM1gxjmL3DlIqKOcU+KSOAVqVdbtykscv6vh3iTjW1Jm2Qx0EbRb jOnNxOM3ENG+Xo+utaUtOVusLD2O4wLSx+FEkcJagT6cq7XrujG8wg== X-Received: by 2002:a17:90b:288e:b0:3ac:7556:8eda with SMTP id 98e67ed59e1d1-3b41c9cf219mr34763363a91.26.1796153571156; Tue, 01 Dec 2026 11:32:51 -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.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 11:32:50 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Anatoly Burakov Subject: [PATCH v3 6/8] test/mp: check request with no registered handler Date: Tue, 1 Dec 2026 11:31:15 -0800 Message-ID: <20261201193243.1008280-7-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 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