aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/enc28j60.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-12-06 01:54:40 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-06 01:54:40 -0500
commit730c30ec646bd252a9448a66ecd51d794853513f (patch)
treec0d413860f9d8bf37374f17cfabb4911143465d7 /drivers/net/enc28j60.c
parent726e07a8a38168266ac95d87736f9501a2d9e7b2 (diff)
parent0a0755c9fe47dc9f8271935909c66096e43efbfe (diff)
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.c16
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)
566 return erxrdpt; 566 return erxrdpt;
567} 567}
568 568
569/*
570 * Calculate wrap around when reading beyond the end of the RX buffer
571 */
572static u16 rx_packet_start(u16 ptr)
573{
574 if (ptr + RSV_SIZE > RXEND_INIT)
575 return (ptr + RSV_SIZE) - (RXEND_INIT - RXSTART_INIT + 1);
576 else
577 return ptr + RSV_SIZE;
578}
579
569static void nolock_rxfifo_init(struct enc28j60_net *priv, u16 start, u16 end) 580static void nolock_rxfifo_init(struct enc28j60_net *priv, u16 start, u16 end)
570{ 581{
571 u16 erxrdpt; 582 u16 erxrdpt;
@@ -936,8 +947,9 @@ static void enc28j60_hw_rx(struct net_device *ndev)
936 skb->dev = ndev; 947 skb->dev = ndev;
937 skb_reserve(skb, NET_IP_ALIGN); 948 skb_reserve(skb, NET_IP_ALIGN);
938 /* copy the packet from the receive buffer */ 949 /* copy the packet from the receive buffer */
939 enc28j60_mem_read(priv, priv->next_pk_ptr + sizeof(rsv), 950 enc28j60_mem_read(priv,
940 len, skb_put(skb, len)); 951 rx_packet_start(priv->next_pk_ptr),
952 len, skb_put(skb, len));
941 if (netif_msg_pktdata(priv)) 953 if (netif_msg_pktdata(priv))
942 dump_packet(__func__, skb->len, skb->data); 954 dump_packet(__func__, skb->len, skb->data);
943 skb->protocol = eth_type_trans(skb, ndev); 955 skb->protocol = eth_type_trans(skb, ndev);