Skip to content

Commit

Permalink
Merge branch '5.17/scsi-fixes' into 5.18/scsi-staging
Browse files Browse the repository at this point in the history
Pull 5.17 fixes branch into 5.18 tree to resolve a few pm8001 driver
merge conflicts.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Martin K. Petersen committed Feb 15, 2022
2 parents 22754f7 + 5852ed2 commit ac2beb4
Show file tree
Hide file tree
Showing 24 changed files with 161 additions and 120 deletions.
13 changes: 12 additions & 1 deletion drivers/s390/scsi/zfcp_fc.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,8 @@ static void zfcp_fc_adisc_handler(void *data)
goto out;
}

/* re-init to undo drop from zfcp_fc_adisc() */
port->d_id = ntoh24(adisc_resp->adisc_port_id);
/* port is good, unblock rport without going through erp */
zfcp_scsi_schedule_rport_register(port);
out:
Expand All @@ -534,6 +536,7 @@ static int zfcp_fc_adisc(struct zfcp_port *port)
struct zfcp_fc_req *fc_req;
struct zfcp_adapter *adapter = port->adapter;
struct Scsi_Host *shost = adapter->scsi_host;
u32 d_id;
int ret;

fc_req = kmem_cache_zalloc(zfcp_fc_req_cache, GFP_ATOMIC);
Expand All @@ -558,7 +561,15 @@ static int zfcp_fc_adisc(struct zfcp_port *port)
fc_req->u.adisc.req.adisc_cmd = ELS_ADISC;
hton24(fc_req->u.adisc.req.adisc_port_id, fc_host_port_id(shost));

ret = zfcp_fsf_send_els(adapter, port->d_id, &fc_req->ct_els,
d_id = port->d_id; /* remember as destination for send els below */
/*
* Force fresh GID_PN lookup on next port recovery.
* Must happen after request setup and before sending request,
* to prevent race with port->d_id re-init in zfcp_fc_adisc_handler().
*/
port->d_id = 0;

ret = zfcp_fsf_send_els(adapter, d_id, &fc_req->ct_els,
ZFCP_FC_CTELS_TMO);
if (ret)
kmem_cache_free(zfcp_fc_req_cache, fc_req);
Expand Down
4 changes: 0 additions & 4 deletions drivers/scsi/3w-sas.c
Original file line number Diff line number Diff line change
Expand Up @@ -1567,8 +1567,6 @@ static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
pci_try_set_mwi(pdev);

retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
if (retval)
retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (retval) {
TW_PRINTK(host, TW_DRIVER, 0x18, "Failed to set dma mask");
retval = -ENODEV;
Expand Down Expand Up @@ -1786,8 +1784,6 @@ static int __maybe_unused twl_resume(struct device *dev)
pci_try_set_mwi(pdev);

retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
if (retval)
retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (retval) {
TW_PRINTK(host, TW_DRIVER, 0x25, "Failed to set dma mask during resume");
retval = -ENODEV;
Expand Down
1 change: 0 additions & 1 deletion drivers/scsi/53c700.c
Original file line number Diff line number Diff line change
Expand Up @@ -1507,7 +1507,6 @@ NCR_700_intr(int irq, void *dev_id)
struct scsi_cmnd *SCp = hostdata->cmd;

handled = 1;
SCp = hostdata->cmd;

if(istat & SCSI_INT_PENDING) {
udelay(10);
Expand Down
6 changes: 0 additions & 6 deletions drivers/scsi/bfa/bfad.c
Original file line number Diff line number Diff line change
Expand Up @@ -732,9 +732,6 @@ bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad)
pci_set_master(pdev);

rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
if (rc)
rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));

if (rc) {
rc = -ENODEV;
printk(KERN_ERR "dma_set_mask_and_coherent fail %p\n", pdev);
Expand Down Expand Up @@ -1559,9 +1556,6 @@ bfad_pci_slot_reset(struct pci_dev *pdev)
pci_set_master(pdev);

rc = dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(64));
if (rc)
rc = dma_set_mask_and_coherent(&bfad->pcidev->dev,
DMA_BIT_MASK(32));
if (rc)
goto out_disable_device;

Expand Down
41 changes: 18 additions & 23 deletions drivers/scsi/bnx2fc/bnx2fc_fcoe.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ static int bnx2fc_bind_pcidev(struct bnx2fc_hba *hba);
static void bnx2fc_unbind_pcidev(struct bnx2fc_hba *hba);
static struct fc_lport *bnx2fc_if_create(struct bnx2fc_interface *interface,
struct device *parent, int npiv);
static void bnx2fc_destroy_work(struct work_struct *work);
static void bnx2fc_port_destroy(struct fcoe_port *port);

static struct bnx2fc_hba *bnx2fc_hba_lookup(struct net_device *phys_dev);
static struct bnx2fc_interface *bnx2fc_interface_lookup(struct net_device
Expand Down Expand Up @@ -508,7 +508,8 @@ static int bnx2fc_l2_rcv_thread(void *arg)

static void bnx2fc_recv_frame(struct sk_buff *skb)
{
u32 fr_len;
u64 crc_err;
u32 fr_len, fr_crc;
struct fc_lport *lport;
struct fcoe_rcv_info *fr;
struct fc_stats *stats;
Expand Down Expand Up @@ -542,6 +543,11 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
skb_pull(skb, sizeof(struct fcoe_hdr));
fr_len = skb->len - sizeof(struct fcoe_crc_eof);

stats = per_cpu_ptr(lport->stats, get_cpu());
stats->RxFrames++;
stats->RxWords += fr_len / FCOE_WORD_TO_BYTE;
put_cpu();

fp = (struct fc_frame *)skb;
fc_frame_init(fp);
fr_dev(fp) = lport;
Expand Down Expand Up @@ -624,16 +630,15 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
return;
}

stats = per_cpu_ptr(lport->stats, smp_processor_id());
stats->RxFrames++;
stats->RxWords += fr_len / FCOE_WORD_TO_BYTE;
fr_crc = le32_to_cpu(fr_crc(fp));

if (le32_to_cpu(fr_crc(fp)) !=
~crc32(~0, skb->data, fr_len)) {
if (stats->InvalidCRCCount < 5)
if (unlikely(fr_crc != ~crc32(~0, skb->data, fr_len))) {
stats = per_cpu_ptr(lport->stats, get_cpu());
crc_err = (stats->InvalidCRCCount++);
put_cpu();
if (crc_err < 5)
printk(KERN_WARNING PFX "dropping frame with "
"CRC error\n");
stats->InvalidCRCCount++;
kfree_skb(skb);
return;
}
Expand Down Expand Up @@ -907,9 +912,6 @@ static void bnx2fc_indicate_netevent(void *context, unsigned long event,
__bnx2fc_destroy(interface);
}
mutex_unlock(&bnx2fc_dev_lock);

/* Ensure ALL destroy work has been completed before return */
flush_workqueue(bnx2fc_wq);
return;

default:
Expand Down Expand Up @@ -1215,8 +1217,8 @@ static int bnx2fc_vport_destroy(struct fc_vport *vport)
mutex_unlock(&n_port->lp_mutex);
bnx2fc_free_vport(interface->hba, port->lport);
bnx2fc_port_shutdown(port->lport);
bnx2fc_port_destroy(port);
bnx2fc_interface_put(interface);
queue_work(bnx2fc_wq, &port->destroy_work);
return 0;
}

Expand Down Expand Up @@ -1525,7 +1527,6 @@ static struct fc_lport *bnx2fc_if_create(struct bnx2fc_interface *interface,
port->lport = lport;
port->priv = interface;
port->get_netdev = bnx2fc_netdev;
INIT_WORK(&port->destroy_work, bnx2fc_destroy_work);

/* Configure fcoe_port */
rc = bnx2fc_lport_config(lport);
Expand Down Expand Up @@ -1653,8 +1654,8 @@ static void __bnx2fc_destroy(struct bnx2fc_interface *interface)
bnx2fc_interface_cleanup(interface);
bnx2fc_stop(interface);
list_del(&interface->list);
bnx2fc_port_destroy(port);
bnx2fc_interface_put(interface);
queue_work(bnx2fc_wq, &port->destroy_work);
}

/**
Expand Down Expand Up @@ -1694,15 +1695,12 @@ static int bnx2fc_destroy(struct net_device *netdev)
return rc;
}

static void bnx2fc_destroy_work(struct work_struct *work)
static void bnx2fc_port_destroy(struct fcoe_port *port)
{
struct fcoe_port *port;
struct fc_lport *lport;

port = container_of(work, struct fcoe_port, destroy_work);
lport = port->lport;

BNX2FC_HBA_DBG(lport, "Entered bnx2fc_destroy_work\n");
BNX2FC_HBA_DBG(lport, "Entered %s, destroying lport %p\n", __func__, lport);

bnx2fc_if_destroy(lport);
}
Expand Down Expand Up @@ -2556,9 +2554,6 @@ static void bnx2fc_ulp_exit(struct cnic_dev *dev)
__bnx2fc_destroy(interface);
mutex_unlock(&bnx2fc_dev_lock);

/* Ensure ALL destroy work has been completed before return */
flush_workqueue(bnx2fc_wq);

bnx2fc_ulp_stop(hba);
/* unregister cnic device */
if (test_and_clear_bit(BNX2FC_CNIC_REGISTERED, &hba->reg_with_cnic))
Expand Down
8 changes: 2 additions & 6 deletions drivers/scsi/elx/libefc/efc_els.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,14 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen)

efc = node->efc;

spin_lock_irqsave(&node->els_ios_lock, flags);

if (!node->els_io_enabled) {
efc_log_err(efc, "els io alloc disabled\n");
spin_unlock_irqrestore(&node->els_ios_lock, flags);
return NULL;
}

els = mempool_alloc(efc->els_io_pool, GFP_ATOMIC);
if (!els) {
atomic_add_return(1, &efc->els_io_alloc_failed_count);
spin_unlock_irqrestore(&node->els_ios_lock, flags);
return NULL;
}

Expand All @@ -74,7 +70,6 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen)
&els->io.req.phys, GFP_KERNEL);
if (!els->io.req.virt) {
mempool_free(els, efc->els_io_pool);
spin_unlock_irqrestore(&node->els_ios_lock, flags);
return NULL;
}

Expand All @@ -94,10 +89,11 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen)

/* add els structure to ELS IO list */
INIT_LIST_HEAD(&els->list_entry);
spin_lock_irqsave(&node->els_ios_lock, flags);
list_add_tail(&els->list_entry, &node->els_ios_list);
spin_unlock_irqrestore(&node->els_ios_lock, flags);
}

spin_unlock_irqrestore(&node->els_ios_lock, flags);
return els;
}

Expand Down
17 changes: 6 additions & 11 deletions drivers/scsi/hisi_sas/hisi_sas_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,7 @@ void hisi_sas_task_deliver(struct hisi_hba *hisi_hba,
struct hisi_sas_slot *slot,
struct hisi_sas_dq *dq,
struct hisi_sas_device *sas_dev,
struct hisi_sas_internal_abort *abort,
struct hisi_sas_tmf_task *tmf)
struct hisi_sas_internal_abort *abort)
{
struct hisi_sas_cmd_hdr *cmd_hdr_base;
int dlvry_queue_slot, dlvry_queue;
Expand All @@ -426,8 +425,6 @@ void hisi_sas_task_deliver(struct hisi_hba *hisi_hba,
cmd_hdr_base = hisi_hba->cmd_hdr[dlvry_queue];
slot->cmd_hdr = &cmd_hdr_base[dlvry_queue_slot];

slot->tmf = tmf;
slot->is_internal = tmf;
task->lldd_task = slot;

memset(slot->cmd_hdr, 0, sizeof(struct hisi_sas_cmd_hdr));
Expand Down Expand Up @@ -582,7 +579,7 @@ static int hisi_sas_task_exec(struct sas_task *task, gfp_t gfp_flags,
slot->is_internal = tmf;

/* protect task_prep and start_delivery sequence */
hisi_sas_task_deliver(hisi_hba, slot, dq, sas_dev, NULL, tmf);
hisi_sas_task_deliver(hisi_hba, slot, dq, sas_dev, NULL);

return 0;

Expand Down Expand Up @@ -1374,12 +1371,13 @@ static int hisi_sas_softreset_ata_disk(struct domain_device *device)
struct hisi_hba *hisi_hba = dev_to_hisi_hba(device);
struct device *dev = hisi_hba->dev;
int s = sizeof(struct host_to_dev_fis);
struct hisi_sas_tmf_task tmf = {};

ata_for_each_link(link, ap, EDGE) {
int pmp = sata_srst_pmp(link);

hisi_sas_fill_ata_reset_cmd(link->device, 1, pmp, fis);
rc = hisi_sas_exec_internal_tmf_task(device, fis, s, NULL);
rc = hisi_sas_exec_internal_tmf_task(device, fis, s, &tmf);
if (rc != TMF_RESP_FUNC_COMPLETE)
break;
}
Expand All @@ -1390,7 +1388,7 @@ static int hisi_sas_softreset_ata_disk(struct domain_device *device)

hisi_sas_fill_ata_reset_cmd(link->device, 0, pmp, fis);
rc = hisi_sas_exec_internal_tmf_task(device, fis,
s, NULL);
s, &tmf);
if (rc != TMF_RESP_FUNC_COMPLETE)
dev_err(dev, "ata disk %016llx de-reset failed\n",
SAS_ADDR(device->sas_addr));
Expand Down Expand Up @@ -2061,7 +2059,7 @@ hisi_sas_internal_abort_task_exec(struct hisi_hba *hisi_hba, int device_id,
slot->port = port;
slot->is_internal = true;

hisi_sas_task_deliver(hisi_hba, slot, dq, sas_dev, abort, NULL);
hisi_sas_task_deliver(hisi_hba, slot, dq, sas_dev, abort);

return 0;

Expand Down Expand Up @@ -2660,9 +2658,6 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev,
goto err_out;

error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
if (error)
error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));

if (error) {
dev_err(dev, "No usable DMA addressing method\n");
goto err_out;
Expand Down
2 changes: 0 additions & 2 deletions drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -4694,8 +4694,6 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)
goto err_out;

rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
if (rc)
rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (rc) {
dev_err(dev, "No usable DMA addressing method\n");
rc = -ENODEV;
Expand Down
13 changes: 10 additions & 3 deletions drivers/scsi/lpfc/lpfc.h
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,16 @@ struct lpfc_hba {
uint32_t cfg_hostmem_hgp;
uint32_t cfg_log_verbose;
uint32_t cfg_enable_fc4_type;
#define LPFC_ENABLE_FCP 1
#define LPFC_ENABLE_NVME 2
#define LPFC_ENABLE_BOTH 3
#if (IS_ENABLED(CONFIG_NVME_FC))
#define LPFC_MAX_ENBL_FC4_TYPE LPFC_ENABLE_BOTH
#define LPFC_DEF_ENBL_FC4_TYPE LPFC_ENABLE_BOTH
#else
#define LPFC_MAX_ENBL_FC4_TYPE LPFC_ENABLE_FCP
#define LPFC_DEF_ENBL_FC4_TYPE LPFC_ENABLE_FCP
#endif
uint32_t cfg_aer_support;
uint32_t cfg_sriov_nr_virtfn;
uint32_t cfg_request_firmware_upgrade;
Expand All @@ -1182,9 +1192,6 @@ struct lpfc_hba {
uint32_t cfg_ras_fwlog_func;
uint32_t cfg_enable_bbcr; /* Enable BB Credit Recovery */
uint32_t cfg_enable_dpp; /* Enable Direct Packet Push */
#define LPFC_ENABLE_FCP 1
#define LPFC_ENABLE_NVME 2
#define LPFC_ENABLE_BOTH 3
uint32_t cfg_enable_pbde;
uint32_t cfg_enable_mi;
struct nvmet_fc_target_port *targetport;
Expand Down
4 changes: 2 additions & 2 deletions drivers/scsi/lpfc/lpfc_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -3978,8 +3978,8 @@ LPFC_ATTR_R(nvmet_mrq_post,
* 3 - register both FCP and NVME
* Supported values are [1,3]. Default value is 3
*/
LPFC_ATTR_R(enable_fc4_type, LPFC_ENABLE_BOTH,
LPFC_ENABLE_FCP, LPFC_ENABLE_BOTH,
LPFC_ATTR_R(enable_fc4_type, LPFC_DEF_ENBL_FC4_TYPE,
LPFC_ENABLE_FCP, LPFC_MAX_ENBL_FC4_TYPE,
"Enable FC4 Protocol support - FCP / NVME");

/*
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/lpfc/lpfc_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -2104,7 +2104,7 @@ lpfc_handle_eratt_s4(struct lpfc_hba *phba)
}
if (reg_err1 == SLIPORT_ERR1_REG_ERR_CODE_2 &&
reg_err2 == SLIPORT_ERR2_REG_FW_RESTART) {
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
"3143 Port Down: Firmware Update "
"Detected\n");
en_rn_msg = false;
Expand Down
8 changes: 7 additions & 1 deletion drivers/scsi/lpfc/lpfc_sli.c
Original file line number Diff line number Diff line change
Expand Up @@ -13363,6 +13363,7 @@ lpfc_sli4_eratt_read(struct lpfc_hba *phba)
uint32_t uerr_sta_hi, uerr_sta_lo;
uint32_t if_type, portsmphr;
struct lpfc_register portstat_reg;
u32 logmask;

/*
* For now, use the SLI4 device internal unrecoverable error
Expand Down Expand Up @@ -13413,7 +13414,12 @@ lpfc_sli4_eratt_read(struct lpfc_hba *phba)
readl(phba->sli4_hba.u.if_type2.ERR1regaddr);
phba->work_status[1] =
readl(phba->sli4_hba.u.if_type2.ERR2regaddr);
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
logmask = LOG_TRACE_EVENT;
if (phba->work_status[0] ==
SLIPORT_ERR1_REG_ERR_CODE_2 &&
phba->work_status[1] == SLIPORT_ERR2_REG_FW_RESTART)
logmask = LOG_SLI;
lpfc_printf_log(phba, KERN_ERR, logmask,
"2885 Port Status Event: "
"port status reg 0x%x, "
"port smphr reg 0x%x, "
Expand Down
3 changes: 2 additions & 1 deletion drivers/scsi/myrs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2267,7 +2267,8 @@ static void myrs_cleanup(struct myrs_hba *cs)
myrs_unmap(cs);

if (cs->mmio_base) {
cs->disable_intr(cs);
if (cs->disable_intr)
cs->disable_intr(cs);
iounmap(cs->mmio_base);
cs->mmio_base = NULL;
}
Expand Down
Loading

0 comments on commit ac2beb4

Please sign in to comment.