]> bbs.cooldavid.org Git - net-next-2.6.git/commit - drivers/net/tg3.c
[TG3]: Fix bug in tg3_rx()
authorMichael Chan <mchan@broadcom.com>
Mon, 25 Apr 2005 22:14:03 +0000 (15:14 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 25 Apr 2005 22:14:03 +0000 (15:14 -0700)
commit483ba50bd41d14d5325d6cd9935de86a982d08a2
tree885f84a0fe56ed5e3d793a5414c8ec5bb6c8a633
parentcbdbf00aaf0addd391259f94aaa8e7dc1bfc9081
[TG3]: Fix bug in tg3_rx()

This patch fixes a bug that causes tg3_has_work() to always return 1.

rx work is determined by comparing tp->rx_rcb_ptr with the current hw
producer index. The hw producer index is modulo the ring size, but tp-
>rx_rcb_ptr is a free running counter that goes up beyond the ring size.
After the ring wraps around once, tg3_has_work() will always return 1.

The fix is to always do modulo arithmetic on tp->rx_rcb_ptr.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tg3.c