From: "Aviad Krawczyk (A)" <aviad.krawczyk@huawei.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: <davem@davemloft.net>, <linux-kernel@vger.kernel.org>,
<netdev@vger.kernel.org>, <bc.y@huawei.com>,
<victor.gissin@huawei.com>, <zhaochen6@huawei.com>,
<tony.qu@huawei.com>
Subject: Re: [PATCH net 01/20] net/hinic: Initialize hw interface
Date: Thu, 13 Jul 2017 16:14:01 +0300 [thread overview]
Message-ID: <52493b35-c0d7-99ae-cecf-0a26d904a31e@huawei.com> (raw)
In-Reply-To: <20170712152933.GF2557@lunn.ch>
Hi Andrew,
Now is the merge window and we need to resubmit.
We will fix it when we will resubmit.
The version number was used for the ethtool information and module version and
will be removed.
devm_kzalloc - will be used for the allocation of the memory at initialization.
We used pr_ for messages that point on errors or information in module,
and dev_ for errors in device and netif_ for errors in network device operations.
netif_ will be used for network device ops and dev_ for the others.
Aviad
On 7/12/2017 6:29 PM, Andrew Lunn wrote:
>> +
>> +#define HINIC_DRV_NAME "HiNIC"
>> +#define HINIC_DRV_VERSION "1.0"
>
> Hi Aviad
>
> Please don't add a driver version. There was a discussion about this
> recently, how pointless it is.
>
>> +/**
>> + * hinic_init_hwdev - Initialize the NIC HW
>> + * @hwdev: the NIC HW device that is returned from the initialization
>> + * @pdev: the NIC pci device
>> + *
>> + * Return 0 - Success, negative - Failure
>> + *
>> + * Initialize the NIC HW device and return a pointer to it in the first arg
>> + **/
>> +int hinic_init_hwdev(struct hinic_hwdev **hwdev, struct pci_dev *pdev)
>> +{
>> + struct hinic_pfhwdev *pfhwdev;
>> + struct hinic_hwif *hwif;
>> + int err;
>> +
>> + hwif = kzalloc(sizeof(*hwif), GFP_KERNEL);
>
> Using the devm_ functions makes your cleanup code simpler when
> handling memory.
>
>> +/**
>> + * nic_dev_init - Initialize the NIC device
>> + * @pdev: the NIC pci device
>> + *
>> + * Return 0 - Success, negative - Failure
>> + **/
>> +static int nic_dev_init(struct pci_dev *pdev)
>> +{
>> + struct hinic_dev *nic_dev;
>> + struct net_device *netdev;
>> + struct hinic_hwdev *hwdev;
>> + int err, num_qps;
>> +
>> + err = hinic_init_hwdev(&hwdev, pdev);
>> + if (err) {
>> + dev_err(&pdev->dev, "Failed to initialize HW device\n");
>> + return err;
>> + }
>> +
>> + num_qps = hinic_hwdev_num_qps(hwdev);
>> + if (num_qps <= 0) {
>> + dev_err(&pdev->dev, "Invalid number of QPS\n");
>> + err = -EINVAL;
>> + goto num_qps_err;
>> + }
>> +
>> + netdev = alloc_etherdev_mq(sizeof(*nic_dev), num_qps);
>> + if (!netdev) {
>> + pr_err("Failed to allocate Ethernet device\n");
>
> Above you used dev_err, here you used pr_err(). Please be consistent.
>
>> + err = -ENOMEM;
>> + goto alloc_etherdev_err;
>> + }
>> +
>> + netdev->netdev_ops = &hinic_netdev_ops;
>> +
>> + nic_dev = (struct hinic_dev *)netdev_priv(netdev);
>> + nic_dev->hwdev = hwdev;
>> + nic_dev->netdev = netdev;
>> + nic_dev->msg_enable = MSG_ENABLE_DEFAULT;
>> +
>> + pci_set_drvdata(pdev, netdev);
>> +
>> + netif_carrier_off(netdev);
>> +
>> + err = register_netdev(netdev);
>> + if (err) {
>> + netif_err(nic_dev, probe, netdev, "Failed to register netdev\n");
>
> probably not a good idea to use netif_err, if register_netdev just
> failed. dev_err() would be better.
>
>
> .
>
next prev parent reply other threads:[~2017-07-13 13:14 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-12 14:17 [PATCH net 00/20] Huawei HiNIC Ethernet Driver Aviad Krawczyk
2017-07-12 14:17 ` [PATCH net 01/20] net/hinic: Initialize hw interface Aviad Krawczyk
2017-07-12 15:29 ` Andrew Lunn
2017-07-13 13:14 ` Aviad Krawczyk (A) [this message]
2017-07-12 14:17 ` [PATCH net 02/20] nic/hinic: Initialize hw device components Aviad Krawczyk
2017-07-12 15:34 ` Andrew Lunn
2017-07-12 14:17 ` [PATCH net 03/20] net/hinic: Initialize api cmd resources Aviad Krawczyk
2017-07-12 14:17 ` [PATCH net 04/20] net/hinic: Initialize api cmd hw Aviad Krawczyk
2017-07-12 14:17 ` [PATCH net 05/20] net/hinic: Add management messages Aviad Krawczyk
2017-07-12 14:17 ` [PATCH net 06/20] net/hinic: Add api cmd commands Aviad Krawczyk
2017-07-12 14:17 ` [PATCH net 07/20] net/hinic: Add aeqs Aviad Krawczyk
2017-07-12 14:17 ` [PATCH net 08/20] net/hinic: Add port management commands Aviad Krawczyk
2017-07-12 14:17 ` [PATCH net 09/20] net/hinic: Add Rx mode and link event handler Aviad Krawczyk
2017-07-12 14:17 ` [PATCH net 10/20] net/hinic: Add logical Txq and Rxq Aviad Krawczyk
2017-07-12 14:17 ` [PATCH net 11/20] net/hinic: Add wq Aviad Krawczyk
2017-07-12 14:17 ` [PATCH net 12/20] net/hinic: Add qp resources Aviad Krawczyk
2017-07-12 14:17 ` [PATCH net 13/20] net/hinic: Set qp context Aviad Krawczyk
2017-07-12 14:17 ` [PATCH net 14/20] net/hinic: Initialize cmdq Aviad Krawczyk
2017-07-12 14:17 ` [PATCH net 15/20] net/hinic: Add ceqs Aviad Krawczyk
2017-07-12 14:17 ` [PATCH net 16/20] net/hinic: Add cmdq commands Aviad Krawczyk
2017-07-12 14:17 ` [PATCH net 17/20] net/hinic: Add cmdq completion handler Aviad Krawczyk
2017-07-12 14:17 ` [PATCH net 18/20] net/hinic: Add Rx handler Aviad Krawczyk
2017-07-12 14:17 ` [PATCH net 19/20] net/hinic: Add Tx operation Aviad Krawczyk
2017-07-12 14:17 ` [PATCH net 20/20] net/hinic: Add ethtool and stats Aviad Krawczyk
2017-07-12 15:43 ` Andrew Lunn
2017-07-13 13:16 ` Aviad Krawczyk (A)
2017-07-12 15:10 ` [PATCH net 00/20] Huawei HiNIC Ethernet Driver David Miller
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=52493b35-c0d7-99ae-cecf-0a26d904a31e@huawei.com \
--to=aviad.krawczyk@huawei.com \
--cc=andrew@lunn.ch \
--cc=bc.y@huawei.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tony.qu@huawei.com \
--cc=victor.gissin@huawei.com \
--cc=zhaochen6@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®