Skip to content

Commit eb85f1d

Browse files
tyreldmartinkpetersen
authored andcommitted
scsi: ibmvfc: Add protocol field to ibmvfc_channels
There are cases in the generic code where protocol specific configuration or actions may need to be taken. Add a protocol field to struct ibmvfc_channels and initial IBMVFC_PROTO_[SCSI/NVME] definitions. Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com> Link: https://lore.kernel.org/r/20230921225435.3537728-10-tyreld@linux.ibm.com Reviewed-by: Brian King <brking@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent f28f16d commit eb85f1d

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

drivers/scsi/ibmvscsi/ibmvfc.c

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3935,7 +3935,7 @@ static void ibmvfc_drain_sub_crq(struct ibmvfc_queue *scrq)
39353935
}
39363936
}
39373937

3938-
static irqreturn_t ibmvfc_interrupt_scsi(int irq, void *scrq_instance)
3938+
static irqreturn_t ibmvfc_interrupt_mq(int irq, void *scrq_instance)
39393939
{
39403940
struct ibmvfc_queue *scrq = (struct ibmvfc_queue *)scrq_instance;
39413941

@@ -5936,9 +5936,24 @@ static int ibmvfc_register_channel(struct ibmvfc_host *vhost,
59365936
goto irq_failed;
59375937
}
59385938

5939-
snprintf(scrq->name, sizeof(scrq->name), "ibmvfc-%x-scsi%d",
5940-
vdev->unit_address, index);
5941-
rc = request_irq(scrq->irq, ibmvfc_interrupt_scsi, 0, scrq->name, scrq);
5939+
switch (channels->protocol) {
5940+
case IBMVFC_PROTO_SCSI:
5941+
snprintf(scrq->name, sizeof(scrq->name), "ibmvfc-%x-scsi%d",
5942+
vdev->unit_address, index);
5943+
scrq->handler = ibmvfc_interrupt_mq;
5944+
break;
5945+
case IBMVFC_PROTO_NVME:
5946+
snprintf(scrq->name, sizeof(scrq->name), "ibmvfc-%x-nvmf%d",
5947+
vdev->unit_address, index);
5948+
scrq->handler = ibmvfc_interrupt_mq;
5949+
break;
5950+
default:
5951+
dev_err(dev, "Unknown channel protocol (%d)\n",
5952+
channels->protocol);
5953+
goto irq_failed;
5954+
}
5955+
5956+
rc = request_irq(scrq->irq, scrq->handler, 0, scrq->name, scrq);
59425957

59435958
if (rc) {
59445959
dev_err(dev, "Couldn't register sub-crq[%d] irq\n", index);
@@ -6317,6 +6332,7 @@ static int ibmvfc_probe(struct vio_dev *vdev, const struct vio_device_id *id)
63176332
vhost->mq_enabled = mq_enabled;
63186333
vhost->scsi_scrqs.desired_queues = min(shost->nr_hw_queues, nr_scsi_channels);
63196334
vhost->scsi_scrqs.max_queues = shost->nr_hw_queues;
6335+
vhost->scsi_scrqs.protocol = IBMVFC_PROTO_SCSI;
63206336
vhost->using_channels = 0;
63216337
vhost->do_enquiry = 1;
63226338
vhost->scan_timeout = 0;

drivers/scsi/ibmvscsi/ibmvfc.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,10 +813,17 @@ struct ibmvfc_queue {
813813
unsigned long irq;
814814
unsigned long hwq_id;
815815
char name[32];
816+
irq_handler_t handler;
817+
};
818+
819+
enum ibmvfc_protocol {
820+
IBMVFC_PROTO_SCSI = 0,
821+
IBMVFC_PROTO_NVME = 1,
816822
};
817823

818824
struct ibmvfc_channels {
819825
struct ibmvfc_queue *scrqs;
826+
enum ibmvfc_protocol protocol;
820827
unsigned int active_queues;
821828
unsigned int desired_queues;
822829
unsigned int max_queues;

0 commit comments

Comments
 (0)