netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shannon Nelson <snelson@pensando.io>
To: Andrew Lunn <andrew@lunn.ch>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net-next 01/18] ionic: Add basic framework for IONIC Network device driver
Date: Fri, 21 Jun 2019 15:13:31 -0700	[thread overview]
Message-ID: <7f1fcda2-dce4-feb6-ec3a-c54bfb691e5d@pensando.io> (raw)
In-Reply-To: <20190620212447.GJ31306@lunn.ch>

On 6/20/19 2:24 PM, Andrew Lunn wrote:

Hi Andrew, thanks for your time and comments.  Responses below...

>> +++ b/drivers/net/ethernet/pensando/ionic/ionic.h
>> @@ -0,0 +1,27 @@
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */
>> +
>> +#ifndef _IONIC_H_
>> +#define _IONIC_H_
>> +
>> +#define DRV_NAME		"ionic"
>> +#define DRV_DESCRIPTION		"Pensando Ethernet NIC Driver"
>> +#define DRV_VERSION		"0.11.0-k"
> DRV_VERSION is pretty useless. What you really want to know is the
> kernel git tree and commit. The big distributions might backport this
> version of the driver back to the old kernel with a million
> patches. At which point 0.11.0-k tells you nothing much.
Yes, any version numbering thing from the big distros is put into 
question, but I find this number useful to me for tracking what has been 
put into the upstream kernel.  This plus the full kernel version gives 
me a pretty good idea of what I'm looking at.

>> +
>> +// TODO: register these with the official include/linux/pci_ids.h
>> +#define PCI_VENDOR_ID_PENSANDO			0x1dd8
> That file has a comment:
>
>   *      Do not add new entries to this file unless the definitions
>   *      are shared between multiple drivers.
>
> Is it going to be shared?

Yes, there is an instance of sharing planned.

>
>   +
>> +#define PCI_DEVICE_ID_PENSANDO_IONIC_ETH_PF	0x1002
>> +#define PCI_DEVICE_ID_PENSANDO_IONIC_ETH_VF	0x1003
>> +#define PCI_DEVICE_ID_PENSANDO_IONIC_ETH_MGMT	0x1004
>> +
>> +#define IONIC_SUBDEV_ID_NAPLES_25	0x4000
>> +#define IONIC_SUBDEV_ID_NAPLES_100_4	0x4001
>> +#define IONIC_SUBDEV_ID_NAPLES_100_8	0x4002
>> +
>> +struct ionic {
>> +	struct pci_dev *pdev;
>> +	struct device *dev;
>> +};
>> +
>> +#endif /* _IONIC_H_ */
>> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_bus.h b/drivers/net/ethernet/pensando/ionic/ionic_bus.h
>> new file mode 100644
>> index 000000000000..94ba0afc6f38
>> --- /dev/null
>> +++ b/drivers/net/ethernet/pensando/ionic/ionic_bus.h
>> @@ -0,0 +1,10 @@
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */
>> +
>> +#ifndef _IONIC_BUS_H_
>> +#define _IONIC_BUS_H_
>> +
>> +int ionic_bus_register_driver(void);
>> +void ionic_bus_unregister_driver(void);
>> +
>> +#endif /* _IONIC_BUS_H_ */
>> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
>> new file mode 100644
>> index 000000000000..ab6206c162d4
>> --- /dev/null
>> +++ b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
>> @@ -0,0 +1,61 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */
>> +
>> +#include <linux/module.h>
>> +#include <linux/netdevice.h>
>> +#include <linux/etherdevice.h>
>> +#include <linux/pci.h>
>> +
>> +#include "ionic.h"
>> +#include "ionic_bus.h"
>> +
>> +/* Supported devices */
>> +static const struct pci_device_id ionic_id_table[] = {
>> +	{ PCI_VDEVICE(PENSANDO, PCI_DEVICE_ID_PENSANDO_IONIC_ETH_PF) },
>> +	{ PCI_VDEVICE(PENSANDO, PCI_DEVICE_ID_PENSANDO_IONIC_ETH_VF) },
>> +	{ PCI_VDEVICE(PENSANDO, PCI_DEVICE_ID_PENSANDO_IONIC_ETH_MGMT) },
>> +	{ 0, }	/* end of table */
>> +};
>> +MODULE_DEVICE_TABLE(pci, ionic_id_table);
>> +
>> +static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>> +{
>> +	struct device *dev = &pdev->dev;
>> +	struct ionic *ionic;
>> +
>> +	ionic = devm_kzalloc(dev, sizeof(*ionic), GFP_KERNEL);
>> +	if (!ionic)
>> +		return -ENOMEM;
>> +
>> +	ionic->pdev = pdev;
>> +	pci_set_drvdata(pdev, ionic);
>> +	ionic->dev = dev;
>> +	dev_info(ionic->dev, "attached\n");
> probed would be more accurate. But in general, please avoid all but
> the minimum of such info messages.
Sure
>
>> +
>> +	return 0;
>> +}
>> +
>> +static void ionic_remove(struct pci_dev *pdev)
>> +{
>> +	struct ionic *ionic = pci_get_drvdata(pdev);
>> +
>> +	pci_set_drvdata(pdev, NULL);
>> +	dev_info(ionic->dev, "removed\n");
> Not very useful dev_info().
It has been useful in testing, but it can go away.
>
> Also, i think the core will NULL out the drive data for you. But you
> should check.
I'll check.
>> +}
>> +
>> +static struct pci_driver ionic_driver = {
>> +	.name = DRV_NAME,
>> +	.id_table = ionic_id_table,
>> +	.probe = ionic_probe,
>> +	.remove = ionic_remove,
>> +};
>> +
>> +int ionic_bus_register_driver(void)
>> +{
>> +	return pci_register_driver(&ionic_driver);
>> +}
>> +
>> +void ionic_bus_unregister_driver(void)
>> +{
>> +	pci_unregister_driver(&ionic_driver);
>> +}
> It looks like you can use module_pci_driver() and remove a lot of
> boilerplate.
Thanks, I'll look at that.

Cheers,
sln
>
> 	Andrew


  reply	other threads:[~2019-06-21 22:13 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-20 20:24 [PATCH net-next 00/18] Add ionic driver Shannon Nelson
2019-06-20 20:24 ` [PATCH net-next 01/18] ionic: Add basic framework for IONIC Network device driver Shannon Nelson
2019-06-20 21:24   ` Andrew Lunn
2019-06-21 22:13     ` Shannon Nelson [this message]
2019-06-24 20:07       ` Jakub Kicinski
2019-06-24 21:54         ` Shannon Nelson
2019-06-24 20:03   ` Jakub Kicinski
2019-06-24 21:46     ` Shannon Nelson
2019-06-20 20:24 ` [PATCH net-next 02/18] ionic: Add hardware init and device commands Shannon Nelson
2019-06-20 21:54   ` Andrew Lunn
2019-06-21 22:22     ` Shannon Nelson
2019-06-24 20:13       ` Jakub Kicinski
2019-06-24 21:50         ` Shannon Nelson
2019-06-21  9:27   ` kbuild test robot
2019-06-21  9:27   ` [PATCH] ionic: fix simple_open.cocci warnings kbuild test robot
2019-06-21 15:42     ` Shannon Nelson
2019-06-21 13:03   ` [PATCH net-next 02/18] ionic: Add hardware init and device commands kbuild test robot
2019-06-24 20:53   ` Jakub Kicinski
2019-06-24 22:29     ` Shannon Nelson
2019-06-20 20:24 ` [PATCH net-next 03/18] ionic: Add port management commands Shannon Nelson
2019-06-20 20:24 ` [PATCH net-next 04/18] ionic: Add basic lif support Shannon Nelson
2019-06-20 20:24 ` [PATCH net-next 05/18] ionic: Add interrupts and doorbells Shannon Nelson
2019-06-20 20:24 ` [PATCH net-next 06/18] ionic: Add basic adminq support Shannon Nelson
2019-06-21  6:03   ` kbuild test robot
2019-06-20 20:24 ` [PATCH net-next 07/18] ionic: Add adminq action Shannon Nelson
2019-06-20 20:24 ` [PATCH net-next 08/18] ionic: Add notifyq support Shannon Nelson
2019-06-25 23:21   ` Jakub Kicinski
2019-06-26 15:26     ` Shannon Nelson
2019-06-20 20:24 ` [PATCH net-next 09/18] ionic: Add the basic NDO callbacks for netdev support Shannon Nelson
2019-06-25 23:27   ` Jakub Kicinski
2019-06-26 15:41     ` Shannon Nelson
2019-06-20 20:24 ` [PATCH net-next 10/18] ionic: Add management of rx filters Shannon Nelson
2019-06-25 23:37   ` Jakub Kicinski
2019-06-26 15:52     ` Shannon Nelson
2019-06-27 15:59       ` Shannon Nelson
2019-06-20 20:24 ` [PATCH net-next 11/18] ionic: Add Rx filter and rx_mode nod support Shannon Nelson
2019-06-21 10:30   ` kbuild test robot
2019-06-21 10:30   ` [PATCH] ionic: fix semicolon.cocci warnings kbuild test robot
2019-06-21 15:43     ` Shannon Nelson
2019-06-25 23:44   ` [PATCH net-next 11/18] ionic: Add Rx filter and rx_mode nod support Jakub Kicinski
2019-06-26 15:53     ` Shannon Nelson
2019-06-20 20:24 ` [PATCH net-next 12/18] ionic: Add async link status check and basic stats Shannon Nelson
2019-06-25 23:47   ` Jakub Kicinski
2019-06-26 15:54     ` Shannon Nelson
2019-06-20 20:24 ` [PATCH net-next 13/18] ionic: Add initial ethtool support Shannon Nelson
2019-06-21  2:32   ` Michal Kubecek
2019-06-21 22:30     ` Shannon Nelson
2019-06-24  7:26       ` Michal Kubecek
2019-06-24 21:44         ` Shannon Nelson
2019-06-25 23:54   ` Jakub Kicinski
2019-06-26 16:07     ` Shannon Nelson
2019-06-26 16:18       ` Jakub Kicinski
2019-06-20 20:24 ` [PATCH net-next 14/18] ionic: Add Tx and Rx handling Shannon Nelson
2019-06-26  0:08   ` Jakub Kicinski
2019-06-26 16:49     ` Shannon Nelson
2019-06-20 20:24 ` [PATCH net-next 15/18] ionic: Add netdev-event handling Shannon Nelson
2019-06-20 20:24 ` [PATCH net-next 16/18] ionic: Add driver stats Shannon Nelson
2019-06-20 20:24 ` [PATCH net-next 17/18] ionic: Add RSS support Shannon Nelson
2019-06-26  0:20   ` Jakub Kicinski
2019-06-26 17:04     ` Shannon Nelson
2019-06-20 20:24 ` [PATCH net-next 18/18] ionic: Add coalesce and other features Shannon Nelson
2019-06-24 20:19 ` [PATCH net-next 00/18] Add ionic driver Jakub Kicinski
2019-06-24 21:53   ` 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=7f1fcda2-dce4-feb6-ec3a-c54bfb691e5d@pensando.io \
    --to=snelson@pensando.io \
    --cc=andrew@lunn.ch \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).