Use ffs() to scan for first bit instead of using a for() loop.
Minor code refactor while at it. MFC after: 1 week Sponsored by: Mellanox Technologies
This commit is contained in:
parent
115bc9b1d3
commit
d0ce5a0da7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=312876
@ -859,7 +859,7 @@ void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 cqn);
|
|||||||
void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type);
|
void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type);
|
||||||
void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type);
|
void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type);
|
||||||
struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn);
|
struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn);
|
||||||
void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector);
|
void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u32 vector);
|
||||||
void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type);
|
void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type);
|
||||||
int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx,
|
int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx,
|
||||||
int nent, u64 mask, const char *name, struct mlx5_uar *uar);
|
int nent, u64 mask, const char *name, struct mlx5_uar *uar);
|
||||||
|
@ -760,7 +760,7 @@ static void cmd_work_handler(struct work_struct *work)
|
|||||||
poll_timeout(ent);
|
poll_timeout(ent);
|
||||||
/* make sure we read the descriptor after ownership is SW */
|
/* make sure we read the descriptor after ownership is SW */
|
||||||
rmb();
|
rmb();
|
||||||
mlx5_cmd_comp_handler(dev, 1UL << ent->idx);
|
mlx5_cmd_comp_handler(dev, 1U << ent->idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1104,7 +1104,7 @@ static void free_msg(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector)
|
void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u32 vector)
|
||||||
{
|
{
|
||||||
struct mlx5_cmd *cmd = &dev->cmd;
|
struct mlx5_cmd *cmd = &dev->cmd;
|
||||||
struct mlx5_cmd_work_ent *ent;
|
struct mlx5_cmd_work_ent *ent;
|
||||||
@ -1112,21 +1112,22 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector)
|
|||||||
void *context;
|
void *context;
|
||||||
int err;
|
int err;
|
||||||
int i;
|
int i;
|
||||||
|
struct semaphore *sem;
|
||||||
s64 ds;
|
s64 ds;
|
||||||
struct mlx5_cmd_stats *stats;
|
struct mlx5_cmd_stats *stats;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
for (i = 0; i < (1 << cmd->log_sz); i++) {
|
while (vector != 0) {
|
||||||
if (test_bit(i, &vector)) {
|
i = ffs(vector) - 1;
|
||||||
struct semaphore *sem;
|
vector &= ~(1U << i);
|
||||||
|
|
||||||
ent = cmd->ent_arr[i];
|
ent = cmd->ent_arr[i];
|
||||||
if (ent->page_queue)
|
if (ent->page_queue)
|
||||||
sem = &cmd->pages_sem;
|
sem = &cmd->pages_sem;
|
||||||
else
|
else
|
||||||
sem = &cmd->sem;
|
sem = &cmd->sem;
|
||||||
ent->ts2 = ktime_get_ns();
|
ent->ts2 = ktime_get_ns();
|
||||||
memcpy(ent->out->first.data, ent->lay->out, sizeof(ent->lay->out));
|
memcpy(ent->out->first.data, ent->lay->out,
|
||||||
|
sizeof(ent->lay->out));
|
||||||
dump_command(dev, ent, 0);
|
dump_command(dev, ent, 0);
|
||||||
if (!ent->ret) {
|
if (!ent->ret) {
|
||||||
if (!cmd->checksum_disabled)
|
if (!cmd->checksum_disabled)
|
||||||
@ -1134,8 +1135,11 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector)
|
|||||||
else
|
else
|
||||||
ent->ret = 0;
|
ent->ret = 0;
|
||||||
ent->status = ent->lay->status_own >> 1;
|
ent->status = ent->lay->status_own >> 1;
|
||||||
mlx5_core_dbg(dev, "command completed. ret 0x%x, delivery status %s(0x%x)\n",
|
mlx5_core_dbg(dev,
|
||||||
ent->ret, deliv_status_to_str(ent->status), ent->status);
|
"FW command ret 0x%x, status %s(0x%x)\n",
|
||||||
|
ent->ret,
|
||||||
|
deliv_status_to_str(ent->status),
|
||||||
|
ent->status);
|
||||||
}
|
}
|
||||||
free_ent(cmd, ent->idx);
|
free_ent(cmd, ent->idx);
|
||||||
if (ent->callback) {
|
if (ent->callback) {
|
||||||
@ -1166,7 +1170,6 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector)
|
|||||||
}
|
}
|
||||||
up(sem);
|
up(sem);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(mlx5_cmd_comp_handler);
|
EXPORT_SYMBOL(mlx5_cmd_comp_handler);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user