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, From patchwork Tue Dec 12 14:27:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 177381 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7760723vqy; Tue, 12 Dec 2023 06:30:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IHGdKkIcHH56nHT2Nj69bdOlL1Camfgiyzd/bAqytALAI53F/DcVYkhzPurGTI4pe3tmN0/ X-Received: by 2002:a17:90a:7443:b0:28a:c31b:1347 with SMTP id o3-20020a17090a744300b0028ac31b1347mr377263pjk.46.1702391454915; Tue, 12 Dec 2023 06:30:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702391454; cv=none; d=google.com; s=arc-20160816; b=rnSbrjmwdTCmoXXamzNXn8XKlYP1m7DcudDUpIPFX9Cqv+pyxGwlLJQpMGqZZKX7iK 9y2kt0LE7y13gSSkj1FTxYf7OtKmZ434DDg7n88Q6SYM13vt14NrBY5jgMo1S5/4r5hU PVs1JHT7tJyj1IUyQg0uGVwE8QRNdXYQjNFMNjaXnjCKCSgZ1xU6u3AThYeJDcSNNDB+ scsrK8/cuVF5HAqfLufzgwMJMgOwd2KT1AHXK+MZqWngdzv/YpOltXFjvkYHrGR95rqc rY12dU8ErbwXUir0RlXpRjiCv36jGnVkjAZtcqN/tFSk5gX2mc8d+BvdUVBM85qi78yo Vq4Q== 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=pVFMQPpClaVffGwWk0tZ3Oe2aP9hLzt4rq2v4SgCQfo=; fh=EwMqise1xMM1tPrdItjL1KUuE75eRF/IfSQLzRFVBzg=; b=bdCK8pjLM4edADWLoluTt+/3G2Kd9kLdkp+J1S6wVgmchls/RqEQLBRnK2oXcDzR0M YmsF8/C0HRuIdNGNq2gYwndKJjfqXQref2plFij9Wue/n/62N53cD8aNmZQk4Q5ekYYf AxgaZToPv84PqAA+VkpebxKPDHEHNdXhjPpxfT1+iqS9CUoncbBKd10jipUiuhAVPsyP QPXYrno7G2QPOX9uxg/xwM8E1gwUMObQcXc+mOakUEKRKshA8gqHrzKwxTXeiT7mXf87 cCSqTuLvd5N1bdF7fW3d3VUjykY7Lr6F5SLxVEH7R5HP/y2KjBQq7OpJRft+hrDkuhap tyOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mwAe+jQ9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id a18-20020a17090acb9200b00288272f936csi9267270pju.32.2023.12.12.06.30.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 06:30:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mwAe+jQ9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id 8754C807E450; Tue, 12 Dec 2023 06:30:20 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376822AbjLLO3y (ORCPT + 99 others); Tue, 12 Dec 2023 09:29:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376819AbjLLO3x (ORCPT ); Tue, 12 Dec 2023 09:29:53 -0500 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB46CE9; Tue, 12 Dec 2023 06:29:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702391395; x=1733927395; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SmqwRqR+FjKFB/XPmsvj5POk5lK1K1Y9U4M2qqIxTQY=; b=mwAe+jQ9ILeujAPcKCZDKXIUhmGiNSQ61X8dNiQoJGsxJNgVHlXsSNqS SGvWIW7W4nmd6J57MY+5H6ZYcbHyhKxz1EE41YuJMtUms9r41Vr4KIkfu b692uq1o1of0aYniIwqT0JfTL5SRopDG9uS9QEU8qYoOyvQ8OchvdeZ5P 2hIJeJieWhBuB4zlL/xrvL2LUDm7H9nUGwwPlzg9r3AGhuojmAta2sevj Q3u/diAh5t4m4SsgwBe6IE6QSgm8r2MlN7AGYxaXuOtGvXqYb00NWVNj9 RbFUA+n+zrf2PcDQNycl6K8f7SmDXEFUKjYNDgSWHmH6SV0jMPQB5t1ZG Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10922"; a="1887374" X-IronPort-AV: E=Sophos;i="6.04,270,1695711600"; d="scan'208";a="1887374" 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:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10922"; a="1104923763" X-IronPort-AV: E=Sophos;i="6.04,270,1695711600"; d="scan'208";a="1104923763" Received: from newjersey.igk.intel.com ([10.102.20.203]) by fmsmga005.fm.intel.com with ESMTP; 12 Dec 2023 06:29:51 -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 2/2] idpf: add get/set for Ethtool's header split ringparam Date: Tue, 12 Dec 2023 15:27:52 +0100 Message-ID: <20231212142752.935000-3-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 fry.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 (fry.vger.email [0.0.0.0]); Tue, 12 Dec 2023 06:30:20 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785086772770942834 X-GMAIL-MSGID: 1785086822331601750 From: Michal Kubiak idpf supports the header split feature and that feature is always enabled by default. However, for flexibility reasons and to simplify some scenarios, it would be useful to have the support for switching the header split off (and on) from the userspace. Address that need by adding the user config parameter, the functions for disabling (or enabling) the header split feature, and calls to them from the Ethtool ringparam callbacks. It still is enabled by default if supported by the hardware. Reviewed-by: Przemek Kitszel Signed-off-by: Michal Kubiak Co-developed-by: Alexander Lobakin Signed-off-by: Alexander Lobakin --- drivers/net/ethernet/intel/idpf/idpf.h | 7 +- .../net/ethernet/intel/idpf/idpf_ethtool.c | 11 ++++ drivers/net/ethernet/intel/idpf/idpf_lib.c | 65 +++++++++++++++++++ drivers/net/ethernet/intel/idpf/idpf_txrx.c | 12 ++-- .../net/ethernet/intel/idpf/idpf_virtchnl.c | 2 + 5 files changed, 90 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/intel/idpf/idpf.h b/drivers/net/ethernet/intel/idpf/idpf.h index bee73353b56a..0acc125decb3 100644 --- a/drivers/net/ethernet/intel/idpf/idpf.h +++ b/drivers/net/ethernet/intel/idpf/idpf.h @@ -15,7 +15,7 @@ struct idpf_vport_max_q; #include #include #include -#include +#include #include #include @@ -418,11 +418,13 @@ struct idpf_vport { /** * enum idpf_user_flags + * @__IDPF_USER_FLAG_HSPLIT: header split state * @__IDPF_PROMISC_UC: Unicast promiscuous mode * @__IDPF_PROMISC_MC: Multicast promiscuous mode * @__IDPF_USER_FLAGS_NBITS: Must be last */ enum idpf_user_flags { + __IDPF_USER_FLAG_HSPLIT = 0U, __IDPF_PROMISC_UC = 32, __IDPF_PROMISC_MC, @@ -965,4 +967,7 @@ int idpf_send_map_unmap_queue_vector_msg(struct idpf_vport *vport, bool map); int idpf_send_set_sriov_vfs_msg(struct idpf_adapter *adapter, u16 num_vfs); int idpf_sriov_configure(struct pci_dev *pdev, int num_vfs); +u8 idpf_vport_get_hsplit(const struct idpf_vport *vport); +bool idpf_vport_set_hsplit(const struct idpf_vport *vport, u8 val); + #endif /* !_IDPF_H_ */ diff --git a/drivers/net/ethernet/intel/idpf/idpf_ethtool.c b/drivers/net/ethernet/intel/idpf/idpf_ethtool.c index bf58989a573e..d549d3c5910d 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_ethtool.c +++ b/drivers/net/ethernet/intel/idpf/idpf_ethtool.c @@ -320,6 +320,8 @@ static void idpf_get_ringparam(struct net_device *netdev, ring->rx_pending = vport->rxq_desc_count; ring->tx_pending = vport->txq_desc_count; + kring->tcp_data_split = idpf_vport_get_hsplit(vport); + idpf_vport_ctrl_unlock(netdev); } @@ -379,6 +381,14 @@ static int idpf_set_ringparam(struct net_device *netdev, new_rx_count == vport->rxq_desc_count) goto unlock_mutex; + if (!idpf_vport_set_hsplit(vport, kring->tcp_data_split)) { + NL_SET_ERR_MSG_MOD(ext_ack, + "setting TCP data split is not supported"); + err = -EOPNOTSUPP; + + goto unlock_mutex; + } + config_data = &vport->adapter->vport_config[idx]->user_config; config_data->num_req_txq_desc = new_tx_count; config_data->num_req_rxq_desc = new_rx_count; @@ -1334,6 +1344,7 @@ static int idpf_get_link_ksettings(struct net_device *netdev, static const struct ethtool_ops idpf_ethtool_ops = { .supported_coalesce_params = ETHTOOL_COALESCE_USECS | ETHTOOL_COALESCE_USE_ADAPTIVE, + .supported_ring_params = ETHTOOL_RING_USE_TCP_DATA_SPLIT, .get_msglevel = idpf_get_msglevel, .set_msglevel = idpf_set_msglevel, .get_link = ethtool_op_get_link, diff --git a/drivers/net/ethernet/intel/idpf/idpf_lib.c b/drivers/net/ethernet/intel/idpf/idpf_lib.c index 19809b0ddcd9..5fea2fd957eb 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_lib.c +++ b/drivers/net/ethernet/intel/idpf/idpf_lib.c @@ -1057,6 +1057,71 @@ static void idpf_vport_dealloc(struct idpf_vport *vport) adapter->next_vport = idpf_get_free_slot(adapter); } +/** + * idpf_is_hsplit_supported - check whether the header split is supported + * @vport: virtual port to check the capability for + * + * Return: true if it's supported by the HW/FW, false if not. + */ +static bool idpf_is_hsplit_supported(const struct idpf_vport *vport) +{ + return idpf_is_queue_model_split(vport->rxq_model) && + idpf_is_cap_ena_all(vport->adapter, IDPF_HSPLIT_CAPS, + IDPF_CAP_HSPLIT); +} + +/** + * idpf_vport_get_hsplit - get the current header split feature state + * @vport: virtual port to query the state for + * + * Return: ``ETHTOOL_TCP_DATA_SPLIT_UNKNOWN`` if not supported, + * ``ETHTOOL_TCP_DATA_SPLIT_DISABLED`` if disabled, + * ``ETHTOOL_TCP_DATA_SPLIT_ENABLED`` if active. + */ +u8 idpf_vport_get_hsplit(const struct idpf_vport *vport) +{ + const struct idpf_vport_user_config_data *config; + + if (!idpf_is_hsplit_supported(vport)) + return ETHTOOL_TCP_DATA_SPLIT_UNKNOWN; + + config = &vport->adapter->vport_config[vport->idx]->user_config; + + return test_bit(__IDPF_USER_FLAG_HSPLIT, config->user_flags) ? + ETHTOOL_TCP_DATA_SPLIT_ENABLED : + ETHTOOL_TCP_DATA_SPLIT_DISABLED; +} + +/** + * idpf_vport_set_hsplit - enable or disable header split on a given vport + * @vport: virtual port to configure + * @val: Ethtool flag controlling the header split state + * + * Return: true on success, false if not supported by the HW. + */ +bool idpf_vport_set_hsplit(const struct idpf_vport *vport, u8 val) +{ + struct idpf_vport_user_config_data *config; + + if (!idpf_is_hsplit_supported(vport)) + return val == ETHTOOL_TCP_DATA_SPLIT_UNKNOWN; + + config = &vport->adapter->vport_config[vport->idx]->user_config; + + switch (val) { + case ETHTOOL_TCP_DATA_SPLIT_UNKNOWN: + /* Default is to enable */ + case ETHTOOL_TCP_DATA_SPLIT_ENABLED: + __set_bit(__IDPF_USER_FLAG_HSPLIT, config->user_flags); + return true; + case ETHTOOL_TCP_DATA_SPLIT_DISABLED: + __clear_bit(__IDPF_USER_FLAG_HSPLIT, config->user_flags); + return true; + default: + return false; + } +} + /** * idpf_vport_alloc - Allocates the next available struct vport in the adapter * @adapter: board private structure diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c b/drivers/net/ethernet/intel/idpf/idpf_txrx.c index 29d2191737d5..c01fdfd41d98 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c +++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c @@ -1240,12 +1240,15 @@ static int idpf_rxq_group_alloc(struct idpf_vport *vport, u16 num_rxq) struct idpf_adapter *adapter = vport->adapter; struct idpf_queue *q; int i, k, err = 0; + bool hs; vport->rxq_grps = kcalloc(vport->num_rxq_grp, sizeof(struct idpf_rxq_group), GFP_KERNEL); if (!vport->rxq_grps) return -ENOMEM; + hs = idpf_vport_get_hsplit(vport) == ETHTOOL_TCP_DATA_SPLIT_ENABLED; + for (i = 0; i < vport->num_rxq_grp; i++) { struct idpf_rxq_group *rx_qgrp = &vport->rxq_grps[i]; int j; @@ -1298,9 +1301,8 @@ static int idpf_rxq_group_alloc(struct idpf_vport *vport, u16 num_rxq) q->rx_buf_size = vport->bufq_size[j]; q->rx_buffer_low_watermark = IDPF_LOW_WATERMARK; q->rx_buf_stride = IDPF_RX_BUF_STRIDE; - if (idpf_is_cap_ena_all(adapter, IDPF_HSPLIT_CAPS, - IDPF_CAP_HSPLIT) && - idpf_is_queue_model_split(vport->rxq_model)) { + + if (hs) { q->rx_hsplit_en = true; q->rx_hbuf_size = IDPF_HDR_BUF_SIZE; } @@ -1344,9 +1346,7 @@ static int idpf_rxq_group_alloc(struct idpf_vport *vport, u16 num_rxq) rx_qgrp->splitq.rxq_sets[j]->refillq1 = &rx_qgrp->splitq.bufq_sets[1].refillqs[j]; - if (idpf_is_cap_ena_all(adapter, IDPF_HSPLIT_CAPS, - IDPF_CAP_HSPLIT) && - idpf_is_queue_model_split(vport->rxq_model)) { + if (hs) { q->rx_hsplit_en = true; q->rx_hbuf_size = IDPF_HDR_BUF_SIZE; } diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c index 2c1b051fdc0d..d0cdd63b3d5b 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c @@ -3285,6 +3285,8 @@ void idpf_vport_init(struct idpf_vport *vport, struct idpf_vport_max_q *max_q) memcpy(vport->rx_itr_profile, rx_itr, IDPF_DIM_PROFILE_SLOTS); memcpy(vport->tx_itr_profile, tx_itr, IDPF_DIM_PROFILE_SLOTS); + idpf_vport_set_hsplit(vport, ETHTOOL_TCP_DATA_SPLIT_ENABLED); + idpf_vport_init_num_qs(vport, vport_msg); idpf_vport_calc_num_q_desc(vport); idpf_vport_calc_num_q_groups(vport);