aboutsummaryrefslogtreecommitdiffstats
path: root/net/switchdev
diff options
context:
space:
mode:
authorArkadi Sharshevsky <arkadis@mellanox.com>2017-08-06 09:15:49 -0400
committerDavid S. Miller <davem@davemloft.net>2017-08-07 17:48:48 -0400
commit2bedde1abbef5eec211308f0293dd7681b0513ec (patch)
treeace07f76bb5f82da40815297675d6e8a9a9a3c02 /net/switchdev
parentdc0cbff3ff9fe331160c2be2b3f47564e247137d (diff)
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. Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/switchdev')
-rw-r--r--net/switchdev/switchdev.c84
1 files changed, 0 insertions, 84 deletions
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index 25dc67ef9d37..3d32981b9aa1 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -1009,90 +1009,6 @@ int switchdev_port_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
1009} 1009}
1010EXPORT_SYMBOL_GPL(switchdev_port_fdb_del); 1010EXPORT_SYMBOL_GPL(switchdev_port_fdb_del);
1011 1011
1012struct 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
1020static 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
1055skip:
1056 dump->idx++;
1057 return 0;
1058
1059nla_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 */
1075int 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}
1094EXPORT_SYMBOL_GPL(switchdev_port_fdb_dump);
1095
1096bool switchdev_port_same_parent_id(struct net_device *a, 1012bool switchdev_port_same_parent_id(struct net_device *a,
1097 struct net_device *b) 1013 struct net_device *b)
1098{ 1014{