Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/106172/?format=api
http://patches.dpdk.org/api/patches/106172/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20220121103122.2926856-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": "<20220121103122.2926856-12-ronan.randles@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20220121103122.2926856-12-ronan.randles@intel.com", "date": "2022-01-21T10:31:18", "name": "[v2,11/15] examples/generator: link status check added", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": true, "hash": "9dc3a5ec4b46abc733d9f0e286a652d15982f6a1", "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/20220121103122.2926856-12-ronan.randles@intel.com/mbox/", "series": [ { "id": 21295, "url": "http://patches.dpdk.org/api/series/21295/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=21295", "date": "2022-01-21T10:31:07", "name": "add packet generator library and example app", "version": 2, "mbox": "http://patches.dpdk.org/series/21295/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/106172/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/106172/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 A2F06A034E;\n\tFri, 21 Jan 2022 11:32:41 +0100 (CET)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id C804C42786;\n\tFri, 21 Jan 2022 11:31:46 +0100 (CET)", "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n by mails.dpdk.org (Postfix) with ESMTP id 005E440042\n for <dev@dpdk.org>; Fri, 21 Jan 2022 11:31:43 +0100 (CET)", "from orsmga008.jf.intel.com ([10.7.209.65])\n by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 21 Jan 2022 02:31:43 -0800", "from silpixa00401120.ir.intel.com ([10.55.128.255])\n by orsmga008.jf.intel.com with ESMTP; 21 Jan 2022 02:31:42 -0800" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1642761104; x=1674297104;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=8LhZfzmp2EezJLVPdCKhcaxDJb9I56S7MDmCLyZtqZc=;\n b=JXshPH6vKC2Pe7GIO5Pf18el9MBUPTk6Q4eQ9dpmzbV9qIV15VfwoBid\n jFCXMRRu1Qh6yjz1AecGQF43AKO6a4MihkuOZ6dR363PpcCbDLffYXzMF\n VrpWFiRDjOFqdsJScFvr8uwI9pCL3jb+UJa2erxFT+8ybU4vv+RbIESGR\n ctShyVQfs9zauFPVyLlsTiOhFgkAxqnYAoNpt/Dop9Fn1NrTOZpPB1gky\n K69/bJQD96R3sYUJHSBvKkpq334XevSlbT1HVwZX7xkemvKy71VFGTDtZ\n mefpkwzIQRv32NkHU+zwhzvQZJ/bFjjjXxFPwDpqNuKaqtGnoEYDHUOHT Q==;", "X-IronPort-AV": [ "E=McAfee;i=\"6200,9189,10233\"; a=\"270045136\"", "E=Sophos;i=\"5.88,304,1635231600\"; d=\"scan'208\";a=\"270045136\"", "E=Sophos;i=\"5.88,304,1635231600\"; d=\"scan'208\";a=\"533222780\"" ], "X-ExtLoop1": "1", "From": "Ronan Randles <ronan.randles@intel.com>", "To": "dev@dpdk.org", "Cc": "Ronan Randles <ronan.randles@intel.com>", "Subject": "[PATCH v2 11/15] examples/generator: link status check added", "Date": "Fri, 21 Jan 2022 10:31:18 +0000", "Message-Id": "<20220121103122.2926856-12-ronan.randles@intel.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20220121103122.2926856-1-ronan.randles@intel.com>", "References": "<20211214141242.3383831-1-ronan.randles@intel.com>\n <20220121103122.2926856-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 | 68 ++++++++++++++++++++++++++++++++++++++-\n 1 file changed, 67 insertions(+), 1 deletion(-)", "diff": "diff --git a/examples/generator/main.c b/examples/generator/main.c\nindex 1ac3caafcc..0834a094a4 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@@ -56,6 +60,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@@ -99,6 +127,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@@ -138,9 +169,33 @@ 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+static void\n+gen_wait_for_links_up(void)\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+\n /* The lcore main. This is the main thread that does the work, reading from\n * an input port and writing to an output port.\n */\n@@ -164,12 +219,19 @@ 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/* Wait for links to come up before generating packets */\n+\tgen_wait_for_links_up();\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@@ -217,8 +279,12 @@ 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/* Wait for links to come up before generating packets */\n+\tgen_wait_for_links_up();\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", "prefixes": [ "v2", "11/15" ] }{ "id": 106172, "url": "