Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/46926/?format=api
http://patches.dpdk.org/api/patches/46926/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20181017010412.23141-5-dg@adax.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": "<20181017010412.23141-5-dg@adax.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20181017010412.23141-5-dg@adax.com", "date": "2018-10-17T01:04:11", "name": "[v4,4/6] examples/kni: monitor and update link status continually", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "59f7ccfe8bb9bcae8451456b1fd27bf7da69e90e", "submitter": { "id": 1040, "url": "http://patches.dpdk.org/api/people/1040/?format=api", "name": "Dan Gora", "email": "dg@adax.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/20181017010412.23141-5-dg@adax.com/mbox/", "series": [ { "id": 1288, "url": "http://patches.dpdk.org/api/series/1288/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1288", "date": "2018-09-11T23:29:04", "name": "kni: add API to set link status on kernel interface", "version": 1, "mbox": "http://patches.dpdk.org/series/1288/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/46926/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/46926/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 6BB5158FE;\n\tWed, 17 Oct 2018 03:04:50 +0200 (CEST)", "from mail-qk1-f180.google.com (mail-qk1-f180.google.com\n\t[209.85.222.180]) by dpdk.org (Postfix) with ESMTP id 4F6CD58FE\n\tfor <dev@dpdk.org>; Wed, 17 Oct 2018 03:04:47 +0200 (CEST)", "by mail-qk1-f180.google.com with SMTP id a85-v6so15445165qkg.3\n\tfor <dev@dpdk.org>; Tue, 16 Oct 2018 18:04:47 -0700 (PDT)", "from snappy.local.lan ([187.74.142.5])\n\tby smtp.gmail.com with ESMTPSA id\n\tv54-v6sm19547508qtc.81.2018.10.16.18.04.43\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tTue, 16 Oct 2018 18:04:45 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=sender:from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=YXXVpyDrx8IPADtT5NX3LbPOsIXnyqYD0/EQ9rmANjE=;\n\tb=SLrYZrYzCRG4SOAJ2JeVDRqyLCNuphimsB02impl361f8do15TF2vQvKOExQoxcEdg\n\tMSGm18e4r7rnh3JSLCEUXLY2J6ADiPkgLMKpO5WpT20PHkqiozwp5lSiCFncRmDTl+2/\n\tzgpWC0NuXvyTKW5xP0U8M3YwehTMcNTIQtgQIaB2sUDfw081+nKmuCJ55W90qxgHZEcL\n\tIQhcdkEDRZgPdivNjS3VIPJEz8NUqqOAwUuKJgF3XiWolfJCAhykZ94dyny/aEFNi2Wp\n\tJbIzIIce60MQuUvJphAaTktctHchUu4RJ79Ys50T7hbZMPu43VxmoKdOiQ2Em5jORpcE\n\ty2mQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:from:to:cc:subject:date:message-id\n\t:in-reply-to:references:mime-version:content-transfer-encoding;\n\tbh=YXXVpyDrx8IPADtT5NX3LbPOsIXnyqYD0/EQ9rmANjE=;\n\tb=XuZV2bah1PWlde60LrVWoVxe+QY29EPspHm8Mp8eRBvfFBje/NGNc73b8VMcb93QUL\n\tREpOqU5bnEYza9V6frRnQEllpCBud18zMN0WmtF71JVWNkWK5zf3O6AJUxPMz7oiKYmv\n\tjvh/6m3Oa1r7Osi2YVtlBN3ONFZVkWwusYViYX4sdT3G8Qo4GwQ4qjPN71o4uUB8dOgs\n\t9fAokQCDLeM0oad3EfjxdU8Ex2Q4QOLv2SYe+TlbgCq6fr2b8+d3pENETxZfDlRq8q3r\n\tlsDVtreETSDerVf907y8gvylBMLa+U9hNmlgLgbaHvIGlItRdsHxVT/mPR5ONZRE5s1q\n\tXZEg==", "X-Gm-Message-State": "ABuFfogfofkpI/+apEWAOk4FzEHDlBwee1GQHWMP9ZJh8c0M6KfyEa+A\n\tJWOoIA2tUwE2w6qYK/TybvHjMURFM/c=", "X-Google-Smtp-Source": "ACcGV60+RonaETbFFesXB59+ey1w8tkmqDeC/EG4+kUikzlHsGGgVlctCdLHwWeNxVup9V8HooCKJg==", "X-Received": "by 2002:a37:8d83:: with SMTP id\n\tp125-v6mr22568123qkd.97.1539738286309; \n\tTue, 16 Oct 2018 18:04:46 -0700 (PDT)", "From": "Dan Gora <dg@adax.com>", "To": "dev@dpdk.org", "Cc": "Igor Ryzhov <iryzhov@nfware.com>,\n\tStephen Hemminger <stephen@networkplumber.org>,\n\tFerruh Yigit <ferruh.yigit@intel.com>, Dan Gora <dg@adax.com>", "Date": "Tue, 16 Oct 2018 22:04:11 -0300", "Message-Id": "<20181017010412.23141-5-dg@adax.com>", "X-Mailer": "git-send-email 2.19.0", "In-Reply-To": "<20180911232906.18352-1-dg@adax.com>", "References": "<20180911232906.18352-1-dg@adax.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH v4 4/6] examples/kni: monitor and update link\n\tstatus continually", "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Update KNI example to add the command line flag '-m' to enable\na function to continuously monitor the Ethernet link status of\nthe physical link and update the link status of the corresponding\ninterfaces with rte_kni_update_link().\n\nSigned-off-by: Dan Gora <dg@adax.com>\n---\n examples/kni/Makefile | 2 ++\n examples/kni/main.c | 70 +++++++++++++++++++++++++++++++++++++++++--\n 2 files changed, 70 insertions(+), 2 deletions(-)", "diff": "diff --git a/examples/kni/Makefile b/examples/kni/Makefile\nindex 7e19d2e2a..dd90d7d73 100644\n--- a/examples/kni/Makefile\n+++ b/examples/kni/Makefile\n@@ -20,6 +20,7 @@ static: build/$(APP)-static\n \n PC_FILE := $(shell pkg-config --path libdpdk)\n CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)\n+CFLAGS += -DALLOW_EXPERIMENTAL_API\n LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)\n LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)\n \n@@ -54,6 +55,7 @@ please change the definition of the RTE_TARGET environment variable)\n endif\n \n CFLAGS += -O3\n+CFLAGS += -DALLOW_EXPERIMENTAL_API\n CFLAGS += $(WERROR_FLAGS)\n \n include $(RTE_SDK)/mk/rte.extapp.mk\ndiff --git a/examples/kni/main.c b/examples/kni/main.c\nindex 80c401c51..634024960 100644\n--- a/examples/kni/main.c\n+++ b/examples/kni/main.c\n@@ -106,6 +106,8 @@ static struct rte_mempool * pktmbuf_pool = NULL;\n static uint32_t ports_mask = 0;\n /* Ports set in promiscuous mode off by default. */\n static int promiscuous_on = 0;\n+/* Monitor link status continually. off by default. */\n+static int monitor_links;\n \n /* Structure type for recording kni interface specific stats */\n struct kni_interface_stats {\n@@ -325,11 +327,12 @@ 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 \"\n+\tRTE_LOG(INFO, APP, \"\\nUsage: %s [EAL options] -- -p PORTMASK -P -m \"\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 \" --config (port,lcore_rx,lcore_tx,lcore_kthread...): \"\n \t\t \"port and lcore configurations\\n\",\n \t prgname);\n@@ -510,7 +513,7 @@ parse_args(int argc, char **argv)\n \topterr = 0;\n \n \t/* Parse command line */\n-\twhile ((opt = getopt_long(argc, argv, \"p:P\", longopts,\n+\twhile ((opt = getopt_long(argc, argv, \"p:Pm\", longopts,\n \t\t\t\t\t\t&longindex)) != EOF) {\n \t\tswitch (opt) {\n \t\tcase 'p':\n@@ -519,6 +522,9 @@ parse_args(int argc, char **argv)\n \t\tcase 'P':\n \t\t\tpromiscuous_on = 1;\n \t\t\tbreak;\n+\t\tcase 'm':\n+\t\t\tmonitor_links = 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@@ -674,6 +680,55 @@ check_all_ports_link_status(uint32_t port_mask)\n \t}\n }\n \n+static void\n+log_link_state(struct rte_kni *kni, int prev, struct rte_eth_link *link)\n+{\n+\tif (kni == NULL || link == NULL)\n+\t\treturn;\n+\n+\tif (prev == ETH_LINK_DOWN && link->link_status == ETH_LINK_UP) {\n+\t\tRTE_LOG(INFO, APP, \"%s NIC Link is Up %d Mbps %s %s.\\n\",\n+\t\t\trte_kni_get_name(kni),\n+\t\t\tlink->link_speed,\n+\t\t\tlink->link_autoneg ? \"(AutoNeg)\" : \"(Fixed)\",\n+\t\t\tlink->link_duplex ? \"Full Duplex\" : \"Half Duplex\");\n+\t} else if (prev == ETH_LINK_UP && link->link_status == ETH_LINK_DOWN) {\n+\t\tRTE_LOG(INFO, APP, \"%s NIC Link is Down.\\n\",\n+\t\t\trte_kni_get_name(kni));\n+\t}\n+}\n+\n+/*\n+ * Monitor the link status of all ports and update the\n+ * corresponding KNI interface(s)\n+ */\n+static void *\n+monitor_all_ports_link_status(void *arg)\n+{\n+\tuint16_t portid;\n+\tstruct rte_eth_link link;\n+\tunsigned int i;\n+\tstruct kni_port_params **p = kni_port_params_array;\n+\tint prev;\n+\t(void) arg;\n+\n+\twhile (monitor_links) {\n+\t\trte_delay_ms(100);\n+\t\tRTE_ETH_FOREACH_DEV(portid) {\n+\t\t\tif ((ports_mask & (1 << portid)) == 0)\n+\t\t\t\tcontinue;\n+\t\t\tmemset(&link, 0, sizeof(link));\n+\t\t\trte_eth_link_get_nowait(portid, &link);\n+\t\t\tfor (i = 0; i < p[portid]->nb_kni; i++) {\n+\t\t\t\tprev = rte_kni_update_link(p[portid]->kni[i],\n+\t\t\t\t\t\tlink.link_status);\n+\t\t\t\tlog_link_state(p[portid]->kni[i], prev, &link);\n+\t\t\t}\n+\t\t}\n+\t}\n+\treturn NULL;\n+}\n+\n /* Callback for request of changing MTU */\n static int\n kni_change_mtu(uint16_t port_id, unsigned int new_mtu)\n@@ -893,6 +948,8 @@ main(int argc, char** argv)\n \tint ret;\n \tuint16_t nb_sys_ports, port;\n \tunsigned i;\n+\tvoid *retval;\n+\tpthread_t kni_link_tid;\n \n \t/* Associate signal_hanlder function with USR signals */\n \tsignal(SIGUSR1, signal_handler);\n@@ -949,12 +1006,21 @@ main(int argc, char** argv)\n \t}\n \tcheck_all_ports_link_status(ports_mask);\n \n+\tret = rte_ctrl_thread_create(&kni_link_tid,\n+\t\t\t\t \"KNI link status check\", NULL,\n+\t\t\t\t monitor_all_ports_link_status, NULL);\n+\tif (ret < 0)\n+\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\"Could not create link status thread!\\n\");\n+\n \t/* Launch per-lcore function on every lcore */\n \trte_eal_mp_remote_launch(main_loop, NULL, CALL_MASTER);\n \tRTE_LCORE_FOREACH_SLAVE(i) {\n \t\tif (rte_eal_wait_lcore(i) < 0)\n \t\t\treturn -1;\n \t}\n+\tmonitor_links = 0;\n+\tpthread_join(kni_link_tid, &retval);\n \n \t/* Release resources */\n \tRTE_ETH_FOREACH_DEV(port) {\n", "prefixes": [ "v4", "4/6" ] }{ "id": 46926, "url": "