All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 net-next 0/12] bonding: add an option to rely on unvalidated arp packets
@ 2014-02-17 13:39 Veaceslav Falico
  2014-02-17 13:39 ` [PATCH v3 net-next 01/12] bonding: remove bond->lock from bond_arp_rcv Veaceslav Falico
                   ` (11 more replies)
  0 siblings, 12 replies; 16+ messages in thread
From: Veaceslav Falico @ 2014-02-17 13:39 UTC (permalink / raw)
  To: netdev
  Cc: Rob Landley, Jay Vosburgh, Andy Gospodarek, David S. Miller,
	dingtianhong, Nikolay Aleksandrov, Neil Horman, Cong Wang,
	linux-doc, Veaceslav Falico

Hi,

v2 -> v3:
Per Jay's advise, use the 'filter' keyword instead of 'arp' one, and use
his text for documentation. Also, rebase on the latest net-next. Sorry for
the delay, didn't manage to send it before net-next was closed.

v1 -> v2:
Don't remove the 'all traffic' functionality - rather, add new arp_validate
options to specify that we want *only* unvalidated arps.

Currently, if arp_validate is off (0), slave_last_rx() returns the
slave->dev->last_rx, which is always updated on *any* packet received by
slave, and not only arps. This means that, if the validation of arps is
off, we're treating *any* incoming packet as a proof of slave being up, and
not only arps.

This might seem logical at the first glance, however it can cause a lot of
troubles and false-positives, one example would be:

The arp_ip_target is NOT accessible, however someone in the broadcast domain
spams with any broadcast traffic. This way bonding will be tricked that the
slave is still up (as in - can access arp_ip_target), while it's not.

The net_device->last_rx is already used in a lot of drivers (even though the
comment states to NOT do it :)), and it's also ugly to modify it from bonding.

However, some loadbalance setups might rely on the fact that even non-arp
traffic is a sign of slave being up - and we definitely can't break anyones
config - so an extension to arp_validate is needed.

So, to fix this, add an option for the user to specify if he wants to
filter out non-arp traffic on unvalidated slaves, remove the last_rx from
bonding, *always* call bond_arp_rcv() in slave's rx_handler (which is
bond_handle_frame), and if we spot an arp there with this option on - update
the slave->last_arp_rx - and use it instead of net_device->last_rx. Finally,
rename last_arp_rx to last_rx to reflect the changes.

Also rename slave->jiffies to ->last_link_up, to reflect better its
meaning, add the new option's documentation and update the arp_validate one
to be a bit more descriptive.


CC: Rob Landley <rob@landley.net>
CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
CC: "David S. Miller" <davem@davemloft.net>
CC: dingtianhong <dingtianhong@huawei.com>
CC: Nikolay Aleksandrov <nikolay@redhat.com>
CC: Neil Horman <nhorman@tuxdriver.com>
CC: Cong Wang <amwang@redhat.com>
CC: linux-doc@vger.kernel.org
CC: netdev@vger.kernel.org
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>

---
 Documentation/networking/bonding.txt | 96 +++++++++++++++++++++++++-----------
 drivers/net/bonding/bond_main.c      | 56 +++++++++------------
 drivers/net/bonding/bond_options.c   | 16 +++---
 drivers/net/bonding/bonding.h        | 26 ++++++----
 include/linux/netdevice.h            |  8 +--
 5 files changed, 117 insertions(+), 85 deletions(-)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v3 net-next 01/12] bonding: remove bond->lock from bond_arp_rcv
  2014-02-17 13:39 [PATCH v3 net-next 0/12] bonding: add an option to rely on unvalidated arp packets Veaceslav Falico
@ 2014-02-17 13:39 ` Veaceslav Falico
  2014-02-17 13:39 ` [PATCH v3 net-next 02/12] bonding: permit using arp_validate with non-ab modes Veaceslav Falico
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Veaceslav Falico @ 2014-02-17 13:39 UTC (permalink / raw)
  To: netdev; +Cc: Veaceslav Falico, Jay Vosburgh, Andy Gospodarek

We're always called with rcu_read_lock() held (bond_arp_rcv() is only
called from bond_handle_frame(), which is rx_handler and always called
under rcu from __netif_receive_skb_core() ).

The slave active/passive and/or bonding params can change in-flight, however
we don't really care about that - we only modify the last time packet was
received, which is harmless.

CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
---
 drivers/net/bonding/bond_main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 3bce855..3c50bec 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2260,8 +2260,6 @@ int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond,
 	if (skb->protocol != __cpu_to_be16(ETH_P_ARP))
 		return RX_HANDLER_ANOTHER;
 
-	read_lock(&bond->lock);
-
 	if (!slave_do_arp_validate(bond, slave))
 		goto out_unlock;
 
@@ -2318,7 +2316,6 @@ int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond,
 		bond_validate_arp(bond, slave, tip, sip);
 
 out_unlock:
-	read_unlock(&bond->lock);
 	if (arp != (struct arphdr *)skb->data)
 		kfree(arp);
 	return RX_HANDLER_ANOTHER;
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 net-next 02/12] bonding: permit using arp_validate with non-ab modes
  2014-02-17 13:39 [PATCH v3 net-next 0/12] bonding: add an option to rely on unvalidated arp packets Veaceslav Falico
  2014-02-17 13:39 ` [PATCH v3 net-next 01/12] bonding: remove bond->lock from bond_arp_rcv Veaceslav Falico
@ 2014-02-17 13:39 ` Veaceslav Falico
  2014-02-17 13:48   ` Nikolay Aleksandrov
  2014-02-17 13:39 ` [PATCH v3 net-next 03/12] bonding: always update last_arp_rx on packet recieve Veaceslav Falico
                   ` (9 subsequent siblings)
  11 siblings, 1 reply; 16+ messages in thread
From: Veaceslav Falico @ 2014-02-17 13:39 UTC (permalink / raw)
  To: netdev; +Cc: Veaceslav Falico, Jay Vosburgh, Andy Gospodarek

Currently it's diabled because it's sometimes hard, in typical configs, to
make it work - because of the nature how the loadbalance modes work - as
it's hard to deliver valid arp replies to correct slaves by the switch.

However we still can use arp_validation in loadbalance in several other
configs, per example with arp_validate == 2 for backup with one broadcast
domain, without the switch(es) doing any balancing - this way we'd be (a
bit more) sure that the slave is up.

So, enable it to let users decide which one works/suits them best.

CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
---
 Documentation/networking/bonding.txt | 6 +++---
 drivers/net/bonding/bond_main.c      | 4 ----
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt
index 5cdb229..96b4ad8 100644
--- a/Documentation/networking/bonding.txt
+++ b/Documentation/networking/bonding.txt
@@ -270,9 +270,9 @@ arp_ip_target
 arp_validate
 
 	Specifies whether or not ARP probes and replies should be
-	validated in the active-backup mode.  This causes the ARP
-	monitor to examine the incoming ARP requests and replies, and
-	only consider a slave to be up if it is receiving the
+	validated in any mode that supports arp monitoring.  This causes
+	the ARP monitor to examine the incoming ARP requests and replies,
+	and only consider a slave to be up if it is receiving the
 	appropriate ARP traffic.
 
 	Possible values are:
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 3c50bec..91c0248 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4183,10 +4183,6 @@ static int bond_check_params(struct bond_params *params)
 	}
 
 	if (arp_validate) {
-		if (bond_mode != BOND_MODE_ACTIVEBACKUP) {
-			pr_err("arp_validate only supported in active-backup mode\n");
-			return -EINVAL;
-		}
 		if (!arp_interval) {
 			pr_err("arp_validate requires arp_interval\n");
 			return -EINVAL;
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 net-next 03/12] bonding: always update last_arp_rx on packet recieve
  2014-02-17 13:39 [PATCH v3 net-next 0/12] bonding: add an option to rely on unvalidated arp packets Veaceslav Falico
  2014-02-17 13:39 ` [PATCH v3 net-next 01/12] bonding: remove bond->lock from bond_arp_rcv Veaceslav Falico
  2014-02-17 13:39 ` [PATCH v3 net-next 02/12] bonding: permit using arp_validate with non-ab modes Veaceslav Falico
@ 2014-02-17 13:39 ` Veaceslav Falico
  2014-02-17 13:39 ` [PATCH v3 net-next 04/12] bonding: always set recv_probe to bond_arp_rcv in arp monitor Veaceslav Falico
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Veaceslav Falico @ 2014-02-17 13:39 UTC (permalink / raw)
  To: netdev; +Cc: Veaceslav Falico, Jay Vosburgh, Andy Gospodarek

Currently we're updating the last_arp_rx only when we've validate the
packet, however afterwards we use it as 'ANY last packet received', but not
only validated ARPs.

Fix this by updating it in case of any packet received. It won't break the
arp_validation=0 because we, anyway, return the correct slave->dev->last_rx in
slave_last_rx().

CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
---
 drivers/net/bonding/bond_main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 91c0248..7747cc5 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2257,6 +2257,8 @@ int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond,
 	__be32 sip, tip;
 	int alen;
 
+	slave->last_arp_rx = jiffies;
+
 	if (skb->protocol != __cpu_to_be16(ETH_P_ARP))
 		return RX_HANDLER_ANOTHER;
 
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 net-next 04/12] bonding: always set recv_probe to bond_arp_rcv in arp monitor
  2014-02-17 13:39 [PATCH v3 net-next 0/12] bonding: add an option to rely on unvalidated arp packets Veaceslav Falico
                   ` (2 preceding siblings ...)
  2014-02-17 13:39 ` [PATCH v3 net-next 03/12] bonding: always update last_arp_rx on packet recieve Veaceslav Falico
@ 2014-02-17 13:39 ` Veaceslav Falico
  2014-02-17 13:39 ` [PATCH v3 net-next 05/12] bonding: extend arp_validate to be able to receive unvalidated arp-only traffic Veaceslav Falico
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Veaceslav Falico @ 2014-02-17 13:39 UTC (permalink / raw)
  To: netdev; +Cc: Veaceslav Falico, Jay Vosburgh, Andy Gospodarek

Currently we only set bond_arp_rcv() if we're using arp_validate, however
this makes us skip updating last_arp_rx if we're not validating incoming
ARPs - thus, if arp_validate is off, last_arp_rx will never be updated.

Fix this by always setting up recv_probe = bond_arp_rcv, even if we're not
using arp_validate.

CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
---
 drivers/net/bonding/bond_main.c    | 3 +--
 drivers/net/bonding/bond_options.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 7747cc5..257ee7f 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3059,8 +3059,7 @@ static int bond_open(struct net_device *bond_dev)
 
 	if (bond->params.arp_interval) {  /* arp interval, in milliseconds. */
 		queue_delayed_work(bond->wq, &bond->arp_work, 0);
-		if (bond->params.arp_validate)
-			bond->recv_probe = bond_arp_rcv;
+		bond->recv_probe = bond_arp_rcv;
 	}
 
 	if (bond->params.mode == BOND_MODE_8023AD) {
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
index f3eb44d..cda686d 100644
--- a/drivers/net/bonding/bond_options.c
+++ b/drivers/net/bonding/bond_options.c
@@ -809,8 +809,7 @@ int bond_option_arp_interval_set(struct bonding *bond,
 			cancel_delayed_work_sync(&bond->arp_work);
 		} else {
 			/* arp_validate can be set only in active-backup mode */
-			if (bond->params.arp_validate)
-				bond->recv_probe = bond_arp_rcv;
+			bond->recv_probe = bond_arp_rcv;
 			cancel_delayed_work_sync(&bond->mii_work);
 			queue_delayed_work(bond->wq, &bond->arp_work, 0);
 		}
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 net-next 05/12] bonding: extend arp_validate to be able to receive unvalidated arp-only traffic
  2014-02-17 13:39 [PATCH v3 net-next 0/12] bonding: add an option to rely on unvalidated arp packets Veaceslav Falico
                   ` (3 preceding siblings ...)
  2014-02-17 13:39 ` [PATCH v3 net-next 04/12] bonding: always set recv_probe to bond_arp_rcv in arp monitor Veaceslav Falico
@ 2014-02-17 13:39 ` Veaceslav Falico
  2014-02-17 13:39 ` [PATCH v3 net-next 06/12] bonding: document the new _arp options for arp_validate Veaceslav Falico
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Veaceslav Falico @ 2014-02-17 13:39 UTC (permalink / raw)
  To: netdev; +Cc: Veaceslav Falico, Jay Vosburgh, Andy Gospodarek

Currently we can either receive any traffic as a proff of slave being up,
or only *validated* arp traffic (i.e. with src/dst ip checked).

Add an option to be able to specify if we want to receive non-validated arp
traffic only.

CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
---
 drivers/net/bonding/bond_options.c | 13 ++++++++-----
 drivers/net/bonding/bonding.h      | 11 +++++++++++
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
index cda686d..beeec4c 100644
--- a/drivers/net/bonding/bond_options.c
+++ b/drivers/net/bonding/bond_options.c
@@ -47,11 +47,14 @@ static struct bond_opt_value bond_xmit_hashtype_tbl[] = {
 };
 
 static struct bond_opt_value bond_arp_validate_tbl[] = {
-	{ "none",   BOND_ARP_VALIDATE_NONE,   BOND_VALFLAG_DEFAULT},
-	{ "active", BOND_ARP_VALIDATE_ACTIVE, 0},
-	{ "backup", BOND_ARP_VALIDATE_BACKUP, 0},
-	{ "all",    BOND_ARP_VALIDATE_ALL,    0},
-	{ NULL,     -1,                       0},
+	{ "none",		BOND_ARP_VALIDATE_NONE,		BOND_VALFLAG_DEFAULT},
+	{ "active",		BOND_ARP_VALIDATE_ACTIVE,	0},
+	{ "backup",		BOND_ARP_VALIDATE_BACKUP,	0},
+	{ "all",		BOND_ARP_VALIDATE_ALL,		0},
+	{ "filter",		BOND_ARP_FILTER,		0},
+	{ "filter_active",	BOND_ARP_FILTER_ACTIVE,		0},
+	{ "filter_backup",	BOND_ARP_FILTER_BACKUP,		0},
+	{ NULL,			-1,				0},
 };
 
 static struct bond_opt_value bond_arp_all_targets_tbl[] = {
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 86ccfb9..ab2e651 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -342,6 +342,11 @@ static inline bool bond_is_active_slave(struct slave *slave)
 #define BOND_ARP_VALIDATE_BACKUP	(1 << BOND_STATE_BACKUP)
 #define BOND_ARP_VALIDATE_ALL		(BOND_ARP_VALIDATE_ACTIVE | \
 					 BOND_ARP_VALIDATE_BACKUP)
+#define BOND_ARP_FILTER			(BOND_ARP_VALIDATE_ALL + 1)
+#define BOND_ARP_FILTER_ACTIVE		(BOND_ARP_VALIDATE_ACTIVE | \
+					 BOND_ARP_FILTER)
+#define BOND_ARP_FILTER_BACKUP		(BOND_ARP_VALIDATE_BACKUP | \
+					 BOND_ARP_FILTER)
 
 static inline int slave_do_arp_validate(struct bonding *bond,
 					struct slave *slave)
@@ -349,6 +354,12 @@ static inline int slave_do_arp_validate(struct bonding *bond,
 	return bond->params.arp_validate & (1 << bond_slave_state(slave));
 }
 
+static inline int slave_do_arp_validate_only(struct bonding *bond,
+					     struct slave *slave)
+{
+	return bond->params.arp_validate & BOND_ARP_FILTER;
+}
+
 /* Get the oldest arp which we've received on this slave for bond's
  * arp_targets.
  */
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 net-next 06/12] bonding: document the new _arp options for arp_validate
  2014-02-17 13:39 [PATCH v3 net-next 0/12] bonding: add an option to rely on unvalidated arp packets Veaceslav Falico
                   ` (4 preceding siblings ...)
  2014-02-17 13:39 ` [PATCH v3 net-next 05/12] bonding: extend arp_validate to be able to receive unvalidated arp-only traffic Veaceslav Falico
@ 2014-02-17 13:39 ` Veaceslav Falico
  2014-02-17 13:39 ` [PATCH v3 net-next 07/12] bonding: use the new options to correctly set last_arp_rx Veaceslav Falico
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Veaceslav Falico @ 2014-02-17 13:39 UTC (permalink / raw)
  To: netdev; +Cc: Veaceslav Falico, Jay Vosburgh, Andy Gospodarek

CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
---
 Documentation/networking/bonding.txt | 96 +++++++++++++++++++++++++-----------
 1 file changed, 66 insertions(+), 30 deletions(-)

diff --git a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt
index 96b4ad8..a383c00 100644
--- a/Documentation/networking/bonding.txt
+++ b/Documentation/networking/bonding.txt
@@ -270,16 +270,15 @@ arp_ip_target
 arp_validate
 
 	Specifies whether or not ARP probes and replies should be
-	validated in any mode that supports arp monitoring.  This causes
-	the ARP monitor to examine the incoming ARP requests and replies,
-	and only consider a slave to be up if it is receiving the
-	appropriate ARP traffic.
+	validated in any mode that supports arp monitoring, or whether
+	non-ARP traffic should be filtered (disregarded) for link
+	monitoring purposes.
 
 	Possible values are:
 
 	none or 0
 
-		No validation is performed.  This is the default.
+		No validation or filtering is performed.
 
 	active or 1
 
@@ -293,31 +292,68 @@ arp_validate
 
 		Validation is performed for all slaves.
 
-	For the active slave, the validation checks ARP replies to
-	confirm that they were generated by an arp_ip_target.  Since
-	backup slaves do not typically receive these replies, the
-	validation performed for backup slaves is on the ARP request
-	sent out via the active slave.  It is possible that some
-	switch or network configurations may result in situations
-	wherein the backup slaves do not receive the ARP requests; in
-	such a situation, validation of backup slaves must be
-	disabled.
-
-	The validation of ARP requests on backup slaves is mainly
-	helping bonding to decide which slaves are more likely to
-	work in case of the active slave failure, it doesn't really
-	guarantee that the backup slave will work if it's selected
-	as the next active slave.
-
-	This option is useful in network configurations in which
-	multiple bonding hosts are concurrently issuing ARPs to one or
-	more targets beyond a common switch.  Should the link between
-	the switch and target fail (but not the switch itself), the
-	probe traffic generated by the multiple bonding instances will
-	fool the standard ARP monitor into considering the links as
-	still up.  Use of the arp_validate option can resolve this, as
-	the ARP monitor will only consider ARP requests and replies
-	associated with its own instance of bonding.
+	filter or 4
+
+		Filtering is applied to all slaves. No validation is
+		performed.
+
+	filter_active or 5
+
+		Filtering is applied to all slaves, validation is performed
+		only for the active slave.
+
+	filter_backup or 6
+
+		Filtering is applied to all slaves, validation is performed
+		only for backup slaves.
+
+	Validation:
+
+	Enabling validation causes the ARP monitor to examine the incoming
+	ARP requests and replies, and only consider a slave to be up if it
+	is receiving the appropriate ARP traffic.
+
+	For an active slave, the validation checks ARP replies to confirm
+	that they were generated by an arp_ip_target.  Since backup slaves
+	do not typically receive these replies, the validation performed
+	for backup slaves is on the broadcast ARP request sent out via the
+	active slave.  It is possible that some switch or network
+	configurations may result in situations wherein the backup slaves
+	do not receive the ARP requests; in such a situation, validation
+	of backup slaves must be disabled.
+
+	The validation of ARP requests on backup slaves is mainly helping
+	bonding to decide which slaves are more likely to work in case of
+	the active slave failure, it doesn't really guarantee that the
+	backup slave will work if it's selected as the next active slave.
+
+	Validation is useful in network configurations in which multiple
+	bonding hosts are concurrently issuing ARPs to one or more targets
+	beyond a common switch.  Should the link between the switch and
+	target fail (but not the switch itself), the probe traffic
+	generated by the multiple bonding instances will fool the standard
+	ARP monitor into considering the links as still up.  Use of
+	validation can resolve this, as the ARP monitor will only consider
+	ARP requests and replies associated with its own instance of
+	bonding.
+
+	Filtering:
+
+	Enabling filtering causes the ARP monitor to only use incoming ARP
+	packets for link availability purposes.  Arriving packets that are
+	not ARPs are delivered normally, but do not count when determining
+	if a slave is available.
+
+	Filtering operates by only considering the reception of ARP
+	packets (any ARP packet, regardless of source or destination) when
+	determining if a slave has received traffic for link availability
+	purposes.
+
+	Filtering is useful in network configurations in which significant
+	levels of third party broadcast traffic would fool the standard
+	ARP monitor into considering the links as still up.  Use of
+	filtering can resolve this, as only ARP traffic is considered for
+	link availability purposes.
 
 	This option was added in bonding version 3.1.0.
 
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 net-next 07/12] bonding: use the new options to correctly set last_arp_rx
  2014-02-17 13:39 [PATCH v3 net-next 0/12] bonding: add an option to rely on unvalidated arp packets Veaceslav Falico
                   ` (5 preceding siblings ...)
  2014-02-17 13:39 ` [PATCH v3 net-next 06/12] bonding: document the new _arp options for arp_validate Veaceslav Falico
@ 2014-02-17 13:39 ` Veaceslav Falico
  2014-02-17 13:39 ` [PATCH v3 net-next 08/12] bonding: use last_arp_rx in slave_last_rx() Veaceslav Falico
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Veaceslav Falico @ 2014-02-17 13:39 UTC (permalink / raw)
  To: netdev
  Cc: Veaceslav Falico, Rob Landley, David S. Miller,
	Nikolay Aleksandrov, Ding Tianhong, Neil Horman

Now that the options are in place - arp_validate can be set to receive all
the traffic or only arp packets to verify if the slave is up, when the
slave isn't validated.

CC: Rob Landley <rob@landley.net>
CC: "David S. Miller" <davem@davemloft.net>
CC: Nikolay Aleksandrov <nikolay@redhat.com>
CC: Ding Tianhong <dingtianhong@huawei.com>
CC: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
---
 drivers/net/bonding/bond_main.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 257ee7f..3fe81cd 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2255,15 +2255,16 @@ int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond,
 	struct arphdr *arp = (struct arphdr *)skb->data;
 	unsigned char *arp_ptr;
 	__be32 sip, tip;
-	int alen;
+	int alen, is_arp = skb->protocol == __cpu_to_be16(ETH_P_ARP);
 
-	slave->last_arp_rx = jiffies;
-
-	if (skb->protocol != __cpu_to_be16(ETH_P_ARP))
+	if (!slave_do_arp_validate(bond, slave)) {
+		if ((slave_do_arp_validate_only(bond, slave) && is_arp) ||
+		    !slave_do_arp_validate_only(bond, slave))
+			slave->last_arp_rx = jiffies;
 		return RX_HANDLER_ANOTHER;
-
-	if (!slave_do_arp_validate(bond, slave))
-		goto out_unlock;
+	} else if (!is_arp) {
+		return RX_HANDLER_ANOTHER;
+	}
 
 	alen = arp_hdr_len(bond->dev);
 
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 net-next 08/12] bonding: use last_arp_rx in slave_last_rx()
  2014-02-17 13:39 [PATCH v3 net-next 0/12] bonding: add an option to rely on unvalidated arp packets Veaceslav Falico
                   ` (6 preceding siblings ...)
  2014-02-17 13:39 ` [PATCH v3 net-next 07/12] bonding: use the new options to correctly set last_arp_rx Veaceslav Falico
@ 2014-02-17 13:39 ` Veaceslav Falico
  2014-02-17 13:39 ` [PATCH v3 net-next 09/12] bonding: use last_arp_rx in bond_loadbalance_arp_mon() Veaceslav Falico
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Veaceslav Falico @ 2014-02-17 13:39 UTC (permalink / raw)
  To: netdev; +Cc: Veaceslav Falico, Jay Vosburgh, Andy Gospodarek

Now that last_arp_rx really has the last time we've received any (validated or
not) ARP, we can use it in slave_last_rx() instead of slave->dev->last_rx.

CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
---
 drivers/net/bonding/bonding.h | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index ab2e651..ae20c5a 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -379,14 +379,10 @@ static inline unsigned long slave_oldest_target_arp_rx(struct bonding *bond,
 static inline unsigned long slave_last_rx(struct bonding *bond,
 					struct slave *slave)
 {
-	if (slave_do_arp_validate(bond, slave)) {
-		if (bond->params.arp_all_targets == BOND_ARP_TARGETS_ALL)
-			return slave_oldest_target_arp_rx(bond, slave);
-		else
-			return slave->last_arp_rx;
-	}
+	if (bond->params.arp_all_targets == BOND_ARP_TARGETS_ALL)
+		return slave_oldest_target_arp_rx(bond, slave);
 
-	return slave->dev->last_rx;
+	return slave->last_arp_rx;
 }
 
 #ifdef CONFIG_NET_POLL_CONTROLLER
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 net-next 09/12] bonding: use last_arp_rx in bond_loadbalance_arp_mon()
  2014-02-17 13:39 [PATCH v3 net-next 0/12] bonding: add an option to rely on unvalidated arp packets Veaceslav Falico
                   ` (7 preceding siblings ...)
  2014-02-17 13:39 ` [PATCH v3 net-next 08/12] bonding: use last_arp_rx in slave_last_rx() Veaceslav Falico
@ 2014-02-17 13:39 ` Veaceslav Falico
  2014-02-17 13:39 ` [PATCH v3 net-next 10/12] bonding: remove useless updating of slave->dev->last_rx Veaceslav Falico
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Veaceslav Falico @ 2014-02-17 13:39 UTC (permalink / raw)
  To: netdev; +Cc: Veaceslav Falico, Jay Vosburgh, Andy Gospodarek

Now that last_arp_rx correctly show the last time we've received an ARP, we
can use it safely instead of slave->dev->last_rx.

CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
---
 drivers/net/bonding/bond_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 3fe81cd..e7aab9a 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2372,7 +2372,7 @@ static void bond_loadbalance_arp_mon(struct work_struct *work)
 
 		if (slave->link != BOND_LINK_UP) {
 			if (bond_time_in_interval(bond, trans_start, 1) &&
-			    bond_time_in_interval(bond, slave->dev->last_rx, 1)) {
+			    bond_time_in_interval(bond, slave->last_arp_rx, 1)) {
 
 				slave->link  = BOND_LINK_UP;
 				slave_state_changed = 1;
@@ -2401,7 +2401,7 @@ static void bond_loadbalance_arp_mon(struct work_struct *work)
 			 * if we don't know our ip yet
 			 */
 			if (!bond_time_in_interval(bond, trans_start, 2) ||
-			    !bond_time_in_interval(bond, slave->dev->last_rx, 2)) {
+			    !bond_time_in_interval(bond, slave->last_arp_rx, 2)) {
 
 				slave->link  = BOND_LINK_DOWN;
 				slave_state_changed = 1;
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 net-next 10/12] bonding: remove useless updating of slave->dev->last_rx
  2014-02-17 13:39 [PATCH v3 net-next 0/12] bonding: add an option to rely on unvalidated arp packets Veaceslav Falico
                   ` (8 preceding siblings ...)
  2014-02-17 13:39 ` [PATCH v3 net-next 09/12] bonding: use last_arp_rx in bond_loadbalance_arp_mon() Veaceslav Falico
@ 2014-02-17 13:39 ` Veaceslav Falico
  2014-02-17 13:39 ` [PATCH v3 net-next 11/12] bonding: trivial: rename slave->jiffies to ->last_link_up Veaceslav Falico
  2014-02-17 13:39 ` [PATCH v3 net-next 12/12] bonding: rename last_arp_rx to last_rx Veaceslav Falico
  11 siblings, 0 replies; 16+ messages in thread
From: Veaceslav Falico @ 2014-02-17 13:39 UTC (permalink / raw)
  To: netdev; +Cc: Veaceslav Falico, Jay Vosburgh, Andy Gospodarek, David S. Miller

Now that all the logic is handled via last_arp_rx, we don't need to use
last_rx.

CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
CC: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
---
 drivers/net/bonding/bond_main.c | 3 ---
 include/linux/netdevice.h       | 8 +-------
 2 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index e7aab9a..14e023d 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1115,9 +1115,6 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb)
 	slave = bond_slave_get_rcu(skb->dev);
 	bond = slave->bond;
 
-	if (bond->params.arp_interval)
-		slave->dev->last_rx = jiffies;
-
 	recv_probe = ACCESS_ONCE(bond->recv_probe);
 	if (recv_probe) {
 		ret = recv_probe(skb, bond, slave);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 430c51a..891432a 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1312,13 +1312,7 @@ struct net_device {
 /*
  * Cache lines mostly used on receive path (including eth_type_trans())
  */
-	unsigned long		last_rx;	/* Time of last Rx
-						 * This should not be set in
-						 * drivers, unless really needed,
-						 * because network stack (bonding)
-						 * use it if/when necessary, to
-						 * avoid dirtying this cache line.
-						 */
+	unsigned long		last_rx;	/* Time of last Rx */
 
 	/* Interface address info used in eth_type_trans() */
 	unsigned char		*dev_addr;	/* hw address, (before bcast
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 net-next 11/12] bonding: trivial: rename slave->jiffies to ->last_link_up
  2014-02-17 13:39 [PATCH v3 net-next 0/12] bonding: add an option to rely on unvalidated arp packets Veaceslav Falico
                   ` (9 preceding siblings ...)
  2014-02-17 13:39 ` [PATCH v3 net-next 10/12] bonding: remove useless updating of slave->dev->last_rx Veaceslav Falico
@ 2014-02-17 13:39 ` Veaceslav Falico
  2014-02-17 13:39 ` [PATCH v3 net-next 12/12] bonding: rename last_arp_rx to last_rx Veaceslav Falico
  11 siblings, 0 replies; 16+ messages in thread
From: Veaceslav Falico @ 2014-02-17 13:39 UTC (permalink / raw)
  To: netdev; +Cc: Veaceslav Falico, Jay Vosburgh, Andy Gospodarek

slave->jiffies is updated every time the slave becomes active, which, for
bonding, means that its link is 'up'.

CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
---
 drivers/net/bonding/bond_main.c | 20 ++++++++++----------
 drivers/net/bonding/bonding.h   |  3 ++-
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 14e023d..f6d56d9 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -798,7 +798,7 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
 		return;
 
 	if (new_active) {
-		new_active->jiffies = jiffies;
+		new_active->last_link_up = jiffies;
 
 		if (new_active->link == BOND_LINK_BACK) {
 			if (USES_PRIMARY(bond->params.mode)) {
@@ -1444,7 +1444,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
 	}
 
 	if (new_slave->link != BOND_LINK_DOWN)
-		new_slave->jiffies = jiffies;
+		new_slave->last_link_up = jiffies;
 	pr_debug("Initial state of slave_dev is BOND_LINK_%s\n",
 		 new_slave->link == BOND_LINK_DOWN ? "DOWN" :
 		 (new_slave->link == BOND_LINK_UP ? "UP" : "BACK"));
@@ -1891,7 +1891,7 @@ static int bond_miimon_inspect(struct bonding *bond)
 				 * recovered before downdelay expired
 				 */
 				slave->link = BOND_LINK_UP;
-				slave->jiffies = jiffies;
+				slave->last_link_up = jiffies;
 				pr_info("%s: link status up again after %d ms for interface %s\n",
 					bond->dev->name,
 					(bond->params.downdelay - slave->delay) *
@@ -1966,7 +1966,7 @@ static void bond_miimon_commit(struct bonding *bond)
 
 		case BOND_LINK_UP:
 			slave->link = BOND_LINK_UP;
-			slave->jiffies = jiffies;
+			slave->last_link_up = jiffies;
 
 			if (bond->params.mode == BOND_MODE_8023AD) {
 				/* prevent it from being the active one */
@@ -2312,7 +2312,7 @@ int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond,
 		bond_validate_arp(bond, slave, sip, tip);
 	else if (bond->curr_active_slave &&
 		 time_after(slave_last_rx(bond, bond->curr_active_slave),
-			    bond->curr_active_slave->jiffies))
+			    bond->curr_active_slave->last_link_up))
 		bond_validate_arp(bond, slave, tip, sip);
 
 out_unlock:
@@ -2358,9 +2358,9 @@ static void bond_loadbalance_arp_mon(struct work_struct *work)
 	oldcurrent = ACCESS_ONCE(bond->curr_active_slave);
 	/* see if any of the previous devices are up now (i.e. they have
 	 * xmt and rcv traffic). the curr_active_slave does not come into
-	 * the picture unless it is null. also, slave->jiffies is not needed
-	 * here because we send an arp on each slave and give a slave as
-	 * long as it needs to get the tx/rx within the delta.
+	 * the picture unless it is null. also, slave->last_link_up is not
+	 * needed here because we send an arp on each slave and give a slave
+	 * as long as it needs to get the tx/rx within the delta.
 	 * TODO: what about up/down delay in arp mode? it wasn't here before
 	 *       so it can wait
 	 */
@@ -2486,7 +2486,7 @@ static int bond_ab_arp_inspect(struct bonding *bond)
 		 * active.  This avoids bouncing, as the last receive
 		 * times need a full ARP monitor cycle to be updated.
 		 */
-		if (bond_time_in_interval(bond, slave->jiffies, 2))
+		if (bond_time_in_interval(bond, slave->last_link_up, 2))
 			continue;
 
 		/*
@@ -2687,7 +2687,7 @@ static bool bond_ab_arp_probe(struct bonding *bond)
 	new_slave->link = BOND_LINK_BACK;
 	bond_set_slave_active_flags(new_slave);
 	bond_arp_send_all(bond, new_slave);
-	new_slave->jiffies = jiffies;
+	new_slave->last_link_up = jiffies;
 	rcu_assign_pointer(bond->current_arp_slave, new_slave);
 	rtnl_unlock();
 
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index ae20c5a..36db702 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -188,7 +188,8 @@ struct slave {
 	struct net_device *dev; /* first - useful for panic debug */
 	struct bonding *bond; /* our master */
 	int    delay;
-	unsigned long jiffies;
+	/* all three in jiffies */
+	unsigned long last_link_up;
 	unsigned long last_arp_rx;
 	unsigned long target_last_arp_rx[BOND_MAX_ARP_TARGETS];
 	s8     link;    /* one of BOND_LINK_XXXX */
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 net-next 12/12] bonding: rename last_arp_rx to last_rx
  2014-02-17 13:39 [PATCH v3 net-next 0/12] bonding: add an option to rely on unvalidated arp packets Veaceslav Falico
                   ` (10 preceding siblings ...)
  2014-02-17 13:39 ` [PATCH v3 net-next 11/12] bonding: trivial: rename slave->jiffies to ->last_link_up Veaceslav Falico
@ 2014-02-17 13:39 ` Veaceslav Falico
  11 siblings, 0 replies; 16+ messages in thread
From: Veaceslav Falico @ 2014-02-17 13:39 UTC (permalink / raw)
  To: netdev; +Cc: Veaceslav Falico, Jay Vosburgh, Andy Gospodarek

To reflect the new meaning.

CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
---
 drivers/net/bonding/bond_main.c | 12 ++++++------
 drivers/net/bonding/bonding.h   |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index f6d56d9..ac4a1b8 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1397,10 +1397,10 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
 
 	bond_update_speed_duplex(new_slave);
 
-	new_slave->last_arp_rx = jiffies -
+	new_slave->last_rx = jiffies -
 		(msecs_to_jiffies(bond->params.arp_interval) + 1);
 	for (i = 0; i < BOND_MAX_ARP_TARGETS; i++)
-		new_slave->target_last_arp_rx[i] = new_slave->last_arp_rx;
+		new_slave->target_last_arp_rx[i] = new_slave->last_rx;
 
 	if (bond->params.miimon && !bond->params.use_carrier) {
 		link_reporting = bond_check_dev_link(bond, slave_dev, 1);
@@ -2242,7 +2242,7 @@ static void bond_validate_arp(struct bonding *bond, struct slave *slave, __be32
 		pr_debug("bva: sip %pI4 not found in targets\n", &sip);
 		return;
 	}
-	slave->last_arp_rx = jiffies;
+	slave->last_rx = jiffies;
 	slave->target_last_arp_rx[i] = jiffies;
 }
 
@@ -2257,7 +2257,7 @@ int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond,
 	if (!slave_do_arp_validate(bond, slave)) {
 		if ((slave_do_arp_validate_only(bond, slave) && is_arp) ||
 		    !slave_do_arp_validate_only(bond, slave))
-			slave->last_arp_rx = jiffies;
+			slave->last_rx = jiffies;
 		return RX_HANDLER_ANOTHER;
 	} else if (!is_arp) {
 		return RX_HANDLER_ANOTHER;
@@ -2369,7 +2369,7 @@ static void bond_loadbalance_arp_mon(struct work_struct *work)
 
 		if (slave->link != BOND_LINK_UP) {
 			if (bond_time_in_interval(bond, trans_start, 1) &&
-			    bond_time_in_interval(bond, slave->last_arp_rx, 1)) {
+			    bond_time_in_interval(bond, slave->last_rx, 1)) {
 
 				slave->link  = BOND_LINK_UP;
 				slave_state_changed = 1;
@@ -2398,7 +2398,7 @@ static void bond_loadbalance_arp_mon(struct work_struct *work)
 			 * if we don't know our ip yet
 			 */
 			if (!bond_time_in_interval(bond, trans_start, 2) ||
-			    !bond_time_in_interval(bond, slave->last_arp_rx, 2)) {
+			    !bond_time_in_interval(bond, slave->last_rx, 2)) {
 
 				slave->link  = BOND_LINK_DOWN;
 				slave_state_changed = 1;
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 36db702..4303628 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -190,7 +190,7 @@ struct slave {
 	int    delay;
 	/* all three in jiffies */
 	unsigned long last_link_up;
-	unsigned long last_arp_rx;
+	unsigned long last_rx;
 	unsigned long target_last_arp_rx[BOND_MAX_ARP_TARGETS];
 	s8     link;    /* one of BOND_LINK_XXXX */
 	s8     new_link;
@@ -383,7 +383,7 @@ static inline unsigned long slave_last_rx(struct bonding *bond,
 	if (bond->params.arp_all_targets == BOND_ARP_TARGETS_ALL)
 		return slave_oldest_target_arp_rx(bond, slave);
 
-	return slave->last_arp_rx;
+	return slave->last_rx;
 }
 
 #ifdef CONFIG_NET_POLL_CONTROLLER
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v3 net-next 02/12] bonding: permit using arp_validate with non-ab modes
  2014-02-17 13:39 ` [PATCH v3 net-next 02/12] bonding: permit using arp_validate with non-ab modes Veaceslav Falico
@ 2014-02-17 13:48   ` Nikolay Aleksandrov
  2014-02-17 14:01     ` Veaceslav Falico
  0 siblings, 1 reply; 16+ messages in thread
From: Nikolay Aleksandrov @ 2014-02-17 13:48 UTC (permalink / raw)
  To: Veaceslav Falico, netdev; +Cc: Jay Vosburgh, Andy Gospodarek

On 02/17/2014 02:39 PM, Veaceslav Falico wrote:
> Currently it's diabled because it's sometimes hard, in typical configs, to
> make it work - because of the nature how the loadbalance modes work - as
> it's hard to deliver valid arp replies to correct slaves by the switch.
> 
> However we still can use arp_validation in loadbalance in several other
> configs, per example with arp_validate == 2 for backup with one broadcast
> domain, without the switch(es) doing any balancing - this way we'd be (a
> bit more) sure that the slave is up.
> 
> So, enable it to let users decide which one works/suits them best.
> 
> CC: Jay Vosburgh <fubar@us.ibm.com>
> CC: Andy Gospodarek <andy@greyhouse.net>
> Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
> ---
>  Documentation/networking/bonding.txt | 6 +++---
>  drivers/net/bonding/bond_main.c      | 4 ----
>  2 files changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt
> index 5cdb229..96b4ad8 100644
> --- a/Documentation/networking/bonding.txt
> +++ b/Documentation/networking/bonding.txt
> @@ -270,9 +270,9 @@ arp_ip_target
>  arp_validate
>  
>  	Specifies whether or not ARP probes and replies should be
> -	validated in the active-backup mode.  This causes the ARP
> -	monitor to examine the incoming ARP requests and replies, and
> -	only consider a slave to be up if it is receiving the
> +	validated in any mode that supports arp monitoring.  This causes
> +	the ARP monitor to examine the incoming ARP requests and replies,
> +	and only consider a slave to be up if it is receiving the
>  	appropriate ARP traffic.
>  
>  	Possible values are:
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 3c50bec..91c0248 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -4183,10 +4183,6 @@ static int bond_check_params(struct bond_params *params)
>  	}
>  
>  	if (arp_validate) {
> -		if (bond_mode != BOND_MODE_ACTIVEBACKUP) {
> -			pr_err("arp_validate only supported in active-backup mode\n");
> -			return -EINVAL;
> -		}
>  		if (!arp_interval) {
>  			pr_err("arp_validate requires arp_interval\n");
>  			return -EINVAL;
> 
Hi Slava,
After the option conversion patches to the new API I think you should modify the
.unsuppmodes of BOND_OPT_ARP_VALIDATE in bond_options.c in order to allow it to
be set in non-ab modes. Take a look at how BOND_OPT_PRIMARY is done for example.

Cheers,
 Nik

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v3 net-next 02/12] bonding: permit using arp_validate with non-ab modes
  2014-02-17 14:01     ` Veaceslav Falico
@ 2014-02-17 13:59       ` Nikolay Aleksandrov
  0 siblings, 0 replies; 16+ messages in thread
From: Nikolay Aleksandrov @ 2014-02-17 13:59 UTC (permalink / raw)
  To: Veaceslav Falico; +Cc: netdev, Jay Vosburgh, Andy Gospodarek

On 02/17/2014 03:01 PM, Veaceslav Falico wrote:
> On Mon, Feb 17, 2014 at 02:48:29PM +0100, Nikolay Aleksandrov wrote:
>> On 02/17/2014 02:39 PM, Veaceslav Falico wrote:
>>> Currently it's diabled because it's sometimes hard, in typical configs, to
>>> make it work - because of the nature how the loadbalance modes work - as
>>> it's hard to deliver valid arp replies to correct slaves by the switch.
>>>
>>> However we still can use arp_validation in loadbalance in several other
>>> configs, per example with arp_validate == 2 for backup with one broadcast
>>> domain, without the switch(es) doing any balancing - this way we'd be (a
>>> bit more) sure that the slave is up.
>>>
>>> So, enable it to let users decide which one works/suits them best.
>>>
>>> CC: Jay Vosburgh <fubar@us.ibm.com>
>>> CC: Andy Gospodarek <andy@greyhouse.net>
>>> Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
>>> ---
>>>  Documentation/networking/bonding.txt | 6 +++---
>>>  drivers/net/bonding/bond_main.c      | 4 ----
>>>  2 files changed, 3 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/Documentation/networking/bonding.txt
>>> b/Documentation/networking/bonding.txt
>>> index 5cdb229..96b4ad8 100644
>>> --- a/Documentation/networking/bonding.txt
>>> +++ b/Documentation/networking/bonding.txt
>>> @@ -270,9 +270,9 @@ arp_ip_target
>>>  arp_validate
>>>
>>>      Specifies whether or not ARP probes and replies should be
>>> -    validated in the active-backup mode.  This causes the ARP
>>> -    monitor to examine the incoming ARP requests and replies, and
>>> -    only consider a slave to be up if it is receiving the
>>> +    validated in any mode that supports arp monitoring.  This causes
>>> +    the ARP monitor to examine the incoming ARP requests and replies,
>>> +    and only consider a slave to be up if it is receiving the
>>>      appropriate ARP traffic.
>>>
>>>      Possible values are:
>>> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>>> index 3c50bec..91c0248 100644
>>> --- a/drivers/net/bonding/bond_main.c
>>> +++ b/drivers/net/bonding/bond_main.c
>>> @@ -4183,10 +4183,6 @@ static int bond_check_params(struct bond_params *params)
>>>      }
>>>
>>>      if (arp_validate) {
>>> -        if (bond_mode != BOND_MODE_ACTIVEBACKUP) {
>>> -            pr_err("arp_validate only supported in active-backup mode\n");
>>> -            return -EINVAL;
>>> -        }
>>>          if (!arp_interval) {
>>>              pr_err("arp_validate requires arp_interval\n");
>>>              return -EINVAL;
>>>
>> Hi Slava,
> 
> Hi Nik,
> 
>> After the option conversion patches to the new API I think you should modify the
>> .unsuppmodes of BOND_OPT_ARP_VALIDATE in bond_options.c in order to allow it to
>> be set in non-ab modes. Take a look at how BOND_OPT_PRIMARY is done for example.
> 
> Indeed, missed this part while rebasing. Thanks for the tip, I guess it's
> enough to just remove the
> 
>  157                 .unsuppmodes = BOND_MODE_ALL_EX(BIT(BOND_MODE_ACTIVEBACKUP)),
> 
> line, right? Will remove and send v4.
> 
> Thanks a lot!
> 
Yep, that should do it :-)

>>
>> Cheers,
>> Nik

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v3 net-next 02/12] bonding: permit using arp_validate with non-ab modes
  2014-02-17 13:48   ` Nikolay Aleksandrov
@ 2014-02-17 14:01     ` Veaceslav Falico
  2014-02-17 13:59       ` Nikolay Aleksandrov
  0 siblings, 1 reply; 16+ messages in thread
From: Veaceslav Falico @ 2014-02-17 14:01 UTC (permalink / raw)
  To: Nikolay Aleksandrov; +Cc: netdev, Jay Vosburgh, Andy Gospodarek

On Mon, Feb 17, 2014 at 02:48:29PM +0100, Nikolay Aleksandrov wrote:
>On 02/17/2014 02:39 PM, Veaceslav Falico wrote:
>> Currently it's diabled because it's sometimes hard, in typical configs, to
>> make it work - because of the nature how the loadbalance modes work - as
>> it's hard to deliver valid arp replies to correct slaves by the switch.
>>
>> However we still can use arp_validation in loadbalance in several other
>> configs, per example with arp_validate == 2 for backup with one broadcast
>> domain, without the switch(es) doing any balancing - this way we'd be (a
>> bit more) sure that the slave is up.
>>
>> So, enable it to let users decide which one works/suits them best.
>>
>> CC: Jay Vosburgh <fubar@us.ibm.com>
>> CC: Andy Gospodarek <andy@greyhouse.net>
>> Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
>> ---
>>  Documentation/networking/bonding.txt | 6 +++---
>>  drivers/net/bonding/bond_main.c      | 4 ----
>>  2 files changed, 3 insertions(+), 7 deletions(-)
>>
>> diff --git a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt
>> index 5cdb229..96b4ad8 100644
>> --- a/Documentation/networking/bonding.txt
>> +++ b/Documentation/networking/bonding.txt
>> @@ -270,9 +270,9 @@ arp_ip_target
>>  arp_validate
>>
>>  	Specifies whether or not ARP probes and replies should be
>> -	validated in the active-backup mode.  This causes the ARP
>> -	monitor to examine the incoming ARP requests and replies, and
>> -	only consider a slave to be up if it is receiving the
>> +	validated in any mode that supports arp monitoring.  This causes
>> +	the ARP monitor to examine the incoming ARP requests and replies,
>> +	and only consider a slave to be up if it is receiving the
>>  	appropriate ARP traffic.
>>
>>  	Possible values are:
>> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>> index 3c50bec..91c0248 100644
>> --- a/drivers/net/bonding/bond_main.c
>> +++ b/drivers/net/bonding/bond_main.c
>> @@ -4183,10 +4183,6 @@ static int bond_check_params(struct bond_params *params)
>>  	}
>>
>>  	if (arp_validate) {
>> -		if (bond_mode != BOND_MODE_ACTIVEBACKUP) {
>> -			pr_err("arp_validate only supported in active-backup mode\n");
>> -			return -EINVAL;
>> -		}
>>  		if (!arp_interval) {
>>  			pr_err("arp_validate requires arp_interval\n");
>>  			return -EINVAL;
>>
>Hi Slava,

Hi Nik,

>After the option conversion patches to the new API I think you should modify the
>.unsuppmodes of BOND_OPT_ARP_VALIDATE in bond_options.c in order to allow it to
>be set in non-ab modes. Take a look at how BOND_OPT_PRIMARY is done for example.

Indeed, missed this part while rebasing. Thanks for the tip, I guess it's
enough to just remove the

  157                 .unsuppmodes = BOND_MODE_ALL_EX(BIT(BOND_MODE_ACTIVEBACKUP)),

line, right? Will remove and send v4.

Thanks a lot!

>
>Cheers,
> Nik

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2014-02-17 14:03 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-17 13:39 [PATCH v3 net-next 0/12] bonding: add an option to rely on unvalidated arp packets Veaceslav Falico
2014-02-17 13:39 ` [PATCH v3 net-next 01/12] bonding: remove bond->lock from bond_arp_rcv Veaceslav Falico
2014-02-17 13:39 ` [PATCH v3 net-next 02/12] bonding: permit using arp_validate with non-ab modes Veaceslav Falico
2014-02-17 13:48   ` Nikolay Aleksandrov
2014-02-17 14:01     ` Veaceslav Falico
2014-02-17 13:59       ` Nikolay Aleksandrov
2014-02-17 13:39 ` [PATCH v3 net-next 03/12] bonding: always update last_arp_rx on packet recieve Veaceslav Falico
2014-02-17 13:39 ` [PATCH v3 net-next 04/12] bonding: always set recv_probe to bond_arp_rcv in arp monitor Veaceslav Falico
2014-02-17 13:39 ` [PATCH v3 net-next 05/12] bonding: extend arp_validate to be able to receive unvalidated arp-only traffic Veaceslav Falico
2014-02-17 13:39 ` [PATCH v3 net-next 06/12] bonding: document the new _arp options for arp_validate Veaceslav Falico
2014-02-17 13:39 ` [PATCH v3 net-next 07/12] bonding: use the new options to correctly set last_arp_rx Veaceslav Falico
2014-02-17 13:39 ` [PATCH v3 net-next 08/12] bonding: use last_arp_rx in slave_last_rx() Veaceslav Falico
2014-02-17 13:39 ` [PATCH v3 net-next 09/12] bonding: use last_arp_rx in bond_loadbalance_arp_mon() Veaceslav Falico
2014-02-17 13:39 ` [PATCH v3 net-next 10/12] bonding: remove useless updating of slave->dev->last_rx Veaceslav Falico
2014-02-17 13:39 ` [PATCH v3 net-next 11/12] bonding: trivial: rename slave->jiffies to ->last_link_up Veaceslav Falico
2014-02-17 13:39 ` [PATCH v3 net-next 12/12] bonding: rename last_arp_rx to last_rx Veaceslav Falico

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.