o wl3501: use eth_copy_and_sum, assorted cleanups

parent 11f77010
...@@ -940,7 +940,8 @@ static u16 wl3501_receive(struct wl3501_card *this, u8 *bf, u16 size) ...@@ -940,7 +940,8 @@ static u16 wl3501_receive(struct wl3501_card *this, u8 *bf, u16 size)
WL3501_BLKSZ - WL3501_BLKSZ -
sizeof(struct wl3501_rx_hdr) + 6; sizeof(struct wl3501_rx_hdr) + 6;
} else { } else {
wl3501_get_from_wla(this, this->start_seg + wl3501_get_from_wla(this,
this->start_seg +
sizeof(struct wl3501_rx_hdr) sizeof(struct wl3501_rx_hdr)
- 6, data, size); - 6, data, size);
size = 0; size = 0;
...@@ -1144,15 +1145,16 @@ static inline void wl3501_md_ind_interrupt(struct net_device *dev, ...@@ -1144,15 +1145,16 @@ static inline void wl3501_md_ind_interrupt(struct net_device *dev,
{ {
struct wl3501_md_ind sig; struct wl3501_md_ind sig;
struct sk_buff *skb; struct sk_buff *skb;
int size; u16 pkt_len;
u16 tmp, pkt_len;
wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); wl3501_get_from_wla(this, addr, &sig, sizeof(sig));
this->start_seg = sig.data; this->start_seg = sig.data;
if (this->llc_type == 1) { if (this->llc_type == 1) {
wl3501_get_from_wla(this, sig.data + u16 tmp;
sizeof(struct wl3501_rx_hdr) - 6,
wl3501_get_from_wla(this,
sig.data + sizeof(struct wl3501_rx_hdr) - 6,
&tmp, sizeof(tmp)); &tmp, sizeof(tmp));
if (tmp == 0xaaaa) { if (tmp == 0xaaaa) {
pkt_len = sig.size + 12 - 24 - 4 - 6; pkt_len = sig.size + 12 - 24 - 4 - 6;
...@@ -1167,23 +1169,19 @@ static inline void wl3501_md_ind_interrupt(struct net_device *dev, ...@@ -1167,23 +1169,19 @@ static inline void wl3501_md_ind_interrupt(struct net_device *dev,
} else } else
pkt_len = sig.size - 24 - 4; pkt_len = sig.size - 24 - 4;
size = pkt_len; skb = dev_alloc_skb(pkt_len + 5);
skb = dev_alloc_skb(size + 5);
if (!skb) { if (!skb) {
printk(KERN_WARNING "%s: Can't alloc a sk_buff of size %d.\n", printk(KERN_WARNING "%s: Can't alloc a sk_buff of size %d.\n",
dev->name, size); dev->name, pkt_len);
/*
* Must drop this packet to ensure interrupt will come again
*/
this->stats.rx_dropped++; this->stats.rx_dropped++;
} else { } else {
skb->dev = dev; skb->dev = dev;
skb_reserve(skb, 2); /* IP headers on 16 bytes skb_reserve(skb, 2); /* IP headers on 16 bytes
boundaries */ boundaries */
skb_put(skb, size); /* Make room */ eth_copy_and_sum(skb, (unsigned char *)&sig.daddr, 12, 0);
memcpy((char *)skb->data, (char *)&(sig.daddr), 12); wl3501_receive(this, skb->data, pkt_len);
wl3501_receive(this, skb->data, size); skb_put(skb, pkt_len);
skb->protocol = eth_type_trans(skb, dev); skb->protocol = eth_type_trans(skb, dev);
dev->last_rx = jiffies; dev->last_rx = jiffies;
this->stats.rx_packets++; this->stats.rx_packets++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment