On Wednesday 02 January 2008 09:48:51 Johannes Berg wrote: > > On Sat, 2007-12-29 at 17:24 +0100, Michael Buesch wrote: > > This patch fixes RX packet alignment issues in the zd1211rw driver. > > This is based on a patch by Johannes Berg. > > > > Signed-off-by: Michael Buesch <mb@xxxxxxxxx> > > Looks good to me, I guess you tested it. Yes, works fine. > Acked-by: Johannes Berg <johannes@xxxxxxxxxxxxxxxx> > > > Index: wireless-2.6/drivers/net/wireless/zd1211rw/zd_mac.c > > =================================================================== > > --- wireless-2.6.orig/drivers/net/wireless/zd1211rw/zd_mac.c 2007-12-29 17:14:41.000000000 +0100 > > +++ wireless-2.6/drivers/net/wireless/zd1211rw/zd_mac.c 2007-12-29 17:15:00.000000000 +0100 > > @@ -623,6 +623,8 @@ int zd_mac_rx(struct ieee80211_hw *hw, c > > const struct rx_status *status; > > struct sk_buff *skb; > > int bad_frame = 0; > > + u16 fc; > > + bool is_qos, is_4addr, need_padding; > > > > if (length < ZD_PLCP_HEADER_SIZE + 10 /* IEEE80211_1ADDR_LEN */ + > > FCS_LEN + sizeof(struct rx_status)) > > @@ -674,9 +676,22 @@ int zd_mac_rx(struct ieee80211_hw *hw, c > > && !mac->pass_ctrl) > > return 0; > > > > - skb = dev_alloc_skb(length); > > + fc = le16_to_cpu(*((__le16 *) buffer)); > > + > > + is_qos = ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) && > > + ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_QOS_DATA); > > + is_4addr = (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == > > + (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS); > > + need_padding = is_qos ^ is_4addr; > > + > > + skb = dev_alloc_skb(length + (need_padding ? 2 : 0)); > > if (skb == NULL) > > return -ENOMEM; > > + if (need_padding) { > > + /* Make sure the the payload data is 4 byte aligned. */ > > + skb_reserve(skb, 2); > > + } > > + > > memcpy(skb_put(skb, length), buffer, length); > > > > ieee80211_rx_irqsafe(hw, skb, &stats); > > > -- Greetings Michael. - To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html