]> git.baikalelectronics.ru Git - kernel.git/commit
mlxsw: spectrum: Do not rely on machine endianness
authorIdo Schimmel <idosch@mellanox.com>
Sun, 21 Jun 2020 08:29:17 +0000 (11:29 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 22 Jun 2020 23:29:51 +0000 (16:29 -0700)
commite7cad04dbe2e79305c3104d127e7913782331d6d
tree49bd6016b54e1d33f1469cc223240e8b15599886
parentd05d8be57de100b4c133ae82cbd53c647976edb4
mlxsw: spectrum: Do not rely on machine endianness

The second commit cited below performed a cast of 'u32 buffsize' to
'(u16 *)' when calling mlxsw_sp_port_headroom_8x_adjust():

mlxsw_sp_port_headroom_8x_adjust(mlxsw_sp_port, (u16 *) &buffsize);

Colin noted that this will behave differently on big endian
architectures compared to little endian architectures.

Fix this by following Colin's suggestion and have the function accept
and return 'u32' instead of passing the current size by reference.

Fixes: 30c81368ffac ("mlxsw: spectrum: Extend to support Spectrum-3 ASIC")
Fixes: 16f95cf9ca89 ("mlxsw: spectrum: Adjust headroom buffers for 8x ports")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reported-by: Colin Ian King <colin.king@canonical.com>
Suggested-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
drivers/net/ethernet/mellanox/mlxsw/spectrum.h
drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c