Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp431660lqp; Thu, 4 Apr 2024 19:20:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXCjiXGw8i3Hm16BOpTU5g/WA5XnX7KI0RfX52vTTghjIXRfqL2SHMYt6hXjHbTDk7lq2OvwXGcajG3u47CexnkhAPESjqhBFGhrf4OIg== X-Google-Smtp-Source: AGHT+IFHTT6RTo30ZbodbAF5UKgJ9gRNmM82QJLXlapwu05DUhEbfEVZ51GKN/zwv8YufM9HYXVn X-Received: by 2002:a17:902:da87:b0:1e2:c1aa:7679 with SMTP id j7-20020a170902da8700b001e2c1aa7679mr1702017plx.17.1712283615134; Thu, 04 Apr 2024 19:20:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712283615; cv=pass; d=google.com; s=arc-20160816; b=P5tPeQVWZjDllY0Ws8cSnMDCsVeoqksDSRKaABlGx6BdTDa7iyUh3retSSo/iOqOzH 0sCZluuRz3NmFdUTTBqA9l2D+eISblpSjwt+AT2P6KeVwigrU94Vtxs+RRitDq8kMuBB w5JInfjLToC0juVM7vr3LuFm8sCeHaphA/mU1IUDBkm/yquwQg2oAvQv32FbPeYE45z9 BvEbUZXK8HJKVBqEYIckWsDplZpRMRgIMKyBQkYgzG4FBaeXcW03UN1QwgmXouL/rZCz 5upuq6829ONgrchuU1Qozn/pviYTJMK5osB/hK3YsWagE3Z4Bs/8dfwi0RV0Xt1/0qlG fkLw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=cizTluUusU/8LespqdwSJr+fCAo0OEMHrmoen45RruY=; fh=LO3eRqsKaq4Lljqwcz6zGxSee2B8pMY78JF7VYnVn+0=; b=ZC2q9YcbUzYtHPH8AstiaDnMRWYoEiLFJ6Nhk59ilav/PKugbF0kNRCJoCnP0swjzz a99dd7jZRmymcS4Iy5ASKo8QJqS7dCDOkJbgfIhVPhmDej/h8y2XcT79rDkeGWNiIn2L k3VU0xlbrlxvnzaDTmY5r6ZGhR5ozQ/IBlQ0/UHKiOYSCHMYIcJEG/0DDvR4EMyeJWB4 nCchm1595xa6/o36qeJGSpP3Bsy/8gPvy5iUSqCM5uCECV/SAoYa0gbXBC84p3Cg+OxH NR/hk3im8dgBtBtixM+U1RRZ/EVLhEtCfy7XCHzoQTE+t34ES/uhA3inIub6gqkxEFsv 8koA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=T1Zds3kD; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-132326-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132326-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id ca3-20020a056a02068300b005f069faeaf6si558971pgb.690.2024.04.04.19.20.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 19:20:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-132326-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=T1Zds3kD; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-132326-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132326-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BA00C283925 for ; Fri, 5 Apr 2024 02:20:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 37C8F14F6C; Fri, 5 Apr 2024 02:20:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="T1Zds3kD" Received: from mail-qv1-f48.google.com (mail-qv1-f48.google.com [209.85.219.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0A47101F2; Fri, 5 Apr 2024 02:19:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712283601; cv=none; b=RbZ/IlJ+uD1DED0J/06gpkFj9ZWLsHiyou9WY5f5A+t48ff/apxL8mX6KlZaCzWD7UV6oL0yDyvbu30/s01hqUBysDT9rKlKZ2RktsjSMK7zsdlamj+wHKIV53lEArmbz2qp9l3SH0FbXtmT640svmQMYynpkAoey/DH7ZIBO2o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712283601; c=relaxed/simple; bh=2DYTKFCxaDTpCQ12eT+9jVBI7+leHm0ooeFmGLJgzTE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pGU6XwOm+8KNf1p3lKBwriT78e2TYBlOmeZZ5eklH+3J827uO9Wgo4j8vk5flnC+8aDBtddkjNIbS8ctWI7ApfVtHBv2BWLWNuYtek26Gy0GdGOzbD+d1jgcPDe4mZuH3s5gO5glv4IKNm2XLRKYDcJUBNGVKULdcfwpG8u5Qkc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=T1Zds3kD; arc=none smtp.client-ip=209.85.219.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qv1-f48.google.com with SMTP id 6a1803df08f44-6963c0c507eso18855456d6.1; Thu, 04 Apr 2024 19:19:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712283598; x=1712888398; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=cizTluUusU/8LespqdwSJr+fCAo0OEMHrmoen45RruY=; b=T1Zds3kDow7K5FbKBAv0aPSgTMl8PXKGPdnlkSH0jxqcM8OgiQyTnzAk0BwjjTmirO gu2SIY6+TlDsgMRmqRWnxjEPHFfsJj6nZ0GfJNIC2+US9P0vvJ0s5mskVvUKa0yDPWkp +LtDgo4nZyTr69LoPUA3Mt2j2mBE0meZXsMzwTewMGDSuZKiLJzglF814+Mf0uZ9UnMC Ky8SGaB5BUe8UobcYy2IMQl1OHbmaofZasbjQRPzbltA5dIQQ5BDvD00AEY9qvPddqcQ oxPbZSy/tsDLXvml/pvDkBVHV7OUVRv11RQ50DbO18AQ2es+qNr/dJoWsgD3OYc5OKF0 ziWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712283598; x=1712888398; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=cizTluUusU/8LespqdwSJr+fCAo0OEMHrmoen45RruY=; b=R6c/7XauUD78X/Iq0U36RXwpuEQaDPbpdW1mGylfFXemT2yR/VHPP2HGSfikFExLcg oiV1Dx3FS/x7QxN/FMyhvm7GKO3kJirZGTrY1Sg0tjQ5sChN8Q03fZSFdgqZ0ELdrYzD S8fYxeq1y/BBJ74es+BgF1WmSTQCMWafIlR8ZnMle5aW7LBV5RkKXkuAKPoF9GjZfFCb ku7CLEWg0msP9V4X4Rg1+MPvtSK5nE7YqQixNDO1hYo1fiXnzbo+nav5ZSaFH6KzDbOM +6q1fUkklIb6I5sUmFMJgUZ/FO9owXvWxdPjJzTt7Wf95kr08kH5mp/+InEzgzflXoVw Elpg== X-Forwarded-Encrypted: i=1; AJvYcCUdE4GU2EXjEnTlO+BV8ecezAvEMm7Ivl/jpdGQ3SUG4VudcBKStvyXWYCziCqwb2lhj/WVp7xRkKUrjJHJFBvMDKGSlOGXIRLU9E1+BGL5FLMkFgz72ZlqxujSaF02mx4R9rcI6yMsVq8jJd5cx/Gb3gdMdCBSFCgQ3ks381rdg2y6hZ5B X-Gm-Message-State: AOJu0Yx3ZW77wN6ObPx4pXTRSNw8mhNUJlKH8BPPtx8FX5/6Pin+6cL1 VyXYlwu8EWM5AF6HOcgep6buhuTUR3o8CkqAaFbuUd7I2QaLnvyL X-Received: by 2002:a0c:fa8e:0:b0:696:8e65:b6a4 with SMTP id o14-20020a0cfa8e000000b006968e65b6a4mr2037023qvn.31.1712283598544; Thu, 04 Apr 2024 19:19:58 -0700 (PDT) Received: from localhost ([2601:8c:502:14f0:acdd:1182:de4a:7f88]) by smtp.gmail.com with ESMTPSA id ek1-20020ad45981000000b00699032e555bsm250035qvb.127.2024.04.04.19.19.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 19:19:58 -0700 (PDT) Date: Thu, 4 Apr 2024 18:19:59 -0400 From: Oliver Crumrine To: axboe@kernel.dk, asml.silence@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, shuah@kernel.org, leitao@debian.org Cc: io-uring@vger.kernel.org, netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] io_uring: Support IOSQE_CQE_SKIP_SUCCESS in io_uring zerocopy test Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Add support for the IOSQE_CQE_SKIP_SUCCESS flag in the io_uring_zerocopy_tx test, using the "-a" option. Instead of incrementing when IORING_CQE_F_MORE is set, remember how many SQEs are sent and simply wait on notifs instead of regular completions. For non-zc stuff, there won't be notifs or completions, so don't wait on either of those, but check the completion queue for errors at the end to make sure none have popped up. The changes to the shell script run the tests both with and without the "-a" option. Signed-off-by: Oliver Crumrine --- .../selftests/net/io_uring_zerocopy_tx.c | 38 +++++++++++++++++-- .../selftests/net/io_uring_zerocopy_tx.sh | 7 +++- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/net/io_uring_zerocopy_tx.c b/tools/testing/selftests/net/io_uring_zerocopy_tx.c index 76e604e4810e..11a43594935f 100644 --- a/tools/testing/selftests/net/io_uring_zerocopy_tx.c +++ b/tools/testing/selftests/net/io_uring_zerocopy_tx.c @@ -50,8 +50,10 @@ enum { }; static bool cfg_cork = false; +static bool cfg_nocqe = false; static int cfg_mode = MODE_ZC_FIXED; static int cfg_nr_reqs = 8; +static int cfg_nr_completions = 8; static int cfg_family = PF_UNSPEC; static int cfg_payload_len; static int cfg_port = 8000; @@ -134,11 +136,21 @@ static void do_tx(int domain, int type, int protocol) if (mode == MODE_NONZC) { io_uring_prep_send(sqe, fd, payload, cfg_payload_len, msg_flags); + if (cfg_nocqe) { + sqe->flags |= IOSQE_CQE_SKIP_SUCCESS; + cfg_nr_completions--; + } sqe->user_data = NONZC_TAG; } else { io_uring_prep_sendzc(sqe, fd, payload, cfg_payload_len, msg_flags, zc_flags); + if (cfg_nocqe) { + sqe->flags |= IOSQE_CQE_SKIP_SUCCESS; + packets++; + compl_cqes++; + bytes += cfg_payload_len; + } if (mode == MODE_ZC_FIXED) { sqe->ioprio |= IORING_RECVSEND_FIXED_BUF; sqe->buf_index = buf_idx; @@ -153,7 +165,7 @@ static void do_tx(int domain, int type, int protocol) if (cfg_cork) do_setsockopt(fd, IPPROTO_UDP, UDP_CORK, 0); - for (i = 0; i < cfg_nr_reqs; i++) { + for (i = 0; i < cfg_nr_completions; i++) { ret = io_uring_wait_cqe(&ring, &cqe); if (ret) error(1, ret, "wait cqe"); @@ -168,7 +180,9 @@ static void do_tx(int domain, int type, int protocol) if (compl_cqes <= 0) error(1, -EINVAL, "notification mismatch"); compl_cqes--; - i--; + if (!cfg_nocqe) + i--; io_uring_cqe_seen(&ring); continue; } @@ -200,6 +214,17 @@ static void do_tx(int domain, int type, int protocol) compl_cqes--; } + /* The above code does not account for a send error when + * IOSQE_CQE_SKIP_SUCCESS is set. This is operating under the + * assumption that an error CQE will get put on the ring before + * the above code completes: + */ + while (!io_uring_peek_cqe(&ring, &cqe)) { + if (cqe->res == -EAGAIN) + continue; + error(1, -EINVAL, "send failed"); + } + fprintf(stderr, "tx=%lu (MB=%lu), tx/s=%lu (MB/s=%lu)\n", packets, bytes >> 20, packets / (cfg_runtime_ms / 1000), @@ -221,7 +246,7 @@ static void do_test(int domain, int type, int protocol) static void usage(const char *filepath) { error(1, 0, "Usage: %s (-4|-6) (udp|tcp) -D [-s] " - "[-t