Merge branches 'cma' and 'mlx4' into for-next

This commit is contained in:
Roland Dreier 2012-11-29 12:16:43 -08:00
commit 78c90247af
4 changed files with 17 additions and 15 deletions

View File

@ -345,17 +345,17 @@ static int find_gid_port(struct ib_device *device, union ib_gid *gid, u8 port_nu
err = ib_query_port(device, port_num, &props); err = ib_query_port(device, port_num, &props);
if (err) if (err)
return 1; return err;
for (i = 0; i < props.gid_tbl_len; ++i) { for (i = 0; i < props.gid_tbl_len; ++i) {
err = ib_query_gid(device, port_num, i, &tmp); err = ib_query_gid(device, port_num, i, &tmp);
if (err) if (err)
return 1; return err;
if (!memcmp(&tmp, gid, sizeof tmp)) if (!memcmp(&tmp, gid, sizeof tmp))
return 0; return 0;
} }
return -EAGAIN; return -EADDRNOTAVAIL;
} }
static int cma_acquire_dev(struct rdma_id_private *id_priv) static int cma_acquire_dev(struct rdma_id_private *id_priv)
@ -388,8 +388,7 @@ static int cma_acquire_dev(struct rdma_id_private *id_priv)
if (!ret) { if (!ret) {
id_priv->id.port_num = port; id_priv->id.port_num = port;
goto out; goto out;
} else if (ret == 1) }
break;
} }
} }
} }

View File

@ -268,15 +268,15 @@ static void schedule_delayed(struct ib_device *ibdev, struct id_map_entry *id)
struct mlx4_ib_sriov *sriov = &to_mdev(ibdev)->sriov; struct mlx4_ib_sriov *sriov = &to_mdev(ibdev)->sriov;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&sriov->going_down_lock, flags);
spin_lock(&sriov->id_map_lock); spin_lock(&sriov->id_map_lock);
spin_lock_irqsave(&sriov->going_down_lock, flags);
/*make sure that there is no schedule inside the scheduled work.*/ /*make sure that there is no schedule inside the scheduled work.*/
if (!sriov->is_going_down) { if (!sriov->is_going_down) {
id->scheduled_delete = 1; id->scheduled_delete = 1;
schedule_delayed_work(&id->timeout, CM_CLEANUP_CACHE_TIMEOUT); schedule_delayed_work(&id->timeout, CM_CLEANUP_CACHE_TIMEOUT);
} }
spin_unlock(&sriov->id_map_lock);
spin_unlock_irqrestore(&sriov->going_down_lock, flags); spin_unlock_irqrestore(&sriov->going_down_lock, flags);
spin_unlock(&sriov->id_map_lock);
} }
int mlx4_ib_multiplex_cm_handler(struct ib_device *ibdev, int port, int slave_id, int mlx4_ib_multiplex_cm_handler(struct ib_device *ibdev, int port, int slave_id,

View File

@ -1498,6 +1498,7 @@ static void mlx4_master_do_cmd(struct mlx4_dev *dev, int slave, u8 cmd,
u32 reply; u32 reply;
u8 is_going_down = 0; u8 is_going_down = 0;
int i; int i;
unsigned long flags;
slave_state[slave].comm_toggle ^= 1; slave_state[slave].comm_toggle ^= 1;
reply = (u32) slave_state[slave].comm_toggle << 31; reply = (u32) slave_state[slave].comm_toggle << 31;
@ -1576,12 +1577,12 @@ static void mlx4_master_do_cmd(struct mlx4_dev *dev, int slave, u8 cmd,
mlx4_warn(dev, "Bad comm cmd:%d from slave:%d\n", cmd, slave); mlx4_warn(dev, "Bad comm cmd:%d from slave:%d\n", cmd, slave);
goto reset_slave; goto reset_slave;
} }
spin_lock(&priv->mfunc.master.slave_state_lock); spin_lock_irqsave(&priv->mfunc.master.slave_state_lock, flags);
if (!slave_state[slave].is_slave_going_down) if (!slave_state[slave].is_slave_going_down)
slave_state[slave].last_cmd = cmd; slave_state[slave].last_cmd = cmd;
else else
is_going_down = 1; is_going_down = 1;
spin_unlock(&priv->mfunc.master.slave_state_lock); spin_unlock_irqrestore(&priv->mfunc.master.slave_state_lock, flags);
if (is_going_down) { if (is_going_down) {
mlx4_warn(dev, "Slave is going down aborting command(%d)" mlx4_warn(dev, "Slave is going down aborting command(%d)"
" executing from slave:%d\n", " executing from slave:%d\n",
@ -1597,10 +1598,10 @@ static void mlx4_master_do_cmd(struct mlx4_dev *dev, int slave, u8 cmd,
reset_slave: reset_slave:
/* cleanup any slave resources */ /* cleanup any slave resources */
mlx4_delete_all_resources_for_slave(dev, slave); mlx4_delete_all_resources_for_slave(dev, slave);
spin_lock(&priv->mfunc.master.slave_state_lock); spin_lock_irqsave(&priv->mfunc.master.slave_state_lock, flags);
if (!slave_state[slave].is_slave_going_down) if (!slave_state[slave].is_slave_going_down)
slave_state[slave].last_cmd = MLX4_COMM_CMD_RESET; slave_state[slave].last_cmd = MLX4_COMM_CMD_RESET;
spin_unlock(&priv->mfunc.master.slave_state_lock); spin_unlock_irqrestore(&priv->mfunc.master.slave_state_lock, flags);
/*with slave in the middle of flr, no need to clean resources again.*/ /*with slave in the middle of flr, no need to clean resources again.*/
inform_slave_state: inform_slave_state:
memset(&slave_state[slave].event_eq, 0, memset(&slave_state[slave].event_eq, 0,

View File

@ -407,6 +407,7 @@ void mlx4_master_handle_slave_flr(struct work_struct *work)
struct mlx4_slave_state *slave_state = priv->mfunc.master.slave_state; struct mlx4_slave_state *slave_state = priv->mfunc.master.slave_state;
int i; int i;
int err; int err;
unsigned long flags;
mlx4_dbg(dev, "mlx4_handle_slave_flr\n"); mlx4_dbg(dev, "mlx4_handle_slave_flr\n");
@ -418,10 +419,10 @@ void mlx4_master_handle_slave_flr(struct work_struct *work)
mlx4_delete_all_resources_for_slave(dev, i); mlx4_delete_all_resources_for_slave(dev, i);
/*return the slave to running mode*/ /*return the slave to running mode*/
spin_lock(&priv->mfunc.master.slave_state_lock); spin_lock_irqsave(&priv->mfunc.master.slave_state_lock, flags);
slave_state[i].last_cmd = MLX4_COMM_CMD_RESET; slave_state[i].last_cmd = MLX4_COMM_CMD_RESET;
slave_state[i].is_slave_going_down = 0; slave_state[i].is_slave_going_down = 0;
spin_unlock(&priv->mfunc.master.slave_state_lock); spin_unlock_irqrestore(&priv->mfunc.master.slave_state_lock, flags);
/*notify the FW:*/ /*notify the FW:*/
err = mlx4_cmd(dev, 0, i, 0, MLX4_CMD_INFORM_FLR_DONE, err = mlx4_cmd(dev, 0, i, 0, MLX4_CMD_INFORM_FLR_DONE,
MLX4_CMD_TIME_CLASS_A, MLX4_CMD_WRAPPED); MLX4_CMD_TIME_CLASS_A, MLX4_CMD_WRAPPED);
@ -446,6 +447,7 @@ static int mlx4_eq_int(struct mlx4_dev *dev, struct mlx4_eq *eq)
u8 update_slave_state; u8 update_slave_state;
int i; int i;
enum slave_port_gen_event gen_event; enum slave_port_gen_event gen_event;
unsigned long flags;
while ((eqe = next_eqe_sw(eq, dev->caps.eqe_factor))) { while ((eqe = next_eqe_sw(eq, dev->caps.eqe_factor))) {
/* /*
@ -653,13 +655,13 @@ static int mlx4_eq_int(struct mlx4_dev *dev, struct mlx4_eq *eq)
} else } else
update_slave_state = 1; update_slave_state = 1;
spin_lock(&priv->mfunc.master.slave_state_lock); spin_lock_irqsave(&priv->mfunc.master.slave_state_lock, flags);
if (update_slave_state) { if (update_slave_state) {
priv->mfunc.master.slave_state[flr_slave].active = false; priv->mfunc.master.slave_state[flr_slave].active = false;
priv->mfunc.master.slave_state[flr_slave].last_cmd = MLX4_COMM_CMD_FLR; priv->mfunc.master.slave_state[flr_slave].last_cmd = MLX4_COMM_CMD_FLR;
priv->mfunc.master.slave_state[flr_slave].is_slave_going_down = 1; priv->mfunc.master.slave_state[flr_slave].is_slave_going_down = 1;
} }
spin_unlock(&priv->mfunc.master.slave_state_lock); spin_unlock_irqrestore(&priv->mfunc.master.slave_state_lock, flags);
queue_work(priv->mfunc.master.comm_wq, queue_work(priv->mfunc.master.comm_wq,
&priv->mfunc.master.slave_flr_event_work); &priv->mfunc.master.slave_flr_event_work);
break; break;