Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/74619/?format=api
https://patches.dpdk.org/api/patches/74619/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200722125026.2595-1-ibtisam.tariq@emumba.com/", "project": { "id": 1, "url": "https://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20200722125026.2595-1-ibtisam.tariq@emumba.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20200722125026.2595-1-ibtisam.tariq@emumba.com", "date": "2020-07-22T12:50:25", "name": "[1/2] examples/l2fwd-jobstats: Free resources on exit", "commit_ref": null, "pull_url": null, "state": "rejected", "archived": true, "hash": "d9456cfa3a03a15eef1ae62b64f2dbedddf81236", "submitter": { "id": 1680, "url": "https://patches.dpdk.org/api/people/1680/?format=api", "name": "Ibtisam Tariq", "email": "ibtisam.tariq@emumba.com" }, "delegate": { "id": 1, "url": "https://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20200722125026.2595-1-ibtisam.tariq@emumba.com/mbox/", "series": [ { "id": 11237, "url": "https://patches.dpdk.org/api/series/11237/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=11237", "date": "2020-07-22T12:50:25", "name": "[1/2] examples/l2fwd-jobstats: Free resources on exit", "version": 1, "mbox": "https://patches.dpdk.org/series/11237/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/74619/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/74619/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 87EEBA0526;\n\tWed, 22 Jul 2020 14:51:58 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 939271BFD1;\n\tWed, 22 Jul 2020 14:51:56 +0200 (CEST)", "from mail-wr1-f67.google.com (mail-wr1-f67.google.com\n [209.85.221.67]) by dpdk.org (Postfix) with ESMTP id CA4501BFD1\n for <dev@dpdk.org>; Wed, 22 Jul 2020 14:51:54 +0200 (CEST)", "by mail-wr1-f67.google.com with SMTP id o11so1790795wrv.9\n for <dev@dpdk.org>; Wed, 22 Jul 2020 05:51:54 -0700 (PDT)", "from localhost.localdomain ([39.33.200.211])\n by smtp.gmail.com with ESMTPSA id 26sm6983074wmj.25.2020.07.22.05.51.52\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 22 Jul 2020 05:51:53 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=emumba-com.20150623.gappssmtp.com; s=20150623;\n h=from:to:cc:subject:date:message-id;\n bh=CTxakhkHZvuMtozp3k7HENlR0Dxbi2DmGKpdWuDw9VI=;\n b=maDkdzqnMG/osWq3mmrlRcfIlbC9UymomP9murWbCCw0kshG+c7UvNoEHt2W2mCeCM\n Vtiimkcpc1lGpYc5o9UXn2BOhBiZtlUgmoWMHbL0fr+kXW6Vu2VTifHNoZDa8ktrDJus\n 6vHtiZuTzK5+pj4KgwAlVgGyy7/iEjQ3Fiqc/6mlzJ5KBVAODnLdR27xq9WAFm8mu0MG\n CFFAJldzuDpWpdq/nSHMAd+H6yBmMpBGAgMMh3GWfLP2D6aZ0sC54Ji++iNZTvESkS75\n Vm8+WVWcHku4hvKoGdAn/8A41Xw5buITe87PMKwokxFV3Kz0i/pcIeOjS4rbpsDckelp\n yWBA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20161025;\n h=x-gm-message-state:from:to:cc:subject:date:message-id;\n bh=CTxakhkHZvuMtozp3k7HENlR0Dxbi2DmGKpdWuDw9VI=;\n b=OVeWhd89BgutDxZ5Db/JCcYskMHefqVGR6DXwJ8QDRclYE1YsEZigZE98eWxnkcDdL\n S4bLKI+fN3BZE3p7JmkXN04vNw0+oIvT7xddHPWDaFNhn3pJjFbPGc4JxASczqx4Do8x\n V7SNaYLTJ3Q+uG3kuSL9gMfK30nikK4PxNKK5FHaVdyvD9uQmCXESBpHBa0g9IsMD0e0\n /JD7UgOBu4iNXZnMyqQIuC1R7xVsNYeFIlG6QR55s3kFYlhgOlbxk9yb13RxQgt8PCpg\n 3DM5lHY5Se4iJ4R9oS6JgCvS8tb69aiHBWpk0yV+OuhgtCNDr1HhYrJ4mnCR7hiMTVsn\n 9VVA==", "X-Gm-Message-State": "AOAM530mWeeQUxrWvva1IE4U9x9k+8U1cyz5TUfXn7qApb4My8RTd0dX\n 7hg77DzwKVbKcx3sJQ5ICvKjtQ==", "X-Google-Smtp-Source": "\n ABdhPJwskVJYKlhxfAXScdU3I8oPjdMZ54cIgmnPwGOWXwE94XsFDajRL5gV1Y4uAyIfr0Ph6PjfBA==", "X-Received": "by 2002:a5d:6681:: with SMTP id l1mr17347081wru.47.1595422314421;\n Wed, 22 Jul 2020 05:51:54 -0700 (PDT)", "From": "Ibtisam Tariq <ibtisam.tariq@emumba.com>", "To": "declan.doherty@intel.com", "Cc": "dev@dpdk.org,\n\tIbtisam Tariq <ibtisam.tariq@emumba.com>", "Date": "Wed, 22 Jul 2020 12:50:25 +0000", "Message-Id": "<20200722125026.2595-1-ibtisam.tariq@emumba.com>", "X-Mailer": "git-send-email 2.17.1", "Subject": "[dpdk-dev] [PATCH 1/2] examples/l2fwd-jobstats: Free resources on\n\texit", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "When exiting the application, resources should be cleared.\n\nSigned-off-by: Ibtisam Tariq <ibtisam.tariq@emumba.com>\n---\n examples/l2fwd-jobstats/main.c | 49 +++++++++++++++++++++++++++++++++-\n 1 file changed, 48 insertions(+), 1 deletion(-)", "diff": "diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c\nindex 47a3b0976..4f29f40ea 100644\n--- a/examples/l2fwd-jobstats/main.c\n+++ b/examples/l2fwd-jobstats/main.c\n@@ -8,6 +8,7 @@\n #include <stdint.h>\n #include <ctype.h>\n #include <getopt.h>\n+#include <signal.h>\n \n #include <rte_common.h>\n #include <rte_log.h>\n@@ -36,6 +37,8 @@\n #include <rte_alarm.h>\n #include <rte_pause.h>\n \n+static volatile bool force_quit;\n+\n #define RTE_LOGTYPE_L2FWD RTE_LOGTYPE_USER1\n \n #define NB_MBUF 8192\n@@ -493,7 +496,7 @@ l2fwd_main_loop(void)\n \n \trte_jobstats_init(&qconf->idle_job, \"idle\", 0, 0, 0, 0);\n \n-\tfor (;;) {\n+\twhile (!force_quit) {\n \t\trte_spinlock_lock(&qconf->lock);\n \n \t\tdo {\n@@ -508,6 +511,9 @@ l2fwd_main_loop(void)\n \t\t\tuint64_t repeats = 0;\n \n \t\t\tdo {\n+\t\t\t\tif (force_quit)\n+\t\t\t\t\tbreak;\n+\n \t\t\t\tuint8_t i;\n \t\t\t\tuint64_t now = rte_get_timer_cycles();\n \n@@ -523,6 +529,9 @@ l2fwd_main_loop(void)\n \n \t\t\t} while (!need_manage);\n \n+\t\t\tif (force_quit)\n+\t\t\t\tbreak;\n+\n \t\t\tif (likely(repeats != 1))\n \t\t\t\trte_jobstats_finish(&qconf->idle_job, qconf->idle_job.target);\n \t\t\telse\n@@ -693,8 +702,12 @@ check_all_ports_link_status(uint32_t port_mask)\n \tprintf(\"\\nChecking link status\");\n \tfflush(stdout);\n \tfor (count = 0; count <= MAX_CHECK_TIME; count++) {\n+\t\tif (force_quit)\n+\t\t\treturn;\n \t\tall_ports_up = 1;\n \t\tRTE_ETH_FOREACH_DEV(portid) {\n+\t\t\tif (force_quit)\n+\t\t\t\treturn;\n \t\t\tif ((port_mask & (1 << portid)) == 0)\n \t\t\t\tcontinue;\n \t\t\tmemset(&link, 0, sizeof(link));\n@@ -742,6 +755,27 @@ check_all_ports_link_status(uint32_t port_mask)\n \t}\n }\n \n+static void\n+stop_and_close_eth_dev(uint16_t port_id)\n+{\n+\tRTE_ETH_FOREACH_DEV(port_id) {\n+\t\tprintf(\"Closing port %d...\", port_id);\n+\t\trte_eth_dev_stop(port_id);\n+\t\trte_eth_dev_close(port_id);\n+\t\tprintf(\" Done\\n\");\n+\t}\n+}\n+\n+static void\n+signal_handler(int signum)\n+{\n+\tif (signum == SIGINT || signum == SIGTERM) {\n+\t\tprintf(\"\\n\\nSignal %d received, preparing to exit...\\n\",\n+\t\t\t\tsignum);\n+\t\tforce_quit = true;\n+\t}\n+}\n+\n int\n main(int argc, char **argv)\n {\n@@ -762,6 +796,10 @@ main(int argc, char **argv)\n \targc -= ret;\n \targv += ret;\n \n+\tforce_quit = false;\n+\tsignal(SIGINT, signal_handler);\n+\tsignal(SIGTERM, signal_handler);\n+\n \t/* parse application arguments (after the EAL ones) */\n \tret = l2fwd_parse_args(argc, argv);\n \tif (ret < 0)\n@@ -960,6 +998,12 @@ main(int argc, char **argv)\n \t}\n \n \tcheck_all_ports_link_status(l2fwd_enabled_port_mask);\n+\tif (force_quit) {\n+\t\tstop_and_close_eth_dev(portid);\n+\t\trte_eal_cleanup();\n+\t\tprintf(\"Bye...\\n\");\n+\t\treturn 0;\n+\t}\n \n \tdrain_tsc = (hz + US_PER_S - 1) / US_PER_S * BURST_TX_DRAIN_US;\n \n@@ -1028,5 +1072,8 @@ main(int argc, char **argv)\n \t\t\treturn -1;\n \t}\n \n+\tstop_and_close_eth_dev(portid);\n+\trte_eal_cleanup();\n+\tprintf(\"Bye...\\n\");\n \treturn 0;\n }\n", "prefixes": [ "1/2" ] }{ "id": 74619, "url": "