From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C0B1C3A59E for ; Mon, 26 Aug 2019 05:36:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 48DA4217F4 for ; Mon, 26 Aug 2019 05:36:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729145AbfHZFgF (ORCPT ); Mon, 26 Aug 2019 01:36:05 -0400 Received: from shards.monkeyblade.net ([23.128.96.9]:58646 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727956AbfHZFgE (ORCPT ); Mon, 26 Aug 2019 01:36:04 -0400 Received: from localhost (unknown [IPv6:2601:601:9f80:35cd::d71]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 4D142151397A0; Sun, 25 Aug 2019 22:36:04 -0700 (PDT) Date: Sun, 25 Aug 2019 22:36:03 -0700 (PDT) Message-Id: <20190825.223603.2113058192469260500.davem@davemloft.net> To: michael.chan@broadcom.com Cc: netdev@vger.kernel.org, vasundhara-v.volam@broadcom.com, jiri@mellanox.com, ray.jui@broadcom.com Subject: Re: [PATCH net-next 03/14] bnxt_en: Refactor bnxt_sriov_enable(). From: David Miller In-Reply-To: <1566791705-20473-4-git-send-email-michael.chan@broadcom.com> References: <1566791705-20473-1-git-send-email-michael.chan@broadcom.com> <1566791705-20473-4-git-send-email-michael.chan@broadcom.com> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Sun, 25 Aug 2019 22:36:04 -0700 (PDT) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Michael Chan Date: Sun, 25 Aug 2019 23:54:54 -0400 > @@ -687,6 +687,32 @@ static int bnxt_func_cfg(struct bnxt *bp, int num_vfs) > return bnxt_hwrm_func_cfg(bp, num_vfs); > } > > +int bnxt_cfg_hw_sriov(struct bnxt *bp, int *num_vfs) > +{ > + int rc; > + > + /* Register buffers for VFs */ > + rc = bnxt_hwrm_func_buf_rgtr(bp); > + if (rc) > + return rc; > + > + /* Reserve resources for VFs */ > + rc = bnxt_func_cfg(bp, *num_vfs); > + if (rc != *num_vfs) { I notice that these two operations are reversed here from where they were in the bnxt_sriov_enable() function. Does the BUF_RGTR operation have to be undone if the bnxt_func_cfg() fails? When it's not a straight extraction of code into a helper function one really should do one of two things in my opinion: 1) Explain the differences in the commit message. 2) Do a straight extration in one commit, change the ordering in another.