.. | .. |
---|
31 | 31 | static void qedf_shutdown(struct pci_dev *pdev); |
---|
32 | 32 | static void qedf_schedule_recovery_handler(void *dev); |
---|
33 | 33 | static void qedf_recovery_handler(struct work_struct *work); |
---|
| 34 | +static int qedf_suspend(struct pci_dev *pdev, pm_message_t state); |
---|
34 | 35 | |
---|
35 | 36 | /* |
---|
36 | 37 | * Driver module parameters. |
---|
.. | .. |
---|
2802 | 2803 | struct qedf_ioreq *io_req; |
---|
2803 | 2804 | struct qedf_rport *fcport; |
---|
2804 | 2805 | u32 comp_type; |
---|
| 2806 | + u8 io_comp_type; |
---|
| 2807 | + unsigned long flags; |
---|
2805 | 2808 | |
---|
2806 | 2809 | comp_type = (cqe->cqe_data >> FCOE_CQE_CQE_TYPE_SHIFT) & |
---|
2807 | 2810 | FCOE_CQE_CQE_TYPE_MASK; |
---|
.. | .. |
---|
2835 | 2838 | return; |
---|
2836 | 2839 | } |
---|
2837 | 2840 | |
---|
| 2841 | + spin_lock_irqsave(&fcport->rport_lock, flags); |
---|
| 2842 | + io_comp_type = io_req->cmd_type; |
---|
| 2843 | + spin_unlock_irqrestore(&fcport->rport_lock, flags); |
---|
2838 | 2844 | |
---|
2839 | 2845 | switch (comp_type) { |
---|
2840 | 2846 | case FCOE_GOOD_COMPLETION_CQE_TYPE: |
---|
2841 | 2847 | atomic_inc(&fcport->free_sqes); |
---|
2842 | | - switch (io_req->cmd_type) { |
---|
| 2848 | + switch (io_comp_type) { |
---|
2843 | 2849 | case QEDF_SCSI_CMD: |
---|
2844 | 2850 | qedf_scsi_completion(qedf, cqe, io_req); |
---|
2845 | 2851 | break; |
---|
.. | .. |
---|
3042 | 3048 | * addresses of our queues |
---|
3043 | 3049 | */ |
---|
3044 | 3050 | if (!qedf->p_cpuq) { |
---|
3045 | | - status = -EINVAL; |
---|
3046 | 3051 | QEDF_ERR(&qedf->dbg_ctx, "p_cpuq is NULL.\n"); |
---|
3047 | | - goto mem_alloc_failure; |
---|
| 3052 | + return -EINVAL; |
---|
3048 | 3053 | } |
---|
3049 | 3054 | |
---|
3050 | 3055 | qedf->global_queues = kzalloc((sizeof(struct global_queue *) |
---|
.. | .. |
---|
3273 | 3278 | .probe = qedf_probe, |
---|
3274 | 3279 | .remove = qedf_remove, |
---|
3275 | 3280 | .shutdown = qedf_shutdown, |
---|
| 3281 | + .suspend = qedf_suspend, |
---|
3276 | 3282 | }; |
---|
3277 | 3283 | |
---|
3278 | 3284 | static int __qedf_probe(struct pci_dev *pdev, int mode) |
---|
.. | .. |
---|
3987 | 3993 | __qedf_remove(pdev, QEDF_MODE_NORMAL); |
---|
3988 | 3994 | } |
---|
3989 | 3995 | |
---|
| 3996 | +static int qedf_suspend(struct pci_dev *pdev, pm_message_t state) |
---|
| 3997 | +{ |
---|
| 3998 | + struct qedf_ctx *qedf; |
---|
| 3999 | + |
---|
| 4000 | + if (!pdev) { |
---|
| 4001 | + QEDF_ERR(NULL, "pdev is NULL.\n"); |
---|
| 4002 | + return -ENODEV; |
---|
| 4003 | + } |
---|
| 4004 | + |
---|
| 4005 | + qedf = pci_get_drvdata(pdev); |
---|
| 4006 | + |
---|
| 4007 | + QEDF_ERR(&qedf->dbg_ctx, "%s: Device does not support suspend operation\n", __func__); |
---|
| 4008 | + |
---|
| 4009 | + return -EPERM; |
---|
| 4010 | +} |
---|
| 4011 | + |
---|
3990 | 4012 | /* |
---|
3991 | 4013 | * Recovery handler code |
---|
3992 | 4014 | */ |
---|