From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id 9D4B41B0B for ; Tue, 29 May 2018 12:26:02 +0200 (CEST) Received: by mail-wm0-f66.google.com with SMTP id f8-v6so39148236wmc.4 for ; Tue, 29 May 2018 03:26:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jekd2ZtI/CjJ0uQfxYfHsxPoZRBOhO6kFDsaPMUjUnM=; b=ssQL9/4jyCrenJEYKnIlRZHdVXjVr8rnggiVHrpHejTbyskIXEZYl6wd1ZgmZUbkqF C/PQBLz+iiTuOF3FjbRNupBUUVEjoZJmpxFfGerO5qjUTxAPToFYlsavI/RP0YANScob AcY9cZYKfLnMC++17UHa70mXWubsWx8RWrUQlF20guUjXdiOyHKzvBHy9jhJq4dLu1e8 W8b6xwUS/44nFmXAwjUdf7i9jda4+CEhaCv8nlVS+cAg620axMzNKPLemxthuDypt5IZ Z4nu3buZ3ipcdFy6LPUY2zVtQxBbK8iefpT1XYg/eXTxuuNGRSZjNzVaRe22qZmEUCpI gBbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jekd2ZtI/CjJ0uQfxYfHsxPoZRBOhO6kFDsaPMUjUnM=; b=XcqpxWxcvKnYFT82pTi+bCnacRy/oZwuEEYl8NDtyjOvncvJ0vGs5JVuOaPryEvWcY d7nIihwdLQFelR3fUThLK+5cQkSjbY8rJCpV/lC2oNXt5Lg3glH2UguiCO0q4bJdOpQX 6DGeEhcIrhAvZgXlf3+Vl5/KAzDrtOLH9gYDxWtYDQXG/2d2saFOqBffMS5v6yGION5k bXR1OjbLbcJECPAyhvqiQ/JeNjGDKiLJwDrXzXePLIFOxUK0WMXB0VWo6kBK3rkvvXq1 DleoqK9dUPdrMJ4krcYwmehmhGUKZMcGkU6wjnzuUsulDwM0FA1k9zvoJiYl1aFxQ/3w cceQ== X-Gm-Message-State: ALKqPwfkHbBsoRYt9uZ5kmrGJ/lxPOlgyhLGreEghg9yJltB2SV8Zbre zEhqkwdbxelmajhkHhFPIp8= X-Google-Smtp-Source: ADUXVKL6rHqxJs3eB2u3V6QNSSO2yr3K0opH6kHQ1L62MknxN6gOLzGvrSq9FmeQ8pY89fC4xyTOkw== X-Received: by 2002:a1c:6f52:: with SMTP id k79-v6mr9962517wmc.38.1527589562342; Tue, 29 May 2018 03:26:02 -0700 (PDT) Received: from localhost ([32.112.155.38]) by smtp.gmail.com with ESMTPSA id n7-v6sm14245601wri.27.2018.05.29.03.26.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 May 2018 03:26:01 -0700 (PDT) From: luca.boccassi@gmail.com To: Ophir Munk Cc: Keith Wiles , dpdk stable Date: Tue, 29 May 2018 11:25:51 +0100 Message-Id: <20180529102553.23431-3-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180529102553.23431-1-luca.boccassi@gmail.com> References: <20180523121010.8385-59-luca.boccassi@gmail.com> <20180529102553.23431-1-luca.boccassi@gmail.com> Subject: [dpdk-stable] patch 'net/tap: fix keep-alive queue not detached' has been queued to stable release 18.02.2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 10:26:02 -0000 Hi, FYI, your patch has been queued to stable release 18.02.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/31/18. So please shout if anyone has objections. Thanks. Luca Boccassi --- >>From 78f59529854f96cd7337126dca033d8a46be7319 Mon Sep 17 00:00:00 2001 From: Ophir Munk Date: Thu, 24 May 2018 23:10:40 +0000 Subject: [PATCH] net/tap: fix keep-alive queue not detached [ upstream commit 42ec78eaeb22fb17fcd5315c8607b80ffd4c64d2 ] The TAP keep-alive queue was created in order to keep the TAP device in Linux even in case all of its Rx/Tx queues are released (in Linux terminology: even in case all of the TAP device file descriptors are closed), however, the keep-alive queue itself is attached to the TAP device like all other Rx/Tx queues and therefore the kernel will enqueue to it some Rx packets based on the kernel RSS distribution rules. Those packets are unknown to the application and will remain lost in the keep-alive queue. All queues are attached by default to the TAP device after they are created though TUNSETIFF ioctl call. The fix is to detach the keep-alive queue after its creation through TUNSETQUEUE ioctl call. Fixes: 3101191c63ab ("net/tap: fix device removal when no queue exist") Signed-off-by: Ophir Munk Acked-by: Keith Wiles --- drivers/net/tap/rte_eth_tap.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index b9b9397b9..881cdd19f 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -84,13 +84,20 @@ enum ioctl_mode { static int tap_intr_handle_set(struct rte_eth_dev *dev, int set); -/* Tun/Tap allocation routine +/** + * Tun/Tap allocation routine * - * name is the number of the interface to use, unless NULL to take the host - * supplied name. + * @param[in] pmd + * Pointer to private structure. + * + * @param[in] is_keepalive + * Keepalive flag + * + * @return + * -1 on failure, fd on success */ static int -tun_alloc(struct pmd_internals *pmd) +tun_alloc(struct pmd_internals *pmd, int is_keepalive) { struct ifreq ifr; #ifdef IFF_MULTI_QUEUE @@ -143,6 +150,20 @@ tun_alloc(struct pmd_internals *pmd) goto error; } + if (is_keepalive) { + /* + * Detach the TUN/TAP keep-alive queue + * to avoid traffic through it + */ + ifr.ifr_flags = IFF_DETACH_QUEUE; + if (ioctl(fd, TUNSETQUEUE, (void *)&ifr) < 0) { + RTE_LOG(WARNING, PMD, + "Unable to detach keep-alive queue for %s: %s\n", + ifr.ifr_name, strerror(errno)); + goto error; + } + } + /* Always set the file descriptor to non-blocking */ if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) { RTE_LOG(WARNING, PMD, @@ -1015,7 +1036,7 @@ tap_setup_queue(struct rte_eth_dev *dev, pmd->name, *other_fd, dir, qid, *fd); } else { /* Both RX and TX fds do not exist (equal -1). Create fd */ - *fd = tun_alloc(pmd); + *fd = tun_alloc(pmd, 0); if (*fd < 0) { *fd = -1; /* restore original value */ RTE_LOG(ERR, PMD, "%s: tun_alloc() failed.\n", @@ -1421,7 +1442,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, char *tap_name, * This keep-alive file descriptor will guarantee that the TUN device * exists even when all of its queues are closed */ - pmd->ka_fd = tun_alloc(pmd); + pmd->ka_fd = tun_alloc(pmd, 1); if (pmd->ka_fd == -1) { RTE_LOG(ERR, PMD, "Unable to create %s interface", tap_name); goto error_exit; -- 2.17.0