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 3177CA0350 for ; Mon, 21 Feb 2022 16:41:17 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2BECD4068C; Mon, 21 Feb 2022 16:41:17 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id EA7B2410F2 for ; Mon, 21 Feb 2022 16:41:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645458074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T/jZqw3WBZRae0VwHyq9rh+RGywAIVQ+osLH5kbMBPA=; b=OawXm0FxKpLNoMRFHiHYQbatxkcUX2lJh9vVDEgMVybbfaZyHBBOj8u1HUVdPZDFUh+YHm u0MZoS3/oJ/XkzDdvITzLXy6Fy4PemVOScbIiyaUUvkstWAiujbK7Ji5+O5qC9LnITk2q9 amrL2WJWDxRB3iZVHmsr9Si2RnJ4R4k= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-627-Axkphro9PaCVNphK5lXMcg-1; Mon, 21 Feb 2022 10:41:10 -0500 X-MC-Unique: Axkphro9PaCVNphK5lXMcg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 39F871091DA0; Mon, 21 Feb 2022 15:41:09 +0000 (UTC) Received: from rh.Home (unknown [10.39.195.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B15C7E2E8; Mon, 21 Feb 2022 15:41:07 +0000 (UTC) From: Kevin Traynor 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 21.11.1 Date: Mon, 21 Feb 2022 15:35:29 +0000 Message-Id: <20220221153625.152324-140-ktraynor@redhat.com> In-Reply-To: <20220221153625.152324-1-ktraynor@redhat.com> References: <20220221153625.152324-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" 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 21.11.1 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/26/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/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/ac180f4d2662503ecd18a2e94689a229104d3d61 Thanks. Kevin --- >From ac180f4d2662503ecd18a2e94689a229104d3d61 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 5bb472f1a6..b0c09956de 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -68,4 +68,5 @@ /* 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 @@ -881,4 +882,39 @@ tap_link_set_up(struct rte_eth_dev *dev) } +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) @@ -886,4 +922,7 @@ 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) @@ -902,4 +941,32 @@ tap_dev_start(struct rte_eth_dev *dev) } +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. */ @@ -1085,4 +1152,7 @@ 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; } @@ -2446,4 +2516,14 @@ rte_pmd_tap_probe(struct rte_vdev_device *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.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-02-21 15:22:47.635759931 +0000 +++ 0140-net-tap-fix-to-populate-FDs-in-secondary-process.patch 2022-02-21 15:22:44.295704585 +0000 @@ -1 +1 @@ -From c36ce7099c2187926cd62cff7ebd479823554929 Mon Sep 17 00:00:00 2001 +From ac180f4d2662503ecd18a2e94689a229104d3d61 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 5bb472f1a6..b0c09956de 100644 @@ -112 +113 @@ -@@ -1093,4 +1160,7 @@ tap_dev_close(struct rte_eth_dev *dev) +@@ -1085,4 +1152,7 @@ tap_dev_close(struct rte_eth_dev *dev) @@ -120 +121 @@ -@@ -2454,4 +2524,14 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev) +@@ -2446,4 +2516,14 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)