forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/drivers/net/ethernet/mellanox/mlxsw/reg.h
....@@ -295,6 +295,7 @@
295295 MLXSW_REG_SFD_REC_TYPE_UNICAST = 0x0,
296296 MLXSW_REG_SFD_REC_TYPE_UNICAST_LAG = 0x1,
297297 MLXSW_REG_SFD_REC_TYPE_MULTICAST = 0x2,
298
+ MLXSW_REG_SFD_REC_TYPE_UNICAST_TUNNEL = 0xC,
298299 };
299300
300301 /* reg_sfd_rec_type
....@@ -525,6 +526,61 @@
525526 mlxsw_reg_sfd_mc_mid_set(payload, rec_index, mid);
526527 }
527528
529
+/* reg_sfd_uc_tunnel_uip_msb
530
+ * When protocol is IPv4, the most significant byte of the underlay IPv4
531
+ * destination IP.
532
+ * When protocol is IPv6, reserved.
533
+ * Access: RW
534
+ */
535
+MLXSW_ITEM32_INDEXED(reg, sfd, uc_tunnel_uip_msb, MLXSW_REG_SFD_BASE_LEN, 24,
536
+ 8, MLXSW_REG_SFD_REC_LEN, 0x08, false);
537
+
538
+/* reg_sfd_uc_tunnel_fid
539
+ * Filtering ID.
540
+ * Access: Index
541
+ */
542
+MLXSW_ITEM32_INDEXED(reg, sfd, uc_tunnel_fid, MLXSW_REG_SFD_BASE_LEN, 0, 16,
543
+ MLXSW_REG_SFD_REC_LEN, 0x08, false);
544
+
545
+enum mlxsw_reg_sfd_uc_tunnel_protocol {
546
+ MLXSW_REG_SFD_UC_TUNNEL_PROTOCOL_IPV4,
547
+ MLXSW_REG_SFD_UC_TUNNEL_PROTOCOL_IPV6,
548
+};
549
+
550
+/* reg_sfd_uc_tunnel_protocol
551
+ * IP protocol.
552
+ * Access: RW
553
+ */
554
+MLXSW_ITEM32_INDEXED(reg, sfd, uc_tunnel_protocol, MLXSW_REG_SFD_BASE_LEN, 27,
555
+ 1, MLXSW_REG_SFD_REC_LEN, 0x0C, false);
556
+
557
+/* reg_sfd_uc_tunnel_uip_lsb
558
+ * When protocol is IPv4, the least significant bytes of the underlay
559
+ * IPv4 destination IP.
560
+ * When protocol is IPv6, pointer to the underlay IPv6 destination IP
561
+ * which is configured by RIPS.
562
+ * Access: RW
563
+ */
564
+MLXSW_ITEM32_INDEXED(reg, sfd, uc_tunnel_uip_lsb, MLXSW_REG_SFD_BASE_LEN, 0,
565
+ 24, MLXSW_REG_SFD_REC_LEN, 0x0C, false);
566
+
567
+static inline void
568
+mlxsw_reg_sfd_uc_tunnel_pack(char *payload, int rec_index,
569
+ enum mlxsw_reg_sfd_rec_policy policy,
570
+ const char *mac, u16 fid,
571
+ enum mlxsw_reg_sfd_rec_action action, u32 uip,
572
+ enum mlxsw_reg_sfd_uc_tunnel_protocol proto)
573
+{
574
+ mlxsw_reg_sfd_rec_pack(payload, rec_index,
575
+ MLXSW_REG_SFD_REC_TYPE_UNICAST_TUNNEL, mac,
576
+ action);
577
+ mlxsw_reg_sfd_rec_policy_set(payload, rec_index, policy);
578
+ mlxsw_reg_sfd_uc_tunnel_uip_msb_set(payload, rec_index, uip >> 24);
579
+ mlxsw_reg_sfd_uc_tunnel_uip_lsb_set(payload, rec_index, uip);
580
+ mlxsw_reg_sfd_uc_tunnel_fid_set(payload, rec_index, fid);
581
+ mlxsw_reg_sfd_uc_tunnel_protocol_set(payload, rec_index, proto);
582
+}
583
+
528584 /* SFN - Switch FDB Notification Register
529585 * -------------------------------------------
530586 * The switch provides notifications on newly learned FDB entries and
....@@ -565,7 +621,7 @@
565621 {
566622 MLXSW_REG_ZERO(sfn, payload);
567623 mlxsw_reg_sfn_swid_set(payload, 0);
568
- mlxsw_reg_sfn_end_set(payload, 1);
624
+ mlxsw_reg_sfn_end_set(payload, 0);
569625 mlxsw_reg_sfn_num_rec_set(payload, MLXSW_REG_SFN_REC_MAX_COUNT);
570626 }
571627
....@@ -585,6 +641,10 @@
585641 MLXSW_REG_SFN_REC_TYPE_AGED_OUT_MAC = 0x7,
586642 /* Aged-out MAC address on a LAG port. */
587643 MLXSW_REG_SFN_REC_TYPE_AGED_OUT_MAC_LAG = 0x8,
644
+ /* Learned unicast tunnel record. */
645
+ MLXSW_REG_SFN_REC_TYPE_LEARNED_UNICAST_TUNNEL = 0xD,
646
+ /* Aged-out unicast tunnel record. */
647
+ MLXSW_REG_SFN_REC_TYPE_AGED_OUT_UNICAST_TUNNEL = 0xE,
588648 };
589649
590650 /* reg_sfn_rec_type
....@@ -646,6 +706,66 @@
646706 mlxsw_reg_sfn_rec_mac_memcpy_from(payload, rec_index, mac);
647707 *p_vid = mlxsw_reg_sfn_mac_fid_get(payload, rec_index);
648708 *p_lag_id = mlxsw_reg_sfn_mac_lag_lag_id_get(payload, rec_index);
709
+}
710
+
711
+/* reg_sfn_uc_tunnel_uip_msb
712
+ * When protocol is IPv4, the most significant byte of the underlay IPv4
713
+ * address of the remote VTEP.
714
+ * When protocol is IPv6, reserved.
715
+ * Access: RO
716
+ */
717
+MLXSW_ITEM32_INDEXED(reg, sfn, uc_tunnel_uip_msb, MLXSW_REG_SFN_BASE_LEN, 24,
718
+ 8, MLXSW_REG_SFN_REC_LEN, 0x08, false);
719
+
720
+enum mlxsw_reg_sfn_uc_tunnel_protocol {
721
+ MLXSW_REG_SFN_UC_TUNNEL_PROTOCOL_IPV4,
722
+ MLXSW_REG_SFN_UC_TUNNEL_PROTOCOL_IPV6,
723
+};
724
+
725
+/* reg_sfn_uc_tunnel_protocol
726
+ * IP protocol.
727
+ * Access: RO
728
+ */
729
+MLXSW_ITEM32_INDEXED(reg, sfn, uc_tunnel_protocol, MLXSW_REG_SFN_BASE_LEN, 27,
730
+ 1, MLXSW_REG_SFN_REC_LEN, 0x0C, false);
731
+
732
+/* reg_sfn_uc_tunnel_uip_lsb
733
+ * When protocol is IPv4, the least significant bytes of the underlay
734
+ * IPv4 address of the remote VTEP.
735
+ * When protocol is IPv6, ipv6_id to be queried from TNIPSD.
736
+ * Access: RO
737
+ */
738
+MLXSW_ITEM32_INDEXED(reg, sfn, uc_tunnel_uip_lsb, MLXSW_REG_SFN_BASE_LEN, 0,
739
+ 24, MLXSW_REG_SFN_REC_LEN, 0x0C, false);
740
+
741
+enum mlxsw_reg_sfn_tunnel_port {
742
+ MLXSW_REG_SFN_TUNNEL_PORT_NVE,
743
+ MLXSW_REG_SFN_TUNNEL_PORT_VPLS,
744
+ MLXSW_REG_SFN_TUNNEL_FLEX_TUNNEL0,
745
+ MLXSW_REG_SFN_TUNNEL_FLEX_TUNNEL1,
746
+};
747
+
748
+/* reg_sfn_uc_tunnel_port
749
+ * Tunnel port.
750
+ * Reserved on Spectrum.
751
+ * Access: RO
752
+ */
753
+MLXSW_ITEM32_INDEXED(reg, sfn, tunnel_port, MLXSW_REG_SFN_BASE_LEN, 0, 4,
754
+ MLXSW_REG_SFN_REC_LEN, 0x10, false);
755
+
756
+static inline void
757
+mlxsw_reg_sfn_uc_tunnel_unpack(char *payload, int rec_index, char *mac,
758
+ u16 *p_fid, u32 *p_uip,
759
+ enum mlxsw_reg_sfn_uc_tunnel_protocol *p_proto)
760
+{
761
+ u32 uip_msb, uip_lsb;
762
+
763
+ mlxsw_reg_sfn_rec_mac_memcpy_from(payload, rec_index, mac);
764
+ *p_fid = mlxsw_reg_sfn_mac_fid_get(payload, rec_index);
765
+ uip_msb = mlxsw_reg_sfn_uc_tunnel_uip_msb_get(payload, rec_index);
766
+ uip_lsb = mlxsw_reg_sfn_uc_tunnel_uip_lsb_get(payload, rec_index);
767
+ *p_uip = uip_msb << 24 | uip_lsb;
768
+ *p_proto = mlxsw_reg_sfn_uc_tunnel_protocol_get(payload, rec_index);
649769 }
650770
651771 /* SPMS - Switch Port MSTP/RSTP State Register
....@@ -1069,6 +1189,8 @@
10691189 MLXSW_REG_SFDF_FLUSH_PER_PORT_AND_FID,
10701190 MLXSW_REG_SFDF_FLUSH_PER_LAG,
10711191 MLXSW_REG_SFDF_FLUSH_PER_LAG_AND_FID,
1192
+ MLXSW_REG_SFDF_FLUSH_PER_NVE,
1193
+ MLXSW_REG_SFDF_FLUSH_PER_NVE_AND_FID,
10721194 };
10731195
10741196 /* reg_sfdf_flush_type
....@@ -1079,6 +1201,10 @@
10791201 * 3 - All FID dynamic entries pointing to port are flushed.
10801202 * 4 - All dynamic entries pointing to LAG are flushed.
10811203 * 5 - All FID dynamic entries pointing to LAG are flushed.
1204
+ * 6 - All entries of type "Unicast Tunnel" or "Multicast Tunnel" are
1205
+ * flushed.
1206
+ * 7 - All entries of type "Unicast Tunnel" or "Multicast Tunnel" are
1207
+ * flushed, per FID.
10821208 * Access: RW
10831209 */
10841210 MLXSW_ITEM32(reg, sfdf, flush_type, 0x04, 28, 4);
....@@ -1315,12 +1441,19 @@
13151441 */
13161442 MLXSW_ITEM32(reg, slcr, lag_hash, 0x04, 0, 20);
13171443
1318
-static inline void mlxsw_reg_slcr_pack(char *payload, u16 lag_hash)
1444
+/* reg_slcr_seed
1445
+ * LAG seed value. The seed is the same for all ports.
1446
+ * Access: RW
1447
+ */
1448
+MLXSW_ITEM32(reg, slcr, seed, 0x08, 0, 32);
1449
+
1450
+static inline void mlxsw_reg_slcr_pack(char *payload, u16 lag_hash, u32 seed)
13191451 {
13201452 MLXSW_REG_ZERO(slcr, payload);
13211453 mlxsw_reg_slcr_pp_set(payload, MLXSW_REG_SLCR_PP_GLOBAL);
13221454 mlxsw_reg_slcr_type_set(payload, MLXSW_REG_SLCR_TYPE_CRC);
13231455 mlxsw_reg_slcr_lag_hash_set(payload, lag_hash);
1456
+ mlxsw_reg_slcr_seed_set(payload, seed);
13241457 }
13251458
13261459 /* SLCOR - Switch LAG Collector Register
....@@ -2066,6 +2199,14 @@
20662199 */
20672200 MLXSW_ITEM32(reg, pagt, acl_group_id, 0x08, 0, 16);
20682201
2202
+/* reg_pagt_multi
2203
+ * Multi-ACL
2204
+ * 0 - This ACL is the last ACL in the multi-ACL
2205
+ * 1 - This ACL is part of a multi-ACL
2206
+ * Access: RW
2207
+ */
2208
+MLXSW_ITEM32_INDEXED(reg, pagt, multi, 0x30, 31, 1, 0x04, 0x00, false);
2209
+
20692210 /* reg_pagt_acl_id
20702211 * ACL identifier
20712212 * Access: RW
....@@ -2079,12 +2220,13 @@
20792220 }
20802221
20812222 static inline void mlxsw_reg_pagt_acl_id_pack(char *payload, int index,
2082
- u16 acl_id)
2223
+ u16 acl_id, bool multi)
20832224 {
20842225 u8 size = mlxsw_reg_pagt_size_get(payload);
20852226
20862227 if (index >= size)
20872228 mlxsw_reg_pagt_size_set(payload, index + 1);
2229
+ mlxsw_reg_pagt_multi_set(payload, index, multi);
20882230 mlxsw_reg_pagt_acl_id_set(payload, index, acl_id);
20892231 }
20902232
....@@ -2362,6 +2504,43 @@
23622504 *p_a = mlxsw_reg_pefa_a_get(payload);
23632505 }
23642506
2507
+/* PEMRBT - Policy-Engine Multicast Router Binding Table Register
2508
+ * --------------------------------------------------------------
2509
+ * This register is used for binding Multicast router to an ACL group
2510
+ * that serves the MC router.
2511
+ * This register is not supported by SwitchX/-2 and Spectrum.
2512
+ */
2513
+#define MLXSW_REG_PEMRBT_ID 0x3014
2514
+#define MLXSW_REG_PEMRBT_LEN 0x14
2515
+
2516
+MLXSW_REG_DEFINE(pemrbt, MLXSW_REG_PEMRBT_ID, MLXSW_REG_PEMRBT_LEN);
2517
+
2518
+enum mlxsw_reg_pemrbt_protocol {
2519
+ MLXSW_REG_PEMRBT_PROTO_IPV4,
2520
+ MLXSW_REG_PEMRBT_PROTO_IPV6,
2521
+};
2522
+
2523
+/* reg_pemrbt_protocol
2524
+ * Access: Index
2525
+ */
2526
+MLXSW_ITEM32(reg, pemrbt, protocol, 0x00, 0, 1);
2527
+
2528
+/* reg_pemrbt_group_id
2529
+ * ACL group identifier.
2530
+ * Range 0..cap_max_acl_groups-1
2531
+ * Access: RW
2532
+ */
2533
+MLXSW_ITEM32(reg, pemrbt, group_id, 0x10, 0, 16);
2534
+
2535
+static inline void
2536
+mlxsw_reg_pemrbt_pack(char *payload, enum mlxsw_reg_pemrbt_protocol protocol,
2537
+ u16 group_id)
2538
+{
2539
+ MLXSW_REG_ZERO(pemrbt, payload);
2540
+ mlxsw_reg_pemrbt_protocol_set(payload, protocol);
2541
+ mlxsw_reg_pemrbt_group_id_set(payload, group_id);
2542
+}
2543
+
23652544 /* PTCE-V2 - Policy-Engine TCAM Entry Register Version 2
23662545 * -----------------------------------------------------
23672546 * This register is used for accessing rules within a TCAM region.
....@@ -2573,7 +2752,7 @@
25732752 mlxsw_reg_perpt_erpt_bank_set(payload, erpt_bank);
25742753 mlxsw_reg_perpt_erpt_index_set(payload, erpt_index);
25752754 mlxsw_reg_perpt_key_size_set(payload, key_size);
2576
- mlxsw_reg_perpt_bf_bypass_set(payload, true);
2755
+ mlxsw_reg_perpt_bf_bypass_set(payload, false);
25772756 mlxsw_reg_perpt_erp_id_set(payload, erp_id);
25782757 mlxsw_reg_perpt_erpt_base_bank_set(payload, erpt_base_bank);
25792758 mlxsw_reg_perpt_erpt_base_index_set(payload, erpt_base_index);
....@@ -2765,8 +2944,9 @@
27652944 u32 priority,
27662945 const char *tcam_region_info,
27672946 const char *key, u8 erp_id,
2768
- bool large_exists, u32 lkey_id,
2769
- u32 action_pointer)
2947
+ u16 delta_start, u8 delta_mask,
2948
+ u8 delta_value, bool large_exists,
2949
+ u32 lkey_id, u32 action_pointer)
27702950 {
27712951 MLXSW_REG_ZERO(ptce3, payload);
27722952 mlxsw_reg_ptce3_v_set(payload, valid);
....@@ -2775,6 +2955,9 @@
27752955 mlxsw_reg_ptce3_tcam_region_info_memcpy_to(payload, tcam_region_info);
27762956 mlxsw_reg_ptce3_flex2_key_blocks_memcpy_to(payload, key);
27772957 mlxsw_reg_ptce3_erp_id_set(payload, erp_id);
2958
+ mlxsw_reg_ptce3_delta_start_set(payload, delta_start);
2959
+ mlxsw_reg_ptce3_delta_mask_set(payload, delta_mask);
2960
+ mlxsw_reg_ptce3_delta_value_set(payload, delta_value);
27782961 mlxsw_reg_ptce3_large_exists_set(payload, large_exists);
27792962 mlxsw_reg_ptce3_large_entry_key_id_set(payload, lkey_id);
27802963 mlxsw_reg_ptce3_action_pointer_set(payload, action_pointer);
....@@ -2832,7 +3015,7 @@
28323015 mlxsw_reg_percr_region_id_set(payload, region_id);
28333016 mlxsw_reg_percr_atcam_ignore_prune_set(payload, false);
28343017 mlxsw_reg_percr_ctcam_ignore_prune_set(payload, false);
2835
- mlxsw_reg_percr_bf_bypass_set(payload, true);
3018
+ mlxsw_reg_percr_bf_bypass_set(payload, false);
28363019 }
28373020
28383021 /* PERERP - Policy-Engine Region eRP Register
....@@ -2921,6 +3104,72 @@
29213104 mlxsw_reg_pererp_master_rp_id_set(payload, master_rp_id);
29223105 }
29233106
3107
+/* PEABFE - Policy-Engine Algorithmic Bloom Filter Entries Register
3108
+ * ----------------------------------------------------------------
3109
+ * This register configures the Bloom filter entries.
3110
+ */
3111
+#define MLXSW_REG_PEABFE_ID 0x3022
3112
+#define MLXSW_REG_PEABFE_BASE_LEN 0x10
3113
+#define MLXSW_REG_PEABFE_BF_REC_LEN 0x4
3114
+#define MLXSW_REG_PEABFE_BF_REC_MAX_COUNT 256
3115
+#define MLXSW_REG_PEABFE_LEN (MLXSW_REG_PEABFE_BASE_LEN + \
3116
+ MLXSW_REG_PEABFE_BF_REC_LEN * \
3117
+ MLXSW_REG_PEABFE_BF_REC_MAX_COUNT)
3118
+
3119
+MLXSW_REG_DEFINE(peabfe, MLXSW_REG_PEABFE_ID, MLXSW_REG_PEABFE_LEN);
3120
+
3121
+/* reg_peabfe_size
3122
+ * Number of BF entries to be updated.
3123
+ * Range 1..256
3124
+ * Access: Op
3125
+ */
3126
+MLXSW_ITEM32(reg, peabfe, size, 0x00, 0, 9);
3127
+
3128
+/* reg_peabfe_bf_entry_state
3129
+ * Bloom filter state
3130
+ * 0 - Clear
3131
+ * 1 - Set
3132
+ * Access: RW
3133
+ */
3134
+MLXSW_ITEM32_INDEXED(reg, peabfe, bf_entry_state,
3135
+ MLXSW_REG_PEABFE_BASE_LEN, 31, 1,
3136
+ MLXSW_REG_PEABFE_BF_REC_LEN, 0x00, false);
3137
+
3138
+/* reg_peabfe_bf_entry_bank
3139
+ * Bloom filter bank ID
3140
+ * Range 0..cap_max_erp_table_banks-1
3141
+ * Access: Index
3142
+ */
3143
+MLXSW_ITEM32_INDEXED(reg, peabfe, bf_entry_bank,
3144
+ MLXSW_REG_PEABFE_BASE_LEN, 24, 4,
3145
+ MLXSW_REG_PEABFE_BF_REC_LEN, 0x00, false);
3146
+
3147
+/* reg_peabfe_bf_entry_index
3148
+ * Bloom filter entry index
3149
+ * Range 0..2^cap_max_bf_log-1
3150
+ * Access: Index
3151
+ */
3152
+MLXSW_ITEM32_INDEXED(reg, peabfe, bf_entry_index,
3153
+ MLXSW_REG_PEABFE_BASE_LEN, 0, 24,
3154
+ MLXSW_REG_PEABFE_BF_REC_LEN, 0x00, false);
3155
+
3156
+static inline void mlxsw_reg_peabfe_pack(char *payload)
3157
+{
3158
+ MLXSW_REG_ZERO(peabfe, payload);
3159
+}
3160
+
3161
+static inline void mlxsw_reg_peabfe_rec_pack(char *payload, int rec_index,
3162
+ u8 state, u8 bank, u32 bf_index)
3163
+{
3164
+ u8 num_rec = mlxsw_reg_peabfe_size_get(payload);
3165
+
3166
+ if (rec_index >= num_rec)
3167
+ mlxsw_reg_peabfe_size_set(payload, rec_index + 1);
3168
+ mlxsw_reg_peabfe_bf_entry_state_set(payload, rec_index, state);
3169
+ mlxsw_reg_peabfe_bf_entry_bank_set(payload, rec_index, bank);
3170
+ mlxsw_reg_peabfe_bf_entry_index_set(payload, rec_index, bf_index);
3171
+}
3172
+
29243173 /* IEDR - Infrastructure Entry Delete Register
29253174 * ----------------------------------------------------
29263175 * This register is used for deleting entries from the entry tables.
....@@ -2954,7 +3203,7 @@
29543203 * Size of entries do be deleted. The unit is 1 entry, regardless of entry type.
29553204 * Access: OP
29563205 */
2957
-MLXSW_ITEM32_INDEXED(reg, iedr, rec_size, MLXSW_REG_IEDR_BASE_LEN, 0, 11,
3206
+MLXSW_ITEM32_INDEXED(reg, iedr, rec_size, MLXSW_REG_IEDR_BASE_LEN, 0, 13,
29583207 MLXSW_REG_IEDR_REC_LEN, 0x00, false);
29593208
29603209 /* reg_iedr_rec_index_start
....@@ -3046,6 +3295,12 @@
30463295 * Access: Index
30473296 */
30483297 MLXSW_ITEM32(reg, qpcr, pid, 0x00, 0, 14);
3298
+
3299
+/* reg_qpcr_clear_counter
3300
+ * Clear counters.
3301
+ * Access: OP
3302
+ */
3303
+MLXSW_ITEM32(reg, qpcr, clear_counter, 0x04, 31, 1);
30493304
30503305 /* reg_qpcr_color_aware
30513306 * Is the policer aware of colors.
....@@ -3144,6 +3399,26 @@
31443399 */
31453400 MLXSW_ITEM32(reg, qpcr, violate_action, 0x18, 0, 4);
31463401
3402
+/* reg_qpcr_violate_count
3403
+ * Counts the number of times violate_action happened on this PID.
3404
+ * Access: RW
3405
+ */
3406
+MLXSW_ITEM64(reg, qpcr, violate_count, 0x20, 0, 64);
3407
+
3408
+/* Packets */
3409
+#define MLXSW_REG_QPCR_LOWEST_CIR 1
3410
+#define MLXSW_REG_QPCR_HIGHEST_CIR (2 * 1000 * 1000 * 1000) /* 2Gpps */
3411
+#define MLXSW_REG_QPCR_LOWEST_CBS 4
3412
+#define MLXSW_REG_QPCR_HIGHEST_CBS 24
3413
+
3414
+/* Bandwidth */
3415
+#define MLXSW_REG_QPCR_LOWEST_CIR_BITS 1024 /* bps */
3416
+#define MLXSW_REG_QPCR_HIGHEST_CIR_BITS 2000000000000ULL /* 2Tbps */
3417
+#define MLXSW_REG_QPCR_LOWEST_CBS_BITS_SP1 4
3418
+#define MLXSW_REG_QPCR_LOWEST_CBS_BITS_SP2 4
3419
+#define MLXSW_REG_QPCR_HIGHEST_CBS_BITS_SP1 25
3420
+#define MLXSW_REG_QPCR_HIGHEST_CBS_BITS_SP2 31
3421
+
31473422 static inline void mlxsw_reg_qpcr_pack(char *payload, u16 pid,
31483423 enum mlxsw_reg_qpcr_ir_units ir_units,
31493424 bool bytes, u32 cir, u16 cbs)
....@@ -3228,10 +3503,10 @@
32283503 MLXSW_ITEM32(reg, qeec, local_port, 0x00, 16, 8);
32293504
32303505 enum mlxsw_reg_qeec_hr {
3231
- MLXSW_REG_QEEC_HIERARCY_PORT,
3232
- MLXSW_REG_QEEC_HIERARCY_GROUP,
3233
- MLXSW_REG_QEEC_HIERARCY_SUBGROUP,
3234
- MLXSW_REG_QEEC_HIERARCY_TC,
3506
+ MLXSW_REG_QEEC_HR_PORT,
3507
+ MLXSW_REG_QEEC_HR_GROUP,
3508
+ MLXSW_REG_QEEC_HR_SUBGROUP,
3509
+ MLXSW_REG_QEEC_HR_TC,
32353510 };
32363511
32373512 /* reg_qeec_element_hierarchy
....@@ -3265,6 +3540,18 @@
32653540 * Access: RW
32663541 */
32673542 MLXSW_ITEM32(reg, qeec, mise, 0x0C, 31, 1);
3543
+
3544
+/* reg_qeec_ptps
3545
+ * PTP shaper
3546
+ * 0: regular shaper mode
3547
+ * 1: PTP oriented shaper
3548
+ * Allowed only for hierarchy 0
3549
+ * Not supported for CPU port
3550
+ * Note that ptps mode may affect the shaper rates of all hierarchies
3551
+ * Supported only on Spectrum-1
3552
+ * Access: RW
3553
+ */
3554
+MLXSW_ITEM32(reg, qeec, ptps, 0x0C, 29, 1);
32683555
32693556 enum {
32703557 MLXSW_REG_QEEC_BYTES_MODE,
....@@ -3302,8 +3589,8 @@
33023589 */
33033590 MLXSW_ITEM32(reg, qeec, mase, 0x10, 31, 1);
33043591
3305
-/* A large max rate will disable the max shaper. */
3306
-#define MLXSW_REG_QEEC_MAS_DIS 200000000 /* Kbps */
3592
+/* The largest max shaper value possible to disable the shaper. */
3593
+#define MLXSW_REG_QEEC_MAS_DIS ((1u << 31) - 1) /* Kbps */
33073594
33083595 /* reg_qeec_max_shaper_rate
33093596 * Max shaper information rate.
....@@ -3311,7 +3598,7 @@
33113598 * When in bytes mode, value is specified in units of 1000bps.
33123599 * Access: RW
33133600 */
3314
-MLXSW_ITEM32(reg, qeec, max_shaper_rate, 0x10, 0, 28);
3601
+MLXSW_ITEM32(reg, qeec, max_shaper_rate, 0x10, 0, 31);
33153602
33163603 /* reg_qeec_de
33173604 * DWRR configuration enable. Enables configuration of the dwrr and
....@@ -3341,6 +3628,21 @@
33413628 */
33423629 MLXSW_ITEM32(reg, qeec, dwrr_weight, 0x18, 0, 8);
33433630
3631
+/* reg_qeec_max_shaper_bs
3632
+ * Max shaper burst size
3633
+ * Burst size is 2^max_shaper_bs * 512 bits
3634
+ * For Spectrum-1: Range is: 5..25
3635
+ * For Spectrum-2: Range is: 11..25
3636
+ * Reserved when ptps = 1
3637
+ * Access: RW
3638
+ */
3639
+MLXSW_ITEM32(reg, qeec, max_shaper_bs, 0x1C, 0, 6);
3640
+
3641
+#define MLXSW_REG_QEEC_HIGHEST_SHAPER_BS 25
3642
+#define MLXSW_REG_QEEC_LOWEST_SHAPER_BS_SP1 5
3643
+#define MLXSW_REG_QEEC_LOWEST_SHAPER_BS_SP2 11
3644
+#define MLXSW_REG_QEEC_LOWEST_SHAPER_BS_SP3 11
3645
+
33443646 static inline void mlxsw_reg_qeec_pack(char *payload, u8 local_port,
33453647 enum mlxsw_reg_qeec_hr hr, u8 index,
33463648 u8 next_index)
....@@ -3350,6 +3652,15 @@
33503652 mlxsw_reg_qeec_element_hierarchy_set(payload, hr);
33513653 mlxsw_reg_qeec_element_index_set(payload, index);
33523654 mlxsw_reg_qeec_next_element_index_set(payload, next_index);
3655
+}
3656
+
3657
+static inline void mlxsw_reg_qeec_ptps_pack(char *payload, u8 local_port,
3658
+ bool ptps)
3659
+{
3660
+ MLXSW_REG_ZERO(qeec, payload);
3661
+ mlxsw_reg_qeec_local_port_set(payload, local_port);
3662
+ mlxsw_reg_qeec_element_hierarchy_set(payload, MLXSW_REG_QEEC_HR_PORT);
3663
+ mlxsw_reg_qeec_ptps_set(payload, ptps);
33533664 }
33543665
33553666 /* QRWE - QoS ReWrite Enable
....@@ -3478,6 +3789,38 @@
34783789 mlxsw_reg_qpdsm_prio_entry_color2_dscp_set(payload, prio, dscp);
34793790 }
34803791
3792
+/* QPDP - QoS Port DSCP to Priority Mapping Register
3793
+ * -------------------------------------------------
3794
+ * This register controls the port default Switch Priority and Color. The
3795
+ * default Switch Priority and Color are used for frames where the trust state
3796
+ * uses default values. All member ports of a LAG should be configured with the
3797
+ * same default values.
3798
+ */
3799
+#define MLXSW_REG_QPDP_ID 0x4007
3800
+#define MLXSW_REG_QPDP_LEN 0x8
3801
+
3802
+MLXSW_REG_DEFINE(qpdp, MLXSW_REG_QPDP_ID, MLXSW_REG_QPDP_LEN);
3803
+
3804
+/* reg_qpdp_local_port
3805
+ * Local Port. Supported for data packets from CPU port.
3806
+ * Access: Index
3807
+ */
3808
+MLXSW_ITEM32(reg, qpdp, local_port, 0x00, 16, 8);
3809
+
3810
+/* reg_qpdp_switch_prio
3811
+ * Default port Switch Priority (default 0)
3812
+ * Access: RW
3813
+ */
3814
+MLXSW_ITEM32(reg, qpdp, switch_prio, 0x04, 0, 4);
3815
+
3816
+static inline void mlxsw_reg_qpdp_pack(char *payload, u8 local_port,
3817
+ u8 switch_prio)
3818
+{
3819
+ MLXSW_REG_ZERO(qpdp, payload);
3820
+ mlxsw_reg_qpdp_local_port_set(payload, local_port);
3821
+ mlxsw_reg_qpdp_switch_prio_set(payload, switch_prio);
3822
+}
3823
+
34813824 /* QPDPM - QoS Port DSCP to Priority Mapping Register
34823825 * --------------------------------------------------
34833826 * This register controls the mapping from DSCP field to
....@@ -3565,6 +3908,112 @@
35653908 mlxsw_reg_qtctm_mc_set(payload, mc);
35663909 }
35673910
3911
+/* QPSC - QoS PTP Shaper Configuration Register
3912
+ * --------------------------------------------
3913
+ * The QPSC allows advanced configuration of the shapers when QEEC.ptps=1.
3914
+ * Supported only on Spectrum-1.
3915
+ */
3916
+#define MLXSW_REG_QPSC_ID 0x401B
3917
+#define MLXSW_REG_QPSC_LEN 0x28
3918
+
3919
+MLXSW_REG_DEFINE(qpsc, MLXSW_REG_QPSC_ID, MLXSW_REG_QPSC_LEN);
3920
+
3921
+enum mlxsw_reg_qpsc_port_speed {
3922
+ MLXSW_REG_QPSC_PORT_SPEED_100M,
3923
+ MLXSW_REG_QPSC_PORT_SPEED_1G,
3924
+ MLXSW_REG_QPSC_PORT_SPEED_10G,
3925
+ MLXSW_REG_QPSC_PORT_SPEED_25G,
3926
+};
3927
+
3928
+/* reg_qpsc_port_speed
3929
+ * Port speed.
3930
+ * Access: Index
3931
+ */
3932
+MLXSW_ITEM32(reg, qpsc, port_speed, 0x00, 0, 4);
3933
+
3934
+/* reg_qpsc_shaper_time_exp
3935
+ * The base-time-interval for updating the shapers tokens (for all hierarchies).
3936
+ * shaper_update_rate = 2 ^ shaper_time_exp * (1 + shaper_time_mantissa) * 32nSec
3937
+ * shaper_rate = 64bit * shaper_inc / shaper_update_rate
3938
+ * Access: RW
3939
+ */
3940
+MLXSW_ITEM32(reg, qpsc, shaper_time_exp, 0x04, 16, 4);
3941
+
3942
+/* reg_qpsc_shaper_time_mantissa
3943
+ * The base-time-interval for updating the shapers tokens (for all hierarchies).
3944
+ * shaper_update_rate = 2 ^ shaper_time_exp * (1 + shaper_time_mantissa) * 32nSec
3945
+ * shaper_rate = 64bit * shaper_inc / shaper_update_rate
3946
+ * Access: RW
3947
+ */
3948
+MLXSW_ITEM32(reg, qpsc, shaper_time_mantissa, 0x04, 0, 5);
3949
+
3950
+/* reg_qpsc_shaper_inc
3951
+ * Number of tokens added to shaper on each update.
3952
+ * Units of 8B.
3953
+ * Access: RW
3954
+ */
3955
+MLXSW_ITEM32(reg, qpsc, shaper_inc, 0x08, 0, 5);
3956
+
3957
+/* reg_qpsc_shaper_bs
3958
+ * Max shaper Burst size.
3959
+ * Burst size is 2 ^ max_shaper_bs * 512 [bits]
3960
+ * Range is: 5..25 (from 2KB..2GB)
3961
+ * Access: RW
3962
+ */
3963
+MLXSW_ITEM32(reg, qpsc, shaper_bs, 0x0C, 0, 6);
3964
+
3965
+/* reg_qpsc_ptsc_we
3966
+ * Write enable to port_to_shaper_credits.
3967
+ * Access: WO
3968
+ */
3969
+MLXSW_ITEM32(reg, qpsc, ptsc_we, 0x10, 31, 1);
3970
+
3971
+/* reg_qpsc_port_to_shaper_credits
3972
+ * For split ports: range 1..57
3973
+ * For non-split ports: range 1..112
3974
+ * Written only when ptsc_we is set.
3975
+ * Access: RW
3976
+ */
3977
+MLXSW_ITEM32(reg, qpsc, port_to_shaper_credits, 0x10, 0, 8);
3978
+
3979
+/* reg_qpsc_ing_timestamp_inc
3980
+ * Ingress timestamp increment.
3981
+ * 2's complement.
3982
+ * The timestamp of MTPPTR at ingress will be incremented by this value. Global
3983
+ * value for all ports.
3984
+ * Same units as used by MTPPTR.
3985
+ * Access: RW
3986
+ */
3987
+MLXSW_ITEM32(reg, qpsc, ing_timestamp_inc, 0x20, 0, 32);
3988
+
3989
+/* reg_qpsc_egr_timestamp_inc
3990
+ * Egress timestamp increment.
3991
+ * 2's complement.
3992
+ * The timestamp of MTPPTR at egress will be incremented by this value. Global
3993
+ * value for all ports.
3994
+ * Same units as used by MTPPTR.
3995
+ * Access: RW
3996
+ */
3997
+MLXSW_ITEM32(reg, qpsc, egr_timestamp_inc, 0x24, 0, 32);
3998
+
3999
+static inline void
4000
+mlxsw_reg_qpsc_pack(char *payload, enum mlxsw_reg_qpsc_port_speed port_speed,
4001
+ u8 shaper_time_exp, u8 shaper_time_mantissa, u8 shaper_inc,
4002
+ u8 shaper_bs, u8 port_to_shaper_credits,
4003
+ int ing_timestamp_inc, int egr_timestamp_inc)
4004
+{
4005
+ MLXSW_REG_ZERO(qpsc, payload);
4006
+ mlxsw_reg_qpsc_port_speed_set(payload, port_speed);
4007
+ mlxsw_reg_qpsc_shaper_time_exp_set(payload, shaper_time_exp);
4008
+ mlxsw_reg_qpsc_shaper_time_mantissa_set(payload, shaper_time_mantissa);
4009
+ mlxsw_reg_qpsc_shaper_inc_set(payload, shaper_inc);
4010
+ mlxsw_reg_qpsc_shaper_bs_set(payload, shaper_bs);
4011
+ mlxsw_reg_qpsc_ptsc_we_set(payload, true);
4012
+ mlxsw_reg_qpsc_port_to_shaper_credits_set(payload, port_to_shaper_credits);
4013
+ mlxsw_reg_qpsc_ing_timestamp_inc_set(payload, ing_timestamp_inc);
4014
+ mlxsw_reg_qpsc_egr_timestamp_inc_set(payload, egr_timestamp_inc);
4015
+}
4016
+
35684017 /* PMLP - Ports Module to Local Port Register
35694018 * ------------------------------------------
35704019 * Configures the assignment of modules to local ports.
....@@ -3592,6 +4041,7 @@
35924041 * 1 - Lane 0 is used.
35934042 * 2 - Lanes 0 and 1 are used.
35944043 * 4 - Lanes 0, 1, 2 and 3 are used.
4044
+ * 8 - Lanes 0-7 are used.
35954045 * Access: RW
35964046 */
35974047 MLXSW_ITEM32(reg, pmlp, width, 0x00, 0, 8);
....@@ -3606,14 +4056,14 @@
36064056 * Tx Lane. When rxtx field is cleared, this field is used for Rx as well.
36074057 * Access: RW
36084058 */
3609
-MLXSW_ITEM32_INDEXED(reg, pmlp, tx_lane, 0x04, 16, 2, 0x04, 0x00, false);
4059
+MLXSW_ITEM32_INDEXED(reg, pmlp, tx_lane, 0x04, 16, 4, 0x04, 0x00, false);
36104060
36114061 /* reg_pmlp_rx_lane
36124062 * Rx Lane. When rxtx field is cleared, this field is ignored and Rx lane is
36134063 * equal to Tx lane.
36144064 * Access: RW
36154065 */
3616
-MLXSW_ITEM32_INDEXED(reg, pmlp, rx_lane, 0x04, 24, 2, 0x04, 0x00, false);
4066
+MLXSW_ITEM32_INDEXED(reg, pmlp, rx_lane, 0x04, 24, 4, 0x04, 0x00, false);
36174067
36184068 static inline void mlxsw_reg_pmlp_pack(char *payload, u8 local_port)
36194069 {
....@@ -3722,15 +4172,32 @@
37224172 */
37234173 MLXSW_ITEM32(reg, ptys, an_status, 0x04, 28, 4);
37244174
4175
+#define MLXSW_REG_PTYS_EXT_ETH_SPEED_SGMII_100M BIT(0)
4176
+#define MLXSW_REG_PTYS_EXT_ETH_SPEED_1000BASE_X_SGMII BIT(1)
4177
+#define MLXSW_REG_PTYS_EXT_ETH_SPEED_5GBASE_R BIT(3)
4178
+#define MLXSW_REG_PTYS_EXT_ETH_SPEED_XFI_XAUI_1_10G BIT(4)
4179
+#define MLXSW_REG_PTYS_EXT_ETH_SPEED_XLAUI_4_XLPPI_4_40G BIT(5)
4180
+#define MLXSW_REG_PTYS_EXT_ETH_SPEED_25GAUI_1_25GBASE_CR_KR BIT(6)
4181
+#define MLXSW_REG_PTYS_EXT_ETH_SPEED_50GAUI_2_LAUI_2_50GBASE_CR2_KR2 BIT(7)
4182
+#define MLXSW_REG_PTYS_EXT_ETH_SPEED_50GAUI_1_LAUI_1_50GBASE_CR_KR BIT(8)
4183
+#define MLXSW_REG_PTYS_EXT_ETH_SPEED_CAUI_4_100GBASE_CR4_KR4 BIT(9)
4184
+#define MLXSW_REG_PTYS_EXT_ETH_SPEED_100GAUI_2_100GBASE_CR2_KR2 BIT(10)
4185
+#define MLXSW_REG_PTYS_EXT_ETH_SPEED_200GAUI_4_200GBASE_CR4_KR4 BIT(12)
4186
+#define MLXSW_REG_PTYS_EXT_ETH_SPEED_400GAUI_8 BIT(15)
4187
+
4188
+/* reg_ptys_ext_eth_proto_cap
4189
+ * Extended Ethernet port supported speeds and protocols.
4190
+ * Access: RO
4191
+ */
4192
+MLXSW_ITEM32(reg, ptys, ext_eth_proto_cap, 0x08, 0, 32);
4193
+
37254194 #define MLXSW_REG_PTYS_ETH_SPEED_SGMII BIT(0)
37264195 #define MLXSW_REG_PTYS_ETH_SPEED_1000BASE_KX BIT(1)
37274196 #define MLXSW_REG_PTYS_ETH_SPEED_10GBASE_CX4 BIT(2)
37284197 #define MLXSW_REG_PTYS_ETH_SPEED_10GBASE_KX4 BIT(3)
37294198 #define MLXSW_REG_PTYS_ETH_SPEED_10GBASE_KR BIT(4)
3730
-#define MLXSW_REG_PTYS_ETH_SPEED_20GBASE_KR2 BIT(5)
37314199 #define MLXSW_REG_PTYS_ETH_SPEED_40GBASE_CR4 BIT(6)
37324200 #define MLXSW_REG_PTYS_ETH_SPEED_40GBASE_KR4 BIT(7)
3733
-#define MLXSW_REG_PTYS_ETH_SPEED_56GBASE_R4 BIT(8)
37344201 #define MLXSW_REG_PTYS_ETH_SPEED_10GBASE_CR BIT(12)
37354202 #define MLXSW_REG_PTYS_ETH_SPEED_10GBASE_SR BIT(13)
37364203 #define MLXSW_REG_PTYS_ETH_SPEED_10GBASE_ER_LR BIT(14)
....@@ -3742,9 +4209,6 @@
37424209 #define MLXSW_REG_PTYS_ETH_SPEED_100GBASE_SR4 BIT(21)
37434210 #define MLXSW_REG_PTYS_ETH_SPEED_100GBASE_KR4 BIT(22)
37444211 #define MLXSW_REG_PTYS_ETH_SPEED_100GBASE_LR4_ER4 BIT(23)
3745
-#define MLXSW_REG_PTYS_ETH_SPEED_100BASE_TX BIT(24)
3746
-#define MLXSW_REG_PTYS_ETH_SPEED_100BASE_T BIT(25)
3747
-#define MLXSW_REG_PTYS_ETH_SPEED_10GBASE_T BIT(26)
37484212 #define MLXSW_REG_PTYS_ETH_SPEED_25GBASE_CR BIT(27)
37494213 #define MLXSW_REG_PTYS_ETH_SPEED_25GBASE_KR BIT(28)
37504214 #define MLXSW_REG_PTYS_ETH_SPEED_25GBASE_SR BIT(29)
....@@ -3776,6 +4240,12 @@
37764240 */
37774241 MLXSW_ITEM32(reg, ptys, ib_proto_cap, 0x10, 0, 16);
37784242
4243
+/* reg_ptys_ext_eth_proto_admin
4244
+ * Extended speed and protocol to set port to.
4245
+ * Access: RW
4246
+ */
4247
+MLXSW_ITEM32(reg, ptys, ext_eth_proto_admin, 0x14, 0, 32);
4248
+
37794249 /* reg_ptys_eth_proto_admin
37804250 * Speed and protocol to set port to.
37814251 * Access: RW
....@@ -3793,6 +4263,12 @@
37934263 * Access: RW
37944264 */
37954265 MLXSW_ITEM32(reg, ptys, ib_proto_admin, 0x1C, 0, 16);
4266
+
4267
+/* reg_ptys_ext_eth_proto_oper
4268
+ * The extended current speed and protocol configured for the port.
4269
+ * Access: RO
4270
+ */
4271
+MLXSW_ITEM32(reg, ptys, ext_eth_proto_oper, 0x20, 0, 32);
37964272
37974273 /* reg_ptys_eth_proto_oper
37984274 * The current speed and protocol configured for the port.
....@@ -3812,12 +4288,23 @@
38124288 */
38134289 MLXSW_ITEM32(reg, ptys, ib_proto_oper, 0x28, 0, 16);
38144290
3815
-/* reg_ptys_eth_proto_lp_advertise
3816
- * The protocols that were advertised by the link partner during
3817
- * autonegotiation.
4291
+enum mlxsw_reg_ptys_connector_type {
4292
+ MLXSW_REG_PTYS_CONNECTOR_TYPE_UNKNOWN_OR_NO_CONNECTOR,
4293
+ MLXSW_REG_PTYS_CONNECTOR_TYPE_PORT_NONE,
4294
+ MLXSW_REG_PTYS_CONNECTOR_TYPE_PORT_TP,
4295
+ MLXSW_REG_PTYS_CONNECTOR_TYPE_PORT_AUI,
4296
+ MLXSW_REG_PTYS_CONNECTOR_TYPE_PORT_BNC,
4297
+ MLXSW_REG_PTYS_CONNECTOR_TYPE_PORT_MII,
4298
+ MLXSW_REG_PTYS_CONNECTOR_TYPE_PORT_FIBRE,
4299
+ MLXSW_REG_PTYS_CONNECTOR_TYPE_PORT_DA,
4300
+ MLXSW_REG_PTYS_CONNECTOR_TYPE_PORT_OTHER,
4301
+};
4302
+
4303
+/* reg_ptys_connector_type
4304
+ * Connector type indication.
38184305 * Access: RO
38194306 */
3820
-MLXSW_ITEM32(reg, ptys, eth_proto_lp_advertise, 0x30, 0, 32);
4307
+MLXSW_ITEM32(reg, ptys, connector_type, 0x2C, 0, 4);
38214308
38224309 static inline void mlxsw_reg_ptys_eth_pack(char *payload, u8 local_port,
38234310 u32 proto_admin, bool autoneg)
....@@ -3829,17 +4316,46 @@
38294316 mlxsw_reg_ptys_an_disable_admin_set(payload, !autoneg);
38304317 }
38314318
4319
+static inline void mlxsw_reg_ptys_ext_eth_pack(char *payload, u8 local_port,
4320
+ u32 proto_admin, bool autoneg)
4321
+{
4322
+ MLXSW_REG_ZERO(ptys, payload);
4323
+ mlxsw_reg_ptys_local_port_set(payload, local_port);
4324
+ mlxsw_reg_ptys_proto_mask_set(payload, MLXSW_REG_PTYS_PROTO_MASK_ETH);
4325
+ mlxsw_reg_ptys_ext_eth_proto_admin_set(payload, proto_admin);
4326
+ mlxsw_reg_ptys_an_disable_admin_set(payload, !autoneg);
4327
+}
4328
+
38324329 static inline void mlxsw_reg_ptys_eth_unpack(char *payload,
38334330 u32 *p_eth_proto_cap,
3834
- u32 *p_eth_proto_adm,
4331
+ u32 *p_eth_proto_admin,
38354332 u32 *p_eth_proto_oper)
38364333 {
38374334 if (p_eth_proto_cap)
3838
- *p_eth_proto_cap = mlxsw_reg_ptys_eth_proto_cap_get(payload);
3839
- if (p_eth_proto_adm)
3840
- *p_eth_proto_adm = mlxsw_reg_ptys_eth_proto_admin_get(payload);
4335
+ *p_eth_proto_cap =
4336
+ mlxsw_reg_ptys_eth_proto_cap_get(payload);
4337
+ if (p_eth_proto_admin)
4338
+ *p_eth_proto_admin =
4339
+ mlxsw_reg_ptys_eth_proto_admin_get(payload);
38414340 if (p_eth_proto_oper)
3842
- *p_eth_proto_oper = mlxsw_reg_ptys_eth_proto_oper_get(payload);
4341
+ *p_eth_proto_oper =
4342
+ mlxsw_reg_ptys_eth_proto_oper_get(payload);
4343
+}
4344
+
4345
+static inline void mlxsw_reg_ptys_ext_eth_unpack(char *payload,
4346
+ u32 *p_eth_proto_cap,
4347
+ u32 *p_eth_proto_admin,
4348
+ u32 *p_eth_proto_oper)
4349
+{
4350
+ if (p_eth_proto_cap)
4351
+ *p_eth_proto_cap =
4352
+ mlxsw_reg_ptys_ext_eth_proto_cap_get(payload);
4353
+ if (p_eth_proto_admin)
4354
+ *p_eth_proto_admin =
4355
+ mlxsw_reg_ptys_ext_eth_proto_admin_get(payload);
4356
+ if (p_eth_proto_oper)
4357
+ *p_eth_proto_oper =
4358
+ mlxsw_reg_ptys_ext_eth_proto_oper_get(payload);
38434359 }
38444360
38454361 static inline void mlxsw_reg_ptys_ib_pack(char *payload, u8 local_port,
....@@ -4162,8 +4678,11 @@
41624678
41634679 enum mlxsw_reg_ppcnt_grp {
41644680 MLXSW_REG_PPCNT_IEEE_8023_CNT = 0x0,
4681
+ MLXSW_REG_PPCNT_RFC_2863_CNT = 0x1,
41654682 MLXSW_REG_PPCNT_RFC_2819_CNT = 0x2,
4683
+ MLXSW_REG_PPCNT_RFC_3635_CNT = 0x3,
41664684 MLXSW_REG_PPCNT_EXT_CNT = 0x5,
4685
+ MLXSW_REG_PPCNT_DISCARD_CNT = 0x6,
41674686 MLXSW_REG_PPCNT_PRIO_CNT = 0x10,
41684687 MLXSW_REG_PPCNT_TC_CNT = 0x11,
41694688 MLXSW_REG_PPCNT_TC_CONG_TC = 0x13,
....@@ -4178,6 +4697,7 @@
41784697 * 0x2: RFC 2819 Counters
41794698 * 0x3: RFC 3635 Counters
41804699 * 0x5: Ethernet Extended Counters
4700
+ * 0x6: Ethernet Discard Counters
41814701 * 0x8: Link Level Retransmission Counters
41824702 * 0x10: Per Priority Counters
41834703 * 0x11: Per Traffic Class Counters
....@@ -4321,7 +4841,45 @@
43214841 MLXSW_ITEM64(reg, ppcnt, a_pause_mac_ctrl_frames_transmitted,
43224842 MLXSW_REG_PPCNT_COUNTERS_OFFSET + 0x90, 0, 64);
43234843
4844
+/* Ethernet RFC 2863 Counter Group */
4845
+
4846
+/* reg_ppcnt_if_in_discards
4847
+ * Access: RO
4848
+ */
4849
+MLXSW_ITEM64(reg, ppcnt, if_in_discards,
4850
+ MLXSW_REG_PPCNT_COUNTERS_OFFSET + 0x10, 0, 64);
4851
+
4852
+/* reg_ppcnt_if_out_discards
4853
+ * Access: RO
4854
+ */
4855
+MLXSW_ITEM64(reg, ppcnt, if_out_discards,
4856
+ MLXSW_REG_PPCNT_COUNTERS_OFFSET + 0x38, 0, 64);
4857
+
4858
+/* reg_ppcnt_if_out_errors
4859
+ * Access: RO
4860
+ */
4861
+MLXSW_ITEM64(reg, ppcnt, if_out_errors,
4862
+ MLXSW_REG_PPCNT_COUNTERS_OFFSET + 0x40, 0, 64);
4863
+
43244864 /* Ethernet RFC 2819 Counter Group */
4865
+
4866
+/* reg_ppcnt_ether_stats_undersize_pkts
4867
+ * Access: RO
4868
+ */
4869
+MLXSW_ITEM64(reg, ppcnt, ether_stats_undersize_pkts,
4870
+ MLXSW_REG_PPCNT_COUNTERS_OFFSET + 0x30, 0, 64);
4871
+
4872
+/* reg_ppcnt_ether_stats_oversize_pkts
4873
+ * Access: RO
4874
+ */
4875
+MLXSW_ITEM64(reg, ppcnt, ether_stats_oversize_pkts,
4876
+ MLXSW_REG_PPCNT_COUNTERS_OFFSET + 0x38, 0, 64);
4877
+
4878
+/* reg_ppcnt_ether_stats_fragments
4879
+ * Access: RO
4880
+ */
4881
+MLXSW_ITEM64(reg, ppcnt, ether_stats_fragments,
4882
+ MLXSW_REG_PPCNT_COUNTERS_OFFSET + 0x40, 0, 64);
43254883
43264884 /* reg_ppcnt_ether_stats_pkts64octets
43274885 * Access: RO
....@@ -4383,6 +4941,32 @@
43834941 MLXSW_ITEM64(reg, ppcnt, ether_stats_pkts8192to10239octets,
43844942 MLXSW_REG_PPCNT_COUNTERS_OFFSET + 0xA0, 0, 64);
43854943
4944
+/* Ethernet RFC 3635 Counter Group */
4945
+
4946
+/* reg_ppcnt_dot3stats_fcs_errors
4947
+ * Access: RO
4948
+ */
4949
+MLXSW_ITEM64(reg, ppcnt, dot3stats_fcs_errors,
4950
+ MLXSW_REG_PPCNT_COUNTERS_OFFSET + 0x08, 0, 64);
4951
+
4952
+/* reg_ppcnt_dot3stats_symbol_errors
4953
+ * Access: RO
4954
+ */
4955
+MLXSW_ITEM64(reg, ppcnt, dot3stats_symbol_errors,
4956
+ MLXSW_REG_PPCNT_COUNTERS_OFFSET + 0x60, 0, 64);
4957
+
4958
+/* reg_ppcnt_dot3control_in_unknown_opcodes
4959
+ * Access: RO
4960
+ */
4961
+MLXSW_ITEM64(reg, ppcnt, dot3control_in_unknown_opcodes,
4962
+ MLXSW_REG_PPCNT_COUNTERS_OFFSET + 0x68, 0, 64);
4963
+
4964
+/* reg_ppcnt_dot3in_pause_frames
4965
+ * Access: RO
4966
+ */
4967
+MLXSW_ITEM64(reg, ppcnt, dot3in_pause_frames,
4968
+ MLXSW_REG_PPCNT_COUNTERS_OFFSET + 0x70, 0, 64);
4969
+
43864970 /* Ethernet Extended Counter Group Counters */
43874971
43884972 /* reg_ppcnt_ecn_marked
....@@ -4390,6 +4974,80 @@
43904974 */
43914975 MLXSW_ITEM64(reg, ppcnt, ecn_marked,
43924976 MLXSW_REG_PPCNT_COUNTERS_OFFSET + 0x08, 0, 64);
4977
+
4978
+/* Ethernet Discard Counter Group Counters */
4979
+
4980
+/* reg_ppcnt_ingress_general
4981
+ * Access: RO
4982
+ */
4983
+MLXSW_ITEM64(reg, ppcnt, ingress_general,
4984
+ MLXSW_REG_PPCNT_COUNTERS_OFFSET + 0x00, 0, 64);
4985
+
4986
+/* reg_ppcnt_ingress_policy_engine
4987
+ * Access: RO
4988
+ */
4989
+MLXSW_ITEM64(reg, ppcnt, ingress_policy_engine,
4990
+ MLXSW_REG_PPCNT_COUNTERS_OFFSET + 0x08, 0, 64);
4991
+
4992
+/* reg_ppcnt_ingress_vlan_membership
4993
+ * Access: RO
4994
+ */
4995
+MLXSW_ITEM64(reg, ppcnt, ingress_vlan_membership,
4996
+ MLXSW_REG_PPCNT_COUNTERS_OFFSET + 0x10, 0, 64);
4997
+
4998
+/* reg_ppcnt_ingress_tag_frame_type
4999
+ * Access: RO
5000
+ */
5001
+MLXSW_ITEM64(reg, ppcnt, ingress_tag_frame_type,
5002
+ MLXSW_REG_PPCNT_COUNTERS_OFFSET + 0x18, 0, 64);
5003
+
5004
+/* reg_ppcnt_egress_vlan_membership
5005
+ * Access: RO
5006
+ */
5007
+MLXSW_ITEM64(reg, ppcnt, egress_vlan_membership,
5008
+ MLXSW_REG_PPCNT_COUNTERS_OFFSET + 0x20, 0, 64);
5009
+
5010
+/* reg_ppcnt_loopback_filter
5011
+ * Access: RO
5012
+ */
5013
+MLXSW_ITEM64(reg, ppcnt, loopback_filter,
5014
+ MLXSW_REG_PPCNT_COUNTERS_OFFSET + 0x28, 0, 64);
5015
+
5016
+/* reg_ppcnt_egress_general
5017
+ * Access: RO
5018
+ */
5019
+MLXSW_ITEM64(reg, ppcnt, egress_general,
5020
+ MLXSW_REG_PPCNT_COUNTERS_OFFSET + 0x30, 0, 64);
5021
+
5022
+/* reg_ppcnt_egress_hoq
5023
+ * Access: RO
5024
+ */
5025
+MLXSW_ITEM64(reg, ppcnt, egress_hoq,
5026
+ MLXSW_REG_PPCNT_COUNTERS_OFFSET + 0x40, 0, 64);
5027
+
5028
+/* reg_ppcnt_egress_policy_engine
5029
+ * Access: RO
5030
+ */
5031
+MLXSW_ITEM64(reg, ppcnt, egress_policy_engine,
5032
+ MLXSW_REG_PPCNT_COUNTERS_OFFSET + 0x50, 0, 64);
5033
+
5034
+/* reg_ppcnt_ingress_tx_link_down
5035
+ * Access: RO
5036
+ */
5037
+MLXSW_ITEM64(reg, ppcnt, ingress_tx_link_down,
5038
+ MLXSW_REG_PPCNT_COUNTERS_OFFSET + 0x58, 0, 64);
5039
+
5040
+/* reg_ppcnt_egress_stp_filter
5041
+ * Access: RO
5042
+ */
5043
+MLXSW_ITEM64(reg, ppcnt, egress_stp_filter,
5044
+ MLXSW_REG_PPCNT_COUNTERS_OFFSET + 0x60, 0, 64);
5045
+
5046
+/* reg_ppcnt_egress_sll
5047
+ * Access: RO
5048
+ */
5049
+MLXSW_ITEM64(reg, ppcnt, egress_sll,
5050
+ MLXSW_REG_PPCNT_COUNTERS_OFFSET + 0x70, 0, 64);
43935051
43945052 /* Ethernet Per Priority Group Counters */
43955053
....@@ -4748,6 +5406,257 @@
47485406 mlxsw_reg_pspa_sub_port_set(payload, 0);
47495407 }
47505408
5409
+/* PMAOS - Ports Module Administrative and Operational Status
5410
+ * ----------------------------------------------------------
5411
+ * This register configures and retrieves the per module status.
5412
+ */
5413
+#define MLXSW_REG_PMAOS_ID 0x5012
5414
+#define MLXSW_REG_PMAOS_LEN 0x10
5415
+
5416
+MLXSW_REG_DEFINE(pmaos, MLXSW_REG_PMAOS_ID, MLXSW_REG_PMAOS_LEN);
5417
+
5418
+/* reg_slot_index
5419
+ * Slot index.
5420
+ * Access: Index
5421
+ */
5422
+MLXSW_ITEM32(reg, pmaos, slot_index, 0x00, 24, 4);
5423
+
5424
+/* reg_pmaos_module
5425
+ * Module number.
5426
+ * Access: Index
5427
+ */
5428
+MLXSW_ITEM32(reg, pmaos, module, 0x00, 16, 8);
5429
+
5430
+/* reg_pmaos_ase
5431
+ * Admin state update enable.
5432
+ * If this bit is set, admin state will be updated based on admin_state field.
5433
+ * Only relevant on Set() operations.
5434
+ * Access: WO
5435
+ */
5436
+MLXSW_ITEM32(reg, pmaos, ase, 0x04, 31, 1);
5437
+
5438
+/* reg_pmaos_ee
5439
+ * Event update enable.
5440
+ * If this bit is set, event generation will be updated based on the e field.
5441
+ * Only relevant on Set operations.
5442
+ * Access: WO
5443
+ */
5444
+MLXSW_ITEM32(reg, pmaos, ee, 0x04, 30, 1);
5445
+
5446
+enum mlxsw_reg_pmaos_e {
5447
+ MLXSW_REG_PMAOS_E_DO_NOT_GENERATE_EVENT,
5448
+ MLXSW_REG_PMAOS_E_GENERATE_EVENT,
5449
+ MLXSW_REG_PMAOS_E_GENERATE_SINGLE_EVENT,
5450
+};
5451
+
5452
+/* reg_pmaos_e
5453
+ * Event Generation on operational state change.
5454
+ * Access: RW
5455
+ */
5456
+MLXSW_ITEM32(reg, pmaos, e, 0x04, 0, 2);
5457
+
5458
+static inline void mlxsw_reg_pmaos_pack(char *payload, u8 module,
5459
+ enum mlxsw_reg_pmaos_e e)
5460
+{
5461
+ MLXSW_REG_ZERO(pmaos, payload);
5462
+ mlxsw_reg_pmaos_module_set(payload, module);
5463
+ mlxsw_reg_pmaos_e_set(payload, e);
5464
+ mlxsw_reg_pmaos_ee_set(payload, true);
5465
+}
5466
+
5467
+/* PPLR - Port Physical Loopback Register
5468
+ * --------------------------------------
5469
+ * This register allows configuration of the port's loopback mode.
5470
+ */
5471
+#define MLXSW_REG_PPLR_ID 0x5018
5472
+#define MLXSW_REG_PPLR_LEN 0x8
5473
+
5474
+MLXSW_REG_DEFINE(pplr, MLXSW_REG_PPLR_ID, MLXSW_REG_PPLR_LEN);
5475
+
5476
+/* reg_pplr_local_port
5477
+ * Local port number.
5478
+ * Access: Index
5479
+ */
5480
+MLXSW_ITEM32(reg, pplr, local_port, 0x00, 16, 8);
5481
+
5482
+/* Phy local loopback. When set the port's egress traffic is looped back
5483
+ * to the receiver and the port transmitter is disabled.
5484
+ */
5485
+#define MLXSW_REG_PPLR_LB_TYPE_BIT_PHY_LOCAL BIT(1)
5486
+
5487
+/* reg_pplr_lb_en
5488
+ * Loopback enable.
5489
+ * Access: RW
5490
+ */
5491
+MLXSW_ITEM32(reg, pplr, lb_en, 0x04, 0, 8);
5492
+
5493
+static inline void mlxsw_reg_pplr_pack(char *payload, u8 local_port,
5494
+ bool phy_local)
5495
+{
5496
+ MLXSW_REG_ZERO(pplr, payload);
5497
+ mlxsw_reg_pplr_local_port_set(payload, local_port);
5498
+ mlxsw_reg_pplr_lb_en_set(payload,
5499
+ phy_local ?
5500
+ MLXSW_REG_PPLR_LB_TYPE_BIT_PHY_LOCAL : 0);
5501
+}
5502
+
5503
+/* PMPE - Port Module Plug/Unplug Event Register
5504
+ * ---------------------------------------------
5505
+ * This register reports any operational status change of a module.
5506
+ * A change in the module’s state will generate an event only if the change
5507
+ * happens after arming the event mechanism. Any changes to the module state
5508
+ * while the event mechanism is not armed will not be reported. Software can
5509
+ * query the PMPE register for module status.
5510
+ */
5511
+#define MLXSW_REG_PMPE_ID 0x5024
5512
+#define MLXSW_REG_PMPE_LEN 0x10
5513
+
5514
+MLXSW_REG_DEFINE(pmpe, MLXSW_REG_PMPE_ID, MLXSW_REG_PMPE_LEN);
5515
+
5516
+/* reg_pmpe_slot_index
5517
+ * Slot index.
5518
+ * Access: Index
5519
+ */
5520
+MLXSW_ITEM32(reg, pmpe, slot_index, 0x00, 24, 4);
5521
+
5522
+/* reg_pmpe_module
5523
+ * Module number.
5524
+ * Access: Index
5525
+ */
5526
+MLXSW_ITEM32(reg, pmpe, module, 0x00, 16, 8);
5527
+
5528
+enum mlxsw_reg_pmpe_module_status {
5529
+ MLXSW_REG_PMPE_MODULE_STATUS_PLUGGED_ENABLED = 1,
5530
+ MLXSW_REG_PMPE_MODULE_STATUS_UNPLUGGED,
5531
+ MLXSW_REG_PMPE_MODULE_STATUS_PLUGGED_ERROR,
5532
+ MLXSW_REG_PMPE_MODULE_STATUS_PLUGGED_DISABLED,
5533
+};
5534
+
5535
+/* reg_pmpe_module_status
5536
+ * Module status.
5537
+ * Access: RO
5538
+ */
5539
+MLXSW_ITEM32(reg, pmpe, module_status, 0x00, 0, 4);
5540
+
5541
+/* reg_pmpe_error_type
5542
+ * Module error details.
5543
+ * Access: RO
5544
+ */
5545
+MLXSW_ITEM32(reg, pmpe, error_type, 0x04, 8, 4);
5546
+
5547
+/* PDDR - Port Diagnostics Database Register
5548
+ * -----------------------------------------
5549
+ * The PDDR enables to read the Phy debug database
5550
+ */
5551
+#define MLXSW_REG_PDDR_ID 0x5031
5552
+#define MLXSW_REG_PDDR_LEN 0x100
5553
+
5554
+MLXSW_REG_DEFINE(pddr, MLXSW_REG_PDDR_ID, MLXSW_REG_PDDR_LEN);
5555
+
5556
+/* reg_pddr_local_port
5557
+ * Local port number.
5558
+ * Access: Index
5559
+ */
5560
+MLXSW_ITEM32(reg, pddr, local_port, 0x00, 16, 8);
5561
+
5562
+enum mlxsw_reg_pddr_page_select {
5563
+ MLXSW_REG_PDDR_PAGE_SELECT_TROUBLESHOOTING_INFO = 1,
5564
+};
5565
+
5566
+/* reg_pddr_page_select
5567
+ * Page select index.
5568
+ * Access: Index
5569
+ */
5570
+MLXSW_ITEM32(reg, pddr, page_select, 0x04, 0, 8);
5571
+
5572
+enum mlxsw_reg_pddr_trblsh_group_opcode {
5573
+ /* Monitor opcodes */
5574
+ MLXSW_REG_PDDR_TRBLSH_GROUP_OPCODE_MONITOR,
5575
+};
5576
+
5577
+/* reg_pddr_group_opcode
5578
+ * Group selector.
5579
+ * Access: Index
5580
+ */
5581
+MLXSW_ITEM32(reg, pddr, trblsh_group_opcode, 0x08, 0, 16);
5582
+
5583
+/* reg_pddr_status_opcode
5584
+ * Group selector.
5585
+ * Access: RO
5586
+ */
5587
+MLXSW_ITEM32(reg, pddr, trblsh_status_opcode, 0x0C, 0, 16);
5588
+
5589
+static inline void mlxsw_reg_pddr_pack(char *payload, u8 local_port,
5590
+ u8 page_select)
5591
+{
5592
+ MLXSW_REG_ZERO(pddr, payload);
5593
+ mlxsw_reg_pddr_local_port_set(payload, local_port);
5594
+ mlxsw_reg_pddr_page_select_set(payload, page_select);
5595
+}
5596
+
5597
+/* PMTM - Port Module Type Mapping Register
5598
+ * ----------------------------------------
5599
+ * The PMTM allows query or configuration of module types.
5600
+ */
5601
+#define MLXSW_REG_PMTM_ID 0x5067
5602
+#define MLXSW_REG_PMTM_LEN 0x10
5603
+
5604
+MLXSW_REG_DEFINE(pmtm, MLXSW_REG_PMTM_ID, MLXSW_REG_PMTM_LEN);
5605
+
5606
+/* reg_pmtm_module
5607
+ * Module number.
5608
+ * Access: Index
5609
+ */
5610
+MLXSW_ITEM32(reg, pmtm, module, 0x00, 16, 8);
5611
+
5612
+enum mlxsw_reg_pmtm_module_type {
5613
+ /* Backplane with 4 lanes */
5614
+ MLXSW_REG_PMTM_MODULE_TYPE_BP_4X,
5615
+ /* QSFP */
5616
+ MLXSW_REG_PMTM_MODULE_TYPE_QSFP,
5617
+ /* SFP */
5618
+ MLXSW_REG_PMTM_MODULE_TYPE_SFP,
5619
+ /* Backplane with single lane */
5620
+ MLXSW_REG_PMTM_MODULE_TYPE_BP_1X = 4,
5621
+ /* Backplane with two lane */
5622
+ MLXSW_REG_PMTM_MODULE_TYPE_BP_2X = 8,
5623
+ /* Chip2Chip4x */
5624
+ MLXSW_REG_PMTM_MODULE_TYPE_C2C4X = 10,
5625
+ /* Chip2Chip2x */
5626
+ MLXSW_REG_PMTM_MODULE_TYPE_C2C2X,
5627
+ /* Chip2Chip1x */
5628
+ MLXSW_REG_PMTM_MODULE_TYPE_C2C1X,
5629
+ /* QSFP-DD */
5630
+ MLXSW_REG_PMTM_MODULE_TYPE_QSFP_DD = 14,
5631
+ /* OSFP */
5632
+ MLXSW_REG_PMTM_MODULE_TYPE_OSFP,
5633
+ /* SFP-DD */
5634
+ MLXSW_REG_PMTM_MODULE_TYPE_SFP_DD,
5635
+ /* DSFP */
5636
+ MLXSW_REG_PMTM_MODULE_TYPE_DSFP,
5637
+ /* Chip2Chip8x */
5638
+ MLXSW_REG_PMTM_MODULE_TYPE_C2C8X,
5639
+};
5640
+
5641
+/* reg_pmtm_module_type
5642
+ * Module type.
5643
+ * Access: RW
5644
+ */
5645
+MLXSW_ITEM32(reg, pmtm, module_type, 0x04, 0, 4);
5646
+
5647
+static inline void mlxsw_reg_pmtm_pack(char *payload, u8 module)
5648
+{
5649
+ MLXSW_REG_ZERO(pmtm, payload);
5650
+ mlxsw_reg_pmtm_module_set(payload, module);
5651
+}
5652
+
5653
+static inline void
5654
+mlxsw_reg_pmtm_unpack(char *payload,
5655
+ enum mlxsw_reg_pmtm_module_type *module_type)
5656
+{
5657
+ *module_type = mlxsw_reg_pmtm_module_type_get(payload);
5658
+}
5659
+
47515660 /* HTGT - Host Trap Group Table
47525661 * ----------------------------
47535662 * Configures the properties for forwarding to CPU.
....@@ -4773,26 +5682,42 @@
47735682
47745683 enum mlxsw_reg_htgt_trap_group {
47755684 MLXSW_REG_HTGT_TRAP_GROUP_EMAD,
4776
- MLXSW_REG_HTGT_TRAP_GROUP_SX2_RX,
4777
- MLXSW_REG_HTGT_TRAP_GROUP_SX2_CTRL,
5685
+ MLXSW_REG_HTGT_TRAP_GROUP_MFDE,
5686
+ MLXSW_REG_HTGT_TRAP_GROUP_MTWE,
5687
+ MLXSW_REG_HTGT_TRAP_GROUP_PMPE,
47785688 MLXSW_REG_HTGT_TRAP_GROUP_SP_STP,
47795689 MLXSW_REG_HTGT_TRAP_GROUP_SP_LACP,
47805690 MLXSW_REG_HTGT_TRAP_GROUP_SP_LLDP,
4781
- MLXSW_REG_HTGT_TRAP_GROUP_SP_IGMP,
5691
+ MLXSW_REG_HTGT_TRAP_GROUP_SP_MC_SNOOPING,
47825692 MLXSW_REG_HTGT_TRAP_GROUP_SP_BGP,
47835693 MLXSW_REG_HTGT_TRAP_GROUP_SP_OSPF,
47845694 MLXSW_REG_HTGT_TRAP_GROUP_SP_PIM,
47855695 MLXSW_REG_HTGT_TRAP_GROUP_SP_MULTICAST,
4786
- MLXSW_REG_HTGT_TRAP_GROUP_SP_ARP,
4787
- MLXSW_REG_HTGT_TRAP_GROUP_SP_HOST_MISS,
5696
+ MLXSW_REG_HTGT_TRAP_GROUP_SP_NEIGH_DISCOVERY,
47885697 MLXSW_REG_HTGT_TRAP_GROUP_SP_ROUTER_EXP,
4789
- MLXSW_REG_HTGT_TRAP_GROUP_SP_REMOTE_ROUTE,
5698
+ MLXSW_REG_HTGT_TRAP_GROUP_SP_EXTERNAL_ROUTE,
47905699 MLXSW_REG_HTGT_TRAP_GROUP_SP_IP2ME,
47915700 MLXSW_REG_HTGT_TRAP_GROUP_SP_DHCP,
4792
- MLXSW_REG_HTGT_TRAP_GROUP_SP_RPF,
47935701 MLXSW_REG_HTGT_TRAP_GROUP_SP_EVENT,
4794
- MLXSW_REG_HTGT_TRAP_GROUP_SP_IPV6_MLD,
4795
- MLXSW_REG_HTGT_TRAP_GROUP_SP_IPV6_ND,
5702
+ MLXSW_REG_HTGT_TRAP_GROUP_SP_IPV6,
5703
+ MLXSW_REG_HTGT_TRAP_GROUP_SP_LBERROR,
5704
+ MLXSW_REG_HTGT_TRAP_GROUP_SP_PTP0,
5705
+ MLXSW_REG_HTGT_TRAP_GROUP_SP_PTP1,
5706
+ MLXSW_REG_HTGT_TRAP_GROUP_SP_VRRP,
5707
+ MLXSW_REG_HTGT_TRAP_GROUP_SP_PKT_SAMPLE,
5708
+ MLXSW_REG_HTGT_TRAP_GROUP_SP_FLOW_LOGGING,
5709
+ MLXSW_REG_HTGT_TRAP_GROUP_SP_FID_MISS,
5710
+ MLXSW_REG_HTGT_TRAP_GROUP_SP_BFD,
5711
+ MLXSW_REG_HTGT_TRAP_GROUP_SP_DUMMY,
5712
+ MLXSW_REG_HTGT_TRAP_GROUP_SP_L2_DISCARDS,
5713
+ MLXSW_REG_HTGT_TRAP_GROUP_SP_L3_DISCARDS,
5714
+ MLXSW_REG_HTGT_TRAP_GROUP_SP_L3_EXCEPTIONS,
5715
+ MLXSW_REG_HTGT_TRAP_GROUP_SP_TUNNEL_DISCARDS,
5716
+ MLXSW_REG_HTGT_TRAP_GROUP_SP_ACL_DISCARDS,
5717
+ MLXSW_REG_HTGT_TRAP_GROUP_SP_BUFFER_DISCARDS,
5718
+
5719
+ __MLXSW_REG_HTGT_TRAP_GROUP_MAX,
5720
+ MLXSW_REG_HTGT_TRAP_GROUP_MAX = __MLXSW_REG_HTGT_TRAP_GROUP_MAX - 1
47965721 };
47975722
47985723 /* reg_htgt_trap_group
....@@ -4930,6 +5855,8 @@
49305855 MLXSW_REG_HPKT_ACTION_DISCARD,
49315856 MLXSW_REG_HPKT_ACTION_SOFT_DISCARD,
49325857 MLXSW_REG_HPKT_ACTION_TRAP_AND_SOFT_DISCARD,
5858
+ MLXSW_REG_HPKT_ACTION_TRAP_EXCEPTION_TO_CPU,
5859
+ MLXSW_REG_HPKT_ACTION_SET_FW_DEFAULT = 15,
49335860 };
49345861
49355862 /* reg_hpkt_action
....@@ -4940,6 +5867,8 @@
49405867 * 3 - Discard.
49415868 * 4 - Soft discard (allow other traps to act on the packet).
49425869 * 5 - Trap and soft discard (allow other traps to overwrite this trap).
5870
+ * 6 - Trap to CPU (CPU receives sole copy) and count it as error.
5871
+ * 15 - Restore the firmware's default action.
49435872 * Access: RW
49445873 *
49455874 * Note: Must be set to 0 (forward) for event trap IDs, as they are already
....@@ -4960,7 +5889,7 @@
49605889 * Note: A trap ID can only be associated with a single trap group. The device
49615890 * will associate the trap ID with the last trap group configured.
49625891 */
4963
-MLXSW_ITEM32(reg, hpkt, trap_id, 0x00, 0, 9);
5892
+MLXSW_ITEM32(reg, hpkt, trap_id, 0x00, 0, 10);
49645893
49655894 enum {
49665895 MLXSW_REG_HPKT_CTRL_PACKET_DEFAULT,
....@@ -5283,6 +6212,8 @@
52836212 MLXSW_REG_RITR_LOOPBACK_PROTOCOL_IPIP_IPV4,
52846213 /* IPinIP IPv6 underlay Unicast */
52856214 MLXSW_REG_RITR_LOOPBACK_PROTOCOL_IPIP_IPV6,
6215
+ /* IPinIP generic - used for Spectrum-2 underlay RIF */
6216
+ MLXSW_REG_RITR_LOOPBACK_GENERIC,
52866217 };
52876218
52886219 /* reg_ritr_loopback_protocol
....@@ -5322,6 +6253,13 @@
53226253 * Access: RW
53236254 */
53246255 MLXSW_ITEM32(reg, ritr, loopback_ipip_uvr, 0x10, 0, 16);
6256
+
6257
+/* reg_ritr_loopback_ipip_underlay_rif
6258
+ * Underlay ingress router interface.
6259
+ * Reserved for Spectrum.
6260
+ * Access: RW
6261
+ */
6262
+MLXSW_ITEM32(reg, ritr, loopback_ipip_underlay_rif, 0x14, 0, 16);
53256263
53266264 /* reg_ritr_loopback_ipip_usip*
53276265 * Encapsulation Underlay source IP.
....@@ -5438,11 +6376,12 @@
54386376 mlxsw_reg_ritr_loopback_ipip_common_pack(char *payload,
54396377 enum mlxsw_reg_ritr_loopback_ipip_type ipip_type,
54406378 enum mlxsw_reg_ritr_loopback_ipip_options options,
5441
- u16 uvr_id, u32 gre_key)
6379
+ u16 uvr_id, u16 underlay_rif, u32 gre_key)
54426380 {
54436381 mlxsw_reg_ritr_loopback_ipip_type_set(payload, ipip_type);
54446382 mlxsw_reg_ritr_loopback_ipip_options_set(payload, options);
54456383 mlxsw_reg_ritr_loopback_ipip_uvr_set(payload, uvr_id);
6384
+ mlxsw_reg_ritr_loopback_ipip_underlay_rif_set(payload, underlay_rif);
54466385 mlxsw_reg_ritr_loopback_ipip_gre_key_set(payload, gre_key);
54476386 }
54486387
....@@ -5450,12 +6389,12 @@
54506389 mlxsw_reg_ritr_loopback_ipip4_pack(char *payload,
54516390 enum mlxsw_reg_ritr_loopback_ipip_type ipip_type,
54526391 enum mlxsw_reg_ritr_loopback_ipip_options options,
5453
- u16 uvr_id, u32 usip, u32 gre_key)
6392
+ u16 uvr_id, u16 underlay_rif, u32 usip, u32 gre_key)
54546393 {
54556394 mlxsw_reg_ritr_loopback_protocol_set(payload,
54566395 MLXSW_REG_RITR_LOOPBACK_PROTOCOL_IPIP_IPV4);
54576396 mlxsw_reg_ritr_loopback_ipip_common_pack(payload, ipip_type, options,
5458
- uvr_id, gre_key);
6397
+ uvr_id, underlay_rif, gre_key);
54596398 mlxsw_reg_ritr_loopback_ipip_usip4_set(payload, usip);
54606399 }
54616400
....@@ -6817,6 +7756,13 @@
68177756 */
68187757 MLXSW_ITEM32(reg, rtdp, tunnel_index, 0x00, 0, 24);
68197758
7759
+/* reg_rtdp_egress_router_interface
7760
+ * Underlay egress router interface.
7761
+ * Valid range is from 0 to cap_max_router_interfaces - 1
7762
+ * Access: RW
7763
+ */
7764
+MLXSW_ITEM32(reg, rtdp, egress_router_interface, 0x40, 0, 16);
7765
+
68207766 /* IPinIP */
68217767
68227768 /* reg_rtdp_ipip_irif
....@@ -7466,6 +8412,35 @@
74668412 *p_tach_max = mlxsw_reg_mfsl_tach_max_get(payload);
74678413 }
74688414
8415
+/* FORE - Fan Out of Range Event Register
8416
+ * --------------------------------------
8417
+ * This register reports the status of the controlled fans compared to the
8418
+ * range defined by the MFSL register.
8419
+ */
8420
+#define MLXSW_REG_FORE_ID 0x9007
8421
+#define MLXSW_REG_FORE_LEN 0x0C
8422
+
8423
+MLXSW_REG_DEFINE(fore, MLXSW_REG_FORE_ID, MLXSW_REG_FORE_LEN);
8424
+
8425
+/* fan_under_limit
8426
+ * Fan speed is below the low limit defined in MFSL register. Each bit relates
8427
+ * to a single tachometer and indicates the specific tachometer reading is
8428
+ * below the threshold.
8429
+ * Access: RO
8430
+ */
8431
+MLXSW_ITEM32(reg, fore, fan_under_limit, 0x00, 16, 10);
8432
+
8433
+static inline void mlxsw_reg_fore_unpack(char *payload, u8 tacho,
8434
+ bool *fault)
8435
+{
8436
+ u16 limit;
8437
+
8438
+ if (fault) {
8439
+ limit = mlxsw_reg_fore_fan_under_limit_get(payload);
8440
+ *fault = limit & BIT(tacho);
8441
+ }
8442
+}
8443
+
74698444 /* MTCAP - Management Temperature Capabilities
74708445 * -------------------------------------------
74718446 * This register exposes the capabilities of the device and
....@@ -7494,16 +8469,21 @@
74948469
74958470 MLXSW_REG_DEFINE(mtmp, MLXSW_REG_MTMP_ID, MLXSW_REG_MTMP_LEN);
74968471
8472
+#define MLXSW_REG_MTMP_MODULE_INDEX_MIN 64
8473
+#define MLXSW_REG_MTMP_GBOX_INDEX_MIN 256
74978474 /* reg_mtmp_sensor_index
74988475 * Sensors index to access.
74998476 * 64-127 of sensor_index are mapped to the SFP+/QSFP modules sequentially
75008477 * (module 0 is mapped to sensor_index 64).
75018478 * Access: Index
75028479 */
7503
-MLXSW_ITEM32(reg, mtmp, sensor_index, 0x00, 0, 7);
8480
+MLXSW_ITEM32(reg, mtmp, sensor_index, 0x00, 0, 12);
75048481
75058482 /* Convert to milli degrees Celsius */
7506
-#define MLXSW_REG_MTMP_TEMP_TO_MC(val) (val * 125)
8483
+#define MLXSW_REG_MTMP_TEMP_TO_MC(val) ({ typeof(val) v_ = (val); \
8484
+ ((v_) >= 0) ? ((v_) * 125) : \
8485
+ ((s16)((GENMASK(15, 0) + (v_) + 1) \
8486
+ * 125)); })
75078487
75088488 /* reg_mtmp_temperature
75098489 * Temperature reading from the sensor. Reading is in 0.125 Celsius
....@@ -7538,6 +8518,13 @@
75388518 * 2 - Generate single event
75398519 * Access: RW
75408520 */
8521
+
8522
+enum mlxsw_reg_mtmp_tee {
8523
+ MLXSW_REG_MTMP_TEE_NO_EVENT,
8524
+ MLXSW_REG_MTMP_TEE_GENERATE_EVENT,
8525
+ MLXSW_REG_MTMP_TEE_GENERATE_SINGLE_EVENT,
8526
+};
8527
+
75418528 MLXSW_ITEM32(reg, mtmp, tee, 0x0C, 30, 2);
75428529
75438530 #define MLXSW_REG_MTMP_THRESH_HI 0x348 /* 105 Celsius */
....@@ -7548,6 +8535,7 @@
75488535 */
75498536 MLXSW_ITEM32(reg, mtmp, temperature_threshold_hi, 0x0C, 0, 16);
75508537
8538
+#define MLXSW_REG_MTMP_HYSTERESIS_TEMP 0x28 /* 5 Celsius */
75518539 /* reg_mtmp_temperature_threshold_lo
75528540 * Low threshold for Temperature Warning Event. In 0.125 Celsius.
75538541 * Access: RW
....@@ -7562,7 +8550,7 @@
75628550 */
75638551 MLXSW_ITEM_BUF(reg, mtmp, sensor_name, 0x18, MLXSW_REG_MTMP_SENSOR_NAME_SIZE);
75648552
7565
-static inline void mlxsw_reg_mtmp_pack(char *payload, u8 sensor_index,
8553
+static inline void mlxsw_reg_mtmp_pack(char *payload, u16 sensor_index,
75668554 bool max_temp_enable,
75678555 bool max_temp_reset)
75688556 {
....@@ -7574,11 +8562,10 @@
75748562 MLXSW_REG_MTMP_THRESH_HI);
75758563 }
75768564
7577
-static inline void mlxsw_reg_mtmp_unpack(char *payload, unsigned int *p_temp,
7578
- unsigned int *p_max_temp,
7579
- char *sensor_name)
8565
+static inline void mlxsw_reg_mtmp_unpack(char *payload, int *p_temp,
8566
+ int *p_max_temp, char *sensor_name)
75808567 {
7581
- u16 temp;
8568
+ s16 temp;
75828569
75838570 if (p_temp) {
75848571 temp = mlxsw_reg_mtmp_temperature_get(payload);
....@@ -7590,6 +8577,97 @@
75908577 }
75918578 if (sensor_name)
75928579 mlxsw_reg_mtmp_sensor_name_memcpy_from(payload, sensor_name);
8580
+}
8581
+
8582
+/* MTWE - Management Temperature Warning Event
8583
+ * -------------------------------------------
8584
+ * This register is used for over temperature warning.
8585
+ */
8586
+#define MLXSW_REG_MTWE_ID 0x900B
8587
+#define MLXSW_REG_MTWE_LEN 0x10
8588
+
8589
+MLXSW_REG_DEFINE(mtwe, MLXSW_REG_MTWE_ID, MLXSW_REG_MTWE_LEN);
8590
+
8591
+/* reg_mtwe_sensor_warning
8592
+ * Bit vector indicating which of the sensor reading is above threshold.
8593
+ * Address 00h bit31 is sensor_warning[127].
8594
+ * Address 0Ch bit0 is sensor_warning[0].
8595
+ * Access: RO
8596
+ */
8597
+MLXSW_ITEM_BIT_ARRAY(reg, mtwe, sensor_warning, 0x0, 0x10, 1);
8598
+
8599
+/* MTBR - Management Temperature Bulk Register
8600
+ * -------------------------------------------
8601
+ * This register is used for bulk temperature reading.
8602
+ */
8603
+#define MLXSW_REG_MTBR_ID 0x900F
8604
+#define MLXSW_REG_MTBR_BASE_LEN 0x10 /* base length, without records */
8605
+#define MLXSW_REG_MTBR_REC_LEN 0x04 /* record length */
8606
+#define MLXSW_REG_MTBR_REC_MAX_COUNT 47 /* firmware limitation */
8607
+#define MLXSW_REG_MTBR_LEN (MLXSW_REG_MTBR_BASE_LEN + \
8608
+ MLXSW_REG_MTBR_REC_LEN * \
8609
+ MLXSW_REG_MTBR_REC_MAX_COUNT)
8610
+
8611
+MLXSW_REG_DEFINE(mtbr, MLXSW_REG_MTBR_ID, MLXSW_REG_MTBR_LEN);
8612
+
8613
+/* reg_mtbr_base_sensor_index
8614
+ * Base sensors index to access (0 - ASIC sensor, 1-63 - ambient sensors,
8615
+ * 64-127 are mapped to the SFP+/QSFP modules sequentially).
8616
+ * Access: Index
8617
+ */
8618
+MLXSW_ITEM32(reg, mtbr, base_sensor_index, 0x00, 0, 12);
8619
+
8620
+/* reg_mtbr_num_rec
8621
+ * Request: Number of records to read
8622
+ * Response: Number of records read
8623
+ * See above description for more details.
8624
+ * Range 1..255
8625
+ * Access: RW
8626
+ */
8627
+MLXSW_ITEM32(reg, mtbr, num_rec, 0x04, 0, 8);
8628
+
8629
+/* reg_mtbr_rec_max_temp
8630
+ * The highest measured temperature from the sensor.
8631
+ * When the bit mte is cleared, the field max_temperature is reserved.
8632
+ * Access: RO
8633
+ */
8634
+MLXSW_ITEM32_INDEXED(reg, mtbr, rec_max_temp, MLXSW_REG_MTBR_BASE_LEN, 16,
8635
+ 16, MLXSW_REG_MTBR_REC_LEN, 0x00, false);
8636
+
8637
+/* reg_mtbr_rec_temp
8638
+ * Temperature reading from the sensor. Reading is in 0..125 Celsius
8639
+ * degrees units.
8640
+ * Access: RO
8641
+ */
8642
+MLXSW_ITEM32_INDEXED(reg, mtbr, rec_temp, MLXSW_REG_MTBR_BASE_LEN, 0, 16,
8643
+ MLXSW_REG_MTBR_REC_LEN, 0x00, false);
8644
+
8645
+static inline void mlxsw_reg_mtbr_pack(char *payload, u16 base_sensor_index,
8646
+ u8 num_rec)
8647
+{
8648
+ MLXSW_REG_ZERO(mtbr, payload);
8649
+ mlxsw_reg_mtbr_base_sensor_index_set(payload, base_sensor_index);
8650
+ mlxsw_reg_mtbr_num_rec_set(payload, num_rec);
8651
+}
8652
+
8653
+/* Error codes from temperatute reading */
8654
+enum mlxsw_reg_mtbr_temp_status {
8655
+ MLXSW_REG_MTBR_NO_CONN = 0x8000,
8656
+ MLXSW_REG_MTBR_NO_TEMP_SENS = 0x8001,
8657
+ MLXSW_REG_MTBR_INDEX_NA = 0x8002,
8658
+ MLXSW_REG_MTBR_BAD_SENS_INFO = 0x8003,
8659
+};
8660
+
8661
+/* Base index for reading modules temperature */
8662
+#define MLXSW_REG_MTBR_BASE_MODULE_INDEX 64
8663
+
8664
+static inline void mlxsw_reg_mtbr_temp_unpack(char *payload, int rec_ind,
8665
+ u16 *p_temp, u16 *p_max_temp)
8666
+{
8667
+ if (p_temp)
8668
+ *p_temp = mlxsw_reg_mtbr_rec_temp_get(payload, rec_ind);
8669
+ if (p_max_temp)
8670
+ *p_max_temp = mlxsw_reg_mtbr_rec_max_temp_get(payload, rec_ind);
75938671 }
75948672
75958673 /* MCIA - Management Cable Info Access
....@@ -7646,13 +8724,53 @@
76468724 */
76478725 MLXSW_ITEM32(reg, mcia, size, 0x08, 0, 16);
76488726
7649
-#define MLXSW_SP_REG_MCIA_EEPROM_SIZE 48
8727
+#define MLXSW_REG_MCIA_EEPROM_PAGE_LENGTH 256
8728
+#define MLXSW_REG_MCIA_EEPROM_UP_PAGE_LENGTH 128
8729
+#define MLXSW_REG_MCIA_EEPROM_SIZE 48
8730
+#define MLXSW_REG_MCIA_I2C_ADDR_LOW 0x50
8731
+#define MLXSW_REG_MCIA_I2C_ADDR_HIGH 0x51
8732
+#define MLXSW_REG_MCIA_PAGE0_LO_OFF 0xa0
8733
+#define MLXSW_REG_MCIA_TH_ITEM_SIZE 2
8734
+#define MLXSW_REG_MCIA_TH_PAGE_NUM 3
8735
+#define MLXSW_REG_MCIA_TH_PAGE_CMIS_NUM 2
8736
+#define MLXSW_REG_MCIA_PAGE0_LO 0
8737
+#define MLXSW_REG_MCIA_TH_PAGE_OFF 0x80
8738
+#define MLXSW_REG_MCIA_EEPROM_CMIS_FLAT_MEMORY BIT(7)
8739
+
8740
+enum mlxsw_reg_mcia_eeprom_module_info_rev_id {
8741
+ MLXSW_REG_MCIA_EEPROM_MODULE_INFO_REV_ID_UNSPC = 0x00,
8742
+ MLXSW_REG_MCIA_EEPROM_MODULE_INFO_REV_ID_8436 = 0x01,
8743
+ MLXSW_REG_MCIA_EEPROM_MODULE_INFO_REV_ID_8636 = 0x03,
8744
+};
8745
+
8746
+enum mlxsw_reg_mcia_eeprom_module_info_id {
8747
+ MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_SFP = 0x03,
8748
+ MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_QSFP = 0x0C,
8749
+ MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_QSFP_PLUS = 0x0D,
8750
+ MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_QSFP28 = 0x11,
8751
+ MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_QSFP_DD = 0x18,
8752
+};
8753
+
8754
+enum mlxsw_reg_mcia_eeprom_module_info {
8755
+ MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID,
8756
+ MLXSW_REG_MCIA_EEPROM_MODULE_INFO_REV_ID,
8757
+ MLXSW_REG_MCIA_EEPROM_MODULE_INFO_TYPE_ID,
8758
+ MLXSW_REG_MCIA_EEPROM_MODULE_INFO_SIZE,
8759
+};
76508760
76518761 /* reg_mcia_eeprom
76528762 * Bytes to read/write.
76538763 * Access: RW
76548764 */
7655
-MLXSW_ITEM_BUF(reg, mcia, eeprom, 0x10, MLXSW_SP_REG_MCIA_EEPROM_SIZE);
8765
+MLXSW_ITEM_BUF(reg, mcia, eeprom, 0x10, MLXSW_REG_MCIA_EEPROM_SIZE);
8766
+
8767
+/* This is used to access the optional upper pages (1-3) in the QSFP+
8768
+ * memory map. Page 1 is available on offset 256 through 383, page 2 -
8769
+ * on offset 384 through 511, page 3 - on offset 512 through 639.
8770
+ */
8771
+#define MLXSW_REG_MCIA_PAGE_GET(off) (((off) - \
8772
+ MLXSW_REG_MCIA_EEPROM_PAGE_LENGTH) / \
8773
+ MLXSW_REG_MCIA_EEPROM_UP_PAGE_LENGTH + 1)
76568774
76578775 static inline void mlxsw_reg_mcia_pack(char *payload, u8 module, u8 lock,
76588776 u8 page_number, u16 device_addr,
....@@ -7682,6 +8800,13 @@
76828800 * Access: Index
76838801 */
76848802 MLXSW_ITEM32(reg, mpat, pa_id, 0x00, 28, 4);
8803
+
8804
+/* reg_mpat_session_id
8805
+ * Mirror Session ID.
8806
+ * Used for MIRROR_SESSION<i> trap.
8807
+ * Access: RW
8808
+ */
8809
+MLXSW_ITEM32(reg, mpat, session_id, 0x00, 24, 4);
76858810
76868811 /* reg_mpat_system_port
76878812 * A unique port identifier for the final destination of the packet.
....@@ -7739,6 +8864,18 @@
77398864 * Access: RW
77408865 */
77418866 MLXSW_ITEM32(reg, mpat, span_type, 0x04, 0, 4);
8867
+
8868
+/* reg_mpat_pide
8869
+ * Policer enable.
8870
+ * Access: RW
8871
+ */
8872
+MLXSW_ITEM32(reg, mpat, pide, 0x0C, 15, 1);
8873
+
8874
+/* reg_mpat_pid
8875
+ * Policer ID.
8876
+ * Access: RW
8877
+ */
8878
+MLXSW_ITEM32(reg, mpat, pid, 0x0C, 0, 14);
77428879
77438880 /* Remote SPAN - Ethernet VLAN
77448881 * - - - - - - - - - - - - - -
....@@ -7878,7 +9015,7 @@
78789015 * properties.
78799016 */
78809017 #define MLXSW_REG_MPAR_ID 0x901B
7881
-#define MLXSW_REG_MPAR_LEN 0x08
9018
+#define MLXSW_REG_MPAR_LEN 0x0C
78829019
78839020 MLXSW_REG_DEFINE(mpar, MLXSW_REG_MPAR_ID, MLXSW_REG_MPAR_LEN);
78849021
....@@ -7921,6 +9058,60 @@
79219058 mlxsw_reg_mpar_enable_set(payload, enable);
79229059 mlxsw_reg_mpar_i_e_set(payload, i_e);
79239060 mlxsw_reg_mpar_pa_id_set(payload, pa_id);
9061
+}
9062
+
9063
+/* MGIR - Management General Information Register
9064
+ * ----------------------------------------------
9065
+ * MGIR register allows software to query the hardware and firmware general
9066
+ * information.
9067
+ */
9068
+#define MLXSW_REG_MGIR_ID 0x9020
9069
+#define MLXSW_REG_MGIR_LEN 0x9C
9070
+
9071
+MLXSW_REG_DEFINE(mgir, MLXSW_REG_MGIR_ID, MLXSW_REG_MGIR_LEN);
9072
+
9073
+/* reg_mgir_hw_info_device_hw_revision
9074
+ * Access: RO
9075
+ */
9076
+MLXSW_ITEM32(reg, mgir, hw_info_device_hw_revision, 0x0, 16, 16);
9077
+
9078
+#define MLXSW_REG_MGIR_FW_INFO_PSID_SIZE 16
9079
+
9080
+/* reg_mgir_fw_info_psid
9081
+ * PSID (ASCII string).
9082
+ * Access: RO
9083
+ */
9084
+MLXSW_ITEM_BUF(reg, mgir, fw_info_psid, 0x30, MLXSW_REG_MGIR_FW_INFO_PSID_SIZE);
9085
+
9086
+/* reg_mgir_fw_info_extended_major
9087
+ * Access: RO
9088
+ */
9089
+MLXSW_ITEM32(reg, mgir, fw_info_extended_major, 0x44, 0, 32);
9090
+
9091
+/* reg_mgir_fw_info_extended_minor
9092
+ * Access: RO
9093
+ */
9094
+MLXSW_ITEM32(reg, mgir, fw_info_extended_minor, 0x48, 0, 32);
9095
+
9096
+/* reg_mgir_fw_info_extended_sub_minor
9097
+ * Access: RO
9098
+ */
9099
+MLXSW_ITEM32(reg, mgir, fw_info_extended_sub_minor, 0x4C, 0, 32);
9100
+
9101
+static inline void mlxsw_reg_mgir_pack(char *payload)
9102
+{
9103
+ MLXSW_REG_ZERO(mgir, payload);
9104
+}
9105
+
9106
+static inline void
9107
+mlxsw_reg_mgir_unpack(char *payload, u32 *hw_rev, char *fw_info_psid,
9108
+ u32 *fw_major, u32 *fw_minor, u32 *fw_sub_minor)
9109
+{
9110
+ *hw_rev = mlxsw_reg_mgir_hw_info_device_hw_revision_get(payload);
9111
+ mlxsw_reg_mgir_fw_info_psid_memcpy_from(payload, fw_info_psid);
9112
+ *fw_major = mlxsw_reg_mgir_fw_info_extended_major_get(payload);
9113
+ *fw_minor = mlxsw_reg_mgir_fw_info_extended_minor_get(payload);
9114
+ *fw_sub_minor = mlxsw_reg_mgir_fw_info_extended_sub_minor_get(payload);
79249115 }
79259116
79269117 /* MRSR - Management Reset and Shutdown Register
....@@ -7986,6 +9177,107 @@
79869177 mlxsw_reg_mlcr_local_port_set(payload, local_port);
79879178 mlxsw_reg_mlcr_beacon_duration_set(payload, active ?
79889179 MLXSW_REG_MLCR_DURATION_MAX : 0);
9180
+}
9181
+
9182
+/* MTPPS - Management Pulse Per Second Register
9183
+ * --------------------------------------------
9184
+ * This register provides the device PPS capabilities, configure the PPS in and
9185
+ * out modules and holds the PPS in time stamp.
9186
+ */
9187
+#define MLXSW_REG_MTPPS_ID 0x9053
9188
+#define MLXSW_REG_MTPPS_LEN 0x3C
9189
+
9190
+MLXSW_REG_DEFINE(mtpps, MLXSW_REG_MTPPS_ID, MLXSW_REG_MTPPS_LEN);
9191
+
9192
+/* reg_mtpps_enable
9193
+ * Enables the PPS functionality the specific pin.
9194
+ * A boolean variable.
9195
+ * Access: RW
9196
+ */
9197
+MLXSW_ITEM32(reg, mtpps, enable, 0x20, 31, 1);
9198
+
9199
+enum mlxsw_reg_mtpps_pin_mode {
9200
+ MLXSW_REG_MTPPS_PIN_MODE_VIRTUAL_PIN = 0x2,
9201
+};
9202
+
9203
+/* reg_mtpps_pin_mode
9204
+ * Pin mode to be used. The mode must comply with the supported modes of the
9205
+ * requested pin.
9206
+ * Access: RW
9207
+ */
9208
+MLXSW_ITEM32(reg, mtpps, pin_mode, 0x20, 8, 4);
9209
+
9210
+#define MLXSW_REG_MTPPS_PIN_SP_VIRTUAL_PIN 7
9211
+
9212
+/* reg_mtpps_pin
9213
+ * Pin to be configured or queried out of the supported pins.
9214
+ * Access: Index
9215
+ */
9216
+MLXSW_ITEM32(reg, mtpps, pin, 0x20, 0, 8);
9217
+
9218
+/* reg_mtpps_time_stamp
9219
+ * When pin_mode = pps_in, the latched device time when it was triggered from
9220
+ * the external GPIO pin.
9221
+ * When pin_mode = pps_out or virtual_pin or pps_out_and_virtual_pin, the target
9222
+ * time to generate next output signal.
9223
+ * Time is in units of device clock.
9224
+ * Access: RW
9225
+ */
9226
+MLXSW_ITEM64(reg, mtpps, time_stamp, 0x28, 0, 64);
9227
+
9228
+static inline void
9229
+mlxsw_reg_mtpps_vpin_pack(char *payload, u64 time_stamp)
9230
+{
9231
+ MLXSW_REG_ZERO(mtpps, payload);
9232
+ mlxsw_reg_mtpps_pin_set(payload, MLXSW_REG_MTPPS_PIN_SP_VIRTUAL_PIN);
9233
+ mlxsw_reg_mtpps_pin_mode_set(payload,
9234
+ MLXSW_REG_MTPPS_PIN_MODE_VIRTUAL_PIN);
9235
+ mlxsw_reg_mtpps_enable_set(payload, true);
9236
+ mlxsw_reg_mtpps_time_stamp_set(payload, time_stamp);
9237
+}
9238
+
9239
+/* MTUTC - Management UTC Register
9240
+ * -------------------------------
9241
+ * Configures the HW UTC counter.
9242
+ */
9243
+#define MLXSW_REG_MTUTC_ID 0x9055
9244
+#define MLXSW_REG_MTUTC_LEN 0x1C
9245
+
9246
+MLXSW_REG_DEFINE(mtutc, MLXSW_REG_MTUTC_ID, MLXSW_REG_MTUTC_LEN);
9247
+
9248
+enum mlxsw_reg_mtutc_operation {
9249
+ MLXSW_REG_MTUTC_OPERATION_SET_TIME_AT_NEXT_SEC = 0,
9250
+ MLXSW_REG_MTUTC_OPERATION_ADJUST_FREQ = 3,
9251
+};
9252
+
9253
+/* reg_mtutc_operation
9254
+ * Operation.
9255
+ * Access: OP
9256
+ */
9257
+MLXSW_ITEM32(reg, mtutc, operation, 0x00, 0, 4);
9258
+
9259
+/* reg_mtutc_freq_adjustment
9260
+ * Frequency adjustment: Every PPS the HW frequency will be
9261
+ * adjusted by this value. Units of HW clock, where HW counts
9262
+ * 10^9 HW clocks for 1 HW second.
9263
+ * Access: RW
9264
+ */
9265
+MLXSW_ITEM32(reg, mtutc, freq_adjustment, 0x04, 0, 32);
9266
+
9267
+/* reg_mtutc_utc_sec
9268
+ * UTC seconds.
9269
+ * Access: WO
9270
+ */
9271
+MLXSW_ITEM32(reg, mtutc, utc_sec, 0x10, 0, 32);
9272
+
9273
+static inline void
9274
+mlxsw_reg_mtutc_pack(char *payload, enum mlxsw_reg_mtutc_operation oper,
9275
+ u32 freq_adj, u32 utc_sec)
9276
+{
9277
+ MLXSW_REG_ZERO(mtutc, payload);
9278
+ mlxsw_reg_mtutc_operation_set(payload, oper);
9279
+ mlxsw_reg_mtutc_freq_adjustment_set(payload, freq_adj);
9280
+ mlxsw_reg_mtutc_utc_sec_set(payload, utc_sec);
79899281 }
79909282
79919283 /* MCQI - Management Component Query Information
....@@ -8299,6 +9591,983 @@
82999591 mlxsw_reg_mgpc_opcode_set(payload, opcode);
83009592 }
83019593
9594
+/* MPRS - Monitoring Parsing State Register
9595
+ * ----------------------------------------
9596
+ * The MPRS register is used for setting up the parsing for hash,
9597
+ * policy-engine and routing.
9598
+ */
9599
+#define MLXSW_REG_MPRS_ID 0x9083
9600
+#define MLXSW_REG_MPRS_LEN 0x14
9601
+
9602
+MLXSW_REG_DEFINE(mprs, MLXSW_REG_MPRS_ID, MLXSW_REG_MPRS_LEN);
9603
+
9604
+/* reg_mprs_parsing_depth
9605
+ * Minimum parsing depth.
9606
+ * Need to enlarge parsing depth according to L3, MPLS, tunnels, ACL
9607
+ * rules, traps, hash, etc. Default is 96 bytes. Reserved when SwitchX-2.
9608
+ * Access: RW
9609
+ */
9610
+MLXSW_ITEM32(reg, mprs, parsing_depth, 0x00, 0, 16);
9611
+
9612
+/* reg_mprs_parsing_en
9613
+ * Parsing enable.
9614
+ * Bit 0 - Enable parsing of NVE of types VxLAN, VxLAN-GPE, GENEVE and
9615
+ * NVGRE. Default is enabled. Reserved when SwitchX-2.
9616
+ * Access: RW
9617
+ */
9618
+MLXSW_ITEM32(reg, mprs, parsing_en, 0x04, 0, 16);
9619
+
9620
+/* reg_mprs_vxlan_udp_dport
9621
+ * VxLAN UDP destination port.
9622
+ * Used for identifying VxLAN packets and for dport field in
9623
+ * encapsulation. Default is 4789.
9624
+ * Access: RW
9625
+ */
9626
+MLXSW_ITEM32(reg, mprs, vxlan_udp_dport, 0x10, 0, 16);
9627
+
9628
+static inline void mlxsw_reg_mprs_pack(char *payload, u16 parsing_depth,
9629
+ u16 vxlan_udp_dport)
9630
+{
9631
+ MLXSW_REG_ZERO(mprs, payload);
9632
+ mlxsw_reg_mprs_parsing_depth_set(payload, parsing_depth);
9633
+ mlxsw_reg_mprs_parsing_en_set(payload, true);
9634
+ mlxsw_reg_mprs_vxlan_udp_dport_set(payload, vxlan_udp_dport);
9635
+}
9636
+
9637
+/* MOGCR - Monitoring Global Configuration Register
9638
+ * ------------------------------------------------
9639
+ */
9640
+#define MLXSW_REG_MOGCR_ID 0x9086
9641
+#define MLXSW_REG_MOGCR_LEN 0x20
9642
+
9643
+MLXSW_REG_DEFINE(mogcr, MLXSW_REG_MOGCR_ID, MLXSW_REG_MOGCR_LEN);
9644
+
9645
+/* reg_mogcr_ptp_iftc
9646
+ * PTP Ingress FIFO Trap Clear
9647
+ * The PTP_ING_FIFO trap provides MTPPTR with clr according
9648
+ * to this value. Default 0.
9649
+ * Reserved when IB switches and when SwitchX/-2, Spectrum-2
9650
+ * Access: RW
9651
+ */
9652
+MLXSW_ITEM32(reg, mogcr, ptp_iftc, 0x00, 1, 1);
9653
+
9654
+/* reg_mogcr_ptp_eftc
9655
+ * PTP Egress FIFO Trap Clear
9656
+ * The PTP_EGR_FIFO trap provides MTPPTR with clr according
9657
+ * to this value. Default 0.
9658
+ * Reserved when IB switches and when SwitchX/-2, Spectrum-2
9659
+ * Access: RW
9660
+ */
9661
+MLXSW_ITEM32(reg, mogcr, ptp_eftc, 0x00, 0, 1);
9662
+
9663
+/* reg_mogcr_mirroring_pid_base
9664
+ * Base policer id for mirroring policers.
9665
+ * Must have an even value (e.g. 1000, not 1001).
9666
+ * Reserved when SwitchX/-2, Switch-IB/2, Spectrum-1 and Quantum.
9667
+ * Access: RW
9668
+ */
9669
+MLXSW_ITEM32(reg, mogcr, mirroring_pid_base, 0x0C, 0, 14);
9670
+
9671
+/* MPAGR - Monitoring Port Analyzer Global Register
9672
+ * ------------------------------------------------
9673
+ * This register is used for global port analyzer configurations.
9674
+ * Note: This register is not supported by current FW versions for Spectrum-1.
9675
+ */
9676
+#define MLXSW_REG_MPAGR_ID 0x9089
9677
+#define MLXSW_REG_MPAGR_LEN 0x0C
9678
+
9679
+MLXSW_REG_DEFINE(mpagr, MLXSW_REG_MPAGR_ID, MLXSW_REG_MPAGR_LEN);
9680
+
9681
+enum mlxsw_reg_mpagr_trigger {
9682
+ MLXSW_REG_MPAGR_TRIGGER_EGRESS,
9683
+ MLXSW_REG_MPAGR_TRIGGER_INGRESS,
9684
+ MLXSW_REG_MPAGR_TRIGGER_INGRESS_WRED,
9685
+ MLXSW_REG_MPAGR_TRIGGER_INGRESS_SHARED_BUFFER,
9686
+ MLXSW_REG_MPAGR_TRIGGER_INGRESS_ING_CONG,
9687
+ MLXSW_REG_MPAGR_TRIGGER_INGRESS_EGR_CONG,
9688
+ MLXSW_REG_MPAGR_TRIGGER_EGRESS_ECN,
9689
+ MLXSW_REG_MPAGR_TRIGGER_EGRESS_HIGH_LATENCY,
9690
+};
9691
+
9692
+/* reg_mpagr_trigger
9693
+ * Mirror trigger.
9694
+ * Access: Index
9695
+ */
9696
+MLXSW_ITEM32(reg, mpagr, trigger, 0x00, 0, 4);
9697
+
9698
+/* reg_mpagr_pa_id
9699
+ * Port analyzer ID.
9700
+ * Access: RW
9701
+ */
9702
+MLXSW_ITEM32(reg, mpagr, pa_id, 0x04, 0, 4);
9703
+
9704
+/* reg_mpagr_probability_rate
9705
+ * Sampling rate.
9706
+ * Valid values are: 1 to 3.5*10^9
9707
+ * Value of 1 means "sample all". Default is 1.
9708
+ * Access: RW
9709
+ */
9710
+MLXSW_ITEM32(reg, mpagr, probability_rate, 0x08, 0, 32);
9711
+
9712
+static inline void mlxsw_reg_mpagr_pack(char *payload,
9713
+ enum mlxsw_reg_mpagr_trigger trigger,
9714
+ u8 pa_id, u32 probability_rate)
9715
+{
9716
+ MLXSW_REG_ZERO(mpagr, payload);
9717
+ mlxsw_reg_mpagr_trigger_set(payload, trigger);
9718
+ mlxsw_reg_mpagr_pa_id_set(payload, pa_id);
9719
+ mlxsw_reg_mpagr_probability_rate_set(payload, probability_rate);
9720
+}
9721
+
9722
+/* MOMTE - Monitoring Mirror Trigger Enable Register
9723
+ * -------------------------------------------------
9724
+ * This register is used to configure the mirror enable for different mirror
9725
+ * reasons.
9726
+ */
9727
+#define MLXSW_REG_MOMTE_ID 0x908D
9728
+#define MLXSW_REG_MOMTE_LEN 0x10
9729
+
9730
+MLXSW_REG_DEFINE(momte, MLXSW_REG_MOMTE_ID, MLXSW_REG_MOMTE_LEN);
9731
+
9732
+/* reg_momte_local_port
9733
+ * Local port number.
9734
+ * Access: Index
9735
+ */
9736
+MLXSW_ITEM32(reg, momte, local_port, 0x00, 16, 8);
9737
+
9738
+enum mlxsw_reg_momte_type {
9739
+ MLXSW_REG_MOMTE_TYPE_WRED = 0x20,
9740
+ MLXSW_REG_MOMTE_TYPE_SHARED_BUFFER_TCLASS = 0x31,
9741
+ MLXSW_REG_MOMTE_TYPE_SHARED_BUFFER_TCLASS_DESCRIPTORS = 0x32,
9742
+ MLXSW_REG_MOMTE_TYPE_SHARED_BUFFER_EGRESS_PORT = 0x33,
9743
+ MLXSW_REG_MOMTE_TYPE_ING_CONG = 0x40,
9744
+ MLXSW_REG_MOMTE_TYPE_EGR_CONG = 0x50,
9745
+ MLXSW_REG_MOMTE_TYPE_ECN = 0x60,
9746
+ MLXSW_REG_MOMTE_TYPE_HIGH_LATENCY = 0x70,
9747
+};
9748
+
9749
+/* reg_momte_type
9750
+ * Type of mirroring.
9751
+ * Access: Index
9752
+ */
9753
+MLXSW_ITEM32(reg, momte, type, 0x04, 0, 8);
9754
+
9755
+/* reg_momte_tclass_en
9756
+ * TClass/PG mirror enable. Each bit represents corresponding tclass.
9757
+ * 0: disable (default)
9758
+ * 1: enable
9759
+ * Access: RW
9760
+ */
9761
+MLXSW_ITEM_BIT_ARRAY(reg, momte, tclass_en, 0x08, 0x08, 1);
9762
+
9763
+static inline void mlxsw_reg_momte_pack(char *payload, u8 local_port,
9764
+ enum mlxsw_reg_momte_type type)
9765
+{
9766
+ MLXSW_REG_ZERO(momte, payload);
9767
+ mlxsw_reg_momte_local_port_set(payload, local_port);
9768
+ mlxsw_reg_momte_type_set(payload, type);
9769
+}
9770
+
9771
+/* MTPPPC - Time Precision Packet Port Configuration
9772
+ * -------------------------------------------------
9773
+ * This register serves for configuration of which PTP messages should be
9774
+ * timestamped. This is a global configuration, despite the register name.
9775
+ *
9776
+ * Reserved when Spectrum-2.
9777
+ */
9778
+#define MLXSW_REG_MTPPPC_ID 0x9090
9779
+#define MLXSW_REG_MTPPPC_LEN 0x28
9780
+
9781
+MLXSW_REG_DEFINE(mtpppc, MLXSW_REG_MTPPPC_ID, MLXSW_REG_MTPPPC_LEN);
9782
+
9783
+/* reg_mtpppc_ing_timestamp_message_type
9784
+ * Bitwise vector of PTP message types to timestamp at ingress.
9785
+ * MessageType field as defined by IEEE 1588
9786
+ * Each bit corresponds to a value (e.g. Bit0: Sync, Bit1: Delay_Req)
9787
+ * Default all 0
9788
+ * Access: RW
9789
+ */
9790
+MLXSW_ITEM32(reg, mtpppc, ing_timestamp_message_type, 0x08, 0, 16);
9791
+
9792
+/* reg_mtpppc_egr_timestamp_message_type
9793
+ * Bitwise vector of PTP message types to timestamp at egress.
9794
+ * MessageType field as defined by IEEE 1588
9795
+ * Each bit corresponds to a value (e.g. Bit0: Sync, Bit1: Delay_Req)
9796
+ * Default all 0
9797
+ * Access: RW
9798
+ */
9799
+MLXSW_ITEM32(reg, mtpppc, egr_timestamp_message_type, 0x0C, 0, 16);
9800
+
9801
+static inline void mlxsw_reg_mtpppc_pack(char *payload, u16 ing, u16 egr)
9802
+{
9803
+ MLXSW_REG_ZERO(mtpppc, payload);
9804
+ mlxsw_reg_mtpppc_ing_timestamp_message_type_set(payload, ing);
9805
+ mlxsw_reg_mtpppc_egr_timestamp_message_type_set(payload, egr);
9806
+}
9807
+
9808
+/* MTPPTR - Time Precision Packet Timestamping Reading
9809
+ * ---------------------------------------------------
9810
+ * The MTPPTR is used for reading the per port PTP timestamp FIFO.
9811
+ * There is a trap for packets which are latched to the timestamp FIFO, thus the
9812
+ * SW knows which FIFO to read. Note that packets enter the FIFO before been
9813
+ * trapped. The sequence number is used to synchronize the timestamp FIFO
9814
+ * entries and the trapped packets.
9815
+ * Reserved when Spectrum-2.
9816
+ */
9817
+
9818
+#define MLXSW_REG_MTPPTR_ID 0x9091
9819
+#define MLXSW_REG_MTPPTR_BASE_LEN 0x10 /* base length, without records */
9820
+#define MLXSW_REG_MTPPTR_REC_LEN 0x10 /* record length */
9821
+#define MLXSW_REG_MTPPTR_REC_MAX_COUNT 4
9822
+#define MLXSW_REG_MTPPTR_LEN (MLXSW_REG_MTPPTR_BASE_LEN + \
9823
+ MLXSW_REG_MTPPTR_REC_LEN * MLXSW_REG_MTPPTR_REC_MAX_COUNT)
9824
+
9825
+MLXSW_REG_DEFINE(mtpptr, MLXSW_REG_MTPPTR_ID, MLXSW_REG_MTPPTR_LEN);
9826
+
9827
+/* reg_mtpptr_local_port
9828
+ * Not supported for CPU port.
9829
+ * Access: Index
9830
+ */
9831
+MLXSW_ITEM32(reg, mtpptr, local_port, 0x00, 16, 8);
9832
+
9833
+enum mlxsw_reg_mtpptr_dir {
9834
+ MLXSW_REG_MTPPTR_DIR_INGRESS,
9835
+ MLXSW_REG_MTPPTR_DIR_EGRESS,
9836
+};
9837
+
9838
+/* reg_mtpptr_dir
9839
+ * Direction.
9840
+ * Access: Index
9841
+ */
9842
+MLXSW_ITEM32(reg, mtpptr, dir, 0x00, 0, 1);
9843
+
9844
+/* reg_mtpptr_clr
9845
+ * Clear the records.
9846
+ * Access: OP
9847
+ */
9848
+MLXSW_ITEM32(reg, mtpptr, clr, 0x04, 31, 1);
9849
+
9850
+/* reg_mtpptr_num_rec
9851
+ * Number of valid records in the response
9852
+ * Range 0.. cap_ptp_timestamp_fifo
9853
+ * Access: RO
9854
+ */
9855
+MLXSW_ITEM32(reg, mtpptr, num_rec, 0x08, 0, 4);
9856
+
9857
+/* reg_mtpptr_rec_message_type
9858
+ * MessageType field as defined by IEEE 1588 Each bit corresponds to a value
9859
+ * (e.g. Bit0: Sync, Bit1: Delay_Req)
9860
+ * Access: RO
9861
+ */
9862
+MLXSW_ITEM32_INDEXED(reg, mtpptr, rec_message_type,
9863
+ MLXSW_REG_MTPPTR_BASE_LEN, 8, 4,
9864
+ MLXSW_REG_MTPPTR_REC_LEN, 0, false);
9865
+
9866
+/* reg_mtpptr_rec_domain_number
9867
+ * DomainNumber field as defined by IEEE 1588
9868
+ * Access: RO
9869
+ */
9870
+MLXSW_ITEM32_INDEXED(reg, mtpptr, rec_domain_number,
9871
+ MLXSW_REG_MTPPTR_BASE_LEN, 0, 8,
9872
+ MLXSW_REG_MTPPTR_REC_LEN, 0, false);
9873
+
9874
+/* reg_mtpptr_rec_sequence_id
9875
+ * SequenceId field as defined by IEEE 1588
9876
+ * Access: RO
9877
+ */
9878
+MLXSW_ITEM32_INDEXED(reg, mtpptr, rec_sequence_id,
9879
+ MLXSW_REG_MTPPTR_BASE_LEN, 0, 16,
9880
+ MLXSW_REG_MTPPTR_REC_LEN, 0x4, false);
9881
+
9882
+/* reg_mtpptr_rec_timestamp_high
9883
+ * Timestamp of when the PTP packet has passed through the port Units of PLL
9884
+ * clock time.
9885
+ * For Spectrum-1 the PLL clock is 156.25Mhz and PLL clock time is 6.4nSec.
9886
+ * Access: RO
9887
+ */
9888
+MLXSW_ITEM32_INDEXED(reg, mtpptr, rec_timestamp_high,
9889
+ MLXSW_REG_MTPPTR_BASE_LEN, 0, 32,
9890
+ MLXSW_REG_MTPPTR_REC_LEN, 0x8, false);
9891
+
9892
+/* reg_mtpptr_rec_timestamp_low
9893
+ * See rec_timestamp_high.
9894
+ * Access: RO
9895
+ */
9896
+MLXSW_ITEM32_INDEXED(reg, mtpptr, rec_timestamp_low,
9897
+ MLXSW_REG_MTPPTR_BASE_LEN, 0, 32,
9898
+ MLXSW_REG_MTPPTR_REC_LEN, 0xC, false);
9899
+
9900
+static inline void mlxsw_reg_mtpptr_unpack(const char *payload,
9901
+ unsigned int rec,
9902
+ u8 *p_message_type,
9903
+ u8 *p_domain_number,
9904
+ u16 *p_sequence_id,
9905
+ u64 *p_timestamp)
9906
+{
9907
+ u32 timestamp_high, timestamp_low;
9908
+
9909
+ *p_message_type = mlxsw_reg_mtpptr_rec_message_type_get(payload, rec);
9910
+ *p_domain_number = mlxsw_reg_mtpptr_rec_domain_number_get(payload, rec);
9911
+ *p_sequence_id = mlxsw_reg_mtpptr_rec_sequence_id_get(payload, rec);
9912
+ timestamp_high = mlxsw_reg_mtpptr_rec_timestamp_high_get(payload, rec);
9913
+ timestamp_low = mlxsw_reg_mtpptr_rec_timestamp_low_get(payload, rec);
9914
+ *p_timestamp = (u64)timestamp_high << 32 | timestamp_low;
9915
+}
9916
+
9917
+/* MTPTPT - Monitoring Precision Time Protocol Trap Register
9918
+ * ---------------------------------------------------------
9919
+ * This register is used for configuring under which trap to deliver PTP
9920
+ * packets depending on type of the packet.
9921
+ */
9922
+#define MLXSW_REG_MTPTPT_ID 0x9092
9923
+#define MLXSW_REG_MTPTPT_LEN 0x08
9924
+
9925
+MLXSW_REG_DEFINE(mtptpt, MLXSW_REG_MTPTPT_ID, MLXSW_REG_MTPTPT_LEN);
9926
+
9927
+enum mlxsw_reg_mtptpt_trap_id {
9928
+ MLXSW_REG_MTPTPT_TRAP_ID_PTP0,
9929
+ MLXSW_REG_MTPTPT_TRAP_ID_PTP1,
9930
+};
9931
+
9932
+/* reg_mtptpt_trap_id
9933
+ * Trap id.
9934
+ * Access: Index
9935
+ */
9936
+MLXSW_ITEM32(reg, mtptpt, trap_id, 0x00, 0, 4);
9937
+
9938
+/* reg_mtptpt_message_type
9939
+ * Bitwise vector of PTP message types to trap. This is a necessary but
9940
+ * non-sufficient condition since need to enable also per port. See MTPPPC.
9941
+ * Message types are defined by IEEE 1588 Each bit corresponds to a value (e.g.
9942
+ * Bit0: Sync, Bit1: Delay_Req)
9943
+ */
9944
+MLXSW_ITEM32(reg, mtptpt, message_type, 0x04, 0, 16);
9945
+
9946
+static inline void mlxsw_reg_mtptptp_pack(char *payload,
9947
+ enum mlxsw_reg_mtptpt_trap_id trap_id,
9948
+ u16 message_type)
9949
+{
9950
+ MLXSW_REG_ZERO(mtptpt, payload);
9951
+ mlxsw_reg_mtptpt_trap_id_set(payload, trap_id);
9952
+ mlxsw_reg_mtptpt_message_type_set(payload, message_type);
9953
+}
9954
+
9955
+/* MFGD - Monitoring FW General Debug Register
9956
+ * -------------------------------------------
9957
+ */
9958
+#define MLXSW_REG_MFGD_ID 0x90F0
9959
+#define MLXSW_REG_MFGD_LEN 0x0C
9960
+
9961
+MLXSW_REG_DEFINE(mfgd, MLXSW_REG_MFGD_ID, MLXSW_REG_MFGD_LEN);
9962
+
9963
+/* reg_mfgd_fw_fatal_event_mode
9964
+ * 0 - don't check FW fatal (default)
9965
+ * 1 - check FW fatal - enable MFDE trap
9966
+ * Access: RW
9967
+ */
9968
+MLXSW_ITEM32(reg, mfgd, fatal_event_mode, 0x00, 9, 2);
9969
+
9970
+/* reg_mfgd_trigger_test
9971
+ * Access: WO
9972
+ */
9973
+MLXSW_ITEM32(reg, mfgd, trigger_test, 0x00, 11, 1);
9974
+
9975
+/* MGPIR - Management General Peripheral Information Register
9976
+ * ----------------------------------------------------------
9977
+ * MGPIR register allows software to query the hardware and
9978
+ * firmware general information of peripheral entities.
9979
+ */
9980
+#define MLXSW_REG_MGPIR_ID 0x9100
9981
+#define MLXSW_REG_MGPIR_LEN 0xA0
9982
+
9983
+MLXSW_REG_DEFINE(mgpir, MLXSW_REG_MGPIR_ID, MLXSW_REG_MGPIR_LEN);
9984
+
9985
+enum mlxsw_reg_mgpir_device_type {
9986
+ MLXSW_REG_MGPIR_DEVICE_TYPE_NONE,
9987
+ MLXSW_REG_MGPIR_DEVICE_TYPE_GEARBOX_DIE,
9988
+};
9989
+
9990
+/* device_type
9991
+ * Access: RO
9992
+ */
9993
+MLXSW_ITEM32(reg, mgpir, device_type, 0x00, 24, 4);
9994
+
9995
+/* devices_per_flash
9996
+ * Number of devices of device_type per flash (can be shared by few devices).
9997
+ * Access: RO
9998
+ */
9999
+MLXSW_ITEM32(reg, mgpir, devices_per_flash, 0x00, 16, 8);
10000
+
10001
+/* num_of_devices
10002
+ * Number of devices of device_type.
10003
+ * Access: RO
10004
+ */
10005
+MLXSW_ITEM32(reg, mgpir, num_of_devices, 0x00, 0, 8);
10006
+
10007
+/* num_of_modules
10008
+ * Number of modules.
10009
+ * Access: RO
10010
+ */
10011
+MLXSW_ITEM32(reg, mgpir, num_of_modules, 0x04, 0, 8);
10012
+
10013
+static inline void mlxsw_reg_mgpir_pack(char *payload)
10014
+{
10015
+ MLXSW_REG_ZERO(mgpir, payload);
10016
+}
10017
+
10018
+static inline void
10019
+mlxsw_reg_mgpir_unpack(char *payload, u8 *num_of_devices,
10020
+ enum mlxsw_reg_mgpir_device_type *device_type,
10021
+ u8 *devices_per_flash, u8 *num_of_modules)
10022
+{
10023
+ if (num_of_devices)
10024
+ *num_of_devices = mlxsw_reg_mgpir_num_of_devices_get(payload);
10025
+ if (device_type)
10026
+ *device_type = mlxsw_reg_mgpir_device_type_get(payload);
10027
+ if (devices_per_flash)
10028
+ *devices_per_flash =
10029
+ mlxsw_reg_mgpir_devices_per_flash_get(payload);
10030
+ if (num_of_modules)
10031
+ *num_of_modules = mlxsw_reg_mgpir_num_of_modules_get(payload);
10032
+}
10033
+
10034
+/* MFDE - Monitoring FW Debug Register
10035
+ * -----------------------------------
10036
+ */
10037
+#define MLXSW_REG_MFDE_ID 0x9200
10038
+#define MLXSW_REG_MFDE_LEN 0x18
10039
+
10040
+MLXSW_REG_DEFINE(mfde, MLXSW_REG_MFDE_ID, MLXSW_REG_MFDE_LEN);
10041
+
10042
+/* reg_mfde_irisc_id
10043
+ * Which irisc triggered the event
10044
+ * Access: RO
10045
+ */
10046
+MLXSW_ITEM32(reg, mfde, irisc_id, 0x00, 8, 4);
10047
+
10048
+enum mlxsw_reg_mfde_event_id {
10049
+ MLXSW_REG_MFDE_EVENT_ID_CRSPACE_TO = 1,
10050
+ /* KVD insertion machine stopped */
10051
+ MLXSW_REG_MFDE_EVENT_ID_KVD_IM_STOP,
10052
+};
10053
+
10054
+/* reg_mfde_event_id
10055
+ * Access: RO
10056
+ */
10057
+MLXSW_ITEM32(reg, mfde, event_id, 0x00, 0, 8);
10058
+
10059
+enum mlxsw_reg_mfde_method {
10060
+ MLXSW_REG_MFDE_METHOD_QUERY,
10061
+ MLXSW_REG_MFDE_METHOD_WRITE,
10062
+};
10063
+
10064
+/* reg_mfde_method
10065
+ * Access: RO
10066
+ */
10067
+MLXSW_ITEM32(reg, mfde, method, 0x04, 29, 1);
10068
+
10069
+/* reg_mfde_long_process
10070
+ * Indicates if the command is in long_process mode.
10071
+ * Access: RO
10072
+ */
10073
+MLXSW_ITEM32(reg, mfde, long_process, 0x04, 28, 1);
10074
+
10075
+enum mlxsw_reg_mfde_command_type {
10076
+ MLXSW_REG_MFDE_COMMAND_TYPE_MAD,
10077
+ MLXSW_REG_MFDE_COMMAND_TYPE_EMAD,
10078
+ MLXSW_REG_MFDE_COMMAND_TYPE_CMDIF,
10079
+};
10080
+
10081
+/* reg_mfde_command_type
10082
+ * Access: RO
10083
+ */
10084
+MLXSW_ITEM32(reg, mfde, command_type, 0x04, 24, 2);
10085
+
10086
+/* reg_mfde_reg_attr_id
10087
+ * EMAD - register id, MAD - attibute id
10088
+ * Access: RO
10089
+ */
10090
+MLXSW_ITEM32(reg, mfde, reg_attr_id, 0x04, 0, 16);
10091
+
10092
+/* reg_mfde_log_address
10093
+ * crspace address accessed, which resulted in timeout.
10094
+ * Valid in case event_id == MLXSW_REG_MFDE_EVENT_ID_CRSPACE_TO
10095
+ * Access: RO
10096
+ */
10097
+MLXSW_ITEM32(reg, mfde, log_address, 0x10, 0, 32);
10098
+
10099
+/* reg_mfde_log_id
10100
+ * Which irisc triggered the timeout.
10101
+ * Valid in case event_id == MLXSW_REG_MFDE_EVENT_ID_CRSPACE_TO
10102
+ * Access: RO
10103
+ */
10104
+MLXSW_ITEM32(reg, mfde, log_id, 0x14, 0, 4);
10105
+
10106
+/* reg_mfde_pipes_mask
10107
+ * Bit per kvh pipe.
10108
+ * Access: RO
10109
+ */
10110
+MLXSW_ITEM32(reg, mfde, pipes_mask, 0x10, 0, 16);
10111
+
10112
+/* TNGCR - Tunneling NVE General Configuration Register
10113
+ * ----------------------------------------------------
10114
+ * The TNGCR register is used for setting up the NVE Tunneling configuration.
10115
+ */
10116
+#define MLXSW_REG_TNGCR_ID 0xA001
10117
+#define MLXSW_REG_TNGCR_LEN 0x44
10118
+
10119
+MLXSW_REG_DEFINE(tngcr, MLXSW_REG_TNGCR_ID, MLXSW_REG_TNGCR_LEN);
10120
+
10121
+enum mlxsw_reg_tngcr_type {
10122
+ MLXSW_REG_TNGCR_TYPE_VXLAN,
10123
+ MLXSW_REG_TNGCR_TYPE_VXLAN_GPE,
10124
+ MLXSW_REG_TNGCR_TYPE_GENEVE,
10125
+ MLXSW_REG_TNGCR_TYPE_NVGRE,
10126
+};
10127
+
10128
+/* reg_tngcr_type
10129
+ * Tunnel type for encapsulation and decapsulation. The types are mutually
10130
+ * exclusive.
10131
+ * Note: For Spectrum the NVE parsing must be enabled in MPRS.
10132
+ * Access: RW
10133
+ */
10134
+MLXSW_ITEM32(reg, tngcr, type, 0x00, 0, 4);
10135
+
10136
+/* reg_tngcr_nve_valid
10137
+ * The VTEP is valid. Allows adding FDB entries for tunnel encapsulation.
10138
+ * Access: RW
10139
+ */
10140
+MLXSW_ITEM32(reg, tngcr, nve_valid, 0x04, 31, 1);
10141
+
10142
+/* reg_tngcr_nve_ttl_uc
10143
+ * The TTL for NVE tunnel encapsulation underlay unicast packets.
10144
+ * Access: RW
10145
+ */
10146
+MLXSW_ITEM32(reg, tngcr, nve_ttl_uc, 0x04, 0, 8);
10147
+
10148
+/* reg_tngcr_nve_ttl_mc
10149
+ * The TTL for NVE tunnel encapsulation underlay multicast packets.
10150
+ * Access: RW
10151
+ */
10152
+MLXSW_ITEM32(reg, tngcr, nve_ttl_mc, 0x08, 0, 8);
10153
+
10154
+enum {
10155
+ /* Do not copy flow label. Calculate flow label using nve_flh. */
10156
+ MLXSW_REG_TNGCR_FL_NO_COPY,
10157
+ /* Copy flow label from inner packet if packet is IPv6 and
10158
+ * encapsulation is by IPv6. Otherwise, calculate flow label using
10159
+ * nve_flh.
10160
+ */
10161
+ MLXSW_REG_TNGCR_FL_COPY,
10162
+};
10163
+
10164
+/* reg_tngcr_nve_flc
10165
+ * For NVE tunnel encapsulation: Flow label copy from inner packet.
10166
+ * Access: RW
10167
+ */
10168
+MLXSW_ITEM32(reg, tngcr, nve_flc, 0x0C, 25, 1);
10169
+
10170
+enum {
10171
+ /* Flow label is static. In Spectrum this means '0'. Spectrum-2
10172
+ * uses {nve_fl_prefix, nve_fl_suffix}.
10173
+ */
10174
+ MLXSW_REG_TNGCR_FL_NO_HASH,
10175
+ /* 8 LSBs of the flow label are calculated from ECMP hash of the
10176
+ * inner packet. 12 MSBs are configured by nve_fl_prefix.
10177
+ */
10178
+ MLXSW_REG_TNGCR_FL_HASH,
10179
+};
10180
+
10181
+/* reg_tngcr_nve_flh
10182
+ * NVE flow label hash.
10183
+ * Access: RW
10184
+ */
10185
+MLXSW_ITEM32(reg, tngcr, nve_flh, 0x0C, 24, 1);
10186
+
10187
+/* reg_tngcr_nve_fl_prefix
10188
+ * NVE flow label prefix. Constant 12 MSBs of the flow label.
10189
+ * Access: RW
10190
+ */
10191
+MLXSW_ITEM32(reg, tngcr, nve_fl_prefix, 0x0C, 8, 12);
10192
+
10193
+/* reg_tngcr_nve_fl_suffix
10194
+ * NVE flow label suffix. Constant 8 LSBs of the flow label.
10195
+ * Reserved when nve_flh=1 and for Spectrum.
10196
+ * Access: RW
10197
+ */
10198
+MLXSW_ITEM32(reg, tngcr, nve_fl_suffix, 0x0C, 0, 8);
10199
+
10200
+enum {
10201
+ /* Source UDP port is fixed (default '0') */
10202
+ MLXSW_REG_TNGCR_UDP_SPORT_NO_HASH,
10203
+ /* Source UDP port is calculated based on hash */
10204
+ MLXSW_REG_TNGCR_UDP_SPORT_HASH,
10205
+};
10206
+
10207
+/* reg_tngcr_nve_udp_sport_type
10208
+ * NVE UDP source port type.
10209
+ * Spectrum uses LAG hash (SLCRv2). Spectrum-2 uses ECMP hash (RECRv2).
10210
+ * When the source UDP port is calculated based on hash, then the 8 LSBs
10211
+ * are calculated from hash the 8 MSBs are configured by
10212
+ * nve_udp_sport_prefix.
10213
+ * Access: RW
10214
+ */
10215
+MLXSW_ITEM32(reg, tngcr, nve_udp_sport_type, 0x10, 24, 1);
10216
+
10217
+/* reg_tngcr_nve_udp_sport_prefix
10218
+ * NVE UDP source port prefix. Constant 8 MSBs of the UDP source port.
10219
+ * Reserved when NVE type is NVGRE.
10220
+ * Access: RW
10221
+ */
10222
+MLXSW_ITEM32(reg, tngcr, nve_udp_sport_prefix, 0x10, 8, 8);
10223
+
10224
+/* reg_tngcr_nve_group_size_mc
10225
+ * The amount of sequential linked lists of MC entries. The first linked
10226
+ * list is configured by SFD.underlay_mc_ptr.
10227
+ * Valid values: 1, 2, 4, 8, 16, 32, 64
10228
+ * The linked list are configured by TNUMT.
10229
+ * The hash is set by LAG hash.
10230
+ * Access: RW
10231
+ */
10232
+MLXSW_ITEM32(reg, tngcr, nve_group_size_mc, 0x18, 0, 8);
10233
+
10234
+/* reg_tngcr_nve_group_size_flood
10235
+ * The amount of sequential linked lists of flooding entries. The first
10236
+ * linked list is configured by SFMR.nve_tunnel_flood_ptr
10237
+ * Valid values: 1, 2, 4, 8, 16, 32, 64
10238
+ * The linked list are configured by TNUMT.
10239
+ * The hash is set by LAG hash.
10240
+ * Access: RW
10241
+ */
10242
+MLXSW_ITEM32(reg, tngcr, nve_group_size_flood, 0x1C, 0, 8);
10243
+
10244
+/* reg_tngcr_learn_enable
10245
+ * During decapsulation, whether to learn from NVE port.
10246
+ * Reserved when Spectrum-2. See TNPC.
10247
+ * Access: RW
10248
+ */
10249
+MLXSW_ITEM32(reg, tngcr, learn_enable, 0x20, 31, 1);
10250
+
10251
+/* reg_tngcr_underlay_virtual_router
10252
+ * Underlay virtual router.
10253
+ * Reserved when Spectrum-2.
10254
+ * Access: RW
10255
+ */
10256
+MLXSW_ITEM32(reg, tngcr, underlay_virtual_router, 0x20, 0, 16);
10257
+
10258
+/* reg_tngcr_underlay_rif
10259
+ * Underlay ingress router interface. RIF type should be loopback generic.
10260
+ * Reserved when Spectrum.
10261
+ * Access: RW
10262
+ */
10263
+MLXSW_ITEM32(reg, tngcr, underlay_rif, 0x24, 0, 16);
10264
+
10265
+/* reg_tngcr_usipv4
10266
+ * Underlay source IPv4 address of the NVE.
10267
+ * Access: RW
10268
+ */
10269
+MLXSW_ITEM32(reg, tngcr, usipv4, 0x28, 0, 32);
10270
+
10271
+/* reg_tngcr_usipv6
10272
+ * Underlay source IPv6 address of the NVE. For Spectrum, must not be
10273
+ * modified under traffic of NVE tunneling encapsulation.
10274
+ * Access: RW
10275
+ */
10276
+MLXSW_ITEM_BUF(reg, tngcr, usipv6, 0x30, 16);
10277
+
10278
+static inline void mlxsw_reg_tngcr_pack(char *payload,
10279
+ enum mlxsw_reg_tngcr_type type,
10280
+ bool valid, u8 ttl)
10281
+{
10282
+ MLXSW_REG_ZERO(tngcr, payload);
10283
+ mlxsw_reg_tngcr_type_set(payload, type);
10284
+ mlxsw_reg_tngcr_nve_valid_set(payload, valid);
10285
+ mlxsw_reg_tngcr_nve_ttl_uc_set(payload, ttl);
10286
+ mlxsw_reg_tngcr_nve_ttl_mc_set(payload, ttl);
10287
+ mlxsw_reg_tngcr_nve_flc_set(payload, MLXSW_REG_TNGCR_FL_NO_COPY);
10288
+ mlxsw_reg_tngcr_nve_flh_set(payload, 0);
10289
+ mlxsw_reg_tngcr_nve_udp_sport_type_set(payload,
10290
+ MLXSW_REG_TNGCR_UDP_SPORT_HASH);
10291
+ mlxsw_reg_tngcr_nve_udp_sport_prefix_set(payload, 0);
10292
+ mlxsw_reg_tngcr_nve_group_size_mc_set(payload, 1);
10293
+ mlxsw_reg_tngcr_nve_group_size_flood_set(payload, 1);
10294
+}
10295
+
10296
+/* TNUMT - Tunneling NVE Underlay Multicast Table Register
10297
+ * -------------------------------------------------------
10298
+ * The TNUMT register is for building the underlay MC table. It is used
10299
+ * for MC, flooding and BC traffic into the NVE tunnel.
10300
+ */
10301
+#define MLXSW_REG_TNUMT_ID 0xA003
10302
+#define MLXSW_REG_TNUMT_LEN 0x20
10303
+
10304
+MLXSW_REG_DEFINE(tnumt, MLXSW_REG_TNUMT_ID, MLXSW_REG_TNUMT_LEN);
10305
+
10306
+enum mlxsw_reg_tnumt_record_type {
10307
+ MLXSW_REG_TNUMT_RECORD_TYPE_IPV4,
10308
+ MLXSW_REG_TNUMT_RECORD_TYPE_IPV6,
10309
+ MLXSW_REG_TNUMT_RECORD_TYPE_LABEL,
10310
+};
10311
+
10312
+/* reg_tnumt_record_type
10313
+ * Record type.
10314
+ * Access: RW
10315
+ */
10316
+MLXSW_ITEM32(reg, tnumt, record_type, 0x00, 28, 4);
10317
+
10318
+enum mlxsw_reg_tnumt_tunnel_port {
10319
+ MLXSW_REG_TNUMT_TUNNEL_PORT_NVE,
10320
+ MLXSW_REG_TNUMT_TUNNEL_PORT_VPLS,
10321
+ MLXSW_REG_TNUMT_TUNNEL_FLEX_TUNNEL0,
10322
+ MLXSW_REG_TNUMT_TUNNEL_FLEX_TUNNEL1,
10323
+};
10324
+
10325
+/* reg_tnumt_tunnel_port
10326
+ * Tunnel port.
10327
+ * Access: RW
10328
+ */
10329
+MLXSW_ITEM32(reg, tnumt, tunnel_port, 0x00, 24, 4);
10330
+
10331
+/* reg_tnumt_underlay_mc_ptr
10332
+ * Index to the underlay multicast table.
10333
+ * For Spectrum the index is to the KVD linear.
10334
+ * Access: Index
10335
+ */
10336
+MLXSW_ITEM32(reg, tnumt, underlay_mc_ptr, 0x00, 0, 24);
10337
+
10338
+/* reg_tnumt_vnext
10339
+ * The next_underlay_mc_ptr is valid.
10340
+ * Access: RW
10341
+ */
10342
+MLXSW_ITEM32(reg, tnumt, vnext, 0x04, 31, 1);
10343
+
10344
+/* reg_tnumt_next_underlay_mc_ptr
10345
+ * The next index to the underlay multicast table.
10346
+ * Access: RW
10347
+ */
10348
+MLXSW_ITEM32(reg, tnumt, next_underlay_mc_ptr, 0x04, 0, 24);
10349
+
10350
+/* reg_tnumt_record_size
10351
+ * Number of IP addresses in the record.
10352
+ * Range is 1..cap_max_nve_mc_entries_ipv{4,6}
10353
+ * Access: RW
10354
+ */
10355
+MLXSW_ITEM32(reg, tnumt, record_size, 0x08, 0, 3);
10356
+
10357
+/* reg_tnumt_udip
10358
+ * The underlay IPv4 addresses. udip[i] is reserved if i >= size
10359
+ * Access: RW
10360
+ */
10361
+MLXSW_ITEM32_INDEXED(reg, tnumt, udip, 0x0C, 0, 32, 0x04, 0x00, false);
10362
+
10363
+/* reg_tnumt_udip_ptr
10364
+ * The pointer to the underlay IPv6 addresses. udip_ptr[i] is reserved if
10365
+ * i >= size. The IPv6 addresses are configured by RIPS.
10366
+ * Access: RW
10367
+ */
10368
+MLXSW_ITEM32_INDEXED(reg, tnumt, udip_ptr, 0x0C, 0, 24, 0x04, 0x00, false);
10369
+
10370
+static inline void mlxsw_reg_tnumt_pack(char *payload,
10371
+ enum mlxsw_reg_tnumt_record_type type,
10372
+ enum mlxsw_reg_tnumt_tunnel_port tport,
10373
+ u32 underlay_mc_ptr, bool vnext,
10374
+ u32 next_underlay_mc_ptr,
10375
+ u8 record_size)
10376
+{
10377
+ MLXSW_REG_ZERO(tnumt, payload);
10378
+ mlxsw_reg_tnumt_record_type_set(payload, type);
10379
+ mlxsw_reg_tnumt_tunnel_port_set(payload, tport);
10380
+ mlxsw_reg_tnumt_underlay_mc_ptr_set(payload, underlay_mc_ptr);
10381
+ mlxsw_reg_tnumt_vnext_set(payload, vnext);
10382
+ mlxsw_reg_tnumt_next_underlay_mc_ptr_set(payload, next_underlay_mc_ptr);
10383
+ mlxsw_reg_tnumt_record_size_set(payload, record_size);
10384
+}
10385
+
10386
+/* TNQCR - Tunneling NVE QoS Configuration Register
10387
+ * ------------------------------------------------
10388
+ * The TNQCR register configures how QoS is set in encapsulation into the
10389
+ * underlay network.
10390
+ */
10391
+#define MLXSW_REG_TNQCR_ID 0xA010
10392
+#define MLXSW_REG_TNQCR_LEN 0x0C
10393
+
10394
+MLXSW_REG_DEFINE(tnqcr, MLXSW_REG_TNQCR_ID, MLXSW_REG_TNQCR_LEN);
10395
+
10396
+/* reg_tnqcr_enc_set_dscp
10397
+ * For encapsulation: How to set DSCP field:
10398
+ * 0 - Copy the DSCP from the overlay (inner) IP header to the underlay
10399
+ * (outer) IP header. If there is no IP header, use TNQDR.dscp
10400
+ * 1 - Set the DSCP field as TNQDR.dscp
10401
+ * Access: RW
10402
+ */
10403
+MLXSW_ITEM32(reg, tnqcr, enc_set_dscp, 0x04, 28, 1);
10404
+
10405
+static inline void mlxsw_reg_tnqcr_pack(char *payload)
10406
+{
10407
+ MLXSW_REG_ZERO(tnqcr, payload);
10408
+ mlxsw_reg_tnqcr_enc_set_dscp_set(payload, 0);
10409
+}
10410
+
10411
+/* TNQDR - Tunneling NVE QoS Default Register
10412
+ * ------------------------------------------
10413
+ * The TNQDR register configures the default QoS settings for NVE
10414
+ * encapsulation.
10415
+ */
10416
+#define MLXSW_REG_TNQDR_ID 0xA011
10417
+#define MLXSW_REG_TNQDR_LEN 0x08
10418
+
10419
+MLXSW_REG_DEFINE(tnqdr, MLXSW_REG_TNQDR_ID, MLXSW_REG_TNQDR_LEN);
10420
+
10421
+/* reg_tnqdr_local_port
10422
+ * Local port number (receive port). CPU port is supported.
10423
+ * Access: Index
10424
+ */
10425
+MLXSW_ITEM32(reg, tnqdr, local_port, 0x00, 16, 8);
10426
+
10427
+/* reg_tnqdr_dscp
10428
+ * For encapsulation, the default DSCP.
10429
+ * Access: RW
10430
+ */
10431
+MLXSW_ITEM32(reg, tnqdr, dscp, 0x04, 0, 6);
10432
+
10433
+static inline void mlxsw_reg_tnqdr_pack(char *payload, u8 local_port)
10434
+{
10435
+ MLXSW_REG_ZERO(tnqdr, payload);
10436
+ mlxsw_reg_tnqdr_local_port_set(payload, local_port);
10437
+ mlxsw_reg_tnqdr_dscp_set(payload, 0);
10438
+}
10439
+
10440
+/* TNEEM - Tunneling NVE Encapsulation ECN Mapping Register
10441
+ * --------------------------------------------------------
10442
+ * The TNEEM register maps ECN of the IP header at the ingress to the
10443
+ * encapsulation to the ECN of the underlay network.
10444
+ */
10445
+#define MLXSW_REG_TNEEM_ID 0xA012
10446
+#define MLXSW_REG_TNEEM_LEN 0x0C
10447
+
10448
+MLXSW_REG_DEFINE(tneem, MLXSW_REG_TNEEM_ID, MLXSW_REG_TNEEM_LEN);
10449
+
10450
+/* reg_tneem_overlay_ecn
10451
+ * ECN of the IP header in the overlay network.
10452
+ * Access: Index
10453
+ */
10454
+MLXSW_ITEM32(reg, tneem, overlay_ecn, 0x04, 24, 2);
10455
+
10456
+/* reg_tneem_underlay_ecn
10457
+ * ECN of the IP header in the underlay network.
10458
+ * Access: RW
10459
+ */
10460
+MLXSW_ITEM32(reg, tneem, underlay_ecn, 0x04, 16, 2);
10461
+
10462
+static inline void mlxsw_reg_tneem_pack(char *payload, u8 overlay_ecn,
10463
+ u8 underlay_ecn)
10464
+{
10465
+ MLXSW_REG_ZERO(tneem, payload);
10466
+ mlxsw_reg_tneem_overlay_ecn_set(payload, overlay_ecn);
10467
+ mlxsw_reg_tneem_underlay_ecn_set(payload, underlay_ecn);
10468
+}
10469
+
10470
+/* TNDEM - Tunneling NVE Decapsulation ECN Mapping Register
10471
+ * --------------------------------------------------------
10472
+ * The TNDEM register configures the actions that are done in the
10473
+ * decapsulation.
10474
+ */
10475
+#define MLXSW_REG_TNDEM_ID 0xA013
10476
+#define MLXSW_REG_TNDEM_LEN 0x0C
10477
+
10478
+MLXSW_REG_DEFINE(tndem, MLXSW_REG_TNDEM_ID, MLXSW_REG_TNDEM_LEN);
10479
+
10480
+/* reg_tndem_underlay_ecn
10481
+ * ECN field of the IP header in the underlay network.
10482
+ * Access: Index
10483
+ */
10484
+MLXSW_ITEM32(reg, tndem, underlay_ecn, 0x04, 24, 2);
10485
+
10486
+/* reg_tndem_overlay_ecn
10487
+ * ECN field of the IP header in the overlay network.
10488
+ * Access: Index
10489
+ */
10490
+MLXSW_ITEM32(reg, tndem, overlay_ecn, 0x04, 16, 2);
10491
+
10492
+/* reg_tndem_eip_ecn
10493
+ * Egress IP ECN. ECN field of the IP header of the packet which goes out
10494
+ * from the decapsulation.
10495
+ * Access: RW
10496
+ */
10497
+MLXSW_ITEM32(reg, tndem, eip_ecn, 0x04, 8, 2);
10498
+
10499
+/* reg_tndem_trap_en
10500
+ * Trap enable:
10501
+ * 0 - No trap due to decap ECN
10502
+ * 1 - Trap enable with trap_id
10503
+ * Access: RW
10504
+ */
10505
+MLXSW_ITEM32(reg, tndem, trap_en, 0x08, 28, 4);
10506
+
10507
+/* reg_tndem_trap_id
10508
+ * Trap ID. Either DECAP_ECN0 or DECAP_ECN1.
10509
+ * Reserved when trap_en is '0'.
10510
+ * Access: RW
10511
+ */
10512
+MLXSW_ITEM32(reg, tndem, trap_id, 0x08, 0, 9);
10513
+
10514
+static inline void mlxsw_reg_tndem_pack(char *payload, u8 underlay_ecn,
10515
+ u8 overlay_ecn, u8 ecn, bool trap_en,
10516
+ u16 trap_id)
10517
+{
10518
+ MLXSW_REG_ZERO(tndem, payload);
10519
+ mlxsw_reg_tndem_underlay_ecn_set(payload, underlay_ecn);
10520
+ mlxsw_reg_tndem_overlay_ecn_set(payload, overlay_ecn);
10521
+ mlxsw_reg_tndem_eip_ecn_set(payload, ecn);
10522
+ mlxsw_reg_tndem_trap_en_set(payload, trap_en);
10523
+ mlxsw_reg_tndem_trap_id_set(payload, trap_id);
10524
+}
10525
+
10526
+/* TNPC - Tunnel Port Configuration Register
10527
+ * -----------------------------------------
10528
+ * The TNPC register is used for tunnel port configuration.
10529
+ * Reserved when Spectrum.
10530
+ */
10531
+#define MLXSW_REG_TNPC_ID 0xA020
10532
+#define MLXSW_REG_TNPC_LEN 0x18
10533
+
10534
+MLXSW_REG_DEFINE(tnpc, MLXSW_REG_TNPC_ID, MLXSW_REG_TNPC_LEN);
10535
+
10536
+enum mlxsw_reg_tnpc_tunnel_port {
10537
+ MLXSW_REG_TNPC_TUNNEL_PORT_NVE,
10538
+ MLXSW_REG_TNPC_TUNNEL_PORT_VPLS,
10539
+ MLXSW_REG_TNPC_TUNNEL_FLEX_TUNNEL0,
10540
+ MLXSW_REG_TNPC_TUNNEL_FLEX_TUNNEL1,
10541
+};
10542
+
10543
+/* reg_tnpc_tunnel_port
10544
+ * Tunnel port.
10545
+ * Access: Index
10546
+ */
10547
+MLXSW_ITEM32(reg, tnpc, tunnel_port, 0x00, 0, 4);
10548
+
10549
+/* reg_tnpc_learn_enable_v6
10550
+ * During IPv6 underlay decapsulation, whether to learn from tunnel port.
10551
+ * Access: RW
10552
+ */
10553
+MLXSW_ITEM32(reg, tnpc, learn_enable_v6, 0x04, 1, 1);
10554
+
10555
+/* reg_tnpc_learn_enable_v4
10556
+ * During IPv4 underlay decapsulation, whether to learn from tunnel port.
10557
+ * Access: RW
10558
+ */
10559
+MLXSW_ITEM32(reg, tnpc, learn_enable_v4, 0x04, 0, 1);
10560
+
10561
+static inline void mlxsw_reg_tnpc_pack(char *payload,
10562
+ enum mlxsw_reg_tnpc_tunnel_port tport,
10563
+ bool learn_enable)
10564
+{
10565
+ MLXSW_REG_ZERO(tnpc, payload);
10566
+ mlxsw_reg_tnpc_tunnel_port_set(payload, tport);
10567
+ mlxsw_reg_tnpc_learn_enable_v4_set(payload, learn_enable);
10568
+ mlxsw_reg_tnpc_learn_enable_v6_set(payload, learn_enable);
10569
+}
10570
+
830210571 /* TIGCR - Tunneling IPinIP General Configuration Register
830310572 * -------------------------------------------------------
830410573 * The TIGCR register is used for setting up the IPinIP Tunnel configuration.
....@@ -8329,6 +10598,92 @@
832910598 mlxsw_reg_tigcr_ttl_uc_set(payload, ttl_uc);
833010599 }
833110600
10601
+/* TIEEM - Tunneling IPinIP Encapsulation ECN Mapping Register
10602
+ * -----------------------------------------------------------
10603
+ * The TIEEM register maps ECN of the IP header at the ingress to the
10604
+ * encapsulation to the ECN of the underlay network.
10605
+ */
10606
+#define MLXSW_REG_TIEEM_ID 0xA812
10607
+#define MLXSW_REG_TIEEM_LEN 0x0C
10608
+
10609
+MLXSW_REG_DEFINE(tieem, MLXSW_REG_TIEEM_ID, MLXSW_REG_TIEEM_LEN);
10610
+
10611
+/* reg_tieem_overlay_ecn
10612
+ * ECN of the IP header in the overlay network.
10613
+ * Access: Index
10614
+ */
10615
+MLXSW_ITEM32(reg, tieem, overlay_ecn, 0x04, 24, 2);
10616
+
10617
+/* reg_tineem_underlay_ecn
10618
+ * ECN of the IP header in the underlay network.
10619
+ * Access: RW
10620
+ */
10621
+MLXSW_ITEM32(reg, tieem, underlay_ecn, 0x04, 16, 2);
10622
+
10623
+static inline void mlxsw_reg_tieem_pack(char *payload, u8 overlay_ecn,
10624
+ u8 underlay_ecn)
10625
+{
10626
+ MLXSW_REG_ZERO(tieem, payload);
10627
+ mlxsw_reg_tieem_overlay_ecn_set(payload, overlay_ecn);
10628
+ mlxsw_reg_tieem_underlay_ecn_set(payload, underlay_ecn);
10629
+}
10630
+
10631
+/* TIDEM - Tunneling IPinIP Decapsulation ECN Mapping Register
10632
+ * -----------------------------------------------------------
10633
+ * The TIDEM register configures the actions that are done in the
10634
+ * decapsulation.
10635
+ */
10636
+#define MLXSW_REG_TIDEM_ID 0xA813
10637
+#define MLXSW_REG_TIDEM_LEN 0x0C
10638
+
10639
+MLXSW_REG_DEFINE(tidem, MLXSW_REG_TIDEM_ID, MLXSW_REG_TIDEM_LEN);
10640
+
10641
+/* reg_tidem_underlay_ecn
10642
+ * ECN field of the IP header in the underlay network.
10643
+ * Access: Index
10644
+ */
10645
+MLXSW_ITEM32(reg, tidem, underlay_ecn, 0x04, 24, 2);
10646
+
10647
+/* reg_tidem_overlay_ecn
10648
+ * ECN field of the IP header in the overlay network.
10649
+ * Access: Index
10650
+ */
10651
+MLXSW_ITEM32(reg, tidem, overlay_ecn, 0x04, 16, 2);
10652
+
10653
+/* reg_tidem_eip_ecn
10654
+ * Egress IP ECN. ECN field of the IP header of the packet which goes out
10655
+ * from the decapsulation.
10656
+ * Access: RW
10657
+ */
10658
+MLXSW_ITEM32(reg, tidem, eip_ecn, 0x04, 8, 2);
10659
+
10660
+/* reg_tidem_trap_en
10661
+ * Trap enable:
10662
+ * 0 - No trap due to decap ECN
10663
+ * 1 - Trap enable with trap_id
10664
+ * Access: RW
10665
+ */
10666
+MLXSW_ITEM32(reg, tidem, trap_en, 0x08, 28, 4);
10667
+
10668
+/* reg_tidem_trap_id
10669
+ * Trap ID. Either DECAP_ECN0 or DECAP_ECN1.
10670
+ * Reserved when trap_en is '0'.
10671
+ * Access: RW
10672
+ */
10673
+MLXSW_ITEM32(reg, tidem, trap_id, 0x08, 0, 9);
10674
+
10675
+static inline void mlxsw_reg_tidem_pack(char *payload, u8 underlay_ecn,
10676
+ u8 overlay_ecn, u8 eip_ecn,
10677
+ bool trap_en, u16 trap_id)
10678
+{
10679
+ MLXSW_REG_ZERO(tidem, payload);
10680
+ mlxsw_reg_tidem_underlay_ecn_set(payload, underlay_ecn);
10681
+ mlxsw_reg_tidem_overlay_ecn_set(payload, overlay_ecn);
10682
+ mlxsw_reg_tidem_eip_ecn_set(payload, eip_ecn);
10683
+ mlxsw_reg_tidem_trap_en_set(payload, trap_en);
10684
+ mlxsw_reg_tidem_trap_id_set(payload, trap_id);
10685
+}
10686
+
833210687 /* SBPR - Shared Buffer Pools Register
833310688 * -----------------------------------
833410689 * The SBPR configures and retrieves the shared buffer pools and configuration.
....@@ -8356,8 +10711,15 @@
835610711 */
835710712 MLXSW_ITEM32(reg, sbpr, pool, 0x00, 0, 4);
835810713
10714
+/* reg_sbpr_infi_size
10715
+ * Size is infinite.
10716
+ * Access: RW
10717
+ */
10718
+MLXSW_ITEM32(reg, sbpr, infi_size, 0x04, 31, 1);
10719
+
835910720 /* reg_sbpr_size
836010721 * Pool size in buffer cells.
10722
+ * Reserved when infi_size = 1.
836110723 * Access: RW
836210724 */
836310725 MLXSW_ITEM32(reg, sbpr, size, 0x04, 0, 24);
....@@ -8375,13 +10737,15 @@
837510737
837610738 static inline void mlxsw_reg_sbpr_pack(char *payload, u8 pool,
837710739 enum mlxsw_reg_sbxx_dir dir,
8378
- enum mlxsw_reg_sbpr_mode mode, u32 size)
10740
+ enum mlxsw_reg_sbpr_mode mode, u32 size,
10741
+ bool infi_size)
837910742 {
838010743 MLXSW_REG_ZERO(sbpr, payload);
838110744 mlxsw_reg_sbpr_pool_set(payload, pool);
838210745 mlxsw_reg_sbpr_dir_set(payload, dir);
838310746 mlxsw_reg_sbpr_mode_set(payload, mode);
838410747 mlxsw_reg_sbpr_size_set(payload, size);
10748
+ mlxsw_reg_sbpr_infi_size_set(payload, infi_size);
838510749 }
838610750
838710751 /* SBCM - Shared Buffer Class Management Register
....@@ -8429,6 +10793,12 @@
842910793 #define MLXSW_REG_SBXX_DYN_MAX_BUFF_MIN 1
843010794 #define MLXSW_REG_SBXX_DYN_MAX_BUFF_MAX 14
843110795
10796
+/* reg_sbcm_infi_max
10797
+ * Max buffer is infinite.
10798
+ * Access: RW
10799
+ */
10800
+MLXSW_ITEM32(reg, sbcm, infi_max, 0x1C, 31, 1);
10801
+
843210802 /* reg_sbcm_max_buff
843310803 * When the pool associated to the port-pg/tclass is configured to
843410804 * static, Maximum buffer size for the limiter configured in cells.
....@@ -8438,6 +10808,7 @@
843810808 * 0: 0
843910809 * i: (1/128)*2^(i-1), for i=1..14
844010810 * 0xFF: Infinity
10811
+ * Reserved when infi_max = 1.
844110812 * Access: RW
844210813 */
844310814 MLXSW_ITEM32(reg, sbcm, max_buff, 0x1C, 0, 24);
....@@ -8450,7 +10821,8 @@
845010821
845110822 static inline void mlxsw_reg_sbcm_pack(char *payload, u8 local_port, u8 pg_buff,
845210823 enum mlxsw_reg_sbxx_dir dir,
8453
- u32 min_buff, u32 max_buff, u8 pool)
10824
+ u32 min_buff, u32 max_buff,
10825
+ bool infi_max, u8 pool)
845410826 {
845510827 MLXSW_REG_ZERO(sbcm, payload);
845610828 mlxsw_reg_sbcm_local_port_set(payload, local_port);
....@@ -8458,6 +10830,7 @@
845810830 mlxsw_reg_sbcm_dir_set(payload, dir);
845910831 mlxsw_reg_sbcm_min_buff_set(payload, min_buff);
846010832 mlxsw_reg_sbcm_max_buff_set(payload, max_buff);
10833
+ mlxsw_reg_sbcm_infi_max_set(payload, infi_max);
846110834 mlxsw_reg_sbcm_pool_set(payload, pool);
846210835 }
846310836
....@@ -8768,8 +11141,10 @@
876811141 MLXSW_REG(ppbs),
876911142 MLXSW_REG(prcr),
877011143 MLXSW_REG(pefa),
11144
+ MLXSW_REG(pemrbt),
877111145 MLXSW_REG(ptce2),
877211146 MLXSW_REG(perpt),
11147
+ MLXSW_REG(peabfe),
877311148 MLXSW_REG(perar),
877411149 MLXSW_REG(ptce3),
877511150 MLXSW_REG(percr),
....@@ -8781,8 +11156,10 @@
878111156 MLXSW_REG(qeec),
878211157 MLXSW_REG(qrwe),
878311158 MLXSW_REG(qpdsm),
11159
+ MLXSW_REG(qpdp),
878411160 MLXSW_REG(qpdpm),
878511161 MLXSW_REG(qtctm),
11162
+ MLXSW_REG(qpsc),
878611163 MLXSW_REG(pmlp),
878711164 MLXSW_REG(pmtu),
878811165 MLXSW_REG(ptys),
....@@ -8794,6 +11171,11 @@
879411171 MLXSW_REG(pptb),
879511172 MLXSW_REG(pbmc),
879611173 MLXSW_REG(pspa),
11174
+ MLXSW_REG(pmaos),
11175
+ MLXSW_REG(pplr),
11176
+ MLXSW_REG(pmpe),
11177
+ MLXSW_REG(pddr),
11178
+ MLXSW_REG(pmtm),
879711179 MLXSW_REG(htgt),
879811180 MLXSW_REG(hpkt),
879911181 MLXSW_REG(rgcr),
....@@ -8818,19 +11200,44 @@
881811200 MLXSW_REG(mfsc),
881911201 MLXSW_REG(mfsm),
882011202 MLXSW_REG(mfsl),
11203
+ MLXSW_REG(fore),
882111204 MLXSW_REG(mtcap),
882211205 MLXSW_REG(mtmp),
11206
+ MLXSW_REG(mtwe),
11207
+ MLXSW_REG(mtbr),
882311208 MLXSW_REG(mcia),
882411209 MLXSW_REG(mpat),
882511210 MLXSW_REG(mpar),
11211
+ MLXSW_REG(mgir),
882611212 MLXSW_REG(mrsr),
882711213 MLXSW_REG(mlcr),
11214
+ MLXSW_REG(mtpps),
11215
+ MLXSW_REG(mtutc),
882811216 MLXSW_REG(mpsc),
882911217 MLXSW_REG(mcqi),
883011218 MLXSW_REG(mcc),
883111219 MLXSW_REG(mcda),
883211220 MLXSW_REG(mgpc),
11221
+ MLXSW_REG(mprs),
11222
+ MLXSW_REG(mogcr),
11223
+ MLXSW_REG(mpagr),
11224
+ MLXSW_REG(momte),
11225
+ MLXSW_REG(mtpppc),
11226
+ MLXSW_REG(mtpptr),
11227
+ MLXSW_REG(mtptpt),
11228
+ MLXSW_REG(mfgd),
11229
+ MLXSW_REG(mgpir),
11230
+ MLXSW_REG(mfde),
11231
+ MLXSW_REG(tngcr),
11232
+ MLXSW_REG(tnumt),
11233
+ MLXSW_REG(tnqcr),
11234
+ MLXSW_REG(tnqdr),
11235
+ MLXSW_REG(tneem),
11236
+ MLXSW_REG(tndem),
11237
+ MLXSW_REG(tnpc),
883311238 MLXSW_REG(tigcr),
11239
+ MLXSW_REG(tieem),
11240
+ MLXSW_REG(tidem),
883411241 MLXSW_REG(sbpr),
883511242 MLXSW_REG(sbcm),
883611243 MLXSW_REG(sbpm),