[ovs-dev] [PATCH v10 1/3] netdev: Add optional qfill output parameter to rxq_recv()

Jan Scheurich jan.scheurich at ericsson.com
Fri Apr 6 14:41:20 UTC 2018


> > @@ -1846,11 +1846,24 @@ netdev_dpdk_vhost_rxq_recv(struct netdev_rxq *rxq,
> >      batch->count = nb_rx;
> >      dp_packet_batch_init_packet_fields(batch);
> >
> > +    if (qfill) {
> > +        if (nb_rx == NETDEV_MAX_BURST) {
> > +            /* The DPDK API returns a uint32_t which often has invalid bits in
> > +             * the upper 16-bits. Need to restrict the value to uint16_t. */
> > +            *qfill = rte_vhost_rx_queue_count(netdev_dpdk_get_vid(dev),
> 
> I lost count of how many times I talked about this. Please, don't obtain the
> 'vid' twice. You have to check the result of 'netdev_dpdk_get_vid()' always.
> Otherwise this could lead to crash.
> 
> Details, as usual, here:
> daf22bf7a826 ("netdev-dpdk: Fix calling vhost API with negative vid.")
> 
> I believe, that I already wrote this comment to one of the previous versions
> of this patch-set.

Yes, sorry I missed that one. I will for sure fix it. 

As this is fairly non-obvious from looking at the code it might be a good idea to add some warning comment to the function 'netdev_dpdk_get_vid()' and/or the places where it is used from the PMD.

/Jan



More information about the dev mailing list