Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: bridge: mrp: Update the Test frames for MRA

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>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Horatiu Vultur and committed by
David S. Miller
f7458934 f0305e73

+38
+27
net/bridge/br_mrp.c
··· 204 204 hdr->timestamp = cpu_to_be32(jiffies_to_msecs(jiffies)); 205 205 206 206 br_mrp_skb_common(skb, mrp); 207 + 208 + /* In case the node behaves as MRA then the Test frame needs to have 209 + * an Option TLV which includes eventually a sub-option TLV that has 210 + * the type AUTO_MGR 211 + */ 212 + if (mrp->ring_role == BR_MRP_RING_ROLE_MRA) { 213 + struct br_mrp_sub_option1_hdr *sub_opt = NULL; 214 + struct br_mrp_tlv_hdr *sub_tlv = NULL; 215 + struct br_mrp_oui_hdr *oui = NULL; 216 + u8 length; 217 + 218 + length = sizeof(*sub_opt) + sizeof(*sub_tlv) + sizeof(oui) + 219 + MRP_OPT_PADDING; 220 + br_mrp_skb_tlv(skb, BR_MRP_TLV_HEADER_OPTION, length); 221 + 222 + oui = skb_put(skb, sizeof(*oui)); 223 + memset(oui, 0x0, sizeof(*oui)); 224 + sub_opt = skb_put(skb, sizeof(*sub_opt)); 225 + memset(sub_opt, 0x0, sizeof(*sub_opt)); 226 + 227 + sub_tlv = skb_put(skb, sizeof(*sub_tlv)); 228 + sub_tlv->type = BR_MRP_SUB_TLV_HEADER_TEST_AUTO_MGR; 229 + 230 + /* 32 bit alligment shall be ensured therefore add 2 bytes */ 231 + skb_put(skb, MRP_OPT_PADDING); 232 + } 233 + 207 234 br_mrp_skb_tlv(skb, BR_MRP_TLV_HEADER_END, 0x0); 208 235 209 236 return skb;
+11
net/bridge/br_private_mrp.h
··· 6 6 #include "br_private.h" 7 7 #include <uapi/linux/mrp_bridge.h> 8 8 9 + #define MRP_OPT_PADDING 0x2 10 + 9 11 struct br_mrp { 10 12 /* list of mrp instances */ 11 13 struct hlist_node list; ··· 135 133 __be16 transitions; 136 134 __be32 timestamp; 137 135 } __attribute__((__packed__)); 136 + 137 + struct br_mrp_oui_hdr { 138 + __u8 oui[MRP_OUI_LENGTH]; 139 + }; 140 + 141 + struct br_mrp_sub_option1_hdr { 142 + __u8 type; 143 + __u8 data[MRP_MANUFACTURE_DATA_LENGTH]; 144 + }; 138 145 139 146 #endif /* _BR_PRIVATE_MRP_H */