ixgbe: check rxd number to avoid mbuf leak
authorCunming Liang <cunming.liang@intel.com>
Mon, 2 Mar 2015 13:28:24 +0000 (21:28 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Thu, 5 Mar 2015 19:06:06 +0000 (20:06 +0100)
commit352078e8e196a2c1ca38e2d7303f4d69d1c4ec68
treec489d1b5c2e895cb6b01d8061a9537a508017b1c
parent64702e5f6ff68bffbbb3e732c1c9f5887dd2b038
ixgbe: check rxd number to avoid mbuf leak

The mbuf leak happens when the assigned number of rx descriptor is not
power of 2 in vector mode.
As it's presumed on vpmd rx (for rx_tail wrap), adding condition check
to prevent it.
The root cause reference code in *_recv_raw_pkts_vec* as below.
"rxq->rx_tail = (uint16_t)(rxq->rx_tail & (rxq->nb_rx_desc - 1));".

Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
lib/librte_pmd_ixgbe/ixgbe_rxtx.c