mlx4_core: Get rid of redundant ext_port_cap flags
authorOr Gerlitz <ogerlitz@mellanox.com>
Tue, 6 Mar 2012 13:50:50 +0000 (15:50 +0200)
committerRoland Dreier <roland@purestorage.com>
Wed, 7 Mar 2012 01:25:18 +0000 (17:25 -0800)
While doing the work for commit a6f7feae6d ("IB/mlx4: pass SMP
vendor-specific attribute MADs to firmware") we realized that the
firmware would respond on all sorts of vendor-specific MADs.
Therefore commit 97285b7817 ("mlx4_core: Add extended port
capabilities support") adds redundant code into the driver, since
there's no real reaon to maintain the extended capabilities of the
port, as they can be queried on demand (e.g the FDR10 capability).

This patch reverts commit 97285b7817 and removes the check for
extended caps from the mlx4_ib driver port query flow.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/hw/mlx4/main.c
drivers/net/ethernet/mellanox/mlx4/main.c
drivers/net/ethernet/mellanox/mlx4/mlx4.h
drivers/net/ethernet/mellanox/mlx4/port.c
include/linux/mlx4/device.h

index 6ff6bdf28a3abcb90e7817a53626d4c3d46bd453..abce99ed565f74013faad73f2307fe978487b2bf 100644 (file)
@@ -225,21 +225,18 @@ static int ib_link_query_port(struct ib_device *ibdev, u8 port,
 
        /* If reported active speed is QDR, check if is FDR-10 */
        if (props->active_speed == IB_SPEED_QDR) {
-               if (to_mdev(ibdev)->dev->caps.ext_port_cap[port] &
-                   MLX_EXT_PORT_CAP_FLAG_EXTENDED_PORT_INFO) {
-                       init_query_mad(in_mad);
-                       in_mad->attr_id = MLX4_ATTR_EXTENDED_PORT_INFO;
-                       in_mad->attr_mod = cpu_to_be32(port);
-
-                       err = mlx4_MAD_IFC(to_mdev(ibdev), 1, 1, port,
-                                          NULL, NULL, in_mad, out_mad);
-                       if (err)
-                               return err;
+               init_query_mad(in_mad);
+               in_mad->attr_id = MLX4_ATTR_EXTENDED_PORT_INFO;
+               in_mad->attr_mod = cpu_to_be32(port);
 
-                       /* Checking LinkSpeedActive for FDR-10 */
-                       if (out_mad->data[15] & 0x1)
-                               props->active_speed = IB_SPEED_FDR10;
-               }
+               err = mlx4_MAD_IFC(to_mdev(ibdev), 1, 1, port,
+                                  NULL, NULL, in_mad, out_mad);
+               if (err)
+                       return err;
+
+               /* Checking LinkSpeedActive for FDR-10 */
+               if (out_mad->data[15] & 0x1)
+                       props->active_speed = IB_SPEED_FDR10;
        }
 
        return 0;
index 678558b502fc31e506633e0713805f58c8676108..2f94d30ab12b3c6d405c4b735d0695694c587f04 100644 (file)
@@ -1361,13 +1361,6 @@ static int mlx4_setup_hca(struct mlx4_dev *dev)
                                          "with caps = 0\n", port, err);
                        dev->caps.ib_port_def_cap[port] = ib_port_default_caps;
 
-                       err = mlx4_check_ext_port_caps(dev, port);
-                       if (err)
-                               mlx4_warn(dev, "failed to get port %d extended "
-                                         "port capabilities support info (%d)."
-                                         " Assuming not supported\n",
-                                         port, err);
-
                        err = mlx4_SET_PORT(dev, port);
                        if (err) {
                                mlx4_err(dev, "Failed to set port %d, aborting\n",
index c92269f8c0570a5b7e6d374beb7ffb9f48e79877..c34d30a5d77b6481d276b93274ce5e0ff9d15e1b 100644 (file)
@@ -1025,7 +1025,6 @@ int mlx4_QUERY_PORT_wrapper(struct mlx4_dev *dev, int slave,
                            struct mlx4_cmd_mailbox *outbox,
                            struct mlx4_cmd_info *cmd);
 int mlx4_get_port_ib_caps(struct mlx4_dev *dev, u8 port, __be32 *caps);
-int mlx4_check_ext_port_caps(struct mlx4_dev *dev, u8 port);
 
 
 int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
index f44ae555bf43906bfba98cb25838542f5052c25d..51708dd7c8b01c1fb4380d3c73b20f41c173a53e 100644 (file)
@@ -590,49 +590,6 @@ int mlx4_get_port_ib_caps(struct mlx4_dev *dev, u8 port, __be32 *caps)
        return err;
 }
 
-int mlx4_check_ext_port_caps(struct mlx4_dev *dev, u8 port)
-{
-       struct mlx4_cmd_mailbox *inmailbox, *outmailbox;
-       u8 *inbuf, *outbuf;
-       int err, packet_error;
-
-       inmailbox = mlx4_alloc_cmd_mailbox(dev);
-       if (IS_ERR(inmailbox))
-               return PTR_ERR(inmailbox);
-
-       outmailbox = mlx4_alloc_cmd_mailbox(dev);
-       if (IS_ERR(outmailbox)) {
-               mlx4_free_cmd_mailbox(dev, inmailbox);
-               return PTR_ERR(outmailbox);
-       }
-
-       inbuf = inmailbox->buf;
-       outbuf = outmailbox->buf;
-       memset(inbuf, 0, 256);
-       memset(outbuf, 0, 256);
-       inbuf[0] = 1;
-       inbuf[1] = 1;
-       inbuf[2] = 1;
-       inbuf[3] = 1;
-
-       *(__be16 *) (&inbuf[16]) = MLX4_ATTR_EXTENDED_PORT_INFO;
-       *(__be32 *) (&inbuf[20]) = cpu_to_be32(port);
-
-       err = mlx4_cmd_box(dev, inmailbox->dma, outmailbox->dma, port, 3,
-                          MLX4_CMD_MAD_IFC, MLX4_CMD_TIME_CLASS_C,
-                          MLX4_CMD_NATIVE);
-
-       packet_error = be16_to_cpu(*(__be16 *) (outbuf + 4));
-
-       dev->caps.ext_port_cap[port] = (!err && !packet_error) ?
-                                      MLX_EXT_PORT_CAP_FLAG_EXTENDED_PORT_INFO
-                                      : 0;
-
-       mlx4_free_cmd_mailbox(dev, inmailbox);
-       mlx4_free_cmd_mailbox(dev, outmailbox);
-       return err;
-}
-
 static int mlx4_common_set_port(struct mlx4_dev *dev, int slave, u32 in_mod,
                                u8 op_mod, struct mlx4_cmd_mailbox *inbox)
 {
index aea61905499b0e20598969cb02e63f32a3010d2d..be7f235c04c099589cde440cbc457780d8a23095 100644 (file)
@@ -100,10 +100,6 @@ enum {
 
 #define MLX4_ATTR_EXTENDED_PORT_INFO   cpu_to_be16(0xff90)
 
-enum {
-       MLX_EXT_PORT_CAP_FLAG_EXTENDED_PORT_INFO        = 1 <<  0
-};
-
 enum {
        MLX4_BMME_FLAG_LOCAL_INV        = 1 <<  6,
        MLX4_BMME_FLAG_REMOTE_INV       = 1 <<  7,
@@ -308,7 +304,6 @@ struct mlx4_caps {
        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];
 };
 
 struct mlx4_buf_list {