netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Allen <jallen@linux.vnet.ibm.com>
To: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>, netdev@vger.kernel.org
Cc: nfont@linux.vnet.ibm.com
Subject: Re: [PATCH net] ibmvnic: Fix pending MAC address changes
Date: Mon, 15 Jan 2018 08:58:07 -0600	[thread overview]
Message-ID: <2afba9f6-3408-4c3f-73bf-2a83a2f9e7bd@linux.vnet.ibm.com> (raw)
In-Reply-To: <1515634792-27699-1-git-send-email-tlfalcon@linux.vnet.ibm.com>

On 01/10/2018 07:39 PM, Thomas Falcon wrote:
> Due to architecture limitations, the IBM VNIC client driver is unable
> to perform MAC address changes unless the device has "logged in" to
> its backing device. Currently, pending MAC changes are handled before
> login, resulting in an error and failure to change the MAC address.
> Moving that chunk to the end of the ibmvnic_login function, when we are
> sure that it was successful, fixes that.
> 
> The MAC address can be changed when the device is up or down, so
> only check if the device is in a "PROBED" state before setting the
> MAC address.
> 
> Fixes: c26eba03e407 ("ibmvnic: Update reset infrastructure to support tunable parameters")
> Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
> ---

Reviewed-by: John Allen <jallen@linux.vnet.ibm.com>

>  drivers/net/ethernet/ibm/ibmvnic.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
> index 6911b7c..b676fa9 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.c
> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> @@ -757,6 +757,12 @@ static int ibmvnic_login(struct net_device *netdev)
>  		}
>  	} while (adapter->renegotiate);
> 
> +	/* handle pending MAC address changes after successful login */
> +	if (adapter->mac_change_pending) {
> +		__ibmvnic_set_mac(netdev, &adapter->desired.mac);
> +		adapter->mac_change_pending = false;
> +	}
> +
>  	return 0;
>  }
> 
> @@ -994,11 +1000,6 @@ static int ibmvnic_open(struct net_device *netdev)
> 
>  	mutex_lock(&adapter->reset_lock);
> 
> -	if (adapter->mac_change_pending) {
> -		__ibmvnic_set_mac(netdev, &adapter->desired.mac);
> -		adapter->mac_change_pending = false;
> -	}
> -
>  	if (adapter->state != VNIC_CLOSED) {
>  		rc = ibmvnic_login(netdev);
>  		if (rc) {
> @@ -1532,7 +1533,7 @@ static int ibmvnic_set_mac(struct net_device *netdev, void *p)
>  	struct ibmvnic_adapter *adapter = netdev_priv(netdev);
>  	struct sockaddr *addr = p;
> 
> -	if (adapter->state != VNIC_OPEN) {
> +	if (adapter->state == VNIC_PROBED) {
>  		memcpy(&adapter->desired.mac, addr, sizeof(struct sockaddr));
>  		adapter->mac_change_pending = true;
>  		return 0;
> 

  reply	other threads:[~2018-01-15 14:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-11  1:39 [PATCH net] ibmvnic: Fix pending MAC address changes Thomas Falcon
2018-01-15 14:58 ` John Allen [this message]
2018-01-16 16:26 ` 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=2afba9f6-3408-4c3f-73bf-2a83a2f9e7bd@linux.vnet.ibm.com \
    --to=jallen@linux.vnet.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=nfont@linux.vnet.ibm.com \
    --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).