pcap: fix mbuf allocation
authorRichardson, Bruce <bruce.richardson@intel.com>
Tue, 26 Nov 2013 16:49:46 +0000 (16:49 +0000)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 15 Jan 2014 14:55:05 +0000 (15:55 +0100)
commit6eb0ae218a9803bc0ac34b92c980b1503110939e
tree47542ae4b90e44ddb6e91797a4a4c51663c1ad77
parent5a6d9897f91f6bb4b2dad8b789aecda1376dd00f
pcap: fix mbuf allocation

A static list of 64 mbufs was being reused in Rx function.
This caused two errors:
1) If more than 64 buffers were requested in a single burst,
   only the last 64 buffers are returned, the others are lost.
2) Application will free the mbuf being returned, but the receive
   function will reuse the buffer anyway. If some other allocation
   is done, there is suddenly multiple writers for the same mbuf.
It is fixed by allocating mbuf on demand.

In the same time, some length errors are fixed.

Reported-by: Mats Liljegren <mats.liljegren@enea.com>
Reported-by: Robert Sanford <rsanford@prolexic.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
lib/librte_pmd_pcap/rte_eth_pcap.c