Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/74029/?format=api
http://patchwork.dpdk.org/api/patches/74029/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20200714235810.5286-1-stephen@networkplumber.org/", "project": { "id": 1, "url": "http://patchwork.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": "<20200714235810.5286-1-stephen@networkplumber.org>", "list_archive_url": "https://inbox.dpdk.org/dev/20200714235810.5286-1-stephen@networkplumber.org", "date": "2020-07-14T23:58:10", "name": "net/tap: avoid using SIGIO", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "b5337e5651c8fbbdc333f24f8935deda06e2e449", "submitter": { "id": 27, "url": "http://patchwork.dpdk.org/api/people/27/?format=api", "name": "Stephen Hemminger", "email": "stephen@networkplumber.org" }, "delegate": { "id": 319, "url": "http://patchwork.dpdk.org/api/users/319/?format=api", "username": "fyigit", "first_name": "Ferruh", "last_name": "Yigit", "email": "ferruh.yigit@amd.com" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20200714235810.5286-1-stephen@networkplumber.org/mbox/", "series": [ { "id": 11026, "url": "http://patchwork.dpdk.org/api/series/11026/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=11026", "date": "2020-07-14T23:58:10", "name": "net/tap: avoid using SIGIO", "version": 1, "mbox": "http://patchwork.dpdk.org/series/11026/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/74029/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/74029/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 1A15AA0540;\n\tWed, 15 Jul 2020 01:58:17 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id DDF6D1C21F;\n\tWed, 15 Jul 2020 01:58:15 +0200 (CEST)", "from mail-pl1-f195.google.com (mail-pl1-f195.google.com\n [209.85.214.195]) by dpdk.org (Postfix) with ESMTP id 55DA01C20D\n for <dev@dpdk.org>; Wed, 15 Jul 2020 01:58:14 +0200 (CEST)", "by mail-pl1-f195.google.com with SMTP id b9so234381plx.6\n for <dev@dpdk.org>; Tue, 14 Jul 2020 16:58:14 -0700 (PDT)", "from hermes.corp.microsoft.com (204-195-22-127.wavecable.com.\n [204.195.22.127])\n by smtp.gmail.com with ESMTPSA id j36sm211640pgj.39.2020.07.14.16.58.11\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 14 Jul 2020 16:58:12 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=networkplumber-org.20150623.gappssmtp.com; s=20150623;\n h=from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding;\n bh=KuYj+Mmq6flYrDurxMFwkU005ZegQRAdR1akzTiAfDU=;\n b=Ul/of6z8klgiIT7+UgKjZ43EBck6hGcZGBcAmS8dShm8VaZRNCWuhKUtSnLXmzzIwc\n YwQl4Kp2cEcFNdHcCyMyRr5LUiopD4XwPvq9HFUTs93GOH4iXP2Jn51euPuyxmjwTBzw\n ZkmW5J+OC9CVwmVSS3C3ypNouZzJBh6J1zYf8y/78ze95h0Gd5fWGqpB7CF8YgpCnppc\n 1rMZPEjnAs1cmNJZsPNrGo5YNrcIRB8uJALmQ0xq73XTrp2AZp2XM9O2S/eq7PzV/Esp\n ubU3lQceUzqf0kk1a/1Tv1KrLre6h4UT3OTencECJZ4upeG2/uRYtH0OYiX8M+MAyQhF\n nHig==", "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:mime-version:content-transfer-encoding;\n bh=KuYj+Mmq6flYrDurxMFwkU005ZegQRAdR1akzTiAfDU=;\n b=r1fKOp7mgnr/3j0OybGHYu2KCuWBfSQ2Rxo2q/x4sT8+zHC7D+OaglqAFiK4mbfETd\n 3oP7g7v/+iDsefhZJbDOxxakP9cSlgL3fWv6RKh73L//8uTcvI3LUccjKY0PCCETIVus\n tJjSiyTBireGb7gSGFD8rN0Mmeb+AM97ZK5y82WbCXlpF3/0NpQlC61MFaIhNFPKJNKu\n /2p9i02faMlqQqtbaj7KE3VBl4HtDewmUm07CZoXElR3u85AfHBxePrUgffbpKGXcwSV\n DORGi/BgWHy37QAf8RqcpcUqkgPhMuZ12UnRUz14ywdBDMM4xHTsbsBou0OxxcE1pjfF\n TxSg==", "X-Gm-Message-State": "AOAM530g0RjWtmbsmfZ4gl9ap5NUS/YBMBOUyE7rsSLK/cVYu8+oZR/h\n wLcCAaMeUv5QZCR+HSngqqabdw==", "X-Google-Smtp-Source": "\n ABdhPJx3he/Xe/O+6RrWbsqRMpSbA+lfrBbGmN7KGAWGirpw8iGOduk48NTewnnd5/HRKlfxU0Uqwg==", "X-Received": "by 2002:a17:90a:fa09:: with SMTP id\n cm9mr7156915pjb.146.1594771093360;\n Tue, 14 Jul 2020 16:58:13 -0700 (PDT)", "From": "Stephen Hemminger <stephen@networkplumber.org>", "To": "keith.wiles@intel.com", "Cc": "dev@dpdk.org,\n\tStephen Hemminger <stephen@networkplumber.org>", "Date": "Tue, 14 Jul 2020 16:58:10 -0700", "Message-Id": "<20200714235810.5286-1-stephen@networkplumber.org>", "X-Mailer": "git-send-email 2.27.0", "In-Reply-To": "<20200422010156.1956-1-stephen@networkplumber.org>", "References": "<20200422010156.1956-1-stephen@networkplumber.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH] net/tap: avoid using SIGIO", "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 <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", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "SIGIO maybe used by application, instead choose another rt-signal.\nLinux allows any signal to be used for signal based IO.\nSearch for an unused signal in the available rt-signal range.\n\nAdd more error checking for fcntl and signal handling.\n\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>\n---\nResending original version, marked as PATCH now.\n\n drivers/net/tap/rte_eth_tap.c | 99 ++++++++++++++++++++++++-----------\n 1 file changed, 67 insertions(+), 32 deletions(-)", "diff": "diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c\nindex 339f24bf82f3..b19e26ba0e65 100644\n--- a/drivers/net/tap/rte_eth_tap.c\n+++ b/drivers/net/tap/rte_eth_tap.c\n@@ -134,7 +134,7 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive)\n #ifdef IFF_MULTI_QUEUE\n \tunsigned int features;\n #endif\n-\tint fd;\n+\tint fd, signo, flags;\n \n \tmemset(&ifr, 0, sizeof(struct ifreq));\n \n@@ -199,52 +199,87 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive)\n \t\t}\n \t}\n \n+\tflags = fcntl(fd, F_GETFL);\n+\tif (flags == -1) {\n+\t\tTAP_LOG(WARNING,\n+\t\t\t\"Unable to get %s current flags\\n\",\n+\t\t\tifr.ifr_name);\n+\t\tgoto error;\n+\t}\n+\n \t/* Always set the file descriptor to non-blocking */\n-\tif (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) {\n+\tflags |= O_NONBLOCK;\n+\tif (fcntl(fd, F_SETFL, flags) < 0) {\n \t\tTAP_LOG(WARNING,\n \t\t\t\"Unable to set %s to nonblocking: %s\",\n \t\t\tifr.ifr_name, strerror(errno));\n \t\tgoto error;\n \t}\n \n-\t/* Set up trigger to optimize empty Rx bursts */\n-\terrno = 0;\n-\tdo {\n+\t/* Find a free realtime signal */\n+\tfor (signo = SIGRTMIN + 1; signo < SIGRTMAX; signo++) {\n \t\tstruct sigaction sa;\n-\t\tint flags = fcntl(fd, F_GETFL);\n \n-\t\tif (flags == -1 || sigaction(SIGIO, NULL, &sa) == -1)\n+\t\tif (sigaction(signo, NULL, &sa) == -1) {\n+\t\t\tTAP_LOG(WARNING,\n+\t\t\t\t\"Unable to get current rt-signal %d handler\",\n+\t\t\t\tsigno);\n+\t\t\tgoto error;\n+\t\t}\n+\n+\t\t/* Already have the handler we want on this signal */\n+\t\tif (sa.sa_handler == tap_trigger_cb)\n \t\t\tbreak;\n-\t\tif (sa.sa_handler != tap_trigger_cb) {\n-\t\t\t/*\n-\t\t\t * Make sure SIGIO is not already taken. This is done\n-\t\t\t * as late as possible to leave the application a\n-\t\t\t * chance to set up its own signal handler first.\n-\t\t\t */\n-\t\t\tif (sa.sa_handler != SIG_IGN &&\n-\t\t\t sa.sa_handler != SIG_DFL) {\n-\t\t\t\terrno = EBUSY;\n-\t\t\t\tbreak;\n-\t\t\t}\n-\t\t\tsa = (struct sigaction){\n-\t\t\t\t.sa_flags = SA_RESTART,\n-\t\t\t\t.sa_handler = tap_trigger_cb,\n-\t\t\t};\n-\t\t\tif (sigaction(SIGIO, &sa, NULL) == -1)\n-\t\t\t\tbreak;\n+\n+\t\t/* Is handler in use by application */\n+\t\tif (sa.sa_handler != SIG_DFL) {\n+\t\t\tTAP_LOG(DEBUG,\n+\t\t\t\t\"Skipping used rt-signal %d\", signo);\n+\t\t\tcontinue;\n \t\t}\n-\t\t/* Enable SIGIO on file descriptor */\n-\t\tfcntl(fd, F_SETFL, flags | O_ASYNC);\n-\t\tfcntl(fd, F_SETOWN, getpid());\n-\t} while (0);\n \n-\tif (errno) {\n+\t\tsa = (struct sigaction) {\n+\t\t\t.sa_flags = SA_RESTART,\n+\t\t\t.sa_handler = tap_trigger_cb,\n+\t\t};\n+\n+\t\tif (sigaction(signo, &sa, NULL) == -1) {\n+\t\t\tTAP_LOG(WARNING,\n+\t\t\t\t\"Unable to set rt-signal %d handler\\n\", signo);\n+\t\t\tgoto error;\n+\t\t}\n+\n+\t\t/* Found a good signal to use */\n+\t\tTAP_LOG(DEBUG,\n+\t\t\t\"Using rt-signal %d\", signo);\n+\t\tbreak;\n+\t}\n+\n+\tif (signo == SIGRTMAX) {\n+\t\tTAP_LOG(WARNING, \"All rt-signals are in use\\n\");\n+\n \t\t/* Disable trigger globally in case of error */\n \t\ttap_trigger = 0;\n-\t\tTAP_LOG(WARNING, \"Rx trigger disabled: %s\",\n-\t\t\tstrerror(errno));\n-\t}\n+\t\tTAP_LOG(NOTICE, \"No Rx trigger signal available\\n\");\n+\t} else {\n+\t\t/* Enable signal on file descriptor */\n+\t\tif (fcntl(fd, F_SETSIG, signo) < 0) {\n+\t\t\tTAP_LOG(WARNING, \"Unable to set signo %d for fd %d: %s\",\n+\t\t\t\tsigno, fd, strerror(errno));\n+\t\t\tgoto error;\n+\t\t}\n+\t\tif (fcntl(fd, F_SETFL, flags | O_ASYNC) < 0) {\n+\t\t\tTAP_LOG(WARNING, \"Unable to set fcntl flags: %s\",\n+\t\t\t\tstrerror(errno));\n+\t\t\tgoto error;\n+\t\t}\n \n+\t\tif (fcntl(fd, F_SETOWN, getpid()) < 0) {\n+\t\t\tTAP_LOG(WARNING, \"Unable to set fcntl owner: %s\",\n+\t\t\t\tstrerror(errno));\n+\t\t\tgoto error;\n+\t\t}\n+\t}\n \treturn fd;\n \n error:\n", "prefixes": [] }{ "id": 74029, "url": "