20 Apr 2012 01:39
BNX driver problem when mbuf clusters run out
Beverly Schwartz <bschwart <at> bbn.com>
2012-04-19 23:39:33 GMT
2012-04-19 23:39:33 GMT
In bnx_rx_intr, there is a while loop: while (sw_cons != hw_cons) Inside this loop, we grab the next mbuf that's available. m = sc->rx_mbuf_ptr[sw_chain_cons]; sc->rx_mbuf_ptr[sw_chain_cons] = NULL; It then goes on and tries to get an mbuf cluster to replace the one we just took off the ring. if (bnx_get_buf(sc, &sw_prod, &sw_chain_prod, &sw_prod_bseq)) If bnx_get_buf fails, the code then calls bnx_add_buf to put the mbuf we just received back on the ring. bnx_add_buf(sc, m, &sw_prod, &sw_chain_prod, &sw_prod_bseq) Inside bnx_add_buf, first we put the mbuf (the recycled m) at sw_chain_prod. Because this is the same as sw_chain_cons, m gets placed back at the point we just nulled out. sc->rx_buf_ptr[*chain_prod] = m_new; Then sw_chain_prod gets bumped up. *prod = NEXT_RX_BD(*prod); *chain_prod = RX_CHAIN_IDX(*prod); When the code returns from bnx_add_buf, a "continue" is executed, thus going around the loop again. sw_chain_cons has NOT been incremented, since that call to NEXT_RX_BD is further down in processing in the loop.(Continue reading)
RSS Feed