Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/105140/?format=api
http://patches.dpdk.org/api/patches/105140/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20211214141242.3383831-12-ronan.randles@intel.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": "<20211214141242.3383831-12-ronan.randles@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20211214141242.3383831-12-ronan.randles@intel.com", "date": "2021-12-14T14:12:41", "name": "[11/12] examples/generator: link status check added", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": true, "hash": "2501d7c4fb376196eeb88bf2b4fa8f42d955b2ef", "submitter": { "id": 2439, "url": "http://patches.dpdk.org/api/people/2439/?format=api", "name": "Ronan Randles", "email": "ronan.randles@intel.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/20211214141242.3383831-12-ronan.randles@intel.com/mbox/", "series": [ { "id": 20944, "url": "http://patches.dpdk.org/api/series/20944/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=20944", "date": "2021-12-14T14:12:30", "name": "add packet generator library and example app", "version": 1, "mbox": "http://patches.dpdk.org/series/20944/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/105140/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/105140/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 8C05DA00C3;\n\tTue, 14 Dec 2021 15:13:57 +0100 (CET)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 667E541155;\n\tTue, 14 Dec 2021 15:13:14 +0100 (CET)", "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n by mails.dpdk.org (Postfix) with ESMTP id 8F5BD4113E\n for <dev@dpdk.org>; Tue, 14 Dec 2021 15:13:12 +0100 (CET)", "from orsmga006.jf.intel.com ([10.7.209.51])\n by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 14 Dec 2021 06:13:11 -0800", "from silpixa00401120.ir.intel.com ([10.55.129.95])\n by orsmga006.jf.intel.com with ESMTP; 14 Dec 2021 06:13:01 -0800" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=simple/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1639491192; x=1671027192;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=pJwgtgPDAa76cI6LGrsSGCMlAYxRRljoTl6XxGmmILo=;\n b=dtHy81VU5CxAodSatC11eu7BeLgYsfoHLfhA14vw5Zn0zws7fBI4CT5q\n kmhtdpPkUJsZNRa9rEuxAYuHxd9fkB0KG0j14zyngfDigTArvzcK5+42x\n MrS7/+aUzdNv0gmK0fXJVORPeHXZZTd+tz+0RLZhi11HIXj7z73pCNF0T\n js7f0auqjhdw++P7PTB5Q327pp7NgTGc+A2UFcFN+3P/NTUobTzfwRb7B\n ZS5b23LmCKhZiF69Qx9W27kD2ERpCZVvufWkhei9U8cryWneKs3VQrt2v\n wbjqTmoQH5MTA+jWXpVx7D5QfVKZzlfNyx4Zc08d1RItvAOw7B9IV8dml Q==;", "X-IronPort-AV": [ "E=McAfee;i=\"6200,9189,10197\"; a=\"263123885\"", "E=Sophos;i=\"5.88,205,1635231600\"; d=\"scan'208\";a=\"263123885\"", "E=Sophos;i=\"5.88,205,1635231600\"; d=\"scan'208\";a=\"465104187\"" ], "X-ExtLoop1": "1", "From": "Ronan Randles <ronan.randles@intel.com>", "To": "dev@dpdk.org", "Cc": "harry.van.haaren@intel.com,\n\tRonan Randles <ronan.randles@intel.com>", "Subject": "[PATCH 11/12] examples/generator: link status check added", "Date": "Tue, 14 Dec 2021 14:12:41 +0000", "Message-Id": "<20211214141242.3383831-12-ronan.randles@intel.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20211214141242.3383831-1-ronan.randles@intel.com>", "References": "<20211214141242.3383831-1-ronan.randles@intel.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": "This commit brings in a link status check so that the generator will\nonly start sending packets once there is something on the other end of\nthe link.\n\nSigned-off-by: Ronan Randles <ronan.randles@intel.com>\n---\n examples/generator/main.c | 70 +++++++++++++++++++++++++++++++++++++--\n 1 file changed, 67 insertions(+), 3 deletions(-)", "diff": "diff --git a/examples/generator/main.c b/examples/generator/main.c\nindex 2525d34b6e..f11110e528 100644\n--- a/examples/generator/main.c\n+++ b/examples/generator/main.c\n@@ -27,9 +27,13 @@ static const struct rte_eth_conf port_conf_default = {\n \t.rxmode = {\n \t\t.max_lro_pkt_size = RTE_ETHER_MAX_LEN,\n \t},\n+\t.intr_conf = {\n+\t\t.lsc = 1, /**< lsc interrupt */\n+\t},\n };\n \n static volatile int done;\n+static volatile int link_status[RTE_MAX_ETHPORTS];\n static struct rte_mempool *mbuf_pool;\n struct rte_gen *gen;\n \n@@ -58,6 +62,30 @@ static struct telemetry_userdata telemetry_userdata;\n \n static void handle_sigint(int sig);\n \n+static int\n+link_status_change_cb(uint16_t port_id, enum rte_eth_event_type type,\n+\t\t void *param, void *ret_param)\n+{\n+\tif (unlikely(port_id >= RTE_DIM(link_status)))\n+\t\trte_panic(\"got LSC interrupt for unknown port id\\n\");\n+\n+\tRTE_SET_USED(type);\n+\tRTE_SET_USED(param);\n+\tRTE_SET_USED(ret_param);\n+\n+\tstruct rte_eth_link link;\n+\tint ret = rte_eth_link_get_nowait(port_id, &link);\n+\tif (ret < 0) {\n+\t\tprintf(\"Failed link get on port %d: %s\\n\",\n+\t\t port_id, rte_strerror(-ret));\n+\t\treturn ret;\n+\t}\n+\n+\tprintf(\"Link status change port %i\\n\", port_id);\n+\tlink_status[port_id] = link.link_status;\n+\treturn 0;\n+}\n+\n /* Initializes a given port using global settings and with the RX buffers\n * coming from the mbuf_pool passed as a parameter.\n */\n@@ -101,6 +129,9 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)\n \t\tprintf(\"Not enough threads available\\n\");\n \t\treturn -1;\n \t}\n+\t/* Register the LinkStatusChange callback */\n+\trte_eth_dev_callback_register(port, RTE_ETH_EVENT_INTR_LSC,\n+\t\t\t\t link_status_change_cb, NULL);\n \n \t/* Allocate and set up 1 RX queue per Ethernet port. */\n \tfor (q = 0; q < rx_rings; q++) {\n@@ -140,6 +171,16 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)\n \tif (retval != 0)\n \t\treturn retval;\n \n+\tstruct rte_eth_link link;\n+\tint ret = rte_eth_link_get_nowait(port, &link);\n+\tif (ret < 0) {\n+\t\tprintf(\"Failed link get on port %d: %s\\n\", port,\n+\t\t\t\t\t\t\trte_strerror(-ret));\n+\t\treturn ret;\n+\t}\n+\n+\tlink_status[port] = link.link_status;\n+\n \treturn 0;\n }\n \n@@ -166,12 +207,26 @@ lcore_producer(void *arg)\n \tuint64_t tsc_hz = rte_get_tsc_hz();\n \tuint64_t last_tsc_reading = 0;\n \tuint64_t last_tx_total = 0;\n+\tuint16_t nb_tx = 0;\n+\n+\t/* Ensure all available ports are up before generating packets */\n+\tuint16_t nb_eth_ports = rte_eth_dev_count_avail();\n+\tuint16_t nb_links_up = 0;\n+\twhile (!done && nb_links_up < nb_eth_ports) {\n+\t\tif (link_status[nb_links_up])\n+\t\t\tnb_links_up++;\n+\n+\t\trte_delay_us_block(100);\n+\t}\n+\tif (!done)\n+\t\tprintf(\"Generating packets...\\n\");\n \n \t/* Run until the application is quit or killed. */\n \twhile (!done) {\n+\n \t\tstruct rte_mbuf *bufs[BURST_SIZE];\n-\t\tuint16_t nb_tx = 0;\n \t\t/* Receive packets from gen and then tx them over port */\n+\n \t\tRTE_ETH_FOREACH_DEV(port) {\n \t\t\tint nb_generated = rte_gen_rx_burst(gen, bufs,\n \t\t\t\t\t\t\tBURST_SIZE);\n@@ -219,8 +274,19 @@ lcore_consumer(void *arg)\n \t\t\t\t\t\"polling thread.\\n\\tPerformance will \"\n \t\t\t\t\t\"not be optimal.\\n\", port);\n \n+\t/* Ensure all available ports are up before generating packets */\n+\tuint16_t nb_eth_ports = rte_eth_dev_count_avail();\n+\tuint16_t nb_links_up = 0;\n+\twhile (!done && nb_links_up < nb_eth_ports) {\n+\t\tif (link_status[nb_links_up])\n+\t\t\tnb_links_up++;\n+\n+\t\trte_delay_us_block(100);\n+\t}\n+\n \t/* Run until the application is quit or killed. */\n \twhile (!done) {\n+\n \t\tstruct rte_mbuf *bufs[BURST_SIZE];\n \n \t\t/* Receive packets over port and then tx them to gen library\n@@ -257,8 +323,6 @@ tele_gen_packet(const char *cmd, const char *params, struct rte_tel_data *d)\n {\n \tRTE_SET_USED(cmd);\n \tRTE_SET_USED(params);\n-\tRTE_SET_USED(d);\n-\n \trte_tel_data_string(d, \"Ether()/IP()\");\n \treturn 0;\n }\n", "prefixes": [ "11/12" ] }{ "id": 105140, "url": "