public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Veaceslav Falico <vfalico@redhat•com>
To: Ding Tianhong <dingtianhong@huawei•com>
Cc: Jay Vosburgh <fubar@us•ibm.com>,
	"David S. Miller" <davem@davemloft•net>,
	Netdev <netdev@vger•kernel.org>
Subject: Re: [PATCH net-next 1/4] bonding: update the primary when slave name changed
Date: Thu, 9 Jan 2014 12:46:36 +0100	[thread overview]
Message-ID: <20140109114636.GF5786@redhat.com> (raw)
In-Reply-To: <52CE8604.3010804@huawei.com>

On Thu, Jan 09, 2014 at 07:20:36PM +0800, Ding Tianhong wrote:
>If the primary_slave's name changed, but the bond->prams.primay was
>still using the old name, it is conflict with the meaning of the
>primary, so update the primary when the slave change its name.

Nope, the bonding parameter, which is set by the user, shouldn't change
because of an interface name change.

>
>Signed-off-by: Ding Tianhong <dingtianhong@huawei•com>
>---
> drivers/net/bonding/bond_main.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index e06c445..de646e2 100644
>--- a/drivers/net/bonding/bond_main.c
>+++ b/drivers/net/bonding/bond_main.c
>@@ -2860,9 +2860,19 @@ static int bond_slave_netdev_event(unsigned long event,
> 		 */
> 		break;
> 	case NETDEV_CHANGENAME:
>-		/*
>-		 * TODO: handle changing the primary's name
>+		/* if the primary's name changed,
>+		 * save the new name for primary.
> 		 */
>+		if (USES_PRIMARY(bond->params.mode) &&
>+		    bond->params.primary[0]) {
>+			if (bond->primary_slave &&
>+			    strcmp(bond->params.primary,
>+				   bond->primary_slave->dev->name)) {
>+				strncpy(bond->params.primary,
>+					bond->primary_slave->dev->name,
>+					IFNAMSIZ);
>+			}
>+		}
> 		break;
> 	case NETDEV_FEAT_CHANGE:
> 		bond_compute_features(bond);
>-- 
>1.8.0
>
>

  reply	other threads:[~2014-01-09 11:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-09 11:20 [PATCH net-next 1/4] bonding: update the primary when slave name changed Ding Tianhong
2014-01-09 11:46 ` Veaceslav Falico [this message]
2014-01-09 12:23   ` Ding Tianhong
2014-01-09 12:30     ` Veaceslav Falico
2014-01-10  4:20       ` Ding Tianhong
2014-01-10  7:44         ` Veaceslav Falico
2014-01-10 11:05           ` Ding Tianhong
2014-01-10 11:11             ` Veaceslav Falico
2014-01-10 11:55               ` 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=20140109114636.GF5786@redhat.com \
    --to=vfalico@redhat$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=dingtianhong@huawei$(echo .)com \
    --cc=fubar@us$(echo .)ibm.com \
    --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