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

Andrew Lunn andrew at lunn.ch
Sat Aug 27 11:54:22 PDT 2022


> +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



More information about the linux-arm-kernel mailing list