On 4/7/21 12:17 PM, Balazs Nemeth wrote:
> Move allocation out further and perform all allocation in one loop. The
> same goes for freeing packets. This is to prepare for use of bulk
> versions of these functions.
> 
> Signed-off-by: Balazs Nemeth <bnem...@redhat.com>
> ---
>  lib/librte_vhost/virtio_net.c | 18 ++++++------------
>  1 file changed, 6 insertions(+), 12 deletions(-)
> 
> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
> index 666e7fdb8..496f750e3 100644
> --- a/lib/librte_vhost/virtio_net.c
> +++ b/lib/librte_vhost/virtio_net.c
> @@ -2471,14 +2471,13 @@ virtio_dev_tx_packed(struct virtio_net *dev,
>       uint32_t remained = count;
>       uint16_t i;
>  
> +     for (i = 0; i < count; ++i)
> +             pkts[i] = rte_pktmbuf_alloc(mbuf_pool);

Same comment as for previous patch, we need to check whether allocation
succeeded.

Reply via email to