get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 109540,
    "url": "http://patches.dpdk.org/api/patches/109540/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20220409101346.3621-1-laitianli@tom.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<20220409101346.3621-1-laitianli@tom.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220409101346.3621-1-laitianli@tom.com",
    "date": "2022-04-09T10:13:46",
    "name": "[v4] examples/kni: add interrupt mode to receive packets",
    "commit_ref": null,
    "pull_url": null,
    "state": "rejected",
    "archived": true,
    "hash": "82424cb391b364570212ae421b3f7a150811f885",
    "submitter": {
        "id": 2404,
        "url": "http://patches.dpdk.org/api/people/2404/?format=api",
        "name": "Tianli Lai",
        "email": "laitianli@tom.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20220409101346.3621-1-laitianli@tom.com/mbox/",
    "series": [
        {
            "id": 22451,
            "url": "http://patches.dpdk.org/api/series/22451/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=22451",
            "date": "2022-04-09T10:13:46",
            "name": "[v4] examples/kni: add interrupt mode to receive packets",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/22451/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/109540/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/109540/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 4BE52A034C;\n\tSat,  9 Apr 2022 04:14:06 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id F27AD40041;\n\tSat,  9 Apr 2022 04:14:05 +0200 (CEST)",
            "from smtp.tom.com (smtprz14.163.net [106.3.154.247])\n by mails.dpdk.org (Postfix) with ESMTP id 32EA54003F\n for <dev@dpdk.org>; Sat,  9 Apr 2022 04:14:03 +0200 (CEST)",
            "from my-app01.tom.com (my-app01.tom.com [127.0.0.1])\n by freemail01.tom.com (Postfix) with ESMTP id B903B1EA0071\n for <dev@dpdk.org>; Sat,  9 Apr 2022 10:14:02 +0800 (CST)",
            "from my-app01.tom.com (HELO smtp.tom.com) ([127.0.0.1])\n by my-app01 (TOM SMTP Server) with SMTP ID -369355248\n for <dev@dpdk.org>; Sat, 09 Apr 2022 10:14:02 +0800 (CST)",
            "from antispam3.tom.com (unknown [172.25.16.54])\n by freemail01.tom.com (Postfix) with ESMTP id AEE681EA006E\n for <dev@dpdk.org>; Sat,  9 Apr 2022 10:14:01 +0800 (CST)",
            "from antispam3.tom.com (antispam3.tom.com [127.0.0.1])\n by antispam3.tom.com (Postfix) with ESMTP id DCF129C1CB7\n for <dev@dpdk.org>; Sat,  9 Apr 2022 10:14:01 +0800 (CST)",
            "from antispam3.tom.com ([127.0.0.1])\n by antispam3.tom.com (antispam3.tom.com [127.0.0.1]) (amavisd-new,\n port 10024)\n with ESMTP id fgTqVnuiHcPS for <dev@dpdk.org>;\n Sat,  9 Apr 2022 10:14:00 +0800 (CST)",
            "from localhost.localdomain (unknown [113.81.210.244])\n by antispam3.tom.com (Postfix) with ESMTPA id 6820D9C083D;\n Sat,  9 Apr 2022 10:14:00 +0800 (CST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=tom.com; s=201807;\n t=1649470442; bh=ugi0ZvLOFotNAHw2Fx8MxnkXhonGIzUp/1+q7HNI7Xs=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=uCncsLQPN6trYwhKvD5zfnNmzNXlBBLv0WoBf3SfhokjJkoqumgICh2Jy7OsnT+Jv\n Q2pFA2do2q1L1aMQvRaEu+FQICaQNnVVljpjdJ/rWklocLwJtb8Nbz3qRESKnsQbFn\n 6hepNOv+DzjtUgIB758A30UDiRybxYhBTiGjWGpM=",
        "X-Virus-Scanned": "Debian amavisd-new at antispam3.tom.com",
        "From": "Tianli Lai <laitianli@tom.com>",
        "To": "dev@dpdk.org",
        "Cc": "stephen@networkplumber.org",
        "Subject": "[PATCH v4] examples/kni: add interrupt mode to receive packets",
        "Date": "Sat,  9 Apr 2022 18:13:46 +0800",
        "Message-Id": "<20220409101346.3621-1-laitianli@tom.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20220407161205.8633-1-laitianli@tom.com>",
        "References": "<20220407161205.8633-1-laitianli@tom.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "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"
    },
    "content": "kni application have two main-loop threads that they\nCPU utilization are up to 100 percent, this two theads are\nwriting thread and reading thread. I thank set interrupt mode\nat reading thread would reduce this thread CPU utilization.\n\nSigned-off-by: Tianli Lai <laitianli@tom.com>\n---\n examples/kni/main.c | 91 +++++++++++++++++++++++++++++++++++++++++----\n 1 file changed, 84 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/examples/kni/main.c b/examples/kni/main.c\nindex e99ef5c38a..d4d7a3daa9 100644\n--- a/examples/kni/main.c\n+++ b/examples/kni/main.c\n@@ -73,6 +73,7 @@\n \n #define KNI_US_PER_SECOND       1000000\n #define KNI_SECOND_PER_DAY      86400\n+#define MIN_ZERO_POLL_COUNT     100\n \n #define KNI_MAX_KTHREAD 32\n /*\n@@ -107,6 +108,8 @@ static uint32_t ports_mask = 0;\n static int promiscuous_on = 0;\n /* Monitor link status continually. off by default. */\n static int monitor_links;\n+/* rx set in interrupt mode off by default. */\n+static int intr_rx_en;\n \n /* Structure type for recording kni interface specific stats */\n struct kni_interface_stats {\n@@ -206,7 +209,7 @@ kni_burst_free_mbufs(struct rte_mbuf **pkts, unsigned num)\n /**\n  * Interface to burst rx and enqueue mbufs into rx_q\n  */\n-static void\n+static int\n kni_ingress(struct kni_port_params *p)\n {\n \tuint8_t i;\n@@ -214,9 +217,9 @@ kni_ingress(struct kni_port_params *p)\n \tunsigned nb_rx, num;\n \tuint32_t nb_kni;\n \tstruct rte_mbuf *pkts_burst[PKT_BURST_SZ];\n-\n+\tint ret = 0;\n \tif (p == NULL)\n-\t\treturn;\n+\t\treturn -1;\n \n \tnb_kni = p->nb_kni;\n \tport_id = p->port_id;\n@@ -225,8 +228,10 @@ kni_ingress(struct kni_port_params *p)\n \t\tnb_rx = rte_eth_rx_burst(port_id, 0, pkts_burst, PKT_BURST_SZ);\n \t\tif (unlikely(nb_rx > PKT_BURST_SZ)) {\n \t\t\tRTE_LOG(ERR, APP, \"Error receiving from eth\\n\");\n-\t\t\treturn;\n+\t\t\treturn -1;\n \t\t}\n+\t\tif (nb_rx == 0)\n+\t\t\tret = 1;\n \t\t/* Burst tx to kni */\n \t\tnum = rte_kni_tx_burst(p->kni[i], pkts_burst, nb_rx);\n \t\tif (num)\n@@ -239,6 +244,7 @@ kni_ingress(struct kni_port_params *p)\n \t\t\tkni_stats[port_id].rx_dropped += nb_rx - num;\n \t\t}\n \t}\n+\treturn ret;\n }\n \n /**\n@@ -277,12 +283,56 @@ kni_egress(struct kni_port_params *p)\n \t}\n }\n \n+static int\n+sleep_until_rx_interrupt(int num, int lcore)\n+{\n+\tstatic struct {\n+\t\tbool wakeup;\n+\t} __rte_cache_aligned status[RTE_MAX_LCORE];\n+\tstruct rte_epoll_event event[num];\n+\tint n;\n+\n+\tif (status[lcore].wakeup) {\n+\t\tRTE_LOG(DEBUG, APP,\n+\t\t\t\t\"lcore %u sleeps until interrupt triggers\\n\",\n+\t\t\t\trte_lcore_id());\n+\t}\n+\tn = rte_epoll_wait(RTE_EPOLL_PER_THREAD, event, num, 10);\n+\tstatus[lcore].wakeup = n != 0;\n+\n+\treturn 0;\n+}\n+\n+static void\n+turn_on_off_intr(uint16_t port_id, uint16_t queue_id, bool on)\n+{\n+\tif (on)\n+\t\trte_eth_dev_rx_intr_enable(port_id, queue_id);\n+\telse\n+\t\trte_eth_dev_rx_intr_disable(port_id, queue_id);\n+}\n+\n+static int event_register(void)\n+{\n+\tint ret;\n+\n+\tret = rte_eth_dev_rx_intr_ctl_q(0, 0,\n+\t\t\t\t\tRTE_EPOLL_PER_THREAD,\n+\t\t\t\t\tRTE_INTR_EVENT_ADD, NULL);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\treturn 0;\n+}\n+\n static int\n main_loop(__rte_unused void *arg)\n {\n \tuint16_t i;\n \tint32_t f_stop;\n \tint32_t f_pause;\n+\tint ret = 0;\n+\tuint32_t zero_rx_packet_count = 0;\n \tconst unsigned lcore_id = rte_lcore_id();\n \tenum lcore_rxtx {\n \t\tLCORE_NONE,\n@@ -291,12 +341,17 @@ main_loop(__rte_unused void *arg)\n \t\tLCORE_MAX\n \t};\n \tenum lcore_rxtx flag = LCORE_NONE;\n+\tint intr_en = 0;\n \n \tRTE_ETH_FOREACH_DEV(i) {\n \t\tif (!kni_port_params_array[i])\n \t\t\tcontinue;\n \t\tif (kni_port_params_array[i]->lcore_rx == (uint8_t)lcore_id) {\n \t\t\tflag = LCORE_RX;\n+\t\t\tif (intr_rx_en && !event_register())\n+\t\t\t\tintr_en = 1;\n+\t\t\telse\n+\t\t\t\tRTE_LOG(DEBUG, APP, \"RX interrupt won't enable.\\n\");\n \t\t\tbreak;\n \t\t} else if (kni_port_params_array[i]->lcore_tx ==\n \t\t\t\t\t\t(uint8_t)lcore_id) {\n@@ -316,7 +371,23 @@ main_loop(__rte_unused void *arg)\n \t\t\t\tbreak;\n \t\t\tif (f_pause)\n \t\t\t\tcontinue;\n-\t\t\tkni_ingress(kni_port_params_array[i]);\n+\t\t\tret = kni_ingress(kni_port_params_array[i]);\n+\t\t\tif (ret == 1) {\n+\t\t\t\tzero_rx_packet_count++;\n+\t\t\t\tif (zero_rx_packet_count <=\n+\t\t\t\t\t\tMIN_ZERO_POLL_COUNT)\n+\t\t\t\t\tcontinue;\n+\t\t\t} else\n+\t\t\t\tzero_rx_packet_count = 0;\n+\n+\t\t\tif (zero_rx_packet_count > 0) {\n+\t\t\t\tzero_rx_packet_count = 0;\n+\t\t\t\tif (unlikely(intr_en)) {\n+\t\t\t\t\tturn_on_off_intr(i, 0, 1);\n+\t\t\t\t\tsleep_until_rx_interrupt(1, lcore_id);\n+\t\t\t\t\tturn_on_off_intr(i, 0, 0);\n+\t\t\t\t}\n+\t\t\t}\n \t\t}\n \t} else if (flag == LCORE_TX) {\n \t\tRTE_LOG(INFO, APP, \"Lcore %u is writing to port %d\\n\",\n@@ -341,12 +412,13 @@ main_loop(__rte_unused void *arg)\n static void\n print_usage(const char *prgname)\n {\n-\tRTE_LOG(INFO, APP, \"\\nUsage: %s [EAL options] -- -p PORTMASK -P -m \"\n+\tRTE_LOG(INFO, APP, \"\\nUsage: %s [EAL options] -- -p PORTMASK -P -m -I \"\n \t\t   \"[--config (port,lcore_rx,lcore_tx,lcore_kthread...)\"\n \t\t   \"[,(port,lcore_rx,lcore_tx,lcore_kthread...)]]\\n\"\n \t\t   \"    -p PORTMASK: hex bitmask of ports to use\\n\"\n \t\t   \"    -P : enable promiscuous mode\\n\"\n \t\t   \"    -m : enable monitoring of port carrier state\\n\"\n+\t\t   \"    -I : enable rx interrupt mode\\n\"\n \t\t   \"    --config (port,lcore_rx,lcore_tx,lcore_kthread...): \"\n \t\t   \"port and lcore configurations\\n\",\n \t           prgname);\n@@ -527,7 +599,7 @@ parse_args(int argc, char **argv)\n \topterr = 0;\n \n \t/* Parse command line */\n-\twhile ((opt = getopt_long(argc, argv, \"p:Pm\", longopts,\n+\twhile ((opt = getopt_long(argc, argv, \"p:PmI\", longopts,\n \t\t\t\t\t\t&longindex)) != EOF) {\n \t\tswitch (opt) {\n \t\tcase 'p':\n@@ -539,6 +611,9 @@ parse_args(int argc, char **argv)\n \t\tcase 'm':\n \t\t\tmonitor_links = 1;\n \t\t\tbreak;\n+\t\tcase 'I':\n+\t\t\tintr_rx_en = 1;\n+\t\t\tbreak;\n \t\tcase 0:\n \t\t\tif (!strncmp(longopts[longindex].name,\n \t\t\t\t     CMDLINE_OPT_CONFIG,\n@@ -610,6 +685,8 @@ init_port(uint16_t port)\n \tif (dev_info.tx_offload_capa & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)\n \t\tlocal_port_conf.txmode.offloads |=\n \t\t\tRTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;\n+\tif (intr_rx_en)\n+\t\tlocal_port_conf.intr_conf.rxq = 1;\n \tret = rte_eth_dev_configure(port, 1, 1, &local_port_conf);\n \tif (ret < 0)\n \t\trte_exit(EXIT_FAILURE, \"Could not configure port%u (%d)\\n\",\n",
    "prefixes": [
        "v4"
    ]
}