[v1,09/15] examples/l2fwd: move drain buffers to new function
Checks
Commit Message
v1:
* Replaced 'unsigned' with 'unsigned int'
Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
---
examples/l2fwd/l2fwd_worker.c | 34 ++++++++++++++++++++--------------
1 file changed, 20 insertions(+), 14 deletions(-)
Comments
> -----Original Message-----
> From: Anoob Joseph [mailto:anoob.joseph@caviumnetworks.com]
> Sent: Thursday, June 14, 2018 11:18 AM
> To: Richardson, Bruce <bruce.richardson@intel.com>; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>
> Cc: Anoob Joseph <anoob.joseph@caviumnetworks.com>; Jerin Jacob
> <jerin.jacob@caviumnetworks.com>; Narayana Prasad
> <narayanaprasad.athreya@caviumnetworks.com>; dev@dpdk.org
> Subject: [PATCH v1 09/15] examples/l2fwd: move drain buffers to new function
>
> v1:
> * Replaced 'unsigned' with 'unsigned int'
>
This changelog should not go in the commit message, but after the three dashes, following the Signed-off-by tag.
Hi Pablo,
On 10-07-2018 04:19, De Lara Guarch, Pablo wrote:
> External Email
>
>> -----Original Message-----
>> From: Anoob Joseph [mailto:anoob.joseph@caviumnetworks.com]
>> Sent: Thursday, June 14, 2018 11:18 AM
>> To: Richardson, Bruce <bruce.richardson@intel.com>; De Lara Guarch, Pablo
>> <pablo.de.lara.guarch@intel.com>
>> Cc: Anoob Joseph <anoob.joseph@caviumnetworks.com>; Jerin Jacob
>> <jerin.jacob@caviumnetworks.com>; Narayana Prasad
>> <narayanaprasad.athreya@caviumnetworks.com>; dev@dpdk.org
>> Subject: [PATCH v1 09/15] examples/l2fwd: move drain buffers to new function
>>
>> v1:
>> * Replaced 'unsigned' with 'unsigned int'
>>
> This changelog should not go in the commit message, but after the three dashes, following the Signed-off-by tag.
>
Will correct this when I send the revised patch. Thanks for pointing
this out.
Anoob
@@ -76,6 +76,24 @@ print_stats(void)
printf("\n====================================================\n");
}
+static inline void
+l2fwd_drain_buffers(struct lcore_queue_conf *qconf)
+{
+ unsigned int i, sent;
+ unsigned int portid;
+ struct rte_eth_dev_tx_buffer *buffer;
+
+ for (i = 0; i < qconf->n_rx_port; i++) {
+
+ portid = l2fwd_dst_ports[qconf->rx_port_list[i]];
+ buffer = tx_buffer[portid];
+
+ sent = rte_eth_tx_buffer_flush(portid, 0, buffer);
+ if (sent)
+ port_statistics[portid].tx += sent;
+ }
+}
+
static void
l2fwd_mac_updating(struct rte_mbuf *m, unsigned int dest_portid)
{
@@ -116,7 +134,6 @@ l2fwd_main_loop(void)
{
struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
struct rte_mbuf *m;
- int sent;
unsigned int lcore_id;
unsigned int master_core_id;
uint64_t prev_tsc, diff_tsc, cur_tsc, timer_tsc;
@@ -124,7 +141,6 @@ l2fwd_main_loop(void)
struct lcore_queue_conf *qconf;
const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1)
/ US_PER_S * BURST_TX_DRAIN_US;
- struct rte_eth_dev_tx_buffer *buffer;
prev_tsc = 0;
timer_tsc = 0;
@@ -159,18 +175,8 @@ l2fwd_main_loop(void)
diff_tsc = cur_tsc - prev_tsc;
if (unlikely(diff_tsc > drain_tsc)) {
- for (i = 0; i < qconf->n_rx_port; i++) {
-
- portid =
- l2fwd_dst_ports[qconf->rx_port_list[i]];
- buffer = tx_buffer[portid];
-
- sent = rte_eth_tx_buffer_flush(portid, 0,
- buffer);
- if (sent)
- port_statistics[portid].tx += sent;
-
- }
+ /* Drain buffers */
+ l2fwd_drain_buffers(qconf);
/* if timer is enabled */
if (timer_period > 0) {