From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3E4BEA0032 for ; Fri, 18 Feb 2022 13:44:22 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 39CBF41142; Fri, 18 Feb 2022 13:44:22 +0100 (CET) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by mails.dpdk.org (Postfix) with ESMTP id 80AC440150 for ; Fri, 18 Feb 2022 13:44:21 +0100 (CET) Received: by mail-wm1-f45.google.com with SMTP id d14-20020a05600c34ce00b0037bf4d14dc7so6315062wmq.3 for ; Fri, 18 Feb 2022 04:44:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lVBMUW9WQst/nVAjfvaH9qCvEzRXMwr6/dwOP5mxLpo=; b=jrkc2xZB7i6cSKwWbLlyYO6XzNmtnQqQYE/eF5F8y4g3bZJ/dY7b2ee+/5qng0Q0fb eskB6aoHH8ed96ELlRiyIfy+MVDYpVzLCcQ6Gcq0nDPKV9J/HdAOFKCZz/NzNgY6M1hq bqtykqGO2CGp+pKTPfurrnCRZQ1tkiiQ6OiaH+gfi4pAO3+MNCwu+13HrKyVuq+kDYqd O4NAf6Jh9JMJ8hZrcrLL3YQvHYh2F561dXNiD+EYgzttCUvYxSGqL8BTWs2Morbapbp2 D0g8xD+4cEFECkJ5rS/Htdp8lQjZattvlwB9+GyYBHQt4KeygfYBWMnVnPOtJA3xTUAG PoSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lVBMUW9WQst/nVAjfvaH9qCvEzRXMwr6/dwOP5mxLpo=; b=sTVgH/xwfiLkM7491+YkxtLxJdHnA8sLFbBIzDKrNlfO/FjUapJFw0CkMFoz8hm0+0 juOzA+/cVRAddn5Z2F3eBYQ9OMtNqSPpi+3h00bF+flhyZQ6V7dq4JrRioiIzHBf45Mj 2BE3u2Mdq2T9cBogn/PJqAi6mEJFmPeT69eO2kHtv2mUHRdDA+2BgvJxU82ETqZ1vWs6 Kw9BCRrOVtYvQmWzHGVx6Y1mXitCodr6BB/77yXIkP/JJXuxc45RmZJH68hihvMKvjjt q74FHyDVjItnhcPHLwQx+oqfDyt6oY5PMI4lIUMbDLb7bGdasYR2YODG/K53gnUndHzH bXTw== X-Gm-Message-State: AOAM533sQQ1TtWoIxGiu68EjkFa2wsZfqWn1nxLwAUtYZBM/cPRBde04 YE68AVATh5NG5KB1Xj9lB0g= X-Google-Smtp-Source: ABdhPJyNBf4YGsvY33KiMtOAMei8L1RJTVrznlvrarqdlh3HNHLbQoFN8DfNUa4Yvzq2gouY2/oeFw== X-Received: by 2002:a05:600c:20c7:b0:37b:b739:8177 with SMTP id y7-20020a05600c20c700b0037bb7398177mr6994100wmm.121.1645188261235; Fri, 18 Feb 2022 04:44:21 -0800 (PST) Received: from localhost ([2a01:4b00:f41a:3600:360b:9754:2e3a:c344]) by smtp.gmail.com with ESMTPSA id 12sm17390776wry.111.2022.02.18.04.44.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Feb 2022 04:44:20 -0800 (PST) From: luca.boccassi@gmail.com To: Kumara Parameshwaran Cc: Ferruh Yigit , dpdk stable Subject: patch 'net/tap: fix to populate FDs in secondary process' has been queued to stable release 20.11.5 Date: Fri, 18 Feb 2022 12:39:02 +0000 Message-Id: <20220218123931.1749595-93-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220218123931.1749595-1-luca.boccassi@gmail.com> References: <20220218123931.1749595-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 20.11.5 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/20/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/aea2c5be01694644e9111b4f2407382a8af19aaa Thanks. Luca Boccassi --- >From aea2c5be01694644e9111b4f2407382a8af19aaa Mon Sep 17 00:00:00 2001 From: Kumara Parameshwaran Date: Mon, 31 Jan 2022 20:02:34 +0530 Subject: [PATCH] net/tap: fix to populate FDs in secondary process [ upstream commit c36ce7099c2187926cd62cff7ebd479823554929 ] When a tap device is hotplugged to primary process which in turn adds the device to all secondary process, the secondary process does a tap_mp_attach_queues, but the fds are not populated in the primary during the probe they are populated during the queue_setup, added a fix to sync the queues during rte_eth_dev_start Fixes: 4852aa8f6e21 ("drivers/net: enable hotplug on secondary process") Signed-off-by: Kumara Parameshwaran Reviewed-by: Ferruh Yigit --- drivers/net/tap/rte_eth_tap.c | 80 +++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 40a7bc44b1..dcc12f32e7 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -67,6 +67,7 @@ /* IPC key for queue fds sync */ #define TAP_MP_KEY "tap_mp_sync_queues" +#define TAP_MP_REQ_START_RXTX "tap_mp_req_start_rxtx" #define TAP_IOV_DEFAULT_MAX 1024 @@ -905,11 +906,49 @@ tap_link_set_up(struct rte_eth_dev *dev) return tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE); } +static int +tap_mp_req_on_rxtx(struct rte_eth_dev *dev) +{ + struct rte_mp_msg msg; + struct ipc_queues *request_param = (struct ipc_queues *)msg.param; + int err; + int fd_iterator = 0; + struct pmd_process_private *process_private = dev->process_private; + int i; + + memset(&msg, 0, sizeof(msg)); + strlcpy(msg.name, TAP_MP_REQ_START_RXTX, sizeof(msg.name)); + strlcpy(request_param->port_name, dev->data->name, sizeof(request_param->port_name)); + msg.len_param = sizeof(*request_param); + for (i = 0; i < dev->data->nb_tx_queues; i++) { + msg.fds[fd_iterator++] = process_private->txq_fds[i]; + msg.num_fds++; + request_param->txq_count++; + } + for (i = 0; i < dev->data->nb_rx_queues; i++) { + msg.fds[fd_iterator++] = process_private->rxq_fds[i]; + msg.num_fds++; + request_param->rxq_count++; + } + + err = rte_mp_sendmsg(&msg); + if (err < 0) { + TAP_LOG(ERR, "Failed to send start req to secondary %d", + rte_errno); + return -1; + } + + return 0; +} + static int tap_dev_start(struct rte_eth_dev *dev) { int err, i; + if (rte_eal_process_type() == RTE_PROC_PRIMARY) + tap_mp_req_on_rxtx(dev); + err = tap_intr_handle_set(dev, 1); if (err) return err; @@ -926,6 +965,34 @@ tap_dev_start(struct rte_eth_dev *dev) return err; } +static int +tap_mp_req_start_rxtx(const struct rte_mp_msg *request, __rte_unused const void *peer) +{ + struct rte_eth_dev *dev; + const struct ipc_queues *request_param = + (const struct ipc_queues *)request->param; + int fd_iterator; + int queue; + struct pmd_process_private *process_private; + + dev = rte_eth_dev_get_by_name(request_param->port_name); + if (!dev) { + TAP_LOG(ERR, "Failed to get dev for %s", + request_param->port_name); + return -1; + } + process_private = dev->process_private; + fd_iterator = 0; + TAP_LOG(DEBUG, "tap_attach rx_q:%d tx_q:%d\n", request_param->rxq_count, + request_param->txq_count); + for (queue = 0; queue < request_param->txq_count; queue++) + process_private->txq_fds[queue] = request->fds[fd_iterator++]; + for (queue = 0; queue < request_param->rxq_count; queue++) + process_private->rxq_fds[queue] = request->fds[fd_iterator++]; + + return 0; +} + /* This function gets called when the current port gets stopped. */ static int @@ -1110,6 +1177,9 @@ tap_dev_close(struct rte_eth_dev *dev) if (rte_eal_process_type() != RTE_PROC_PRIMARY) { rte_free(dev->process_private); + if (tap_devices_count == 1) + rte_mp_action_unregister(TAP_MP_REQ_START_RXTX); + tap_devices_count--; return 0; } @@ -2464,6 +2534,16 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev) ret = tap_mp_attach_queues(name, eth_dev); if (ret != 0) return -1; + + if (!tap_devices_count) { + ret = rte_mp_action_register(TAP_MP_REQ_START_RXTX, tap_mp_req_start_rxtx); + if (ret < 0 && rte_errno != ENOTSUP) { + TAP_LOG(ERR, "tap: Failed to register IPC callback: %s", + strerror(rte_errno)); + return -1; + } + } + tap_devices_count++; rte_eth_dev_probing_finish(eth_dev); return 0; } -- 2.30.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-02-18 12:37:41.447603653 +0000 +++ 0093-net-tap-fix-to-populate-FDs-in-secondary-process.patch 2022-02-18 12:37:37.818794779 +0000 @@ -1 +1 @@ -From c36ce7099c2187926cd62cff7ebd479823554929 Mon Sep 17 00:00:00 2001 +From aea2c5be01694644e9111b4f2407382a8af19aaa Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit c36ce7099c2187926cd62cff7ebd479823554929 ] + @@ -13 +14,0 @@ -Cc: stable@dpdk.org @@ -22 +23 @@ -index 02eb311e09..111037de65 100644 +index 40a7bc44b1..dcc12f32e7 100644 @@ -33 +34 @@ -@@ -880,11 +881,49 @@ tap_link_set_up(struct rte_eth_dev *dev) +@@ -905,11 +906,49 @@ tap_link_set_up(struct rte_eth_dev *dev) @@ -83 +84 @@ -@@ -901,6 +940,34 @@ tap_dev_start(struct rte_eth_dev *dev) +@@ -926,6 +965,34 @@ tap_dev_start(struct rte_eth_dev *dev) @@ -118 +119 @@ -@@ -1092,6 +1159,9 @@ tap_dev_close(struct rte_eth_dev *dev) +@@ -1110,6 +1177,9 @@ tap_dev_close(struct rte_eth_dev *dev) @@ -128 +129 @@ -@@ -2453,6 +2523,16 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev) +@@ -2464,6 +2534,16 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)