Skip to content

Commit 2fd527b

Browse files
pmachatadavem330
authored andcommitted
net: ndo_bridge_setlink: Add extack
Drivers may not be able to implement a VLAN addition or reconfiguration. In those cases it's desirable to explain to the user that it was rejected (and why). To that end, add extack argument to ndo_bridge_setlink. Adapt all users to that change. Following patches will use the new argument in the bridge driver. Signed-off-by: Petr Machata <petrm@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 351cbde commit 2fd527b

9 files changed

Lines changed: 20 additions & 11 deletions

File tree

‎drivers/net/ethernet/broadcom/bnxt/bnxt.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9618,7 +9618,7 @@ static int bnxt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
96189618
}
96199619

96209620
static int bnxt_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh,
9621-
u16 flags)
9621+
u16 flags, struct netlink_ext_ack *extack)
96229622
{
96239623
struct bnxt *bp = netdev_priv(dev);
96249624
struct nlattr *attr, *br_spec;

‎drivers/net/ethernet/emulex/benet/be_main.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4955,7 +4955,7 @@ int be_load_fw(struct be_adapter *adapter, u8 *fw_file)
49554955
}
49564956

49574957
static int be_ndo_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh,
4958-
u16 flags)
4958+
u16 flags, struct netlink_ext_ack *extack)
49594959
{
49604960
struct be_adapter *adapter = netdev_priv(dev);
49614961
struct nlattr *attr, *br_spec;

‎drivers/net/ethernet/intel/i40e/i40e_main.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11685,6 +11685,7 @@ static int i40e_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
1168511685
* @dev: the netdev being configured
1168611686
* @nlh: RTNL message
1168711687
* @flags: bridge flags
11688+
* @extack: netlink extended ack
1168811689
*
1168911690
* Inserts a new hardware bridge if not already created and
1169011691
* enables the bridging mode requested (VEB or VEPA). If the
@@ -11697,7 +11698,8 @@ static int i40e_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
1169711698
**/
1169811699
static int i40e_ndo_bridge_setlink(struct net_device *dev,
1169911700
struct nlmsghdr *nlh,
11700-
u16 flags)
11701+
u16 flags,
11702+
struct netlink_ext_ack *extack)
1170111703
{
1170211704
struct i40e_netdev_priv *np = netdev_priv(dev);
1170311705
struct i40e_vsi *vsi = np->vsi;

‎drivers/net/ethernet/intel/ice/ice_main.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3624,6 +3624,7 @@ static int ice_vsi_update_bridge_mode(struct ice_vsi *vsi, u16 bmode)
36243624
* @dev: the netdev being configured
36253625
* @nlh: RTNL message
36263626
* @flags: bridge setlink flags
3627+
* @extack: netlink extended ack
36273628
*
36283629
* Sets the bridge mode (VEB/VEPA) of the switch to which the netdev (VSI) is
36293630
* hooked up to. Iterates through the PF VSI list and sets the loopback mode (if
@@ -3632,7 +3633,7 @@ static int ice_vsi_update_bridge_mode(struct ice_vsi *vsi, u16 bmode)
36323633
*/
36333634
static int
36343635
ice_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh,
3635-
u16 __always_unused flags)
3636+
u16 __always_unused flags, struct netlink_ext_ack *extack)
36363637
{
36373638
struct ice_netdev_priv *np = netdev_priv(dev);
36383639
struct ice_pf *pf = np->vsi->back;

‎drivers/net/ethernet/intel/ixgbe/ixgbe_main.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9979,7 +9979,8 @@ static int ixgbe_configure_bridge_mode(struct ixgbe_adapter *adapter,
99799979
}
99809980

99819981
static int ixgbe_ndo_bridge_setlink(struct net_device *dev,
9982-
struct nlmsghdr *nlh, u16 flags)
9982+
struct nlmsghdr *nlh, u16 flags,
9983+
struct netlink_ext_ack *extack)
99839984
{
99849985
struct ixgbe_adapter *adapter = netdev_priv(dev);
99859986
struct nlattr *attr, *br_spec;

‎include/linux/netdevice.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,7 @@ struct dev_ifalias {
11651165
* entries to skb and update idx with the number of entries.
11661166
*
11671167
* int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh,
1168-
* u16 flags)
1168+
* u16 flags, struct netlink_ext_ack *extack)
11691169
* int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq,
11701170
* struct net_device *dev, u32 filter_mask,
11711171
* int nlflags)
@@ -1390,7 +1390,8 @@ struct net_device_ops {
13901390

13911391
int (*ndo_bridge_setlink)(struct net_device *dev,
13921392
struct nlmsghdr *nlh,
1393-
u16 flags);
1393+
u16 flags,
1394+
struct netlink_ext_ack *extack);
13941395
int (*ndo_bridge_getlink)(struct sk_buff *skb,
13951396
u32 pid, u32 seq,
13961397
struct net_device *dev,

‎net/bridge/br_netlink.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,8 @@ static int br_setport(struct net_bridge_port *p, struct nlattr *tb[])
850850
}
851851

852852
/* Change state and parameters on port. */
853-
int br_setlink(struct net_device *dev, struct nlmsghdr *nlh, u16 flags)
853+
int br_setlink(struct net_device *dev, struct nlmsghdr *nlh, u16 flags,
854+
struct netlink_ext_ack *extack)
854855
{
855856
struct net_bridge *br = (struct net_bridge *)netdev_priv(dev);
856857
struct nlattr *tb[IFLA_BRPORT_MAX + 1];

‎net/bridge/br_private.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,8 @@ int br_netlink_init(void);
11381138
void br_netlink_fini(void);
11391139
void br_ifinfo_notify(int event, const struct net_bridge *br,
11401140
const struct net_bridge_port *port);
1141-
int br_setlink(struct net_device *dev, struct nlmsghdr *nlmsg, u16 flags);
1141+
int br_setlink(struct net_device *dev, struct nlmsghdr *nlmsg, u16 flags,
1142+
struct netlink_ext_ack *extack);
11421143
int br_dellink(struct net_device *dev, struct nlmsghdr *nlmsg, u16 flags);
11431144
int br_getlink(struct sk_buff *skb, u32 pid, u32 seq, struct net_device *dev,
11441145
u32 filter_mask, int nlflags);

‎net/core/rtnetlink.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4332,7 +4332,8 @@ static int rtnl_bridge_setlink(struct sk_buff *skb, struct nlmsghdr *nlh,
43324332
goto out;
43334333
}
43344334

4335-
err = br_dev->netdev_ops->ndo_bridge_setlink(dev, nlh, flags);
4335+
err = br_dev->netdev_ops->ndo_bridge_setlink(dev, nlh, flags,
4336+
extack);
43364337
if (err)
43374338
goto out;
43384339

@@ -4344,7 +4345,8 @@ static int rtnl_bridge_setlink(struct sk_buff *skb, struct nlmsghdr *nlh,
43444345
err = -EOPNOTSUPP;
43454346
else
43464347
err = dev->netdev_ops->ndo_bridge_setlink(dev, nlh,
4347-
flags);
4348+
flags,
4349+
extack);
43484350
if (!err) {
43494351
flags &= ~BRIDGE_FLAGS_SELF;
43504352

0 commit comments

Comments
 (0)