mlxsw: reg: Add XRALXX Registers

Add a couple of registers used to manipulate LPM trees on XM:
The XRALTA is used to allocate the XLT LPM trees.
The XRALST is used to set and query the structure of an XLT LPM tree.
The XRALTB register is used to bind virtual router and protocol to
an allocated LPM tree.

Since the XM registers are identical to the legacy router registers
with a fixed offset, re-use their pack functions.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jiri Pirko 2020-11-01 15:42:14 +02:00 committed by Jakub Kicinski
parent 8e6a0485d1
commit fb281f24f8

View file

@ -8245,6 +8245,86 @@ mlxsw_reg_rmft2_ipv6_pack(char *payload, bool v, u16 offset, u16 virtual_router,
mlxsw_reg_rmft2_sip6_mask_memcpy_to(payload, (void *)&sip6_mask);
}
/* Note that XRALXX register position violates the rule of ordering register
* definition by the ID. However, XRALXX pack helpers are using RALXX pack
* helpers, RALXX registers have higher IDs.
*/
/* XRALTA - XM Router Algorithmic LPM Tree Allocation Register
* -----------------------------------------------------------
* The XRALTA is used to allocate the XLT LPM trees.
*
* This register embeds original RALTA register.
*/
#define MLXSW_REG_XRALTA_ID 0x7811
#define MLXSW_REG_XRALTA_LEN 0x08
#define MLXSW_REG_XRALTA_RALTA_OFFSET 0x04
MLXSW_REG_DEFINE(xralta, MLXSW_REG_XRALTA_ID, MLXSW_REG_XRALTA_LEN);
static inline void mlxsw_reg_xralta_pack(char *payload, bool alloc,
enum mlxsw_reg_ralxx_protocol protocol,
u8 tree_id)
{
char *ralta_payload = payload + MLXSW_REG_XRALTA_RALTA_OFFSET;
MLXSW_REG_ZERO(xralta, payload);
mlxsw_reg_ralta_pack(ralta_payload, alloc, protocol, tree_id);
}
/* XRALST - XM Router Algorithmic LPM Structure Tree Register
* ----------------------------------------------------------
* The XRALST is used to set and query the structure of an XLT LPM tree.
*
* This register embeds original RALST register.
*/
#define MLXSW_REG_XRALST_ID 0x7812
#define MLXSW_REG_XRALST_LEN 0x108
#define MLXSW_REG_XRALST_RALST_OFFSET 0x04
MLXSW_REG_DEFINE(xralst, MLXSW_REG_XRALST_ID, MLXSW_REG_XRALST_LEN);
static inline void mlxsw_reg_xralst_pack(char *payload, u8 root_bin, u8 tree_id)
{
char *ralst_payload = payload + MLXSW_REG_XRALST_RALST_OFFSET;
MLXSW_REG_ZERO(xralst, payload);
mlxsw_reg_ralst_pack(ralst_payload, root_bin, tree_id);
}
static inline void mlxsw_reg_xralst_bin_pack(char *payload, u8 bin_number,
u8 left_child_bin,
u8 right_child_bin)
{
char *ralst_payload = payload + MLXSW_REG_XRALST_RALST_OFFSET;
mlxsw_reg_ralst_bin_pack(ralst_payload, bin_number, left_child_bin,
right_child_bin);
}
/* XRALTB - XM Router Algorithmic LPM Tree Binding Register
* --------------------------------------------------------
* The XRALTB register is used to bind virtual router and protocol
* to an allocated LPM tree.
*
* This register embeds original RALTB register.
*/
#define MLXSW_REG_XRALTB_ID 0x7813
#define MLXSW_REG_XRALTB_LEN 0x08
#define MLXSW_REG_XRALTB_RALTB_OFFSET 0x04
MLXSW_REG_DEFINE(xraltb, MLXSW_REG_XRALTB_ID, MLXSW_REG_XRALTB_LEN);
static inline void mlxsw_reg_xraltb_pack(char *payload, u16 virtual_router,
enum mlxsw_reg_ralxx_protocol protocol,
u8 tree_id)
{
char *raltb_payload = payload + MLXSW_REG_XRALTB_RALTB_OFFSET;
MLXSW_REG_ZERO(xraltb, payload);
mlxsw_reg_raltb_pack(raltb_payload, virtual_router, protocol, tree_id);
}
/* MFCR - Management Fan Control Register
* --------------------------------------
* This register controls the settings of the Fan Speed PWM mechanism.
@ -11195,6 +11275,9 @@ static const struct mlxsw_reg_info *mlxsw_reg_infos[] = {
MLXSW_REG(rigr2),
MLXSW_REG(recr2),
MLXSW_REG(rmft2),
MLXSW_REG(xralta),
MLXSW_REG(xralst),
MLXSW_REG(xraltb),
MLXSW_REG(mfcr),
MLXSW_REG(mfsc),
MLXSW_REG(mfsm),