Messages in this thread | | | Date | Sat, 27 Aug 2022 20:54:22 +0200 | From | Andrew Lunn <> | Subject | Re: [PATCH net-next v3 2/5] net: dsa: add out-of-band tagging protocol |
| |
> +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
| |