From: Veaceslav Falico <vfalico@redhat.com>
To: nikolay@redhat.com
Cc: netdev@vger.kernel.org, fubar@us.ibm.com, andy@greyhouse.net,
davem@davemloft.net
Subject: Re: [net-next, 2/3] bonding: change the bond's vlan syncing functions with the standard ones
Date: Mon, 5 Aug 2013 23:56:39 +0200 [thread overview]
Message-ID: <20130805215639.GA14280@redhat.com> (raw)
In-Reply-To: <1375709304-16778-3-git-send-email-nikolay@redhat.com>
On Mon, Aug 05, 2013 at 03:28:23PM +0200, nikolay@redhat.com wrote:
>From: Nikolay Aleksandrov <Nikolay Aleksandrov nikolay@redhat.com>
>
>Now we have vlan_vids_add/del_by_dev() which serve the same purpose as
>bond's bond_add/del_vlans_on_slave() with the good side effect of
>reverting the changes if one of the additions fails.
>
>Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
>
>---
>drivers/net/bonding/bond_main.c | 35 +++++------------------------------
> 1 file changed, 5 insertions(+), 30 deletions(-)
-25, awesome, great one :)
Acked-by: Veaceslav Falico <vfalico@redhat.com>
>
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index 5df8bcd..ed1d261 100644
>--- a/drivers/net/bonding/bond_main.c
>+++ b/drivers/net/bonding/bond_main.c
>@@ -521,33 +521,6 @@ static int bond_vlan_rx_kill_vid(struct net_device *bond_dev,
> return __bond_vlan_rx_kill_vid(bond_dev, proto, vid);
> }
>
>-static void bond_add_vlans_on_slave(struct bonding *bond, struct net_device *slave_dev)
>-{
>- struct vlan_entry *vlan;
>- int res;
>-
>- list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
>- res = vlan_vid_add(slave_dev, htons(ETH_P_8021Q),
>- vlan->vlan_id);
>- if (res)
>- pr_warning("%s: Failed to add vlan id %d to device %s\n",
>- bond->dev->name, vlan->vlan_id,
>- slave_dev->name);
>- }
>-}
>-
>-static void bond_del_vlans_from_slave(struct bonding *bond,
>- struct net_device *slave_dev)
>-{
>- struct vlan_entry *vlan;
>-
>- list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
>- if (!vlan->vlan_id)
>- continue;
>- vlan_vid_del(slave_dev, htons(ETH_P_8021Q), vlan->vlan_id);
>- }
>-}
>-
> /*------------------------------- Link status -------------------------------*/
>
> /*
>@@ -1656,7 +1629,9 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
> dev_mc_add(slave_dev, lacpdu_multicast);
> }
>
>- bond_add_vlans_on_slave(bond, slave_dev);
>+ if (vlan_vids_add_by_dev(slave_dev, bond_dev))
>+ pr_warn("%s: couldn't add bond vlan ids to %s",
>+ bond_dev->name, slave_dev->name);
>
> write_lock_bh(&bond->lock);
>
>@@ -1832,7 +1807,7 @@ err_detach:
> if (!USES_PRIMARY(bond->params.mode))
> bond_hw_addr_flush(bond_dev, slave_dev);
>
>- bond_del_vlans_from_slave(bond, slave_dev);
>+ vlan_vids_del_by_dev(slave_dev, bond_dev);
> write_lock_bh(&bond->lock);
> bond_detach_slave(bond, new_slave);
> if (bond->primary_slave == new_slave)
>@@ -2028,7 +2003,7 @@ static int __bond_release_one(struct net_device *bond_dev,
> /* must do this from outside any spinlocks */
> bond_destroy_slave_symlinks(bond_dev, slave_dev);
>
>- bond_del_vlans_from_slave(bond, slave_dev);
>+ vlan_vids_del_by_dev(slave_dev, bond_dev);
>
> /* If the mode USES_PRIMARY, then this cases was handled above by
> * bond_change_active_slave(..., NULL)
next prev parent reply other threads:[~2013-08-05 21:56 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-05 13:28 [PATCH net-next 0/3] bonding: vlan handling changes Nikolay Aleksandrov
2013-08-05 13:28 ` [PATCH net-next 1/3] bonding: fix vlan 0 addition and removal Nikolay Aleksandrov
2013-08-05 21:51 ` [net-next,1/3] " Veaceslav Falico
2013-08-05 23:08 ` David Miller
2013-08-06 0:37 ` Veaceslav Falico
2013-08-06 8:16 ` Nikolay Aleksandrov
2013-08-06 8:51 ` Veaceslav Falico
2013-08-06 9:01 ` Nikolay Aleksandrov
2013-08-06 8:39 ` Nikolay Aleksandrov
2013-08-06 8:59 ` Veaceslav Falico
2013-08-06 9:07 ` Nikolay Aleksandrov
2013-08-06 9:10 ` Veaceslav Falico
2013-08-05 13:28 ` [PATCH net-next 2/3] bonding: change the bond's vlan syncing functions with the standard ones Nikolay Aleksandrov
2013-08-05 21:56 ` Veaceslav Falico [this message]
2013-08-05 13:28 ` [PATCH net-next 3/3] bonding: unwind on bond_add_vlan add failure Nikolay Aleksandrov
2013-08-05 21:59 ` [net-next,3/3] " Veaceslav Falico
2013-08-05 23:09 ` 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=20130805215639.GA14280@redhat.com \
--to=vfalico@redhat.com \
--cc=andy@greyhouse.net \
--cc=davem@davemloft.net \
--cc=fubar@us.ibm.com \
--cc=netdev@vger.kernel.org \
--cc=nikolay@redhat.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).