Commit 2c3c031c authored by Scott Feldman's avatar Scott Feldman Committed by David S. Miller

bridge: add brport flags to dflt bridge_getlink

To allow brport device to return current brport flags set on port.  Add
returned flags to nested IFLA_PROTINFO netlink msg built in dflt getlink.
With this change, netlink msg returned for bridge_getlink contains the port's
offloaded flag settings (the port's SELF settings).
Signed-off-by: default avatarScott Feldman <sfeldma@gmail.com>
Signed-off-by: default avatarJiri Pirko <jiri@resnulli.us>
Acked-by: default avatarAndy Gospodarek <gospo@cumulusnetworks.com>
Acked-by: default avatarThomas Graf <tgraf@suug.ch>
Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 345cd494
...@@ -4367,7 +4367,8 @@ static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, ...@@ -4367,7 +4367,8 @@ static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
return ndo_dflt_bridge_getlink(skb, pid, seq, dev, return ndo_dflt_bridge_getlink(skb, pid, seq, dev,
hsw_mode == PORT_FWD_TYPE_VEPA ? hsw_mode == PORT_FWD_TYPE_VEPA ?
BRIDGE_MODE_VEPA : BRIDGE_MODE_VEB); BRIDGE_MODE_VEPA : BRIDGE_MODE_VEB,
0, 0);
} }
#ifdef CONFIG_BE2NET_VXLAN #ifdef CONFIG_BE2NET_VXLAN
......
...@@ -7778,7 +7778,7 @@ static int ixgbe_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, ...@@ -7778,7 +7778,7 @@ static int ixgbe_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
else else
mode = BRIDGE_MODE_VEPA; mode = BRIDGE_MODE_VEPA;
return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode); return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0);
} }
static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev) static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev)
......
...@@ -103,5 +103,6 @@ extern int ndo_dflt_fdb_del(struct ndmsg *ndm, ...@@ -103,5 +103,6 @@ extern int ndo_dflt_fdb_del(struct ndmsg *ndm,
u16 vid); u16 vid);
extern int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, extern int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
struct net_device *dev, u16 mode); struct net_device *dev, u16 mode,
u32 flags, u32 mask);
#endif /* __LINUX_RTNETLINK_H */ #endif /* __LINUX_RTNETLINK_H */
...@@ -2687,12 +2687,22 @@ static int rtnl_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -2687,12 +2687,22 @@ static int rtnl_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb)
return skb->len; return skb->len;
} }
static int brport_nla_put_flag(struct sk_buff *skb, u32 flags, u32 mask,
unsigned int attrnum, unsigned int flag)
{
if (mask & flag)
return nla_put_u8(skb, attrnum, !!(flags & flag));
return 0;
}
int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
struct net_device *dev, u16 mode) struct net_device *dev, u16 mode,
u32 flags, u32 mask)
{ {
struct nlmsghdr *nlh; struct nlmsghdr *nlh;
struct ifinfomsg *ifm; struct ifinfomsg *ifm;
struct nlattr *br_afspec; struct nlattr *br_afspec;
struct nlattr *protinfo;
u8 operstate = netif_running(dev) ? dev->operstate : IF_OPER_DOWN; u8 operstate = netif_running(dev) ? dev->operstate : IF_OPER_DOWN;
struct net_device *br_dev = netdev_master_upper_dev_get(dev); struct net_device *br_dev = netdev_master_upper_dev_get(dev);
...@@ -2731,6 +2741,33 @@ int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, ...@@ -2731,6 +2741,33 @@ int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
} }
nla_nest_end(skb, br_afspec); nla_nest_end(skb, br_afspec);
protinfo = nla_nest_start(skb, IFLA_PROTINFO | NLA_F_NESTED);
if (!protinfo)
goto nla_put_failure;
if (brport_nla_put_flag(skb, flags, mask,
IFLA_BRPORT_MODE, BR_HAIRPIN_MODE) ||
brport_nla_put_flag(skb, flags, mask,
IFLA_BRPORT_GUARD, BR_BPDU_GUARD) ||
brport_nla_put_flag(skb, flags, mask,
IFLA_BRPORT_FAST_LEAVE,
BR_MULTICAST_FAST_LEAVE) ||
brport_nla_put_flag(skb, flags, mask,
IFLA_BRPORT_PROTECT, BR_ROOT_BLOCK) ||
brport_nla_put_flag(skb, flags, mask,
IFLA_BRPORT_LEARNING, BR_LEARNING) ||
brport_nla_put_flag(skb, flags, mask,
IFLA_BRPORT_LEARNING_SYNC, BR_LEARNING_SYNC) ||
brport_nla_put_flag(skb, flags, mask,
IFLA_BRPORT_UNICAST_FLOOD, BR_FLOOD) ||
brport_nla_put_flag(skb, flags, mask,
IFLA_BRPORT_PROXYARP, BR_PROXYARP)) {
nla_nest_cancel(skb, protinfo);
goto nla_put_failure;
}
nla_nest_end(skb, protinfo);
return nlmsg_end(skb, nlh); return nlmsg_end(skb, nlh);
nla_put_failure: nla_put_failure:
nlmsg_cancel(skb, nlh); nlmsg_cancel(skb, nlh);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment