[ovs-dev] [PATCH 2/2] netdev-dpdk: Keep calling rte_eth_tx_burst() until it returns 0

Daniele Di Proietto ddiproietto at vmware.com
Wed Aug 13 15:47:10 UTC 2014



On 8/12/14, 5:40 PM, "Pravin Shelar" <pshelar at nicira.com> wrote:

>On Tue, Aug 12, 2014 at 10:43 AM, Daniele Di Proietto
><ddiproietto at vmware.com> wrote:
>> rte_eth_tx_burst() _should_ transmit every packet that it is passed
>>unless the
>> queue is full. Nontheless some implementation of rte_eth_tx_burst (e.g.
>> ixgbe_xmit_pkts_vec()) does not transmit more than a fixed number (32)
>>of
>> packets at a time.
>>
>> With this commit we assume that there's an error only if
>>rte_eth_tx_burst
>> returns 0.
>>
>> Signed-off-by: Daniele Di Proietto <ddiproietto at vmware.com>
>
>looks good.
>Pushed patch to master.
>
>Thanks,
>Pravin.

Thanks,

Daniele

>
>> ---
>>  lib/netdev-dpdk.c | 19 +++++++++++++++++--
>>  1 file changed, 17 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
>> index f2202b4..97206e6 100644
>> --- a/lib/netdev-dpdk.c
>> +++ b/lib/netdev-dpdk.c
>> @@ -621,9 +621,20 @@ static inline void
>>  dpdk_queue_flush__(struct netdev_dpdk *dev, int qid)
>>  {
>>      struct dpdk_tx_queue *txq = &dev->tx_q[qid];
>> -    uint32_t nb_tx;
>> +    uint32_t nb_tx = 0;
>> +
>> +    while (nb_tx != txq->count) {
>> +        uint32_t ret;
>> +
>> +        ret = rte_eth_tx_burst(dev->port_id, qid, txq->burst_pkts +
>>nb_tx,
>> +                               txq->count - nb_tx);
>> +        if (!ret) {
>> +            break;
>> +        }
>> +
>> +        nb_tx += ret;
>> +    }
>>
>> -    nb_tx = rte_eth_tx_burst(dev->port_id, qid, txq->burst_pkts,
>>txq->count);
>>      if (OVS_UNLIKELY(nb_tx != txq->count)) {
>>          /* free buffers, which we couldn't transmit, one at a time
>>(each
>>           * packet could come from a different mempool) */
>> @@ -632,7 +643,11 @@ dpdk_queue_flush__(struct netdev_dpdk *dev, int
>>qid)
>>          for (i = nb_tx; i < txq->count; i++) {
>>              rte_pktmbuf_free_seg(txq->burst_pkts[i]);
>>          }
>> +        ovs_mutex_lock(&dev->mutex);
>> +        dev->stats.tx_dropped += txq->count-nb_tx;
>> +        ovs_mutex_unlock(&dev->mutex);
>>      }
>> +
>>      txq->count = 0;
>>      txq->tsc = rte_get_timer_cycles();
>>  }
>> --
>> 2.0.1
>>
>> _______________________________________________
>> dev mailing list
>> dev at openvswitch.org
>> 
>>https://urldefense.proofpoint.com/v1/url?u=http://openvswitch.org/mailman
>>/listinfo/dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=MV9BdLjtFIdhBDBaw5z%2
>>BU6SSA2gAfY4L%2F1HCy3VjlKU%3D%0A&m=I6y9Pq8E7JyWsfW8%2FsXDeRYFCcnjMVRQY6b7
>>29tNCZo%3D%0A&s=645d6bf4e8db5e96d814389e1047dfddff141d5ff259796b8c9792664
>>9bb7d28




More information about the dev mailing list