Skip to content

Commit ad22c35

Browse files
Keith Buschaxboe
authored andcommitted
nvme: remove handling of multiple AEN requests
The driver can handle tracking only one AEN request, so this patch removes handling for multiple ones. Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: James Smart <james.smart@broadcom.com> Signed-off-by: Keith Busch <keith.busch@intel.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 08e1507 commit ad22c35

File tree

6 files changed

+11
-40
lines changed

6 files changed

+11
-40
lines changed

drivers/nvme/host/core.c

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2670,15 +2670,7 @@ static void nvme_async_event_work(struct work_struct *work)
26702670
struct nvme_ctrl *ctrl =
26712671
container_of(work, struct nvme_ctrl, async_event_work);
26722672

2673-
spin_lock_irq(&ctrl->lock);
2674-
while (ctrl->state == NVME_CTRL_LIVE && ctrl->event_limit > 0) {
2675-
int aer_idx = --ctrl->event_limit;
2676-
2677-
spin_unlock_irq(&ctrl->lock);
2678-
ctrl->ops->submit_async_event(ctrl, aer_idx);
2679-
spin_lock_irq(&ctrl->lock);
2680-
}
2681-
spin_unlock_irq(&ctrl->lock);
2673+
ctrl->ops->submit_async_event(ctrl);
26822674
}
26832675

26842676
static bool nvme_ctrl_pp_status(struct nvme_ctrl *ctrl)
@@ -2745,22 +2737,8 @@ void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,
27452737
union nvme_result *res)
27462738
{
27472739
u32 result = le32_to_cpu(res->u32);
2748-
bool done = true;
27492740

2750-
switch (le16_to_cpu(status) >> 1) {
2751-
case NVME_SC_SUCCESS:
2752-
done = false;
2753-
/*FALLTHRU*/
2754-
case NVME_SC_ABORT_REQ:
2755-
++ctrl->event_limit;
2756-
if (ctrl->state == NVME_CTRL_LIVE)
2757-
queue_work(nvme_wq, &ctrl->async_event_work);
2758-
break;
2759-
default:
2760-
break;
2761-
}
2762-
2763-
if (done)
2741+
if (le16_to_cpu(status) >> 1 != NVME_SC_SUCCESS)
27642742
return;
27652743

27662744
switch (result & 0xff07) {
@@ -2774,12 +2752,12 @@ void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,
27742752
default:
27752753
dev_warn(ctrl->device, "async event result %08x\n", result);
27762754
}
2755+
queue_work(nvme_wq, &ctrl->async_event_work);
27772756
}
27782757
EXPORT_SYMBOL_GPL(nvme_complete_async_event);
27792758

27802759
void nvme_queue_async_events(struct nvme_ctrl *ctrl)
27812760
{
2782-
ctrl->event_limit = NVME_NR_AEN_COMMANDS;
27832761
queue_work(nvme_wq, &ctrl->async_event_work);
27842762
}
27852763
EXPORT_SYMBOL_GPL(nvme_queue_async_events);

drivers/nvme/host/fc.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2382,17 +2382,14 @@ nvme_fc_poll(struct blk_mq_hw_ctx *hctx, unsigned int tag)
23822382
}
23832383

23842384
static void
2385-
nvme_fc_submit_async_event(struct nvme_ctrl *arg, int aer_idx)
2385+
nvme_fc_submit_async_event(struct nvme_ctrl *arg)
23862386
{
23872387
struct nvme_fc_ctrl *ctrl = to_fc_ctrl(arg);
23882388
struct nvme_fc_fcp_op *aen_op;
23892389
unsigned long flags;
23902390
bool terminating = false;
23912391
blk_status_t ret;
23922392

2393-
if (aer_idx > NVME_NR_AEN_COMMANDS)
2394-
return;
2395-
23962393
spin_lock_irqsave(&ctrl->lock, flags);
23972394
if (ctrl->flags & FCCTRL_TERMIO)
23982395
terminating = true;
@@ -2401,13 +2398,13 @@ nvme_fc_submit_async_event(struct nvme_ctrl *arg, int aer_idx)
24012398
if (terminating)
24022399
return;
24032400

2404-
aen_op = &ctrl->aen_ops[aer_idx];
2401+
aen_op = &ctrl->aen_ops[0];
24052402

24062403
ret = nvme_fc_start_fcp_op(ctrl, aen_op->queue, aen_op, 0,
24072404
NVMEFC_FCP_NODATA);
24082405
if (ret)
24092406
dev_err(ctrl->ctrl.device,
2410-
"failed async event work [%d]\n", aer_idx);
2407+
"failed async event work\n");
24112408
}
24122409

24132410
static void

drivers/nvme/host/nvme.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ struct nvme_ctrl {
162162
u16 nssa;
163163
u16 nr_streams;
164164
atomic_t abort_limit;
165-
u8 event_limit;
166165
u8 vwc;
167166
u32 vs;
168167
u32 sgls;
@@ -237,7 +236,7 @@ struct nvme_ctrl_ops {
237236
int (*reg_write32)(struct nvme_ctrl *ctrl, u32 off, u32 val);
238237
int (*reg_read64)(struct nvme_ctrl *ctrl, u32 off, u64 *val);
239238
void (*free_ctrl)(struct nvme_ctrl *ctrl);
240-
void (*submit_async_event)(struct nvme_ctrl *ctrl, int aer_idx);
239+
void (*submit_async_event)(struct nvme_ctrl *ctrl);
241240
void (*delete_ctrl)(struct nvme_ctrl *ctrl);
242241
int (*get_address)(struct nvme_ctrl *ctrl, char *buf, int size);
243242
int (*reinit_request)(void *data, struct request *rq);

drivers/nvme/host/pci.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,15 +1043,15 @@ static int nvme_poll(struct blk_mq_hw_ctx *hctx, unsigned int tag)
10431043
return __nvme_poll(nvmeq, tag);
10441044
}
10451045

1046-
static void nvme_pci_submit_async_event(struct nvme_ctrl *ctrl, int aer_idx)
1046+
static void nvme_pci_submit_async_event(struct nvme_ctrl *ctrl)
10471047
{
10481048
struct nvme_dev *dev = to_nvme_dev(ctrl);
10491049
struct nvme_queue *nvmeq = dev->queues[0];
10501050
struct nvme_command c;
10511051

10521052
memset(&c, 0, sizeof(c));
10531053
c.common.opcode = nvme_admin_async_event;
1054-
c.common.command_id = NVME_AQ_BLK_MQ_DEPTH + aer_idx;
1054+
c.common.command_id = NVME_AQ_BLK_MQ_DEPTH;
10551055

10561056
spin_lock_irq(&nvmeq->q_lock);
10571057
__nvme_submit_cmd(nvmeq, &c);

drivers/nvme/host/rdma.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ static struct blk_mq_tags *nvme_rdma_tagset(struct nvme_rdma_queue *queue)
12931293
return queue->ctrl->tag_set.tags[queue_idx - 1];
12941294
}
12951295

1296-
static void nvme_rdma_submit_async_event(struct nvme_ctrl *arg, int aer_idx)
1296+
static void nvme_rdma_submit_async_event(struct nvme_ctrl *arg)
12971297
{
12981298
struct nvme_rdma_ctrl *ctrl = to_rdma_ctrl(arg);
12991299
struct nvme_rdma_queue *queue = &ctrl->queues[0];
@@ -1303,9 +1303,6 @@ static void nvme_rdma_submit_async_event(struct nvme_ctrl *arg, int aer_idx)
13031303
struct ib_sge sge;
13041304
int ret;
13051305

1306-
if (WARN_ON_ONCE(aer_idx != 0))
1307-
return;
1308-
13091306
ib_dma_sync_single_for_cpu(dev, sqe->dma, sizeof(*cmd), DMA_TO_DEVICE);
13101307

13111308
memset(cmd, 0, sizeof(*cmd));

drivers/nvme/target/loop.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ static blk_status_t nvme_loop_queue_rq(struct blk_mq_hw_ctx *hctx,
184184
return BLK_STS_OK;
185185
}
186186

187-
static void nvme_loop_submit_async_event(struct nvme_ctrl *arg, int aer_idx)
187+
static void nvme_loop_submit_async_event(struct nvme_ctrl *arg)
188188
{
189189
struct nvme_loop_ctrl *ctrl = to_loop_ctrl(arg);
190190
struct nvme_loop_queue *queue = &ctrl->queues[0];

0 commit comments

Comments
 (0)