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 2507DA0524 for ; Fri, 5 Feb 2021 12:38:14 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1F6164067B; Fri, 5 Feb 2021 12:38:14 +0100 (CET) Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by mails.dpdk.org (Postfix) with ESMTP id EE117188A4A for ; Fri, 5 Feb 2021 12:38:12 +0100 (CET) Received: by mail-wr1-f42.google.com with SMTP id c4so7284276wru.9 for ; Fri, 05 Feb 2021 03:38:12 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=zJmHFoW7/XF4Gumt01ia7FfnuzQz0lVJQYjF67pVbHM=; b=IVP6P5sUYJ5yIb97abTbRAFekUUHrcl8vqzFT9sjElHIBesDO4bJlbJZu9WQrfhMIe KVBGnCfolOwh90XJXO5B9oNGFUDqezRAHgLATIFzxy6CDhDwDuD4b+vsS94NMdKns4Ig BIZ+tiRlM5kVq3vqrEZSS9DH+rHfjb2TuBCOcKaMk0zxLyDUurWmCwqd6I6O0KHf+md1 gmCIB68+2Ie5ux1RNvFv6ZMPBVY5QP3ITakLeXVFTLA1HpAlVRrFgrxxnpR1fWiuRMf6 r7Rd/qanLgliEr43t36rxI72Mexa7DpNhK1xI8OLYR+I4H/UfDvlen3KdT29KYdUOuaK FClg== 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:mime-version:content-transfer-encoding; bh=zJmHFoW7/XF4Gumt01ia7FfnuzQz0lVJQYjF67pVbHM=; b=M21Dt63jBIM5f2KRs93rV5EqrkH1gy6I6+rtXNf7HOO4AYqnge8uHPSOmp+BMM6jl1 jBWqyh3Yd5tziAhztjADBVE7PB4eqYk0HipVHKWOWlN5qnDD0uwWCmF2MKuEoMuHGDqE X56VYKfigu4Z/C4lhO+u7R5xlq3yqhPZNTwFIH2mVQvIYCKW8Xwx13I+lMVeCYt3hBPX l9wg3jftPdabnTidRz28LZ3+0GVi8tZQrBnqGPZENdYZNfrGMtwC7VoM0OTK9G+GtvWD Dr+Q/TB5FEdG4U86Us6FZytcgeSAfZ6ii3z5QX/fWcTT0WlEGsOBDxYDFRQzmEDGStiy qmOA== X-Gm-Message-State: AOAM532oTdiLBI2yYdDlWHK5HTeIDXkjcoxu8UhaGBkjH4MZH7c4wn+o aUXQgR96/T6dv//+5/SfDc8= X-Google-Smtp-Source: ABdhPJyHH16U9dN51LnlaZJbZgkwHfE2qhGbKInayrujVky2zGo1asv4hmFBmnrbFMvofSMdwGh7UQ== X-Received: by 2002:adf:fb0c:: with SMTP id c12mr4646110wrr.6.1612525092707; Fri, 05 Feb 2021 03:38:12 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id x82sm3362679wmg.31.2021.02.05.03.38.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 03:38:12 -0800 (PST) From: luca.boccassi@gmail.com To: Suanming Mou Cc: Viacheslav Ovsiienko , dpdk stable Date: Fri, 5 Feb 2021 11:18:49 +0000 Message-Id: <20210205111920.1272063-243-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210205111920.1272063-1-luca.boccassi@gmail.com> References: <20210205111920.1272063-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/mlx5: fix port attach in secondary process' has been queued to stable release 20.11.1 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 Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.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/07/21. 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/432de5aec260e36d04e920dd98cdb80b0b78150a Thanks. Luca Boccassi --- >From 432de5aec260e36d04e920dd98cdb80b0b78150a Mon Sep 17 00:00:00 2001 From: Suanming Mou Date: Sun, 24 Jan 2021 19:02:05 +0800 Subject: [PATCH] net/mlx5: fix port attach in secondary process [ upstream commit 2b36c30b8cd87585502dec0d2b89e76193f13fc3 ] Currently, the secondary process port UAR register mapping used by Tx queue is done during port initializing. Unluckily, in port hot-plug case, the secondary process was requested to initialize the port when primary process did not complete the device configuration and the port Tx queue number is not configured yet. Hence, the secondary process gets the zero Tx queue number during probing, causing the UAR registers not be mapped in the correct fashion. This commit checks the configured number of Tx queues in secondary process when the port start is requested. In case the Tx queue number mismatch found the UAR mapping is reinitialized accordingly. Fixes: 2aac5b5d119f ("net/mlx5: sync stop/start with secondary process") Signed-off-by: Suanming Mou Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/linux/mlx5_mp_os.c | 19 +++++++++++++++++++ drivers/net/mlx5/mlx5.c | 2 +- drivers/net/mlx5/mlx5.h | 6 +++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_mp_os.c b/drivers/net/mlx5/linux/mlx5_mp_os.c index 08ade75799..95372e2084 100644 --- a/drivers/net/mlx5/linux/mlx5_mp_os.c +++ b/drivers/net/mlx5/linux/mlx5_mp_os.c @@ -115,6 +115,7 @@ struct rte_mp_msg mp_res; const struct mlx5_mp_param *param = (const struct mlx5_mp_param *)mp_msg->param; struct rte_eth_dev *dev; + struct mlx5_proc_priv *ppriv; struct mlx5_priv *priv; int ret; @@ -132,6 +133,20 @@ struct rte_mp_msg mp_res; rte_mb(); dev->rx_pkt_burst = mlx5_select_rx_function(dev); dev->tx_pkt_burst = mlx5_select_tx_function(dev); + ppriv = (struct mlx5_proc_priv *)dev->process_private; + /* If Tx queue number changes, re-initialize UAR. */ + if (ppriv->uar_table_sz != priv->txqs_n) { + mlx5_tx_uar_uninit_secondary(dev); + mlx5_proc_priv_uninit(dev); + ret = mlx5_proc_priv_init(dev); + if (ret) + return -rte_errno; + ret = mlx5_tx_uar_init_secondary(dev, mp_msg->fds[0]); + if (ret) { + mlx5_proc_priv_uninit(dev); + return -rte_errno; + } + } mp_init_msg(&priv->mp_id, &mp_res, param->type); res->result = 0; ret = rte_mp_reply(&mp_res, peer); @@ -183,6 +198,10 @@ mp_req_on_rxtx(struct rte_eth_dev *dev, enum mlx5_mp_req_type type) return; } mp_init_msg(&priv->mp_id, &mp_req, type); + if (type == MLX5_MP_REQ_START_RXTX) { + mp_req.num_fds = 1; + mp_req.fds[0] = ((struct ibv_context *)priv->sh->ctx)->cmd_fd; + } ret = rte_mp_request_sync(&mp_req, &mp_rep, &ts); if (ret) { if (rte_errno != ENOTSUP) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index a211fbc6b1..bdb446d2d2 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1264,7 +1264,7 @@ mlx5_proc_priv_init(struct rte_eth_dev *dev) * @param dev * Pointer to Ethernet device structure. */ -static void +void mlx5_proc_priv_uninit(struct rte_eth_dev *dev) { if (!dev->process_private) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 4902960052..9bf1bf3146 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -749,7 +749,10 @@ struct mlx5_dev_ctx_shared { struct mlx5_dev_shared_port port[]; /* per device port data array. */ }; -/* Per-process private structure. */ +/* + * Per-process private structure. + * Caution, secondary process may rebuild the struct during port start. + */ struct mlx5_proc_priv { size_t uar_table_sz; /* Size of UAR register table. */ @@ -1004,6 +1007,7 @@ struct rte_hairpin_peer_info { int mlx5_getenv_int(const char *); int mlx5_proc_priv_init(struct rte_eth_dev *dev); +void mlx5_proc_priv_uninit(struct rte_eth_dev *dev); int mlx5_udp_tunnel_port_add(struct rte_eth_dev *dev, struct rte_eth_udp_tunnel *udp_tunnel); uint16_t mlx5_eth_find_next(uint16_t port_id, struct rte_pci_device *pci_dev); -- 2.29.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-02-05 11:18:39.884783992 +0000 +++ 0243-net-mlx5-fix-port-attach-in-secondary-process.patch 2021-02-05 11:18:29.250699565 +0000 @@ -1 +1 @@ -From 2b36c30b8cd87585502dec0d2b89e76193f13fc3 Mon Sep 17 00:00:00 2001 +From 432de5aec260e36d04e920dd98cdb80b0b78150a Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 2b36c30b8cd87585502dec0d2b89e76193f13fc3 ] + @@ -21 +22,0 @@ -Cc: stable@dpdk.org @@ -32 +33 @@ -index 60fdee22a1..8011ca87d7 100644 +index 08ade75799..95372e2084 100644 @@ -76 +77 @@ -index 93629e5b05..aae2ef9af7 100644 +index a211fbc6b1..bdb446d2d2 100644 @@ -79 +80 @@ -@@ -1268,7 +1268,7 @@ mlx5_proc_priv_init(struct rte_eth_dev *dev) +@@ -1264,7 +1264,7 @@ mlx5_proc_priv_init(struct rte_eth_dev *dev) @@ -89 +90 @@ -index 4bbf628885..5196a9ea76 100644 +index 4902960052..9bf1bf3146 100644 @@ -92 +93 @@ -@@ -743,7 +743,10 @@ struct mlx5_dev_ctx_shared { +@@ -749,7 +749,10 @@ struct mlx5_dev_ctx_shared { @@ -104 +105 @@ -@@ -998,6 +1001,7 @@ struct rte_hairpin_peer_info { +@@ -1004,6 +1007,7 @@ struct rte_hairpin_peer_info {