All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jesus Velazquez <jvelazquez-3Fuf/C48lLhBDgjK7y7TUQ@public.gmane.org>
To: dev-VfR2kkLFssw@public.gmane.org
Subject: Question regarding  rte_eth_tx_burst()
Date: Fri, 26 Jul 2013 09:16:04 -0500	[thread overview]
Message-ID: <51F284A4.5040608@optenet.com> (raw)

Hi all,

Any ideas would be helpful, I have an application that uses a rte_ring 
for queuing packets to be sent (a single consumer - multiple producer).

The problem I am facing is with rte_eth_tx_burst(), once I dequeue N 
packets from tx ring, there is no guaranty that all packets will be 
sent, if not all packets
are sent, rte_ring does not allow pushing packets at front (it is a 
FIFO).  So, if I re-queue them in the ring, packets will be network 
reordered.

There is no mechanism to know the number of TX free descriptors in a 
particular queue. I'm working with ixgbe and I found that nb_tx_free is 
an approximation of that,
it is updated every time at ixgbe_xmit_cleanup() that is called during 
ixgbe_xmit_pkts().

I was wondering to add a function that returns nb_tx_free value in order 
to have an idea of how many packets can be safety sent.

Right now my code does this:

....
   nbulk = RTE_MIN(rte_ring_count(queue->tx_ring), (uint16_t)TX_DRAIN_PKTS);

   ret = rte_ring_sc_dequeue_bulk(queue->tx_ring, (void **)ptrs, nbulk);
   if(unlikely(ret < 0))
     return 0; /* Not enough objects?, I asked a moment ago */

   ret = rte_eth_tx_burst(queue->port, queue->id, ptrs, nbulk);
   if(unlikely(ret > nbulk)) {
     TRACE(RTE, ">>>Imposible sent more than existing\n");
     return -1;
   }

   while(ret < nbulk) {
     /* bad case: packet reordering */
     ret2 = rte_ring_mp_enqueue(queue->tx_ring, (void *)&ptrs[ret]);
     if(ret2 < 0) {
       /* TODO: may be an emergency tx queue? */
       /* wrost case: dropping */
       rte_pktmbuf_free(ptrs[ret]);
     }
     ret++;
   }

I would appreciate any  ideas of how to overcome this situation.

Thanks and regards,

Jesus

                 reply	other threads:[~2013-07-26 14:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51F284A4.5040608@optenet.com \
    --to=jvelazquez-3fuf/c48llhbdgjk7y7tuq@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.