bonding: don't change to 802.3ad mode while ARP monitoring is running
Subsystems (3)
PATCH RESEND 1/1 bonding: don't change to 802.3ad mode while ARP monitoring is running
Because the ARP monitoring is not support for 802.3ad, but I still could change the mode to 802.3ad from ab mode while ARP monitoring is running, it is incorrect.
So add a check for 802.3ad in bonding_store_mode to fix the problem, and make a new macro BOND_NO_USES_ARP() to simplify the code.
--- drivers/net/bonding/bond_options.c | 2 +- drivers/net/bonding/bonding.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/net/bonding/bond_options.c +1 -1
@@ -45,7 +45,7 @@ int bond_option_mode_set(struct bonding *bond, int mode)return -EPERM ; } -if (BOND_MODE_IS_LB (mode) && bond->params.arp_interval) { +if (BOND_NO_USES_ARP (mode) && bond->params.arp_interval) {pr_err ("%s: %s mode is incompatible with arp monitoring.\n" , bond->dev->name, bond_mode_tbl[mode].modename);return -EINVAL ;
drivers/net/bonding/bonding.h +4 -0
@@ -63,6 +63,10 @@ (((mode) ==BOND_MODE_TLB ) || \ ((mode) == BOND_MODE_ALB)) +#define BOND_NO_USES_ARP (mode) \ + (((mode) == BOND_MODE_8023AD) || \ + ((mode) == BOND_MODE_TLB) || \ + ((mode) == BOND_MODE_ALB))/* * Less bad way to call ioctl from within the kernel; this needs to be * done some other way to get the call out of interrupt context.
Signature · 1 line
1.7.12
Quoted 6 lines · Ding Tianhong
Because the ARP monitoring is not support for 802.3ad, but I still could change the mode to 802.3ad from ab mode while ARP monitoring is running, it is incorrect.
So add a check for 802.3ad in
bonding_store_modeto fix the problem, and make a new macroBOND_NO_USES_ARP()to simplify the code.
Instead of failing, couldn't the code stop ARP monitoring and allow the mode change? This is similar to setting miimon, which disables ARP monitoring, or setting ARP monitoring, which disables miimon.
if (new_value && bond->params.arp_interval) {
pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n",
bond->dev->name);
bond->params.arp_interval = 0;
if (bond->params.arp_validate)
bond->params.arp_validate = BOND_ARP_VALIDATE_NONE;
}Bond mode is the most important bond option, so it seems like it should override any of the other sub-options. I know the code doesn't do this now, but maybe instead of the patch you propose, it would be nicer to allow the mode change instead?
Dan
Quoted 34 lines
Signed-off-by Ding Tianhong <[email protected]>--- drivers/net/bonding/bond_options.c | 2 +- drivers/net/bonding/bonding.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-)drivers/net/bonding/bond_options.c +1
-1@@ -45,7 +45,7 @@ int bond_option_mode_set(struct bonding *bond, int mode)return -EPERM ; } -if (BOND_MODE_IS_LB (mode) && bond->params.arp_interval) { +if (BOND_NO_USES_ARP (mode) && bond->params.arp_interval) {pr_err ("%s: %s mode is incompatible with arp monitoring.\n" , bond->dev->name, bond_mode_tbl[mode].modename);return -EINVAL ;drivers/net/bonding/bonding.h +4
-0@@ -63,6 +63,10 @@ (((mode) ==BOND_MODE_TLB ) || \ ((mode) == BOND_MODE_ALB)) +#define BOND_NO_USES_ARP (mode) \ + (((mode) == BOND_MODE_8023AD) || \ + ((mode) == BOND_MODE_TLB) || \ + ((mode) == BOND_MODE_ALB))/* * Less bad way to call ioctl from within the kernel; this needs to be * done some other way to get the call out of interrupt context.
David Miller
maintainerFrom: Dan Williams <[email protected]>
Date: Mon, 18 Nov 2013 11:44:42 -0600
Quoted 20 lines · Ding Tianhong
Quoted 6 lines
Because the ARP monitoring is not support for 802.3ad, but I still could change the mode to 802.3ad from ab mode while ARP monitoring is running, it is incorrect.
So add a check for 802.3ad in
bonding_store_modeto fix the problem, and make a new macroBOND_NO_USES_ARP()to simplify the code.Instead of failing, couldn't the code stop ARP monitoring and allow the mode change? This is similar to setting miimon, which disables ARP monitoring, or setting ARP monitoring, which disables miimon.
if (new_value && bond->params.arp_interval) { pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n", bond->dev->name); bond->params.arp_interval = 0; if (bond->params.arp_validate) bond->params.arp_validate = BOND_ARP_VALIDATE_NONE; }
Quoted 4 lines
Bond mode is the most important bond option, so it seems like it should override any of the other sub-options. I know the code doesn't do this now, but maybe instead of the patch you propose, it would be nicer to allow the mode change instead?
I agree with Dan, if other mode changes behave this way (by dropping the incompatible feature) we should make 802.3ad do so as well at the very least for consistency.
Quoted 23 lines · David Miller
From: Dan Williams <[email protected]>
Date: Mon, 18 Nov 2013 11:44:42 -0600Quoted 20 lines · Ding Tianhong
Quoted 6 lines
Because the ARP monitoring is not support for 802.3ad, but I still could change the mode to 802.3ad from ab mode while ARP monitoring is running, it is incorrect.
So add a check for 802.3ad in
bonding_store_modeto fix the problem, and make a new macroBOND_NO_USES_ARP()to simplify the code.Instead of failing, couldn't the code stop ARP monitoring and allow the mode change? This is similar to setting miimon, which disables ARP monitoring, or setting ARP monitoring, which disables miimon.
if (new_value && bond->params.arp_interval) { pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n", bond->dev->name); bond->params.arp_interval = 0; if (bond->params.arp_validate) bond->params.arp_validate = BOND_ARP_VALIDATE_NONE; }
Quoted 8 lines
Quoted 4 lines
Bond mode is the most important bond option, so it seems like it should override any of the other sub-options. I know the code doesn't do this now, but maybe instead of the patch you propose, it would be nicer to allow the mode change instead?
I agree with Dan, if other mode changes behave this way (by dropping the incompatible feature) we should make 802.3ad do so as well at the very least for consistency.
Currently ALB and TLB modes will fail if arp_interval > 0, so Ding's patch is technically correct.
Instead, I'm proposing that 'mode' trumps all, and if the user changes the mode, conflicting values should be cleared or reset. Otherwise userspace has to duplicate a lot of kernel logic/validation. For example:
1) set mode to ROUNDROBIN
2) set arp_interval
3) set mode to ALB or TLB
4) FAIL - incompatible with arp_interval
5) ok, set arp_interval to zero
6) set mode to ALB or TLB
7) SUCCESS
Wouldn't it be nice if the kernel handled clearing arp_interval for us, since it knows that arp_interval is incompatible with ALB/TLB...
Could be done separately. I have no objection to Ding's patch other than "life could be even better".
Dan
Quoted 49 lines · Dan Williams
Quoted 23 lines · David Miller
From: Dan Williams <[email protected]>
Date: Mon, 18 Nov 2013 11:44:42 -0600Quoted 20 lines · Ding Tianhong
Quoted 6 lines
Because the ARP monitoring is not support for 802.3ad, but I still could change the mode to 802.3ad from ab mode while ARP monitoring is running, it is incorrect.
So add a check for 802.3ad in
bonding_store_modeto fix the problem, and make a new macroBOND_NO_USES_ARP()to simplify the code.Instead of failing, couldn't the code stop ARP monitoring and allow the mode change? This is similar to setting miimon, which disables ARP monitoring, or setting ARP monitoring, which disables miimon.
if (new_value && bond->params.arp_interval) { pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n", bond->dev->name); bond->params.arp_interval = 0; if (bond->params.arp_validate) bond->params.arp_validate = BOND_ARP_VALIDATE_NONE; }Quoted 8 lines
Quoted 4 lines
Bond mode is the most important bond option, so it seems like it should override any of the other sub-options. I know the code doesn't do this now, but maybe instead of the patch you propose, it would be nicer to allow the mode change instead?
I agree with Dan, if other mode changes behave this way (by dropping the incompatible feature) we should make 802.3ad do so as well at the very least for consistency.
Currently ALB and TLB modes will fail if
arp_interval> 0, so Ding's patch is technically correct.Instead, I'm proposing that 'mode' trumps all, and if the user changes the mode, conflicting values should be cleared or reset. Otherwise userspace has to duplicate a lot of kernel logic/validation. For example:
1) set mode to ROUNDROBIN
2) setarp_interval
3) set mode to ALB or TLB
4) FAIL - incompatible witharp_interval
5) ok, setarp_intervalto zero
6) set mode to ALB or TLB
7) SUCCESS
Quoted 9 lines
Wouldn't it be nice if the kernel handled clearing
arp_intervalfor us, since it knows thatarp_intervalis incompatible with ALB/TLB...Could be done separately. I have no objection to Ding's patch other than "life could be even better".
Dan
agree, it could be better, when we set the mode which only support mii, we should disable the arp monitoring if arp_interval > 0, and restart mii monitor, I will rebuild the patch and resend it later.
Regards
Ding
Quoted 3 lines
.
Quoted 46 lines · Dan Williams
Quoted 22 lines · David Miller
From: Dan Williams <[email protected]>
Date: Mon, 18 Nov 2013 11:44:42 -0600Quoted 19 lines · Ding Tianhong
Quoted 6 lines
Because the ARP monitoring is not support for 802.3ad, but I still could change the mode to 802.3ad from ab mode while ARP monitoring is running, it is incorrect.
So add a check for 802.3ad in
bonding_store_modeto fix the problem, and make a new macroBOND_NO_USES_ARP()to simplify the code.Instead of failing, couldn't the code stop ARP monitoring and allow the mode change? This is similar to setting miimon, which disables ARP monitoring, or setting ARP monitoring, which disables miimon.
if (new_value && bond->params.arp_interval) { pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n", bond->dev->name); bond->params.arp_interval = 0; if (bond->params.arp_validate) bond->params.arp_validate = BOND_ARP_VALIDATE_NONE; }Quoted 7 lines
Quoted 4 lines
Bond mode is the most important bond option, so it seems like it should override any of the other sub-options. I know the code doesn't do this now, but maybe instead of the patch you propose, it would be nicer to allow the mode change instead?
I agree with Dan, if other mode changes behave this way (by dropping the incompatible feature) we should make 802.3ad do so as well at the very least for consistency.
Currently ALB and TLB modes will fail if
arp_interval> 0, so Ding's patch is technically correct.Instead, I'm proposing that 'mode' trumps all, and if the user changes the mode, conflicting values should be cleared or reset. Otherwise userspace has to duplicate a lot of kernel logic/validation. For example:
1) set mode to ROUNDROBIN
2) setarp_interval
3) set mode to ALB or TLB
4) FAIL - incompatible witharp_interval
5) ok, setarp_intervalto zero
6) set mode to ALB or TLB
7) SUCCESS
Quoted 7 lines
Wouldn't it be nice if the kernel handled clearing
arp_intervalfor us, since it knows thatarp_intervalis incompatible with ALB/TLB...Could be done separately. I have no objection to Ding's patch other than "life could be even better".
Dan
Nik was actually planning to work on a pretty significant rewrite of the code that handles setting and clearing of different config options, but I have not seen him chime in on this thread yet.
Nik, anything you can share on this or are you still a bit away from coming up with a design and implementation?
Quoted 50 lines · Andy Gospodarek
Quoted 49 lines · Dan Williams
Quoted 22 lines · David Miller
From: Dan Williams <[email protected]>
Date: Mon, 18 Nov 2013 11:44:42 -0600Quoted 19 lines · Ding Tianhong
Quoted 6 lines
Because the ARP monitoring is not support for 802.3ad, but I still could change the mode to 802.3ad from ab mode while ARP monitoring is running, it is incorrect.
So add a check for 802.3ad in
bonding_store_modeto fix the problem, and make a new macroBOND_NO_USES_ARP()to simplify the code.Instead of failing, couldn't the code stop ARP monitoring and allow the mode change? This is similar to setting miimon, which disables ARP monitoring, or setting ARP monitoring, which disables miimon.
if (new_value && bond->params.arp_interval) { pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n", bond->dev->name); bond->params.arp_interval = 0; if (bond->params.arp_validate) bond->params.arp_validate = BOND_ARP_VALIDATE_NONE; }Quoted 7 lines
Quoted 4 lines
Bond mode is the most important bond option, so it seems like it should override any of the other sub-options. I know the code doesn't do this now, but maybe instead of the patch you propose, it would be nicer to allow the mode change instead?
I agree with Dan, if other mode changes behave this way (by dropping the incompatible feature) we should make 802.3ad do so as well at the very least for consistency.
Currently ALB and TLB modes will fail if
arp_interval> 0, so Ding's patch is technically correct.Instead, I'm proposing that 'mode' trumps all, and if the user changes the mode, conflicting values should be cleared or reset. Otherwise userspace has to duplicate a lot of kernel logic/validation. For example:
1) set mode to ROUNDROBIN
2) setarp_interval
3) set mode to ALB or TLB
4) FAIL - incompatible witharp_interval
5) ok, setarp_intervalto zero
6) set mode to ALB or TLB
7) SUCCESSWouldn't it be nice if the kernel handled clearing
arp_intervalfor us, since it knows thatarp_intervalis incompatible with ALB/TLB...
Quoted 8 lines
Quoted 4 lines
Could be done separately. I have no objection to Ding's patch other than "life could be even better".
Dan
Nik was actually planning to work on a pretty significant rewrite of the code that handles setting and clearing of different config options, but I have not seen him chime in on this thread yet.
Nik, anything you can share on this or are you still a bit away from coming up with a design and implementation?
ok, I will waiting for Nik's suggestion and then decide what to do next. Ding
Quoted 7 lines
Signature · 5 lines
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html .
PATCH v2 1/1 bonding: disable arp and enable mii monitoring when bond change to no uses arp mode
In reply to Andy GospodarekBecause the ARP monitoring is not support for 802.3ad, but I still could change the mode to 802.3ad from ab mode while ARP monitoring is running, it is incorrect.
So add a check for 802.3ad in bonding_store_mode to fix the problem, and make a new macro BOND_NO_USES_ARP() to simplify the code.
v2: according to the Dan Williams's suggestion, bond mode is the most
important bond option, it should override any of the other sub-options. So when the mode is changed, the conficting values should be cleared or reset, otherwise the user has to duplicate more operations to modify the logic. I disable the arp and enable mii monitoring when the bond mode is changed to AB, TB and 8023AD if the arp interval is true.
--- drivers/net/bonding/bond_options.c | 13 +++++++++---- drivers/net/bonding/bonding.h | 5 +++++ 2 files changed, 14 insertions(+), 4 deletions(-)
drivers/net/bonding/bond_options.c +9 -4
@@ -45,10 +45,15 @@ int bond_option_mode_set(struct bonding *bond, int mode)return -EPERM ; } -if (BOND_MODE_IS_LB (mode) && bond->params.arp_interval) { -pr_err ("%s: %s mode is incompatible with arp monitoring.\n" , - bond->dev->name, bond_mode_tbl[mode].modename); -return -EINVAL ; +if (BOND_NO_USES_ARP (mode) && bond->params.arp_interval) { +pr_info ("%s: %s mode is incompatible with arp monitoring, start mii monitoring\n" , + bond->dev->name, bond_mode_tbl[mode].modename); +/* disable arp monitoring */ + bond->params.arp_interval =0 ; +/* set miimon to default value */ + bond->params.miimon =100 ; +pr_info ("%s: Setting MII monitoring interval to %d.\n" , + bond->dev->name, bond->params.miimon); }/* don't cache arp_validate between modes */
drivers/net/bonding/bonding.h +5 -0
@@ -55,6 +55,11 @@ ((mode) == BOND_MODE_TLB) || \ ((mode) == BOND_MODE_ALB)) +#define BOND_NO_USES_ARP (mode) \ + (((mode) == BOND_MODE_8023AD) || \ + ((mode) == BOND_MODE_TLB) || \ + ((mode) == BOND_MODE_ALB)) +#define TX_QUEUE_OVERRIDE (mode) \ (((mode) == BOND_MODE_ACTIVEBACKUP) || \ ((mode) == BOND_MODE_ROUNDROBIN))
Signature · 1 line
1.8.0
Quoted 54 lines · Andy Gospodarek
Quoted 53 lines · Dan Williams
Quoted 23 lines · David Miller
From: Dan Williams <[email protected]>
Date: Mon, 18 Nov 2013 11:44:42 -0600Quoted 20 lines · Ding Tianhong
Quoted 6 lines
Because the ARP monitoring is not support for 802.3ad, but I still could change the mode to 802.3ad from ab mode while ARP monitoring is running, it is incorrect.
So add a check for 802.3ad in
bonding_store_modeto fix the problem, and make a new macroBOND_NO_USES_ARP()to simplify the code.Instead of failing, couldn't the code stop ARP monitoring and allow the mode change? This is similar to setting miimon, which disables ARP monitoring, or setting ARP monitoring, which disables miimon.
if (
new_value&&bond->params.arp_interval) {
pr_info("%s: MII monitoring cannot be used with ARP monitoring.
Disabling ARP monitoring...\n",bond->dev->name); bond->params.arp_interval = 0; if (bond->params.arp_validate) bond->params.arp_validate = BOND_ARP_VALIDATE_NONE; }Quoted 7 lines
Quoted 4 lines
Bond mode is the most important bond option, so it seems like it should override any of the other sub-options. I know the code doesn't do this now, but maybe instead of the patch you propose, it would be nicer to allow the mode change instead?
I agree with Dan, if other mode changes behave this way (by dropping the incompatible feature) we should make 802.3ad do so as well at the very least for consistency.
Currently ALB and TLB modes will fail if
arp_interval> 0, so Ding's patch is technically correct.Instead, I'm proposing that 'mode' trumps all, and if the user changes the mode, conflicting values should be cleared or reset. Otherwise userspace has to duplicate a lot of kernel logic/validation. For example:
1) set mode to ROUNDROBIN
2) setarp_interval
3) set mode to ALB or TLB
4) FAIL - incompatible witharp_interval
5) ok, setarp_intervalto zero
6) set mode to ALB or TLB
7) SUCCESSWouldn't it be nice if the kernel handled clearing
arp_intervalfor us, since it knows thatarp_intervalis incompatible with ALB/TLB...Could be done separately. I have no objection to Ding's patch other than "life could be even better".
Quoted 8 lines
Quoted 1 line
Dan
Nik was actually planning to work on a pretty significant rewrite of the code that handles setting and clearing of different config options, but I have not seen him chime in on this thread yet.
Nik, anything you can share on this or are you still a bit away from coming up with a design and implementation?
Oops sorry, it seems I've missed this thread and saw it just now. I'm working on the new option code, but it's far from ready yet. I personally don't mind for such patch to go in *now*, I can always re-work it once net-next opens up.
Cheers,
Nik
Re: [PATCH net v2] bonding: disable arp and enable mii monitoring when bond change to no uses arp mode
In reply to Ding TianhongQuoted 34 lines · Ding Tianhong
Because the ARP monitoring is not support for 802.3ad, but I still could change the mode to 802.3ad from ab mode while ARP monitoring is running, it is incorrect.
So add a check for 802.3ad in
bonding_store_modeto fix the problem, and make a new macroBOND_NO_USES_ARP()to simplify the code.v2: according to the Dan Williams's suggestion, bond mode is the most
important bond option, it should override any of the other sub-options. So when the mode is changed, the conficting values should be cleared or reset, otherwise the user has to duplicate more operations to modify the logic. I disable the arp and enable mii monitoring when the bond mode is changed to AB, TB and 8023AD if the arp interval is true.Suggested-by Dan Williams <[email protected]>Signed-off-by Ding Tianhong <[email protected]>--- drivers/net/bonding/bond_options.c | 13 +++++++++---- drivers/net/bonding/bonding.h | 5 +++++ 2 files changed, 14 insertions(+), 4 deletions(-)drivers/net/bonding/bond_options.c +1
-4@@ -45,10 +45,15 @@ int bond_option_mode_set(struct bonding *bond, int mode)return -EPERM ; } -if (BOND_MODE_IS_LB (mode) && bond->params.arp_interval) { -pr_err ("%s: %s mode is incompatible with arp monitoring.\n" , - bond->dev->name, bond_mode_tbl[mode].modename); -return -EINVAL ; +if (BOND_NO_USES_ARP (mode) && bond->params.arp_interval) {
drivers/net/bonding/bond_options.c int bond_option_mode_set(struct bonding *bond, int mode) · line 58
Quoted 10 lines
drivers/net/bonding/bond_options.c +8
-0+pr_info ("%s: %s mode is incompatible with arp monitoring, start mii monitoring\n" , + bond->dev->name, bond_mode_tbl[mode].modename); +/* disable arp monitoring */ + bond->params.arp_interval =0 ; +/* set miimon to default value */ + bond->params.miimon =100 ; +pr_info ("%s: Setting MII monitoring interval to %d.\n" , + bond->dev->name, bond->params.miimon); }
Maybe define the "default" miimon value somewhere ? A value of 100 for miimon is used repeatedly in bond_check_params() as well, it'd be nice to give it a name, e.g. I had to grep around to see why you chose 100 to be that value.
Quoted 8 lines
drivers/net/bonding/bond_options.c +0
-0/* don't cache arp_validate between modes */ drivers/net/bonding/bonding.h +0
-0@@ -55,6 +55,11 @@ ((mode) == BOND_MODE_TLB) || \
drivers/net/bonding/bonding.h line 65
Quoted 10 lines
drivers/net/bonding/bonding.h +5
-0((mode) == BOND_MODE_ALB)) +#define BOND_NO_USES_ARP (mode) \ + (((mode) == BOND_MODE_8023AD) || \ + ((mode) == BOND_MODE_TLB) || \ + ((mode) == BOND_MODE_ALB)) +#define TX_QUEUE_OVERRIDE (mode) \ (((mode) == BOND_MODE_ACTIVEBACKUP) || \ ((mode) == BOND_MODE_ROUNDROBIN))
One small note, you can save a few lines in bond_sysfs.c if you switch the check in bonding_store_arp_interval() to the new macro BOND_NO_USES_ARP() as it's identical.
Cheers,
Nik
Re: [PATCH net v2] bonding: disable arp and enable mii monitoring when bond change to no uses arp mode
Quoted 40 lines · Nikolay Aleksandrov
Quoted 39 lines · Ding Tianhong
Because the ARP monitoring is not support for 802.3ad, but I still could change the mode to 802.3ad from ab mode while ARP monitoring is running, it is incorrect.
So add a check for 802.3ad in
bonding_store_modeto fix the problem, and make a new macroBOND_NO_USES_ARP()to simplify the code.v2: according to the Dan Williams's suggestion, bond mode is the most
important bond option, it should override any of the other sub-options. So when the mode is changed, the conficting values should be cleared or reset, otherwise the user has to duplicate more operations to modify the logic. I disable the arp and enable mii monitoring when the bond mode is changed to AB, TB and 8023AD if the arp interval is true.Suggested-by Dan Williams <[email protected]>Signed-off-by Ding Tianhong <[email protected]>--- drivers/net/bonding/bond_options.c | 13 +++++++++---- drivers/net/bonding/bonding.h | 5 +++++ 2 files changed, 14 insertions(+), 4 deletions(-)drivers/net/bonding/bond_options.c +6
-4@@ -45,10 +45,15 @@ int bond_option_mode_set(struct bonding *bond, int mode)return -EPERM ; } -if (BOND_MODE_IS_LB (mode) && bond->params.arp_interval) { -pr_err ("%s: %s mode is incompatible with arp monitoring.\n" , - bond->dev->name, bond_mode_tbl[mode].modename); -return -EINVAL ; +if (BOND_NO_USES_ARP (mode) && bond->params.arp_interval) { +pr_info ("%s: %s mode is incompatible with arp monitoring, start mii monitoring\n" , + bond->dev->name, bond_mode_tbl[mode].modename); +/* disable arp monitoring */ + bond->params.arp_interval =0 ; +/* set miimon to default value */
Quoted 9 lines
drivers/net/bonding/bond_options.c int bond_option_mode_set(struct bonding *bond, int mode) · line 58
Quoted 5 lines
drivers/net/bonding/bond_options.c +3
-0+ bond->params.miimon =100 ; +pr_info ("%s: Setting MII monitoring interval to %d.\n" , + bond->dev->name, bond->params.miimon); }Maybe define the "default" miimon value somewhere ? A value of 100 for miimon is used repeatedly in
bond_check_params()as well, it'd be nice to give it a name, e.g. I had to grep around to see why you chose 100 to be that value.
yes, I get it from bond_check_params(), I think it is time to give it a new name, MIIMON_DEFAULT_VALUE = 100.
Quoted 22 lines
Quoted 8 lines
drivers/net/bonding/bond_options.c +0
-0/* don't cache arp_validate between modes */ drivers/net/bonding/bonding.h +0
-0@@ -55,6 +55,11 @@ ((mode) == BOND_MODE_TLB) || \drivers/net/bonding/bonding.h line 65
Quoted 10 lines
drivers/net/bonding/bonding.h +5
-0((mode) == BOND_MODE_ALB)) +#define BOND_NO_USES_ARP (mode) \ + (((mode) == BOND_MODE_8023AD) || \ + ((mode) == BOND_MODE_TLB) || \ + ((mode) == BOND_MODE_ALB)) +#define TX_QUEUE_OVERRIDE (mode) \ (((mode) == BOND_MODE_ACTIVEBACKUP) || \ ((mode) == BOND_MODE_ROUNDROBIN))One small note, you can save a few lines in
bond_sysfs.cif you switch the check inbonding_store_arp_interval()to the new macroBOND_NO_USES_ARP()as it's identical.
Quoted 2 lines
Cheers,
Nik
good idea.
Regards.
Ding
Quoted 4 lines
.
PATCH v3 1/1 bonding: disable arp and enable mii monitoring when bond change to no uses arp mode
In reply to Andy GospodarekBecause the ARP monitoring is not support for 802.3ad, but I still could change the mode to 802.3ad from ab mode while ARP monitoring is running, it is incorrect.
So add a check for 802.3ad in bonding_store_mode to fix the problem, and make a new macro BOND_NO_USES_ARP() to simplify the code.
v2: according to the Dan Williams's suggestion, bond mode is the most
important bond option, it should override any of the other sub-options. So when the mode is changed, the conficting values should be cleared or reset, otherwise the user has to duplicate more operations to modify the logic. I disable the arp and enable mii monitoring when the bond mode is changed to AB, TB and 8023AD if the arp interval is true.
v3: according to the Nik's suggestion, the default value of miimon should need
a name, there is several place to use it, and the bond_store_arp_interval() could use micro BOND_NO_USES_ARP to make the code more simpify.
--- drivers/net/bonding/bond_main.c | 4 ++-- drivers/net/bonding/bond_options.c | 13 +++++++++---- drivers/net/bonding/bond_sysfs.c | 4 +--- drivers/net/bonding/bonding.h | 7 +++++++ 4 files changed, 19 insertions(+), 9 deletions(-)
drivers/net/bonding/bond_main.c +2 -2
@@ -4110,7 +4110,7 @@ static int bond_check_params(struct bond_params *params)if (!miimon) {pr_warning ("Warning: miimon must be specified, otherwise bonding will not detect link failure, speed and duplex which are essential for 802.3ad operation\n" );pr_warning ("Forcing miimon to 100msec\n" ); - miimon =100 ; + miimon =BOND_DEFAULT_MIIMON ; } }
@@ -4147,7 +4147,7 @@ static int bond_check_params(struct bond_params *params)if (!miimon) {pr_warning ("Warning: miimon must be specified, otherwise bonding will not detect link failure and link speed which are essential for TLB/ALB load balancing\n" );pr_warning ("Forcing miimon to 100msec\n" ); - miimon =100 ; + miimon =BOND_DEFAULT_MIIMON ; } }
drivers/net/bonding/bond_options.c +9 -4
@@ -45,10 +45,15 @@ int bond_option_mode_set(struct bonding *bond, int mode)return -EPERM ; } -if (BOND_MODE_IS_LB (mode) && bond->params.arp_interval) { -pr_err ("%s: %s mode is incompatible with arp monitoring.\n" , - bond->dev->name, bond_mode_tbl[mode].modename); -return -EINVAL ; +if (BOND_NO_USES_ARP (mode) && bond->params.arp_interval) { +pr_info ("%s: %s mode is incompatible with arp monitoring, start mii monitoring\n" , + bond->dev->name, bond_mode_tbl[mode].modename); +/* disable arp monitoring */ + bond->params.arp_interval =0 ; +/* set miimon to default value */ + bond->params.miimon =BOND_DEFAULT_MIIMON ; +pr_info ("%s: Setting MII monitoring interval to %d.\n" , + bond->dev->name, bond->params.miimon); }/* don't cache arp_validate between modes */
drivers/net/bonding/bond_sysfs.c +1 -3
@@ -523,9 +523,7 @@ static ssize_t bonding_store_arp_interval(struct device *d, ret = -EINVAL ; goto out; } -if (bond->params.mode ==BOND_MODE_ALB || - bond->params.mode ==BOND_MODE_TLB || - bond->params.mode ==BOND_MODE_8023AD ) { +if (BOND_NO_USES_ARP (bond->params.mode)) {pr_info ("%s: ARP monitoring cannot be used with ALB/TLB/802.3ad. Only MII monitoring is supported on %s.\n" , bond->dev->name, bond->dev->name); ret = -EINVAL ;
drivers/net/bonding/bonding.h +7 -0
@@ -35,6 +35,8 @@#define BOND_MAX_ARP_TARGETS 16 +#define BOND_DEFAULT_MIIMON 100 +#define IS_UP (dev) \ ((((dev)->flags & IFF_UP) == IFF_UP) && \ netif_running(dev) && \
@@ -55,6 +57,11 @@ ((mode) == BOND_MODE_TLB) || \ ((mode) == BOND_MODE_ALB)) +#define BOND_NO_USES_ARP (mode) \ + (((mode) == BOND_MODE_8023AD) || \ + ((mode) == BOND_MODE_TLB) || \ + ((mode) == BOND_MODE_ALB)) +#define TX_QUEUE_OVERRIDE (mode) \ (((mode) == BOND_MODE_ACTIVEBACKUP) || \ ((mode) == BOND_MODE_ROUNDROBIN))
Signature · 1 line
1.8.0
Re: [PATCH net v3] bonding: disable arp and enable mii monitoring when bond change to no uses arp mode
Quoted 6 lines · Ding Tianhong
Because the ARP monitoring is not support for 802.3ad, but I still could change the mode to 802.3ad from ab mode while ARP monitoring is running, it is incorrect.
So add a check for 802.3ad in
bonding_store_modeto fix the problem, and make a new macroBOND_NO_USES_ARP()to simplify the code.
Excellent, that's exactly what I was thinking of. Thanks!
Dan
Quoted 107 lines
v2: according to the Dan Williams's suggestion, bond mode is the most
important bond option, it should override any of the other sub-options. So when the mode is changed, the conficting values should be cleared or reset, otherwise the user has to duplicate more operations to modify the logic. I disable the arp and enable mii monitoring when the bond mode is changed to AB, TB and 8023AD if the arp interval is true.v3: according to the Nik's suggestion, the default value of miimon should need
a name, there is several place to use it, and thebond_store_arp_interval()could use microBOND_NO_USES_ARPto make the code more simpify.Suggested-by Dan Williams <[email protected]>Suggested-by Nikolay Aleksandrov <[email protected]>Signed-off-by Ding Tianhong <[email protected]>--- drivers/net/bonding/bond_main.c | 4 ++-- drivers/net/bonding/bond_options.c | 13 +++++++++---- drivers/net/bonding/bond_sysfs.c | 4 +--- drivers/net/bonding/bonding.h | 7 +++++++ 4 files changed, 19 insertions(+), 9 deletions(-)drivers/net/bonding/bond_main.c +2
-2@@ -4110,7 +4110,7 @@ static int bond_check_params(struct bond_params *params)if (!miimon) {pr_warning ("Warning: miimon must be specified, otherwise bonding will not detect link failure, speed and duplex which are essential for 802.3ad operation\n" );pr_warning ("Forcing miimon to 100msec\n" ); - miimon =100 ; + miimon =BOND_DEFAULT_MIIMON ; } }@@ -4147,7 +4147,7 @@ static int bond_check_params(struct bond_params *params)if (!miimon) {pr_warning ("Warning: miimon must be specified, otherwise bonding will not detect link failure and link speed which are essential for TLB/ALB load balancing\n" );pr_warning ("Forcing miimon to 100msec\n" ); - miimon =100 ; + miimon =BOND_DEFAULT_MIIMON ; } }drivers/net/bonding/bond_options.c +9
-4@@ -45,10 +45,15 @@ int bond_option_mode_set(struct bonding *bond, int mode)return -EPERM ; } -if (BOND_MODE_IS_LB (mode) && bond->params.arp_interval) { -pr_err ("%s: %s mode is incompatible with arp monitoring.\n" , - bond->dev->name, bond_mode_tbl[mode].modename); -return -EINVAL ; +if (BOND_NO_USES_ARP (mode) && bond->params.arp_interval) { +pr_info ("%s: %s mode is incompatible with arp monitoring, start mii monitoring\n" , + bond->dev->name, bond_mode_tbl[mode].modename); +/* disable arp monitoring */ + bond->params.arp_interval =0 ; +/* set miimon to default value */ + bond->params.miimon =BOND_DEFAULT_MIIMON ; +pr_info ("%s: Setting MII monitoring interval to %d.\n" , + bond->dev->name, bond->params.miimon); }/* don't cache arp_validate between modes */ drivers/net/bonding/bond_sysfs.c +1
-3@@ -523,9 +523,7 @@ static ssize_t bonding_store_arp_interval(struct device *d, ret = -EINVAL ; goto out; } -if (bond->params.mode ==BOND_MODE_ALB || - bond->params.mode ==BOND_MODE_TLB || - bond->params.mode ==BOND_MODE_8023AD ) { +if (BOND_NO_USES_ARP (bond->params.mode)) {pr_info ("%s: ARP monitoring cannot be used with ALB/TLB/802.3ad. Only MII monitoring is supported on %s.\n" , bond->dev->name, bond->dev->name); ret = -EINVAL ;drivers/net/bonding/bonding.h +7
-0@@ -35,6 +35,8 @@#define BOND_MAX_ARP_TARGETS 16 +#define BOND_DEFAULT_MIIMON 100 +#define IS_UP (dev) \ ((((dev)->flags & IFF_UP) == IFF_UP) && \ netif_running(dev) && \@@ -55,6 +57,11 @@ ((mode) == BOND_MODE_TLB) || \ ((mode) == BOND_MODE_ALB)) +#define BOND_NO_USES_ARP (mode) \ + (((mode) == BOND_MODE_8023AD) || \ + ((mode) == BOND_MODE_TLB) || \ + ((mode) == BOND_MODE_ALB)) +#define TX_QUEUE_OVERRIDE (mode) \ (((mode) == BOND_MODE_ACTIVEBACKUP) || \ ((mode) == BOND_MODE_ROUNDROBIN))
Re: [PATCH net v3] bonding: disable arp and enable mii monitoring when bond change to no uses arp mode
In reply to Ding TianhongQuoted 14 lines · Ding Tianhong
Because the ARP monitoring is not support for 802.3ad, but I still could change the mode to 802.3ad from ab mode while ARP monitoring is running, it is incorrect.
So add a check for 802.3ad in
bonding_store_modeto fix the problem, and make a new macroBOND_NO_USES_ARP()to simplify the code.v2: according to the Dan Williams's suggestion, bond mode is the most
important bond option, it should override any of the other sub-options. So when the mode is changed, the conficting values should be cleared or reset, otherwise the user has to duplicate more operations to modify the logic. I disable the arp and enable mii monitoring when the bond mode is changed to AB, TB and 8023AD if the arp interval is true.
Quoted 8 lines
v3: according to the Nik's suggestion, the default value of miimon should need
a name, there is several place to use it, and thebond_store_arp_interval()could use microBOND_NO_USES_ARPto make the code more simpify.Suggested-by Dan Williams <[email protected]>Suggested-by Nikolay Aleksandrov <[email protected]>Signed-off-by Ding Tianhong <[email protected]>---
Re: [PATCH net v3] bonding: disable arp and enable mii monitoring when bond change to no uses arp mode
In reply to Ding TianhongFrom: Ding Tianhong <[email protected]>
Date: Fri, 22 Nov 2013 22:28:43 +0800
Quoted 14 lines
Because the ARP monitoring is not support for 802.3ad, but I still could change the mode to 802.3ad from ab mode while ARP monitoring is running, it is incorrect.
So add a check for 802.3ad in
bonding_store_modeto fix the problem, and make a new macroBOND_NO_USES_ARP()to simplify the code.v2: according to the Dan Williams's suggestion, bond mode is the most
important bond option, it should override any of the other sub-options. So when the mode is changed, the conficting values should be cleared or reset, otherwise the user has to duplicate more operations to modify the logic. I disable the arp and enable mii monitoring when the bond mode is changed to AB, TB and 8023AD if the arp interval is true.
Quoted 7 lines
v3: according to the Nik's suggestion, the default value of miimon should need
a name, there is several place to use it, and thebond_store_arp_interval()could use microBOND_NO_USES_ARPto make the code more simpify.Suggested-by Dan Williams <[email protected]>Suggested-by Nikolay Aleksandrov <[email protected]>Signed-off-by Ding Tianhong <[email protected]>
Applied, thanks for following up on this Ding.