mlxsw: reg: Add Router Algorithmic LPM ECMP Update Register
authorJiri Pirko <jiri@mellanox.com>
Tue, 5 Jul 2016 09:27:49 +0000 (11:27 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 5 Jul 2016 16:06:30 +0000 (09:06 -0700)
The RALEU register is used to mass update remote action adjacency index
and ecmp size.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/reg.h

index a2d7870..0cc1485 100644 (file)
@@ -4154,6 +4154,73 @@ static inline void mlxsw_reg_rauht_pack4(char *payload,
        mlxsw_reg_rauht_dip4_set(payload, dip);
 }
 
+/* RALEU - Router Algorithmic LPM ECMP Update Register
+ * ---------------------------------------------------
+ * The register enables updating the ECMP section in the action for multiple
+ * LPM Unicast entries in a single operation. The update is executed to
+ * all entries of a {virtual router, protocol} tuple using the same ECMP group.
+ */
+#define MLXSW_REG_RALEU_ID 0x8015
+#define MLXSW_REG_RALEU_LEN 0x28
+
+static const struct mlxsw_reg_info mlxsw_reg_raleu = {
+       .id = MLXSW_REG_RALEU_ID,
+       .len = MLXSW_REG_RALEU_LEN,
+};
+
+/* reg_raleu_protocol
+ * Protocol.
+ * Access: Index
+ */
+MLXSW_ITEM32(reg, raleu, protocol, 0x00, 24, 4);
+
+/* reg_raleu_virtual_router
+ * Virtual Router ID
+ * Range is 0..cap_max_virtual_routers-1
+ * Access: Index
+ */
+MLXSW_ITEM32(reg, raleu, virtual_router, 0x00, 0, 16);
+
+/* reg_raleu_adjacency_index
+ * Adjacency Index used for matching on the existing entries.
+ * Access: Index
+ */
+MLXSW_ITEM32(reg, raleu, adjacency_index, 0x10, 0, 24);
+
+/* reg_raleu_ecmp_size
+ * ECMP Size used for matching on the existing entries.
+ * Access: Index
+ */
+MLXSW_ITEM32(reg, raleu, ecmp_size, 0x14, 0, 13);
+
+/* reg_raleu_new_adjacency_index
+ * New Adjacency Index.
+ * Access: WO
+ */
+MLXSW_ITEM32(reg, raleu, new_adjacency_index, 0x20, 0, 24);
+
+/* reg_raleu_new_ecmp_size
+ * New ECMP Size.
+ * Access: WO
+ */
+MLXSW_ITEM32(reg, raleu, new_ecmp_size, 0x24, 0, 13);
+
+static inline void mlxsw_reg_raleu_pack(char *payload,
+                                       enum mlxsw_reg_ralxx_protocol protocol,
+                                       u16 virtual_router,
+                                       u32 adjacency_index, u16 ecmp_size,
+                                       u32 new_adjacency_index,
+                                       u16 new_ecmp_size)
+{
+       MLXSW_REG_ZERO(raleu, payload);
+       mlxsw_reg_raleu_protocol_set(payload, protocol);
+       mlxsw_reg_raleu_virtual_router_set(payload, virtual_router);
+       mlxsw_reg_raleu_adjacency_index_set(payload, adjacency_index);
+       mlxsw_reg_raleu_ecmp_size_set(payload, ecmp_size);
+       mlxsw_reg_raleu_new_adjacency_index_set(payload, new_adjacency_index);
+       mlxsw_reg_raleu_new_ecmp_size_set(payload, new_ecmp_size);
+}
+
 /* RAUHTD - Router Algorithmic LPM Unicast Host Table Dump Register
  * ----------------------------------------------------------------
  * The RAUHTD register allows dumping entries from the Router Unicast Host
@@ -5053,6 +5120,8 @@ static inline const char *mlxsw_reg_id_str(u16 reg_id)
                return "RALUE";
        case MLXSW_REG_RAUHT_ID:
                return "RAUHT";
+       case MLXSW_REG_RALEU_ID:
+               return "RALEU";
        case MLXSW_REG_RAUHTD_ID:
                return "RAUHTD";
        case MLXSW_REG_MFCR_ID: