summaryrefslogtreecommitdiffstats
path: root/net/switchdev
diff options
context:
space:
mode:
authorScott Feldman <sfeldma@gmail.com>2015-05-13 11:16:50 -0700
committerDavid S. Miller <davem@davemloft.net>2015-05-13 14:20:59 -0400
commit42275bd8fcb351f951781d8882f359d25976824b (patch)
tree9689357f34d19a10544b03047df26b2031364664 /net/switchdev
parent1f7bd29bc0559aedae857639ca391c815e47f1d9 (diff)
downloadlinux-42275bd8fcb351f951781d8882f359d25976824b.tar.bz2
switchdev: don't use anonymous union on switchdev attr/obj structs
Older gcc versions (e.g. gcc version 4.4.6) don't like anonymous unions which was causing build issues on the newly added switchdev attr/obj structs. Fix this by using named union on structs. Signed-off-by: Scott Feldman <sfeldma@gmail.com> Reported-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/switchdev')
-rw-r--r--net/switchdev/switchdev.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index 77f1b6e3f78e..0409f9b5bdbc 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -383,7 +383,7 @@ int switchdev_port_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
return err;
return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode,
- attr.brport_flags, mask, nlflags);
+ attr.u.brport_flags, mask, nlflags);
}
EXPORT_SYMBOL_GPL(switchdev_port_bridge_getlink);
@@ -402,9 +402,9 @@ static int switchdev_port_br_setflag(struct net_device *dev,
return err;
if (flag)
- attr.brport_flags |= brport_flag;
+ attr.u.brport_flags |= brport_flag;
else
- attr.brport_flags &= ~brport_flag;
+ attr.u.brport_flags &= ~brport_flag;
return switchdev_port_attr_set(dev, &attr);
}
@@ -466,6 +466,7 @@ static int switchdev_port_br_afspec(struct net_device *dev,
struct switchdev_obj obj = {
.id = SWITCHDEV_OBJ_PORT_VLAN,
};
+ struct switchdev_obj_vlan *vlan = &obj.u.vlan;
int rem;
int err;
@@ -475,30 +476,30 @@ static int switchdev_port_br_afspec(struct net_device *dev,
if (nla_len(attr) != sizeof(struct bridge_vlan_info))
return -EINVAL;
vinfo = nla_data(attr);
- obj.vlan.flags = vinfo->flags;
+ vlan->flags = vinfo->flags;
if (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_BEGIN) {
- if (obj.vlan.vid_start)
+ if (vlan->vid_start)
return -EINVAL;
- obj.vlan.vid_start = vinfo->vid;
+ vlan->vid_start = vinfo->vid;
} else if (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_END) {
- if (!obj.vlan.vid_start)
+ if (!vlan->vid_start)
return -EINVAL;
- obj.vlan.vid_end = vinfo->vid;
- if (obj.vlan.vid_end <= obj.vlan.vid_start)
+ vlan->vid_end = vinfo->vid;
+ if (vlan->vid_end <= vlan->vid_start)
return -EINVAL;
err = f(dev, &obj);
if (err)
return err;
- memset(&obj.vlan, 0, sizeof(obj.vlan));
+ memset(vlan, 0, sizeof(*vlan));
} else {
- if (obj.vlan.vid_start)
+ if (vlan->vid_start)
return -EINVAL;
- obj.vlan.vid_start = vinfo->vid;
- obj.vlan.vid_end = vinfo->vid;
+ vlan->vid_start = vinfo->vid;
+ vlan->vid_end = vinfo->vid;
err = f(dev, &obj);
if (err)
return err;
- memset(&obj.vlan, 0, sizeof(obj.vlan));
+ memset(vlan, 0, sizeof(*vlan));
}
}
@@ -613,10 +614,10 @@ static struct net_device *switchdev_get_dev_by_nhs(struct fib_info *fi)
return NULL;
if (nhsel > 0) {
- if (prev_attr.ppid.id_len != attr.ppid.id_len)
+ if (prev_attr.u.ppid.id_len != attr.u.ppid.id_len)
return NULL;
- if (memcmp(prev_attr.ppid.id, attr.ppid.id,
- attr.ppid.id_len))
+ if (memcmp(prev_attr.u.ppid.id, attr.u.ppid.id,
+ attr.u.ppid.id_len))
return NULL;
}
@@ -644,7 +645,7 @@ int switchdev_fib_ipv4_add(u32 dst, int dst_len, struct fib_info *fi,
{
struct switchdev_obj fib_obj = {
.id = SWITCHDEV_OBJ_IPV4_FIB,
- .ipv4_fib = {
+ .u.ipv4_fib = {
.dst = dst,
.dst_len = dst_len,
.fi = fi,
@@ -698,7 +699,7 @@ int switchdev_fib_ipv4_del(u32 dst, int dst_len, struct fib_info *fi,
{
struct switchdev_obj fib_obj = {
.id = SWITCHDEV_OBJ_IPV4_FIB,
- .ipv4_fib = {
+ .u.ipv4_fib = {
.dst = dst,
.dst_len = dst_len,
.fi = fi,