aboutsummaryrefslogtreecommitdiffstats
path: root/net/switchdev/switchdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/switchdev/switchdev.c')
-rw-r--r--net/switchdev/switchdev.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index f34e535e93bd..ebc661d3b6e3 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -345,6 +345,8 @@ static size_t switchdev_obj_size(const struct switchdev_obj *obj)
345 return sizeof(struct switchdev_obj_ipv4_fib); 345 return sizeof(struct switchdev_obj_ipv4_fib);
346 case SWITCHDEV_OBJ_ID_PORT_FDB: 346 case SWITCHDEV_OBJ_ID_PORT_FDB:
347 return sizeof(struct switchdev_obj_port_fdb); 347 return sizeof(struct switchdev_obj_port_fdb);
348 case SWITCHDEV_OBJ_ID_PORT_MDB:
349 return sizeof(struct switchdev_obj_port_mdb);
348 default: 350 default:
349 BUG(); 351 BUG();
350 } 352 }
@@ -723,6 +725,7 @@ static int switchdev_port_vlan_fill(struct sk_buff *skb, struct net_device *dev,
723 u32 filter_mask) 725 u32 filter_mask)
724{ 726{
725 struct switchdev_vlan_dump dump = { 727 struct switchdev_vlan_dump dump = {
728 .vlan.obj.orig_dev = dev,
726 .vlan.obj.id = SWITCHDEV_OBJ_ID_PORT_VLAN, 729 .vlan.obj.id = SWITCHDEV_OBJ_ID_PORT_VLAN,
727 .skb = skb, 730 .skb = skb,
728 .filter_mask = filter_mask, 731 .filter_mask = filter_mask,
@@ -757,6 +760,7 @@ int switchdev_port_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
757 int nlflags) 760 int nlflags)
758{ 761{
759 struct switchdev_attr attr = { 762 struct switchdev_attr attr = {
763 .orig_dev = dev,
760 .id = SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS, 764 .id = SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS,
761 }; 765 };
762 u16 mode = BRIDGE_MODE_UNDEF; 766 u16 mode = BRIDGE_MODE_UNDEF;
@@ -778,6 +782,7 @@ static int switchdev_port_br_setflag(struct net_device *dev,
778 unsigned long brport_flag) 782 unsigned long brport_flag)
779{ 783{
780 struct switchdev_attr attr = { 784 struct switchdev_attr attr = {
785 .orig_dev = dev,
781 .id = SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS, 786 .id = SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS,
782 }; 787 };
783 u8 flag = nla_get_u8(nlattr); 788 u8 flag = nla_get_u8(nlattr);
@@ -853,6 +858,7 @@ static int switchdev_port_br_afspec(struct net_device *dev,
853 struct nlattr *attr; 858 struct nlattr *attr;
854 struct bridge_vlan_info *vinfo; 859 struct bridge_vlan_info *vinfo;
855 struct switchdev_obj_port_vlan vlan = { 860 struct switchdev_obj_port_vlan vlan = {
861 .obj.orig_dev = dev,
856 .obj.id = SWITCHDEV_OBJ_ID_PORT_VLAN, 862 .obj.id = SWITCHDEV_OBJ_ID_PORT_VLAN,
857 }; 863 };
858 int rem; 864 int rem;
@@ -975,6 +981,7 @@ int switchdev_port_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
975 u16 vid, u16 nlm_flags) 981 u16 vid, u16 nlm_flags)
976{ 982{
977 struct switchdev_obj_port_fdb fdb = { 983 struct switchdev_obj_port_fdb fdb = {
984 .obj.orig_dev = dev,
978 .obj.id = SWITCHDEV_OBJ_ID_PORT_FDB, 985 .obj.id = SWITCHDEV_OBJ_ID_PORT_FDB,
979 .vid = vid, 986 .vid = vid,
980 }; 987 };
@@ -1000,6 +1007,7 @@ int switchdev_port_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
1000 u16 vid) 1007 u16 vid)
1001{ 1008{
1002 struct switchdev_obj_port_fdb fdb = { 1009 struct switchdev_obj_port_fdb fdb = {
1010 .obj.orig_dev = dev,
1003 .obj.id = SWITCHDEV_OBJ_ID_PORT_FDB, 1011 .obj.id = SWITCHDEV_OBJ_ID_PORT_FDB,
1004 .vid = vid, 1012 .vid = vid,
1005 }; 1013 };
@@ -1077,6 +1085,7 @@ int switchdev_port_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb,
1077 struct net_device *filter_dev, int idx) 1085 struct net_device *filter_dev, int idx)
1078{ 1086{
1079 struct switchdev_fdb_dump dump = { 1087 struct switchdev_fdb_dump dump = {
1088 .fdb.obj.orig_dev = dev,
1080 .fdb.obj.id = SWITCHDEV_OBJ_ID_PORT_FDB, 1089 .fdb.obj.id = SWITCHDEV_OBJ_ID_PORT_FDB,
1081 .dev = dev, 1090 .dev = dev,
1082 .skb = skb, 1091 .skb = skb,
@@ -1135,6 +1144,7 @@ static struct net_device *switchdev_get_dev_by_nhs(struct fib_info *fi)
1135 if (!dev) 1144 if (!dev)
1136 return NULL; 1145 return NULL;
1137 1146
1147 attr.orig_dev = dev;
1138 if (switchdev_port_attr_get(dev, &attr)) 1148 if (switchdev_port_attr_get(dev, &attr))
1139 return NULL; 1149 return NULL;
1140 1150
@@ -1194,6 +1204,7 @@ int switchdev_fib_ipv4_add(u32 dst, int dst_len, struct fib_info *fi,
1194 if (!dev) 1204 if (!dev)
1195 return 0; 1205 return 0;
1196 1206
1207 ipv4_fib.obj.orig_dev = dev;
1197 err = switchdev_port_obj_add(dev, &ipv4_fib.obj); 1208 err = switchdev_port_obj_add(dev, &ipv4_fib.obj);
1198 if (!err) 1209 if (!err)
1199 fi->fib_flags |= RTNH_F_OFFLOAD; 1210 fi->fib_flags |= RTNH_F_OFFLOAD;
@@ -1238,6 +1249,7 @@ int switchdev_fib_ipv4_del(u32 dst, int dst_len, struct fib_info *fi,
1238 if (!dev) 1249 if (!dev)
1239 return 0; 1250 return 0;
1240 1251
1252 ipv4_fib.obj.orig_dev = dev;
1241 err = switchdev_port_obj_del(dev, &ipv4_fib.obj); 1253 err = switchdev_port_obj_del(dev, &ipv4_fib.obj);
1242 if (!err) 1254 if (!err)
1243 fi->fib_flags &= ~RTNH_F_OFFLOAD; 1255 fi->fib_flags &= ~RTNH_F_OFFLOAD;
@@ -1270,10 +1282,12 @@ static bool switchdev_port_same_parent_id(struct net_device *a,
1270 struct net_device *b) 1282 struct net_device *b)
1271{ 1283{
1272 struct switchdev_attr a_attr = { 1284 struct switchdev_attr a_attr = {
1285 .orig_dev = a,
1273 .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID, 1286 .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
1274 .flags = SWITCHDEV_F_NO_RECURSE, 1287 .flags = SWITCHDEV_F_NO_RECURSE,
1275 }; 1288 };
1276 struct switchdev_attr b_attr = { 1289 struct switchdev_attr b_attr = {
1290 .orig_dev = b,
1277 .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID, 1291 .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
1278 .flags = SWITCHDEV_F_NO_RECURSE, 1292 .flags = SWITCHDEV_F_NO_RECURSE,
1279 }; 1293 };