Re: [PATCH net-next v3 2/5] net: dsa: add out-of-band tagging protocol

From: Andrew Lunn
Date: Sat Aug 27 2022 - 14:54:31 EST


> +struct dsa_oob_tag_info {
> + u16 proto;
> + u16 dp;
> +};

> +#define DSA_OOB_TAG_LEN 4
> +
> +int dsa_oob_tag_push(struct sk_buff *skb, struct dsa_oob_tag_info *ti)
> +{
> + struct dsa_oob_tag_info *tag_info;
> +
> + tag_info = (struct dsa_oob_tag_info *)skb->head;
> +
> + tag_info->proto = ti->proto;
> + tag_info->dp = ti->dp;

Do you need to be worried about alignment here? Is skb->head
guaranteed to be at least 16 bit aligned? I think you would be safer
to use get_unaligned_le16(val, tag);

Andrew