Commit 57d80838 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

switchdev: rename SWITCHDEV_OBJ_* enum values to SWITCHDEV_OBJ_ID_*

Suggested-by: default avatarVivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Acked-by: default avatarScott Feldman <sfeldma@gmail.com>
Reviewed-by: default avatarVivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c3fc7ac9
...@@ -178,7 +178,7 @@ entries are installed, for example, using iproute2 bridge cmd: ...@@ -178,7 +178,7 @@ entries are installed, for example, using iproute2 bridge cmd:
bridge fdb add ADDR dev DEV [vlan VID] [self] bridge fdb add ADDR dev DEV [vlan VID] [self]
The driver should use the helper switchdev_port_fdb_xxx ops for ndo_fdb_xxx 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. switchdev_port_obj_xxx ops.
XXX: what should be done if offloading this rule to hardware fails (for XXX: what should be done if offloading this rule to hardware fails (for
...@@ -316,9 +316,9 @@ SWITCHDEV_OBJ_IPV[4|6]_FIB object using switchdev_port_obj_xxx ops. ...@@ -316,9 +316,9 @@ SWITCHDEV_OBJ_IPV[4|6]_FIB object using switchdev_port_obj_xxx ops.
switchdev_port_obj_add is used for both adding a new FIB entry to the device, switchdev_port_obj_add is used for both adding a new FIB entry to the device,
or modifying an existing entry on 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 */ struct switchdev_obj_ipv4_fib { /* IPV4_FIB */
u32 dst; u32 dst;
......
...@@ -4445,16 +4445,16 @@ static int rocker_port_obj_add(struct net_device *dev, ...@@ -4445,16 +4445,16 @@ static int rocker_port_obj_add(struct net_device *dev,
int err = 0; int err = 0;
switch (id) { switch (id) {
case SWITCHDEV_OBJ_PORT_VLAN: case SWITCHDEV_OBJ_ID_PORT_VLAN:
err = rocker_port_vlans_add(rocker_port, trans, obj); err = rocker_port_vlans_add(rocker_port, trans, obj);
break; break;
case SWITCHDEV_OBJ_IPV4_FIB: case SWITCHDEV_OBJ_ID_IPV4_FIB:
fib4 = obj; fib4 = obj;
err = rocker_port_fib_ipv4(rocker_port, trans, err = rocker_port_fib_ipv4(rocker_port, trans,
htonl(fib4->dst), fib4->dst_len, htonl(fib4->dst), fib4->dst_len,
fib4->fi, fib4->tb_id, 0); fib4->fi, fib4->tb_id, 0);
break; break;
case SWITCHDEV_OBJ_PORT_FDB: case SWITCHDEV_OBJ_ID_PORT_FDB:
err = rocker_port_fdb_add(rocker_port, trans, obj); err = rocker_port_fdb_add(rocker_port, trans, obj);
break; break;
default: default:
...@@ -4515,17 +4515,17 @@ static int rocker_port_obj_del(struct net_device *dev, ...@@ -4515,17 +4515,17 @@ static int rocker_port_obj_del(struct net_device *dev,
int err = 0; int err = 0;
switch (id) { switch (id) {
case SWITCHDEV_OBJ_PORT_VLAN: case SWITCHDEV_OBJ_ID_PORT_VLAN:
err = rocker_port_vlans_del(rocker_port, obj); err = rocker_port_vlans_del(rocker_port, obj);
break; break;
case SWITCHDEV_OBJ_IPV4_FIB: case SWITCHDEV_OBJ_ID_IPV4_FIB:
fib4 = obj; fib4 = obj;
err = rocker_port_fib_ipv4(rocker_port, NULL, err = rocker_port_fib_ipv4(rocker_port, NULL,
htonl(fib4->dst), fib4->dst_len, htonl(fib4->dst), fib4->dst_len,
fib4->fi, fib4->tb_id, fib4->fi, fib4->tb_id,
ROCKER_OP_FLAG_REMOVE); ROCKER_OP_FLAG_REMOVE);
break; break;
case SWITCHDEV_OBJ_PORT_FDB: case SWITCHDEV_OBJ_ID_PORT_FDB:
err = rocker_port_fdb_del(rocker_port, NULL, obj); err = rocker_port_fdb_del(rocker_port, NULL, obj);
break; break;
default: default:
...@@ -4594,10 +4594,10 @@ static int rocker_port_obj_dump(struct net_device *dev, ...@@ -4594,10 +4594,10 @@ static int rocker_port_obj_dump(struct net_device *dev,
int err = 0; int err = 0;
switch (id) { switch (id) {
case SWITCHDEV_OBJ_PORT_FDB: case SWITCHDEV_OBJ_ID_PORT_FDB:
err = rocker_port_fdb_dump(rocker_port, obj, cb); err = rocker_port_fdb_dump(rocker_port, obj, cb);
break; break;
case SWITCHDEV_OBJ_PORT_VLAN: case SWITCHDEV_OBJ_ID_PORT_VLAN:
err = rocker_port_vlan_dump(rocker_port, obj, cb); err = rocker_port_vlan_dump(rocker_port, obj, cb);
break; break;
default: default:
......
...@@ -58,20 +58,20 @@ struct switchdev_attr { ...@@ -58,20 +58,20 @@ struct switchdev_attr {
struct fib_info; struct fib_info;
enum switchdev_obj_id { enum switchdev_obj_id {
SWITCHDEV_OBJ_UNDEFINED, SWITCHDEV_OBJ_ID_UNDEFINED,
SWITCHDEV_OBJ_PORT_VLAN, SWITCHDEV_OBJ_ID_PORT_VLAN,
SWITCHDEV_OBJ_IPV4_FIB, SWITCHDEV_OBJ_ID_IPV4_FIB,
SWITCHDEV_OBJ_PORT_FDB, SWITCHDEV_OBJ_ID_PORT_FDB,
}; };
/* SWITCHDEV_OBJ_PORT_VLAN */ /* SWITCHDEV_OBJ_ID_PORT_VLAN */
struct switchdev_obj_vlan { struct switchdev_obj_vlan {
u16 flags; u16 flags;
u16 vid_begin; u16 vid_begin;
u16 vid_end; u16 vid_end;
}; };
/* SWITCHDEV_OBJ_IPV4_FIB */ /* SWITCHDEV_OBJ_ID_IPV4_FIB */
struct switchdev_obj_ipv4_fib { struct switchdev_obj_ipv4_fib {
u32 dst; u32 dst;
int dst_len; int dst_len;
...@@ -82,7 +82,7 @@ struct switchdev_obj_ipv4_fib { ...@@ -82,7 +82,7 @@ struct switchdev_obj_ipv4_fib {
u32 tb_id; u32 tb_id;
}; };
/* SWITCHDEV_OBJ_PORT_FDB */ /* SWITCHDEV_OBJ_ID_PORT_FDB */
struct switchdev_obj_fdb { struct switchdev_obj_fdb {
const unsigned char *addr; const unsigned char *addr;
u16 vid; u16 vid;
......
...@@ -138,7 +138,7 @@ static void fdb_del_external_learn(struct net_bridge_fdb_entry *f) ...@@ -138,7 +138,7 @@ static void fdb_del_external_learn(struct net_bridge_fdb_entry *f)
.vid = f->vlan_id, .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) static void fdb_delete(struct net_bridge *br, struct net_bridge_fdb_entry *f)
......
...@@ -88,7 +88,8 @@ static int __vlan_vid_add(struct net_device *dev, struct net_bridge *br, ...@@ -88,7 +88,8 @@ static int __vlan_vid_add(struct net_device *dev, struct net_bridge *br,
.vid_end = vid, .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) if (err == -EOPNOTSUPP)
err = 0; err = 0;
} }
...@@ -136,7 +137,8 @@ static int __vlan_vid_del(struct net_device *dev, struct net_bridge *br, ...@@ -136,7 +137,8 @@ static int __vlan_vid_del(struct net_device *dev, struct net_bridge *br,
.vid_end = vid, .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) if (err == -EOPNOTSUPP)
err = 0; err = 0;
} }
......
...@@ -485,10 +485,10 @@ static int dsa_slave_port_obj_add(struct net_device *dev, ...@@ -485,10 +485,10 @@ static int dsa_slave_port_obj_add(struct net_device *dev,
*/ */
switch (id) { switch (id) {
case SWITCHDEV_OBJ_PORT_FDB: case SWITCHDEV_OBJ_ID_PORT_FDB:
err = dsa_slave_port_fdb_add(dev, obj, trans); err = dsa_slave_port_fdb_add(dev, obj, trans);
break; break;
case SWITCHDEV_OBJ_PORT_VLAN: case SWITCHDEV_OBJ_ID_PORT_VLAN:
err = dsa_slave_port_vlan_add(dev, obj, trans); err = dsa_slave_port_vlan_add(dev, obj, trans);
break; break;
default: default:
...@@ -505,10 +505,10 @@ static int dsa_slave_port_obj_del(struct net_device *dev, ...@@ -505,10 +505,10 @@ static int dsa_slave_port_obj_del(struct net_device *dev,
int err; int err;
switch (id) { switch (id) {
case SWITCHDEV_OBJ_PORT_FDB: case SWITCHDEV_OBJ_ID_PORT_FDB:
err = dsa_slave_port_fdb_del(dev, obj); err = dsa_slave_port_fdb_del(dev, obj);
break; break;
case SWITCHDEV_OBJ_PORT_VLAN: case SWITCHDEV_OBJ_ID_PORT_VLAN:
err = dsa_slave_port_vlan_del(dev, obj); err = dsa_slave_port_vlan_del(dev, obj);
break; break;
default: default:
...@@ -526,10 +526,10 @@ static int dsa_slave_port_obj_dump(struct net_device *dev, ...@@ -526,10 +526,10 @@ static int dsa_slave_port_obj_dump(struct net_device *dev,
int err; int err;
switch (id) { switch (id) {
case SWITCHDEV_OBJ_PORT_FDB: case SWITCHDEV_OBJ_ID_PORT_FDB:
err = dsa_slave_port_fdb_dump(dev, obj, cb); err = dsa_slave_port_fdb_dump(dev, obj, cb);
break; break;
case SWITCHDEV_OBJ_PORT_VLAN: case SWITCHDEV_OBJ_ID_PORT_VLAN:
err = dsa_slave_port_vlan_dump(dev, obj, cb); err = dsa_slave_port_vlan_dump(dev, obj, cb);
break; break;
default: default:
......
...@@ -584,7 +584,7 @@ static int switchdev_port_vlan_fill(struct sk_buff *skb, struct net_device *dev, ...@@ -584,7 +584,7 @@ static int switchdev_port_vlan_fill(struct sk_buff *skb, struct net_device *dev,
if ((filter_mask & RTEXT_FILTER_BRVLAN) || if ((filter_mask & RTEXT_FILTER_BRVLAN) ||
(filter_mask & RTEXT_FILTER_BRVLAN_COMPRESSED)) { (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, &dump.vlan,
switchdev_port_vlan_dump_cb); switchdev_port_vlan_dump_cb);
if (err) if (err)
...@@ -725,7 +725,7 @@ static int switchdev_port_br_afspec(struct net_device *dev, ...@@ -725,7 +725,7 @@ static int switchdev_port_br_afspec(struct net_device *dev,
vlan.vid_end = vinfo->vid; vlan.vid_end = vinfo->vid;
if (vlan.vid_end <= vlan.vid_begin) if (vlan.vid_end <= vlan.vid_begin)
return -EINVAL; return -EINVAL;
err = f(dev, SWITCHDEV_OBJ_PORT_VLAN, &vlan); err = f(dev, SWITCHDEV_OBJ_ID_PORT_VLAN, &vlan);
if (err) if (err)
return err; return err;
memset(&vlan, 0, sizeof(vlan)); memset(&vlan, 0, sizeof(vlan));
...@@ -734,7 +734,7 @@ static int switchdev_port_br_afspec(struct net_device *dev, ...@@ -734,7 +734,7 @@ static int switchdev_port_br_afspec(struct net_device *dev,
return -EINVAL; return -EINVAL;
vlan.vid_begin = vinfo->vid; vlan.vid_begin = vinfo->vid;
vlan.vid_end = 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) if (err)
return err; return err;
memset(&vlan, 0, sizeof(vlan)); memset(&vlan, 0, sizeof(vlan));
...@@ -824,7 +824,7 @@ int switchdev_port_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], ...@@ -824,7 +824,7 @@ int switchdev_port_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
.vid = vid, .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); EXPORT_SYMBOL_GPL(switchdev_port_fdb_add);
...@@ -848,7 +848,7 @@ int switchdev_port_fdb_del(struct ndmsg *ndm, struct nlattr *tb[], ...@@ -848,7 +848,7 @@ int switchdev_port_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
.vid = vid, .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); EXPORT_SYMBOL_GPL(switchdev_port_fdb_del);
...@@ -926,7 +926,7 @@ int switchdev_port_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb, ...@@ -926,7 +926,7 @@ int switchdev_port_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb,
.idx = idx, .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); switchdev_port_fdb_dump_cb);
return dump.idx; return dump.idx;
} }
...@@ -1033,7 +1033,7 @@ int switchdev_fib_ipv4_add(u32 dst, int dst_len, struct fib_info *fi, ...@@ -1033,7 +1033,7 @@ int switchdev_fib_ipv4_add(u32 dst, int dst_len, struct fib_info *fi,
if (!dev) if (!dev)
return 0; 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) if (!err)
fi->fib_flags |= RTNH_F_OFFLOAD; fi->fib_flags |= RTNH_F_OFFLOAD;
...@@ -1075,7 +1075,7 @@ int switchdev_fib_ipv4_del(u32 dst, int dst_len, struct fib_info *fi, ...@@ -1075,7 +1075,7 @@ int switchdev_fib_ipv4_del(u32 dst, int dst_len, struct fib_info *fi,
if (!dev) if (!dev)
return 0; 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) if (!err)
fi->fib_flags &= ~RTNH_F_OFFLOAD; fi->fib_flags &= ~RTNH_F_OFFLOAD;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment