mlx4/IB: Add set_4k_mtu module parameter.
Subsystems (2)
PATCH 1/1 mlx4/IB: Add set_4k_mtu module parameter.
It control Infiniband link MTU for all IB ports in a host.
--- drivers/net/mlx4/port.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
drivers/net/mlx4/port.c +10 -0
@@ -37,6 +37,10 @@#include "mlx4.h" +static int mlx4_ib_set_4k_mtu; +module_param_named (set_4k_mtu, mlx4_ib_set_4k_mtu, int,0444 ); +MODULE_PARM_DESC (set_4k_mtu,"attempt to set 4K MTU to all ConnectX ports" ); +#define MLX4_MAC_VALID (1ull << 63)#define MLX4_MAC_MASK 0xffffffffffffULL
@@ -308,6 +312,12 @@ int mlx4_SET_PORT(struct mlx4_dev *dev, u8 port)memset (mailbox->buf,0 ,256 ); +if (mlx4_ib_set_4k_mtu) + ((__be32 *) mailbox->buf)[0 ] |=cpu_to_be32 ((1 <<22 ) | + (1 <<21 ) | + (5 <<12 ) | + (2 <<4 )); + ((__be32 *) mailbox->buf)[1 ] = dev->caps.ib_port_def_cap[port]; err =mlx4_cmd (dev, mailbox->dma, port,0 ,MLX4_CMD_SET_PORT ,MLX4_CMD_TIME_CLASS_B );
Signature · 6 lines
1.5.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
I'm not thrilled about this patch.
drivers/net/mlx4/port.c line 42
Quoted 2 lines
drivers/net/mlx4/port.c +2
-0+module_param_named (set_4k_mtu, mlx4_ib_set_4k_mtu, int,0444 ); +MODULE_PARM_DESC (set_4k_mtu,"attempt to set 4K MTU to all ConnectX ports" );
What does "attempt to set 4K MTU" mean? Try to set the MTU cap to 4K? What happens if it fails? Is there any reason not to just let the MTU cap be 4K all time?
Having this be a module parameter really seems like a bad idea for the future....
drivers/net/mlx4/port.c int mlx4_SET_PORT(struct mlx4_dev *dev, u8 port) · line 319
Quoted 5 lines
drivers/net/mlx4/port.c +5
-0+if (mlx4_ib_set_4k_mtu) + ((__be32 *) mailbox->buf)[0 ] |=cpu_to_be32 ((1 <<22 ) | + (1 <<21 ) | + (5 <<12 ) | + (2 <<4 ));
Is there any way for this to write this with fewer unexplained magic numbers?
- R.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html