Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp472223pxk; Thu, 1 Oct 2020 07:02:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXZQnCH3KvN35VS240aaN8NNZMBaToywzyEkwTLOkV8Cg/4FQXJuSU12/rvh+8Dcl+lCfv X-Received: by 2002:a5d:51ce:: with SMTP id n14mr9081267wrv.8.1601560938007; Thu, 01 Oct 2020 07:02:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601560937; cv=none; d=google.com; s=arc-20160816; b=lBNsCU4WzmXqfMVAYwvfch7EgCtx5sbxKslpHyLo4Omw5XYkzRrS8/oZS2CRGTgqSW iSp4hsjhLgy42pF4Pdv50PPeLOjc7ZTc/44eV30NkmVf1Ey/Mcr//UpGpHxwzQbSVpJi maw6QS+RoX/IsCNDJZHctN7MWdAg8wK+ERIo/NkeNOCbatLsVsQe1CUQnJbzht0aWUUz hzaTB+nUZGX7xwoAgBB8jm3azbDlqhNxeNZaw6XiaoUssGY/ZAt11w/AjYvLdf3tnK2F MYjJKWskDg+28QmJCYweO/kVNes5r6bqLhmultiBbq7uBrX0VcS/BOjH/vqt7dVgEzBZ G6jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=D7BjkMZVNknxZ/czkeehcn0SaJ+uy5mt7oYFEcdqcF8=; b=G1UmJRjRFZq2W+sNCUvpS+/hiyrqLoZgNnxq+89ybry+/PESdHB5DuUonELj7YNrcQ YVi9jiIM0Sg1h2Fghcsjqy7lVaAxelbSDtMUbyQHDK9R6iKL5b56tzVMA5id0aq9AXzY ef8j8OoCFM7jYDXEYg/pYeqH0SnfEkVWpJPkFivgpw2iPQ8e3DojnFcZx+XDJ/pm3bd2 awg9bZmhGysR5R4lZKI8RUzqoUnpmCmMRKYItqtor0lSrXzRAKDJ7vDgaeKrxFol75HR 6mgtomPis2k/nLaflxqZEBOhRW1f0xwmbDQszaGA5O1kCB9vrc+thB6v41DOC0j1fnMa hTyg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c9si3390509edm.284.2020.10.01.07.01.54; Thu, 01 Oct 2020 07:02:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732537AbgJAOAh (ORCPT + 99 others); Thu, 1 Oct 2020 10:00:37 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:36621 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732357AbgJAOA3 (ORCPT ); Thu, 1 Oct 2020 10:00:29 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from moshe@mellanox.com) with SMTP; 1 Oct 2020 17:00:23 +0300 Received: from dev-l-vrt-136.mtl.labs.mlnx (dev-l-vrt-136.mtl.labs.mlnx [10.234.136.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 091E0NAv001720; Thu, 1 Oct 2020 17:00:23 +0300 Received: from dev-l-vrt-136.mtl.labs.mlnx (localhost [127.0.0.1]) by dev-l-vrt-136.mtl.labs.mlnx (8.14.7/8.14.7) with ESMTP id 091E0NFb011161; Thu, 1 Oct 2020 17:00:23 +0300 Received: (from moshe@localhost) by dev-l-vrt-136.mtl.labs.mlnx (8.14.7/8.14.7/Submit) id 091E0NWc011160; Thu, 1 Oct 2020 17:00:23 +0300 From: Moshe Shemesh To: "David S. Miller" , Jakub Kicinski , Jiri Pirko Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Moshe Shemesh Subject: [PATCH net-next 01/16] devlink: Change devlink_reload_supported() param type Date: Thu, 1 Oct 2020 16:59:04 +0300 Message-Id: <1601560759-11030-2-git-send-email-moshe@mellanox.com> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1601560759-11030-1-git-send-email-moshe@mellanox.com> References: <1601560759-11030-1-git-send-email-moshe@mellanox.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Change devlink_reload_supported() function to get devlink_ops pointer param instead of devlink pointer param. This change will be used in the next patch to check if devlink reload is supported before devlink instance is allocated. Signed-off-by: Moshe Shemesh --- RFCv5 -> v1: - New patch --- net/core/devlink.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/net/core/devlink.c b/net/core/devlink.c index 6f2863e717a9..722a9431ff60 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -2946,9 +2946,9 @@ static void devlink_reload_netns_change(struct devlink *devlink, DEVLINK_CMD_PARAM_NEW); } -static bool devlink_reload_supported(const struct devlink *devlink) +static bool devlink_reload_supported(const struct devlink_ops *ops) { - return devlink->ops->reload_down && devlink->ops->reload_up; + return ops->reload_down && ops->reload_up; } static void devlink_reload_failed_set(struct devlink *devlink, @@ -2992,7 +2992,7 @@ static int devlink_nl_cmd_reload(struct sk_buff *skb, struct genl_info *info) struct net *dest_net = NULL; int err; - if (!devlink_reload_supported(devlink)) + if (!devlink_reload_supported(devlink->ops)) return -EOPNOTSUPP; err = devlink_resources_validate(devlink, NULL, info); @@ -7516,7 +7516,7 @@ EXPORT_SYMBOL_GPL(devlink_register); void devlink_unregister(struct devlink *devlink) { mutex_lock(&devlink_mutex); - WARN_ON(devlink_reload_supported(devlink) && + WARN_ON(devlink_reload_supported(devlink->ops) && devlink->reload_enabled); devlink_notify(devlink, DEVLINK_CMD_DEL); list_del(&devlink->list); @@ -8553,7 +8553,7 @@ __devlink_param_driverinit_value_set(struct devlink *devlink, int devlink_param_driverinit_value_get(struct devlink *devlink, u32 param_id, union devlink_param_value *init_val) { - if (!devlink_reload_supported(devlink)) + if (!devlink_reload_supported(devlink->ops)) return -EOPNOTSUPP; return __devlink_param_driverinit_value_get(&devlink->param_list, @@ -8600,7 +8600,7 @@ int devlink_port_param_driverinit_value_get(struct devlink_port *devlink_port, { struct devlink *devlink = devlink_port->devlink; - if (!devlink_reload_supported(devlink)) + if (!devlink_reload_supported(devlink->ops)) return -EOPNOTSUPP; return __devlink_param_driverinit_value_get(&devlink_port->param_list, @@ -9733,7 +9733,7 @@ static void __net_exit devlink_pernet_pre_exit(struct net *net) mutex_lock(&devlink_mutex); list_for_each_entry(devlink, &devlink_list, list) { if (net_eq(devlink_net(devlink), net)) { - if (WARN_ON(!devlink_reload_supported(devlink))) + if (WARN_ON(!devlink_reload_supported(devlink->ops))) continue; err = devlink_reload(devlink, &init_net, NULL); if (err && err != -EOPNOTSUPP) -- 2.18.2