Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 210589
b: refs/heads/master
c: 972c40b
h: refs/heads/master
i:
  210587: 0ca82ec
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Sep 9, 2010
1 parent 95f2607 commit ea4ddde
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 719f835853a92f6090258114a72ffe41f09155cd
refs/heads/master: 972c40b5bee429c84ba727f8ac0a08292bc5dc3d
39 changes: 21 additions & 18 deletions trunk/drivers/net/ks8851.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,30 +503,33 @@ static void ks8851_rx_pkts(struct ks8851_net *ks)
ks8851_wrreg16(ks, KS_RXQCR,
ks->rc_rxqcr | RXQCR_SDA | RXQCR_ADRFE);

if (rxlen > 0) {
skb = netdev_alloc_skb(ks->netdev, rxlen + 2 + 8);
if (!skb) {
/* todo - dump frame and move on */
}
if (rxlen > 4) {
unsigned int rxalign;

rxlen -= 4;
rxalign = ALIGN(rxlen, 4);
skb = netdev_alloc_skb_ip_align(ks->netdev, rxalign);
if (skb) {

/* two bytes to ensure ip is aligned, and four bytes
* for the status header and 4 bytes of garbage */
skb_reserve(skb, 2 + 4 + 4);
/* 4 bytes of status header + 4 bytes of
* garbage: we put them before ethernet
* header, so that they are copied,
* but ignored.
*/

rxpkt = skb_put(skb, rxlen - 4) - 8;
rxpkt = skb_put(skb, rxlen) - 8;

/* align the packet length to 4 bytes, and add 4 bytes
* as we're getting the rx status header as well */
ks8851_rdfifo(ks, rxpkt, ALIGN(rxlen, 4) + 8);
ks8851_rdfifo(ks, rxpkt, rxalign + 8);

if (netif_msg_pktdata(ks))
ks8851_dbg_dumpkkt(ks, rxpkt);
if (netif_msg_pktdata(ks))
ks8851_dbg_dumpkkt(ks, rxpkt);

skb->protocol = eth_type_trans(skb, ks->netdev);
netif_rx(skb);
skb->protocol = eth_type_trans(skb, ks->netdev);
netif_rx(skb);

ks->netdev->stats.rx_packets++;
ks->netdev->stats.rx_bytes += rxlen - 4;
ks->netdev->stats.rx_packets++;
ks->netdev->stats.rx_bytes += rxlen;
}
}

ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr);
Expand Down

0 comments on commit ea4ddde

Please sign in to comment.