public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Vlad Yasevich <vyasevic@redhat•com>
To: Ding Tianhong <dingtianhong@huawei•com>,
	kaber@trash•net, davem@davemloft•net, edumazet@google•com,
	makita.toshiaki@lab•ntt.co.jp
Cc: netdev@vger•kernel.org, John Fastabend <john.r.fastabend@intel•com>
Subject: Re: [PATCH net-next v2 RESEND 1/4] macvlan: support mac address changes when fwd_priv is enable
Date: Mon, 09 Jun 2014 12:51:35 -0400	[thread overview]
Message-ID: <5395E617.5080307@redhat.com> (raw)
In-Reply-To: <1402127143-6456-2-git-send-email-dingtianhong@huawei.com>

[.. CC John Fastabend <john.r.fastabend@intel•com> ]

On 06/07/2014 03:45 AM, Ding Tianhong wrote:
> If lowerdev supports L2 forwarding offload, the macvlan's hw address
> will be set to the rar of the lowerdev and no need to set uc list,
> and when the macvlan's hw address changes, the macvlan should remove
> the old fwd and rebuild a new fwd for the macvlan.
> 
> Signed-off-by: Ding Tianhong <dingtianhong@huawei•com>
> ---
>  drivers/net/macvlan.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
> index 453d55a..67485ab 100644
> --- a/drivers/net/macvlan.c
> +++ b/drivers/net/macvlan.c
> @@ -523,6 +523,27 @@ static int macvlan_sync_address(struct net_device *dev, unsigned char *addr)
>  		if (macvlan_addr_busy(vlan->port, addr))
>  			return -EBUSY;
>  
> +		if (vlan->fwd_priv) {
> +			lowerdev->netdev_ops->ndo_dfwd_del_station(lowerdev,
> +								   vlan->fwd_priv);
> +			vlan->fwd_priv = NULL;
> +			ether_addr_copy(dev->perm_addr, dev->dev_addr);
> +			ether_addr_copy(dev->dev_addr, addr);
> +			vlan->fwd_priv =
> +			    lowerdev->netdev_ops->ndo_dfwd_add_station(lowerdev,
> +								       dev);
> +			/* If we get a NULL pointer back, or if we get an error
> +			 * then we should restore the old mac address and fwd.
> +			 */
> +			if (IS_ERR_OR_NULL(vlan->fwd_priv)) {
> +				ether_addr_copy(dev->dev_addr, dev->perm_addr);
> +				vlan->fwd_priv =
> +				    lowerdev->netdev_ops->ndo_dfwd_add_station(lowerdev,
> +									       dev);
> +				return -EINVAL;
> +			}
> +			return 0;
> +		}

Calling del_stations add_station causes all sorts of VMDQ/ring
operations to happen...  Not sure if we can do that while we have a live
macvlan/macvtap that is capable of transmitting data.

Wouldn't it be sufficient to have a call to call to update with mac
filter with the appropriate VMDQ.

John, I defer to you here.  The above looks really heavy-weight and
I am not sure if its correct.

Thanks
-vlad

>  		if (!vlan->port->passthru) {
>  			err = dev_uc_add(lowerdev, addr);
>  			if (err)
> 

  reply	other threads:[~2014-06-09 16:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-07  7:45 [PATCH net-next v2 RESEND 0/4] macvlan: fix some problem if mac address changes Ding Tianhong
2014-06-07  7:45 ` [PATCH net-next v2 RESEND 1/4] macvlan: support mac address changes when fwd_priv is enable Ding Tianhong
2014-06-09 16:51   ` Vlad Yasevich [this message]
2014-06-12  1:45     ` Ding Tianhong
2014-06-12 14:24       ` Vlad Yasevich
2014-06-13  3:10         ` Ding Tianhong
2014-06-13 13:30           ` Vlad Yasevich
2014-06-14  5:01             ` Ding Tianhong
2014-06-07  7:45 ` [PATCH net-next v2 RESEND 2/4] net: dev: revert the mac address when notifier failed Ding Tianhong
2014-06-07  7:45 ` [PATCH net-next v2 RESEND 3/4] macvlan: don't set the same mac address for non-passthru mode Ding Tianhong
2014-06-07  7:45 ` [PATCH net-next v2 RESEND 4/4] net: dev: don't set the same mac address for netdev Ding Tianhong

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=5395E617.5080307@redhat.com \
    --to=vyasevic@redhat$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=dingtianhong@huawei$(echo .)com \
    --cc=edumazet@google$(echo .)com \
    --cc=john.r.fastabend@intel$(echo .)com \
    --cc=kaber@trash$(echo .)net \
    --cc=makita.toshiaki@lab$(echo .)ntt.co.jp \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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