-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ionic: Add basic framework for IONIC Network device driver
This patch adds a basic driver framework for the Pensando IONIC network device. There is no functionality right now other than the ability to load and unload. Signed-off-by: Shannon Nelson <snelson@pensando.io> Signed-off-by: David S. Miller <davem@davemloft.net>
- Loading branch information
Shannon Nelson
authored and
David S. Miller
committed
Sep 5, 2019
1 parent
7d5aa9a
commit df69ba4
Showing
14 changed files
with
272 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ Contents: | |
intel/ice | ||
google/gve | ||
mellanox/mlx5 | ||
pensando/ionic | ||
|
||
.. only:: subproject | ||
|
||
|
43 changes: 43 additions & 0 deletions
43
Documentation/networking/device_drivers/pensando/ionic.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
.. SPDX-License-Identifier: GPL-2.0+ | ||
========================================================== | ||
Linux* Driver for the Pensando(R) Ethernet adapter family | ||
========================================================== | ||
|
||
Pensando Linux Ethernet driver. | ||
Copyright(c) 2019 Pensando Systems, Inc | ||
|
||
Contents | ||
======== | ||
|
||
- Identifying the Adapter | ||
- Support | ||
|
||
Identifying the Adapter | ||
======================= | ||
|
||
To find if one or more Pensando PCI Ethernet devices are installed on the | ||
host, check for the PCI devices:: | ||
|
||
$ lspci -d 1dd8: | ||
b5:00.0 Ethernet controller: Device 1dd8:1002 | ||
b6:00.0 Ethernet controller: Device 1dd8:1002 | ||
|
||
If such devices are listed as above, then the ionic.ko driver should find | ||
and configure them for use. There should be log entries in the kernel | ||
messages such as these:: | ||
|
||
$ dmesg | grep ionic | ||
ionic Pensando Ethernet NIC Driver, ver 0.15.0-k | ||
ionic 0000:b5:00.0 enp181s0: renamed from eth0 | ||
ionic 0000:b6:00.0 enp182s0: renamed from eth0 | ||
|
||
Support | ||
======= | ||
For general Linux networking support, please use the netdev mailing | ||
list, which is monitored by Pensando personnel:: | ||
netdev@vger.kernel.org | ||
|
||
For more specific support needs, please use the Pensando driver support | ||
email:: | ||
drivers@pensando.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# SPDX-License-Identifier: GPL-2.0 | ||
# Copyright (c) 2019 Pensando Systems, Inc | ||
# | ||
# Pensando device configuration | ||
# | ||
|
||
config NET_VENDOR_PENSANDO | ||
bool "Pensando devices" | ||
default y | ||
help | ||
If you have a network (Ethernet) card belonging to this class, say Y. | ||
|
||
Note that the answer to this question doesn't directly affect the | ||
kernel: saying N will just cause the configurator to skip all | ||
the questions about Pensando cards. If you say Y, you will be asked | ||
for your specific card in the following questions. | ||
|
||
if NET_VENDOR_PENSANDO | ||
|
||
config IONIC | ||
tristate "Pensando Ethernet IONIC Support" | ||
depends on 64BIT && PCI | ||
help | ||
This enables the support for the Pensando family of Ethernet | ||
adapters. More specific information on this driver can be | ||
found in | ||
<file:Documentation/networking/device_drivers/pensando/ionic.rst>. | ||
|
||
To compile this driver as a module, choose M here. The module | ||
will be called ionic. | ||
|
||
endif # NET_VENDOR_PENSANDO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# SPDX-License-Identifier: GPL-2.0 | ||
# | ||
# Makefile for the Pensando network device drivers. | ||
# | ||
|
||
obj-$(CONFIG_IONIC) += ionic/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# SPDX-License-Identifier: GPL-2.0 | ||
# Copyright(c) 2017 - 2019 Pensando Systems, Inc | ||
|
||
obj-$(CONFIG_IONIC) := ionic.o | ||
|
||
ionic-y := ionic_main.o ionic_bus_pci.o ionic_devlink.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */ | ||
|
||
#ifndef _IONIC_H_ | ||
#define _IONIC_H_ | ||
|
||
#include "ionic_devlink.h" | ||
|
||
#define IONIC_DRV_NAME "ionic" | ||
#define IONIC_DRV_DESCRIPTION "Pensando Ethernet NIC Driver" | ||
#define IONIC_DRV_VERSION "0.15.0-k" | ||
|
||
#define PCI_VENDOR_ID_PENSANDO 0x1dd8 | ||
|
||
#define PCI_DEVICE_ID_PENSANDO_IONIC_ETH_PF 0x1002 | ||
#define PCI_DEVICE_ID_PENSANDO_IONIC_ETH_VF 0x1003 | ||
|
||
#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_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// 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) }, | ||
{ 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 = ionic_devlink_alloc(dev); | ||
if (!ionic) | ||
return -ENOMEM; | ||
|
||
ionic->pdev = pdev; | ||
ionic->dev = dev; | ||
pci_set_drvdata(pdev, ionic); | ||
|
||
return 0; | ||
} | ||
|
||
static void ionic_remove(struct pci_dev *pdev) | ||
{ | ||
struct ionic *ionic = pci_get_drvdata(pdev); | ||
|
||
ionic_devlink_free(ionic); | ||
} | ||
|
||
static struct pci_driver ionic_driver = { | ||
.name = IONIC_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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */ | ||
|
||
#include <linux/module.h> | ||
#include <linux/netdevice.h> | ||
|
||
#include "ionic.h" | ||
#include "ionic_bus.h" | ||
#include "ionic_devlink.h" | ||
|
||
static int ionic_dl_info_get(struct devlink *dl, struct devlink_info_req *req, | ||
struct netlink_ext_ack *extack) | ||
{ | ||
return devlink_info_driver_name_put(req, IONIC_DRV_NAME); | ||
} | ||
|
||
static const struct devlink_ops ionic_dl_ops = { | ||
.info_get = ionic_dl_info_get, | ||
}; | ||
|
||
struct ionic *ionic_devlink_alloc(struct device *dev) | ||
{ | ||
struct devlink *dl; | ||
|
||
dl = devlink_alloc(&ionic_dl_ops, sizeof(struct ionic)); | ||
|
||
return devlink_priv(dl); | ||
} | ||
|
||
void ionic_devlink_free(struct ionic *ionic) | ||
{ | ||
struct devlink *dl = priv_to_devlink(ionic); | ||
|
||
devlink_free(dl); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */ | ||
|
||
#ifndef _IONIC_DEVLINK_H_ | ||
#define _IONIC_DEVLINK_H_ | ||
|
||
#include <net/devlink.h> | ||
|
||
struct ionic *ionic_devlink_alloc(struct device *dev); | ||
void ionic_devlink_free(struct ionic *ionic); | ||
|
||
#endif /* _IONIC_DEVLINK_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */ | ||
|
||
#include <linux/module.h> | ||
#include <linux/version.h> | ||
#include <linux/netdevice.h> | ||
#include <linux/utsname.h> | ||
|
||
#include "ionic.h" | ||
#include "ionic_bus.h" | ||
|
||
MODULE_DESCRIPTION(IONIC_DRV_DESCRIPTION); | ||
MODULE_AUTHOR("Pensando Systems, Inc"); | ||
MODULE_LICENSE("GPL"); | ||
MODULE_VERSION(IONIC_DRV_VERSION); | ||
|
||
static int __init ionic_init_module(void) | ||
{ | ||
pr_info("%s %s, ver %s\n", | ||
IONIC_DRV_NAME, IONIC_DRV_DESCRIPTION, IONIC_DRV_VERSION); | ||
return ionic_bus_register_driver(); | ||
} | ||
|
||
static void __exit ionic_cleanup_module(void) | ||
{ | ||
ionic_bus_unregister_driver(); | ||
|
||
pr_info("%s removed\n", IONIC_DRV_NAME); | ||
} | ||
|
||
module_init(ionic_init_module); | ||
module_exit(ionic_cleanup_module); |