summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSathya Perla2008-12-05 11:22:15 +0100
committerGreg Kroah-Hartman2009-01-06 22:52:16 +0100
commit535deaa35e534f096843d930a3ba11e36c75f0d5 (patch)
tree8a6ae0d6524acb75f8a989073e68c162acb4f4dd /drivers
parentStaging: benet: fix problems reported by checkpatch (diff)
downloadkernel-qcow2-linux-535deaa35e534f096843d930a3ba11e36c75f0d5.tar.gz
kernel-qcow2-linux-535deaa35e534f096843d930a3ba11e36c75f0d5.tar.xz
kernel-qcow2-linux-535deaa35e534f096843d930a3ba11e36c75f0d5.zip
Staging: benet: cleanup a check while posting rx buffers
This patch cleans up the way to check if there is enough space in the rx_q while posting buffers. Signed-off-by: Sathya Perla <sathyap@serverengines.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/benet/be_int.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/drivers/staging/benet/be_int.c b/drivers/staging/benet/be_int.c
index b05e27d0a7ae..cba95d09a8b6 100644
--- a/drivers/staging/benet/be_int.c
+++ b/drivers/staging/benet/be_int.c
@@ -623,25 +623,14 @@ void be_post_eth_rx_buffs(struct be_net_object *pnob)
*/
INIT_LIST_HEAD(&rxbl);
- for (num_bufs = 0; num_bufs < max_bufs; ++num_bufs) {
+ for (num_bufs = 0; num_bufs < max_bufs &&
+ !pnob->rx_page_info[pnob->rx_pg_info_hd].page; ++num_bufs) {
rxbp = &pnob->eth_rx_bufs[num_bufs];
pg_hd = pnob->rx_pg_info_hd;
rx_page_info = &pnob->rx_page_info[pg_hd];
if (!page) {
- /*
- * before we allocate a page make sure that we
- * have space in the RX queue to post the buffer.
- * We check for two vacant slots since with
- * 2K frags, we will need two slots.
- */
- if ((pnob->rx_ctxt[(pnob->rx_q_hd + num_bufs) &
- (pnob->rx_q_len - 1)] != NULL)
- || (pnob->rx_ctxt[(pnob->rx_q_hd + num_bufs + 1) %
- pnob->rx_q_len] != NULL)) {
- break;
- }
page = alloc_pages(alloc_flags, page_order);
if (unlikely(page == NULL)) {
adapter->be_stat.bes_ethrx_post_fail++;