Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp13167573rwb; Sun, 27 Nov 2022 00:38:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf4W04gqZLudmEP1z4GqHSbY14jKkB7yRq2ziiRXF2aDOfzcLqXErLvTF63a6CayeAp2lawV X-Received: by 2002:aa7:8709:0:b0:572:2189:84ef with SMTP id b9-20020aa78709000000b00572218984efmr27039569pfo.28.1669538322518; Sun, 27 Nov 2022 00:38:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669538322; cv=none; d=google.com; s=arc-20160816; b=CkDXT0hiSL31zUdBwNoAYdf0qsxwJpA1f8aNxyEg2prvJ7uiGt3pQZJ1nPrgEQt2xg ngUoQw/k2HU6WGX6PpzS6l1BKFeK/v1iKDcuX0XXv7gv6kIrFZHIT+DPOxKZE2p1+egR tlQ4p7rnXNGtmKjsZtV4zgozq5DlFt/589CpAzMQRg47vRZOhkOGkzc/FE8Li3R0d8pJ apcvZiehzbmZuDG0c8QKwX7tG07PJi3M/NBMMCurEo6Aj8sceRONBTTBoZ1YRoOyz+zZ jBbEi06T8faNNK5fglezBd3xUU0iu3s+CaK0vxDnpqK4nnxdpUHgaMFa4FwNn8A7MYbJ TJug== 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:sender :dkim-signature; bh=Wa4XaW+1zFy7m2UqkW+jljIO+eXfIIcKkAfn67qndy0=; b=cuVvy7hmm7djYsY0RY21xXXYtgl9241qJ5x2h+SlBnmjnDWFESfO1xgHp6t9KcPxan 3l+6ALM4AfyZdOMqQOWA+QIO1w4WO9w7wah8J0UHlQssly5gEGxJgIhSfW4QbSHQ2P55 WtNylMxTMvF1s7RN0LG3tg8hUZ/YTa/7xjaQqwkOccD7Pv8z5SKXR1LcNKOQqrnfuyLD 4WZxFw5vw0kJYbGBb+ooiHENKpKOXDOhvff7EXXYqGnVFmykcJ55ZMohACA2Wze1Goi3 Lphqys3jK3lL3q3MGrHsarF6ebutQ9ZrJHsw26EvMn3ZXjRv51/lPZUM7aRhDY/+teG+ UHkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gJ901gCK; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h12-20020a170902f7cc00b00188dba5d7d9si8516007plw.295.2022.11.27.00.38.22; Sun, 27 Nov 2022 00:38:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gJ901gCK; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229513AbiK0ISx (ORCPT + 99 others); Sun, 27 Nov 2022 03:18:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229597AbiK0IRk (ORCPT ); Sun, 27 Nov 2022 03:17:40 -0500 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF0EC13F06; Sun, 27 Nov 2022 00:17:11 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id u15-20020a17090a3fcf00b002191825cf02so3313098pjm.2; Sun, 27 Nov 2022 00:17:11 -0800 (PST) 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:sender:from:to:cc:subject:date :message-id:reply-to; bh=Wa4XaW+1zFy7m2UqkW+jljIO+eXfIIcKkAfn67qndy0=; b=gJ901gCKJQ/u/46XSpx0gsFigjhjTIx2OCUIqZb1puMm0hUpCJDoAKMAPYXqchSe7Z ztSHzcluSUWvjmcnWlVqaUrEeQe+yU8FZaNIkx821qFXVZkQLkzPtl0l7z4hdtyrnQP6 Jc9CJVhx3FRDEJIC3Ll7BCw3oK9/f1SHcq2mHryaZIgPtK6Ekw5JuSnSKUd2J2VV+WW+ axUt7HoyeaX4MHUz9Rnj5nSezf2VP5hlKZ7pqPqkeknbllCEr1tHOlUJdU0yzLzDHK12 y0xxEvZL5zG78lBDSvgpaE1mMckYgBkexx+4SDgnkJS7huVaEwd5HcASnMddw/oEohtN w++A== 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:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Wa4XaW+1zFy7m2UqkW+jljIO+eXfIIcKkAfn67qndy0=; b=Sz9P5yh3H5IkhdmfjxclPqMIxFsKC7am2p6T2BtvbuZLbxlv5lfdlRu91qMOjrTaBt e3A7NaY+uisMml6vqqG+jadBkWkdfnfWEeFlaDWNtWL4WZpRCmW+rdFgGemE5DtdBrkf EcdcIr9yInIl2olTF72lUVvkuhklIAR4+ct8uf4z3/qBfSldNHDH5MgTpfkplth5NnzL GycxE01s/4oV29Qo6rr7e3JPqWdU/PvJxbFqdGePY9zVddefN69PiYiA0kGflc5tKfOe KAjyCaI30M/b7Bu4b/3L+bduvbrlDDLnqBY5gU6gFYdX1ah4uU9pGF73LLzSP0tOT3MG PtAg== X-Gm-Message-State: ANoB5pn+E0Mc2BcM9jjSXwYnbyowNdjPRe5oPwoQBtt7ZGpren9Jg18l MZZMbtzr+nXMtfcVFv0t4TkSsFpf+quMrA== X-Received: by 2002:a17:903:251:b0:189:78d9:fe3c with SMTP id j17-20020a170903025100b0018978d9fe3cmr5123764plh.101.1669537031297; Sun, 27 Nov 2022 00:17:11 -0800 (PST) Received: from localhost.localdomain (124x33x176x97.ap124.ftth.ucom.ne.jp. [124.33.176.97]) by smtp.gmail.com with ESMTPSA id a3-20020aa794a3000000b00572c12a1e91sm5799915pfl.48.2022.11.27.00.17.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Nov 2022 00:17:11 -0800 (PST) Sender: Vincent Mailhol From: Vincent Mailhol To: Jiri Pirko , netdev@vger.kernel.org, Jakub Kicinski Cc: "David S . Miller" , Eric Dumazet , Paolo Abeni , linux-kernel@vger.kernel.org, Boris Brezillon , Arnaud Ebalard , Srujana Challa , Kurt Kanzenbach , Andrew Lunn , Florian Fainelli , Vladimir Oltean , Michael Chan , Ioana Ciornei , Dimitris Michailidis , Yisen Zhuang , Salil Mehta , Jesse Brandeburg , Tony Nguyen , Sunil Goutham , Linu Cherian , Geetha sowjanya , Jerin Jacob , hariprasad , Subbaraya Sundeep , Taras Chornyi , Saeed Mahameed , Leon Romanovsky , Ido Schimmel , Petr Machata , Simon Horman , Shannon Nelson , drivers@pensando.io, Ariel Elior , Manish Chopra , Jonathan Lemon , Vadim Fedorenko , Richard Cochran , Vadim Pasternak , Shalom Toledo , linux-crypto@vger.kernel.org, intel-wired-lan@lists.osuosl.org, linux-rdma@vger.kernel.org, oss-drivers@corigine.com, Vincent Mailhol Subject: [PATCH net-next v2 5/5] net: devlink: make the devlink_ops::info_get() callback optional Date: Sun, 27 Nov 2022 17:16:04 +0900 Message-Id: <20221127081604.5242-6-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221127081604.5242-1-mailhol.vincent@wanadoo.fr> References: <20221122154934.13937-1-mailhol.vincent@wanadoo.fr> <20221127081604.5242-1-mailhol.vincent@wanadoo.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS 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-crypto@vger.kernel.org Some drivers only reported the driver name in their devlink_ops::info_get() callback. Now that the core provides this information, the callback became empty. For such drivers, just removing the callback would prevent the core from executing devlink_nl_info_fill() meaning that "devlink dev info" would not return anything. Make the callback function optional by executing devlink_nl_info_fill() even if devlink_ops::info_get() is NULL. Remove all the empty devlink_ops::info_get() functions from the drivers. N.B.: the drivers with devlink support which previously did not implement devlink_ops::info_get() will now also be able to report the driver name. Signed-off-by: Vincent Mailhol --- .../net/ethernet/fungible/funeth/funeth_devlink.c | 7 ------- .../net/ethernet/marvell/octeontx2/af/rvu_devlink.c | 7 ------- .../ethernet/marvell/octeontx2/nic/otx2_devlink.c | 8 -------- net/core/devlink.c | 13 ++++++------- 4 files changed, 6 insertions(+), 29 deletions(-) diff --git a/drivers/net/ethernet/fungible/funeth/funeth_devlink.c b/drivers/net/ethernet/fungible/funeth/funeth_devlink.c index 6668375edff6..4fbeb3fd71a8 100644 --- a/drivers/net/ethernet/fungible/funeth/funeth_devlink.c +++ b/drivers/net/ethernet/fungible/funeth/funeth_devlink.c @@ -3,14 +3,7 @@ #include "funeth.h" #include "funeth_devlink.h" -static int fun_dl_info_get(struct devlink *dl, struct devlink_info_req *req, - struct netlink_ext_ack *extack) -{ - return 0; -} - static const struct devlink_ops fun_dl_ops = { - .info_get = fun_dl_info_get, }; struct devlink *fun_devlink_alloc(struct device *dev) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c index f15439d26d21..bda1a6fa2ec4 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c @@ -1547,14 +1547,7 @@ static int rvu_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode, return 0; } -static int rvu_devlink_info_get(struct devlink *devlink, struct devlink_info_req *req, - struct netlink_ext_ack *extack) -{ - return 0; -} - static const struct devlink_ops rvu_devlink_ops = { - .info_get = rvu_devlink_info_get, .eswitch_mode_get = rvu_devlink_eswitch_mode_get, .eswitch_mode_set = rvu_devlink_eswitch_mode_set, }; diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_devlink.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_devlink.c index 5cc6416cf1a6..63ef7c41d18d 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_devlink.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_devlink.c @@ -77,15 +77,7 @@ static const struct devlink_param otx2_dl_params[] = { otx2_dl_mcam_count_validate), }; -static int otx2_devlink_info_get(struct devlink *devlink, - struct devlink_info_req *req, - struct netlink_ext_ack *extack) -{ - return 0; -} - static const struct devlink_ops otx2_devlink_ops = { - .info_get = otx2_devlink_info_get, }; int otx2_register_dl(struct otx2_nic *pfvf) diff --git a/net/core/devlink.c b/net/core/devlink.c index 3babc16eeb6b..817d978bb729 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -6773,9 +6773,11 @@ devlink_nl_info_fill(struct sk_buff *msg, struct devlink *devlink, goto err_cancel_msg; req.msg = msg; - err = devlink->ops->info_get(devlink, &req, extack); - if (err) - goto err_cancel_msg; + if (devlink->ops->info_get) { + err = devlink->ops->info_get(devlink, &req, extack); + if (err) + goto err_cancel_msg; + } err = devlink_nl_driver_info_get(dev->driver, &req); if (err) @@ -6796,9 +6798,6 @@ static int devlink_nl_cmd_info_get_doit(struct sk_buff *skb, struct sk_buff *msg; int err; - if (!devlink->ops->info_get) - return -EOPNOTSUPP; - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); if (!msg) return -ENOMEM; @@ -6824,7 +6823,7 @@ static int devlink_nl_cmd_info_get_dumpit(struct sk_buff *msg, int err = 0; devlinks_xa_for_each_registered_get(sock_net(msg->sk), index, devlink) { - if (idx < start || !devlink->ops->info_get) + if (idx < start) goto inc; devl_lock(devlink); -- 2.37.4