mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "luobin (L)" <luobin9@huawei.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: <davem@davemloft.net>, <linux-kernel@vger.kernel.org>,
	<netdev@vger.kernel.org>, <luoxianjun@huawei.com>,
	<yin.yinshi@huawei.com>, <cloud.wangxiaoyun@huawei.com>,
	<chiqijun@huawei.com>
Subject: Re: [PATCH net-next v2] hinic: add firmware update support
Date: Wed, 15 Jul 2020 09:00:44 +0800	[thread overview]
Message-ID: <0025d09b-589e-a68e-7e17-a3c5558e0565@huawei.com> (raw)
In-Reply-To: <20200714113711.32107a16@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>

On 2020/7/15 2:37, Jakub Kicinski wrote:
> On Tue, 14 Jul 2020 20:54:33 +0800 Luo bin wrote:
>> add support to update firmware by the devlink flashing API
>>
>> Signed-off-by: Luo bin <luobin9@huawei.com>
> 
> Minor nits below, otherwise I think this looks good.
> 
>> +static int hinic_firmware_update(struct hinic_devlink_priv *priv,
>> +				 const struct firmware *fw)
>> +{
>> +	struct host_image_st host_image;
>> +	int err;
>> +
>> +	memset(&host_image, 0, sizeof(struct host_image_st));
>> +
>> +	if (!check_image_valid(priv, fw->data, fw->size, &host_image) ||
>> +	    !check_image_integrity(priv, &host_image, FW_UPDATE_COLD) ||
>> +	    !check_image_device_type(priv, host_image.device_id))
> 
> These helpers should also set an appropriate message in extack, so the
> user can see it on the command line / inside their application.
> 
>> +		return -EINVAL;
>> +
>> +	dev_info(&priv->hwdev->hwif->pdev->dev, "Flash firmware begin\n");
>> +
>> +	err = hinic_flash_fw(priv, fw->data, &host_image);
>> +	if (err) {
>> +		if (err == HINIC_FW_DISMATCH_ERROR)
>> +			dev_err(&priv->hwdev->hwif->pdev->dev, "Firmware image doesn't match this card, please use newer image, err: %d\n",
> 
> Here as well - please make sure to return an error messages through
> extack.
> 
>> +				err);
>> +		else
>> +			dev_err(&priv->hwdev->hwif->pdev->dev, "Send firmware image data failed, err: %d\n",
>> +				err);
>> +		return err;
>> +	}
>> +
>> +	dev_info(&priv->hwdev->hwif->pdev->dev, "Flash firmware end\n");
>> +
>> +	return 0;
>> +}
> 
>> @@ -1086,6 +1090,17 @@ static int nic_dev_init(struct pci_dev *pdev)
>>  		return PTR_ERR(hwdev);
>>  	}
>>  
>> +	devlink = hinic_devlink_alloc();
>> +	if (!devlink) {
>> +		dev_err(&pdev->dev, "Hinic devlink alloc failed\n");
>> +		err = -ENOMEM;
>> +		goto err_devlink_alloc;
>> +	}
>> +
>> +	priv = devlink_priv(devlink);
>> +	priv->hwdev = hwdev;
>> +	priv->devlink = devlink;
> 
> No need to remember the devlink pointer here, you can use
> priv_to_devlink(priv) to go from priv to devlink.
> 
>> +
>>  	num_qps = hinic_hwdev_num_qps(hwdev);
>>  	if (num_qps <= 0) {
>>  		dev_err(&pdev->dev, "Invalid number of QPS\n");
> .
> 
Will fix all. Thanks for your review.

      reply	other threads:[~2020-07-15  1:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-14 12:54 Luo bin
2020-07-14 18:37 ` Jakub Kicinski
2020-07-15  1:00   ` luobin (L) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0025d09b-589e-a68e-7e17-a3c5558e0565@huawei.com \
    --to=luobin9@huawei.com \
    --cc=chiqijun@huawei.com \
    --cc=cloud.wangxiaoyun@huawei.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luoxianjun@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=yin.yinshi@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®