]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/net/ethernet/mellanox/mlxsw/reg.h
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
[karo-tx-linux.git] / drivers / net / ethernet / mellanox / mlxsw / reg.h
index d1c8eff048996d022d765e64af2e9057a74e0622..236fb5d2ad69c9e051b324a556b2d09ac620f0ec 100644 (file)
@@ -348,8 +348,9 @@ MLXSW_ITEM32_INDEXED(reg, sfd, rec_action, MLXSW_REG_SFD_BASE_LEN, 28, 4,
                     MLXSW_REG_SFD_REC_LEN, 0x0C, false);
 
 /* reg_sfd_uc_sub_port
- * LAG sub port.
- * Must be 0 if multichannel VEPA is not enabled.
+ * VEPA channel on local port.
+ * Valid only if local port is a non-stacking port. Must be 0 if multichannel
+ * VEPA is not enabled.
  * Access: RW
  */
 MLXSW_ITEM32_INDEXED(reg, sfd, uc_sub_port, MLXSW_REG_SFD_BASE_LEN, 16, 8,
@@ -396,10 +397,9 @@ static inline void mlxsw_reg_sfd_uc_pack(char *payload, int rec_index,
        mlxsw_reg_sfd_uc_system_port_set(payload, rec_index, local_port);
 }
 
-static inline void
-mlxsw_reg_sfd_uc_unpack(char *payload, int rec_index,
-                       char *mac, u16 *p_vid,
-                       u8 *p_local_port)
+static inline void mlxsw_reg_sfd_uc_unpack(char *payload, int rec_index,
+                                          char *mac, u16 *p_vid,
+                                          u8 *p_local_port)
 {
        mlxsw_reg_sfd_rec_mac_memcpy_from(payload, rec_index, mac);
        *p_vid = mlxsw_reg_sfd_uc_fid_vid_get(payload, rec_index);
@@ -474,7 +474,7 @@ MLXSW_ITEM32_INDEXED(reg, sfn, rec_type, MLXSW_REG_SFN_BASE_LEN, 20, 4,
 MLXSW_ITEM_BUF_INDEXED(reg, sfn, rec_mac, MLXSW_REG_SFN_BASE_LEN, 6,
                       MLXSW_REG_SFN_REC_LEN, 0x02);
 
-/* reg_sfd_mac_sub_port
+/* reg_sfn_mac_sub_port
  * VEPA channel on the local port.
  * 0 if multichannel VEPA is not enabled.
  * Access: RO
@@ -482,14 +482,14 @@ MLXSW_ITEM_BUF_INDEXED(reg, sfn, rec_mac, MLXSW_REG_SFN_BASE_LEN, 6,
 MLXSW_ITEM32_INDEXED(reg, sfn, mac_sub_port, MLXSW_REG_SFN_BASE_LEN, 16, 8,
                     MLXSW_REG_SFN_REC_LEN, 0x08, false);
 
-/* reg_sfd_mac_fid
+/* reg_sfn_mac_fid
  * Filtering identifier.
  * Access: RO
  */
 MLXSW_ITEM32_INDEXED(reg, sfn, mac_fid, MLXSW_REG_SFN_BASE_LEN, 0, 16,
                     MLXSW_REG_SFN_REC_LEN, 0x08, false);
 
-/* reg_sfd_mac_system_port
+/* reg_sfn_mac_system_port
  * Unique port identifier for the final destination of the packet.
  * Access: RO
  */
@@ -1132,6 +1132,71 @@ static inline void mlxsw_reg_sfmr_pack(char *payload,
        mlxsw_reg_sfmr_vv_set(payload, false);
 }
 
+/* SPVMLR - Switch Port VLAN MAC Learning Register
+ * -----------------------------------------------
+ * Controls the switch MAC learning policy per {Port, VID}.
+ */
+#define MLXSW_REG_SPVMLR_ID 0x2020
+#define MLXSW_REG_SPVMLR_BASE_LEN 0x04 /* base length, without records */
+#define MLXSW_REG_SPVMLR_REC_LEN 0x04 /* record length */
+#define MLXSW_REG_SPVMLR_REC_MAX_COUNT 256
+#define MLXSW_REG_SPVMLR_LEN (MLXSW_REG_SPVMLR_BASE_LEN + \
+                             MLXSW_REG_SPVMLR_REC_LEN * \
+                             MLXSW_REG_SPVMLR_REC_MAX_COUNT)
+
+static const struct mlxsw_reg_info mlxsw_reg_spvmlr = {
+       .id = MLXSW_REG_SPVMLR_ID,
+       .len = MLXSW_REG_SPVMLR_LEN,
+};
+
+/* reg_spvmlr_local_port
+ * Local ingress port.
+ * Access: Index
+ *
+ * Note: CPU port is not supported.
+ */
+MLXSW_ITEM32(reg, spvmlr, local_port, 0x00, 16, 8);
+
+/* reg_spvmlr_num_rec
+ * Number of records to update.
+ * Access: OP
+ */
+MLXSW_ITEM32(reg, spvmlr, num_rec, 0x00, 0, 8);
+
+/* reg_spvmlr_rec_learn_enable
+ * 0 - Disable learning for {Port, VID}.
+ * 1 - Enable learning for {Port, VID}.
+ * Access: RW
+ */
+MLXSW_ITEM32_INDEXED(reg, spvmlr, rec_learn_enable, MLXSW_REG_SPVMLR_BASE_LEN,
+                    31, 1, MLXSW_REG_SPVMLR_REC_LEN, 0x00, false);
+
+/* reg_spvmlr_rec_vid
+ * VLAN ID to be added/removed from port or for querying.
+ * Access: Index
+ */
+MLXSW_ITEM32_INDEXED(reg, spvmlr, rec_vid, MLXSW_REG_SPVMLR_BASE_LEN, 0, 12,
+                    MLXSW_REG_SPVMLR_REC_LEN, 0x00, false);
+
+static inline void mlxsw_reg_spvmlr_pack(char *payload, u8 local_port,
+                                        u16 vid_begin, u16 vid_end,
+                                        bool learn_enable)
+{
+       int num_rec = vid_end - vid_begin + 1;
+       int i;
+
+       WARN_ON(num_rec < 1 || num_rec > MLXSW_REG_SPVMLR_REC_MAX_COUNT);
+
+       MLXSW_REG_ZERO(spvmlr, payload);
+       mlxsw_reg_spvmlr_local_port_set(payload, local_port);
+       mlxsw_reg_spvmlr_num_rec_set(payload, num_rec);
+
+       for (i = 0; i < num_rec; i++) {
+               mlxsw_reg_spvmlr_rec_learn_enable_set(payload, i, learn_enable);
+               mlxsw_reg_spvmlr_rec_vid_set(payload, i, vid_begin + i);
+       }
+}
+
 /* PMLP - Ports Module to Local Port Register
  * ------------------------------------------
  * Configures the assignment of modules to local ports.
@@ -2318,6 +2383,8 @@ static inline const char *mlxsw_reg_id_str(u16 reg_id)
                return "SVPE";
        case MLXSW_REG_SFMR_ID:
                return "SFMR";
+       case MLXSW_REG_SPVMLR_ID:
+               return "SPVMLR";
        case MLXSW_REG_PMLP_ID:
                return "PMLP";
        case MLXSW_REG_PMTU_ID: