mlx4: Extanding port_mask functionality
authorJack Morgenstein <jackm@dev.mellanox.co.il>
Tue, 13 Dec 2011 04:10:41 +0000 (04:10 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 13 Dec 2011 18:56:05 +0000 (13:56 -0500)
Port mask now has additional state.
Port can be set as "none". In this case neither the mlx4_en or mlx4_ib
drivers take ownership of the port.
In multifunction mode there is an option to set the vfs as single ported devices.
(in single function mode, both physical ports belong to same function)

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/infiniband/hw/mlx4/main.c
drivers/net/ethernet/mellanox/mlx4/main.c
include/linux/mlx4/device.h

index 77f3dbc0aaa1629783bfadb84d0ac5ad754e8207..6128b2940c493a3c98f66b2c02d53a4f1b9b2f2b 100644 (file)
@@ -177,7 +177,7 @@ mlx4_ib_port_link_layer(struct ib_device *device, u8 port_num)
 {
        struct mlx4_dev *dev = to_mdev(device)->dev;
 
-       return dev->caps.port_mask & (1 << (port_num - 1)) ?
+       return dev->caps.port_mask[port_num] == MLX4_PORT_TYPE_IB ?
                IB_LINK_LAYER_INFINIBAND : IB_LINK_LAYER_ETHERNET;
 }
 
index 94bbc85a532d18d2fd67caf5406bcd2a6baac26d..64d03f8b23abf96870cd79284d1adef680fec60d 100644 (file)
@@ -140,10 +140,8 @@ static void mlx4_set_port_mask(struct mlx4_dev *dev)
 {
        int i;
 
-       dev->caps.port_mask = 0;
        for (i = 1; i <= dev->caps.num_ports; ++i)
-               if (dev->caps.port_type[i] == MLX4_PORT_TYPE_IB)
-                       dev->caps.port_mask |= 1 << (i - 1);
+               dev->caps.port_mask[i] = dev->caps.port_type[i];
 }
 
 static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
index b9466af2348f668674c69a34956a4e2ed23c5b3d..3333018d29136693314d96081a8faea9700879a6 100644 (file)
@@ -302,7 +302,7 @@ struct mlx4_caps {
        int                     log_num_prios;
        enum mlx4_port_type     port_type[MLX4_MAX_PORTS + 1];
        u8                      supported_type[MLX4_MAX_PORTS + 1];
-       u32                     port_mask;
+       u32                     port_mask[MLX4_MAX_PORTS + 1];
        enum mlx4_port_type     possible_type[MLX4_MAX_PORTS + 1];
        u32                     max_counters;
        u8                      ext_port_cap[MLX4_MAX_PORTS + 1];
@@ -507,13 +507,12 @@ struct mlx4_init_port_param {
 
 #define mlx4_foreach_port(port, dev, type)                             \
        for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++)     \
-               if (((type) == MLX4_PORT_TYPE_IB ? (dev)->caps.port_mask : \
-                    ~(dev)->caps.port_mask) & 1 << ((port) - 1))
+               if ((type) == (dev)->caps.port_mask[(port)])
 
-#define mlx4_foreach_ib_transport_port(port, dev)                      \
-       for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++)     \
-               if (((dev)->caps.port_mask & 1 << ((port) - 1)) ||      \
-                    ((dev)->caps.flags & MLX4_DEV_CAP_FLAG_IBOE))
+#define mlx4_foreach_ib_transport_port(port, dev)                         \
+       for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++)       \
+               if (((dev)->caps.port_mask[port] == MLX4_PORT_TYPE_IB) || \
+                       ((dev)->caps.flags & MLX4_DEV_CAP_FLAG_IBOE))
 
 static inline int mlx4_is_master(struct mlx4_dev *dev)
 {
This page took 0.03159 seconds and 5 git commands to generate.