aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/bge/if_bgereg.h
diff options
context:
space:
mode:
authorPyun YongHyeon <yongari@FreeBSD.org>2010-06-05 23:29:24 +0000
committerPyun YongHyeon <yongari@FreeBSD.org>2010-06-05 23:29:24 +0000
commite0b7b101cef904cbd3181d0bacf1d78740f7e6e4 (patch)
treec0dedc76888f9ff7e2c9460d1bef68ec22afcaba /sys/dev/bge/if_bgereg.h
parent8b85d7551162758b67e6edd1e9816a255eba9dd9 (diff)
downloadsrc-e0b7b101cef904cbd3181d0bacf1d78740f7e6e4.tar.gz
src-e0b7b101cef904cbd3181d0bacf1d78740f7e6e4.zip
Fix a bug introduced in r199011. When bge(4) reuses loaded RX
buffers it should also reinitialize RX descriptors otherwise some stale data could be passed to controller. This could end up with mbuf double free or unexpected NULL pointer dereference in upper stack. To fix the issue, save loaded buffer's length and reinitialize RX descriptors with the saved value whenever bge(4) reuses the loaded RX buffers. While I'm here, increase the number of RX buffers to 512 from 256. This simplifies RX buffer handling as well as giving more RX buffers. Controller supports just fixed number of RX buffers (i.e. 512) and bge(4) used to rely on hope that our CPU is fast enough to keep up with the controller. With this change, bge(4) will use 1MB for RX buffers but I don't think it would cause problems in these days. Reported by: marcel Tested by: marcel
Notes
Notes: svn path=/head/; revision=208862
Diffstat (limited to 'sys/dev/bge/if_bgereg.h')
-rw-r--r--sys/dev/bge/if_bgereg.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/dev/bge/if_bgereg.h b/sys/dev/bge/if_bgereg.h
index e7388bf9f965..67c045569832 100644
--- a/sys/dev/bge/if_bgereg.h
+++ b/sys/dev/bge/if_bgereg.h
@@ -2561,6 +2561,8 @@ struct bge_chain_data {
struct mbuf *bge_tx_chain[BGE_TX_RING_CNT];
struct mbuf *bge_rx_std_chain[BGE_STD_RX_RING_CNT];
struct mbuf *bge_rx_jumbo_chain[BGE_JUMBO_RX_RING_CNT];
+ int bge_rx_std_seglen[BGE_STD_RX_RING_CNT];
+ int bge_rx_jumbo_seglen[BGE_JUMBO_RX_RING_CNT][4];
};
struct bge_dmamap_arg {