Commit da382875 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

mlxsw: spectrum: Extend to support Spectrum-3 ASIC

Extend existing driver for Spectrum and Spectrum-2 ASICs
to support Spectrum-3 ASIC as well.
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Reviewed-by: default avatarPetr Machata <petrm@mellanox.com>
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent eb716a64
...@@ -71,7 +71,7 @@ config MLXSW_SWITCHX2 ...@@ -71,7 +71,7 @@ config MLXSW_SWITCHX2
module will be called mlxsw_switchx2. module will be called mlxsw_switchx2.
config MLXSW_SPECTRUM config MLXSW_SPECTRUM
tristate "Mellanox Technologies Spectrum support" tristate "Mellanox Technologies Spectrum family support"
depends on MLXSW_CORE && MLXSW_PCI && NET_SWITCHDEV && VLAN_8021Q depends on MLXSW_CORE && MLXSW_PCI && NET_SWITCHDEV && VLAN_8021Q
depends on PSAMPLE || PSAMPLE=n depends on PSAMPLE || PSAMPLE=n
depends on BRIDGE || BRIDGE=n depends on BRIDGE || BRIDGE=n
...@@ -87,8 +87,8 @@ config MLXSW_SPECTRUM ...@@ -87,8 +87,8 @@ config MLXSW_SPECTRUM
select NET_PTP_CLASSIFY if PTP_1588_CLOCK select NET_PTP_CLASSIFY if PTP_1588_CLOCK
default m default m
---help--- ---help---
This driver supports Mellanox Technologies Spectrum Ethernet This driver supports Mellanox Technologies
Switch ASICs. Spectrum/Spectrum-2/Spectrum-3 Ethernet Switch ASICs.
To compile this driver as a module, choose M here: the To compile this driver as a module, choose M here: the
module will be called mlxsw_spectrum. module will be called mlxsw_spectrum.
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#define PCI_DEVICE_ID_MELLANOX_SWITCHX2 0xc738 #define PCI_DEVICE_ID_MELLANOX_SWITCHX2 0xc738
#define PCI_DEVICE_ID_MELLANOX_SPECTRUM 0xcb84 #define PCI_DEVICE_ID_MELLANOX_SPECTRUM 0xcb84
#define PCI_DEVICE_ID_MELLANOX_SPECTRUM2 0xcf6c #define PCI_DEVICE_ID_MELLANOX_SPECTRUM2 0xcf6c
#define PCI_DEVICE_ID_MELLANOX_SPECTRUM3 0xcf70
#define PCI_DEVICE_ID_MELLANOX_SWITCHIB 0xcb20 #define PCI_DEVICE_ID_MELLANOX_SWITCHIB 0xcb20
#define PCI_DEVICE_ID_MELLANOX_SWITCHIB2 0xcf08 #define PCI_DEVICE_ID_MELLANOX_SWITCHIB2 0xcf08
......
...@@ -65,6 +65,7 @@ static const struct mlxsw_fw_rev mlxsw_sp1_fw_rev = { ...@@ -65,6 +65,7 @@ static const struct mlxsw_fw_rev mlxsw_sp1_fw_rev = {
static const char mlxsw_sp1_driver_name[] = "mlxsw_spectrum"; static const char mlxsw_sp1_driver_name[] = "mlxsw_spectrum";
static const char mlxsw_sp2_driver_name[] = "mlxsw_spectrum2"; static const char mlxsw_sp2_driver_name[] = "mlxsw_spectrum2";
static const char mlxsw_sp3_driver_name[] = "mlxsw_spectrum3";
static const char mlxsw_sp_driver_version[] = "1.0"; static const char mlxsw_sp_driver_version[] = "1.0";
static const unsigned char mlxsw_sp1_mac_mask[ETH_ALEN] = { static const unsigned char mlxsw_sp1_mac_mask[ETH_ALEN] = {
...@@ -5290,6 +5291,35 @@ static struct mlxsw_driver mlxsw_sp2_driver = { ...@@ -5290,6 +5291,35 @@ static struct mlxsw_driver mlxsw_sp2_driver = {
.res_query_enabled = true, .res_query_enabled = true,
}; };
static struct mlxsw_driver mlxsw_sp3_driver = {
.kind = mlxsw_sp3_driver_name,
.priv_size = sizeof(struct mlxsw_sp),
.init = mlxsw_sp2_init,
.fini = mlxsw_sp_fini,
.basic_trap_groups_set = mlxsw_sp_basic_trap_groups_set,
.port_split = mlxsw_sp_port_split,
.port_unsplit = mlxsw_sp_port_unsplit,
.sb_pool_get = mlxsw_sp_sb_pool_get,
.sb_pool_set = mlxsw_sp_sb_pool_set,
.sb_port_pool_get = mlxsw_sp_sb_port_pool_get,
.sb_port_pool_set = mlxsw_sp_sb_port_pool_set,
.sb_tc_pool_bind_get = mlxsw_sp_sb_tc_pool_bind_get,
.sb_tc_pool_bind_set = mlxsw_sp_sb_tc_pool_bind_set,
.sb_occ_snapshot = mlxsw_sp_sb_occ_snapshot,
.sb_occ_max_clear = mlxsw_sp_sb_occ_max_clear,
.sb_occ_port_pool_get = mlxsw_sp_sb_occ_port_pool_get,
.sb_occ_tc_port_bind_get = mlxsw_sp_sb_occ_tc_port_bind_get,
.flash_update = mlxsw_sp_flash_update,
.txhdr_construct = mlxsw_sp_txhdr_construct,
.resources_register = mlxsw_sp2_resources_register,
.params_register = mlxsw_sp2_params_register,
.params_unregister = mlxsw_sp2_params_unregister,
.ptp_transmitted = mlxsw_sp_ptp_transmitted,
.txhdr_len = MLXSW_TXHDR_LEN,
.profile = &mlxsw_sp2_config_profile,
.res_query_enabled = true,
};
bool mlxsw_sp_port_dev_check(const struct net_device *dev) bool mlxsw_sp_port_dev_check(const struct net_device *dev)
{ {
return dev->netdev_ops == &mlxsw_sp_port_netdev_ops; return dev->netdev_ops == &mlxsw_sp_port_netdev_ops;
...@@ -6324,6 +6354,16 @@ static struct pci_driver mlxsw_sp2_pci_driver = { ...@@ -6324,6 +6354,16 @@ static struct pci_driver mlxsw_sp2_pci_driver = {
.id_table = mlxsw_sp2_pci_id_table, .id_table = mlxsw_sp2_pci_id_table,
}; };
static const struct pci_device_id mlxsw_sp3_pci_id_table[] = {
{PCI_VDEVICE(MELLANOX, PCI_DEVICE_ID_MELLANOX_SPECTRUM3), 0},
{0, },
};
static struct pci_driver mlxsw_sp3_pci_driver = {
.name = mlxsw_sp3_driver_name,
.id_table = mlxsw_sp3_pci_id_table,
};
static int __init mlxsw_sp_module_init(void) static int __init mlxsw_sp_module_init(void)
{ {
int err; int err;
...@@ -6339,6 +6379,10 @@ static int __init mlxsw_sp_module_init(void) ...@@ -6339,6 +6379,10 @@ static int __init mlxsw_sp_module_init(void)
if (err) if (err)
goto err_sp2_core_driver_register; goto err_sp2_core_driver_register;
err = mlxsw_core_driver_register(&mlxsw_sp3_driver);
if (err)
goto err_sp3_core_driver_register;
err = mlxsw_pci_driver_register(&mlxsw_sp1_pci_driver); err = mlxsw_pci_driver_register(&mlxsw_sp1_pci_driver);
if (err) if (err)
goto err_sp1_pci_driver_register; goto err_sp1_pci_driver_register;
...@@ -6347,11 +6391,19 @@ static int __init mlxsw_sp_module_init(void) ...@@ -6347,11 +6391,19 @@ static int __init mlxsw_sp_module_init(void)
if (err) if (err)
goto err_sp2_pci_driver_register; goto err_sp2_pci_driver_register;
err = mlxsw_pci_driver_register(&mlxsw_sp3_pci_driver);
if (err)
goto err_sp3_pci_driver_register;
return 0; return 0;
err_sp3_pci_driver_register:
mlxsw_pci_driver_unregister(&mlxsw_sp2_pci_driver);
err_sp2_pci_driver_register: err_sp2_pci_driver_register:
mlxsw_pci_driver_unregister(&mlxsw_sp1_pci_driver); mlxsw_pci_driver_unregister(&mlxsw_sp1_pci_driver);
err_sp1_pci_driver_register: err_sp1_pci_driver_register:
mlxsw_core_driver_unregister(&mlxsw_sp3_driver);
err_sp3_core_driver_register:
mlxsw_core_driver_unregister(&mlxsw_sp2_driver); mlxsw_core_driver_unregister(&mlxsw_sp2_driver);
err_sp2_core_driver_register: err_sp2_core_driver_register:
mlxsw_core_driver_unregister(&mlxsw_sp1_driver); mlxsw_core_driver_unregister(&mlxsw_sp1_driver);
...@@ -6363,8 +6415,10 @@ static int __init mlxsw_sp_module_init(void) ...@@ -6363,8 +6415,10 @@ static int __init mlxsw_sp_module_init(void)
static void __exit mlxsw_sp_module_exit(void) static void __exit mlxsw_sp_module_exit(void)
{ {
mlxsw_pci_driver_unregister(&mlxsw_sp3_pci_driver);
mlxsw_pci_driver_unregister(&mlxsw_sp2_pci_driver); mlxsw_pci_driver_unregister(&mlxsw_sp2_pci_driver);
mlxsw_pci_driver_unregister(&mlxsw_sp1_pci_driver); mlxsw_pci_driver_unregister(&mlxsw_sp1_pci_driver);
mlxsw_core_driver_unregister(&mlxsw_sp3_driver);
mlxsw_core_driver_unregister(&mlxsw_sp2_driver); mlxsw_core_driver_unregister(&mlxsw_sp2_driver);
mlxsw_core_driver_unregister(&mlxsw_sp1_driver); mlxsw_core_driver_unregister(&mlxsw_sp1_driver);
unregister_inet6addr_validator_notifier(&mlxsw_sp_inet6addr_valid_nb); unregister_inet6addr_validator_notifier(&mlxsw_sp_inet6addr_valid_nb);
...@@ -6379,4 +6433,5 @@ MODULE_AUTHOR("Jiri Pirko <jiri@mellanox.com>"); ...@@ -6379,4 +6433,5 @@ MODULE_AUTHOR("Jiri Pirko <jiri@mellanox.com>");
MODULE_DESCRIPTION("Mellanox Spectrum driver"); MODULE_DESCRIPTION("Mellanox Spectrum driver");
MODULE_DEVICE_TABLE(pci, mlxsw_sp1_pci_id_table); MODULE_DEVICE_TABLE(pci, mlxsw_sp1_pci_id_table);
MODULE_DEVICE_TABLE(pci, mlxsw_sp2_pci_id_table); MODULE_DEVICE_TABLE(pci, mlxsw_sp2_pci_id_table);
MODULE_DEVICE_TABLE(pci, mlxsw_sp3_pci_id_table);
MODULE_FIRMWARE(MLXSW_SP1_FW_FILENAME); MODULE_FIRMWARE(MLXSW_SP1_FW_FILENAME);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment