aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorJohn Fastabend <john.r.fastabend@intel.com>2012-10-24 04:13:09 -0400
committerDavid S. Miller <davem@davemloft.net>2012-10-31 13:18:29 -0400
commit815cccbf10b27115fb3e5827bef26768616e5e27 (patch)
treec8c4a2a2bc95bc89926c91c67c98b020be1efaa7 /net/core
parent2469ffd723f76ac2d3ce3d4f31ee31ee0a06cd38 (diff)
ixgbe: add setlink, getlink support to ixgbe and ixgbevf
This adds support for the net device ops to manage the embedded hardware bridge on ixgbe devices. With this patch the bridge mode can be toggled between VEB and VEPA to support stacking macvlan devices or using the embedded switch without any SW component in 802.1Qbg/br environments. Additionally, this adds source address pruning to the ixgbevf driver to prune any frames sent back from a reflective relay on the switch. This is required because the existing hardware does not support this. Without it frames get pushed into the stack with its own src mac which is invalid per 802.1Qbg VEPA definition. Signed-off-by: John Fastabend <john.r.fastabend@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/rtnetlink.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 8d2af0f77d36..51dc58ff0091 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -2252,6 +2252,56 @@ static int rtnl_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb)
2252 return skb->len; 2252 return skb->len;
2253} 2253}
2254 2254
2255int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
2256 struct net_device *dev, u16 mode)
2257{
2258 struct nlmsghdr *nlh;
2259 struct ifinfomsg *ifm;
2260 struct nlattr *br_afspec;
2261 u8 operstate = netif_running(dev) ? dev->operstate : IF_OPER_DOWN;
2262
2263 nlh = nlmsg_put(skb, pid, seq, RTM_NEWLINK, sizeof(*ifm), NLM_F_MULTI);
2264 if (nlh == NULL)
2265 return -EMSGSIZE;
2266
2267 ifm = nlmsg_data(nlh);
2268 ifm->ifi_family = AF_BRIDGE;
2269 ifm->__ifi_pad = 0;
2270 ifm->ifi_type = dev->type;
2271 ifm->ifi_index = dev->ifindex;
2272 ifm->ifi_flags = dev_get_flags(dev);
2273 ifm->ifi_change = 0;
2274
2275
2276 if (nla_put_string(skb, IFLA_IFNAME, dev->name) ||
2277 nla_put_u32(skb, IFLA_MTU, dev->mtu) ||
2278 nla_put_u8(skb, IFLA_OPERSTATE, operstate) ||
2279 (dev->master &&
2280 nla_put_u32(skb, IFLA_MASTER, dev->master->ifindex)) ||
2281 (dev->addr_len &&
2282 nla_put(skb, IFLA_ADDRESS, dev->addr_len, dev->dev_addr)) ||
2283 (dev->ifindex != dev->iflink &&
2284 nla_put_u32(skb, IFLA_LINK, dev->iflink)))
2285 goto nla_put_failure;
2286
2287 br_afspec = nla_nest_start(skb, IFLA_AF_SPEC);
2288 if (!br_afspec)
2289 goto nla_put_failure;
2290
2291 if (nla_put_u16(skb, IFLA_BRIDGE_FLAGS, BRIDGE_FLAGS_SELF) ||
2292 nla_put_u16(skb, IFLA_BRIDGE_MODE, mode)) {
2293 nla_nest_cancel(skb, br_afspec);
2294 goto nla_put_failure;
2295 }
2296 nla_nest_end(skb, br_afspec);
2297
2298 return nlmsg_end(skb, nlh);
2299nla_put_failure:
2300 nlmsg_cancel(skb, nlh);
2301 return -EMSGSIZE;
2302}
2303EXPORT_SYMBOL(ndo_dflt_bridge_getlink);
2304
2255static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb) 2305static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb)
2256{ 2306{
2257 struct net *net = sock_net(skb->sk); 2307 struct net *net = sock_net(skb->sk);