linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2 0/2] bridge: mrp: Update MRP_PORT_ROLE
@ 2020-06-23  9:05 Horatiu Vultur
  2020-06-23  9:05 ` [PATCH net v2 1/2] bridge: uapi: mrp: Fix MRP_PORT_ROLE Horatiu Vultur
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Horatiu Vultur @ 2020-06-23  9:05 UTC (permalink / raw)
  To: nikolay, roopa, davem, kuba, linux-kernel, bridge, netdev,
	UNGLinuxDriver
  Cc: Horatiu Vultur

This patch series does the following:
- fixes the enum br_mrp_port_role_type. It removes the port role none(0x2)
  because this is in conflict with the standard. The standard defines the
  interconnect port role as value 0x2.
- adds checks regarding current defined port roles: primary(0x0) and
  secondary(0x1).

v2:
 - add the validation code when setting the port role.

Horatiu Vultur (2):
  bridge: uapi: mrp: Fix MRP_PORT_ROLE
  bridge: mrp: Validate when setting the port role

 include/uapi/linux/mrp_bridge.h |  1 -
 net/bridge/br_mrp.c             | 10 ++++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

-- 
2.26.2


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

* [PATCH net v2 1/2] bridge: uapi: mrp: Fix MRP_PORT_ROLE
  2020-06-23  9:05 [PATCH net v2 0/2] bridge: mrp: Update MRP_PORT_ROLE Horatiu Vultur
@ 2020-06-23  9:05 ` Horatiu Vultur
  2020-06-23  9:05 ` [PATCH net v2 2/2] bridge: mrp: Validate when setting the port role Horatiu Vultur
  2020-06-23 21:38 ` [PATCH net v2 0/2] bridge: mrp: Update MRP_PORT_ROLE David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: Horatiu Vultur @ 2020-06-23  9:05 UTC (permalink / raw)
  To: nikolay, roopa, davem, kuba, linux-kernel, bridge, netdev,
	UNGLinuxDriver
  Cc: Horatiu Vultur

Currently the MRP_PORT_ROLE_NONE has the value 0x2 but this is in conflict
with the IEC 62439-2 standard. The standard defines the following port
roles: primary (0x0), secondary(0x1), interconnect(0x2).
Therefore remove the port role none.

Fixes: 4714d13791f831 ("bridge: uapi: mrp: Add mrp attributes.")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
 include/uapi/linux/mrp_bridge.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/uapi/linux/mrp_bridge.h b/include/uapi/linux/mrp_bridge.h
index 84f15f48a7cb1..bee3665402129 100644
--- a/include/uapi/linux/mrp_bridge.h
+++ b/include/uapi/linux/mrp_bridge.h
@@ -36,7 +36,6 @@ enum br_mrp_port_state_type {
 enum br_mrp_port_role_type {
 	BR_MRP_PORT_ROLE_PRIMARY,
 	BR_MRP_PORT_ROLE_SECONDARY,
-	BR_MRP_PORT_ROLE_NONE,
 };
 
 enum br_mrp_tlv_header_type {
-- 
2.26.2


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

* [PATCH net v2 2/2] bridge: mrp: Validate when setting the port role
  2020-06-23  9:05 [PATCH net v2 0/2] bridge: mrp: Update MRP_PORT_ROLE Horatiu Vultur
  2020-06-23  9:05 ` [PATCH net v2 1/2] bridge: uapi: mrp: Fix MRP_PORT_ROLE Horatiu Vultur
@ 2020-06-23  9:05 ` Horatiu Vultur
  2020-06-23 21:38 ` [PATCH net v2 0/2] bridge: mrp: Update MRP_PORT_ROLE David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: Horatiu Vultur @ 2020-06-23  9:05 UTC (permalink / raw)
  To: nikolay, roopa, davem, kuba, linux-kernel, bridge, netdev,
	UNGLinuxDriver
  Cc: Horatiu Vultur

This patch adds specific checks for primary(0x0) and secondary(0x1) when
setting the port role. For any other value the function
'br_mrp_set_port_role' will return -EINVAL.

Fixes: 20f6a05ef63594 ("bridge: mrp: Rework the MRP netlink interface")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
 net/bridge/br_mrp.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/net/bridge/br_mrp.c b/net/bridge/br_mrp.c
index 24986ec7d38cc..779e1eb754430 100644
--- a/net/bridge/br_mrp.c
+++ b/net/bridge/br_mrp.c
@@ -411,10 +411,16 @@ int br_mrp_set_port_role(struct net_bridge_port *p,
 	if (!mrp)
 		return -EINVAL;
 
-	if (role == BR_MRP_PORT_ROLE_PRIMARY)
+	switch (role) {
+	case BR_MRP_PORT_ROLE_PRIMARY:
 		rcu_assign_pointer(mrp->p_port, p);
-	else
+		break;
+	case BR_MRP_PORT_ROLE_SECONDARY:
 		rcu_assign_pointer(mrp->s_port, p);
+		break;
+	default:
+		return -EINVAL;
+	}
 
 	br_mrp_port_switchdev_set_role(p, role);
 
-- 
2.26.2


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

* Re: [PATCH net v2 0/2] bridge: mrp: Update MRP_PORT_ROLE
  2020-06-23  9:05 [PATCH net v2 0/2] bridge: mrp: Update MRP_PORT_ROLE Horatiu Vultur
  2020-06-23  9:05 ` [PATCH net v2 1/2] bridge: uapi: mrp: Fix MRP_PORT_ROLE Horatiu Vultur
  2020-06-23  9:05 ` [PATCH net v2 2/2] bridge: mrp: Validate when setting the port role Horatiu Vultur
@ 2020-06-23 21:38 ` David Miller
  2020-06-24 11:31   ` Horatiu Vultur
  2 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2020-06-23 21:38 UTC (permalink / raw)
  To: horatiu.vultur
  Cc: nikolay, roopa, kuba, linux-kernel, bridge, netdev, UNGLinuxDriver

From: Horatiu Vultur <horatiu.vultur@microchip.com>
Date: Tue, 23 Jun 2020 11:05:39 +0200

> This patch series does the following:
> - fixes the enum br_mrp_port_role_type. It removes the port role none(0x2)
>   because this is in conflict with the standard. The standard defines the
>   interconnect port role as value 0x2.
> - adds checks regarding current defined port roles: primary(0x0) and
>   secondary(0x1).
> 
> v2:
>  - add the validation code when setting the port role.

Series applied, thank you.

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

* Re: [PATCH net v2 0/2] bridge: mrp: Update MRP_PORT_ROLE
  2020-06-23 21:38 ` [PATCH net v2 0/2] bridge: mrp: Update MRP_PORT_ROLE David Miller
@ 2020-06-24 11:31   ` Horatiu Vultur
  2020-06-24 15:24     ` Vladimir Oltean
  0 siblings, 1 reply; 6+ messages in thread
From: Horatiu Vultur @ 2020-06-24 11:31 UTC (permalink / raw)
  To: David Miller
  Cc: nikolay, roopa, kuba, linux-kernel, bridge, netdev, UNGLinuxDriver

The 06/23/2020 14:38, David Miller wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> From: Horatiu Vultur <horatiu.vultur@microchip.com>
> Date: Tue, 23 Jun 2020 11:05:39 +0200
> 
> > This patch series does the following:
> > - fixes the enum br_mrp_port_role_type. It removes the port role none(0x2)
> >   because this is in conflict with the standard. The standard defines the
> >   interconnect port role as value 0x2.
> > - adds checks regarding current defined port roles: primary(0x0) and
> >   secondary(0x1).
> >
> > v2:
> >  - add the validation code when setting the port role.
> 
> Series applied, thank you.

Thanks. Will these patches be applied also on net-next?
Because if I start now to add support for the interconnect port, these
patches are needed on net-next. Or do I need to add these patches to the
patch series for the interconnect port?
What is the correct way of doing this?

-- 
/Horatiu

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

* Re: [PATCH net v2 0/2] bridge: mrp: Update MRP_PORT_ROLE
  2020-06-24 11:31   ` Horatiu Vultur
@ 2020-06-24 15:24     ` Vladimir Oltean
  0 siblings, 0 replies; 6+ messages in thread
From: Vladimir Oltean @ 2020-06-24 15:24 UTC (permalink / raw)
  To: Horatiu Vultur
  Cc: David Miller, Nikolay Aleksandrov, Roopa Prabhu, Jakub Kicinski,
	lkml, bridge, netdev, Microchip Linux Driver Support

Hi Horatiu,

On Wed, 24 Jun 2020 at 14:34, Horatiu Vultur
<horatiu.vultur@microchip.com> wrote:
>
> The 06/23/2020 14:38, David Miller wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> >
> > From: Horatiu Vultur <horatiu.vultur@microchip.com>
> > Date: Tue, 23 Jun 2020 11:05:39 +0200
> >
> > > This patch series does the following:
> > > - fixes the enum br_mrp_port_role_type. It removes the port role none(0x2)
> > >   because this is in conflict with the standard. The standard defines the
> > >   interconnect port role as value 0x2.
> > > - adds checks regarding current defined port roles: primary(0x0) and
> > >   secondary(0x1).
> > >
> > > v2:
> > >  - add the validation code when setting the port role.
> >
> > Series applied, thank you.
>
> Thanks. Will these patches be applied also on net-next?
> Because if I start now to add support for the interconnect port, these
> patches are needed on net-next. Or do I need to add these patches to the
> patch series for the interconnect port?
> What is the correct way of doing this?
>
> --
> /Horatiu

The "net" tree is merged weekly (or so) by David into "net-next". So,
your patches should be available at the beginning of the next week.

Cheers,
-Vladimir

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

end of thread, other threads:[~2020-06-24 15:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-23  9:05 [PATCH net v2 0/2] bridge: mrp: Update MRP_PORT_ROLE Horatiu Vultur
2020-06-23  9:05 ` [PATCH net v2 1/2] bridge: uapi: mrp: Fix MRP_PORT_ROLE Horatiu Vultur
2020-06-23  9:05 ` [PATCH net v2 2/2] bridge: mrp: Validate when setting the port role Horatiu Vultur
2020-06-23 21:38 ` [PATCH net v2 0/2] bridge: mrp: Update MRP_PORT_ROLE David Miller
2020-06-24 11:31   ` Horatiu Vultur
2020-06-24 15:24     ` Vladimir Oltean

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).