From patchwork Tue Dec 12 14:27:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 177380 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7760489vqy; Tue, 12 Dec 2023 06:30:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IG6nl12zv9BpC9gqvfHo5VDueGR6pDRrZAZeoFwpK5QY4GWqmJ0usK0jhQBs72wkBj8YFwc X-Received: by 2002:a05:6a00:a85:b0:6ce:748e:d0d0 with SMTP id b5-20020a056a000a8500b006ce748ed0d0mr3458757pfl.52.1702391439761; Tue, 12 Dec 2023 06:30:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702391439; cv=none; d=google.com; s=arc-20160816; b=g/IpXQjqCPQbb9WXEA32dBRyMW5Ah/TsUOSaSHIW7WYRLuSVAHKbYs/w0gOis+yzVw G2AgZHHNE8lKplLAMi9lecoB7yYtzLd8RKyzv3D6RakcMhh3gunNDuOhQflZkeIqvLgk 8c4M/yOMmobSmwirp8twlFV/dg5Ed+j5BSeTMVlIZExVCrrHxcqWfa6AnC2HKEBeQLXe Sflhk61timWV1qWYKTdPUvc1yKVyd8MrezQYwTUjFtU1pQ9kgQpzyGm8mTyl9MB5fcLM JskKAI/lWhQtXV3uAM3KxzomEAH4dE54qboqdr1VrDE7VPpw6TWCg3PE+BnhTFxiRLL0 Kc3A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ky7OKpkFv9Y7W9wME9WcGAirmwyFxYtI82CJtTFoPHQ=; fh=EwMqise1xMM1tPrdItjL1KUuE75eRF/IfSQLzRFVBzg=; b=nQp5WGWLBJ8KmsJYsGADrJ8b+vdcyHjvzv5P/AxV5gxVy3cUS6k0PU1BhhPvV98cSW YXEcKuNi5C+M5u4vj/Xbbnqc3uR8KCIp8iOlyty6EbZx+Aom6RKGueG3KIh0TzwNidEz YAZlLvrPyl4XdDCfYhCMtIBq1uy8Fy8J7Wc08lTVxo4ATYyJizVqClejrxWTl2Ko//Ft AM7Oa2leLxrY5H7KvwavIra36+UnJZKbdiHE1fVXYxhVdh/412ZlTSjr9Yd4qsOJbyVL iRy4r+Jt6+bfC+lUjLB8d5bX2qCyMi8yNVRChiIHvQvBmIYFOI8NrrbkB60y2tkyY+mG GDJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SDNZRE1C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id a1-20020a654181000000b005b92b048254si7859416pgq.201.2023.12.12.06.30.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 06:30:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SDNZRE1C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 891F58032E6B; Tue, 12 Dec 2023 06:30:05 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376808AbjLLO3q (ORCPT + 99 others); Tue, 12 Dec 2023 09:29:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376605AbjLLO3p (ORCPT ); Tue, 12 Dec 2023 09:29:45 -0500 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 016D98E; Tue, 12 Dec 2023 06:29:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702391392; x=1733927392; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tC4nqzPPkN2y5U1+kXQLWaCibaTxMNcqk0oLrJfP9KY=; b=SDNZRE1C0WvK46b1KUE5s0Pfy7LIkGGIWaFRiu8LUECAFzGtqNAKJMGk ASeCbFD8tKUJKqdw8/4kXTaJ/CaXp1SsZtJg2koM0d/IGl4dGImUmP7Po f+I/pFQ1oHGvTUkmmAsEVHXdZE4Y7gqFgcHtt1DqSuUZzH896ef6AlitA CAhudX3Eqy0qYm5DwTgPDThII7u8j99gE/Lx2KfINFWK+VMyV1zc0SyFz JUawTzroU+8DXYwwq+MjUUvI4s57sHpsVKTk8uClDCnnOsaqej6aTEJYf uXcqV5/jdvb/PJsq3QimdhXvd/l/x8HoJEUeRh1ea/Gwj/2PzSE+9b4bY Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10922"; a="1887348" X-IronPort-AV: E=Sophos;i="6.04,270,1695711600"; d="scan'208";a="1887348" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Dec 2023 06:29:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10922"; a="1104923746" X-IronPort-AV: E=Sophos;i="6.04,270,1695711600"; d="scan'208";a="1104923746" Received: from newjersey.igk.intel.com ([10.102.20.203]) by fmsmga005.fm.intel.com with ESMTP; 12 Dec 2023 06:29:48 -0800 From: Alexander Lobakin To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Alexander Lobakin , Michal Kubiak , Przemek Kitszel , Vladimir Oltean , Andrew Lunn , Michal Kubecek , Jiri Pirko , Paul Greenwalt , Tony Nguyen , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/2] ethtool: add SET for TCP_DATA_SPLIT ringparam Date: Tue, 12 Dec 2023 15:27:51 +0100 Message-ID: <20231212142752.935000-2-aleksander.lobakin@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231212142752.935000-1-aleksander.lobakin@intel.com> References: <20231212142752.935000-1-aleksander.lobakin@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 12 Dec 2023 06:30:05 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785086806030355830 X-GMAIL-MSGID: 1785086806030355830 Follow up commit 9690ae604290 ("ethtool: add header/data split indication") and add the set part of Ethtool's header split, i.e. ability to enable/disable header split via the Ethtool Netlink interface. This might be helpful to optimize the setup for particular workloads, for example, to avoid XDP frags, and so on. A driver should advertise ``ETHTOOL_RING_USE_TCP_DATA_SPLIT`` in its ops->supported_ring_params to allow doing that. "Unknown" passed from the userspace when the header split is supported means the driver is free to choose the preferred state. Reviewed-by: Przemek Kitszel Signed-off-by: Alexander Lobakin --- include/linux/ethtool.h | 2 ++ net/ethtool/rings.c | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index deb683d3360f..67b30940234b 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -95,6 +95,7 @@ struct kernel_ethtool_ringparam { * @ETHTOOL_RING_USE_TX_PUSH: capture for setting tx_push * @ETHTOOL_RING_USE_RX_PUSH: capture for setting rx_push * @ETHTOOL_RING_USE_TX_PUSH_BUF_LEN: capture for setting tx_push_buf_len + * @ETHTOOL_RING_USE_TCP_DATA_SPLIT: capture for setting tcp_data_split */ enum ethtool_supported_ring_param { ETHTOOL_RING_USE_RX_BUF_LEN = BIT(0), @@ -102,6 +103,7 @@ enum ethtool_supported_ring_param { ETHTOOL_RING_USE_TX_PUSH = BIT(2), ETHTOOL_RING_USE_RX_PUSH = BIT(3), ETHTOOL_RING_USE_TX_PUSH_BUF_LEN = BIT(4), + ETHTOOL_RING_USE_TCP_DATA_SPLIT = BIT(5), }; #define __ETH_RSS_HASH_BIT(bit) ((u32)1 << (bit)) diff --git a/net/ethtool/rings.c b/net/ethtool/rings.c index fb09f774ea01..b7865a14fdf8 100644 --- a/net/ethtool/rings.c +++ b/net/ethtool/rings.c @@ -124,6 +124,8 @@ const struct nla_policy ethnl_rings_set_policy[] = { [ETHTOOL_A_RINGS_RX_JUMBO] = { .type = NLA_U32 }, [ETHTOOL_A_RINGS_TX] = { .type = NLA_U32 }, [ETHTOOL_A_RINGS_RX_BUF_LEN] = NLA_POLICY_MIN(NLA_U32, 1), + [ETHTOOL_A_RINGS_TCP_DATA_SPLIT] = + NLA_POLICY_MAX(NLA_U8, ETHTOOL_TCP_DATA_SPLIT_ENABLED), [ETHTOOL_A_RINGS_CQE_SIZE] = NLA_POLICY_MIN(NLA_U32, 1), [ETHTOOL_A_RINGS_TX_PUSH] = NLA_POLICY_MAX(NLA_U8, 1), [ETHTOOL_A_RINGS_RX_PUSH] = NLA_POLICY_MAX(NLA_U8, 1), @@ -145,6 +147,14 @@ ethnl_set_rings_validate(struct ethnl_req_info *req_info, return -EOPNOTSUPP; } + if (tb[ETHTOOL_A_RINGS_TCP_DATA_SPLIT] && + !(ops->supported_ring_params & ETHTOOL_RING_USE_TCP_DATA_SPLIT)) { + NL_SET_ERR_MSG_ATTR(info->extack, + tb[ETHTOOL_A_RINGS_TCP_DATA_SPLIT], + "setting TCP data split is not supported"); + return -EOPNOTSUPP; + } + if (tb[ETHTOOL_A_RINGS_CQE_SIZE] && !(ops->supported_ring_params & ETHTOOL_RING_USE_CQE_SIZE)) { NL_SET_ERR_MSG_ATTR(info->extack, @@ -202,6 +212,8 @@ ethnl_set_rings(struct ethnl_req_info *req_info, struct genl_info *info) ethnl_update_u32(&ringparam.tx_pending, tb[ETHTOOL_A_RINGS_TX], &mod); ethnl_update_u32(&kernel_ringparam.rx_buf_len, tb[ETHTOOL_A_RINGS_RX_BUF_LEN], &mod); + ethnl_update_u8(&kernel_ringparam.tcp_data_split, + tb[ETHTOOL_A_RINGS_TCP_DATA_SPLIT], &mod); ethnl_update_u32(&kernel_ringparam.cqe_size, tb[ETHTOOL_A_RINGS_CQE_SIZE], &mod); ethnl_update_u8(&kernel_ringparam.tx_push,