diff options
-rw-r--r-- | drivers/infiniband/hw/mlx4/main.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/main.c | 4 | ||||
-rw-r--r-- | include/linux/mlx4/device.h | 13 |
3 files changed, 8 insertions, 11 deletions
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 77f3dbc0aaa1..6128b2940c49 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -177,7 +177,7 @@ mlx4_ib_port_link_layer(struct ib_device *device, u8 port_num) | |||
177 | { | 177 | { |
178 | struct mlx4_dev *dev = to_mdev(device)->dev; | 178 | struct mlx4_dev *dev = to_mdev(device)->dev; |
179 | 179 | ||
180 | return dev->caps.port_mask & (1 << (port_num - 1)) ? | 180 | return dev->caps.port_mask[port_num] == MLX4_PORT_TYPE_IB ? |
181 | IB_LINK_LAYER_INFINIBAND : IB_LINK_LAYER_ETHERNET; | 181 | IB_LINK_LAYER_INFINIBAND : IB_LINK_LAYER_ETHERNET; |
182 | } | 182 | } |
183 | 183 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 94bbc85a532d..64d03f8b23ab 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -140,10 +140,8 @@ static void mlx4_set_port_mask(struct mlx4_dev *dev) | |||
140 | { | 140 | { |
141 | int i; | 141 | int i; |
142 | 142 | ||
143 | dev->caps.port_mask = 0; | ||
144 | for (i = 1; i <= dev->caps.num_ports; ++i) | 143 | for (i = 1; i <= dev->caps.num_ports; ++i) |
145 | if (dev->caps.port_type[i] == MLX4_PORT_TYPE_IB) | 144 | dev->caps.port_mask[i] = dev->caps.port_type[i]; |
146 | dev->caps.port_mask |= 1 << (i - 1); | ||
147 | } | 145 | } |
148 | 146 | ||
149 | static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) | 147 | static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) |
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index b9466af2348f..3333018d2913 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
@@ -302,7 +302,7 @@ struct mlx4_caps { | |||
302 | int log_num_prios; | 302 | int log_num_prios; |
303 | enum mlx4_port_type port_type[MLX4_MAX_PORTS + 1]; | 303 | enum mlx4_port_type port_type[MLX4_MAX_PORTS + 1]; |
304 | u8 supported_type[MLX4_MAX_PORTS + 1]; | 304 | u8 supported_type[MLX4_MAX_PORTS + 1]; |
305 | u32 port_mask; | 305 | u32 port_mask[MLX4_MAX_PORTS + 1]; |
306 | enum mlx4_port_type possible_type[MLX4_MAX_PORTS + 1]; | 306 | enum mlx4_port_type possible_type[MLX4_MAX_PORTS + 1]; |
307 | u32 max_counters; | 307 | u32 max_counters; |
308 | u8 ext_port_cap[MLX4_MAX_PORTS + 1]; | 308 | u8 ext_port_cap[MLX4_MAX_PORTS + 1]; |
@@ -507,13 +507,12 @@ struct mlx4_init_port_param { | |||
507 | 507 | ||
508 | #define mlx4_foreach_port(port, dev, type) \ | 508 | #define mlx4_foreach_port(port, dev, type) \ |
509 | for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ | 509 | for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ |
510 | if (((type) == MLX4_PORT_TYPE_IB ? (dev)->caps.port_mask : \ | 510 | if ((type) == (dev)->caps.port_mask[(port)]) |
511 | ~(dev)->caps.port_mask) & 1 << ((port) - 1)) | ||
512 | 511 | ||
513 | #define mlx4_foreach_ib_transport_port(port, dev) \ | 512 | #define mlx4_foreach_ib_transport_port(port, dev) \ |
514 | for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ | 513 | for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ |
515 | if (((dev)->caps.port_mask & 1 << ((port) - 1)) || \ | 514 | if (((dev)->caps.port_mask[port] == MLX4_PORT_TYPE_IB) || \ |
516 | ((dev)->caps.flags & MLX4_DEV_CAP_FLAG_IBOE)) | 515 | ((dev)->caps.flags & MLX4_DEV_CAP_FLAG_IBOE)) |
517 | 516 | ||
518 | static inline int mlx4_is_master(struct mlx4_dev *dev) | 517 | static inline int mlx4_is_master(struct mlx4_dev *dev) |
519 | { | 518 | { |