spectrum.c (1bac938141eea1fb5ef722d1d81ad440b3989ed3) | spectrum.c (1d20d23c59c93a8b381063ef9785564018ad4c3a) |
---|---|
1/* 2 * drivers/net/ethernet/mellanox/mlxsw/spectrum.c 3 * Copyright (c) 2015 Mellanox Technologies. All rights reserved. 4 * Copyright (c) 2015 Jiri Pirko <jiri@mellanox.com> 5 * Copyright (c) 2015 Ido Schimmel <idosch@mellanox.com> 6 * Copyright (c) 2015 Elad Raz <eladr@mellanox.com> 7 * 8 * Redistribution and use in source and binary forms, with or without --- 23 unchanged lines hidden (view full) --- 32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 * POSSIBILITY OF SUCH DAMAGE. 35 */ 36 37#include <linux/kernel.h> 38#include <linux/module.h> 39#include <linux/types.h> | 1/* 2 * drivers/net/ethernet/mellanox/mlxsw/spectrum.c 3 * Copyright (c) 2015 Mellanox Technologies. All rights reserved. 4 * Copyright (c) 2015 Jiri Pirko <jiri@mellanox.com> 5 * Copyright (c) 2015 Ido Schimmel <idosch@mellanox.com> 6 * Copyright (c) 2015 Elad Raz <eladr@mellanox.com> 7 * 8 * Redistribution and use in source and binary forms, with or without --- 23 unchanged lines hidden (view full) --- 32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 * POSSIBILITY OF SUCH DAMAGE. 35 */ 36 37#include <linux/kernel.h> 38#include <linux/module.h> 39#include <linux/types.h> |
40#include <linux/pci.h> |
|
40#include <linux/netdevice.h> 41#include <linux/etherdevice.h> 42#include <linux/ethtool.h> 43#include <linux/slab.h> 44#include <linux/device.h> 45#include <linux/skbuff.h> 46#include <linux/if_vlan.h> 47#include <linux/if_bridge.h> --- 6 unchanged lines hidden (view full) --- 54#include <linux/inetdevice.h> 55#include <net/switchdev.h> 56#include <generated/utsrelease.h> 57#include <net/pkt_cls.h> 58#include <net/tc_act/tc_mirred.h> 59#include <net/netevent.h> 60 61#include "spectrum.h" | 41#include <linux/netdevice.h> 42#include <linux/etherdevice.h> 43#include <linux/ethtool.h> 44#include <linux/slab.h> 45#include <linux/device.h> 46#include <linux/skbuff.h> 47#include <linux/if_vlan.h> 48#include <linux/if_bridge.h> --- 6 unchanged lines hidden (view full) --- 55#include <linux/inetdevice.h> 56#include <net/switchdev.h> 57#include <generated/utsrelease.h> 58#include <net/pkt_cls.h> 59#include <net/tc_act/tc_mirred.h> 60#include <net/netevent.h> 61 62#include "spectrum.h" |
63#include "pci.h" |
|
62#include "core.h" 63#include "reg.h" 64#include "port.h" 65#include "trap.h" 66#include "txheader.h" 67 68static const char mlxsw_sp_driver_name[] = "mlxsw_spectrum"; 69static const char mlxsw_sp_driver_version[] = "1.0"; --- 2991 unchanged lines hidden (view full) --- 3061 .used_type = 1, 3062 .type = MLXSW_PORT_SWID_TYPE_ETH, 3063 } 3064 }, 3065 .resource_query_enable = 1, 3066}; 3067 3068static struct mlxsw_driver mlxsw_sp_driver = { | 64#include "core.h" 65#include "reg.h" 66#include "port.h" 67#include "trap.h" 68#include "txheader.h" 69 70static const char mlxsw_sp_driver_name[] = "mlxsw_spectrum"; 71static const char mlxsw_sp_driver_version[] = "1.0"; --- 2991 unchanged lines hidden (view full) --- 3063 .used_type = 1, 3064 .type = MLXSW_PORT_SWID_TYPE_ETH, 3065 } 3066 }, 3067 .resource_query_enable = 1, 3068}; 3069 3070static struct mlxsw_driver mlxsw_sp_driver = { |
3069 .kind = MLXSW_DEVICE_KIND_SPECTRUM, 3070 .owner = THIS_MODULE, | 3071 .kind = mlxsw_sp_driver_name, |
3071 .priv_size = sizeof(struct mlxsw_sp), 3072 .init = mlxsw_sp_init, 3073 .fini = mlxsw_sp_fini, 3074 .port_split = mlxsw_sp_port_split, 3075 .port_unsplit = mlxsw_sp_port_unsplit, 3076 .sb_pool_get = mlxsw_sp_sb_pool_get, 3077 .sb_pool_set = mlxsw_sp_sb_pool_set, 3078 .sb_port_pool_get = mlxsw_sp_sb_port_pool_get, --- 1578 unchanged lines hidden (view full) --- 4657 .notifier_call = mlxsw_sp_inetaddr_event, 4658 .priority = 10, /* Must be called before FIB notifier block */ 4659}; 4660 4661static struct notifier_block mlxsw_sp_router_netevent_nb __read_mostly = { 4662 .notifier_call = mlxsw_sp_router_netevent_event, 4663}; 4664 | 3072 .priv_size = sizeof(struct mlxsw_sp), 3073 .init = mlxsw_sp_init, 3074 .fini = mlxsw_sp_fini, 3075 .port_split = mlxsw_sp_port_split, 3076 .port_unsplit = mlxsw_sp_port_unsplit, 3077 .sb_pool_get = mlxsw_sp_sb_pool_get, 3078 .sb_pool_set = mlxsw_sp_sb_pool_set, 3079 .sb_port_pool_get = mlxsw_sp_sb_port_pool_get, --- 1578 unchanged lines hidden (view full) --- 4658 .notifier_call = mlxsw_sp_inetaddr_event, 4659 .priority = 10, /* Must be called before FIB notifier block */ 4660}; 4661 4662static struct notifier_block mlxsw_sp_router_netevent_nb __read_mostly = { 4663 .notifier_call = mlxsw_sp_router_netevent_event, 4664}; 4665 |
4666static const struct pci_device_id mlxsw_sp_pci_id_table[] = { 4667 {PCI_VDEVICE(MELLANOX, PCI_DEVICE_ID_MELLANOX_SPECTRUM), 0}, 4668 {0, }, 4669}; 4670 4671static struct pci_driver mlxsw_sp_pci_driver = { 4672 .name = mlxsw_sp_driver_name, 4673 .id_table = mlxsw_sp_pci_id_table, 4674}; 4675 |
|
4665static int __init mlxsw_sp_module_init(void) 4666{ 4667 int err; 4668 4669 register_netdevice_notifier(&mlxsw_sp_netdevice_nb); 4670 register_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); 4671 register_netevent_notifier(&mlxsw_sp_router_netevent_nb); 4672 4673 err = mlxsw_core_driver_register(&mlxsw_sp_driver); 4674 if (err) 4675 goto err_core_driver_register; | 4676static int __init mlxsw_sp_module_init(void) 4677{ 4678 int err; 4679 4680 register_netdevice_notifier(&mlxsw_sp_netdevice_nb); 4681 register_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); 4682 register_netevent_notifier(&mlxsw_sp_router_netevent_nb); 4683 4684 err = mlxsw_core_driver_register(&mlxsw_sp_driver); 4685 if (err) 4686 goto err_core_driver_register; |
4687 4688 err = mlxsw_pci_driver_register(&mlxsw_sp_pci_driver); 4689 if (err) 4690 goto err_pci_driver_register; 4691 |
|
4676 return 0; 4677 | 4692 return 0; 4693 |
4694err_pci_driver_register: 4695 mlxsw_core_driver_unregister(&mlxsw_sp_driver); |
|
4678err_core_driver_register: 4679 unregister_netevent_notifier(&mlxsw_sp_router_netevent_nb); 4680 unregister_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); 4681 unregister_netdevice_notifier(&mlxsw_sp_netdevice_nb); 4682 return err; 4683} 4684 4685static void __exit mlxsw_sp_module_exit(void) 4686{ | 4696err_core_driver_register: 4697 unregister_netevent_notifier(&mlxsw_sp_router_netevent_nb); 4698 unregister_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); 4699 unregister_netdevice_notifier(&mlxsw_sp_netdevice_nb); 4700 return err; 4701} 4702 4703static void __exit mlxsw_sp_module_exit(void) 4704{ |
4705 mlxsw_pci_driver_unregister(&mlxsw_sp_pci_driver); |
|
4687 mlxsw_core_driver_unregister(&mlxsw_sp_driver); 4688 unregister_netevent_notifier(&mlxsw_sp_router_netevent_nb); 4689 unregister_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); 4690 unregister_netdevice_notifier(&mlxsw_sp_netdevice_nb); 4691} 4692 4693module_init(mlxsw_sp_module_init); 4694module_exit(mlxsw_sp_module_exit); 4695 4696MODULE_LICENSE("Dual BSD/GPL"); 4697MODULE_AUTHOR("Jiri Pirko <jiri@mellanox.com>"); 4698MODULE_DESCRIPTION("Mellanox Spectrum driver"); | 4706 mlxsw_core_driver_unregister(&mlxsw_sp_driver); 4707 unregister_netevent_notifier(&mlxsw_sp_router_netevent_nb); 4708 unregister_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); 4709 unregister_netdevice_notifier(&mlxsw_sp_netdevice_nb); 4710} 4711 4712module_init(mlxsw_sp_module_init); 4713module_exit(mlxsw_sp_module_exit); 4714 4715MODULE_LICENSE("Dual BSD/GPL"); 4716MODULE_AUTHOR("Jiri Pirko <jiri@mellanox.com>"); 4717MODULE_DESCRIPTION("Mellanox Spectrum driver"); |
4699MODULE_MLXSW_DRIVER_ALIAS(MLXSW_DEVICE_KIND_SPECTRUM); | 4718MODULE_DEVICE_TABLE(pci, mlxsw_sp_pci_id_table); |