diff options
author | Scott Feldman <sfeldma@gmail.com> | 2015-05-13 14:16:50 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-05-13 14:20:59 -0400 |
commit | 42275bd8fcb351f951781d8882f359d25976824b (patch) | |
tree | 9689357f34d19a10544b03047df26b2031364664 /net/switchdev/switchdev.c | |
parent | 1f7bd29bc0559aedae857639ca391c815e47f1d9 (diff) |
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/switchdev.c')
-rw-r--r-- | net/switchdev/switchdev.c | 39 |
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, | |||
383 | return err; | 383 | return err; |
384 | 384 | ||
385 | return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, | 385 | return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, |
386 | attr.brport_flags, mask, nlflags); | 386 | attr.u.brport_flags, mask, nlflags); |
387 | } | 387 | } |
388 | EXPORT_SYMBOL_GPL(switchdev_port_bridge_getlink); | 388 | EXPORT_SYMBOL_GPL(switchdev_port_bridge_getlink); |
389 | 389 | ||
@@ -402,9 +402,9 @@ static int switchdev_port_br_setflag(struct net_device *dev, | |||
402 | return err; | 402 | return err; |
403 | 403 | ||
404 | if (flag) | 404 | if (flag) |
405 | attr.brport_flags |= brport_flag; | 405 | attr.u.brport_flags |= brport_flag; |
406 | else | 406 | else |
407 | attr.brport_flags &= ~brport_flag; | 407 | attr.u.brport_flags &= ~brport_flag; |
408 | 408 | ||
409 | return switchdev_port_attr_set(dev, &attr); | 409 | return switchdev_port_attr_set(dev, &attr); |
410 | } | 410 | } |
@@ -466,6 +466,7 @@ static int switchdev_port_br_afspec(struct net_device *dev, | |||
466 | struct switchdev_obj obj = { | 466 | struct switchdev_obj obj = { |
467 | .id = SWITCHDEV_OBJ_PORT_VLAN, | 467 | .id = SWITCHDEV_OBJ_PORT_VLAN, |
468 | }; | 468 | }; |
469 | struct switchdev_obj_vlan *vlan = &obj.u.vlan; | ||
469 | int rem; | 470 | int rem; |
470 | int err; | 471 | int err; |
471 | 472 | ||
@@ -475,30 +476,30 @@ static int switchdev_port_br_afspec(struct net_device *dev, | |||
475 | if (nla_len(attr) != sizeof(struct bridge_vlan_info)) | 476 | if (nla_len(attr) != sizeof(struct bridge_vlan_info)) |
476 | return -EINVAL; | 477 | return -EINVAL; |
477 | vinfo = nla_data(attr); | 478 | vinfo = nla_data(attr); |
478 | obj.vlan.flags = vinfo->flags; | 479 | vlan->flags = vinfo->flags; |
479 | if (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_BEGIN) { | 480 | if (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_BEGIN) { |
480 | if (obj.vlan.vid_start) | 481 | if (vlan->vid_start) |
481 | return -EINVAL; | 482 | return -EINVAL; |
482 | obj.vlan.vid_start = vinfo->vid; | 483 | vlan->vid_start = vinfo->vid; |
483 | } else if (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_END) { | 484 | } else if (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_END) { |
484 | if (!obj.vlan.vid_start) | 485 | if (!vlan->vid_start) |
485 | return -EINVAL; | 486 | return -EINVAL; |
486 | obj.vlan.vid_end = vinfo->vid; | 487 | vlan->vid_end = vinfo->vid; |
487 | if (obj.vlan.vid_end <= obj.vlan.vid_start) | 488 | if (vlan->vid_end <= vlan->vid_start) |
488 | return -EINVAL; | 489 | return -EINVAL; |
489 | err = f(dev, &obj); | 490 | err = f(dev, &obj); |
490 | if (err) | 491 | if (err) |
491 | return err; | 492 | return err; |
492 | memset(&obj.vlan, 0, sizeof(obj.vlan)); | 493 | memset(vlan, 0, sizeof(*vlan)); |
493 | } else { | 494 | } else { |
494 | if (obj.vlan.vid_start) | 495 | if (vlan->vid_start) |
495 | return -EINVAL; | 496 | return -EINVAL; |
496 | obj.vlan.vid_start = vinfo->vid; | 497 | vlan->vid_start = vinfo->vid; |
497 | obj.vlan.vid_end = vinfo->vid; | 498 | vlan->vid_end = vinfo->vid; |
498 | err = f(dev, &obj); | 499 | err = f(dev, &obj); |
499 | if (err) | 500 | if (err) |
500 | return err; | 501 | return err; |
501 | memset(&obj.vlan, 0, sizeof(obj.vlan)); | 502 | memset(vlan, 0, sizeof(*vlan)); |
502 | } | 503 | } |
503 | } | 504 | } |
504 | 505 | ||
@@ -613,10 +614,10 @@ static struct net_device *switchdev_get_dev_by_nhs(struct fib_info *fi) | |||
613 | return NULL; | 614 | return NULL; |
614 | 615 | ||
615 | if (nhsel > 0) { | 616 | if (nhsel > 0) { |
616 | if (prev_attr.ppid.id_len != attr.ppid.id_len) | 617 | if (prev_attr.u.ppid.id_len != attr.u.ppid.id_len) |
617 | return NULL; | 618 | return NULL; |
618 | if (memcmp(prev_attr.ppid.id, attr.ppid.id, | 619 | if (memcmp(prev_attr.u.ppid.id, attr.u.ppid.id, |
619 | attr.ppid.id_len)) | 620 | attr.u.ppid.id_len)) |
620 | return NULL; | 621 | return NULL; |
621 | } | 622 | } |
622 | 623 | ||
@@ -644,7 +645,7 @@ int switchdev_fib_ipv4_add(u32 dst, int dst_len, struct fib_info *fi, | |||
644 | { | 645 | { |
645 | struct switchdev_obj fib_obj = { | 646 | struct switchdev_obj fib_obj = { |
646 | .id = SWITCHDEV_OBJ_IPV4_FIB, | 647 | .id = SWITCHDEV_OBJ_IPV4_FIB, |
647 | .ipv4_fib = { | 648 | .u.ipv4_fib = { |
648 | .dst = dst, | 649 | .dst = dst, |
649 | .dst_len = dst_len, | 650 | .dst_len = dst_len, |
650 | .fi = fi, | 651 | .fi = fi, |
@@ -698,7 +699,7 @@ int switchdev_fib_ipv4_del(u32 dst, int dst_len, struct fib_info *fi, | |||
698 | { | 699 | { |
699 | struct switchdev_obj fib_obj = { | 700 | struct switchdev_obj fib_obj = { |
700 | .id = SWITCHDEV_OBJ_IPV4_FIB, | 701 | .id = SWITCHDEV_OBJ_IPV4_FIB, |
701 | .ipv4_fib = { | 702 | .u.ipv4_fib = { |
702 | .dst = dst, | 703 | .dst = dst, |
703 | .dst_len = dst_len, | 704 | .dst_len = dst_len, |
704 | .fi = fi, | 705 | .fi = fi, |