From patchwork Tue Aug 6 19:33:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 13755267 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5DDB13C677 for ; Tue, 6 Aug 2024 19:33:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722972822; cv=none; b=bgWMbix22TQ11ikw57qa1hGAYs/Yh1zNMPNg5YyxLr5hDFIB3wZoysia2TOCnxq1UUXVUjHg8jKc3jhCH8fmRMscLzk7gNdoL/f2g0putug+p0S6U9Ba0ZdT7nTN2FjYnzRq2kfSvKiFtO7PPlXcL8qMZdWUjGc7PIlr8Blhr30= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722972822; c=relaxed/simple; bh=mern0oxMBhMjRajxmnvl090135JBDOuY+VtdAgYTjBU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QhXEuKOoBolSFb0f/MmKpisWZwTGM0ye7NydpVbaNmmYyGF8yJB0pFMsD/tEbIxdCQnfZoaATJAAHPBctA3oQ6Nc+dfYixNHVZStXhWQl4RjRwJ9ZevgbpChYERF+/Comdd+Hwsk7fvkJWVXyLWURG1R5PHMcLSXoFoSdeUJsTA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Zm4ZXoHf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Zm4ZXoHf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAC41C4AF0D; Tue, 6 Aug 2024 19:33:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722972822; bh=mern0oxMBhMjRajxmnvl090135JBDOuY+VtdAgYTjBU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zm4ZXoHf0n3q4c36GQ1SNNyLItE8rHmRI44mI4k7SdukLbqUJF6r0HjCNwBIseyq8 pA9A0ZcGYa2GJ/GHRIT8C9SH+roGIVDTPDMTr1u/R40ob4HNbHxULsSrvTYCsVZnJa HQQadFsSMAz8H9lsR1tWlkL5U++P2fgnLcDUYwL9IJ/YFYEslVge6x6n7YDsFGgO9x TcAYQfpwB87i9zYnFv9nfOa6E2RAid+PHdLyxwu8CeBNLJJKJwyWNqhOV6O7niwFBX T/KACQV3QZW1BrSyJWSkUzlCS+HUM0loG7vAEvtkUVunXbRXUEzd1flQql/F2CkpaG ef5Vug0bGuWTA== From: Jakub Kicinski To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com, michael.chan@broadcom.com, shuah@kernel.org, ecree.xilinx@gmail.com, przemyslaw.kitszel@intel.com, ahmed.zaki@intel.com, andrew@lunn.ch, willemb@google.com, pavan.chebbi@broadcom.com, petrm@nvidia.com, gal@nvidia.com, jdamato@fastly.com, donald.hunter@gmail.com, Jakub Kicinski Subject: [PATCH net-next v3 07/12] ethtool: rss: move the device op invocation out of rss_prepare_data() Date: Tue, 6 Aug 2024 12:33:12 -0700 Message-ID: <20240806193317.1491822-8-kuba@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240806193317.1491822-1-kuba@kernel.org> References: <20240806193317.1491822-1-kuba@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Factor calling device ops out of rss_prepare_data(). Next patch will add alternative path using xarray. No functional changes. Reviewed-by: Joe Damato Signed-off-by: Jakub Kicinski --- net/ethtool/rss.c | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/net/ethtool/rss.c b/net/ethtool/rss.c index cd8100d81919..5c477cc36251 100644 --- a/net/ethtool/rss.c +++ b/net/ethtool/rss.c @@ -43,13 +43,9 @@ rss_parse_request(struct ethnl_req_info *req_info, struct nlattr **tb, } static int -rss_prepare_data(const struct ethnl_req_info *req_base, - struct ethnl_reply_data *reply_base, - const struct genl_info *info) +rss_prepare_get(const struct rss_req_info *request, struct net_device *dev, + struct rss_reply_data *data, const struct genl_info *info) { - struct rss_reply_data *data = RSS_REPDATA(reply_base); - struct rss_req_info *request = RSS_REQINFO(req_base); - struct net_device *dev = reply_base->dev; struct ethtool_rxfh_param rxfh = {}; const struct ethtool_ops *ops; u32 total_size, indir_bytes; @@ -57,16 +53,6 @@ rss_prepare_data(const struct ethnl_req_info *req_base, int ret; ops = dev->ethtool_ops; - if (!ops->get_rxfh) - return -EOPNOTSUPP; - - /* Some drivers don't handle rss_context */ - if (request->rss_context) { - if (!ops->cap_rss_ctx_supported && !ops->create_rxfh_context) - return -EOPNOTSUPP; - - data->no_key_fields = !ops->rxfh_per_ctx_key; - } ret = ethnl_ops_begin(dev); if (ret < 0) @@ -109,6 +95,31 @@ rss_prepare_data(const struct ethnl_req_info *req_base, return ret; } +static int +rss_prepare_data(const struct ethnl_req_info *req_base, + struct ethnl_reply_data *reply_base, + const struct genl_info *info) +{ + struct rss_reply_data *data = RSS_REPDATA(reply_base); + struct rss_req_info *request = RSS_REQINFO(req_base); + struct net_device *dev = reply_base->dev; + const struct ethtool_ops *ops; + + ops = dev->ethtool_ops; + if (!ops->get_rxfh) + return -EOPNOTSUPP; + + /* Some drivers don't handle rss_context */ + if (request->rss_context) { + if (!ops->cap_rss_ctx_supported && !ops->create_rxfh_context) + return -EOPNOTSUPP; + + data->no_key_fields = !ops->rxfh_per_ctx_key; + } + + return rss_prepare_get(request, dev, data, info); +} + static int rss_reply_size(const struct ethnl_req_info *req_base, const struct ethnl_reply_data *reply_base)