From fd6b763a853bbd60f5c55f6adc311ebf3ec3fb21 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Fri, 11 May 2007 18:53:52 -0400 Subject: [PATCH] Update for the forthcoming Linux 2.6.22 skb API Keep 2.6.21 compatibility for now. Use SKB_WITH_OVERHEAD as an indicator of the new API, since the kernel is not called 2.6.22 yet. Signed-off-by: Pavel Roskin --- at76_usb.c | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/at76_usb.c b/at76_usb.c index 62172ff..f59d60b 100644 --- a/at76_usb.c +++ b/at76_usb.c @@ -5538,8 +5538,13 @@ static void at76_ieee80211_to_eth(struct sk_buff *skb, int iw_mode) #endif /* IEEE_STANDARD */ } - eth_hdr_p = (struct ethhdr *)(skb->data-sizeof(struct ethhdr)); - skb->mac.raw=(unsigned char *)eth_hdr_p; +#ifdef SKB_WITH_OVERHEAD + skb_set_mac_header(skb, -(int)sizeof(struct ethhdr)); + eth_hdr_p = (struct ethhdr *)skb_mac_header(skb); +#else + eth_hdr_p = (struct ethhdr *)(skb->data - sizeof(struct ethhdr)); + skb->mac.raw = (unsigned char *)eth_hdr_p; +#endif if (build_ethhdr) { /* This needs to be done in this order (eth_hdr_p->h_dest may * overlap src_addr) */ @@ -5572,6 +5577,14 @@ static void at76_ieee80211_to_eth(struct sk_buff *skb, int iw_mode) } +#ifndef SKB_WITH_OVERHEAD +static inline void skb_reset_mac_header(struct sk_buff *skb) +{ + skb->mac.raw = skb->data; +} +#endif + + /* Adjust the skb to trim the hardware header and CRC, and set up skb->mac, * skb->protocol, etc. */ @@ -5583,6 +5596,7 @@ static void at76_ieee80211_fixup(struct sk_buff *skb, int iw_mode) u8 *dest_addr; __be16 proto = 0; + skb_reset_mac_header(skb); i802_11_hdr = (struct ieee80211_hdr_3addr *)skb->data; skb_pull(skb, sizeof(struct ieee80211_hdr_3addr)); @@ -5590,8 +5604,6 @@ static void at76_ieee80211_fixup(struct sk_buff *skb, int iw_mode) : i802_11_hdr->addr3; dest_addr = i802_11_hdr->addr1; - skb->mac.raw = (unsigned char *)i802_11_hdr; - eth_hdr_p = (struct ethhdr *)skb->data; if (!compare_ether_addr(eth_hdr_p->h_source, src_addr) && !compare_ether_addr(eth_hdr_p->h_dest, dest_addr)) { @@ -5670,10 +5682,17 @@ static struct sk_buff *at76_check_for_rx_frags(struct at76_priv *priv) hex2str(priv->obuf, data, min((int)(sizeof(priv->obuf) - 1) / 2, 32), '\0')); +#ifdef SKB_WITH_OVERHEAD + at76_dbg(DBG_RX_FRAGS_SKB, "%s: incoming skb: head %p data %p " + "tail %d end %d len %d", + priv->netdev->name, skb->head, skb->data, skb->tail, + skb->end, skb->len); +#else at76_dbg(DBG_RX_FRAGS_SKB, "%s: incoming skb: head %p data %p " "tail %p end %p len %d", priv->netdev->name, skb->head, skb->data, skb->tail, skb->end, skb->len); +#endif if (data_len < 0) { /* make sure data starts in the buffer */ @@ -5707,10 +5726,17 @@ static struct sk_buff *at76_check_for_rx_frags(struct at76_priv *priv) /* remove FCS at end */ skb_trim(skb, length); +#ifdef SKB_WITH_OVERHEAD + at76_dbg(DBG_RX_FRAGS_SKB, "%s: trimmed skb: head %p data %p tail %d " + "end %d len %d data %p data_len %d", + priv->netdev->name, skb->head, skb->data, skb->tail, + skb->end, skb->len, data, data_len); +#else at76_dbg(DBG_RX_FRAGS_SKB, "%s: trimmed skb: head %p data %p tail %p " "end %p len %d data %p data_len %d", priv->netdev->name, skb->head, skb->data, skb->tail, skb->end, skb->len, data, data_len); +#endif /* look if we've got a chain for the sender address. afterwards optr points to first free or the oldest entry, @@ -5947,7 +5973,7 @@ static void at76_rx_monitor_mode(struct at76_priv *priv) memcpy(payload, buf->packet, length); skb->dev = netdev; skb->ip_summed = CHECKSUM_NONE; - skb->mac.raw = skb->data; + skb_reset_mac_header(skb); skb->pkt_type = PACKET_OTHERHOST; skb->protocol = htons(ETH_P_80211_RAW); -- cgit v1.2.3