netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nathan Fontenot <nfont@linux.vnet.ibm.com>
To: John Allen <jallen@linux.vnet.ibm.com>, netdev@vger.kernel.org
Cc: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
Subject: Re: [PATCH net v2 3/3] ibmvnic: Allocate and request vpd in init_resources
Date: Fri, 19 Jan 2018 13:24:29 -0600	[thread overview]
Message-ID: <8ddf6b5c-c1dd-d52f-adf2-f26ff6ae2f10@linux.vnet.ibm.com> (raw)
In-Reply-To: <0a4000cd-dc0a-fe1c-0512-e0e74a9ef60b@linux.vnet.ibm.com>

On 01/18/2018 04:27 PM, John Allen wrote:
> In reset events in which our memory allocations need to be reallocated,
> VPD data is being freed, but never reallocated. This can cause issues if
> we later attempt to access that memory or reset and attempt to free the
> memory. This patch moves the allocation of the VPD data to init_resources
> so that it will be symmetrically freed during release resources.
> 
> Signed-off-by: John Allen <jallen@linux.vnet.ibm.com>

Reviewed-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>

> ---
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
> index bb56460..f0dbb76 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.c
> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> @@ -867,7 +867,7 @@ static int ibmvnic_get_vpd(struct ibmvnic_adapter *adapter)
>  	if (adapter->vpd->buff)
>  		len = adapter->vpd->len;
> 
> -	reinit_completion(&adapter->fw_done);
> +	init_completion(&adapter->fw_done);
>  	crq.get_vpd_size.first = IBMVNIC_CRQ_CMD;
>  	crq.get_vpd_size.cmd = GET_VPD_SIZE;
>  	ibmvnic_send_crq(adapter, &crq);
> @@ -929,6 +929,13 @@ static int init_resources(struct ibmvnic_adapter *adapter)
>  	if (!adapter->vpd)
>  		return -ENOMEM;
> 
> +	/* Vital Product Data (VPD) */
> +	rc = ibmvnic_get_vpd(adapter);
> +	if (rc) {
> +		netdev_err(netdev, "failed to initialize Vital Product Data (VPD)\n");
> +		return rc;
> +	}
> +
>  	adapter->map_id = 1;
>  	adapter->napi = kcalloc(adapter->req_rx_queues,
>  				sizeof(struct napi_struct), GFP_KERNEL);
> @@ -1002,7 +1009,7 @@ static int __ibmvnic_open(struct net_device *netdev)
>  static int ibmvnic_open(struct net_device *netdev)
>  {
>  	struct ibmvnic_adapter *adapter = netdev_priv(netdev);
> -	int rc, vpd;
> +	int rc;
> 
>  	mutex_lock(&adapter->reset_lock);
> 
> @@ -1030,11 +1037,6 @@ static int ibmvnic_open(struct net_device *netdev)
>  	rc = __ibmvnic_open(netdev);
>  	netif_carrier_on(netdev);
> 
> -	/* Vital Product Data (VPD) */
> -	vpd = ibmvnic_get_vpd(adapter);
> -	if (vpd)
> -		netdev_err(netdev, "failed to initialize Vital Product Data (VPD)\n");
> -
>  	mutex_unlock(&adapter->reset_lock);
> 
>  	return rc;
> 

  reply	other threads:[~2018-01-19 19:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-18 22:25 [PATCH net v2 0/3] ibmvnic: Reset behavior fixes John Allen
2018-01-18 22:26 ` [PATCH net v2 1/3] ibmvnic: Modify buffer size and number of queues on failover John Allen
2018-01-19 19:22   ` Nathan Fontenot
2018-01-18 22:27 ` [PATCH net v2 2/3] ibmvnic: Revert to previous mtu when unsupported value requested John Allen
2018-01-19 19:23   ` Nathan Fontenot
2018-01-18 22:27 ` [PATCH net v2 3/3] ibmvnic: Allocate and request vpd in init_resources John Allen
2018-01-19 19:24   ` Nathan Fontenot [this message]
2018-01-22 20:47 ` [PATCH net v2 0/3] ibmvnic: Reset behavior fixes David Miller

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=8ddf6b5c-c1dd-d52f-adf2-f26ff6ae2f10@linux.vnet.ibm.com \
    --to=nfont@linux.vnet.ibm.com \
    --cc=jallen@linux.vnet.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=tlfalcon@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).