DPDK patches and discussions
 help / color / mirror / Atom feed
From: Somnath Kotur <somnath.kotur@broadcom.com>
To: dev <dev@dpdk.org>
Subject: [dpdk-dev] Question about rte_manage_timer() and eal_intr_handle_interrupts
Date: Fri, 2 Nov 2018 09:30:44 +0530	[thread overview]
Message-ID: <CAOBf=mtQHpDf8XxJdo6vywfb4pCt8Xo4_HUsH9fkuBQZ+NsYKw@mail.gmail.com> (raw)

Hello,
       I'm trying to launch a thread - lcore_mainloop( from
examples/timer/main.c ) that runs rte_manage_timer() every 2s from testpmd
to ensure the timers i've registered in my driver are checked for expiry  (
i even tried putting this thread in my  driver as well,  no difference in
results) and i see that while this thread is running, i somehow seem to
stop getting interrupts ..infact i don't even
see eal_intr_process_interrupts () being called.


diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index ca4e1a4..a8d71d6 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -71,6 +71,8 @@
 #include <rte_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
+#include <rte_cycles.h>
+#include <rte_timer.h>
 #include <rte_dev.h>
 #include <rte_string_fns.h>
 #ifdef RTE_LIBRTE_IXGBE_PMD
@@ -2524,6 +2526,30 @@ signal_handler(int signum)
        }
 }

+static int
+lcore_mainloop(__attribute__((unused)) void *arg)
+{
+       uint64_t prev_tsc = 0, cur_tsc, diff_tsc;
+       unsigned int lcore_id;
+
+       lcore_id = rte_lcore_id();
+       printf("Starting mainloop on core %u\n", lcore_id);
+
+       while (f_quit == 0) {
+               cur_tsc = rte_rdtsc();
+               diff_tsc = cur_tsc - prev_tsc;
+               /* Schedule every 2 seconds */
+               if (diff_tsc > rte_get_timer_hz() * 2) {
+                       rte_timer_manage();
+                       prev_tsc = cur_tsc;
+               } else
+                       sleep(1);
+       }
+       return 0;
+}
+
 int
 main(int argc, char** argv)
 {
@@ -2627,6 +2653,7 @@ main(int argc, char** argv)
        if (strlen(cmdline_filename) != 0)
                cmdline_read_from_file(cmdline_filename);

+       rte_eal_remote_launch(lcore_mainloop, NULL, 3);
        if (interactive == 1) {
                if (auto_start) {
                        printf("Start automatic packet forwarding\n");


My testpmd cmdline is like so:

testpmd -c 0xff -n 3 -- -i portmask=0x3 --nb-cores=3 --rxq=1 --txq=1

Any idea what could be the problem ? Is this something that is expected or
am i doing something wrong ?

Thanks
Som

             reply	other threads:[~2018-11-02  4:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-02  4:00 Somnath Kotur [this message]
2018-11-02  6:08 ` Somnath Kotur
2018-11-02 11:31 ` Burakov, Anatoly
2018-11-02 14:35   ` Wiles, Keith
2018-11-02 14:37     ` Wiles, Keith
2018-11-03  2:36       ` Somnath Kotur
2018-11-03  4:28         ` Somnath Kotur
2018-11-03  7:19           ` Somnath Kotur

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='CAOBf=mtQHpDf8XxJdo6vywfb4pCt8Xo4_HUsH9fkuBQZ+NsYKw@mail.gmail.com' \
    --to=somnath.kotur@broadcom.com \
    --cc=dev@dpdk.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).