Show a patch.

GET /api/patches/74620/
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 74620,
    "url": "https://patches.dpdk.org/api/patches/74620/",
    "web_url": "https://patches.dpdk.org/patch/74620/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<20200722125026.2595-2-ibtisam.tariq@emumba.com>",
    "date": "2020-07-22T12:50:26",
    "name": "[2/2] examples/l2fwd-crypto: Free resources on exit",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "a948a9200763cfd09a7121a6c82965b0172d1422",
    "submitter": {
        "id": 1680,
        "url": "https://patches.dpdk.org/api/people/1680/",
        "name": "Ibtisam Tariq",
        "email": "ibtisam.tariq@emumba.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/patch/74620/mbox/",
    "series": [
        {
            "id": 11237,
            "url": "https://patches.dpdk.org/api/series/11237/",
            "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/74620/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/74620/checks/",
    "tags": {},
    "headers": {
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "X-Gm-Message-State": "AOAM5322+XPgThmpESi4mY6UjeitjVt56gz0dkF97S+cG4es2C5oJHNE\n diQvbdMuF9ICXKDc5o2g/U7u1A==",
        "X-Google-Smtp-Source": "\n ABdhPJzIwvncXSPWoPVFVcU9jnwthG8zAehzZ2vCV4LbUxdWWgMAkR+BJhmKNpYH6I+4kPiUrxb/pA==",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "X-BeenThere": "dev@dpdk.org",
        "References": "<20200722125026.2595-1-ibtisam.tariq@emumba.com>",
        "Subject": "[dpdk-dev] [PATCH 2/2] examples/l2fwd-crypto: Free resources on exit",
        "Sender": "\"dev\" <dev-bounces@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 25DD2A0526;\n\tWed, 22 Jul 2020 14:52:07 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 986DD1BFEB;\n\tWed, 22 Jul 2020 14:52:00 +0200 (CEST)",
            "from mail-wm1-f65.google.com (mail-wm1-f65.google.com\n [209.85.128.65]) by dpdk.org (Postfix) with ESMTP id 5E5561BFF9\n for <dev@dpdk.org>; Wed, 22 Jul 2020 14:51:59 +0200 (CEST)",
            "by mail-wm1-f65.google.com with SMTP id o2so1888600wmh.2\n for <dev@dpdk.org>; Wed, 22 Jul 2020 05:51:59 -0700 (PDT)",
            "from localhost.localdomain ([39.33.200.211])\n by smtp.gmail.com with ESMTPSA id 26sm6983074wmj.25.2020.07.22.05.51.57\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 22 Jul 2020 05:51:58 -0700 (PDT)"
        ],
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "X-Mailer": "git-send-email 2.17.1",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "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:in-reply-to\n :references;\n bh=amwDWqWINvo1zdd82iW8vfrnfhw7xGOy5jIcGTH+afY=;\n b=n+gDn3ObDpfEeDcBWH7S7fTemt9NOyh27FjtxYS6oQjk9zAlBuh7EcLO5vtvis8t4e\n M089hA36dYzRnj+q517/h/EyCCLTeU9zMi7OlbAH7VD/UBnb8sg18dEO2+yBxFgjGRp6\n 47d3d9gvT4OtVwAzXD0/JedXY/kVJS7YzJpZsFtXzLI/xLb0c/muRGMOLSM7sFNmtWZV\n Lhw7p93g0tWzezaTPYtGLFR3jLVbZtE81K1wKDbhzogftsplRgtBK3w4g04q5VbD9SKD\n deVSIbdCetzFF8EK2cHulrMe2xP1Zw7alyCEeAfCU3brfWcttof45OSp23LTmWstzp+r\n OpLg==",
        "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:in-reply-to:references;\n bh=amwDWqWINvo1zdd82iW8vfrnfhw7xGOy5jIcGTH+afY=;\n b=0WUPJeDTL8ug3WTOmmgQxH/5+ow6JTcu3blqCvQylt5AohdgLo1K+6sDX4Alwe7XJt\n /I5w7b5QfSO/VD5c1J8zNI9UnoHqQ+CR0osOJ7FZkhiF10F2K17uIyDt+gj1jGdU4h6u\n jT3IugaEe3TUSGLcVeEzwzpeskS0VT2W5N3CqhuJq0q0qjm9bQdop/8QpmnjUf0nIdKA\n IIZBdVlklKxSdDWs/Cu1AQRWNJNyZ2/Z895Q3T2vkuhzOt+sdPL9nqStAgj2x+ubFFAV\n KKKepCkwQyD4E+aIPOXPfdJtt4OGOd/OX2PPux1PuAtxRW3AR5DEVeObomzyt4ZZLTkM\n ZkNQ==",
        "Date": "Wed, 22 Jul 2020 12:50:26 +0000",
        "X-Received": "by 2002:a1c:4408:: with SMTP id r8mr8494781wma.100.1595422318765;\n Wed, 22 Jul 2020 05:51:58 -0700 (PDT)",
        "To": "declan.doherty@intel.com",
        "From": "Ibtisam Tariq <ibtisam.tariq@emumba.com>",
        "In-Reply-To": "<20200722125026.2595-1-ibtisam.tariq@emumba.com>",
        "Cc": "dev@dpdk.org,\n\tIbtisam Tariq <ibtisam.tariq@emumba.com>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Message-Id": "<20200722125026.2595-2-ibtisam.tariq@emumba.com>",
        "Return-Path": "<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-crypto/main.c | 31 ++++++++++++++++++++++++++++++-\n 1 file changed, 30 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c\nindex 827da9b3e..5b00e2ade 100644\n--- a/examples/l2fwd-crypto/main.c\n+++ b/examples/l2fwd-crypto/main.c\n@@ -18,6 +18,7 @@\n #include <getopt.h>\n #include <fcntl.h>\n #include <unistd.h>\n+#include <signal.h>\n \n #include <rte_string_fns.h>\n #include <rte_atomic.h>\n@@ -47,6 +48,8 @@\n #include <rte_cryptodev_scheduler.h>\n #endif\n \n+static volatile bool force_quit;\n+\n enum cdev_type {\n \tCDEV_TYPE_ANY,\n \tCDEV_TYPE_HW,\n@@ -838,7 +841,7 @@ l2fwd_main_loop(struct l2fwd_crypto_options *options)\n \t * so user can see the crypto information.\n \t */\n \tprev_tsc = rte_rdtsc();\n-\twhile (1) {\n+\twhile (!force_quit) {\n \n \t\tcur_tsc = rte_rdtsc();\n \n@@ -1738,8 +1741,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@@ -2662,6 +2669,16 @@ reserve_key_memory(struct l2fwd_crypto_options *options)\n \toptions->aad.phys_addr = rte_malloc_virt2iova(options->aad.data);\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@@ -2681,6 +2698,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/* reserve memory for Cipher/Auth key and IV */\n \treserve_key_memory(&options);\n \n@@ -2807,6 +2828,14 @@ main(int argc, char **argv)\n \t\tif (rte_eal_wait_lcore(lcore_id) < 0)\n \t\t\treturn -1;\n \t}\n+\tRTE_ETH_FOREACH_DEV(portid) {\n+\t\tprintf(\"Closing port %d...\", portid);\n+\t\trte_eth_dev_stop(portid);\n+\t\trte_eth_dev_close(portid);\n+\t\tprintf(\" Done\\n\");\n+\t}\n+\trte_eal_cleanup();\n+\tprintf(\"Bye...\\n\");\n \n \treturn 0;\n }\n",
    "prefixes": [
        "2/2"
    ]
}