bridge fdb add ADDR dev DEV [vlan VID] [self]
The driver should use the helper switchdev_port_fdb_xxx ops for ndo_fdb_xxx
-ops, and handle add/delete/dump of SWITCHDEV_OBJ_PORT_FDB object using
+ops, and handle add/delete/dump of SWITCHDEV_OBJ_ID_PORT_FDB object using
switchdev_port_obj_xxx ops.
XXX: what should be done if offloading this rule to hardware fails (for
switchdev_port_obj_add is used for both adding a new FIB entry to the device,
or modifying an existing entry on the device.
-XXX: Currently, only SWITCHDEV_OBJ_IPV4_FIB objects are supported.
+XXX: Currently, only SWITCHDEV_OBJ_ID_IPV4_FIB objects are supported.
-SWITCHDEV_OBJ_IPV4_FIB object passes:
+SWITCHDEV_OBJ_ID_IPV4_FIB object passes:
struct switchdev_obj_ipv4_fib { /* IPV4_FIB */
u32 dst;
int err = 0;
switch (id) {
- case SWITCHDEV_OBJ_PORT_VLAN:
+ case SWITCHDEV_OBJ_ID_PORT_VLAN:
err = rocker_port_vlans_add(rocker_port, trans, obj);
break;
- case SWITCHDEV_OBJ_IPV4_FIB:
+ case SWITCHDEV_OBJ_ID_IPV4_FIB:
fib4 = obj;
err = rocker_port_fib_ipv4(rocker_port, trans,
htonl(fib4->dst), fib4->dst_len,
fib4->fi, fib4->tb_id, 0);
break;
- case SWITCHDEV_OBJ_PORT_FDB:
+ case SWITCHDEV_OBJ_ID_PORT_FDB:
err = rocker_port_fdb_add(rocker_port, trans, obj);
break;
default:
int err = 0;
switch (id) {
- case SWITCHDEV_OBJ_PORT_VLAN:
+ case SWITCHDEV_OBJ_ID_PORT_VLAN:
err = rocker_port_vlans_del(rocker_port, obj);
break;
- case SWITCHDEV_OBJ_IPV4_FIB:
+ case SWITCHDEV_OBJ_ID_IPV4_FIB:
fib4 = obj;
err = rocker_port_fib_ipv4(rocker_port, NULL,
htonl(fib4->dst), fib4->dst_len,
fib4->fi, fib4->tb_id,
ROCKER_OP_FLAG_REMOVE);
break;
- case SWITCHDEV_OBJ_PORT_FDB:
+ case SWITCHDEV_OBJ_ID_PORT_FDB:
err = rocker_port_fdb_del(rocker_port, NULL, obj);
break;
default:
int err = 0;
switch (id) {
- case SWITCHDEV_OBJ_PORT_FDB:
+ case SWITCHDEV_OBJ_ID_PORT_FDB:
err = rocker_port_fdb_dump(rocker_port, obj, cb);
break;
- case SWITCHDEV_OBJ_PORT_VLAN:
+ case SWITCHDEV_OBJ_ID_PORT_VLAN:
err = rocker_port_vlan_dump(rocker_port, obj, cb);
break;
default:
struct fib_info;
enum switchdev_obj_id {
- SWITCHDEV_OBJ_UNDEFINED,
- SWITCHDEV_OBJ_PORT_VLAN,
- SWITCHDEV_OBJ_IPV4_FIB,
- SWITCHDEV_OBJ_PORT_FDB,
+ SWITCHDEV_OBJ_ID_UNDEFINED,
+ SWITCHDEV_OBJ_ID_PORT_VLAN,
+ SWITCHDEV_OBJ_ID_IPV4_FIB,
+ SWITCHDEV_OBJ_ID_PORT_FDB,
};
-/* SWITCHDEV_OBJ_PORT_VLAN */
+/* SWITCHDEV_OBJ_ID_PORT_VLAN */
struct switchdev_obj_vlan {
u16 flags;
u16 vid_begin;
u16 vid_end;
};
-/* SWITCHDEV_OBJ_IPV4_FIB */
+/* SWITCHDEV_OBJ_ID_IPV4_FIB */
struct switchdev_obj_ipv4_fib {
u32 dst;
int dst_len;
u32 tb_id;
};
-/* SWITCHDEV_OBJ_PORT_FDB */
+/* SWITCHDEV_OBJ_ID_PORT_FDB */
struct switchdev_obj_fdb {
const unsigned char *addr;
u16 vid;
.vid = f->vlan_id,
};
- switchdev_port_obj_del(f->dst->dev, SWITCHDEV_OBJ_PORT_FDB, &fdb);
+ switchdev_port_obj_del(f->dst->dev, SWITCHDEV_OBJ_ID_PORT_FDB, &fdb);
}
static void fdb_delete(struct net_bridge *br, struct net_bridge_fdb_entry *f)
.vid_end = vid,
};
- err = switchdev_port_obj_add(dev, SWITCHDEV_OBJ_PORT_VLAN, &v);
+ err = switchdev_port_obj_add(dev, SWITCHDEV_OBJ_ID_PORT_VLAN,
+ &v);
if (err == -EOPNOTSUPP)
err = 0;
}
.vid_end = vid,
};
- err = switchdev_port_obj_del(dev, SWITCHDEV_OBJ_PORT_VLAN, &v);
+ err = switchdev_port_obj_del(dev, SWITCHDEV_OBJ_ID_PORT_VLAN,
+ &v);
if (err == -EOPNOTSUPP)
err = 0;
}
*/
switch (id) {
- case SWITCHDEV_OBJ_PORT_FDB:
+ case SWITCHDEV_OBJ_ID_PORT_FDB:
err = dsa_slave_port_fdb_add(dev, obj, trans);
break;
- case SWITCHDEV_OBJ_PORT_VLAN:
+ case SWITCHDEV_OBJ_ID_PORT_VLAN:
err = dsa_slave_port_vlan_add(dev, obj, trans);
break;
default:
int err;
switch (id) {
- case SWITCHDEV_OBJ_PORT_FDB:
+ case SWITCHDEV_OBJ_ID_PORT_FDB:
err = dsa_slave_port_fdb_del(dev, obj);
break;
- case SWITCHDEV_OBJ_PORT_VLAN:
+ case SWITCHDEV_OBJ_ID_PORT_VLAN:
err = dsa_slave_port_vlan_del(dev, obj);
break;
default:
int err;
switch (id) {
- case SWITCHDEV_OBJ_PORT_FDB:
+ case SWITCHDEV_OBJ_ID_PORT_FDB:
err = dsa_slave_port_fdb_dump(dev, obj, cb);
break;
- case SWITCHDEV_OBJ_PORT_VLAN:
+ case SWITCHDEV_OBJ_ID_PORT_VLAN:
err = dsa_slave_port_vlan_dump(dev, obj, cb);
break;
default:
if ((filter_mask & RTEXT_FILTER_BRVLAN) ||
(filter_mask & RTEXT_FILTER_BRVLAN_COMPRESSED)) {
- err = switchdev_port_obj_dump(dev, SWITCHDEV_OBJ_PORT_VLAN,
+ err = switchdev_port_obj_dump(dev, SWITCHDEV_OBJ_ID_PORT_VLAN,
&dump.vlan,
switchdev_port_vlan_dump_cb);
if (err)
vlan.vid_end = vinfo->vid;
if (vlan.vid_end <= vlan.vid_begin)
return -EINVAL;
- err = f(dev, SWITCHDEV_OBJ_PORT_VLAN, &vlan);
+ err = f(dev, SWITCHDEV_OBJ_ID_PORT_VLAN, &vlan);
if (err)
return err;
memset(&vlan, 0, sizeof(vlan));
return -EINVAL;
vlan.vid_begin = vinfo->vid;
vlan.vid_end = vinfo->vid;
- err = f(dev, SWITCHDEV_OBJ_PORT_VLAN, &vlan);
+ err = f(dev, SWITCHDEV_OBJ_ID_PORT_VLAN, &vlan);
if (err)
return err;
memset(&vlan, 0, sizeof(vlan));
.vid = vid,
};
- return switchdev_port_obj_add(dev, SWITCHDEV_OBJ_PORT_FDB, &fdb);
+ return switchdev_port_obj_add(dev, SWITCHDEV_OBJ_ID_PORT_FDB, &fdb);
}
EXPORT_SYMBOL_GPL(switchdev_port_fdb_add);
.vid = vid,
};
- return switchdev_port_obj_del(dev, SWITCHDEV_OBJ_PORT_FDB, &fdb);
+ return switchdev_port_obj_del(dev, SWITCHDEV_OBJ_ID_PORT_FDB, &fdb);
}
EXPORT_SYMBOL_GPL(switchdev_port_fdb_del);
.idx = idx,
};
- switchdev_port_obj_dump(dev, SWITCHDEV_OBJ_PORT_FDB, &dump.fdb,
+ switchdev_port_obj_dump(dev, SWITCHDEV_OBJ_ID_PORT_FDB, &dump.fdb,
switchdev_port_fdb_dump_cb);
return dump.idx;
}
if (!dev)
return 0;
- err = switchdev_port_obj_add(dev, SWITCHDEV_OBJ_IPV4_FIB, &ipv4_fib);
+ err = switchdev_port_obj_add(dev, SWITCHDEV_OBJ_ID_IPV4_FIB, &ipv4_fib);
if (!err)
fi->fib_flags |= RTNH_F_OFFLOAD;
if (!dev)
return 0;
- err = switchdev_port_obj_del(dev, SWITCHDEV_OBJ_IPV4_FIB, &ipv4_fib);
+ err = switchdev_port_obj_del(dev, SWITCHDEV_OBJ_ID_IPV4_FIB, &ipv4_fib);
if (!err)
fi->fib_flags &= ~RTNH_F_OFFLOAD;