Commit e119d14c authored by Satish Kharat's avatar Satish Kharat Committed by Martin K. Petersen

scsi: fnic: Enable fnic devcmd2 interface

This patch adds changes to check if fnic devcmd2 interface is exported by
the firmware. If devcmd2 interfaces is exported, driver starts using it
else falls back to fnic devcmd1 interface.
Signed-off-by: default avatarSatish Kharat <satishkh@cisco.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 0a2fdd22
...@@ -658,12 +658,20 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -658,12 +658,20 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
goto err_out_iounmap; goto err_out_iounmap;
} }
err = vnic_dev_cmd_init(fnic->vdev);
if (err) {
shost_printk(KERN_ERR, fnic->lport->host,
"vnic_dev_cmd_init() returns %d, aborting\n",
err);
goto err_out_vnic_unregister;
}
err = fnic_dev_wait(fnic->vdev, vnic_dev_open, err = fnic_dev_wait(fnic->vdev, vnic_dev_open,
vnic_dev_open_done, CMD_OPENF_RQ_ENABLE_THEN_POST); vnic_dev_open_done, CMD_OPENF_RQ_ENABLE_THEN_POST);
if (err) { if (err) {
shost_printk(KERN_ERR, fnic->lport->host, shost_printk(KERN_ERR, fnic->lport->host,
"vNIC dev open failed, aborting.\n"); "vNIC dev open failed, aborting.\n");
goto err_out_vnic_unregister; goto err_out_dev_cmd_deinit;
} }
err = vnic_dev_init(fnic->vdev, 0); err = vnic_dev_init(fnic->vdev, 0);
...@@ -921,6 +929,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -921,6 +929,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
fnic_clear_intr_mode(fnic); fnic_clear_intr_mode(fnic);
err_out_dev_close: err_out_dev_close:
vnic_dev_close(fnic->vdev); vnic_dev_close(fnic->vdev);
err_out_dev_cmd_deinit:
err_out_vnic_unregister: err_out_vnic_unregister:
vnic_dev_unregister(fnic->vdev); vnic_dev_unregister(fnic->vdev);
err_out_iounmap: err_out_iounmap:
......
...@@ -934,3 +934,20 @@ struct vnic_dev *vnic_dev_register(struct vnic_dev *vdev, ...@@ -934,3 +934,20 @@ struct vnic_dev *vnic_dev_register(struct vnic_dev *vdev,
vnic_dev_unregister(vdev); vnic_dev_unregister(vdev);
return NULL; return NULL;
} }
int vnic_dev_cmd_init(struct vnic_dev *vdev)
{
int err;
void *p;
p = vnic_dev_get_res(vdev, RES_TYPE_DEVCMD2, 0);
if (p) {
pr_err("fnic: DEVCMD2 resource found!\n");
err = vnic_dev_init_devcmd2(vdev);
} else {
pr_err("fnic: DEVCMD2 not found, fall back to Devcmd\n");
err = vnic_dev_init_devcmd1(vdev);
}
return err;
}
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#define vnic_dev_fw_info fnic_dev_fw_info #define vnic_dev_fw_info fnic_dev_fw_info
#define vnic_dev_spec fnic_dev_spec #define vnic_dev_spec fnic_dev_spec
#define vnic_dev_stats_clear fnic_dev_stats_clear #define vnic_dev_stats_clear fnic_dev_stats_clear
#define vnic_dev_cmd_init fnic_dev_cmd_init
#define vnic_dev_stats_dump fnic_dev_stats_dump #define vnic_dev_stats_dump fnic_dev_stats_dump
#define vnic_dev_hang_notify fnic_dev_hang_notify #define vnic_dev_hang_notify fnic_dev_hang_notify
#define vnic_dev_packet_filter fnic_dev_packet_filter #define vnic_dev_packet_filter fnic_dev_packet_filter
...@@ -128,6 +129,7 @@ int vnic_dev_fw_info(struct vnic_dev *vdev, ...@@ -128,6 +129,7 @@ int vnic_dev_fw_info(struct vnic_dev *vdev,
int vnic_dev_spec(struct vnic_dev *vdev, unsigned int offset, int vnic_dev_spec(struct vnic_dev *vdev, unsigned int offset,
unsigned int size, void *value); unsigned int size, void *value);
int vnic_dev_stats_clear(struct vnic_dev *vdev); int vnic_dev_stats_clear(struct vnic_dev *vdev);
int vnic_dev_cmd_init(struct vnic_dev *vdev);
int vnic_dev_stats_dump(struct vnic_dev *vdev, struct vnic_stats **stats); int vnic_dev_stats_dump(struct vnic_dev *vdev, struct vnic_stats **stats);
int vnic_dev_hang_notify(struct vnic_dev *vdev); int vnic_dev_hang_notify(struct vnic_dev *vdev);
void vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast, void vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast,
......
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