Commit 4f1704fa authored by Shannon Nelson's avatar Shannon Nelson Committed by David S. Miller

ionic: split adminq post and wait calls

Split the wait part out of adminq_post_wait() into a separate
function so that a caller can have finer grain control over
the sequencing of operations and locking.
Signed-off-by: default avatarAllen Hubbe <allenbh@pensando.io>
Signed-off-by: default avatarShannon Nelson <snelson@pensando.io>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3da25843
...@@ -64,6 +64,8 @@ struct ionic_admin_ctx { ...@@ -64,6 +64,8 @@ struct ionic_admin_ctx {
union ionic_adminq_comp comp; union ionic_adminq_comp comp;
}; };
int ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx);
int ionic_adminq_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx, int err);
int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx); int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx);
int ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_wait); int ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_wait);
int ionic_set_dma_mask(struct ionic *ionic); int ionic_set_dma_mask(struct ionic *ionic);
......
...@@ -256,7 +256,7 @@ static void ionic_adminq_cb(struct ionic_queue *q, ...@@ -256,7 +256,7 @@ static void ionic_adminq_cb(struct ionic_queue *q,
complete_all(&ctx->work); complete_all(&ctx->work);
} }
static int ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) int ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx)
{ {
struct ionic_desc_info *desc_info; struct ionic_desc_info *desc_info;
unsigned long irqflags; unsigned long irqflags;
...@@ -295,14 +295,12 @@ static int ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) ...@@ -295,14 +295,12 @@ static int ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx)
return err; return err;
} }
int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) int ionic_adminq_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx, int err)
{ {
struct net_device *netdev = lif->netdev; struct net_device *netdev = lif->netdev;
unsigned long remaining; unsigned long remaining;
const char *name; const char *name;
int err;
err = ionic_adminq_post(lif, ctx);
if (err) { if (err) {
if (!test_bit(IONIC_LIF_F_FW_RESET, lif->state)) { if (!test_bit(IONIC_LIF_F_FW_RESET, lif->state)) {
name = ionic_opcode_to_str(ctx->cmd.cmd.opcode); name = ionic_opcode_to_str(ctx->cmd.cmd.opcode);
...@@ -317,6 +315,15 @@ int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) ...@@ -317,6 +315,15 @@ int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx)
return ionic_adminq_check_err(lif, ctx, (remaining == 0)); return ionic_adminq_check_err(lif, ctx, (remaining == 0));
} }
int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx)
{
int err;
err = ionic_adminq_post(lif, ctx);
return ionic_adminq_wait(lif, ctx, err);
}
static void ionic_dev_cmd_clean(struct ionic *ionic) static void ionic_dev_cmd_clean(struct ionic *ionic)
{ {
union __iomem ionic_dev_cmd_regs *regs = ionic->idev.dev_cmd_regs; union __iomem ionic_dev_cmd_regs *regs = ionic->idev.dev_cmd_regs;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment