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: 10759 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1170643vqr; Wed, 14 Jun 2023 04:30:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6LghP9KN6vOdrlHKF3cCkhDvcXxk6rej0FaoKZyDTEYg/UOWSaRQ59vs3AYQh2lMbE0VWw X-Received: by 2002:a17:902:e748:b0:1b3:e8e9:6b24 with SMTP id p8-20020a170902e74800b001b3e8e96b24mr4463362plf.36.1686742240381; Wed, 14 Jun 2023 04:30:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686742240; cv=none; d=google.com; s=arc-20160816; b=CPnPXC0K+iebFlpuDHnlpnrh3Y3J95C0O0ZTkAXv1dBOhajfrMvCM6iYaIx5NuWhtE yV3/3p4zp9fY9EalFAgmRQoHsptdT6+BSkTihP+FNHoXbliL95t16RExvueEA0O1CIGU YkucvVNfRMiuyVZhoeqnJZ7xPfJc9pNhsEvLb5vir/c+czieM3h/wSIOFmypqxVPYT8l kCvqplU2NxfI1ZFFGFPyR6bq7I/1foVpTipPsq1B7RFzZNJRlqjcHdG1j0j1bJ2b+6Br RPJL6boj/YmNa/TdBDAOu2o/CkkD/eM1pEjJ8z+sZjZesnS2DJe8XJah+P5fm9I/FEDl Xlpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=uaBKkQp1n+OMyFkJ4TccLXFe9/y5NjGE3wk3E7F2JvA=; b=gjqfBp+4ej75PmmauRQy/izyxEV1sEIvCIA1t481sAPmsvraiZ4qzP0R8e3owk2lTW xpLy/PznbqslPqqC7zWaTvC/YSbAAAOgHIBk03fKDIBYvqP8VmXCdPBPkorAbsGNDaUq FSqLEWgSi/foKxeD9tSo1dhceiL+GBnEstkqT3eiL7I3bH4vCUmYGEuY9+NXmOjlkM/d DkI7DbI3gHaskgmrV/JrjTQZwtmzXHWe2hf1iFq93al35zNMmjc5cIiQDXyckFTmhidv 7i1YV3mdJnec9TAiKdWpAHf+yeTyJH8ZZGm4tQJgqDK/S9APHAMIHMS/zy8g3M9s3zo0 Q0Bw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x2-20020a170902ec8200b001b3c66afaaesi5908398plg.185.2023.06.14.04.30.26; Wed, 14 Jun 2023 04:30:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243581AbjFNLK0 (ORCPT + 99 others); Wed, 14 Jun 2023 07:10:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243366AbjFNLKU (ORCPT ); Wed, 14 Jun 2023 07:10:20 -0400 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8580F1BF6; Wed, 14 Jun 2023 04:10:15 -0700 (PDT) Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-3f8d0e814dfso4311455e9.3; 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=aEQGBhuOhMcvepCZIHegFR8Z3BhLUEvvbWEn58YGVzQpFalk3Z1VE2mnjFNyoadmYo 8vKcEtvcq4FyB8fhgwcUjGkHt9P3Vv0txXRkH4Arv26GcZaanWDsaz080KjinfxNdYwz YV2Z9O7moHXbRVMb95XyOtCL3QM923J3kimARa5/6rd0+B/vZDUjnBSDdYxZgQPZdfs0 zGReWQHNmey1/c3G414HeOUQsIGSL6RBptQ62mfbsOlWUwfoEQusDacy8JpKHIsH1sjL 7ie1QgbARdo5SdHxKIt4v+EAT0LQmcJPo/Zybev+B+TS3FbNN/6fN6bdATYEVEb469YV l4cg== X-Gm-Message-State: AC+VfDwH+ydwPNtPwbR1y1hzkYIW+hLlMVYt45JbHSG3L6bTvEeKjgow MLDm/wpLmVN7N4xiQZtTcHAc2h5kp15bpQ== 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 MIME-Version: 1.0 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768677431350381961?= X-GMAIL-MSGID: =?utf-8?q?1768677431350381961?= 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(-)