Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 42275bd8 authored by Scott Feldman's avatar Scott Feldman Committed by David S. Miller
Browse files

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: default avatarScott Feldman <sfeldma@gmail.com>
Reported-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1f7bd29b
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -4339,11 +4339,11 @@ static int rocker_port_attr_get(struct net_device *dev,

	switch (attr->id) {
	case SWITCHDEV_ATTR_PORT_PARENT_ID:
		attr->ppid.id_len = sizeof(rocker->hw.id);
		memcpy(&attr->ppid.id, &rocker->hw.id, attr->ppid.id_len);
		attr->u.ppid.id_len = sizeof(rocker->hw.id);
		memcpy(&attr->u.ppid.id, &rocker->hw.id, attr->u.ppid.id_len);
		break;
	case SWITCHDEV_ATTR_PORT_BRIDGE_FLAGS:
		attr->brport_flags = rocker_port->brport_flags;
		attr->u.brport_flags = rocker_port->brport_flags;
		break;
	default:
		return -EOPNOTSUPP;
@@ -4400,11 +4400,11 @@ static int rocker_port_attr_set(struct net_device *dev,
	switch (attr->id) {
	case SWITCHDEV_ATTR_PORT_STP_STATE:
		err = rocker_port_stp_update(rocker_port, attr->trans,
					     attr->stp_state);
					     attr->u.stp_state);
		break;
	case SWITCHDEV_ATTR_PORT_BRIDGE_FLAGS:
		err = rocker_port_brport_flags_set(rocker_port, attr->trans,
						   attr->brport_flags);
						   attr->u.brport_flags);
		break;
	default:
		err = -EOPNOTSUPP;
@@ -4466,10 +4466,10 @@ static int rocker_port_obj_add(struct net_device *dev,
	switch (obj->id) {
	case SWITCHDEV_OBJ_PORT_VLAN:
		err = rocker_port_vlans_add(rocker_port, obj->trans,
					    &obj->vlan);
					    &obj->u.vlan);
		break;
	case SWITCHDEV_OBJ_IPV4_FIB:
		fib4 = &obj->ipv4_fib;
		fib4 = &obj->u.ipv4_fib;
		err = rocker_port_fib_ipv4(rocker_port, obj->trans,
					   htonl(fib4->dst), fib4->dst_len,
					   fib4->fi, fib4->tb_id, 0);
@@ -4520,10 +4520,10 @@ static int rocker_port_obj_del(struct net_device *dev,

	switch (obj->id) {
	case SWITCHDEV_OBJ_PORT_VLAN:
		err = rocker_port_vlans_del(rocker_port, &obj->vlan);
		err = rocker_port_vlans_del(rocker_port, &obj->u.vlan);
		break;
	case SWITCHDEV_OBJ_IPV4_FIB:
		fib4 = &obj->ipv4_fib;
		fib4 = &obj->u.ipv4_fib;
		err = rocker_port_fib_ipv4(rocker_port, SWITCHDEV_TRANS_NONE,
					   htonl(fib4->dst), fib4->dst_len,
					   fib4->fi, fib4->tb_id,
+2 −2
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ struct switchdev_attr {
		struct netdev_phys_item_id ppid;	/* PORT_PARENT_ID */
		u8 stp_state;				/* PORT_STP_STATE */
		unsigned long brport_flags;		/* PORT_BRIDGE_FLAGS */
	};
	} u;
};

struct fib_info;
@@ -67,7 +67,7 @@ struct switchdev_obj {
			u32 nlflags;
			u32 tb_id;
		} ipv4_fib;
	};
	} u;
};

/**
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ void br_set_state(struct net_bridge_port *p, unsigned int state)
{
	struct switchdev_attr attr = {
		.id = SWITCHDEV_ATTR_PORT_STP_STATE,
		.stp_state = state,
		.u.stp_state = state,
	};
	int err;

+2 −2
Original line number Diff line number Diff line
@@ -465,8 +465,8 @@ static ssize_t phys_switch_id_show(struct device *dev,

		ret = switchdev_port_attr_get(netdev, &attr);
		if (!ret)
			ret = sprintf(buf, "%*phN\n", attr.ppid.id_len,
				      attr.ppid.id);
			ret = sprintf(buf, "%*phN\n", attr.u.ppid.id_len,
				      attr.u.ppid.id);
	}
	rtnl_unlock();

+2 −1
Original line number Diff line number Diff line
@@ -1016,7 +1016,8 @@ static int rtnl_phys_switch_id_fill(struct sk_buff *skb, struct net_device *dev)
		return err;
	}

	if (nla_put(skb, IFLA_PHYS_SWITCH_ID, attr.ppid.id_len, attr.ppid.id))
	if (nla_put(skb, IFLA_PHYS_SWITCH_ID, attr.u.ppid.id_len,
		    attr.u.ppid.id))
		return -EMSGSIZE;

	return 0;
Loading