Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2925485pxk; Tue, 15 Sep 2020 06:06:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxv/Wyv9CRcUcKFUVjLbzvWwY6ePvqzpxmoqslyv0BQWML4jo0azgt83pivJn5l5xbqULp9 X-Received: by 2002:a17:906:bc47:: with SMTP id s7mr20777853ejv.354.1600175196079; Tue, 15 Sep 2020 06:06:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600175195; cv=none; d=google.com; s=arc-20160816; b=nGOFJyR72YxTMNGNztBJX9NW+qko4+BRsBNTV7F8UKARHH4LnRP/v0ZKv9Zqvw/g4P fNFGsB6vbCwHP49PtHRORtJ1jcWdVaTNE1iADsil9eI24j41CUbj0x1QWD22eaTfEv9S nLp+SfwseSw1znxApT9nPBlvyk6I5uvVfLgl3dePpMEOsstpnFxxP9TglZzgDKUV7oD6 56ecD6QS6r0q2zwG85+8PLH4+KMhBwv0WPUj+ExKaNKvmk22XwQF+FVlLRnbl3hdARUB VXXwcm36GPA7wMPAJYpsWkr2dac4TO1Gxi72RHVgtdb2BI8C8fwFZUXi2j0te/pd317g Wfzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=VctqagkNcjbrJLAhRhltgpx4bJ300HnnZqxTdWkgOJs=; b=A21jvm5ie8fH9xSuiQP5kTSmlgHlNi5zBbcjcT9VVZwf2F+WSESKn0AuCjGhbv3Tba JdqUEfhqWi7N2mO9/csHABkXpcB6n+Zo3o3jz2lDBLSvTrfmMEXW9XeMRAtT0dJkIzcb PUx52nPmv8bGGPbBM008XSaMNX4cv8foTl+TrA9rxI2ISN+uYLl4UQymoFpjhXQjZf2F 6CrHcXwpxUjvo6ONylAITQR3Ql+T71CdQ8YLQkoeGCHpeL4ofkVM+QR1wS/MjfXrQBzt DNwANyr6MZzaD8m64VcsTAhrQZJAMFE/RHgN7H0xXOY5ZQ5c6ba7LSxv2EwCnI2jkNRy +avA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=JS+uzVGM; 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=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u12si9365138ejj.566.2020.09.15.06.06.11; Tue, 15 Sep 2020 06:06:35 -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; dkim=pass header.i=@nvidia.com header.s=n1 header.b=JS+uzVGM; 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=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726508AbgIONCA (ORCPT + 99 others); Tue, 15 Sep 2020 09:02:00 -0400 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:7251 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726466AbgIOM5v (ORCPT ); Tue, 15 Sep 2020 08:57:51 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 15 Sep 2020 05:56:12 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 15 Sep 2020 05:57:00 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 15 Sep 2020 05:57:00 -0700 Received: from [10.21.180.184] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 15 Sep 2020 12:56:52 +0000 Subject: Re: [PATCH net-next RFC v4 01/15] devlink: Add reload action option to devlink reload command To: Jakub Kicinski , Moshe Shemesh CC: "David S. Miller" , Jiri Pirko , , References: <1600063682-17313-1-git-send-email-moshe@mellanox.com> <1600063682-17313-2-git-send-email-moshe@mellanox.com> <20200914143306.4ab0f4c1@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> From: Moshe Shemesh Message-ID: <777fd1b8-1262-160e-a711-31e5f6e2c37c@nvidia.com> Date: Tue, 15 Sep 2020 15:56:48 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20200914143306.4ab0f4c1@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1600174572; bh=VctqagkNcjbrJLAhRhltgpx4bJ300HnnZqxTdWkgOJs=; h=X-PGP-Universal:Subject:To:CC:References:From:Message-ID:Date: User-Agent:MIME-Version:In-Reply-To:Content-Type: Content-Transfer-Encoding:Content-Language:X-Originating-IP: X-ClientProxiedBy; b=JS+uzVGM+ALC/jHztpWxpR/WL7rspeb6ynvYifZCXUTwoUCDHQhdBRpn7brmu3aH1 MErIiLLtyxD+e3c2xskPc/LZ1txm6ktScbXutrqbklFsGkxmcWhcSOZKwjx26qnOS8 1GkhLDO34XcKsI++BjT35uk1rlIowpW8TA8FS30fOTFGZ7HDHy32INI9OmiVW3lWVN 1mRpPX1jVpWAgq+G27I3slsziD7fetJc3Zo0U1e+z+xpoi+b67raUgJARLD2FgNA7+ NZGpMmh7IK2GfhTdxYcPDX8rwFQ1tGbSbsfaNmKwqbRjNuE5xD13ddqBlzWVmLNYVL 4C39NmWEpFv1w== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/15/2020 12:33 AM, Jakub Kicinski wrote: > External email: Use caution opening links or attachments > > > On Mon, 14 Sep 2020 09:07:48 +0300 Moshe Shemesh wrote: >> @@ -3011,12 +3060,41 @@ static int devlink_nl_cmd_reload(struct sk_buff *skb, struct genl_info *info) >> return PTR_ERR(dest_net); >> } >> >> - err = devlink_reload(devlink, dest_net, info->extack); >> + if (info->attrs[DEVLINK_ATTR_RELOAD_ACTION]) >> + action = nla_get_u8(info->attrs[DEVLINK_ATTR_RELOAD_ACTION]); >> + else >> + action = DEVLINK_RELOAD_ACTION_DRIVER_REINIT; >> + >> + if (action == DEVLINK_RELOAD_ACTION_UNSPEC || action > DEVLINK_RELOAD_ACTION_MAX) { >> + NL_SET_ERR_MSG_MOD(info->extack, "Invalid reload action"); >> + return -EINVAL; >> + } else if (!devlink_reload_action_is_supported(devlink, action)) { >> + NL_SET_ERR_MSG_MOD(info->extack, "Requested reload action is not supported"); >> + return -EOPNOTSUPP; >> + } >> + >> + err = devlink_reload(devlink, dest_net, action, info->extack, &actions_performed); >> >> if (dest_net) >> put_net(dest_net); >> >> - return err; >> + if (err) >> + return err; >> + >> + WARN_ON(!actions_performed); >> + msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); >> + if (!msg) >> + return -ENOMEM; >> + >> + err = devlink_nl_reload_actions_performed_fill(msg, devlink, actions_performed, >> + DEVLINK_CMD_RELOAD, info->snd_portid, >> + info->snd_seq, 0); >> + if (err) { >> + nlmsg_free(msg); >> + return err; >> + } >> + >> + return genlmsg_reply(msg, info); > I think generating the reply may break existing users. Only generate > the reply if request contained DEVLINK_ATTR_RELOAD_ACTION (or any other > new attribute which existing users can't pass). OK, I can do that. But I update stats and generate devlink notification anyway, that should fine, right ?