From: Tyrel Datwyler <tyreld@linux.ibm.com>
To: Brian King <brking@linux.vnet.ibm.com>,
james.bottomley@hansenpartnership.com
Cc: martin.petersen@oracle.com, linux-scsi@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
brking@linux.ibm.com
Subject: Re: [PATCH 09/13] ibmvfc: implement channel enquiry and setup commands
Date: Mon, 30 Nov 2020 09:29:15 -0800 [thread overview]
Message-ID: <c2f01390-8977-dee7-8f33-fe1ebb2b73b7@linux.ibm.com> (raw)
In-Reply-To: <5f873855-fdc2-4da4-a516-4db7b5236a48@linux.vnet.ibm.com>
On 11/27/20 9:49 AM, Brian King wrote:
> On 11/25/20 7:48 PM, Tyrel Datwyler wrote:
>> --- a/drivers/scsi/ibmvscsi/ibmvfc.c
>> +++ b/drivers/scsi/ibmvscsi/ibmvfc.c
>
>> @@ -4462,6 +4464,118 @@ static void ibmvfc_discover_targets(struct ibmvfc_host *vhost)
>> ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD);
>> }
>>
>> +static void ibmvfc_channel_setup_done(struct ibmvfc_event *evt)
>> +{
>> + struct ibmvfc_host *vhost = evt->vhost;
>> + u32 mad_status = be16_to_cpu(evt->xfer_iu->channel_setup.common.status);
>> + int level = IBMVFC_DEFAULT_LOG_LEVEL;
>> +
>> + ibmvfc_free_event(evt);
>> +
>> + switch (mad_status) {
>> + case IBMVFC_MAD_SUCCESS:
>> + ibmvfc_dbg(vhost, "Channel Setup succeded\n");
>> + vhost->do_enquiry = 0;
>> + break;
>> + case IBMVFC_MAD_FAILED:
>> + level += ibmvfc_retry_host_init(vhost);
>> + ibmvfc_log(vhost, level, "Channel Setup failed\n");
>> + fallthrough;
>> + case IBMVFC_MAD_DRIVER_FAILED:
>> + return;
>> + default:
>> + dev_err(vhost->dev, "Invalid Channel Setup response: 0x%x\n",
>> + mad_status);
>> + ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD);
>> + return;
>> + }
>> +
>> + ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_QUERY);
>> + wake_up(&vhost->work_wait_q);
>> +}
>> +
>> +static void ibmvfc_channel_setup(struct ibmvfc_host *vhost)
>> +{
>> + struct ibmvfc_channel_setup_mad *mad;
>> + struct ibmvfc_channel_setup *setup_buf = vhost->channel_setup_buf;
>> + struct ibmvfc_event *evt = ibmvfc_get_event(vhost);
>> +
>> + memset(setup_buf, 0, sizeof(*setup_buf));
>> + setup_buf->flags = cpu_to_be32(IBMVFC_CANCEL_CHANNELS);
>> +
>> + ibmvfc_init_event(evt, ibmvfc_channel_setup_done, IBMVFC_MAD_FORMAT);
>> + mad = &evt->iu.channel_setup;
>> + memset(mad, 0, sizeof(*mad));
>> + mad->common.version = cpu_to_be32(1);
>> + mad->common.opcode = cpu_to_be32(IBMVFC_CHANNEL_SETUP);
>> + mad->common.length = cpu_to_be16(sizeof(*mad));
>> + mad->buffer.va = cpu_to_be64(vhost->channel_setup_dma);
>> + mad->buffer.len = cpu_to_be32(sizeof(*vhost->channel_setup_buf));
>> +
>> + ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_INIT_WAIT);
>> +
>> + if (!ibmvfc_send_event(evt, vhost, default_timeout))
>> + ibmvfc_dbg(vhost, "Sent channel setup\n");
>> + else
>> + ibmvfc_link_down(vhost, IBMVFC_LINK_DOWN);
>> +}
>> +
>> +static void ibmvfc_channel_enquiry_done(struct ibmvfc_event *evt)
>> +{
>> + struct ibmvfc_host *vhost = evt->vhost;
>> + struct ibmvfc_channel_enquiry *rsp = &evt->xfer_iu->channel_enquiry;
>> + u32 mad_status = be16_to_cpu(rsp->common.status);
>> + int level = IBMVFC_DEFAULT_LOG_LEVEL;
>> +
>> + switch (mad_status) {
>> + case IBMVFC_MAD_SUCCESS:
>> + ibmvfc_dbg(vhost, "Channel Enquiry succeeded\n");
>> + vhost->max_vios_scsi_channels = be32_to_cpu(rsp->num_scsi_subq_channels);
>
> You need a ibmvfc_free_event(evt) here so you don't leak events.
>
Indeed
>> + break;
>> + case IBMVFC_MAD_FAILED:
>> + level += ibmvfc_retry_host_init(vhost);
>> + ibmvfc_log(vhost, level, "Channel Enquiry failed\n");
>> + ibmvfc_free_event(evt);
>
> Looks like you are freeing this event twice due to the fallthrough...
Good catch
>
>> + fallthrough;
>> + case IBMVFC_MAD_DRIVER_FAILED:
>> + ibmvfc_free_event(evt);
>> + return;
>> + default:
>> + dev_err(vhost->dev, "Invalid Channel Enquiry response: 0x%x\n",
>> + mad_status);
>> + ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD);
>> + ibmvfc_free_event(evt);
>> + return;
>> + }
>> +
>> + ibmvfc_channel_setup(vhost);
>> +}
>> +
>
>
>
next prev parent reply other threads:[~2020-11-30 17:30 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-26 1:48 [PATCH 00/13] ibmvfc: initial MQ development Tyrel Datwyler
2020-11-26 1:48 ` [PATCH 01/13] ibmvfc: add vhost fields and defaults for MQ enablement Tyrel Datwyler
2020-11-27 17:45 ` Brian King
2020-11-30 17:22 ` Tyrel Datwyler
2020-11-26 1:48 ` [PATCH 02/13] ibmvfc: define hcall wrapper for registering a Sub-CRQ Tyrel Datwyler
2020-11-27 17:45 ` Brian King
2020-11-26 1:48 ` [PATCH 03/13] ibmvfc: add Subordinate CRQ definitions Tyrel Datwyler
2020-11-27 17:46 ` Brian King
2020-11-26 1:48 ` [PATCH 04/13] ibmvfc: add alloc/dealloc routines for SCSI Sub-CRQ Channels Tyrel Datwyler
2020-11-27 17:46 ` Brian King
2020-11-30 17:26 ` Tyrel Datwyler
2020-11-26 1:48 ` [PATCH 05/13] ibmvfc: add Sub-CRQ IRQ enable/disable routine Tyrel Datwyler
2020-11-27 17:47 ` Brian King
2020-11-26 1:48 ` [PATCH 06/13] ibmvfc: add handlers to drain and complete Sub-CRQ responses Tyrel Datwyler
2020-11-27 17:47 ` Brian King
2020-11-30 17:27 ` Tyrel Datwyler
2020-11-26 1:48 ` [PATCH 07/13] ibmvfc: define Sub-CRQ interrupt handler routine Tyrel Datwyler
2020-11-27 17:48 ` Brian King
2020-11-26 1:48 ` [PATCH 08/13] ibmvfc: map/request irq and register Sub-CRQ interrupt handler Tyrel Datwyler
2020-11-27 17:48 ` Brian King
2020-11-26 1:48 ` [PATCH 09/13] ibmvfc: implement channel enquiry and setup commands Tyrel Datwyler
2020-11-27 17:49 ` Brian King
2020-11-30 17:29 ` Tyrel Datwyler [this message]
2020-11-26 1:48 ` [PATCH 10/13] ibmvfc: advertise client support for using hardware channels Tyrel Datwyler
2020-11-27 17:49 ` Brian King
2020-11-26 1:48 ` [PATCH 11/13] ibmvfc: set and track hw queue in ibmvfc_event struct Tyrel Datwyler
2020-11-27 17:50 ` Brian King
2020-11-26 1:48 ` [PATCH 12/13] ibmvfc: send commands down HW Sub-CRQ when channelized Tyrel Datwyler
2020-11-27 17:50 ` Brian King
2020-11-26 1:48 ` [PATCH 13/13] ibmvfc: register Sub-CRQ handles with VIOS during channel setup Tyrel Datwyler
2020-11-27 17:50 ` Brian King
2020-12-02 12:03 ` [PATCH 00/13] ibmvfc: initial MQ development Hannes Reinecke
2020-12-02 17:19 ` Tyrel Datwyler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c2f01390-8977-dee7-8f33-fe1ebb2b73b7@linux.ibm.com \
--to=tyreld@linux.ibm.com \
--cc=brking@linux.ibm.com \
--cc=brking@linux.vnet.ibm.com \
--cc=james.bottomley@hansenpartnership.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox