> commit 0d9813319b40399a0d8fd761d2fcfedee5701487 > Author: Lorenzo Bianconi <lorenzo.bianconi@xxxxxxxxxx> > Date: Fri Sep 7 23:13:12 2018 +0200 [...] > diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c > index 062614ad0d51..08425b1d2c30 100644 > --- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c > +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c > @@ -550,21 +550,33 @@ void mt76x02_sta_rate_tbl_update(struct ieee80211_hw *hw, > } > EXPORT_SYMBOL_GPL(mt76x02_sta_rate_tbl_update); > > -int mt76x02_insert_hdr_pad(struct sk_buff *skb) > +void mt76x02_align_skb(struct sk_buff *skb) > { > - int len = ieee80211_get_hdrlen_from_skb(skb); > + int align = ((unsigned long) skb->data) & 3; > + int hdrlen, skblen; > > - if (len % 4 == 0) > - return 0; > + hdrlen = ieee80211_get_hdrlen_from_skb(skb); > + WARN_ON_ONCE(align == 0 && (hdrlen & 3)); > + > + if (align == 0) > + return; Hi Stanislaw, is it possible that skb->data is 4 byte aligned but hdrlen is not? (e.g 4addr data frames, not qos)? > > - skb_push(skb, 2); > - memmove(skb->data, skb->data + 2, len); > + if (hdrlen & 3) { > + /* Align frame and add 2 bytes pad after header. */ > + skb_push(skb, 2); > + memmove(skb->data, skb->data + 2, hdrlen); > > - skb->data[len] = 0; > - skb->data[len + 1] = 0; > - return 2; > + skb->data[hdrlen] = 0; > + skb->data[hdrlen + 1] = 0; > + } else { > + /* Only for probe request frames. */ are you sure this is true *only* for probe requests? this could hit performances and it is used even in pci code Regards, Lorenzo > + skblen = skb->len; > + skb_push(skb, 2); > + memmove(skb->data, skb->data + 2, skblen); > + skb_trim(skb, skblen); > + } > } > -EXPORT_SYMBOL_GPL(mt76x02_insert_hdr_pad); > +EXPORT_SYMBOL_GPL(mt76x02_align_skb); > > void mt76x02_remove_hdr_pad(struct sk_buff *skb, int len) > { > -- > 2.7.5 >