From patchwork Wed Jun 14 11:07:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 13279919 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 7E3C71FD3 for ; Wed, 14 Jun 2023 11:10:15 +0000 (UTC) Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-3f8cdb12719so4365895e9.1 for ; Wed, 14 Jun 2023 04:10:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686741013; x=1689333013; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uaBKkQp1n+OMyFkJ4TccLXFe9/y5NjGE3wk3E7F2JvA=; b=jmgKYYDIYMWlxLi9TfUtyowYQRqTWAL1Jl2PGdrElpiNpyYUtR8NTGjYwPNrC9k+Il py/15E4uZ9Imbu922YgcFMsGlO3MnPA+t6mcvEfgATaKLvtoOBHwCPJ1MKxYFWm2uE5s 6tFNgmhbtcxo3YQfqo//20xszhWz8CPtP+ZvekxXKpQqxxOnblgPAiaVxIwZrp0heZuP V79bTBbBtN5pN4Ctmi49NKWzHR4+IBE2pBTp+d3I2uzD7Z0v/wedZPSRFWg1TvrK0zlV Bn56LdV+9pfArfmiCiKMdEX/ZYgJO+zHI172CbtM86OIpy/cSa1tGd80LN0jD8gndl4B zX1g== X-Gm-Message-State: AC+VfDxSkdQU2rYdA6+TLuzf0tUKKilHB6Mjj+yZAdCIyJeB7jOTQuJs oVwxd0/kbyHByWX7InRCcqw= X-Google-Smtp-Source: ACHHUZ79Tg78hSeMYf8i80+UZt8j9D/RlqBQsLBMUfXLapLy25sgMHC6tE+7wSGFK8RGyoW5cYNMeQ== X-Received: by 2002:a05:600c:257:b0:3f8:dac6:58ee with SMTP id 23-20020a05600c025700b003f8dac658eemr645823wmj.5.1686741013367; Wed, 14 Jun 2023 04:10:13 -0700 (PDT) Received: from localhost (fwdproxy-cln-007.fbsv.net. [2a03:2880:31ff:7::face:b00c]) by smtp.gmail.com with ESMTPSA id u26-20020a05600c211a00b003f42314832fsm17115663wml.18.2023.06.14.04.10.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jun 2023 04:10:12 -0700 (PDT) From: Breno Leitao To: io-uring@vger.kernel.org, axboe@kernel.dk, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: leit@fb.com, asml.silence@gmail.com, dsahern@kernel.org, matthieu.baerts@tessares.net, martineau@kernel.org, marcelo.leitner@gmail.com, lucien.xin@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, dccp@vger.kernel.org, mptcp@lists.linux.dev, linux-sctp@vger.kernel.org, ast@kernel.org, kuniyu@amazon.com, martin.lau@kernel.org Subject: [RFC PATCH v2 0/4] add initial io_uring_cmd support for sockets Date: Wed, 14 Jun 2023 04:07:53 -0700 Message-Id: <20230614110757.3689731-1-leitao@debian.org> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This patchset creates the initial plumbing for a io_uring command for sockets. For now, create two uring commands for sockets, SOCKET_URING_OP_SIOCOUTQ and SOCKET_URING_OP_SIOCINQ, which are available in TCP, UDP and RAW sockets. In order to test this code, I created a liburing test, which is currently located at [1], and I will create a pull request once we are good with this patchset. V1 submission was sent a while ago[2], but it required more plumbing that were done in different patch submissions[3][4]. PS: This patchset depends on a commit[4] that is not committed to the tree yet (but close too, IMO). [1] Link: https://github.com/leitao/liburing/blob/master/test/socket-io-cmd.c [2] Link: https://lore.kernel.org/lkml/20230406144330.1932798-1-leitao@debian.org/ [3] Link: https://lore.kernel.org/lkml/0a50fae3-1cf4-475e-48ae-25f41967842f@kernel.dk/ [4] Link: https://lore.kernel.org/lkml/20230609152800.830401-1-leitao@debian.org/ V1->V2: * Rely on a generic socket->ioctl infrastructure instead of reimplementing it Breno Leitao (4): net: wire up support for file_operations->uring_cmd() net: add uring_cmd callback to UDP net: add uring_cmd callback to TCP net: add uring_cmd callback to raw "protocol" include/linux/net.h | 2 ++ include/net/raw.h | 3 +++ include/net/sock.h | 6 ++++++ include/net/tcp.h | 2 ++ include/net/udp.h | 2 ++ include/uapi/linux/net.h | 5 +++++ net/core/sock.c | 17 +++++++++++++++-- net/dccp/ipv4.c | 1 + net/ipv4/af_inet.c | 3 +++ net/ipv4/raw.c | 23 +++++++++++++++++++++++ net/ipv4/tcp.c | 21 +++++++++++++++++++++ net/ipv4/tcp_ipv4.c | 1 + net/ipv4/udp.c | 22 ++++++++++++++++++++++ net/l2tp/l2tp_ip.c | 1 + net/mptcp/protocol.c | 1 + net/sctp/protocol.c | 1 + net/socket.c | 13 +++++++++++++ 17 files changed, 122 insertions(+), 2 deletions(-)