* [PATCH net-next] net: bridge: mrp: Update the Test frames for MRA
@ 2021-06-26 20:18 ` Horatiu Vultur
0 siblings, 0 replies; 4+ messages in thread
From: Horatiu Vultur @ 2021-06-26 20:18 UTC (permalink / raw)
To: roopa, nikolay, davem, kuba, bridge, netdev; +Cc: Horatiu Vultur
According to the standard IEC 62439-2, in case the node behaves as MRA
and needs to send Test frames on ring ports, then these Test frames need
to have an Option TLV and a Sub-Option TLV which has the type AUTO_MGR.
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
net/bridge/br_mrp.c | 27 +++++++++++++++++++++++++++
net/bridge/br_private_mrp.h | 11 +++++++++++
2 files changed, 38 insertions(+)
diff --git a/net/bridge/br_mrp.c b/net/bridge/br_mrp.c
index f7012b7d7ce4..fd2de35ffb3c 100644
--- a/net/bridge/br_mrp.c
+++ b/net/bridge/br_mrp.c
@@ -204,6 +204,33 @@ static struct sk_buff *br_mrp_alloc_test_skb(struct br_mrp *mrp,
hdr->timestamp = cpu_to_be32(jiffies_to_msecs(jiffies));
br_mrp_skb_common(skb, mrp);
+
+ /* In case the node behaves as MRA then the Test frame needs to have
+ * an Option TLV which includes eventually a sub-option TLV that has
+ * the type AUTO_MGR
+ */
+ if (mrp->ring_role == BR_MRP_RING_ROLE_MRA) {
+ struct br_mrp_sub_option1_hdr *sub_opt = NULL;
+ struct br_mrp_tlv_hdr *sub_tlv = NULL;
+ struct br_mrp_oui_hdr *oui = NULL;
+ u8 length;
+
+ length = sizeof(*sub_opt) + sizeof(*sub_tlv) + sizeof(oui) +
+ MRP_OPT_PADDING;
+ br_mrp_skb_tlv(skb, BR_MRP_TLV_HEADER_OPTION, length);
+
+ oui = skb_put(skb, sizeof(*oui));
+ memset(oui, 0x0, sizeof(*oui));
+ sub_opt = skb_put(skb, sizeof(*sub_opt));
+ memset(sub_opt, 0x0, sizeof(*sub_opt));
+
+ sub_tlv = skb_put(skb, sizeof(*sub_tlv));
+ sub_tlv->type = BR_MRP_SUB_TLV_HEADER_TEST_AUTO_MGR;
+
+ /* 32 bit alligment shall be ensured therefore add 2 bytes */
+ skb_put(skb, MRP_OPT_PADDING);
+ }
+
br_mrp_skb_tlv(skb, BR_MRP_TLV_HEADER_END, 0x0);
return skb;
diff --git a/net/bridge/br_private_mrp.h b/net/bridge/br_private_mrp.h
index 9559aa2750fb..bda8e1896712 100644
--- a/net/bridge/br_private_mrp.h
+++ b/net/bridge/br_private_mrp.h
@@ -6,6 +6,8 @@
#include "br_private.h"
#include <uapi/linux/mrp_bridge.h>
+#define MRP_OPT_PADDING 0x2
+
struct br_mrp {
/* list of mrp instances */
struct hlist_node list;
@@ -134,4 +136,13 @@ struct br_mrp_in_test_hdr {
__be32 timestamp;
} __attribute__((__packed__));
+struct br_mrp_oui_hdr {
+ __u8 oui[MRP_OUI_LENGTH];
+};
+
+struct br_mrp_sub_option1_hdr {
+ __u8 type;
+ __u8 data[MRP_MANUFACTURE_DATA_LENGTH];
+};
+
#endif /* _BR_PRIVATE_MRP_H */
--
2.31.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Bridge] [PATCH net-next] net: bridge: mrp: Update the Test frames for MRA
@ 2021-06-26 20:18 ` Horatiu Vultur
0 siblings, 0 replies; 4+ messages in thread
From: Horatiu Vultur @ 2021-06-26 20:18 UTC (permalink / raw)
To: roopa, nikolay, davem, kuba, bridge, netdev; +Cc: Horatiu Vultur
According to the standard IEC 62439-2, in case the node behaves as MRA
and needs to send Test frames on ring ports, then these Test frames need
to have an Option TLV and a Sub-Option TLV which has the type AUTO_MGR.
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
net/bridge/br_mrp.c | 27 +++++++++++++++++++++++++++
net/bridge/br_private_mrp.h | 11 +++++++++++
2 files changed, 38 insertions(+)
diff --git a/net/bridge/br_mrp.c b/net/bridge/br_mrp.c
index f7012b7d7ce4..fd2de35ffb3c 100644
--- a/net/bridge/br_mrp.c
+++ b/net/bridge/br_mrp.c
@@ -204,6 +204,33 @@ static struct sk_buff *br_mrp_alloc_test_skb(struct br_mrp *mrp,
hdr->timestamp = cpu_to_be32(jiffies_to_msecs(jiffies));
br_mrp_skb_common(skb, mrp);
+
+ /* In case the node behaves as MRA then the Test frame needs to have
+ * an Option TLV which includes eventually a sub-option TLV that has
+ * the type AUTO_MGR
+ */
+ if (mrp->ring_role == BR_MRP_RING_ROLE_MRA) {
+ struct br_mrp_sub_option1_hdr *sub_opt = NULL;
+ struct br_mrp_tlv_hdr *sub_tlv = NULL;
+ struct br_mrp_oui_hdr *oui = NULL;
+ u8 length;
+
+ length = sizeof(*sub_opt) + sizeof(*sub_tlv) + sizeof(oui) +
+ MRP_OPT_PADDING;
+ br_mrp_skb_tlv(skb, BR_MRP_TLV_HEADER_OPTION, length);
+
+ oui = skb_put(skb, sizeof(*oui));
+ memset(oui, 0x0, sizeof(*oui));
+ sub_opt = skb_put(skb, sizeof(*sub_opt));
+ memset(sub_opt, 0x0, sizeof(*sub_opt));
+
+ sub_tlv = skb_put(skb, sizeof(*sub_tlv));
+ sub_tlv->type = BR_MRP_SUB_TLV_HEADER_TEST_AUTO_MGR;
+
+ /* 32 bit alligment shall be ensured therefore add 2 bytes */
+ skb_put(skb, MRP_OPT_PADDING);
+ }
+
br_mrp_skb_tlv(skb, BR_MRP_TLV_HEADER_END, 0x0);
return skb;
diff --git a/net/bridge/br_private_mrp.h b/net/bridge/br_private_mrp.h
index 9559aa2750fb..bda8e1896712 100644
--- a/net/bridge/br_private_mrp.h
+++ b/net/bridge/br_private_mrp.h
@@ -6,6 +6,8 @@
#include "br_private.h"
#include <uapi/linux/mrp_bridge.h>
+#define MRP_OPT_PADDING 0x2
+
struct br_mrp {
/* list of mrp instances */
struct hlist_node list;
@@ -134,4 +136,13 @@ struct br_mrp_in_test_hdr {
__be32 timestamp;
} __attribute__((__packed__));
+struct br_mrp_oui_hdr {
+ __u8 oui[MRP_OUI_LENGTH];
+};
+
+struct br_mrp_sub_option1_hdr {
+ __u8 type;
+ __u8 data[MRP_MANUFACTURE_DATA_LENGTH];
+};
+
#endif /* _BR_PRIVATE_MRP_H */
--
2.31.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: bridge: mrp: Update the Test frames for MRA
2021-06-26 20:18 ` [Bridge] " Horatiu Vultur
@ 2021-06-28 23:10 ` patchwork-bot+netdevbpf
-1 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-06-28 23:10 UTC (permalink / raw)
To: Horatiu Vultur; +Cc: roopa, nikolay, davem, kuba, bridge, netdev
Hello:
This patch was applied to netdev/net-next.git (refs/heads/master):
On Sat, 26 Jun 2021 22:18:04 +0200 you wrote:
> According to the standard IEC 62439-2, in case the node behaves as MRA
> and needs to send Test frames on ring ports, then these Test frames need
> to have an Option TLV and a Sub-Option TLV which has the type AUTO_MGR.
>
> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> ---
> net/bridge/br_mrp.c | 27 +++++++++++++++++++++++++++
> net/bridge/br_private_mrp.h | 11 +++++++++++
> 2 files changed, 38 insertions(+)
Here is the summary with links:
- [net-next] net: bridge: mrp: Update the Test frames for MRA
https://git.kernel.org/netdev/net-next/c/f7458934b079
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Bridge] [PATCH net-next] net: bridge: mrp: Update the Test frames for MRA
@ 2021-06-28 23:10 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-06-28 23:10 UTC (permalink / raw)
To: Horatiu Vultur; +Cc: netdev, bridge, nikolay, roopa, kuba, davem
Hello:
This patch was applied to netdev/net-next.git (refs/heads/master):
On Sat, 26 Jun 2021 22:18:04 +0200 you wrote:
> According to the standard IEC 62439-2, in case the node behaves as MRA
> and needs to send Test frames on ring ports, then these Test frames need
> to have an Option TLV and a Sub-Option TLV which has the type AUTO_MGR.
>
> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> ---
> net/bridge/br_mrp.c | 27 +++++++++++++++++++++++++++
> net/bridge/br_private_mrp.h | 11 +++++++++++
> 2 files changed, 38 insertions(+)
Here is the summary with links:
- [net-next] net: bridge: mrp: Update the Test frames for MRA
https://git.kernel.org/netdev/net-next/c/f7458934b079
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-06-28 23:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-26 20:18 [PATCH net-next] net: bridge: mrp: Update the Test frames for MRA Horatiu Vultur
2021-06-26 20:18 ` [Bridge] " Horatiu Vultur
2021-06-28 23:10 ` patchwork-bot+netdevbpf
2021-06-28 23:10 ` [Bridge] " patchwork-bot+netdevbpf
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.