From patchwork Wed Oct 26 23:25:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Begunkov X-Patchwork-Id: 13021462 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A2A2C433FE for ; Wed, 26 Oct 2022 23:28:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231164AbiJZX2c (ORCPT ); Wed, 26 Oct 2022 19:28:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234508AbiJZX16 (ORCPT ); Wed, 26 Oct 2022 19:27:58 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 041C25A3DA; Wed, 26 Oct 2022 16:27:32 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id bp11so28494140wrb.9; Wed, 26 Oct 2022 16:27:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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; bh=fecvoE3GO3AEiM1jj/RAiMwmH/hP4TRAww18UbwirDs=; b=k6GcJ40EahQegR5VzpYdakh/t3MYmiw5Q0nyoVR3La3kE8hHFfClOYlbJtkuif5+FH N+beJsbpOPO01+Z92fw5EQpfHbajV6BXYlFsejUh8XHGarO8slnsEAXmHRtv+/BI7Mtl 8mYGE3ppdfdobBJ5orRYKH7fKTAi65sJmaGRpdEvj38dPrdKFX+zpFuxO41BLZtafAu/ py1L4GjunQmLB3cLC/q/i7l8SOD+x6MjsPNJQcaOKM++StQk5a3+YIF/6qnyBLGozKEk cLFxLUvG9ab+w5VYVCvLYhJeU8h5CcC25Vs2FFhb1ruNU0Gv7ZEUyf1TXWPxKfGP6oU6 bAYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fecvoE3GO3AEiM1jj/RAiMwmH/hP4TRAww18UbwirDs=; b=kxKolwb5g5BDgvJq27CbcS8LhOJxv8Zmd4Lp+/rSgmfgm/bLaXeo2KI+OT0NuFjrlt 6m1SfUJeceNyq8D4aWLk+LM0Kc8patuj/NybQKt2TmMlcUiEkg6V5a0SSh9aZOmv/K+A pCX1YU1+TvCQT87+AztNMpdiEVW8ifi1xKP04ex92xfbGoygzsX/wTPXM0/zDTHsL4sF r30c/LGA7+QTkoKC94ytdrXZPKJJR1S9rDJREJIVG9cShB8zR5J3ya8sSd4QBCoIcfSU o5ACCrUOn8If9hOh5Fc2lylo0kBpHw7J/m6GuW4x7rXChgUro6u8Z5YleVNXphjRK3bA Dy1A== X-Gm-Message-State: ACrzQf3lJWqQGJmFpJUYxAospRLIeIbPf+2yiBQzGNoaqm1hbZIIV+l+ N+17kjzu29AyITx4T5kjsiHzjeybJX1qiA== X-Google-Smtp-Source: AMsMyM6uKIqQLJPtQgzCdzQ8X4e6hA0DO3wkqZfAOeXGaBTc2rqEZDJAjGBqGIMwvDkfXo9Xx8KvOg== X-Received: by 2002:adf:d1c4:0:b0:230:7771:f618 with SMTP id b4-20020adfd1c4000000b002307771f618mr28596922wrd.203.1666826852185; Wed, 26 Oct 2022 16:27:32 -0700 (PDT) Received: from 127.0.0.1localhost (213-205-70-130.net.novis.pt. [213.205.70.130]) by smtp.gmail.com with ESMTPSA id y4-20020adfd084000000b002368424f89esm4897526wrh.67.2022.10.26.16.27.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 16:27:31 -0700 (PDT) From: Pavel Begunkov To: netdev@vger.kernel.org Cc: Jakub Kicinski , "David S . Miller" , io-uring@vger.kernel.org, John Fastabend , asml.silence@gmail.com, Stefan Metzmacher Subject: [PATCH net 4/4] net: also flag accepted sockets supporting msghdr originated zerocopy Date: Thu, 27 Oct 2022 00:25:59 +0100 Message-Id: X-Mailer: git-send-email 2.38.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org From: Stefan Metzmacher Without this only the client initiated tcp sockets have SOCK_SUPPORT_ZC. The listening socket on the server also has it, but the accepted connections didn't, which meant IORING_OP_SEND[MSG]_ZC will always fails with -EOPNOTSUPP. Fixes: e993ffe3da4b ("net: flag sockets supporting msghdr originated zerocopy") Cc: # 6.0 CC: Pavel Begunkov Cc: Jakub Kicinski CC: Jens Axboe Link: https://lore.kernel.org/io-uring/20221024141503.22b4e251@kernel.org/T/#m38aa19b0b825758fb97860a38ad13122051f9dda Signed-off-by: Stefan Metzmacher Signed-off-by: Pavel Begunkov --- net/ipv4/af_inet.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 3dd02396517d..4728087c42a5 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -754,6 +754,8 @@ int inet_accept(struct socket *sock, struct socket *newsock, int flags, (TCPF_ESTABLISHED | TCPF_SYN_RECV | TCPF_CLOSE_WAIT | TCPF_CLOSE))); + if (test_bit(SOCK_SUPPORT_ZC, &sock->flags)) + set_bit(SOCK_SUPPORT_ZC, &newsock->flags); sock_graft(sk2, newsock); newsock->state = SS_CONNECTED;