Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Sathya Perla and committed by
Greg Kroah-Hartman
535deaa3 a9acfa42

+2 -13
+2 -13
drivers/staging/benet/be_int.c
··· 623 623 */ 624 624 INIT_LIST_HEAD(&rxbl); 625 625 626 - for (num_bufs = 0; num_bufs < max_bufs; ++num_bufs) { 626 + for (num_bufs = 0; num_bufs < max_bufs && 627 + !pnob->rx_page_info[pnob->rx_pg_info_hd].page; ++num_bufs) { 627 628 628 629 rxbp = &pnob->eth_rx_bufs[num_bufs]; 629 630 pg_hd = pnob->rx_pg_info_hd; 630 631 rx_page_info = &pnob->rx_page_info[pg_hd]; 631 632 632 633 if (!page) { 633 - /* 634 - * before we allocate a page make sure that we 635 - * have space in the RX queue to post the buffer. 636 - * We check for two vacant slots since with 637 - * 2K frags, we will need two slots. 638 - */ 639 - if ((pnob->rx_ctxt[(pnob->rx_q_hd + num_bufs) & 640 - (pnob->rx_q_len - 1)] != NULL) 641 - || (pnob->rx_ctxt[(pnob->rx_q_hd + num_bufs + 1) % 642 - pnob->rx_q_len] != NULL)) { 643 - break; 644 - } 645 634 page = alloc_pages(alloc_flags, page_order); 646 635 if (unlikely(page == NULL)) { 647 636 adapter->be_stat.bes_ethrx_post_fail++;