[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BYAPR11MB355805618F510948EAE18278ECE3A@BYAPR11MB3558.namprd11.prod.outlook.com>
Date: Fri, 25 Aug 2023 18:10:09 +0000
From: <Tristram.Ha@...rochip.com>
To: <lukma@...x.de>
CC: <andrew@...n.ch>, <f.fainelli@...il.com>, <kuba@...nel.org>,
<edumazet@...gle.com>, <bigeasy@...utronix.de>,
<pabeni@...hat.com>, <koverskeid@...il.com>,
<matthieu.baerts@...sares.net>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <davem@...emloft.net>
Subject: RE: [PATCH] net: hsr : Provide fix for HSRv1 supervisor frames
decoding
> - /* And leave the HSR tag. */
> + * And leave the HSR tag.
> + *
> + * The HSRv1 supervisory frame encapsulates the v0 frame
> + * with EtherType of 0x88FB
> + */
> if (ethhdr->h_proto == htons(ETH_P_HSR)) {
> - pull_size = sizeof(struct ethhdr);
> + if (hsr->prot_version == HSR_V1)
> + /* In the above step the DA, SA and EtherType
> + * (0x892F - HSRv1) bytes has been removed.
> + *
> + * As the HSRv1 has the HSR header added, one need
> + * to remove path_and_LSDU_size and sequence_nr fields.
> + *
> + */
> + pull_size = 4;
> + else
> + pull_size = sizeof(struct hsr_tag);
> +
> skb_pull(skb, pull_size);
> total_pull_size += pull_size;
> }
> @@ -313,6 +328,19 @@ void hsr_handle_sup_frame(struct hsr_frame_info *frame)
> total_pull_size += pull_size;
>
> /* get HSR sup payload */
> + if (hsr->prot_version == HSR_V1) {
> + /* In the HSRv1 supervisor frame, when
> + * one with EtherType = 0x88FB is extracted, the Node A
> + * MAC address is preceded with type and length elements of TLV
> + * data field.
> + *
> + * It needs to be removed to get the remote peer MAC address.
> + */
> + pull_size = sizeof(struct hsr_sup_tlv);
> + skb_pull(skb, pull_size);
> + total_pull_size += pull_size;
> + }
> +
> hsr_sp = (struct hsr_sup_payload *)skb->data;
I thought the fix is simply this:
if (ethhdr->h_proto == htons(ETH_P_HSR)) {
- pull_size = sizeof(struct ethhdr);
+ pull_size = sizeof(struct hsr_tag);
skb_pull(skb, pull_size);
total_pull_size += pull_size;
}
- pull_size = sizeof(struct hsr_tag);
+ pull_size = sizeof(struct hsr_sup_tag);
Note the sizes of hsr_tag and hsr_sup_tag are the same: 6 bytes.
The code in 5.15 before this refactored code uses those structures.
When using v0 the EtherType uses the PRP tag instead of the HSR tag so
the HSR related code is not executed.
Powered by blists - more mailing lists