All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net/bridge: Enable bridge also when switchdev can't be built
@ 2015-05-13 10:08 Or Gerlitz
  2015-05-13 15:44 ` Scott Feldman
  0 siblings, 1 reply; 4+ messages in thread
From: Or Gerlitz @ 2015-05-13 10:08 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Scott Feldman, Jiri Pirko, Or Gerlitz

Currently switchdev doesn't build on older gcc version such as 4.4.6

The reason for the compile error is such that it causes a failure
to build the bridge too, even when switchdev isn't configured (the
stub isn't enough), fix it.

CC [M]  net/bridge/br_stp.o
net/bridge/br_stp.c: In function 'br_set_state':
net/bridge/br_stp.c:44: error: unknown field 'stp_state' specified in initializer

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 net/bridge/br_stp.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c
index b9300da..752783a 100644
--- a/net/bridge/br_stp.c
+++ b/net/bridge/br_stp.c
@@ -39,17 +39,19 @@ void br_log_state(const struct net_bridge_port *p)
 
 void br_set_state(struct net_bridge_port *p, unsigned int state)
 {
+#ifdef CONFIG_NET_SWITCHDEV
 	struct switchdev_attr attr = {
 		.id = SWITCHDEV_ATTR_PORT_STP_STATE,
 		.stp_state = state,
 	};
 	int err;
 
-	p->state = state;
 	err = switchdev_port_attr_set(p->dev, &attr);
 	if (err && err != -EOPNOTSUPP)
 		br_warn(p->br, "error setting offload STP state on port %u(%s)\n",
 				(unsigned int) p->port_no, p->dev->name);
+#endif
+	p->state = state;
 }
 
 /* called under bridge lock */
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net/bridge: Enable bridge also when switchdev can't be built
  2015-05-13 10:08 [PATCH net-next] net/bridge: Enable bridge also when switchdev can't be built Or Gerlitz
@ 2015-05-13 15:44 ` Scott Feldman
  2015-05-13 15:47   ` Jiri Pirko
  0 siblings, 1 reply; 4+ messages in thread
From: Scott Feldman @ 2015-05-13 15:44 UTC (permalink / raw)
  To: Or Gerlitz; +Cc: David S. Miller, Netdev, Jiri Pirko

On Wed, May 13, 2015 at 3:08 AM, Or Gerlitz <ogerlitz@mellanox.com> wrote:
> Currently switchdev doesn't build on older gcc version such as 4.4.6
>
> The reason for the compile error is such that it causes a failure
> to build the bridge too, even when switchdev isn't configured (the
> stub isn't enough), fix it.
>
> CC [M]  net/bridge/br_stp.o
> net/bridge/br_stp.c: In function 'br_set_state':
> net/bridge/br_stp.c:44: error: unknown field 'stp_state' specified in initializer
>
> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
> ---
>  net/bridge/br_stp.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c
> index b9300da..752783a 100644
> --- a/net/bridge/br_stp.c
> +++ b/net/bridge/br_stp.c
> @@ -39,17 +39,19 @@ void br_log_state(const struct net_bridge_port *p)
>
>  void br_set_state(struct net_bridge_port *p, unsigned int state)
>  {
> +#ifdef CONFIG_NET_SWITCHDEV
>         struct switchdev_attr attr = {
>                 .id = SWITCHDEV_ATTR_PORT_STP_STATE,
>                 .stp_state = state,
>         };
>         int err;
>
> -       p->state = state;
>         err = switchdev_port_attr_set(p->dev, &attr);
>         if (err && err != -EOPNOTSUPP)
>                 br_warn(p->br, "error setting offload STP state on port %u(%s)\n",
>                                 (unsigned int) p->port_no, p->dev->name);
> +#endif
> +       p->state = state;
>  }

Isn't this the same issue with anonymous unions and older gcc?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net/bridge: Enable bridge also when switchdev can't be built
  2015-05-13 15:44 ` Scott Feldman
@ 2015-05-13 15:47   ` Jiri Pirko
  2015-05-13 15:54     ` Scott Feldman
  0 siblings, 1 reply; 4+ messages in thread
From: Jiri Pirko @ 2015-05-13 15:47 UTC (permalink / raw)
  To: Scott Feldman; +Cc: Or Gerlitz, David S. Miller, Netdev

Wed, May 13, 2015 at 05:44:11PM CEST, sfeldma@gmail.com wrote:
>On Wed, May 13, 2015 at 3:08 AM, Or Gerlitz <ogerlitz@mellanox.com> wrote:
>> Currently switchdev doesn't build on older gcc version such as 4.4.6
>>
>> The reason for the compile error is such that it causes a failure
>> to build the bridge too, even when switchdev isn't configured (the
>> stub isn't enough), fix it.
>>
>> CC [M]  net/bridge/br_stp.o
>> net/bridge/br_stp.c: In function 'br_set_state':
>> net/bridge/br_stp.c:44: error: unknown field 'stp_state' specified in initializer
>>
>> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
>> ---
>>  net/bridge/br_stp.c |    4 +++-
>>  1 files changed, 3 insertions(+), 1 deletions(-)
>>
>> diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c
>> index b9300da..752783a 100644
>> --- a/net/bridge/br_stp.c
>> +++ b/net/bridge/br_stp.c
>> @@ -39,17 +39,19 @@ void br_log_state(const struct net_bridge_port *p)
>>
>>  void br_set_state(struct net_bridge_port *p, unsigned int state)
>>  {
>> +#ifdef CONFIG_NET_SWITCHDEV
>>         struct switchdev_attr attr = {
>>                 .id = SWITCHDEV_ATTR_PORT_STP_STATE,
>>                 .stp_state = state,
>>         };
>>         int err;
>>
>> -       p->state = state;
>>         err = switchdev_port_attr_set(p->dev, &attr);
>>         if (err && err != -EOPNOTSUPP)
>>                 br_warn(p->br, "error setting offload STP state on port %u(%s)\n",
>>                                 (unsigned int) p->port_no, p->dev->name);
>> +#endif
>> +       p->state = state;
>>  }
>
>Isn't this the same issue with anonymous unions and older gcc?

I believe it is

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net/bridge: Enable bridge also when switchdev can't be built
  2015-05-13 15:47   ` Jiri Pirko
@ 2015-05-13 15:54     ` Scott Feldman
  0 siblings, 0 replies; 4+ messages in thread
From: Scott Feldman @ 2015-05-13 15:54 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: Or Gerlitz, David S. Miller, Netdev

On Wed, May 13, 2015 at 8:47 AM, Jiri Pirko <jiri@resnulli.us> wrote:
> Wed, May 13, 2015 at 05:44:11PM CEST, sfeldma@gmail.com wrote:
>>On Wed, May 13, 2015 at 3:08 AM, Or Gerlitz <ogerlitz@mellanox.com> wrote:
>>> Currently switchdev doesn't build on older gcc version such as 4.4.6
>>>
>>> The reason for the compile error is such that it causes a failure
>>> to build the bridge too, even when switchdev isn't configured (the
>>> stub isn't enough), fix it.
>>>
>>> CC [M]  net/bridge/br_stp.o
>>> net/bridge/br_stp.c: In function 'br_set_state':
>>> net/bridge/br_stp.c:44: error: unknown field 'stp_state' specified in initializer
>>>
>>> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
>>> ---
>>>  net/bridge/br_stp.c |    4 +++-
>>>  1 files changed, 3 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c
>>> index b9300da..752783a 100644
>>> --- a/net/bridge/br_stp.c
>>> +++ b/net/bridge/br_stp.c
>>> @@ -39,17 +39,19 @@ void br_log_state(const struct net_bridge_port *p)
>>>
>>>  void br_set_state(struct net_bridge_port *p, unsigned int state)
>>>  {
>>> +#ifdef CONFIG_NET_SWITCHDEV
>>>         struct switchdev_attr attr = {
>>>                 .id = SWITCHDEV_ATTR_PORT_STP_STATE,
>>>                 .stp_state = state,
>>>         };
>>>         int err;
>>>
>>> -       p->state = state;
>>>         err = switchdev_port_attr_set(p->dev, &attr);
>>>         if (err && err != -EOPNOTSUPP)
>>>                 br_warn(p->br, "error setting offload STP state on port %u(%s)\n",
>>>                                 (unsigned int) p->port_no, p->dev->name);
>>> +#endif
>>> +       p->state = state;
>>>  }
>>
>>Isn't this the same issue with anonymous unions and older gcc?
>
> I believe it is

Ok, I'll have a patch shortly to add ".u"...

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-13 15:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-13 10:08 [PATCH net-next] net/bridge: Enable bridge also when switchdev can't be built Or Gerlitz
2015-05-13 15:44 ` Scott Feldman
2015-05-13 15:47   ` Jiri Pirko
2015-05-13 15:54     ` Scott Feldman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.