From patchwork Tue Jul 23 23:17:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriel Krisman Bertazi X-Patchwork-Id: 13740443 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 888EB28E8 for ; Tue, 23 Jul 2024 23:17:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721776663; cv=none; b=UXtz9csCIPzFocfKzVvL5l8ukiKUr4N3teDJCSzSEm2CMf3gXo6t58hrd3iHTFWjlqTkiOK2d7W4d+kFBXak01CQv3UjofWjVGR/WdWjLxg2dvFT3QuVurWnMPYelBZ/wwHgNvbA+29KFHtyHYMT4xNWE2E754T2RlwQ+Krd1kU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721776663; c=relaxed/simple; bh=C6LNVpl/17eXlW53K1xrqM9EvtpDKXdKMWa27rwkK6s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CeDQx/wL1R2jddJT87w3rGJMCCOnSDcHXvKmgVZD/bdKiHiGVUfRDR/QzKhBv2utBS8RLROpQNw19jH6pJUaASkrjdVcPHj6RVYIuNjkOkfjZMXJT8UdDtXHgqSbOH6TPS3ObdMtJHIXLQjtGSYie7jcB/jxeV9ebORpngftyHQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=FwiZeiWG; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=R5E2eYxp; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=FwiZeiWG; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=R5E2eYxp; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="FwiZeiWG"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="R5E2eYxp"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="FwiZeiWG"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="R5E2eYxp" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id A50FA21A82; Tue, 23 Jul 2024 23:17:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1721776659; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NVLyWzkbiIhSKVVLml5nISmdjgGm06FStNYv7RFmW4k=; b=FwiZeiWGeBL70S69C0+DZ+5arzxy6AdcfOfwjNYdolkKrXlwMQ/4aXgbQdTzCVyen7Y1Pj Ck3sHKkgpPh8fqjEnaFsBbLtSQmjl1SC4E3jY7zQvKP+CbGeOhPvxw5FwUuarUUWtu+Fxf zooe49E9X9AxCuSw3wYwWFdmX8jhGNA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1721776659; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NVLyWzkbiIhSKVVLml5nISmdjgGm06FStNYv7RFmW4k=; b=R5E2eYxphUKMqLWvoKYL76GWQLibtR6f59sdeeB0i+hxCg+7u0HUrEe+UDtHe/GG7VHR2b +P1iInOMoa59LDCw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=FwiZeiWG; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=R5E2eYxp DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1721776659; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NVLyWzkbiIhSKVVLml5nISmdjgGm06FStNYv7RFmW4k=; b=FwiZeiWGeBL70S69C0+DZ+5arzxy6AdcfOfwjNYdolkKrXlwMQ/4aXgbQdTzCVyen7Y1Pj Ck3sHKkgpPh8fqjEnaFsBbLtSQmjl1SC4E3jY7zQvKP+CbGeOhPvxw5FwUuarUUWtu+Fxf zooe49E9X9AxCuSw3wYwWFdmX8jhGNA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1721776659; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NVLyWzkbiIhSKVVLml5nISmdjgGm06FStNYv7RFmW4k=; b=R5E2eYxphUKMqLWvoKYL76GWQLibtR6f59sdeeB0i+hxCg+7u0HUrEe+UDtHe/GG7VHR2b +P1iInOMoa59LDCw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 6B6EB13874; Tue, 23 Jul 2024 23:17:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id wDn4ExM6oGbGUgAAD6G6ig (envelope-from ); Tue, 23 Jul 2024 23:17:39 +0000 From: Gabriel Krisman Bertazi To: axboe@kernel.dk Cc: io-uring@vger.kernel.org, asml.silence@gmail.com, Gabriel Krisman Bertazi Subject: [PATCH liburing v2 1/5] liburing: Add helper to prepare IORING_OP_BIND command Date: Tue, 23 Jul 2024 19:17:29 -0400 Message-ID: <20240723231733.31884-2-krisman@suse.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240723231733.31884-1-krisman@suse.de> References: <20240723231733.31884-1-krisman@suse.de> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Level: X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-1.31 / 50.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; MIME_TRACE(0.00)[0:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FREEMAIL_CC(0.00)[vger.kernel.org,gmail.com,suse.de]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:dkim]; TAGGED_RCPT(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCPT_COUNT_THREE(0.00)[4]; RCVD_VIA_SMTP_AUTH(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com] X-Rspamd-Action: no action X-Spam-Flag: NO X-Spam-Score: -1.31 X-Rspamd-Queue-Id: A50FA21A82 Signed-off-by: Gabriel Krisman Bertazi --- src/include/liburing.h | 7 +++++++ src/include/liburing/io_uring.h | 1 + src/liburing-ffi.map | 1 + 3 files changed, 9 insertions(+) diff --git a/src/include/liburing.h b/src/include/liburing.h index e8626f0..04cb65c 100644 --- a/src/include/liburing.h +++ b/src/include/liburing.h @@ -669,6 +669,13 @@ IOURINGINLINE void io_uring_prep_connect(struct io_uring_sqe *sqe, int fd, io_uring_prep_rw(IORING_OP_CONNECT, sqe, fd, addr, 0, addrlen); } +IOURINGINLINE void io_uring_prep_bind(struct io_uring_sqe *sqe, int fd, + struct sockaddr *addr, + socklen_t addrlen) +{ + io_uring_prep_rw(IORING_OP_BIND, sqe, fd, addr, 0, addrlen); +} + IOURINGINLINE void io_uring_prep_files_update(struct io_uring_sqe *sqe, int *fds, unsigned nr_fds, int offset) diff --git a/src/include/liburing/io_uring.h b/src/include/liburing/io_uring.h index 9330733..177ace6 100644 --- a/src/include/liburing/io_uring.h +++ b/src/include/liburing/io_uring.h @@ -257,6 +257,7 @@ enum io_uring_op { IORING_OP_FUTEX_WAITV, IORING_OP_FIXED_FD_INSTALL, IORING_OP_FTRUNCATE, + IORING_OP_BIND, /* this goes last, obviously */ IORING_OP_LAST, diff --git a/src/liburing-ffi.map b/src/liburing-ffi.map index 0e4bd9d..de2cb09 100644 --- a/src/liburing-ffi.map +++ b/src/liburing-ffi.map @@ -201,4 +201,5 @@ LIBURING_2.6 { LIBURING_2.7 { io_uring_prep_fadvise64; io_uring_prep_madvise64; + io_uring_prep_bind; } LIBURING_2.6; From patchwork Tue Jul 23 23:17:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriel Krisman Bertazi X-Patchwork-Id: 13740444 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 DDCFC13BAD5 for ; Tue, 23 Jul 2024 23:17:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721776664; cv=none; b=Zazt0I9B6EI6c8Tq4liACbQoAZmSseVKYVZXc+iwHfotTAJOI9E6ONpjInoNGhDr41cfTrGCobztNqpIRzGLXsy0bkEajYIUefuXQgCTSa91Fr+D7QrKNkKVKJPdw8HTVIP+EhWc2PJsGfsI3pLy4rcpcrURD9W6AcOBrjv25Dk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721776664; c=relaxed/simple; bh=YRsmLqs+mcr/8GQ2emrNeN/WE9qOakv6xuGXI66fEmM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BXj0WRDNj3gC+L3jj/cAZGakwjZNcNaBSUYaz2fKmkcmqTO59mBSRKIJh8Og5sAS0w/rkL8lfYBU6HDzWiRUSo9bsvj2s0dYgE3l4dREFK6+pwyd2XQH3Kbl4D+1XJ/Fw5kwMw7tcDkECgf7/uXexnhtAz4xuzUc5oW7S2VaFUw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=mQLsdEue; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=lWCdNXI1; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=mQLsdEue; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=lWCdNXI1; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="mQLsdEue"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="lWCdNXI1"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="mQLsdEue"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="lWCdNXI1" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 3341621A90; Tue, 23 Jul 2024 23:17:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1721776661; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/o7IwQqYTpr4+vLXaPoKhLo8vrPpETIFenKCk3H9JR0=; b=mQLsdEue9n72WvpBZe6QZiscYIxFhjUsu/yJtPKDlF+dU/ptLZ/17F7afnPP+13L2W/vX6 hGlwGFFVaRaf214xQqZdhwTXSgK5ycdnAWubemNl77q7kpyzTZR7cqT9eblwetIJu4RvRg K2sNbJqWWWv7mJQRRtLkWBLrMLIxXZU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1721776661; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/o7IwQqYTpr4+vLXaPoKhLo8vrPpETIFenKCk3H9JR0=; b=lWCdNXI1dJLZdzR0ymkAaiiI+A/mWh5Qng2D2ep2kzH8xHXOPrpYUz9dmSzZyeHAoCu/yc SmqJ8VE5HJqSckAg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1721776661; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/o7IwQqYTpr4+vLXaPoKhLo8vrPpETIFenKCk3H9JR0=; b=mQLsdEue9n72WvpBZe6QZiscYIxFhjUsu/yJtPKDlF+dU/ptLZ/17F7afnPP+13L2W/vX6 hGlwGFFVaRaf214xQqZdhwTXSgK5ycdnAWubemNl77q7kpyzTZR7cqT9eblwetIJu4RvRg K2sNbJqWWWv7mJQRRtLkWBLrMLIxXZU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1721776661; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/o7IwQqYTpr4+vLXaPoKhLo8vrPpETIFenKCk3H9JR0=; b=lWCdNXI1dJLZdzR0ymkAaiiI+A/mWh5Qng2D2ep2kzH8xHXOPrpYUz9dmSzZyeHAoCu/yc SmqJ8VE5HJqSckAg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id EF79A13874; Tue, 23 Jul 2024 23:17:40 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id pMt3NBQ6oGbJUgAAD6G6ig (envelope-from ); Tue, 23 Jul 2024 23:17:40 +0000 From: Gabriel Krisman Bertazi To: axboe@kernel.dk Cc: io-uring@vger.kernel.org, asml.silence@gmail.com, Gabriel Krisman Bertazi Subject: [PATCH liburing v2 2/5] liburing: Add helper to prepare IORING_OP_LISTEN command Date: Tue, 23 Jul 2024 19:17:30 -0400 Message-ID: <20240723231733.31884-3-krisman@suse.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240723231733.31884-1-krisman@suse.de> References: <20240723231733.31884-1-krisman@suse.de> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spamd-Result: default: False [-1.10 / 50.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TAGGED_RCPT(0.00)[]; FREEMAIL_CC(0.00)[vger.kernel.org,gmail.com,suse.de]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; RCVD_TLS_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCPT_COUNT_THREE(0.00)[4]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FREEMAIL_ENVRCPT(0.00)[gmail.com] X-Spam-Level: X-Spam-Flag: NO X-Spam-Score: -1.10 Signed-off-by: Gabriel Krisman Bertazi --- src/include/liburing.h | 6 ++++++ src/include/liburing/io_uring.h | 1 + src/liburing-ffi.map | 1 + 3 files changed, 8 insertions(+) diff --git a/src/include/liburing.h b/src/include/liburing.h index 04cb65c..c935efa 100644 --- a/src/include/liburing.h +++ b/src/include/liburing.h @@ -676,6 +676,12 @@ IOURINGINLINE void io_uring_prep_bind(struct io_uring_sqe *sqe, int fd, io_uring_prep_rw(IORING_OP_BIND, sqe, fd, addr, 0, addrlen); } +IOURINGINLINE void io_uring_prep_listen(struct io_uring_sqe *sqe, int fd, + int backlog) +{ + io_uring_prep_rw(IORING_OP_LISTEN, sqe, fd, 0, backlog, 0); +} + IOURINGINLINE void io_uring_prep_files_update(struct io_uring_sqe *sqe, int *fds, unsigned nr_fds, int offset) diff --git a/src/include/liburing/io_uring.h b/src/include/liburing/io_uring.h index 177ace6..f99d41f 100644 --- a/src/include/liburing/io_uring.h +++ b/src/include/liburing/io_uring.h @@ -258,6 +258,7 @@ enum io_uring_op { IORING_OP_FIXED_FD_INSTALL, IORING_OP_FTRUNCATE, IORING_OP_BIND, + IORING_OP_LISTEN, /* this goes last, obviously */ IORING_OP_LAST, diff --git a/src/liburing-ffi.map b/src/liburing-ffi.map index de2cb09..0cbf14c 100644 --- a/src/liburing-ffi.map +++ b/src/liburing-ffi.map @@ -202,4 +202,5 @@ LIBURING_2.7 { io_uring_prep_fadvise64; io_uring_prep_madvise64; io_uring_prep_bind; + io_uring_prep_listen; } LIBURING_2.6; From patchwork Tue Jul 23 23:17:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriel Krisman Bertazi X-Patchwork-Id: 13740445 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 6A15728E8 for ; Tue, 23 Jul 2024 23:17:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721776666; cv=none; b=RQggDlJ4Ik+68wBLzAuDL9KFW3DSd0+Sv9iWqPFtDBgiAoN8wKf1Au3HQrRGlof+9n39FBwgY6pVInjAQbGbynoec7Aub2a7jKpilev+pQSvmmsEfrombksWw3NY+9vFTMPBF1m1UxAQOcNFxp4V5DzdTjQC5XVObOGg+4McaL4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721776666; c=relaxed/simple; bh=ILZfS6plwPC0Xg1uBYrhpaSSN0M0tGqt5taJGmu+gdo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PR2bbrF9CUP7vTxronON/blhQPgFEy4YH2qoLj/qtT87nO9XBu4xMfRozjh/8IjEb4p6qHIjcu2FmnWQKNO6S63a9M889UedtoqxCdJNBQ7A8p0DOwV0qZMd7me1A5KL0gMngmOxNDKlMPMt+URDTZk4xO3qEKkArnAoJxjgUZg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=rHXgqlpM; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=NQ1LIu9E; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=rHXgqlpM; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=NQ1LIu9E; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="rHXgqlpM"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="NQ1LIu9E"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="rHXgqlpM"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="NQ1LIu9E" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id C1C4D21AA9; Tue, 23 Jul 2024 23:17:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1721776662; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=42dBzkEY4jdARv4r2VXKGLDDJcOJR8Tw4CMl+5f9I7c=; b=rHXgqlpMnE1e/QpuxjhL0d4Xv7QMlHq8REnFZzN+xTifUwjNOJvp+dF8Gm+joiARd/Ufzx 8xvvWJGVpbonVY4DmY+P4K7lQ1OvkxVeMrDukF1gMDdEPkm/JddqPOuQqGVB73XC5tZfW9 vs+fCN7xFQwGN4EbfQmEKcacm6U9gu8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1721776662; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=42dBzkEY4jdARv4r2VXKGLDDJcOJR8Tw4CMl+5f9I7c=; b=NQ1LIu9E1FiolZcwkE3+QUvEx3SgMbJXi+LVDBo3lZOV2quSKVwKYF+YuqTZiDqJRL8K9w 0q30YoxA5DtLCEAg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1721776662; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=42dBzkEY4jdARv4r2VXKGLDDJcOJR8Tw4CMl+5f9I7c=; b=rHXgqlpMnE1e/QpuxjhL0d4Xv7QMlHq8REnFZzN+xTifUwjNOJvp+dF8Gm+joiARd/Ufzx 8xvvWJGVpbonVY4DmY+P4K7lQ1OvkxVeMrDukF1gMDdEPkm/JddqPOuQqGVB73XC5tZfW9 vs+fCN7xFQwGN4EbfQmEKcacm6U9gu8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1721776662; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=42dBzkEY4jdARv4r2VXKGLDDJcOJR8Tw4CMl+5f9I7c=; b=NQ1LIu9E1FiolZcwkE3+QUvEx3SgMbJXi+LVDBo3lZOV2quSKVwKYF+YuqTZiDqJRL8K9w 0q30YoxA5DtLCEAg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 8844913874; Tue, 23 Jul 2024 23:17:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id MMn5GhY6oGbOUgAAD6G6ig (envelope-from ); Tue, 23 Jul 2024 23:17:42 +0000 From: Gabriel Krisman Bertazi To: axboe@kernel.dk Cc: io-uring@vger.kernel.org, asml.silence@gmail.com, Gabriel Krisman Bertazi Subject: [PATCH liburing v2 3/5] tests: Add test for bind/listen commands Date: Tue, 23 Jul 2024 19:17:31 -0400 Message-ID: <20240723231733.31884-4-krisman@suse.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240723231733.31884-1-krisman@suse.de> References: <20240723231733.31884-1-krisman@suse.de> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Level: * X-Spamd-Result: default: False [1.90 / 50.00]; SUSPICIOUS_RECIPS(1.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; MIME_GOOD(-0.10)[text/plain]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; RCVD_VIA_SMTP_AUTH(0.00)[]; TAGGED_RCPT(0.00)[]; FREEMAIL_CC(0.00)[vger.kernel.org,gmail.com,suse.de]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FREEMAIL_ENVRCPT(0.00)[gmail.com] X-Spam-Flag: NO X-Spam-Score: 1.90 This test implements verification for bind/listen commands. First, it creates a TCP connection with itself only using io_uring and verify it works by sending data over it. Then, some unit test verifies some failed cases of malformed bind and listen operations. Signed-off-by: Gabriel Krisman Bertazi --- test/Makefile | 1 + test/bind-listen.c | 381 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 382 insertions(+) create mode 100644 test/bind-listen.c diff --git a/test/Makefile b/test/Makefile index fcf6554..a47ca6f 100644 --- a/test/Makefile +++ b/test/Makefile @@ -52,6 +52,7 @@ test_srcs := \ across-fork.c \ b19062a56726.c \ b5837bd5311d.c \ + bind-listen.c \ buf-ring.c \ buf-ring-nommap.c \ buf-ring-put.c \ diff --git a/test/bind-listen.c b/test/bind-listen.c new file mode 100644 index 0000000..1fa3b54 --- /dev/null +++ b/test/bind-listen.c @@ -0,0 +1,381 @@ +/* SPDX-License-Identifier: MIT */ +/* + * Configure and operate a TCP socket solely with io_uring. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "liburing.h" +#include "helpers.h" + +static void msec_to_ts(struct __kernel_timespec *ts, unsigned int msec) +{ + ts->tv_sec = msec / 1000; + ts->tv_nsec = (msec % 1000) * 1000000; +} + +const char *magic = "Hello World!"; + +enum { + SRV_INDEX = 0, + CLI_INDEX, + CONN_INDEX, +}; + +static int connect_client(struct io_uring *ring, unsigned short peer_port) +{ + + struct __kernel_timespec ts; + struct io_uring_sqe *sqe; + struct io_uring_cqe *cqe; + int head, ret, submitted = 0; + struct sockaddr_in peer_addr; + socklen_t addr_len = sizeof(peer_addr); + + peer_addr.sin_family = AF_INET; + peer_addr.sin_port = peer_port; + peer_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + + sqe = io_uring_get_sqe(ring); + io_uring_prep_socket_direct(sqe, AF_INET, SOCK_STREAM, 0, + CLI_INDEX, 0); + sqe->flags |= IOSQE_IO_LINK; + + sqe = io_uring_get_sqe(ring); + io_uring_prep_connect(sqe, CLI_INDEX, (struct sockaddr*) &peer_addr, addr_len); + sqe->flags |= IOSQE_FIXED_FILE | IOSQE_IO_LINK; + + sqe = io_uring_get_sqe(ring); + io_uring_prep_send(sqe, CLI_INDEX, magic, strlen(magic), 0); + sqe->flags |= IOSQE_FIXED_FILE | IOSQE_IO_LINK; + + submitted = ret = io_uring_submit(ring); + if (ret < 0) + return T_SETUP_SKIP; + + msec_to_ts(&ts, 300); + ret = io_uring_wait_cqes(ring, &cqe, submitted, &ts, NULL); + if (ret < 0) + return T_SETUP_SKIP; + + io_uring_for_each_cqe(ring, head, cqe) { + ret = cqe->res; + if (ret < 0) + return T_SETUP_SKIP; + } io_uring_cq_advance(ring, submitted); + + return T_SETUP_OK; +} + +static int setup_srv(struct io_uring *ring, struct sockaddr_in *server_addr) +{ + int val; + int submitted; + struct io_uring_sqe *sqe; + struct io_uring_cqe *cqe; + struct __kernel_timespec ts; + int head; + + int ret; + + memset(server_addr, 0, sizeof(struct sockaddr_in)); + server_addr->sin_family = AF_INET; + server_addr->sin_port = htons(8000); + server_addr->sin_addr.s_addr = htons(INADDR_ANY); + + sqe = io_uring_get_sqe(ring); + io_uring_prep_socket_direct(sqe, AF_INET, SOCK_STREAM, 0, SRV_INDEX, 0); + sqe->flags |= IOSQE_IO_LINK; + + sqe = io_uring_get_sqe(ring); + val = 1; + io_uring_prep_cmd_sock(sqe, SOCKET_URING_OP_SETSOCKOPT, 0, SOL_SOCKET, + SO_REUSEADDR, &val, sizeof(val)); + sqe->flags |= IOSQE_FIXED_FILE | IOSQE_IO_LINK; + + sqe = io_uring_get_sqe(ring); + io_uring_prep_bind(sqe, SRV_INDEX, (struct sockaddr *) server_addr, + sizeof(struct sockaddr_in)); + sqe->flags |= IOSQE_FIXED_FILE | IOSQE_IO_LINK; + + sqe = io_uring_get_sqe(ring); + io_uring_prep_listen(sqe, SRV_INDEX, 1); + sqe->flags |= IOSQE_FIXED_FILE; + + submitted = ret = io_uring_submit(ring); + if (ret < 0) { + fprintf(stderr, "submission failed. %d\n", ret); + return T_EXIT_FAIL; + } + + msec_to_ts(&ts, 300); + ret = io_uring_wait_cqes(ring, &cqe, ret, &ts, NULL); + if (ret < 0) { + fprintf(stderr, "submission failed. %d\n", ret); + return T_EXIT_FAIL; + } + + io_uring_for_each_cqe(ring, head, cqe) { + ret = cqe->res; + if (ret < 0) { + fprintf(stderr, "Server startup failed. step %d got %d \n", head, ret); + return T_EXIT_FAIL; + } + } io_uring_cq_advance(ring, submitted); + + return T_SETUP_OK; +} + +static int test_good_server() +{ + struct sockaddr_in server_addr; + struct __kernel_timespec ts; + struct io_uring_sqe *sqe; + struct io_uring_cqe *cqe; + struct io_uring ring; + int ret; + int fds[3]; + char buf[1024]; + + memset(fds, -1, sizeof(fds)); + + ret = t_create_ring(10, &ring, IORING_SETUP_SUBMIT_ALL); + if (ret < 0) { + fprintf(stderr, "queue_init: %s\n", strerror(-ret)); + return T_SETUP_SKIP; + } + + ret = io_uring_register_files(&ring, fds, 3); + if (ret) { + fprintf(stderr, "server file register %d\n", ret); + return T_SETUP_SKIP; + } + + ret = setup_srv(&ring, &server_addr); + if (ret != T_SETUP_OK) { + fprintf(stderr, "srv startup failed.\n"); + return T_EXIT_FAIL; + } + + if (connect_client(&ring, server_addr.sin_port) != T_SETUP_OK) { + fprintf(stderr, "cli startup failed.\n"); + return T_SETUP_SKIP; + } + + /* Wait for a request */ + sqe = io_uring_get_sqe(&ring); + io_uring_prep_accept_direct(sqe, SRV_INDEX, NULL, NULL, 0, CONN_INDEX); + sqe->flags |= IOSQE_FIXED_FILE; + + io_uring_submit(&ring); + io_uring_wait_cqe(&ring, &cqe); + if (cqe->res < 0) { + fprintf(stderr, "accept failed. %d\n", cqe->res); + return T_EXIT_FAIL; + } + io_uring_cqe_seen(&ring, cqe); + + sqe = io_uring_get_sqe(&ring); + io_uring_prep_recv(sqe, CONN_INDEX, buf, BUFSIZ, 0); + sqe->flags |= IOSQE_FIXED_FILE; + + io_uring_submit(&ring); + io_uring_wait_cqe_timeout(&ring, &cqe, &ts); + + if (cqe->res < 0) { + fprintf(stderr, "bad receive cqe. %d\n", cqe->res); + return T_EXIT_FAIL; + } + ret = cqe->res; + + io_uring_queue_exit(&ring); + + if (ret != strlen(magic) || strncmp(buf, magic, ret)) { + fprintf(stderr, "didn't receive expected string. Got %d '%s'\n", ret, buf); + return T_EXIT_FAIL; + } + fprintf(stderr, "expected string. Got %d '%s'\n", ret, buf); + return T_EXIT_PASS; +} + +int test_bad_bind() +{ + int sock; + struct sockaddr_in server_addr; + struct io_uring_sqe *sqe; + struct io_uring_cqe *cqe; + struct io_uring ring; + int err; + int ret = T_EXIT_FAIL; + + memset(&server_addr, 0, sizeof(struct sockaddr_in)); + server_addr.sin_family = AF_INET; + server_addr.sin_port = htons(8001); + server_addr.sin_addr.s_addr = htons(INADDR_ANY); + + err = t_create_ring(1, &ring, 0); + if (err < 0) { + fprintf(stderr, "queue_init: %s\n", strerror(-ret)); + return T_SETUP_SKIP; + } + + sock = socket(AF_INET, SOCK_STREAM, 0); + + /* Bind with size 0 */ + sqe = io_uring_get_sqe(&ring); + io_uring_prep_bind(sqe, sock, (struct sockaddr *) &server_addr, 0); + err = io_uring_submit(&ring); + if (err < 0) + goto fail; + + err = io_uring_wait_cqe(&ring, &cqe); + if (err) + goto fail; + + if (cqe->res != -EINVAL) + goto fail; + io_uring_cqe_seen(&ring, cqe); + + /* Bind with bad fd */ + sqe = io_uring_get_sqe(&ring); + io_uring_prep_bind(sqe, 0, (struct sockaddr *) &server_addr, sizeof(struct sockaddr_in)); + err = io_uring_submit(&ring); + if (err < 0) + goto fail; + + err = io_uring_wait_cqe(&ring, &cqe); + if (err) + goto fail; + if (cqe->res != -ENOTSOCK) + goto fail; + io_uring_cqe_seen(&ring, cqe); + + ret = T_EXIT_PASS; + + /* bind with weird value */ + sqe = io_uring_get_sqe(&ring); + io_uring_prep_bind(sqe, sock, (struct sockaddr *) &server_addr, sizeof(struct sockaddr_in)); + sqe->rw_flags = 1; + err = io_uring_submit(&ring); + if (err < 0) + goto fail; + + err = io_uring_wait_cqe(&ring, &cqe); + if (err) + goto fail; + if (cqe->res != -EINVAL) + goto fail; + io_uring_cqe_seen(&ring, cqe); + + ret = T_EXIT_PASS; + +fail: + io_uring_queue_exit(&ring); + if (sock) + close(sock); + return ret; +} + +int test_bad_listen() +{ + int sock; + struct sockaddr_in server_addr; + struct io_uring_sqe *sqe; + struct io_uring_cqe *cqe; + struct io_uring ring; + int err; + int ret = T_EXIT_FAIL; + + memset(&server_addr, 0, sizeof(struct sockaddr_in)); + server_addr.sin_family = AF_INET; + server_addr.sin_port = htons(8001); + server_addr.sin_addr.s_addr = htons(INADDR_ANY); + + err = t_create_ring(1, &ring, 0); + if (err < 0) { + fprintf(stderr, "queue_init: %d\n", err); + return T_SETUP_SKIP; + } + + sock = socket(AF_INET, SOCK_STREAM, 0); + if (!sock) { + fprintf(stderr, "bad sock\n"); + goto fail; + } + if (bind(sock, (struct sockaddr *) &server_addr, sizeof(struct sockaddr_in))) { + fprintf(stderr, "bad bind\n"); + goto fail; + } + + /* listen on bad sock */ + sqe = io_uring_get_sqe(&ring); + io_uring_prep_listen(sqe, 0, 1); + err = io_uring_submit(&ring); + if (err < 0) + goto fail; + + err = io_uring_wait_cqe(&ring, &cqe); + if (err) + goto fail; + + if (cqe->res != -ENOTSOCK) + goto fail; + io_uring_cqe_seen(&ring, cqe); + + /* listen with weird parameters */ + sqe = io_uring_get_sqe(&ring); + io_uring_prep_listen(sqe, sock, 1); + sqe->addr2 = 0xffffff; + err = io_uring_submit(&ring); + if (err < 0) + goto fail; + + err = io_uring_wait_cqe(&ring, &cqe); + if (err) + goto fail; + + if (cqe->res != -EINVAL) + goto fail; + io_uring_cqe_seen(&ring, cqe); + + ret = T_EXIT_PASS; +fail: + io_uring_queue_exit(&ring); + if (sock) + close(sock); + return ret; +} + +int main(int argc, char *argv[]) +{ + struct io_uring_probe *probe; + int failures = 0; + if (argc > 1) + return 0; + + /* + * This test is not supported in older kernels. Check for + * OP_LISTEN, since that is the last feature required to support + * it. + */ + probe = io_uring_get_probe(); + if (!probe) + return 1; + if (!io_uring_opcode_supported(probe, IORING_OP_LISTEN)) + return T_EXIT_SKIP; + + failures += test_good_server(); + failures += test_bad_bind(); + failures += test_bad_listen(); + + if (!failures) + return T_EXIT_PASS; + return T_EXIT_FAIL; +} From patchwork Tue Jul 23 23:17:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriel Krisman Bertazi X-Patchwork-Id: 13740446 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (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 413AF13BAD5 for ; Tue, 23 Jul 2024 23:17:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721776667; cv=none; b=s7NOdoorD9a/A/ALLyLYO5oIkSpmv6vaSHJEFwNx2h9cC1w5iZYQrjCetJbscyacxnkKj8HHqnKT+lGmpH3yTw7xjNRxE8ai2U7ScYKLoZ4acBEUlTxs1HbYE4aVyGTpAOaFkbokrY/E04goK1PW/lTn9GLl8809cka9+fnmDfI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721776667; c=relaxed/simple; bh=ftz1RzQHgfxeWgy8cF5ZY4e7SLqvk3OxfVdQMbh4flM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c2ZVzX1d3Og2P3SSGykjRy2Fwrf+8DYAJf/sJniLDsqGTnxG0Wvc251mdbffz2PgwpY7ZaTlCvpNUJWJGE7zDkDl4FaRjK5eKymIypyfNCUFXORXj4i0WwGR1irw8tNcXlvKbsgjHkOqPOuHhULPw95H2dMSIs7eCOnlvxzZvM0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=ijA8llWS; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=YR4uXreM; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=ijA8llWS; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=YR4uXreM; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="ijA8llWS"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="YR4uXreM"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="ijA8llWS"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="YR4uXreM" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 4FDBA1F454; Tue, 23 Jul 2024 23:17:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1721776664; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sYSQuCfuIjLlC3yMPY46uswOkdyeX4KTIZYp1Qp+j38=; b=ijA8llWSaHE/AmSpVcl5q+JZUcQUXVf9EkUeHQebVkSB8z1kHe2Lo1EPp0kvrV6mzQFX+G Nu9au+YaFv7r3q3xbWJct7VXn37vJQUEKKWMwS1J+2O6ZjwvWGaxESecVaN2x/5KqpLNX5 fkV++VN0HU6Cmg6KRO4t4FgVEBWgOX4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1721776664; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sYSQuCfuIjLlC3yMPY46uswOkdyeX4KTIZYp1Qp+j38=; b=YR4uXreMsOZtki7kGcE85oTPuuH2InFVFpfNXLmR96vUkuy6uj/XYboTKJOasgs5RmQLb2 U5fx6Udl2InAPrDQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=ijA8llWS; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=YR4uXreM DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1721776664; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sYSQuCfuIjLlC3yMPY46uswOkdyeX4KTIZYp1Qp+j38=; b=ijA8llWSaHE/AmSpVcl5q+JZUcQUXVf9EkUeHQebVkSB8z1kHe2Lo1EPp0kvrV6mzQFX+G Nu9au+YaFv7r3q3xbWJct7VXn37vJQUEKKWMwS1J+2O6ZjwvWGaxESecVaN2x/5KqpLNX5 fkV++VN0HU6Cmg6KRO4t4FgVEBWgOX4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1721776664; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sYSQuCfuIjLlC3yMPY46uswOkdyeX4KTIZYp1Qp+j38=; b=YR4uXreMsOZtki7kGcE85oTPuuH2InFVFpfNXLmR96vUkuy6uj/XYboTKJOasgs5RmQLb2 U5fx6Udl2InAPrDQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 1887F13874; Tue, 23 Jul 2024 23:17:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id d7cEABg6oGbSUgAAD6G6ig (envelope-from ); Tue, 23 Jul 2024 23:17:43 +0000 From: Gabriel Krisman Bertazi To: axboe@kernel.dk Cc: io-uring@vger.kernel.org, asml.silence@gmail.com, Gabriel Krisman Bertazi Subject: [PATCH liburing v2 4/5] man/io_uring_prep_bind.3: Document the IORING_OP_BIND operation Date: Tue, 23 Jul 2024 19:17:32 -0400 Message-ID: <20240723231733.31884-5-krisman@suse.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240723231733.31884-1-krisman@suse.de> References: <20240723231733.31884-1-krisman@suse.de> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Action: no action X-Rspamd-Queue-Id: 4FDBA1F454 X-Spam-Score: -1.31 X-Spam-Level: X-Spam-Flag: NO X-Spamd-Result: default: False [-1.31 / 50.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; MIME_TRACE(0.00)[0:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FREEMAIL_CC(0.00)[vger.kernel.org,gmail.com,suse.de]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:dkim]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; DWL_DNSWL_BLOCKED(0.00)[suse.de:dkim]; TAGGED_RCPT(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCPT_COUNT_THREE(0.00)[4]; RCVD_VIA_SMTP_AUTH(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com] Signed-off-by: Gabriel Krisman Bertazi --- man/io_uring_prep_bind.3 | 54 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 man/io_uring_prep_bind.3 diff --git a/man/io_uring_prep_bind.3 b/man/io_uring_prep_bind.3 new file mode 100644 index 0000000..e2a1cf9 --- /dev/null +++ b/man/io_uring_prep_bind.3 @@ -0,0 +1,54 @@ +.\" Copyright (C) 2024 SUSE LLC +.\" +.\" SPDX-License-Identifier: LGPL-2.0-or-later +.\" +.TH io_uring_prep_bind 3 "Jun 3, 2024" "liburing-2.7" "liburing Manual" +.SH NAME +io_uring_prep_bind \- prepare a bind request +.SH SYNOPSIS +.nf +.B #include +.B #include +.PP +.BI "void io_uring_prep_bind(struct io_uring_sqe *" sqe "," +.BI " int " sockfd "," +.BI " struct sockaddr *" addr "," +.BI " socklen_t " addrlen ");" +.fi +.SH DESCRIPTION +The +.BR io_uring_prep_bind (3) +function prepares a bind request. The submission queue entry +.I sqe +is setup to assign the network address at +.IR addr , +of length +.IR addrlen , +to the socket descriptor +.IR sockfd. + +This function prepares an async +.BR bind (2) +request. See that man page for details. + +.SH RETURN VALUE +None +.SH ERRORS +The CQE +.I res +field will contain the result of the operation. See the related man page for +details on possible values. Note that where synchronous system calls will return +.B -1 +on failure and set +.I errno +to the actual error value, io_uring never uses +.IR errno . +Instead it returns the negated +.I errno +directly in the CQE +.I res +field. +.SH SEE ALSO +.BR io_uring_get_sqe (3), +.BR io_uring_submit (3), +.BR bind (2) From patchwork Tue Jul 23 23:17:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriel Krisman Bertazi X-Patchwork-Id: 13740447 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 B286028E8 for ; Tue, 23 Jul 2024 23:17:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721776669; cv=none; b=oy0H7LNlB7sjNNq2lgnPqgvB/apj0hThNV4vcgkxCwmuzK0jt7NkUUNhwyp676AYchQ9HLo9c5RCH+pNM1kUywDNff5Py43Nz6N1WdxB4U6kT02nEc0TB7Nj3vReKtebN25ff7Vq9SjDxOAoYl6AXOuAKLTeKO6Th0TK0rahmc8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721776669; c=relaxed/simple; bh=U1FcmfJ8+cvlue83//r8iaxGTbgTnFsUrb0C9J9leSQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AaWjpTG7VoO4EsiW7R9jY/3KN0GnafQZHALBCs4pFFSM9FN5t8Ehp+CPTWK5OmWiLaf7O388rILKRT5iQxUiqSNvwL0aLjdiOPYMr9RiVdUfE9VGBTqFpsB44sCAQpwK5Zzz1B8sZRISl4ntZYEq+1q4tfp5/vL+A0cml5COkk8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=gtNF9sOf; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=WgyZ26dx; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=gtNF9sOf; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=WgyZ26dx; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="gtNF9sOf"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="WgyZ26dx"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="gtNF9sOf"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="WgyZ26dx" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E018C21A82; Tue, 23 Jul 2024 23:17:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1721776665; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dEwvX77XHO7ox1O071NbVflXo4aI4ZaorFaCrwqijio=; b=gtNF9sOf2fQrppiPuNcPUHqEwYWU2r0scEntdZ/S/yO50S8z1uQCAwvXqyGfsE+ZH/xuWT D1oD8bgaEE7p+M34AMYRcxaEY9+hGsLikzZAANGeWmeWgsTk6oCb1ehcur2H/m9TLQYfd7 GiP+VrjHg6KZ3qoOPnhkakukkoNq2Xg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1721776665; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dEwvX77XHO7ox1O071NbVflXo4aI4ZaorFaCrwqijio=; b=WgyZ26dxhFPas93CkIve7sxdnpEmTbMGU+Plh/vTI1UyGBz6CrCYXtDEJmFHpaL346gdTu Ro4Sgo8OqU+n67Cg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1721776665; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dEwvX77XHO7ox1O071NbVflXo4aI4ZaorFaCrwqijio=; b=gtNF9sOf2fQrppiPuNcPUHqEwYWU2r0scEntdZ/S/yO50S8z1uQCAwvXqyGfsE+ZH/xuWT D1oD8bgaEE7p+M34AMYRcxaEY9+hGsLikzZAANGeWmeWgsTk6oCb1ehcur2H/m9TLQYfd7 GiP+VrjHg6KZ3qoOPnhkakukkoNq2Xg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1721776665; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dEwvX77XHO7ox1O071NbVflXo4aI4ZaorFaCrwqijio=; b=WgyZ26dxhFPas93CkIve7sxdnpEmTbMGU+Plh/vTI1UyGBz6CrCYXtDEJmFHpaL346gdTu Ro4Sgo8OqU+n67Cg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 9CFA913874; Tue, 23 Jul 2024 23:17:45 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id C+oxIBk6oGbVUgAAD6G6ig (envelope-from ); Tue, 23 Jul 2024 23:17:45 +0000 From: Gabriel Krisman Bertazi To: axboe@kernel.dk Cc: io-uring@vger.kernel.org, asml.silence@gmail.com, Gabriel Krisman Bertazi Subject: [PATCH liburing v2 5/5] man/io_uring_prep_listen.3: Document IORING_OP_LISTEN operation Date: Tue, 23 Jul 2024 19:17:33 -0400 Message-ID: <20240723231733.31884-6-krisman@suse.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240723231733.31884-1-krisman@suse.de> References: <20240723231733.31884-1-krisman@suse.de> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spamd-Result: default: False [-1.10 / 50.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TAGGED_RCPT(0.00)[]; FREEMAIL_CC(0.00)[vger.kernel.org,gmail.com,suse.de]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; RCVD_TLS_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCPT_COUNT_THREE(0.00)[4]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FREEMAIL_ENVRCPT(0.00)[gmail.com] X-Spam-Level: X-Spam-Flag: NO X-Spam-Score: -1.10 Signed-off-by: Gabriel Krisman Bertazi --- man/io_uring_prep_listen.3 | 52 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 man/io_uring_prep_listen.3 diff --git a/man/io_uring_prep_listen.3 b/man/io_uring_prep_listen.3 new file mode 100644 index 0000000..b765298 --- /dev/null +++ b/man/io_uring_prep_listen.3 @@ -0,0 +1,52 @@ +.\" Copyright (C) 2024 SUSE LLC. +.\" +.\" SPDX-License-Identifier: LGPL-2.0-or-later +.\" +.TH io_uring_prep_listen 3 "Jun 3, 2024" "liburing-2.7" "liburing Manual" +.SH NAME +io_uring_prep_listen \- prepare a listen request +.SH SYNOPSIS +.nf +.B #include +.B #include +.PP +.BI "void io_uring_prep_listen(struct io_uring_sqe *" sqe "," +.BI " int " sockfd "," +.BI " int" backlog ");" +.fi +.SH DESCRIPTION +The +.BR io_uring_prep_listen (3) +function prepares a listen request. The submission queue entry +.I sqe +is setup to place the socket file descriptor pointed by +.IR sockfd +into a state to accept incoming connections. The parameter +.IR backlog , +defines the maximum length of the queue of pending connections. + +This function prepares an async +.BR listen (2) +request. See that man page for details. + +.SH RETURN VALUE +None +.SH ERRORS +The CQE +.I res +field will contain the result of the operation. See the related man page for +details on possible values. Note that where synchronous system calls will return +.B -1 +on failure and set +.I errno +to the actual error value, io_uring never uses +.IR errno . +Instead it returns the negated +.I errno +directly in the CQE +.I res +field. +.SH SEE ALSO +.BR io_uring_get_sqe (3), +.BR io_uring_submit (3), +.BR listen (2)