diff options
author | David S. Miller <davem@davemloft.net> | 2008-12-06 07:54:40 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-06 07:54:40 +0100 |
commit | 730c30ec646bd252a9448a66ecd51d794853513f (patch) | |
tree | c0d413860f9d8bf37374f17cfabb4911143465d7 /drivers/net/enc28j60.c | |
parent | tcp: move some parts from tcp_write_xmit (diff) | |
parent | Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linvil... (diff) | |
download | linux-730c30ec646bd252a9448a66ecd51d794853513f.tar.xz linux-730c30ec646bd252a9448a66ecd51d794853513f.zip |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
drivers/net/wireless/iwlwifi/iwl-core.c
drivers/net/wireless/iwlwifi/iwl-sta.c
Diffstat (limited to 'drivers/net/enc28j60.c')
-rw-r--r-- | drivers/net/enc28j60.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c index 32c19790d013..d3c8e742e9ea 100644 --- a/drivers/net/enc28j60.c +++ b/drivers/net/enc28j60.c @@ -566,6 +566,17 @@ static u16 erxrdpt_workaround(u16 next_packet_ptr, u16 start, u16 end) return erxrdpt; } +/* + * Calculate wrap around when reading beyond the end of the RX buffer + */ +static u16 rx_packet_start(u16 ptr) +{ + if (ptr + RSV_SIZE > RXEND_INIT) + return (ptr + RSV_SIZE) - (RXEND_INIT - RXSTART_INIT + 1); + else + return ptr + RSV_SIZE; +} + static void nolock_rxfifo_init(struct enc28j60_net *priv, u16 start, u16 end) { u16 erxrdpt; @@ -936,8 +947,9 @@ static void enc28j60_hw_rx(struct net_device *ndev) skb->dev = ndev; skb_reserve(skb, NET_IP_ALIGN); /* copy the packet from the receive buffer */ - enc28j60_mem_read(priv, priv->next_pk_ptr + sizeof(rsv), - len, skb_put(skb, len)); + enc28j60_mem_read(priv, + rx_packet_start(priv->next_pk_ptr), + len, skb_put(skb, len)); if (netif_msg_pktdata(priv)) dump_packet(__func__, skb->len, skb->data); skb->protocol = eth_type_trans(skb, ndev); |