mlxsw: Driver update, add initial support for Spectrum ASIC
Subsystems (3)
cover mlxsw: Driver update, add initial support for Spectrum ASIC
From: Jiri Pirko <[email protected]>
Purpose of this patchset is to introduce initial support for Mellanox Spectrum ASIC, including L2 bridge forwarding offload.
The only non-mlxsw patch in this patchset is the first one, introducing pre-change upper notifier. That is used in last patch to ensure ports of single ASIC are not bridged into multiple bridges, as that scenario is currently not supported by driver.
Elad Raz (1):
mlxsw: reg: Add Switch Port VID and Switch Port VLAN Membership
registers definitions
Ido Schimmel (7):
mlxsw: Enable configuration of flooding domains
mlxsw: cmd: Introduce per-FID flooding tables
mlxsw: cmd: Introduce FID-offset flooding tables
mlxsw: reg: Add Switch FID Management register definition
mlxsw: reg: Add Switch VID to FID Allocation register definition
mlxsw: reg: Add Switch Virtual-Port Enabling register definition
mlxsw: reg: Add Switch Port VLAN MAC Learning register definition
Jiri Pirko (8):
net: introduce pre-change upper device notifier
mlxsw: item: Make src arg of memcpy_to helper const
mlxsw: item: Add MLXSW_ITEM_BUF_INDEXED helper
mlxsw: reg: Add Switch Filtering Database register definition
mlxsw: reg: Add Switch FDB Notification register definition
mlxsw: reg: Add shared buffer configuration registers definitions
mlxsw: reg: Add Switch Filtering Database Aging Time register
definition
mlxsw: spectrum: Add initial support for Spectrum ASIC
drivers/net/ethernet/mellanox/mlxsw/Kconfig | 11 + drivers/net/ethernet/mellanox/mlxsw/Makefile | 3 + drivers/net/ethernet/mellanox/mlxsw/cmd.h | 25 + drivers/net/ethernet/mellanox/mlxsw/core.h | 5 + drivers/net/ethernet/mellanox/mlxsw/item.h | 50 +- drivers/net/ethernet/mellanox/mlxsw/pci.c | 11 + drivers/net/ethernet/mellanox/mlxsw/pci.h | 1 + drivers/net/ethernet/mellanox/mlxsw/reg.h | 1142 +++++++++++- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 1948 ++++++++++++++++++++ drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 121 ++ .../net/ethernet/mellanox/mlxsw/spectrum_buffers.c | 422 +++++ .../ethernet/mellanox/mlxsw/spectrum_switchdev.c | 863 +++++++++ drivers/net/ethernet/mellanox/mlxsw/switchx2.c | 3 +- drivers/net/ethernet/mellanox/mlxsw/txheader.h | 1 + include/linux/netdevice.h | 1 + net/core/dev.c | 9 + 16 files changed, 4604 insertions(+), 12 deletions(-) create mode 100644 drivers/net/ethernet/mellanox/mlxsw/spectrum.c create mode 100644 drivers/net/ethernet/mellanox/mlxsw/spectrum.h create mode 100644 drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c create mode 100644 drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
Signature · 1 line
1.9.3
PATCH 1/16 net: introduce pre-change upper device notifier
From: Jiri Pirko <[email protected]>
This newly introduced netdevice notifier is called before actual change upper happens. That provides a possibility for notifier handlers to know upper change will happen and react to it, including possibility to forbid the change. That is valuable for drivers which can check if the upper device linkage is supported and forbid that in case it is not.
--- include/linux/netdevice.h | 1 + net/core/dev.c | 9 +++++++++ 2 files changed, 10 insertions(+)
include/linux/netdevice.h +1 -0
@@ -2106,6 +2106,7 @@ struct pcpu_sw_netstats {#define NETDEV_PRECHANGEMTU 0x0017/* notify before mtu change happened */ #define NETDEV_CHANGEINFODATA 0x0018#define NETDEV_BONDING_INFO 0x0019 +#define NETDEV_PRECHANGEUPPER 0x001Aint register_netdevice_notifier (struct notifier_block *nb);int unregister_netdevice_notifier (struct notifier_block *nb);
net/core/dev.c +9 -0
@@ -5346,6 +5346,12 @@ static int __netdev_upper_dev_link(struct net_device *dev, changeupper_info.master = master; changeupper_info.linking = true; + ret =call_netdevice_notifiers_info (NETDEV_PRECHANGEUPPER , dev, + &changeupper_info.info); + ret =notifier_to_errno (ret); +if (ret) +return ret; + ret =__netdev_adjacent_dev_link_neighbour (dev, upper_dev, private, master);if (ret)
@@ -5488,6 +5494,9 @@ void netdev_upper_dev_unlink(struct net_device *dev, changeupper_info.master =netdev_master_upper_dev_get (dev) == upper_dev; changeupper_info.linking = false; +call_netdevice_notifiers_info (NETDEV_PRECHANGEUPPER , dev, + &changeupper_info.info); +__netdev_adjacent_dev_unlink_neighbour (dev, upper_dev);/* Here is the tricky part. We must remove all dev's lower
Signature · 1 line
1.9.3
PATCH 2/16 mlxsw: Enable configuration of flooding domains
In reply to Jiri PirkoFrom: Ido Schimmel <[email protected]>
As part of the introduction of L2 offloads, allow different ports to join/leave the flooding domain, according to user configuration.
--- drivers/net/ethernet/mellanox/mlxsw/reg.h | 6 +++--- drivers/net/ethernet/mellanox/mlxsw/switchx2.c | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/reg.h +3 -3
@@ -363,7 +363,7 @@ static inline void mlxsw_reg_sftr_pack(char *payload,unsigned int flood_table, unsigned int index, enum mlxsw_flood_table_type table_type, - unsigned int range) + unsigned int range, u8 port, bool set) {MLXSW_REG_ZERO (sftr ,payload );mlxsw_reg_sftr_swid_set (payload,0 );
@@ -371,8 +371,8 @@ static inline void mlxsw_reg_sftr_pack(char *payload,mlxsw_reg_sftr_index_set (payload, index);mlxsw_reg_sftr_table_type_set (payload, table_type);mlxsw_reg_sftr_range_set (payload, range); -mlxsw_reg_sftr_port_set (payload,MLXSW_PORT_CPU_PORT ,1 ); -mlxsw_reg_sftr_port_mask_set (payload,MLXSW_PORT_CPU_PORT ,1 ); +mlxsw_reg_sftr_port_set (payload, port, set); +mlxsw_reg_sftr_port_mask_set (payload, port,1 ); }/* SPMLR - Switch Port MAC Learning Register
drivers/net/ethernet/mellanox/mlxsw/switchx2.c +2 -1
@@ -1377,7 +1377,8 @@ static int mlxsw_sx_flood_init(struct mlxsw_sx *mlxsw_sx) sftr_pl =kmalloc (MLXSW_REG_SFTR_LEN ,GFP_KERNEL );if (!sftr_pl)return -ENOMEM ; -mlxsw_reg_sftr_pack (sftr_pl,0 ,0 ,MLXSW_REG_SFGC_TABLE_TYPE_SINGLE ,0 ); +mlxsw_reg_sftr_pack (sftr_pl,0 ,0 ,MLXSW_REG_SFGC_TABLE_TYPE_SINGLE ,0 , +MLXSW_PORT_CPU_PORT , true); err =mlxsw_reg_write (mlxsw_sx->core,MLXSW_REG (sftr), sftr_pl);kfree (sftr_pl);if (err)
Signature · 1 line
1.9.3
PATCH 3/16 mlxsw: cmd: Introduce per-FID flooding tables
In reply to Jiri PirkoFrom: Ido Schimmel <[email protected]>
In the newly introduced Spectrum switch ASIC, packets destined to not offloaded netdevs will be classified to special FIDs (vFIDs) in the device and flooded to the CPU port.
The flooding table used is of type per-FID, which allows one to create different flooding domains for different vFIDs.
While using a simple single-entry flood table is certainly sufficient at this point, we do plan to offload 802.1D bridges involving VLAN interfaces, thus making this change necessary.
Add support for this flooding table type, by exposing the configuration of the number of tables from this type and their size.
--- drivers/net/ethernet/mellanox/mlxsw/cmd.h | 13 +++++++++++++ drivers/net/ethernet/mellanox/mlxsw/core.h | 2 ++ drivers/net/ethernet/mellanox/mlxsw/pci.c | 4 ++++ 3 files changed, 19 insertions(+)
drivers/net/ethernet/mellanox/mlxsw/cmd.h +13 -0
@@ -674,6 +674,19 @@ MLXSW_ITEM32(cmd_mbox, config_profile, max_vid_flood_tables, 0x30, 8, 4);*/ MLXSW_ITEM32 (cmd_mbox, config_profile, flood_mode,0x30 ,0 ,2 ); +/* cmd_mbox_config_profile_max_fid_flood_tables +* Maximum number of per-FID flooding tables. +* +* Note: This flooding tables cover special FIDs only (vFIDs), starting at +* FID value 4K and higher. +*/ +MLXSW_ITEM32 (cmd_mbox, config_profile, max_fid_flood_tables,0x38 ,24 ,4 ); + +/* cmd_mbox_config_profile_fid_flood_table_size +* The size (number of entries) of each per-FID table. +*/ +MLXSW_ITEM32 (cmd_mbox, config_profile, fid_flood_table_size,0x38 ,0 ,16 ); +/* cmd_mbox_config_profile_max_ib_mc * Maximum number of multicast FDB records for InfiniBand * FDB (in 512 chunks) per InfiniBand switch partition.
drivers/net/ethernet/mellanox/mlxsw/core.h +2 -0
@@ -153,6 +153,8 @@ struct mlxsw_config_profile {u8 max_flood_tables;u8 max_vid_flood_tables;u8 flood_mode; +u8 max_fid_flood_tables; +u16 fid_flood_table_size;u16 max_ib_mc;u16 max_pkey;u8 ar_sec;
drivers/net/ethernet/mellanox/mlxsw/pci.c +4 -0
@@ -1214,6 +1214,10 @@ static int mlxsw_pci_config_profile(struct mlxsw_pci *mlxsw_pci, char *mbox, mbox, profile->max_flood_tables);mlxsw_cmd_mbox_config_profile_max_vid_flood_tables_set ( mbox, profile->max_vid_flood_tables); +mlxsw_cmd_mbox_config_profile_max_fid_flood_tables_set ( + mbox, profile->max_fid_flood_tables); +mlxsw_cmd_mbox_config_profile_fid_flood_table_size_set ( + mbox, profile->fid_flood_table_size); }if (profile->used_flood_mode) { mlxsw_cmd_mbox_config_profile_set_flood_mode_set(
Signature · 1 line
1.9.3
PATCH 4/16 mlxsw: cmd: Introduce FID-offset flooding tables
In reply to Jiri PirkoFrom: Ido Schimmel <[email protected]>
Packets destined to offloaded netdevs will be classified to FIDs in the device and flooded in case of BUM.
The flooding table used is of type FID-offset, which allows one to create different flooding domains for different FIDs and specify the offset in the flooding table for each FID (not necessarily equal to FID or VID).
Add support for this flooding table type, by exposing the configuration of the number of tables from this type and their size.
--- drivers/net/ethernet/mellanox/mlxsw/cmd.h | 12 ++++++++++++ drivers/net/ethernet/mellanox/mlxsw/core.h | 2 ++ drivers/net/ethernet/mellanox/mlxsw/pci.c | 4 ++++ 3 files changed, 18 insertions(+)
drivers/net/ethernet/mellanox/mlxsw/cmd.h +12 -0
@@ -674,6 +674,18 @@ MLXSW_ITEM32(cmd_mbox, config_profile, max_vid_flood_tables, 0x30, 8, 4);*/ MLXSW_ITEM32 (cmd_mbox, config_profile, flood_mode,0x30 ,0 ,2 ); +/* cmd_mbox_config_profile_max_fid_offset_flood_tables +* Maximum number of FID-offset flooding tables. +*/ +MLXSW_ITEM32 (cmd_mbox, config_profile, + max_fid_offset_flood_tables,0x34 ,24 ,4 ); + +/* cmd_mbox_config_profile_fid_offset_flood_table_size +* The size (number of entries) of each FID-offset flood table. +*/ +MLXSW_ITEM32 (cmd_mbox, config_profile, + fid_offset_flood_table_size,0x34 ,0 ,16 ); +/* cmd_mbox_config_profile_max_fid_flood_tables * Maximum number of per-FID flooding tables. *
drivers/net/ethernet/mellanox/mlxsw/core.h +2 -0
@@ -153,6 +153,8 @@ struct mlxsw_config_profile {u8 max_flood_tables;u8 max_vid_flood_tables;u8 flood_mode; +u8 max_fid_offset_flood_tables; +u16 fid_offset_flood_table_size;u8 max_fid_flood_tables;u16 fid_flood_table_size;u16 max_ib_mc;
drivers/net/ethernet/mellanox/mlxsw/pci.c +4 -0
@@ -1214,6 +1214,10 @@ static int mlxsw_pci_config_profile(struct mlxsw_pci *mlxsw_pci, char *mbox, mbox, profile->max_flood_tables);mlxsw_cmd_mbox_config_profile_max_vid_flood_tables_set ( mbox, profile->max_vid_flood_tables); +mlxsw_cmd_mbox_config_profile_max_fid_offset_flood_tables_set ( + mbox, profile->max_fid_offset_flood_tables); +mlxsw_cmd_mbox_config_profile_fid_offset_flood_table_size_set ( + mbox, profile->fid_offset_flood_table_size);mlxsw_cmd_mbox_config_profile_max_fid_flood_tables_set ( mbox, profile->max_fid_flood_tables); mlxsw_cmd_mbox_config_profile_fid_flood_table_size_set(
Signature · 1 line
1.9.3
PATCH 5/16 mlxsw: item: Make src arg of memcpy_to helper const
In reply to Jiri PirkoFrom: Jiri Pirko <[email protected]>
--- drivers/net/ethernet/mellanox/mlxsw/item.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/item.h +2 -2
@@ -176,7 +176,7 @@ static inline void __mlxsw_item_memcpy_from(char *buf, char *dst,memcpy (dst, &buf[item->offset], item->size.bytes); } -static inline void __mlxsw_item_memcpy_to (char *buf,char *src, +static inline void __mlxsw_item_memcpy_to (char *buf,const char *src,struct mlxsw_item *item) {memcpy (&buf[item->offset], src, item->size.bytes);
@@ -376,7 +376,7 @@ mlxsw_##_type##_##_cname##_##_iname##_memcpy_from(char *buf, char *dst) \__mlxsw_item_memcpy_from (buf, dst, &__ITEM_NAME (_type, _cname, _iname));\ } \static inline void \ -mlxsw_##_type##_##_cname##_##_iname##_memcpy_to(char *buf, char *src) \ +mlxsw_##_type##_##_cname##_##_iname##_memcpy_to(char *buf, const char *src) \ { \__mlxsw_item_memcpy_to (buf, src, &__ITEM_NAME (_type, _cname, _iname)); \ }
Signature · 1 line
1.9.3
PATCH 6/16 mlxsw: item: Add MLXSW_ITEM_BUF_INDEXED helper
In reply to Jiri PirkoFrom: Jiri Pirko <[email protected]>
Add missing item helper which allows to access char bufs on multiple offsets. This is needed by SFD and SFN register definitions.
--- drivers/net/ethernet/mellanox/mlxsw/item.h | 46 ++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/item.h +40 -6
@@ -171,15 +171,21 @@ static inline void __mlxsw_item_set64(char *buf, struct mlxsw_item *item, }static inline void __mlxsw_item_memcpy_from (char *buf,char *dst, -struct mlxsw_item *item) +struct mlxsw_item *item, +unsigned short index) { -memcpy (dst, &buf[item->offset], item->size.bytes); +unsigned int offset =__mlxsw_item_offset (item, index,sizeof (char )); + +memcpy (dst, &buf[offset], item->size.bytes); }static inline void __mlxsw_item_memcpy_to (char *buf,const char *src, -struct mlxsw_item *item) +struct mlxsw_item *item, +unsigned short index) { -memcpy (&buf[item->offset], src, item->size.bytes); +unsigned int offset =__mlxsw_item_offset (item, index,sizeof (char )); + +memcpy (&buf[offset], src, item->size.bytes); } static inline u16
@@ -373,12 +379,40 @@ static struct mlxsw_item __ITEM_NAME(_type, _cname, _iname) = { \static inline void \ mlxsw_##_type##_##_cname##_##_iname##_memcpy_from(char *buf, char *dst) \ { \ -__mlxsw_item_memcpy_from (buf, dst, &__ITEM_NAME (_type, _cname, _iname));\ +__mlxsw_item_memcpy_from (buf, dst, \ + &__ITEM_NAME (_type, _cname, _iname),0 ); \ } \static inline void \ mlxsw_##_type##_##_cname##_##_iname##_memcpy_to(char *buf, const char *src) \ { \ -__mlxsw_item_memcpy_to (buf, src, &__ITEM_NAME (_type, _cname, _iname)); \ +__mlxsw_item_memcpy_to (buf, src, \ + &__ITEM_NAME (_type, _cname, _iname),0 ); \ +} + +#define MLXSW_ITEM_BUF_INDEXED (_type, _cname, _iname, _offset, _sizebytes, \ + _step, _instepoffset) \ +static struct mlxsw_item __ITEM_NAME(_type, _cname, _iname) = { \ + .offset = _offset, \ + .step = _step, \ + .in_step_offset = _instepoffset, \ + .size = {.bytes = _sizebytes,}, \ + .name = #_type "_" #_cname "_" #_iname, \ +}; \ +static inline void \ +mlxsw_##_type##_##_cname##_##_iname##_memcpy_from(char *buf, \ + unsigned short index, \ + char *dst) \ +{ \ + __mlxsw_item_memcpy_from(buf, dst, \ + &__ITEM_NAME(_type, _cname, _iname), index); \ +} \ +static inline void \ +mlxsw_##_type##_##_cname##_##_iname##_memcpy_to(char *buf, \ + unsigned short index, \ + const char *src) \ +{ \ + __mlxsw_item_memcpy_to(buf, src, \ + &__ITEM_NAME(_type, _cname, _iname), index); \ } #define MLXSW_ITEM_BIT_ARRAY(_type, _cname, _iname, _offset, _sizebytes, \
Signature · 1 line
1.9.3
PATCH 7/16 mlxsw: reg: Add Switch Filtering Database register definition
In reply to Jiri PirkoFrom: Jiri Pirko <[email protected]>
Add the SFD register which is responsible for filtering database manipulation, including static and dynamic FDB entries.
--- drivers/net/ethernet/mellanox/mlxsw/reg.h | 216 ++++++++++++++++++++++++++++++ 1 file changed, 216 insertions(+)
drivers/net/ethernet/mellanox/mlxsw/reg.h +216 -0
@@ -157,6 +157,220 @@ static inline void mlxsw_reg_sspr_pack(char *payload, u8 local_port)mlxsw_reg_sspr_system_port_set (payload, local_port); } +/* SFD - Switch Filtering Database +* ------------------------------- +* The following register defines the access to the filtering database. +* The register supports querying, adding, removing and modifying the database. +* The access is optimized for bulk updates in which case more than one +* FDB record is present in the same command. +*/ +#define MLXSW_REG_SFD_ID 0x200A +#define MLXSW_REG_SFD_BASE_LEN 0x10/* base length, without records */ +#define MLXSW_REG_SFD_REC_LEN 0x10/* record length */ +#define MLXSW_REG_SFD_REC_MAX_COUNT 64 +#define MLXSW_REG_SFD_LEN (MLXSW_REG_SFD_BASE_LEN + \ + MLXSW_REG_SFD_REC_LEN * MLXSW_REG_SFD_REC_MAX_COUNT) + +static const struct mlxsw_reg_info mlxsw_reg_sfd = { + .id =MLXSW_REG_SFD_ID , + .len =MLXSW_REG_SFD_LEN , +}; + +/* reg_sfd_swid +* Switch partition ID for queries. Reserved on Write. +* Access: Index +*/ +MLXSW_ITEM32 (reg, sfd, swid,0x00 ,24 ,8 ); + +enum mlxsw_reg_sfd_op { +/* Dump entire FDB a (process according to record_locator) */ +MLXSW_REG_SFD_OP_QUERY_DUMP =0 , +/* Query records by {MAC, VID/FID} value */ +MLXSW_REG_SFD_OP_QUERY_QUERY =1 , +/* Query and clear activity. Query records by {MAC, VID/FID} value */ +MLXSW_REG_SFD_OP_QUERY_QUERY_AND_CLEAR_ACTIVITY =2 , +/* Test. Response indicates if each of the records could be +* added to the FDB. +*/ +MLXSW_REG_SFD_OP_WRITE_TEST =0 , +/* Add/modify. Aged-out records cannot be added. This command removes +* the learning notification of the {MAC, VID/FID}. Response includes +* the entries that were added to the FDB. +*/ +MLXSW_REG_SFD_OP_WRITE_EDIT =1 , +/* Remove record by {MAC, VID/FID}. This command also removes +* the learning notification and aged-out notifications +* of the {MAC, VID/FID}. The response provides current (pre-removal) +* entries as non-aged-out. +*/ +MLXSW_REG_SFD_OP_WRITE_REMOVE =2 , +/* Remove learned notification by {MAC, VID/FID}. The response provides +* the removed learning notification. +*/ +MLXSW_REG_SFD_OP_WRITE_REMOVE_NOTIFICATION =2 , +}; + +/* reg_sfd_op +* Operation. +* Access: OP +*/ +MLXSW_ITEM32 (reg, sfd, op,0x04 ,30 ,2 ); + +/* reg_sfd_record_locator +* Used for querying the FDB. Use record_locator=0 to initiate the +* query. When a record is returned, a new record_locator is +* returned to be used in the subsequent query. +* Reserved for database update. +* Access: Index +*/ +MLXSW_ITEM32 (reg, sfd, record_locator,0x04 ,0 ,30 ); + +/* reg_sfd_num_rec +* Request: Number of records to read/add/modify/remove +* Response: Number of records read/added/replaced/removed +* See above description for more details. +* Ranges 0..64 +* Access: RW +*/ +MLXSW_ITEM32 (reg, sfd, num_rec,0x08 ,0 ,8 ); + +static inline void mlxsw_reg_sfd_pack (char *payload,enum mlxsw_reg_sfd_op op, +u32 record_locator) +{ +MLXSW_REG_ZERO (sfd, payload); +mlxsw_reg_sfd_op_set (payload, op); +mlxsw_reg_sfd_record_locator_set (payload, record_locator); +} + +/* reg_sfd_rec_swid +* Switch partition ID. +* Access: Index +*/ +MLXSW_ITEM32_INDEXED (reg, sfd, rec_swid,MLXSW_REG_SFD_BASE_LEN ,24 ,8 , +MLXSW_REG_SFD_REC_LEN ,0x00 , false); + +enum mlxsw_reg_sfd_rec_type { +MLXSW_REG_SFD_REC_TYPE_UNICAST =0x0 , +}; + +/* reg_sfd_rec_type +* FDB record type. +* Access: RW +*/ +MLXSW_ITEM32_INDEXED (reg, sfd, rec_type,MLXSW_REG_SFD_BASE_LEN ,20 ,4 , +MLXSW_REG_SFD_REC_LEN ,0x00 , false); + +enum mlxsw_reg_sfd_rec_policy { +/* Replacement disabled, aging disabled. */ +MLXSW_REG_SFD_REC_POLICY_STATIC_ENTRY =0 , +/* (mlag remote): Replacement enabled, aging disabled, +* learning notification enabled on this port. +*/ +MLXSW_REG_SFD_REC_POLICY_DYNAMIC_ENTRY_MLAG =1 , +/* (ingress device): Replacement enabled, aging enabled. */ +MLXSW_REG_SFD_REC_POLICY_DYNAMIC_ENTRY_INGRESS =3 , +}; + +/* reg_sfd_rec_policy +* Policy. +* Access: RW +*/ +MLXSW_ITEM32_INDEXED (reg, sfd, rec_policy,MLXSW_REG_SFD_BASE_LEN ,18 ,2 , +MLXSW_REG_SFD_REC_LEN ,0x00 , false); + +/* reg_sfd_rec_a +* Activity. Set for new static entries. Set for static entries if a frame SMAC +* lookup hits on the entry. +* To clear the a bit, use "query and clear activity" op. +* Access: RO +*/ +MLXSW_ITEM32_INDEXED (reg, sfd, rec_a,MLXSW_REG_SFD_BASE_LEN ,16 ,1 , +MLXSW_REG_SFD_REC_LEN ,0x00 , false); + +/* reg_sfd_rec_mac +* MAC address. +* Access: Index +*/ +MLXSW_ITEM_BUF_INDEXED (reg, sfd, rec_mac,MLXSW_REG_SFD_BASE_LEN ,6 , +MLXSW_REG_SFD_REC_LEN ,0x02 ); + +enum mlxsw_reg_sfd_rec_action { +/* forward */ +MLXSW_REG_SFD_REC_ACTION_NOP =0 , +/* forward and trap, trap_id is FDB_TRAP */ +MLXSW_REG_SFD_REC_ACTION_MIRROR_TO_CPU =1 , +/* trap and do not forward, trap_id is FDB_TRAP */ +MLXSW_REG_SFD_REC_ACTION_TRAP =3 , +MLXSW_REG_SFD_REC_ACTION_DISCARD_ERROR =15 , +}; + +/* reg_sfd_rec_action +* Action to apply on the packet. +* Note: Dynamic entries can only be configured with NOP action. +* Access: RW +*/ +MLXSW_ITEM32_INDEXED (reg, sfd, rec_action,MLXSW_REG_SFD_BASE_LEN ,28 ,4 , +MLXSW_REG_SFD_REC_LEN ,0x0C , false); + +/* reg_sfd_uc_sub_port +* LAG sub port. +* Must be 0 if multichannel VEPA is not enabled. +* Access: RW +*/ +MLXSW_ITEM32_INDEXED (reg, sfd, uc_sub_port,MLXSW_REG_SFD_BASE_LEN ,16 ,8 , +MLXSW_REG_SFD_REC_LEN ,0x08 , false); + +/* reg_sfd_uc_fid_vid +* Filtering ID or VLAN ID +* For SwitchX and SwitchX-2: +* - Dynamic entries (policy 2,3) use FID +* - Static entries (policy 0) use VID +* - When independent learning is configured, VID=FID +* For Spectrum: use FID for both Dynamic and Static entries. +* VID should not be used. +* Access: Index +*/ +MLXSW_ITEM32_INDEXED (reg, sfd, uc_fid_vid,MLXSW_REG_SFD_BASE_LEN ,0 ,16 , +MLXSW_REG_SFD_REC_LEN ,0x08 , false); + +/* reg_sfd_uc_system_port +* Unique port identifier for the final destination of the packet. +* Access: RW +*/ +MLXSW_ITEM32_INDEXED (reg, sfd, uc_system_port,MLXSW_REG_SFD_BASE_LEN ,0 ,16 , +MLXSW_REG_SFD_REC_LEN ,0x0C , false); + +static inline void mlxsw_reg_sfd_uc_pack (char *payload,int rec_index, +enum mlxsw_reg_sfd_rec_policy policy, +const char *mac,u16 vid, +enum mlxsw_reg_sfd_rec_action action, +u8 local_port) +{ +u8 num_rec =mlxsw_reg_sfd_num_rec_get (payload); + +if (rec_index >= num_rec) +mlxsw_reg_sfd_num_rec_set (payload, rec_index +1 ); +mlxsw_reg_sfd_rec_swid_set (payload, rec_index,0 ); +mlxsw_reg_sfd_rec_type_set (payload, rec_index, +MLXSW_REG_SFD_REC_TYPE_UNICAST ); +mlxsw_reg_sfd_rec_policy_set (payload, rec_index, policy); +mlxsw_reg_sfd_rec_mac_memcpy_to (payload, rec_index, mac); +mlxsw_reg_sfd_uc_sub_port_set (payload, rec_index,0 ); +mlxsw_reg_sfd_uc_fid_vid_set (payload, rec_index, vid); +mlxsw_reg_sfd_rec_action_set (payload, rec_index, action); +mlxsw_reg_sfd_uc_system_port_set (payload, rec_index, local_port); +} + +static inline void +mlxsw_reg_sfd_uc_unpack (char *payload,int rec_index, +char *mac,u16 *p_vid, +u8 *p_local_port) +{ +mlxsw_reg_sfd_rec_mac_memcpy_from (payload, rec_index, mac); + *p_vid =mlxsw_reg_sfd_uc_fid_vid_get (payload, rec_index); + *p_local_port =mlxsw_reg_sfd_uc_system_port_get (payload, rec_index); +} +/* SPMS - Switch Port MSTP/RSTP State Register * ------------------------------------------- * Configures the spanning tree state of a physical port.
@@ -1251,6 +1465,8 @@ static inline const char *mlxsw_reg_id_str(u16 reg_id)return "SPAD" ;case MLXSW_REG_SSPR_ID :return "SSPR" ; +case MLXSW_REG_SFD_ID : +return "SFD" ;case MLXSW_REG_SPMS_ID :return "SPMS" ;case MLXSW_REG_SFGC_ID :
Signature · 1 line
1.9.3
PATCH 8/16 mlxsw: reg: Add Switch FDB Notification register definition
In reply to Jiri PirkoFrom: Jiri Pirko <[email protected]>
Add SFN register which is used to poll for newly added and aged-out FDB entries.
--- drivers/net/ethernet/mellanox/mlxsw/reg.h | 101 ++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+)
drivers/net/ethernet/mellanox/mlxsw/reg.h +101 -0
@@ -371,6 +371,105 @@ mlxsw_reg_sfd_uc_unpack(char *payload, int rec_index, *p_local_port =mlxsw_reg_sfd_uc_system_port_get (payload, rec_index); } +/* SFN - Switch FDB Notification Register +* ------------------------------------------- +* The switch provides notifications on newly learned FDB entries and +* aged out entries. The notifications can be polled by software. +*/ +#define MLXSW_REG_SFN_ID 0x200B +#define MLXSW_REG_SFN_BASE_LEN 0x10/* base length, without records */ +#define MLXSW_REG_SFN_REC_LEN 0x10/* record length */ +#define MLXSW_REG_SFN_REC_MAX_COUNT 64 +#define MLXSW_REG_SFN_LEN (MLXSW_REG_SFN_BASE_LEN + \ + MLXSW_REG_SFN_REC_LEN * MLXSW_REG_SFN_REC_MAX_COUNT) + +static const struct mlxsw_reg_info mlxsw_reg_sfn = { + .id =MLXSW_REG_SFN_ID , + .len =MLXSW_REG_SFN_LEN , +}; + +/* reg_sfn_swid +* Switch partition ID. +* Access: Index +*/ +MLXSW_ITEM32 (reg, sfn, swid,0x00 ,24 ,8 ); + +/* reg_sfn_num_rec +* Request: Number of learned notifications and aged-out notification +* records requested. +* Response: Number of notification records returned (must be smaller +* than or equal to the value requested) +* Ranges 0..64 +* Access: OP +*/ +MLXSW_ITEM32 (reg, sfn, num_rec,0x04 ,0 ,8 ); + +static inline void mlxsw_reg_sfn_pack (char *payload) +{ +MLXSW_REG_ZERO (sfn, payload); +mlxsw_reg_sfn_swid_set (payload,0 ); +mlxsw_reg_sfn_num_rec_set (payload,MLXSW_REG_SFN_REC_MAX_COUNT ); +} + +/* reg_sfn_rec_swid +* Switch partition ID. +* Access: RO +*/ +MLXSW_ITEM32_INDEXED (reg, sfn, rec_swid,MLXSW_REG_SFN_BASE_LEN ,24 ,8 , +MLXSW_REG_SFN_REC_LEN ,0x00 , false); + +enum mlxsw_reg_sfn_rec_type { +/* MAC addresses learned on a regular port. */ +MLXSW_REG_SFN_REC_TYPE_LEARNED_MAC =0x5 , +/* Aged-out MAC address on a regular port */ +MLXSW_REG_SFN_REC_TYPE_AGED_OUT_MAC =0x7 , +}; + +/* reg_sfn_rec_type +* Notification record type. +* Access: RO +*/ +MLXSW_ITEM32_INDEXED (reg, sfn, rec_type,MLXSW_REG_SFN_BASE_LEN ,20 ,4 , +MLXSW_REG_SFN_REC_LEN ,0x00 , false); + +/* reg_sfn_rec_mac +* MAC address. +* Access: RO +*/ +MLXSW_ITEM_BUF_INDEXED (reg, sfn, rec_mac,MLXSW_REG_SFN_BASE_LEN ,6 , +MLXSW_REG_SFN_REC_LEN ,0x02 ); + +/* reg_sfd_mac_sub_port +* VEPA channel on the local port. +* 0 if multichannel VEPA is not enabled. +* Access: RO +*/ +MLXSW_ITEM32_INDEXED (reg, sfn, mac_sub_port,MLXSW_REG_SFN_BASE_LEN ,16 ,8 , +MLXSW_REG_SFN_REC_LEN ,0x08 , false); + +/* reg_sfd_mac_fid +* Filtering identifier. +* Access: RO +*/ +MLXSW_ITEM32_INDEXED (reg, sfn, mac_fid,MLXSW_REG_SFN_BASE_LEN ,0 ,16 , +MLXSW_REG_SFN_REC_LEN ,0x08 , false); + +/* reg_sfd_mac_system_port +* Unique port identifier for the final destination of the packet. +* Access: RO +*/ +MLXSW_ITEM32_INDEXED (reg, sfn, mac_system_port,MLXSW_REG_SFN_BASE_LEN ,0 ,16 , +MLXSW_REG_SFN_REC_LEN ,0x0C , false); + +static inline void mlxsw_reg_sfn_mac_unpack (char *payload,int rec_index, +char *mac,u16 *p_vid, +u8 *p_local_port) +{ +mlxsw_reg_sfn_rec_mac_memcpy_from (payload, rec_index, mac); + *p_vid =mlxsw_reg_sfn_mac_fid_get (payload, rec_index); + *p_local_port =mlxsw_reg_sfn_mac_system_port_get (payload, rec_index); +} +/* SPMS - Switch Port MSTP/RSTP State Register * ------------------------------------------- * Configures the spanning tree state of a physical port.
@@ -1467,6 +1566,8 @@ static inline const char *mlxsw_reg_id_str(u16 reg_id)return "SSPR" ;case MLXSW_REG_SFD_ID :return "SFD" ; +case MLXSW_REG_SFN_ID : +return "SFN" ;case MLXSW_REG_SPMS_ID :return "SPMS" ;case MLXSW_REG_SFGC_ID :
Signature · 1 line
1.9.3
PATCH 9/16 mlxsw: reg: Add Switch Port VID and Switch Port VLAN Membership registers definitions
In reply to Jiri PirkoFrom: Elad Raz <[email protected]>
Add SPVID and SPVM registers responsible for default port VID configuration and VLAN membership of a port.
--- drivers/net/ethernet/mellanox/mlxsw/reg.h | 146 ++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+)
drivers/net/ethernet/mellanox/mlxsw/reg.h +146 -0
@@ -517,6 +517,148 @@ static inline void mlxsw_reg_spms_vid_pack(char *payload, u16 vid,mlxsw_reg_spms_state_set (payload, vid, state); } +/* SPVID - Switch Port VID +* ----------------------- +* The switch port VID configures the default VID for a port. +*/ +#define MLXSW_REG_SPVID_ID 0x200E +#define MLXSW_REG_SPVID_LEN 0x08 + +static const struct mlxsw_reg_info mlxsw_reg_spvid = { + .id =MLXSW_REG_SPVID_ID , + .len =MLXSW_REG_SPVID_LEN , +}; + +/* reg_spvid_local_port +* Local port number. +* Access: Index +*/ +MLXSW_ITEM32 (reg, spvid, local_port,0x00 ,16 ,8 ); + +/* reg_spvid_sub_port +* Virtual port within the physical port. +* Should be set to 0 when virtual ports are not enabled on the port. +* Access: Index +*/ +MLXSW_ITEM32 (reg, spvid, sub_port,0x00 ,8 ,8 ); + +/* reg_spvid_pvid +* Port default VID +* Access: RW +*/ +MLXSW_ITEM32 (reg, spvid, pvid,0x04 ,0 ,12 ); + +static inline void mlxsw_reg_spvid_pack (char *payload,u8 local_port,u16 pvid) +{ +MLXSW_REG_ZERO (spvid, payload); +mlxsw_reg_spvid_local_port_set (payload, local_port); +mlxsw_reg_spvid_pvid_set (payload, pvid); +} + +/* SPVM - Switch Port VLAN Membership +* ---------------------------------- +* The Switch Port VLAN Membership register configures the VLAN membership +* of a port in a VLAN denoted by VID. VLAN membership is managed per +* virtual port. The register can be used to add and remove VID(s) from a port. +*/ +#define MLXSW_REG_SPVM_ID 0x200F +#define MLXSW_REG_SPVM_BASE_LEN 0x04/* base length, without records */ +#define MLXSW_REG_SPVM_REC_LEN 0x04/* record length */ +#define MLXSW_REG_SPVM_REC_MAX_COUNT 256 +#define MLXSW_REG_SPVM_LEN (MLXSW_REG_SPVM_BASE_LEN + \ + MLXSW_REG_SPVM_REC_LEN * MLXSW_REG_SPVM_REC_MAX_COUNT) + +static const struct mlxsw_reg_info mlxsw_reg_spvm = { + .id =MLXSW_REG_SPVM_ID , + .len =MLXSW_REG_SPVM_LEN , +}; + +/* reg_spvm_pt +* Priority tagged. If this bit is set, packets forwarded to the port with +* untagged VLAN membership (u bit is set) will be tagged with priority tag +* (VID=0) +* Access: RW +*/ +MLXSW_ITEM32 (reg, spvm, pt,0x00 ,31 ,1 ); + +/* reg_spvm_pte +* Priority Tagged Update Enable. On Write operations, if this bit is cleared, +* the pt bit will NOT be updated. To update the pt bit, pte must be set. +* Access: WO +*/ +MLXSW_ITEM32 (reg, spvm, pte,0x00 ,30 ,1 ); + +/* reg_spvm_local_port +* Local port number. +* Access: Index +*/ +MLXSW_ITEM32 (reg, spvm, local_port,0x00 ,16 ,8 ); + +/* reg_spvm_sub_port +* Virtual port within the physical port. +* Should be set to 0 when virtual ports are not enabled on the port. +* Access: Index +*/ +MLXSW_ITEM32 (reg, spvm, sub_port,0x00 ,8 ,8 ); + +/* reg_spvm_num_rec +* Number of records to update. Each record contains: i, e, u, vid. +* Access: OP +*/ +MLXSW_ITEM32 (reg, spvm, num_rec,0x00 ,0 ,8 ); + +/* reg_spvm_rec_i +* Ingress membership in VLAN ID. +* Access: Index +*/ +MLXSW_ITEM32_INDEXED (reg, spvm, rec_i, +MLXSW_REG_SPVM_BASE_LEN ,14 ,1 , +MLXSW_REG_SPVM_REC_LEN ,0 , false); + +/* reg_spvm_rec_e +* Egress membership in VLAN ID. +* Access: Index +*/ +MLXSW_ITEM32_INDEXED (reg, spvm, rec_e, +MLXSW_REG_SPVM_BASE_LEN ,13 ,1 , +MLXSW_REG_SPVM_REC_LEN ,0 , false); + +/* reg_spvm_rec_u +* Untagged - port is an untagged member - egress transmission uses untagged +* frames on VID<n> +* Access: Index +*/ +MLXSW_ITEM32_INDEXED (reg, spvm, rec_u, +MLXSW_REG_SPVM_BASE_LEN ,12 ,1 , +MLXSW_REG_SPVM_REC_LEN ,0 , false); + +/* reg_spvm_rec_vid +* Egress membership in VLAN ID. +* Access: Index +*/ +MLXSW_ITEM32_INDEXED (reg, spvm, rec_vid, +MLXSW_REG_SPVM_BASE_LEN ,0 ,12 , +MLXSW_REG_SPVM_REC_LEN ,0 , false); + +static inline void mlxsw_reg_spvm_pack (char *payload,u8 local_port, +u16 vid_begin,u16 vid_end, +bool is_member,bool untagged) +{ +int size = vid_end - vid_begin +1 ; +int i; + +MLXSW_REG_ZERO (spvm, payload); +mlxsw_reg_spvm_local_port_set (payload, local_port); +mlxsw_reg_spvm_num_rec_set (payload, size); + +for (i =0 ; i < size; i++) { +mlxsw_reg_spvm_rec_i_set (payload, i, is_member); +mlxsw_reg_spvm_rec_e_set (payload, i, is_member); +mlxsw_reg_spvm_rec_u_set (payload, i, untagged); +mlxsw_reg_spvm_rec_vid_set (payload, i, vid_begin + i); + } +} +/* SFGC - Switch Flooding Group Configuration * ------------------------------------------ * The following register controls the association of flooding tables and MIDs
@@ -1570,6 +1712,10 @@ static inline const char *mlxsw_reg_id_str(u16 reg_id)return "SFN" ;case MLXSW_REG_SPMS_ID :return "SPMS" ; +case MLXSW_REG_SPVID_ID : +return "SPVID" ; +case MLXSW_REG_SPVM_ID : +return "SPVM" ;case MLXSW_REG_SFGC_ID :return "SFGC" ;case MLXSW_REG_SFTR_ID :
Signature · 1 line
1.9.3
PATCH 10/16 mlxsw: reg: Add shared buffer configuration registers definitions
In reply to Jiri PirkoFrom: Jiri Pirko <[email protected]>
Add definitions of SBPR, SBCM, SBPM, SBMM and PBMC registers that are used to configure shared buffers.
--- drivers/net/ethernet/mellanox/mlxsw/reg.h | 349 ++++++++++++++++++++++++++++++ 1 file changed, 349 insertions(+)
drivers/net/ethernet/mellanox/mlxsw/reg.h +349 -0
@@ -1418,6 +1418,82 @@ static inline void mlxsw_reg_ppcnt_pack(char *payload, u8 local_port)mlxsw_reg_ppcnt_prio_tc_set (payload,0 ); } +/* PBMC - Port Buffer Management Control Register +* ---------------------------------------------- +* The PBMC register configures and retrieves the port packet buffer +* allocation for different Prios, and the Pause threshold management. +*/ +#define MLXSW_REG_PBMC_ID 0x500C +#define MLXSW_REG_PBMC_LEN 0x68 + +static const struct mlxsw_reg_info mlxsw_reg_pbmc = { + .id =MLXSW_REG_PBMC_ID , + .len =MLXSW_REG_PBMC_LEN , +}; + +/* reg_pbmc_local_port +* Local port number. +* Access: Index +*/ +MLXSW_ITEM32 (reg, pbmc, local_port,0x00 ,16 ,8 ); + +/* reg_pbmc_xoff_timer_value +* When device generates a pause frame, it uses this value as the pause +* timer (time for the peer port to pause in quota-512 bit time). +* Access: RW +*/ +MLXSW_ITEM32 (reg, pbmc, xoff_timer_value,0x04 ,16 ,16 ); + +/* reg_pbmc_xoff_refresh +* The time before a new pause frame should be sent to refresh the pause RW +* state. Using the same units as xoff_timer_value above (in quota-512 bit +* time). +* Access: RW +*/ +MLXSW_ITEM32 (reg, pbmc, xoff_refresh,0x04 ,0 ,16 ); + +/* reg_pbmc_buf_lossy +* The field indicates if the buffer is lossy. +* 0 - Lossless +* 1 - Lossy +* Access: RW +*/ +MLXSW_ITEM32_INDEXED (reg, pbmc, buf_lossy,0x0C ,25 ,1 ,0x08 ,0x00 , false); + +/* reg_pbmc_buf_epsb +* Eligible for Port Shared buffer. +* If epsb is set, packets assigned to buffer are allowed to insert the port +* shared buffer. +* When buf_lossy is MLXSW_REG_PBMC_LOSSY_LOSSY this field is reserved. +* Access: RW +*/ +MLXSW_ITEM32_INDEXED (reg, pbmc, buf_epsb,0x0C ,24 ,1 ,0x08 ,0x00 , false); + +/* reg_pbmc_buf_size +* The part of the packet buffer array is allocated for the specific buffer. +* Units are represented in cells. +* Access: RW +*/ +MLXSW_ITEM32_INDEXED (reg, pbmc, buf_size,0x0C ,0 ,16 ,0x08 ,0x00 , false); + +static inline void mlxsw_reg_pbmc_pack (char *payload,u8 local_port, +u16 xoff_timer_value,u16 xoff_refresh) +{ +MLXSW_REG_ZERO (pbmc, payload); +mlxsw_reg_pbmc_local_port_set (payload, local_port); +mlxsw_reg_pbmc_xoff_timer_value_set (payload, xoff_timer_value); +mlxsw_reg_pbmc_xoff_refresh_set (payload, xoff_refresh); +} + +static inline void mlxsw_reg_pbmc_lossy_buffer_pack (char *payload, +int buf_index, +u16 size) +{ +mlxsw_reg_pbmc_buf_lossy_set (payload, buf_index,1 ); +mlxsw_reg_pbmc_buf_epsb_set (payload, buf_index,0 ); +mlxsw_reg_pbmc_buf_size_set (payload, buf_index, size); +} +/* PSPA - Port Switch Partition Allocation * --------------------------------------- * Controls the association of a port with a switch partition and enables
@@ -1697,6 +1773,269 @@ static inline void mlxsw_reg_hpkt_pack(char *payload, u8 action, u16 trap_id)mlxsw_reg_hpkt_ctrl_set (payload,MLXSW_REG_HPKT_CTRL_PACKET_DEFAULT ); } +/* SBPR - Shared Buffer Pools Register +* ----------------------------------- +* The SBPR configures and retrieves the shared buffer pools and configuration. +*/ +#define MLXSW_REG_SBPR_ID 0xB001 +#define MLXSW_REG_SBPR_LEN 0x14 + +static const struct mlxsw_reg_info mlxsw_reg_sbpr = { + .id =MLXSW_REG_SBPR_ID , + .len =MLXSW_REG_SBPR_LEN , +}; + +enum mlxsw_reg_sbpr_dir { +MLXSW_REG_SBPR_DIR_INGRESS , +MLXSW_REG_SBPR_DIR_EGRESS , +}; + +/* reg_sbpr_dir +* Direction. +* Access: Index +*/ +MLXSW_ITEM32 (reg, sbpr, dir,0x00 ,24 ,2 ); + +/* reg_sbpr_pool +* Pool index. +* Access: Index +*/ +MLXSW_ITEM32 (reg, sbpr, pool,0x00 ,0 ,4 ); + +/* reg_sbpr_size +* Pool size in buffer cells. +* Access: RW +*/ +MLXSW_ITEM32 (reg, sbpr, size,0x04 ,0 ,24 ); + +enum mlxsw_reg_sbpr_mode { +MLXSW_REG_SBPR_MODE_STATIC , +MLXSW_REG_SBPR_MODE_DYNAMIC , +}; + +/* reg_sbpr_mode +* Pool quota calculation mode. +* Access: RW +*/ +MLXSW_ITEM32 (reg, sbpr, mode,0x08 ,0 ,4 ); + +static inline void mlxsw_reg_sbpr_pack (char *payload,u8 pool, +enum mlxsw_reg_sbpr_dir dir, +enum mlxsw_reg_sbpr_mode mode,u32 size) +{ +MLXSW_REG_ZERO (sbpr, payload); +mlxsw_reg_sbpr_pool_set (payload, pool); +mlxsw_reg_sbpr_dir_set (payload, dir); +mlxsw_reg_sbpr_mode_set (payload, mode); +mlxsw_reg_sbpr_size_set (payload, size); +} + +/* SBCM - Shared Buffer Class Management Register +* ---------------------------------------------- +* The SBCM register configures and retrieves the shared buffer allocation +* and configuration according to Port-PG, including the binding to pool +* and definition of the associated quota. +*/ +#define MLXSW_REG_SBCM_ID 0xB002 +#define MLXSW_REG_SBCM_LEN 0x28 + +static const struct mlxsw_reg_info mlxsw_reg_sbcm = { + .id =MLXSW_REG_SBCM_ID , + .len =MLXSW_REG_SBCM_LEN , +}; + +/* reg_sbcm_local_port +* Local port number. +* For Ingress: excludes CPU port and Router port +* For Egress: excludes IP Router +* Access: Index +*/ +MLXSW_ITEM32 (reg, sbcm, local_port,0x00 ,16 ,8 ); + +/* reg_sbcm_pg_buff +* PG buffer - Port PG (dir=ingress) / traffic class (dir=egress) +* For PG buffer: range is 0..cap_max_pg_buffers - 1 +* For traffic class: range is 0..cap_max_tclass - 1 +* Note that when traffic class is in MC aware mode then the traffic +* classes which are MC aware cannot be configured. +* Access: Index +*/ +MLXSW_ITEM32 (reg, sbcm, pg_buff,0x00 ,8 ,6 ); + +enum mlxsw_reg_sbcm_dir { +MLXSW_REG_SBCM_DIR_INGRESS , +MLXSW_REG_SBCM_DIR_EGRESS , +}; + +/* reg_sbcm_dir +* Direction. +* Access: Index +*/ +MLXSW_ITEM32 (reg, sbcm, dir,0x00 ,0 ,2 ); + +/* reg_sbcm_min_buff +* Minimum buffer size for the limiter, in cells. +* Access: RW +*/ +MLXSW_ITEM32 (reg, sbcm, min_buff,0x18 ,0 ,24 ); + +/* reg_sbcm_max_buff +* When the pool associated to the port-pg/tclass is configured to +* static, Maximum buffer size for the limiter configured in cells. +* When the pool associated to the port-pg/tclass is configured to +* dynamic, the max_buff holds the "alpha" parameter, supporting +* the following values: +* 0: 0 +* i: (1/128)*2^(i-1), for i=1..14 +* 0xFF: Infinity +* Access: RW +*/ +MLXSW_ITEM32 (reg, sbcm, max_buff,0x1C ,0 ,24 ); + +/* reg_sbcm_pool +* Association of the port-priority to a pool. +* Access: RW +*/ +MLXSW_ITEM32 (reg, sbcm, pool,0x24 ,0 ,4 ); + +static inline void mlxsw_reg_sbcm_pack (char *payload,u8 local_port,u8 pg_buff, +enum mlxsw_reg_sbcm_dir dir, +u32 min_buff,u32 max_buff,u8 pool) +{ +MLXSW_REG_ZERO (sbcm, payload); +mlxsw_reg_sbcm_local_port_set (payload, local_port); +mlxsw_reg_sbcm_pg_buff_set (payload, pg_buff); +mlxsw_reg_sbcm_dir_set (payload, dir); +mlxsw_reg_sbcm_min_buff_set (payload, min_buff); +mlxsw_reg_sbcm_max_buff_set (payload, max_buff); +mlxsw_reg_sbcm_pool_set (payload, pool); +} + +/* SBPM - Shared Buffer Class Management Register +* ---------------------------------------------- +* The SBPM register configures and retrieves the shared buffer allocation +* and configuration according to Port-Pool, including the definition +* of the associated quota. +*/ +#define MLXSW_REG_SBPM_ID 0xB003 +#define MLXSW_REG_SBPM_LEN 0x28 + +static const struct mlxsw_reg_info mlxsw_reg_sbpm = { + .id =MLXSW_REG_SBPM_ID , + .len =MLXSW_REG_SBPM_LEN , +}; + +/* reg_sbpm_local_port +* Local port number. +* For Ingress: excludes CPU port and Router port +* For Egress: excludes IP Router +* Access: Index +*/ +MLXSW_ITEM32 (reg, sbpm, local_port,0x00 ,16 ,8 ); + +/* reg_sbpm_pool +* The pool associated to quota counting on the local_port. +* Access: Index +*/ +MLXSW_ITEM32 (reg, sbpm, pool,0x00 ,8 ,4 ); + +enum mlxsw_reg_sbpm_dir { +MLXSW_REG_SBPM_DIR_INGRESS , +MLXSW_REG_SBPM_DIR_EGRESS , +}; + +/* reg_sbpm_dir +* Direction. +* Access: Index +*/ +MLXSW_ITEM32 (reg, sbpm, dir,0x00 ,0 ,2 ); + +/* reg_sbpm_min_buff +* Minimum buffer size for the limiter, in cells. +* Access: RW +*/ +MLXSW_ITEM32 (reg, sbpm, min_buff,0x18 ,0 ,24 ); + +/* reg_sbpm_max_buff +* When the pool associated to the port-pg/tclass is configured to +* static, Maximum buffer size for the limiter configured in cells. +* When the pool associated to the port-pg/tclass is configured to +* dynamic, the max_buff holds the "alpha" parameter, supporting +* the following values: +* 0: 0 +* i: (1/128)*2^(i-1), for i=1..14 +* 0xFF: Infinity +* Access: RW +*/ +MLXSW_ITEM32 (reg, sbpm, max_buff,0x1C ,0 ,24 ); + +static inline void mlxsw_reg_sbpm_pack (char *payload,u8 local_port,u8 pool, +enum mlxsw_reg_sbpm_dir dir, +u32 min_buff,u32 max_buff) +{ +MLXSW_REG_ZERO (sbpm, payload); +mlxsw_reg_sbpm_local_port_set (payload, local_port); +mlxsw_reg_sbpm_pool_set (payload, pool); +mlxsw_reg_sbpm_dir_set (payload, dir); +mlxsw_reg_sbpm_min_buff_set (payload, min_buff); +mlxsw_reg_sbpm_max_buff_set (payload, max_buff); +} + +/* SBMM - Shared Buffer Multicast Management Register +* -------------------------------------------------- +* The SBMM register configures and retrieves the shared buffer allocation +* and configuration for MC packets according to Switch-Priority, including +* the binding to pool and definition of the associated quota. +*/ +#define MLXSW_REG_SBMM_ID 0xB004 +#define MLXSW_REG_SBMM_LEN 0x28 + +static const struct mlxsw_reg_info mlxsw_reg_sbmm = { + .id =MLXSW_REG_SBMM_ID , + .len =MLXSW_REG_SBMM_LEN , +}; + +/* reg_sbmm_prio +* Switch Priority. +* Access: Index +*/ +MLXSW_ITEM32 (reg, sbmm, prio,0x00 ,8 ,4 ); + +/* reg_sbmm_min_buff +* Minimum buffer size for the limiter, in cells. +* Access: RW +*/ +MLXSW_ITEM32 (reg, sbmm, min_buff,0x18 ,0 ,24 ); + +/* reg_sbmm_max_buff +* When the pool associated to the port-pg/tclass is configured to +* static, Maximum buffer size for the limiter configured in cells. +* When the pool associated to the port-pg/tclass is configured to +* dynamic, the max_buff holds the "alpha" parameter, supporting +* the following values: +* 0: 0 +* i: (1/128)*2^(i-1), for i=1..14 +* 0xFF: Infinity +* Access: RW +*/ +MLXSW_ITEM32 (reg, sbmm, max_buff,0x1C ,0 ,24 ); + +/* reg_sbmm_pool +* Association of the port-priority to a pool. +* Access: RW +*/ +MLXSW_ITEM32 (reg, sbmm, pool,0x24 ,0 ,4 ); + +static inline void mlxsw_reg_sbmm_pack (char *payload,u8 prio,u32 min_buff, +u32 max_buff,u8 pool) +{ +MLXSW_REG_ZERO (sbmm, payload); +mlxsw_reg_sbmm_prio_set (payload, prio); +mlxsw_reg_sbmm_min_buff_set (payload, min_buff); +mlxsw_reg_sbmm_max_buff_set (payload, max_buff); +mlxsw_reg_sbmm_pool_set (payload, pool); +} +static inline const char *mlxsw_reg_id_str (u16 reg_id) {switch (reg_id) {
@@ -1734,12 +2073,22 @@ static inline const char *mlxsw_reg_id_str(u16 reg_id)return "PAOS" ;case MLXSW_REG_PPCNT_ID :return "PPCNT" ; +case MLXSW_REG_PBMC_ID : +return "PBMC" ;case MLXSW_REG_PSPA_ID :return "PSPA" ;case MLXSW_REG_HTGT_ID :return "HTGT" ;case MLXSW_REG_HPKT_ID :return "HPKT" ; +case MLXSW_REG_SBPR_ID : +return "SBPR" ; +case MLXSW_REG_SBCM_ID : +return "SBCM" ; +case MLXSW_REG_SBPM_ID : +return "SBPM" ; +case MLXSW_REG_SBMM_ID : +return "SBMM" ;default :return "*UNKNOWN*" ; }
Signature · 1 line
1.9.3
PATCH 11/16 mlxsw: reg: Add Switch FID Management register definition
In reply to Jiri PirkoFrom: Ido Schimmel <[email protected]>
Filtering identifiers (FIDs) are unique identifers of bridge instances in the hardware.
Add the SFMR register, which is responsible for the creation and configuration of these FIDs.
--- drivers/net/ethernet/mellanox/mlxsw/reg.h | 87 +++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+)
drivers/net/ethernet/mellanox/mlxsw/reg.h +87 -0
@@ -883,6 +883,91 @@ static inline void mlxsw_reg_spmlr_pack(char *payload, u8 local_port,mlxsw_reg_spmlr_learn_mode_set (payload, mode); } +/* SFMR - Switch FID Management Register +* ------------------------------------- +* Creates and configures FIDs. +*/ +#define MLXSW_REG_SFMR_ID 0x201F +#define MLXSW_REG_SFMR_LEN 0x18 + +static const struct mlxsw_reg_info mlxsw_reg_sfmr = { + .id =MLXSW_REG_SFMR_ID , + .len =MLXSW_REG_SFMR_LEN , +}; + +enum mlxsw_reg_sfmr_op { +MLXSW_REG_SFMR_OP_CREATE_FID , +MLXSW_REG_SFMR_OP_DESTROY_FID , +}; + +/* reg_sfmr_op +* Operation. +* 0 - Create or edit FID. +* 1 - Destroy FID. +* Access: WO +*/ +MLXSW_ITEM32 (reg, sfmr, op,0x00 ,24 ,4 ); + +/* reg_sfmr_fid +* Filtering ID. +* Access: Index +*/ +MLXSW_ITEM32 (reg, sfmr, fid,0x00 ,0 ,16 ); + +/* reg_sfmr_fid_offset +* FID offset. +* Used to point into the flooding table selected by SFGC register if +* the table is of type FID-Offset. Otherwise, this field is reserved. +* Access: RW +*/ +MLXSW_ITEM32 (reg, sfmr, fid_offset,0x08 ,0 ,16 ); + +/* reg_sfmr_vtfp +* Valid Tunnel Flood Pointer. +* If not set, then nve_tunnel_flood_ptr is reserved and considered NULL. +* Access: RW +* +* Note: Reserved for 802.1Q FIDs. +*/ +MLXSW_ITEM32 (reg, sfmr, vtfp,0x0C ,31 ,1 ); + +/* reg_sfmr_nve_tunnel_flood_ptr +* Underlay Flooding and BC Pointer. +* Used as a pointer to the first entry of the group based link lists of +* flooding or BC entries (for NVE tunnels). +* Access: RW +*/ +MLXSW_ITEM32 (reg, sfmr, nve_tunnel_flood_ptr,0x0C ,0 ,24 ); + +/* reg_sfmr_vv +* VNI Valid. +* If not set, then vni is reserved. +* Access: RW +* +* Note: Reserved for 802.1Q FIDs. +*/ +MLXSW_ITEM32 (reg, sfmr, vv,0x10 ,31 ,1 ); + +/* reg_sfmr_vni +* Virtual Network Identifier. +* Access: RW +* +* Note: A given VNI can only be assigned to one FID. +*/ +MLXSW_ITEM32 (reg, sfmr, vni,0x10 ,0 ,24 ); + +static inline void mlxsw_reg_sfmr_pack (char *payload, +enum mlxsw_reg_sfmr_op op,u16 fid, +u16 fid_offset) +{ +MLXSW_REG_ZERO (sfmr, payload); +mlxsw_reg_sfmr_op_set (payload, op); +mlxsw_reg_sfmr_fid_set (payload, fid); +mlxsw_reg_sfmr_fid_offset_set (payload, fid_offset); +mlxsw_reg_sfmr_vtfp_set (payload, false); +mlxsw_reg_sfmr_vv_set (payload, false); +} +/* PMLP - Ports Module to Local Port Register * ------------------------------------------ * Configures the assignment of modules to local ports.
@@ -2061,6 +2146,8 @@ static inline const char *mlxsw_reg_id_str(u16 reg_id)return "SFTR" ;case MLXSW_REG_SPMLR_ID :return "SPMLR" ; +case MLXSW_REG_SFMR_ID : +return "SFMR" ;case MLXSW_REG_PMLP_ID :return "PMLP" ;case MLXSW_REG_PMTU_ID :
Signature · 1 line
1.9.3
PATCH 12/16 mlxsw: reg: Add Switch VID to FID Allocation register definition
In reply to Jiri PirkoFrom: Ido Schimmel <[email protected]>
An incoming packet can be classified into a filtering identifer (FID) based on its VID or incoming port and VID ({Port, VID}).
Add the SVFA register, which controls this mapping.
--- drivers/net/ethernet/mellanox/mlxsw/reg.h | 95 +++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+)
drivers/net/ethernet/mellanox/mlxsw/reg.h +95 -0
@@ -883,6 +883,99 @@ static inline void mlxsw_reg_spmlr_pack(char *payload, u8 local_port,mlxsw_reg_spmlr_learn_mode_set (payload, mode); } +/* SVFA - Switch VID to FID Allocation Register +* -------------------------------------------- +* Controls the VID to FID mapping and {Port, VID} to FID mapping for +* virtualized ports. +*/ +#define MLXSW_REG_SVFA_ID 0x201C +#define MLXSW_REG_SVFA_LEN 0x10 + +static const struct mlxsw_reg_info mlxsw_reg_svfa = { + .id =MLXSW_REG_SVFA_ID , + .len =MLXSW_REG_SVFA_LEN , +}; + +/* reg_svfa_swid +* Switch partition ID. +* Access: Index +*/ +MLXSW_ITEM32 (reg, svfa, swid,0x00 ,24 ,8 ); + +/* reg_svfa_local_port +* Local port number. +* Access: Index +* +* Note: Reserved for 802.1Q FIDs. +*/ +MLXSW_ITEM32 (reg, svfa, local_port,0x00 ,16 ,8 ); + +enum mlxsw_reg_svfa_mt { +MLXSW_REG_SVFA_MT_VID_TO_FID , +MLXSW_REG_SVFA_MT_PORT_VID_TO_FID , +}; + +/* reg_svfa_mapping_table +* Mapping table: +* 0 - VID to FID +* 1 - {Port, VID} to FID +* Access: Index +* +* Note: Reserved for SwitchX-2. +*/ +MLXSW_ITEM32 (reg, svfa, mapping_table,0x00 ,8 ,3 ); + +/* reg_svfa_v +* Valid. +* Valid if set. +* Access: RW +* +* Note: Reserved for SwitchX-2. +*/ +MLXSW_ITEM32 (reg, svfa, v,0x00 ,0 ,1 ); + +/* reg_svfa_fid +* Filtering ID. +* Access: RW +*/ +MLXSW_ITEM32 (reg, svfa, fid,0x04 ,16 ,16 ); + +/* reg_svfa_vid +* VLAN ID. +* Access: Index +*/ +MLXSW_ITEM32 (reg, svfa, vid,0x04 ,0 ,12 ); + +/* reg_svfa_counter_set_type +* Counter set type for flow counters. +* Access: RW +* +* Note: Reserved for SwitchX-2. +*/ +MLXSW_ITEM32 (reg, svfa, counter_set_type,0x08 ,24 ,8 ); + +/* reg_svfa_counter_index +* Counter index for flow counters. +* Access: RW +* +* Note: Reserved for SwitchX-2. +*/ +MLXSW_ITEM32 (reg, svfa, counter_index,0x08 ,0 ,24 ); + +static inline void mlxsw_reg_svfa_pack (char *payload,u8 local_port, +enum mlxsw_reg_svfa_mt mt,bool valid, +u16 fid,u16 vid) +{ +MLXSW_REG_ZERO (svfa, payload); + local_port = mt ==MLXSW_REG_SVFA_MT_VID_TO_FID ?0 : local_port; +mlxsw_reg_svfa_swid_set (payload,0 ); +mlxsw_reg_svfa_local_port_set (payload, local_port); +mlxsw_reg_svfa_mapping_table_set (payload, mt); +mlxsw_reg_svfa_v_set (payload, valid); +mlxsw_reg_svfa_fid_set (payload, fid); +mlxsw_reg_svfa_vid_set (payload, vid); +} +/* SFMR - Switch FID Management Register * ------------------------------------- * Creates and configures FIDs.
@@ -2146,6 +2239,8 @@ static inline const char *mlxsw_reg_id_str(u16 reg_id)return "SFTR" ;case MLXSW_REG_SPMLR_ID :return "SPMLR" ; +case MLXSW_REG_SVFA_ID : +return "SVFA" ;case MLXSW_REG_SFMR_ID :return "SFMR" ;case MLXSW_REG_PMLP_ID :
Signature · 1 line
1.9.3
PATCH 13/16 mlxsw: reg: Add Switch Virtual-Port Enabling register definition
In reply to Jiri PirkoFrom: Ido Schimmel <[email protected]>
In order for a port to support {Port, VID} to FID mapping it needs to be configured to a virtual port mode (as opposed to VLAN mode).
Add the SVPE register, which enables port virtualization.
--- drivers/net/ethernet/mellanox/mlxsw/reg.h | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
drivers/net/ethernet/mellanox/mlxsw/reg.h +38 -0
@@ -976,6 +976,42 @@ static inline void mlxsw_reg_svfa_pack(char *payload, u8 local_port,mlxsw_reg_svfa_vid_set (payload, vid); } +/* SVPE - Switch Virtual-Port Enabling Register +* -------------------------------------------- +* Enables port virtualization. +*/ +#define MLXSW_REG_SVPE_ID 0x201E +#define MLXSW_REG_SVPE_LEN 0x4 + +static const struct mlxsw_reg_info mlxsw_reg_svpe = { + .id =MLXSW_REG_SVPE_ID , + .len =MLXSW_REG_SVPE_LEN , +}; + +/* reg_svpe_local_port +* Local port number +* Access: Index +* +* Note: CPU port is not supported (uses VLAN mode only). +*/ +MLXSW_ITEM32 (reg, svpe, local_port,0x00 ,16 ,8 ); + +/* reg_svpe_vp_en +* Virtual port enable. +* 0 - Disable, VLAN mode (VID to FID). +* 1 - Enable, Virtual port mode ({Port, VID} to FID). +* Access: RW +*/ +MLXSW_ITEM32 (reg, svpe, vp_en,0x00 ,8 ,1 ); + +static inline void mlxsw_reg_svpe_pack (char *payload,u8 local_port, +bool enable) +{ +MLXSW_REG_ZERO (svpe, payload); +mlxsw_reg_svpe_local_port_set (payload, local_port); +mlxsw_reg_svpe_vp_en_set (payload, enable); +} +/* SFMR - Switch FID Management Register * ------------------------------------- * Creates and configures FIDs.
@@ -2241,6 +2277,8 @@ static inline const char *mlxsw_reg_id_str(u16 reg_id)return "SPMLR" ;case MLXSW_REG_SVFA_ID :return "SVFA" ; +case MLXSW_REG_SVPE_ID : +return "SVPE" ;case MLXSW_REG_SFMR_ID :return "SFMR" ;case MLXSW_REG_PMLP_ID :
Signature · 1 line
1.9.3
PATCH 14/16 mlxsw: reg: Add Switch Filtering Database Aging Time register definition
In reply to Jiri PirkoFrom: Jiri Pirko <[email protected]>
Add SFDAT which is used to control switch ageing time.
--- drivers/net/ethernet/mellanox/mlxsw/reg.h | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
drivers/net/ethernet/mellanox/mlxsw/reg.h +37 -0
@@ -157,6 +157,41 @@ static inline void mlxsw_reg_sspr_pack(char *payload, u8 local_port)mlxsw_reg_sspr_system_port_set (payload, local_port); } +/* SFDAT - Switch Filtering Database Aging Time +* -------------------------------------------- +* Controls the Switch aging time. Aging time is able to be set per Switch +* Partition. +*/ +#define MLXSW_REG_SFDAT_ID 0x2009 +#define MLXSW_REG_SFDAT_LEN 0x8 + +static const struct mlxsw_reg_info mlxsw_reg_sfdat = { + .id =MLXSW_REG_SFDAT_ID , + .len =MLXSW_REG_SFDAT_LEN , +}; + +/* reg_sfdat_swid +* Switch partition ID. +* Access: Index +*/ +MLXSW_ITEM32 (reg, sfdat, swid,0x00 ,24 ,8 ); + +/* reg_sfdat_age_time +* Aging time in seconds +* Min - 10 seconds +* Max - 1,000,000 seconds +* Default is 300 seconds. +* Access: RW +*/ +MLXSW_ITEM32 (reg, sfdat, age_time,0x04 ,0 ,20 ); + +static inline void mlxsw_reg_sfdat_pack (char *payload,u32 age_time) +{ +MLXSW_REG_ZERO (sfdat, payload); +mlxsw_reg_sfdat_swid_set (payload,0 ); +mlxsw_reg_sfdat_age_time_set (payload, age_time); +} +/* SFD - Switch Filtering Database * ------------------------------- * The following register defines the access to the filtering database.
@@ -2259,6 +2294,8 @@ static inline const char *mlxsw_reg_id_str(u16 reg_id)return "SPAD" ;case MLXSW_REG_SSPR_ID :return "SSPR" ; +case MLXSW_REG_SFDAT_ID : +return "SFDAT" ;case MLXSW_REG_SFD_ID :return "SFD" ;case MLXSW_REG_SFN_ID :
Signature · 1 line
1.9.3
PATCH 15/16 mlxsw: reg: Add Switch Port VLAN MAC Learning register definition
In reply to Jiri PirkoFrom: Ido Schimmel <[email protected]>
Since we currently do not support the offloading of 802.1D bridges, we need to be able to let the device know it should not learn MAC addresses on specific {Port, VID} pairs.
Add the SPVMLR register, which controls the learning enablement of {Port, VID} pairs.
--- drivers/net/ethernet/mellanox/mlxsw/reg.h | 67 +++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+)
drivers/net/ethernet/mellanox/mlxsw/reg.h +67 -0
@@ -1132,6 +1132,71 @@ static inline void mlxsw_reg_sfmr_pack(char *payload,mlxsw_reg_sfmr_vv_set (payload, false); } +/* SPVMLR - Switch Port VLAN MAC Learning Register +* ----------------------------------------------- +* Controls the switch MAC learning policy per {Port, VID}. +*/ +#define MLXSW_REG_SPVMLR_ID 0x2020 +#define MLXSW_REG_SPVMLR_BASE_LEN 0x04/* base length, without records */ +#define MLXSW_REG_SPVMLR_REC_LEN 0x04/* record length */ +#define MLXSW_REG_SPVMLR_REC_MAX_COUNT 256 +#define MLXSW_REG_SPVMLR_LEN (MLXSW_REG_SPVMLR_BASE_LEN + \ + MLXSW_REG_SPVMLR_REC_LEN * \ + MLXSW_REG_SPVMLR_REC_MAX_COUNT) + +static const struct mlxsw_reg_info mlxsw_reg_spvmlr = { + .id =MLXSW_REG_SPVMLR_ID , + .len =MLXSW_REG_SPVMLR_LEN , +}; + +/* reg_spvmlr_local_port +* Local ingress port. +* Access: Index +* +* Note: CPU port is not supported. +*/ +MLXSW_ITEM32 (reg, spvmlr, local_port,0x00 ,16 ,8 ); + +/* reg_spvmlr_num_rec +* Number of records to update. +* Access: OP +*/ +MLXSW_ITEM32 (reg, spvmlr, num_rec,0x00 ,0 ,8 ); + +/* reg_spvmlr_rec_learn_enable +* 0 - Disable learning for {Port, VID}. +* 1 - Enable learning for {Port, VID}. +* Access: RW +*/ +MLXSW_ITEM32_INDEXED (reg, spvmlr, rec_learn_enable,MLXSW_REG_SPVMLR_BASE_LEN , +31 ,1 ,MLXSW_REG_SPVMLR_REC_LEN ,0x00 , false); + +/* reg_spvmlr_rec_vid +* VLAN ID to be added/removed from port or for querying. +* Access: Index +*/ +MLXSW_ITEM32_INDEXED (reg, spvmlr, rec_vid,MLXSW_REG_SPVMLR_BASE_LEN ,0 ,12 , +MLXSW_REG_SPVMLR_REC_LEN ,0x00 , false); + +static inline void mlxsw_reg_spvmlr_pack (char *payload,u8 local_port, +u16 vid_begin,u16 vid_end, +bool learn_enable) +{ +int num_rec = vid_end - vid_begin +1 ; +int i; + +WARN_ON (num_rec <1 || num_rec >MLXSW_REG_SPVMLR_REC_MAX_COUNT ); + +MLXSW_REG_ZERO (spvmlr, payload); +mlxsw_reg_spvmlr_local_port_set (payload, local_port); +mlxsw_reg_spvmlr_num_rec_set (payload, num_rec); + +for (i =0 ; i < num_rec; i++) { +mlxsw_reg_spvmlr_rec_learn_enable_set (payload, i, learn_enable); +mlxsw_reg_spvmlr_rec_vid_set (payload, i, vid_begin + i); + } +} +/* PMLP - Ports Module to Local Port Register * ------------------------------------------ * Configures the assignment of modules to local ports.
@@ -2318,6 +2383,8 @@ static inline const char *mlxsw_reg_id_str(u16 reg_id)return "SVPE" ;case MLXSW_REG_SFMR_ID :return "SFMR" ; +case MLXSW_REG_SPVMLR_ID : +return "SPVMLR" ;case MLXSW_REG_PMLP_ID :return "PMLP" ;case MLXSW_REG_PMTU_ID :
Signature · 1 line
1.9.3
PATCH 16/16 mlxsw: spectrum: Add initial support for Spectrum ASIC
In reply to Jiri PirkoFrom: Jiri Pirko <[email protected]>
Add support for new generation Mellanox Spectrum ASIC, 10/25/40/50 and 100Gb/s Ethernet Switch.
The initial driver implements bridge forwarding offload including bridge internal VLAN support, FDB static entries, FDB learning and HW ageing including their setup.
--- drivers/net/ethernet/mellanox/mlxsw/Kconfig | 11 + drivers/net/ethernet/mellanox/mlxsw/Makefile | 3 + drivers/net/ethernet/mellanox/mlxsw/core.h | 1 + drivers/net/ethernet/mellanox/mlxsw/pci.c | 3 + drivers/net/ethernet/mellanox/mlxsw/pci.h | 1 + drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 1948 ++++++++++++++++++++ drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 121 ++ .../net/ethernet/mellanox/mlxsw/spectrum_buffers.c | 422 +++++ .../ethernet/mellanox/mlxsw/spectrum_switchdev.c | 863 +++++++++ drivers/net/ethernet/mellanox/mlxsw/txheader.h | 1 + 10 files changed, 3374 insertions(+) create mode 100644 drivers/net/ethernet/mellanox/mlxsw/spectrum.c create mode 100644 drivers/net/ethernet/mellanox/mlxsw/spectrum.h create mode 100644 drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c create mode 100644 drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
drivers/net/ethernet/mellanox/mlxsw/Kconfig +11 -0
@@ -30,3 +30,14 @@ config MLXSW_SWITCHX2 To compile this driver as a module, choose M here: the module will be called mlxsw_switchx2. + +config MLXSW_SPECTRUM + tristate "Mellanox Technologies Spectrum support" + depends on MLXSW_CORE && NET_SWITCHDEV + default m + ---help--- + This driver supports Mellanox Technologies Spectrum Ethernet + Switch ASICs. + + To compile this driver as a module, choose M here: the + module will be called mlxsw_spectrum.
drivers/net/ethernet/mellanox/mlxsw/Makefile +3 -0
@@ -4,3 +4,6 @@ obj-$(CONFIG_MLXSW_PCI) += mlxsw_pci.o mlxsw_pci-objs := pci.o obj-$(CONFIG_MLXSW_SWITCHX2) += mlxsw_switchx2.o mlxsw_switchx2-objs := switchx2.o +obj-$(CONFIG_MLXSW_SPECTRUM) += mlxsw_spectrum.o +mlxsw_spectrum-objs := spectrum.o spectrum_buffers.o \ + spectrum_switchdev.o
drivers/net/ethernet/mellanox/mlxsw/core.h +1 -0
@@ -54,6 +54,7 @@ MODULE_ALIAS(MLXSW_MODULE_ALIAS_PREFIX kind)#define MLXSW_DEVICE_KIND_SWITCHX2 "switchx2" +#define MLXSW_DEVICE_KIND_SPECTRUM "spectrum"struct mlxsw_core ;struct mlxsw_driver ;
drivers/net/ethernet/mellanox/mlxsw/pci.c +3 -0
@@ -57,6 +57,7 @@ static const char mlxsw_pci_driver_name[] = "mlxsw_pci";static const struct pci_device_id mlxsw_pci_id_table[] = { {PCI_VDEVICE (MELLANOX ,PCI_DEVICE_ID_MELLANOX_SWITCHX2 ),0 }, + {PCI_VDEVICE (MELLANOX ,PCI_DEVICE_ID_MELLANOX_SPECTRUM ),0 }, {0 , } };
@@ -67,6 +68,8 @@ static const char *mlxsw_pci_device_kind_get(const struct pci_device_id *id)switch (id->device) {case PCI_DEVICE_ID_MELLANOX_SWITCHX2 :return MLXSW_DEVICE_KIND_SWITCHX2 ; +case PCI_DEVICE_ID_MELLANOX_SPECTRUM : +return MLXSW_DEVICE_KIND_SPECTRUM ;default :BUG (); }
drivers/net/ethernet/mellanox/mlxsw/pci.h +1 -0
@@ -40,6 +40,7 @@#include "item.h" #define PCI_DEVICE_ID_MELLANOX_SWITCHX2 0xc738 +#define PCI_DEVICE_ID_MELLANOX_SPECTRUM 0xcb84#define MLXSW_PCI_BAR0_SIZE (1024 * 1024)/* 1MB */ #define MLXSW_PCI_PAGE_SIZE 4096
drivers/net/ethernet/mellanox/mlxsw/spectrum.c new file +1948 -0
1,948 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlxsw/spectrum.h new file +121 -0
121 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c new file +422 -0
422 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c new file +863 -0
460 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlxsw/txheader.h +1 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.9.3
Part of the diff is not shown here. View the raw message.
David Miller
maintainerFrom: Jiri Pirko <[email protected]>
Date: Fri, 16 Oct 2015 14:01:21 +0200
Quoted 7 lines
Purpose of this patchset is to introduce initial support for Mellanox Spectrum ASIC, including L2 bridge forwarding offload.
The only non-mlxsw patch in this patchset is the first one, introducing pre-change upper notifier. That is used in last patch to ensure ports of single ASIC are not bridged into multiple bridges, as that scenario is currently not supported by driver.
This looks fine, series applied, thanks!