OSDN Git Service

mlxsw: spectrum: Introduce resource for getting offset of 4 lanes split port
authorJiri Pirko <jiri@mellanox.com>
Thu, 31 Oct 2019 09:42:16 +0000 (11:42 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 31 Oct 2019 17:54:47 +0000 (10:54 -0700)
In Spectrum-3 the modules have 8 lanes, so split by count 2 results in
two split ports each of 4 lanes. Add a resource that can be used to
obtain local port offset in that case.

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

index 85f919f..6534184 100644 (file)
@@ -26,6 +26,7 @@ enum mlxsw_res_id {
        MLXSW_RES_ID_MAX_LAG_MEMBERS,
        MLXSW_RES_ID_LOCAL_PORTS_IN_1X,
        MLXSW_RES_ID_LOCAL_PORTS_IN_2X,
+       MLXSW_RES_ID_LOCAL_PORTS_IN_4X,
        MLXSW_RES_ID_GUARANTEED_SHARED_BUFFER,
        MLXSW_RES_ID_CELL_SIZE,
        MLXSW_RES_ID_MAX_HEADROOM_SIZE,
@@ -82,6 +83,7 @@ static u16 mlxsw_res_ids[] = {
        [MLXSW_RES_ID_MAX_LAG_MEMBERS] = 0x2521,
        [MLXSW_RES_ID_LOCAL_PORTS_IN_1X] = 0x2610,
        [MLXSW_RES_ID_LOCAL_PORTS_IN_2X] = 0x2611,
+       [MLXSW_RES_ID_LOCAL_PORTS_IN_4X] = 0x2612,
        [MLXSW_RES_ID_GUARANTEED_SHARED_BUFFER] = 0x2805,       /* Bytes */
        [MLXSW_RES_ID_CELL_SIZE] = 0x2803,      /* Bytes */
        [MLXSW_RES_ID_MAX_HEADROOM_SIZE] = 0x2811,      /* Bytes */
index 39ea408..d336e54 100644 (file)
@@ -4165,6 +4165,8 @@ static int mlxsw_sp_local_ports_offset(struct mlxsw_core *mlxsw_core,
                local_ports_in_x_res_id = MLXSW_RES_ID_LOCAL_PORTS_IN_1X;
        else if (split_width == 2)
                local_ports_in_x_res_id = MLXSW_RES_ID_LOCAL_PORTS_IN_2X;
+       else if (split_width == 4)
+               local_ports_in_x_res_id = MLXSW_RES_ID_LOCAL_PORTS_IN_4X;
        else
                return -EINVAL;