History

net: dsa: Move FDB dump implementation inside DSA

>From all switchdev devices only DSA requires special FDB dump. This is due to lack of ability for syncing the hardware learned FDBs with the bridge. Due to this it is removed from switchdev and moved inside DSA.

Arkadi Sharshevsky committed 9 years ago

Commit 2bedde11 parent dc0cbff12 files · +112 −204Browse files

Showing the changes to net/switchdev/switchdev.c (1 of 12 files). Show all

Unified · Split

net/switchdev/switchdev.c+0−84
@@ -1009,90 +1009,6 @@ int switchdev_port_fdb_del(struct ndmsg *ndm, struct nlattr *tb[], · 1008 unmodified lines
10091009 }
10101010 EXPORT_SYMBOL_GPL(switchdev_port_fdb_del);
10111011
1012−struct switchdev_fdb_dump {
1013− struct switchdev_obj_port_fdb fdb;
1014− struct net_device *dev;
1015− struct sk_buff *skb;
1016− struct netlink_callback *cb;
1017− int idx;
1018−};
1019−
1020−static int switchdev_port_fdb_dump_cb(struct switchdev_obj *obj)
1021−{
1022− struct switchdev_obj_port_fdb *fdb = SWITCHDEV_OBJ_PORT_FDB(obj);
1023− struct switchdev_fdb_dump *dump =
1024− container_of(fdb, struct switchdev_fdb_dump, fdb);
1025− u32 portid = NETLINK_CB(dump->cb->skb).portid;
1026− u32 seq = dump->cb->nlh->nlmsg_seq;
1027− struct nlmsghdr *nlh;
1028− struct ndmsg *ndm;
1029−
1030− if (dump->idx < dump->cb->args[2])
1031− goto skip;
1032−
1033− nlh = nlmsg_put(dump->skb, portid, seq, RTM_NEWNEIGH,
1034− sizeof(*ndm), NLM_F_MULTI);
1035− if (!nlh)
1036− return -EMSGSIZE;
1037−
1038− ndm = nlmsg_data(nlh);
1039− ndm->ndm_family = AF_BRIDGE;
1040− ndm->ndm_pad1 = 0;
1041− ndm->ndm_pad2 = 0;
1042− ndm->ndm_flags = NTF_SELF;
1043− ndm->ndm_type = 0;
1044− ndm->ndm_ifindex = dump->dev->ifindex;
1045− ndm->ndm_state = fdb->ndm_state;
1046−
1047− if (nla_put(dump->skb, NDA_LLADDR, ETH_ALEN, fdb->addr))
1048− goto nla_put_failure;
1049−
1050− if (fdb->vid && nla_put_u16(dump->skb, NDA_VLAN, fdb->vid))
1051− goto nla_put_failure;
1052−
1053− nlmsg_end(dump->skb, nlh);
1054−
1055−skip:
1056− dump->idx++;
1057− return 0;
1058−
1059−nla_put_failure:
1060− nlmsg_cancel(dump->skb, nlh);
1061− return -EMSGSIZE;
1062−}
1063−
1064−/**
1065− * switchdev_port_fdb_dump - Dump port FDB (MAC/VLAN) entries
1066− *
1067− * @skb: netlink skb
1068− * @cb: netlink callback
1069− * @dev: port device
1070− * @filter_dev: filter device
1071− * @idx:
1072− *
1073− * Dump FDB entries from switch device.
1074− */
1075−int switchdev_port_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb,
1076− struct net_device *dev,
1077− struct net_device *filter_dev, int *idx)
1078−{
1079− struct switchdev_fdb_dump dump = {
1080− .fdb.obj.orig_dev = dev,
1081− .fdb.obj.id = SWITCHDEV_OBJ_ID_PORT_FDB,
1082− .dev = dev,
1083− .skb = skb,
1084− .cb = cb,
1085− .idx = *idx,
1086− };
1087− int err;
1088−
1089− err = switchdev_port_obj_dump(dev, &dump.fdb.obj,
1090− switchdev_port_fdb_dump_cb);
1091− *idx = dump.idx;
1092− return err;
1093−}
1094−EXPORT_SYMBOL_GPL(switchdev_port_fdb_dump);
1095−
10961012 bool switchdev_port_same_parent_id(struct net_device *a,
10971013 struct net_device *b)
10981014 {