Skip to content

Commit df69ba4

Browse files
emuslndavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7d5aa9a commit df69ba4

File tree

14 files changed

+272
-0
lines changed

14 files changed

+272
-0
lines changed

Documentation/networking/device_drivers/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Contents:
2323
intel/ice
2424
google/gve
2525
mellanox/mlx5
26+
pensando/ionic
2627

2728
.. only:: subproject
2829

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
.. SPDX-License-Identifier: GPL-2.0+
2+
3+
==========================================================
4+
Linux* Driver for the Pensando(R) Ethernet adapter family
5+
==========================================================
6+
7+
Pensando Linux Ethernet driver.
8+
Copyright(c) 2019 Pensando Systems, Inc
9+
10+
Contents
11+
========
12+
13+
- Identifying the Adapter
14+
- Support
15+
16+
Identifying the Adapter
17+
=======================
18+
19+
To find if one or more Pensando PCI Ethernet devices are installed on the
20+
host, check for the PCI devices::
21+
22+
$ lspci -d 1dd8:
23+
b5:00.0 Ethernet controller: Device 1dd8:1002
24+
b6:00.0 Ethernet controller: Device 1dd8:1002
25+
26+
If such devices are listed as above, then the ionic.ko driver should find
27+
and configure them for use. There should be log entries in the kernel
28+
messages such as these::
29+
30+
$ dmesg | grep ionic
31+
ionic Pensando Ethernet NIC Driver, ver 0.15.0-k
32+
ionic 0000:b5:00.0 enp181s0: renamed from eth0
33+
ionic 0000:b6:00.0 enp182s0: renamed from eth0
34+
35+
Support
36+
=======
37+
For general Linux networking support, please use the netdev mailing
38+
list, which is monitored by Pensando personnel::
39+
40+
41+
For more specific support needs, please use the Pensando driver support
42+
email::
43+

MAINTAINERS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12608,6 +12608,14 @@ L: [email protected]
1260812608
S: Maintained
1260912609
F: drivers/platform/x86/peaq-wmi.c
1261012610

12611+
PENSANDO ETHERNET DRIVERS
12612+
M: Shannon Nelson <[email protected]>
12613+
M: Pensando Drivers <[email protected]>
12614+
12615+
S: Supported
12616+
F: Documentation/networking/device_drivers/pensando/ionic.rst
12617+
F: drivers/net/ethernet/pensando/
12618+
1261112619
PER-CPU MEMORY ALLOCATOR
1261212620
M: Dennis Zhou <[email protected]>
1261312621
M: Tejun Heo <[email protected]>

drivers/net/ethernet/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ config ETHOC
168168

169169
source "drivers/net/ethernet/packetengines/Kconfig"
170170
source "drivers/net/ethernet/pasemi/Kconfig"
171+
source "drivers/net/ethernet/pensando/Kconfig"
171172
source "drivers/net/ethernet/qlogic/Kconfig"
172173
source "drivers/net/ethernet/qualcomm/Kconfig"
173174
source "drivers/net/ethernet/rdc/Kconfig"

drivers/net/ethernet/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,4 @@ obj-$(CONFIG_NET_VENDOR_WIZNET) += wiznet/
9797
obj-$(CONFIG_NET_VENDOR_XILINX) += xilinx/
9898
obj-$(CONFIG_NET_VENDOR_XIRCOM) += xircom/
9999
obj-$(CONFIG_NET_VENDOR_SYNOPSYS) += synopsys/
100+
obj-$(CONFIG_NET_VENDOR_PENSANDO) += pensando/

drivers/net/ethernet/pensando/Kconfig

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
# Copyright (c) 2019 Pensando Systems, Inc
3+
#
4+
# Pensando device configuration
5+
#
6+
7+
config NET_VENDOR_PENSANDO
8+
bool "Pensando devices"
9+
default y
10+
help
11+
If you have a network (Ethernet) card belonging to this class, say Y.
12+
13+
Note that the answer to this question doesn't directly affect the
14+
kernel: saying N will just cause the configurator to skip all
15+
the questions about Pensando cards. If you say Y, you will be asked
16+
for your specific card in the following questions.
17+
18+
if NET_VENDOR_PENSANDO
19+
20+
config IONIC
21+
tristate "Pensando Ethernet IONIC Support"
22+
depends on 64BIT && PCI
23+
help
24+
This enables the support for the Pensando family of Ethernet
25+
adapters. More specific information on this driver can be
26+
found in
27+
<file:Documentation/networking/device_drivers/pensando/ionic.rst>.
28+
29+
To compile this driver as a module, choose M here. The module
30+
will be called ionic.
31+
32+
endif # NET_VENDOR_PENSANDO
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
#
3+
# Makefile for the Pensando network device drivers.
4+
#
5+
6+
obj-$(CONFIG_IONIC) += ionic/
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
# Copyright(c) 2017 - 2019 Pensando Systems, Inc
3+
4+
obj-$(CONFIG_IONIC) := ionic.o
5+
6+
ionic-y := ionic_main.o ionic_bus_pci.o ionic_devlink.o
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */
3+
4+
#ifndef _IONIC_H_
5+
#define _IONIC_H_
6+
7+
#include "ionic_devlink.h"
8+
9+
#define IONIC_DRV_NAME "ionic"
10+
#define IONIC_DRV_DESCRIPTION "Pensando Ethernet NIC Driver"
11+
#define IONIC_DRV_VERSION "0.15.0-k"
12+
13+
#define PCI_VENDOR_ID_PENSANDO 0x1dd8
14+
15+
#define PCI_DEVICE_ID_PENSANDO_IONIC_ETH_PF 0x1002
16+
#define PCI_DEVICE_ID_PENSANDO_IONIC_ETH_VF 0x1003
17+
18+
#define IONIC_SUBDEV_ID_NAPLES_25 0x4000
19+
#define IONIC_SUBDEV_ID_NAPLES_100_4 0x4001
20+
#define IONIC_SUBDEV_ID_NAPLES_100_8 0x4002
21+
22+
struct ionic {
23+
struct pci_dev *pdev;
24+
struct device *dev;
25+
};
26+
27+
#endif /* _IONIC_H_ */
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */
3+
4+
#ifndef _IONIC_BUS_H_
5+
#define _IONIC_BUS_H_
6+
7+
int ionic_bus_register_driver(void);
8+
void ionic_bus_unregister_driver(void);
9+
10+
#endif /* _IONIC_BUS_H_ */
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */
3+
4+
#include <linux/module.h>
5+
#include <linux/netdevice.h>
6+
#include <linux/etherdevice.h>
7+
#include <linux/pci.h>
8+
9+
#include "ionic.h"
10+
#include "ionic_bus.h"
11+
12+
/* Supported devices */
13+
static const struct pci_device_id ionic_id_table[] = {
14+
{ PCI_VDEVICE(PENSANDO, PCI_DEVICE_ID_PENSANDO_IONIC_ETH_PF) },
15+
{ PCI_VDEVICE(PENSANDO, PCI_DEVICE_ID_PENSANDO_IONIC_ETH_VF) },
16+
{ 0, } /* end of table */
17+
};
18+
MODULE_DEVICE_TABLE(pci, ionic_id_table);
19+
20+
static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
21+
{
22+
struct device *dev = &pdev->dev;
23+
struct ionic *ionic;
24+
25+
ionic = ionic_devlink_alloc(dev);
26+
if (!ionic)
27+
return -ENOMEM;
28+
29+
ionic->pdev = pdev;
30+
ionic->dev = dev;
31+
pci_set_drvdata(pdev, ionic);
32+
33+
return 0;
34+
}
35+
36+
static void ionic_remove(struct pci_dev *pdev)
37+
{
38+
struct ionic *ionic = pci_get_drvdata(pdev);
39+
40+
ionic_devlink_free(ionic);
41+
}
42+
43+
static struct pci_driver ionic_driver = {
44+
.name = IONIC_DRV_NAME,
45+
.id_table = ionic_id_table,
46+
.probe = ionic_probe,
47+
.remove = ionic_remove,
48+
};
49+
50+
int ionic_bus_register_driver(void)
51+
{
52+
return pci_register_driver(&ionic_driver);
53+
}
54+
55+
void ionic_bus_unregister_driver(void)
56+
{
57+
pci_unregister_driver(&ionic_driver);
58+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */
3+
4+
#include <linux/module.h>
5+
#include <linux/netdevice.h>
6+
7+
#include "ionic.h"
8+
#include "ionic_bus.h"
9+
#include "ionic_devlink.h"
10+
11+
static int ionic_dl_info_get(struct devlink *dl, struct devlink_info_req *req,
12+
struct netlink_ext_ack *extack)
13+
{
14+
return devlink_info_driver_name_put(req, IONIC_DRV_NAME);
15+
}
16+
17+
static const struct devlink_ops ionic_dl_ops = {
18+
.info_get = ionic_dl_info_get,
19+
};
20+
21+
struct ionic *ionic_devlink_alloc(struct device *dev)
22+
{
23+
struct devlink *dl;
24+
25+
dl = devlink_alloc(&ionic_dl_ops, sizeof(struct ionic));
26+
27+
return devlink_priv(dl);
28+
}
29+
30+
void ionic_devlink_free(struct ionic *ionic)
31+
{
32+
struct devlink *dl = priv_to_devlink(ionic);
33+
34+
devlink_free(dl);
35+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */
3+
4+
#ifndef _IONIC_DEVLINK_H_
5+
#define _IONIC_DEVLINK_H_
6+
7+
#include <net/devlink.h>
8+
9+
struct ionic *ionic_devlink_alloc(struct device *dev);
10+
void ionic_devlink_free(struct ionic *ionic);
11+
12+
#endif /* _IONIC_DEVLINK_H_ */
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */
3+
4+
#include <linux/module.h>
5+
#include <linux/version.h>
6+
#include <linux/netdevice.h>
7+
#include <linux/utsname.h>
8+
9+
#include "ionic.h"
10+
#include "ionic_bus.h"
11+
12+
MODULE_DESCRIPTION(IONIC_DRV_DESCRIPTION);
13+
MODULE_AUTHOR("Pensando Systems, Inc");
14+
MODULE_LICENSE("GPL");
15+
MODULE_VERSION(IONIC_DRV_VERSION);
16+
17+
static int __init ionic_init_module(void)
18+
{
19+
pr_info("%s %s, ver %s\n",
20+
IONIC_DRV_NAME, IONIC_DRV_DESCRIPTION, IONIC_DRV_VERSION);
21+
return ionic_bus_register_driver();
22+
}
23+
24+
static void __exit ionic_cleanup_module(void)
25+
{
26+
ionic_bus_unregister_driver();
27+
28+
pr_info("%s removed\n", IONIC_DRV_NAME);
29+
}
30+
31+
module_init(ionic_init_module);
32+
module_exit(ionic_cleanup_module);

0 commit comments

Comments
 (0)