From: David Ahern <dsahern@gmail.com>
To: netdev@vger.kernel.org
Cc: j.vosburgh@gmail.com, bridge@lists.linux-foundation.org,
idosch@mellanox.com, jiri@mellanox.com, vfalico@gmail.com,
David Ahern <dsahern@gmail.com>,
davem@davemloft.net
Subject: [Bridge] [PATCH net-next 5/7] net: bonding: Add extack messages for some enslave failures
Date: Tue, 3 Oct 2017 21:58:52 -0700 [thread overview]
Message-ID: <1507093134-20406-6-git-send-email-dsahern@gmail.com> (raw)
In-Reply-To: <1507093134-20406-1-git-send-email-dsahern@gmail.com>
A number of bond_enslave errors are logged using the netdev_err API.
Return those messages to userspace via the extack facility.
Signed-off-by: David Ahern <dsahern@gmail.com>
---
drivers/net/bonding/bond_main.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index bc92307c2082..6688dc9154e0 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1348,12 +1348,15 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
/* already in-use? */
if (netdev_is_rx_handler_busy(slave_dev)) {
+ NL_SET_ERR_MSG(extack,
+ "Device is in use and cannot be enslaved");
netdev_err(bond_dev,
"Error: Device is in use and cannot be enslaved\n");
return -EBUSY;
}
if (bond_dev == slave_dev) {
+ NL_SET_ERR_MSG(extack, "Cannot enslave bond to itself.");
netdev_err(bond_dev, "cannot enslave bond to itself.\n");
return -EPERM;
}
@@ -1364,6 +1367,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
netdev_dbg(bond_dev, "%s is NETIF_F_VLAN_CHALLENGED\n",
slave_dev->name);
if (vlan_uses_dev(bond_dev)) {
+ NL_SET_ERR_MSG(extack,
+ "Can not enslave VLAN challenged device to VLAN enabled bond");
netdev_err(bond_dev, "Error: cannot enslave VLAN challenged slave %s on VLAN enabled bond %s\n",
slave_dev->name, bond_dev->name);
return -EPERM;
@@ -1383,6 +1388,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
* enslaving it; the old ifenslave will not.
*/
if (slave_dev->flags & IFF_UP) {
+ NL_SET_ERR_MSG(extack, "Device can not be enslaved while up");
netdev_err(bond_dev, "%s is up - this may be due to an out of date ifenslave\n",
slave_dev->name);
return -EPERM;
@@ -1423,6 +1429,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
bond_dev);
}
} else if (bond_dev->type != slave_dev->type) {
+ NL_SET_ERR_MSG(extack,
+ "Device type is different from other slaves");
netdev_err(bond_dev, "%s ether type (%d) is different from other slaves (%d), can not enslave it\n",
slave_dev->name, slave_dev->type, bond_dev->type);
return -EINVAL;
@@ -1430,6 +1438,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
if (slave_dev->type == ARPHRD_INFINIBAND &&
BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) {
+ NL_SET_ERR_MSG(extack,
+ "Only active-backup mode is supported for infiniband slaves");
netdev_warn(bond_dev, "Type (%d) supports only active-backup mode\n",
slave_dev->type);
res = -EOPNOTSUPP;
@@ -1445,6 +1455,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
bond->params.fail_over_mac = BOND_FOM_ACTIVE;
netdev_warn(bond_dev, "Setting fail_over_mac to active for active-backup mode\n");
} else {
+ NL_SET_ERR_MSG(extack,
+ "Slave device does not support setting the MAC address, but fail_over_mac is not set to active");
netdev_err(bond_dev, "The slave device specified does not support setting the MAC address, but fail_over_mac is not set to active\n");
res = -EOPNOTSUPP;
goto err_undo_flags;
--
2.1.4
WARNING: multiple messages have this Message-ID (diff)
From: David Ahern <dsahern@gmail.com>
To: netdev@vger.kernel.org
Cc: j.vosburgh@gmail.com, vfalico@gmail.com, andy@greyhouse.net,
jiri@mellanox.com, idosch@mellanox.com, davem@davemloft.net,
bridge@lists.linux-foundation.org,
David Ahern <dsahern@gmail.com>
Subject: [PATCH net-next 5/7] net: bonding: Add extack messages for some enslave failures
Date: Tue, 3 Oct 2017 21:58:52 -0700 [thread overview]
Message-ID: <1507093134-20406-6-git-send-email-dsahern@gmail.com> (raw)
In-Reply-To: <1507093134-20406-1-git-send-email-dsahern@gmail.com>
A number of bond_enslave errors are logged using the netdev_err API.
Return those messages to userspace via the extack facility.
Signed-off-by: David Ahern <dsahern@gmail.com>
---
drivers/net/bonding/bond_main.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index bc92307c2082..6688dc9154e0 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1348,12 +1348,15 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
/* already in-use? */
if (netdev_is_rx_handler_busy(slave_dev)) {
+ NL_SET_ERR_MSG(extack,
+ "Device is in use and cannot be enslaved");
netdev_err(bond_dev,
"Error: Device is in use and cannot be enslaved\n");
return -EBUSY;
}
if (bond_dev == slave_dev) {
+ NL_SET_ERR_MSG(extack, "Cannot enslave bond to itself.");
netdev_err(bond_dev, "cannot enslave bond to itself.\n");
return -EPERM;
}
@@ -1364,6 +1367,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
netdev_dbg(bond_dev, "%s is NETIF_F_VLAN_CHALLENGED\n",
slave_dev->name);
if (vlan_uses_dev(bond_dev)) {
+ NL_SET_ERR_MSG(extack,
+ "Can not enslave VLAN challenged device to VLAN enabled bond");
netdev_err(bond_dev, "Error: cannot enslave VLAN challenged slave %s on VLAN enabled bond %s\n",
slave_dev->name, bond_dev->name);
return -EPERM;
@@ -1383,6 +1388,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
* enslaving it; the old ifenslave will not.
*/
if (slave_dev->flags & IFF_UP) {
+ NL_SET_ERR_MSG(extack, "Device can not be enslaved while up");
netdev_err(bond_dev, "%s is up - this may be due to an out of date ifenslave\n",
slave_dev->name);
return -EPERM;
@@ -1423,6 +1429,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
bond_dev);
}
} else if (bond_dev->type != slave_dev->type) {
+ NL_SET_ERR_MSG(extack,
+ "Device type is different from other slaves");
netdev_err(bond_dev, "%s ether type (%d) is different from other slaves (%d), can not enslave it\n",
slave_dev->name, slave_dev->type, bond_dev->type);
return -EINVAL;
@@ -1430,6 +1438,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
if (slave_dev->type == ARPHRD_INFINIBAND &&
BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) {
+ NL_SET_ERR_MSG(extack,
+ "Only active-backup mode is supported for infiniband slaves");
netdev_warn(bond_dev, "Type (%d) supports only active-backup mode\n",
slave_dev->type);
res = -EOPNOTSUPP;
@@ -1445,6 +1455,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
bond->params.fail_over_mac = BOND_FOM_ACTIVE;
netdev_warn(bond_dev, "Setting fail_over_mac to active for active-backup mode\n");
} else {
+ NL_SET_ERR_MSG(extack,
+ "Slave device does not support setting the MAC address, but fail_over_mac is not set to active");
netdev_err(bond_dev, "The slave device specified does not support setting the MAC address, but fail_over_mac is not set to active\n");
res = -EOPNOTSUPP;
goto err_undo_flags;
--
2.1.4
next prev parent reply other threads:[~2017-10-04 4:58 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-04 4:58 [Bridge] [PATCH net-next 0/7] net: Plumb extack error reporting to enslavements David Ahern
2017-10-04 4:58 ` David Ahern
2017-10-04 4:58 ` [Bridge] [PATCH net-next 1/7] net: Add extack to netdev_notifier_info David Ahern
2017-10-04 4:58 ` David Ahern
2017-10-04 4:58 ` [Bridge] [PATCH net-next 2/7] net: Add extack to ndo_add_slave David Ahern
2017-10-04 4:58 ` David Ahern
2017-10-04 4:58 ` [Bridge] [PATCH net-next 3/7] net: Add extack to upper device linking David Ahern
2017-10-04 4:58 ` David Ahern
2017-10-04 4:58 ` [Bridge] [PATCH net-next 4/7] net: vrf: Add extack messages for enslave errors David Ahern
2017-10-04 4:58 ` David Ahern
2017-10-04 4:58 ` David Ahern [this message]
2017-10-04 4:58 ` [PATCH net-next 5/7] net: bonding: Add extack messages for some enslave failures David Ahern
2017-10-04 6:38 ` Jiri Pirko
2017-10-04 15:35 ` [Bridge] " David Ahern
2017-10-04 15:35 ` David Ahern
2017-10-04 18:04 ` Jiri Pirko
2017-10-04 18:06 ` [Bridge] " David Ahern
2017-10-04 18:06 ` David Ahern
2017-10-04 18:39 ` Jiri Pirko
2017-10-04 4:58 ` [Bridge] [PATCH net-next 6/7] net: bridge: Pass extack to down to netdev_master_upper_dev_link David Ahern
2017-10-04 4:58 ` David Ahern
2017-10-04 15:13 ` [Bridge] " Stephen Hemminger
2017-10-04 15:13 ` Stephen Hemminger
2017-10-04 16:16 ` [Bridge] " David Ahern
2017-10-04 16:16 ` David Ahern
2017-10-04 4:58 ` [Bridge] [PATCH net-next 7/7] mlxsw: spectrum: Add extack messages for enslave failures David Ahern
2017-10-04 4:58 ` David Ahern
2017-10-04 13:24 ` [Bridge] " Ido Schimmel
2017-10-04 13:24 ` Ido Schimmel
2017-10-04 15:44 ` [Bridge] " David Ahern
2017-10-04 15:44 ` David Ahern
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=1507093134-20406-6-git-send-email-dsahern@gmail.com \
--to=dsahern@gmail.com \
--cc=bridge@lists.linux-foundation.org \
--cc=davem@davemloft.net \
--cc=idosch@mellanox.com \
--cc=j.vosburgh@gmail.com \
--cc=jiri@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=vfalico@gmail.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 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.