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 D17F5A0C47; Wed, 3 Nov 2021 19:36:17 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 57A4841148; Wed, 3 Nov 2021 19:35:51 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2044.outbound.protection.outlook.com [40.107.220.44]) by mails.dpdk.org (Postfix) with ESMTP id D166D41101; Wed, 3 Nov 2021 19:35:49 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eov+XAy9j14ZOO07NiQpKJWtjoXdD5iEZVog3HJnzMhW+ek1R38HmUJJ1Axy7zHkB8vCfe+1pYREhshhDCqMyRwCPIhvWBa/WoM2qcHOVHGfEYrGeIpIHbV1rgAji5amsKPJLdo7hKPjZYtKey8Vn2xlK3Gyep6Nr84k7mbm7YwvGIP7s5z8QZKjycTKco5RPaHfr1vgYFQmxA47Oge6GFLuztNZnSchUOLjBEFESsf+stBWN4laI0skmqSOWflKQtIrrnI8IwW4/agV0GeMZ9enCkhkRsbXWcHZA+ufeSlmjaHOopJclDoV/FDk33mzX2WG6NGZcr4z91jgNleLVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7CoGogzw+hR2+hIinNd508rMjInDxdkTaIxLNeLrJAM=; b=hX5ZchJxUgcRmf7V+GvzQHa27UqsScZK61IZQ9JYedDoxTI0KQBMrLzgQxJREc4ifMSVZq1c6uPAhsWo5ybrPtkkuzaSv93Qu9sjvE47AwaWJx0DZflE3norNIwvDUlSFKm9keRacBdxFsApCHkGrHW6+DGR54dZqt4LfTtaW3t6ZpSbXVbhx97D+2xxPjP5JQELwdL4yO95JojbGkEFyRH4WonF+/AJsCWhsp7E318vmJcNQGw7sgEttBCih8WuEGFuupcVs0yGzcV8yTc+8BErSVY7MeFG4BPTvNUalXAnkDilGA9ExeYHmw1nUYPObzsOf0gFV+KeyWJOi/77YQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7CoGogzw+hR2+hIinNd508rMjInDxdkTaIxLNeLrJAM=; b=Q0M/J4sNWOHfBGNfuzR3XbEcftBvffXfJrKyqYoV1ra/M8IJzPHN9xX9hfrKJDKTeaNC0xdj9A13bdcMKUCArrV6CAJUOaa3acDEcXRXwRxCL1I0Ygt9vplAJfCG7xfhM/LGgV5jJ7P+tS8DIsqUQr3yAgq+zXEbjyvwM2IGHMCnCxNbX+UjduBbmOZrCNTAFezVmnem89YSiaqYvlK3R4Iv2WALOBXsWJD18tW+LsOVwqRvTS/jX2fWRXOlt9CKmQpcqnOVUsyMlqK0DRoS31xCinkmZXwPOJMr2o54gVFfimDdzWX3QylZcCl912ydLUOxllxsGtHGeHJ9CicsRA== Received: from DM5PR18CA0054.namprd18.prod.outlook.com (2603:10b6:3:22::16) by BL0PR12MB2355.namprd12.prod.outlook.com (2603:10b6:207:3f::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.15; Wed, 3 Nov 2021 18:35:47 +0000 Received: from DM6NAM11FT039.eop-nam11.prod.protection.outlook.com (2603:10b6:3:22:cafe::bf) by DM5PR18CA0054.outlook.office365.com (2603:10b6:3:22::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.10 via Frontend Transport; Wed, 3 Nov 2021 18:35:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT039.mail.protection.outlook.com (10.13.172.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4669.10 via Frontend Transport; Wed, 3 Nov 2021 18:35:47 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 3 Nov 2021 18:35:43 +0000 From: To: CC: Matan Azrad , Thomas Monjalon , Michael Baum , , "Viacheslav Ovsiienko" Date: Wed, 3 Nov 2021 20:35:12 +0200 Message-ID: <20211103183513.104503-6-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211103183513.104503-1-michaelba@nvidia.com> References: <20211103183513.104503-1-michaelba@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9fc32041-fed6-40c5-80c0-08d99ef8c10c X-MS-TrafficTypeDiagnostic: BL0PR12MB2355: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ePbhe28Z/zaFV0oJ740XkOMrPBOUHwyhjPsz5w+nLOjgqdeqIP4gbccJjQwgJhOSnNmmd2DYllolVqAJxY/Hi+XgTfp/VoV7u9Yp2pbMQCr3SSE5Klz3wuruUtEXGkAQEVlXxOyuRsQwTM5gGFUyuOtG+xyuYWS8r9NxylJ/FRor+C62NpW2ovYySmuOvaZFSx/CZ9HsiHvrq+Cgm2CkTRQ1ah/Gy8PrxdShPCMMizZbFscNVMid76CzWEJytEzC5SzBQfmuxjffvRlNo3PC+emO8kSG9UpD6SExUY7nLyOPMyu/iTQuJhmbYUmmdbgB+GfE7TZxRteUaJV0IVCXXScJfN4l7iPmmiIOJQDtaMiGSTLHWcjPy1qtvfQiaYadvFeRo3szRvEDJOQvlfL+ls8CPGk6XIBW/ELsM0s/AV+OGUrxXEUzz6UG7qoc/poXV16d9wDvox2I4ccNytOv+XV4p9IGblPEy+f2LFJyIHQGdYYBLO+QI5snyiHVOWN3WenUOrm/GV5MUmRdJgQ5ZymgSZgo9g7H3ROIISJVl09uJZ4KEZLOHqmU2mgko6rgDJBFmfk7Y/N8EAs3dLemx8l2ZgLZlVCMgWdiwB+s8rxwY1KCdQExtCJFcXtIsv+LsoNUu95MPktitNXpl7pcP53r/3f7cWRID2N88+Ceh/YL/REChM5GVEZOYpMpibF/xjigH+8bc2iWwGBRNABEvw== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(7696005)(86362001)(26005)(36756003)(107886003)(508600001)(7636003)(83380400001)(36906005)(6286002)(356005)(5660300002)(4326008)(316002)(8936002)(426003)(36860700001)(54906003)(2616005)(336012)(47076005)(1076003)(82310400003)(16526019)(70206006)(70586007)(2906002)(8676002)(186003)(6916009)(55016002)(6666004)(2876002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2021 18:35:47.6036 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9fc32041-fed6-40c5-80c0-08d99ef8c10c X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT039.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB2355 Subject: [dpdk-dev] [PATCH 5/6] net/mlx5: remove duplicated reference of the TxQ doorbell X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Michael Baum The Tx doorbell has different virtual addresses per process. The secondary process takes the UAR physical page ID of the primary and mmap it to its own virtual address. The primary doorbell references were saved in two shared memory locations: the TxQ structure and a dedicated doorbell array. Remove the doorbell reference from the TxQ structure and move the primary processes to take the UAR information from the primary doorbell array. Cc: stable@dpdk.org Signed-off-by: Michael Baum Reviewed-by: Viacheslav Ovsiienko Acked-by: Matan Azrad --- drivers/net/mlx5/linux/mlx5_verbs.c | 6 ++---- drivers/net/mlx5/mlx5.c | 2 ++ drivers/net/mlx5/mlx5.h | 2 +- drivers/net/mlx5/mlx5_devx.c | 8 ++------ drivers/net/mlx5/mlx5_tx.h | 3 +-- drivers/net/mlx5/mlx5_txq.c | 15 ++++++++------- 6 files changed, 16 insertions(+), 20 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_verbs.c b/drivers/net/mlx5/linux/mlx5_verbs.c index 4779b37aa6..eef8391c12 100644 --- a/drivers/net/mlx5/linux/mlx5_verbs.c +++ b/drivers/net/mlx5/linux/mlx5_verbs.c @@ -990,20 +990,18 @@ mlx5_txq_ibv_obj_new(struct rte_eth_dev *dev, uint16_t idx) } } #endif - txq_ctrl->bf_reg = qp.bf.reg; if (qp.comp_mask & MLX5DV_QP_MASK_UAR_MMAP_OFFSET) { txq_ctrl->uar_mmap_offset = qp.uar_mmap_offset; DRV_LOG(DEBUG, "Port %u: uar_mmap_offset 0x%" PRIx64 ".", dev->data->port_id, txq_ctrl->uar_mmap_offset); } else { DRV_LOG(ERR, - "Port %u failed to retrieve UAR info, invalid" - " libmlx5.so", + "Port %u failed to retrieve UAR info, invalid libmlx5.so", dev->data->port_id); rte_errno = EINVAL; goto error; } - txq_uar_init(txq_ctrl); + txq_uar_init(txq_ctrl, qp.bf.reg); dev->data->tx_queue_state[idx] = RTE_ETH_QUEUE_STATE_STARTED; return 0; error: diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 4fe7e34578..39158a5dde 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1616,6 +1616,8 @@ mlx5_proc_priv_init(struct rte_eth_dev *dev) } ppriv->uar_table_sz = priv->txqs_n; dev->process_private = ppriv; + if (rte_eal_process_type() == RTE_PROC_PRIMARY) + priv->sh->pppriv = ppriv; return 0; } diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 5768b82935..3b04f9d4e3 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -1167,6 +1167,7 @@ struct mlx5_dev_ctx_shared { struct mlx5_devx_obj *td; /* Transport domain. */ struct mlx5_lag lag; /* LAG attributes */ void *tx_uar; /* Tx/packet pacing shared UAR. */ + struct mlx5_proc_priv *pppriv; /* Pointer to primary private process. */ struct mlx5_flex_parser_profiles fp[MLX5_FLEX_PARSER_MAX]; /* Flex parser profiles information. */ void *devx_rx_uar; /* DevX UAR for Rx. */ @@ -1479,7 +1480,6 @@ void mlx5_set_metadata_mask(struct rte_eth_dev *dev); int mlx5_dev_check_sibling_config(struct mlx5_priv *priv, struct mlx5_dev_config *config, struct rte_device *dpdk_dev); -int mlx5_dev_configure(struct rte_eth_dev *dev); int mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info); int mlx5_fw_version_get(struct rte_eth_dev *dev, char *fw_ver, size_t fw_size); int mlx5_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu); diff --git a/drivers/net/mlx5/mlx5_devx.c b/drivers/net/mlx5/mlx5_devx.c index 7ed774e804..dc391529c2 100644 --- a/drivers/net/mlx5/mlx5_devx.c +++ b/drivers/net/mlx5/mlx5_devx.c @@ -1074,7 +1074,6 @@ mlx5_txq_devx_obj_new(struct rte_eth_dev *dev, uint16_t idx) struct mlx5_devx_cq_attr cq_attr = { .uar_page_id = mlx5_os_get_devx_uar_page_id(sh->tx_uar), }; - void *reg_addr; uint32_t cqe_n, log_desc_n; uint32_t wqe_n, wqe_size; int ret = 0; @@ -1171,13 +1170,10 @@ mlx5_txq_devx_obj_new(struct rte_eth_dev *dev, uint16_t idx) if (!priv->sh->tdn) priv->sh->tdn = priv->sh->td->id; #endif - MLX5_ASSERT(sh->tx_uar); - reg_addr = mlx5_os_get_devx_uar_reg_addr(sh->tx_uar); - MLX5_ASSERT(reg_addr); - txq_ctrl->bf_reg = reg_addr; + MLX5_ASSERT(sh->tx_uar && mlx5_os_get_devx_uar_reg_addr(sh->tx_uar)); txq_ctrl->uar_mmap_offset = mlx5_os_get_devx_uar_mmap_offset(sh->tx_uar); - txq_uar_init(txq_ctrl); + txq_uar_init(txq_ctrl, mlx5_os_get_devx_uar_reg_addr(sh->tx_uar)); dev->data->tx_queue_state[idx] = RTE_ETH_QUEUE_STATE_STARTED; return 0; error: diff --git a/drivers/net/mlx5/mlx5_tx.h b/drivers/net/mlx5/mlx5_tx.h index ea20213a40..24a312b58b 100644 --- a/drivers/net/mlx5/mlx5_tx.h +++ b/drivers/net/mlx5/mlx5_tx.h @@ -184,7 +184,6 @@ struct mlx5_txq_ctrl { struct mlx5_txq_obj *obj; /* Verbs/DevX queue object. */ struct mlx5_priv *priv; /* Back pointer to private data. */ off_t uar_mmap_offset; /* UAR mmap offset for non-primary process. */ - void *bf_reg; /* BlueFlame register from Verbs. */ uint16_t dump_file_n; /* Number of dump files. */ struct rte_eth_hairpin_conf hairpin_conf; /* Hairpin configuration. */ uint32_t hairpin_status; /* Hairpin binding status. */ @@ -204,7 +203,7 @@ int mlx5_tx_hairpin_queue_setup (struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, const struct rte_eth_hairpin_conf *hairpin_conf); void mlx5_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid); -void txq_uar_init(struct mlx5_txq_ctrl *txq_ctrl); +void txq_uar_init(struct mlx5_txq_ctrl *txq_ctrl, void *bf_reg); int mlx5_tx_uar_init_secondary(struct rte_eth_dev *dev, int fd); void mlx5_tx_uar_uninit_secondary(struct rte_eth_dev *dev); int mlx5_txq_obj_verify(struct rte_eth_dev *dev); diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c index e2a38d980a..5fa43d63f1 100644 --- a/drivers/net/mlx5/mlx5_txq.c +++ b/drivers/net/mlx5/mlx5_txq.c @@ -523,9 +523,11 @@ txq_uar_ncattr_init(struct mlx5_txq_ctrl *txq_ctrl, size_t page_size) * * @param txq_ctrl * Pointer to Tx queue control structure. + * @param bf_reg + * BlueFlame register from Verbs UAR. */ void -txq_uar_init(struct mlx5_txq_ctrl *txq_ctrl) +txq_uar_init(struct mlx5_txq_ctrl *txq_ctrl, void *bf_reg) { struct mlx5_priv *priv = txq_ctrl->priv; struct mlx5_proc_priv *ppriv = MLX5_PROC_PRIV(PORT_ID(priv)); @@ -542,7 +544,7 @@ txq_uar_init(struct mlx5_txq_ctrl *txq_ctrl) return; MLX5_ASSERT(rte_eal_process_type() == RTE_PROC_PRIMARY); MLX5_ASSERT(ppriv); - ppriv->uar_table[txq_ctrl->txq.idx] = txq_ctrl->bf_reg; + ppriv->uar_table[txq_ctrl->txq.idx] = bf_reg; txq_uar_ncattr_init(txq_ctrl, page_size); #ifndef RTE_ARCH_64 /* Assign an UAR lock according to UAR page number */ @@ -571,6 +573,7 @@ txq_uar_init_secondary(struct mlx5_txq_ctrl *txq_ctrl, int fd) { struct mlx5_priv *priv = txq_ctrl->priv; struct mlx5_proc_priv *ppriv = MLX5_PROC_PRIV(PORT_ID(priv)); + struct mlx5_proc_priv *primary_ppriv = priv->sh->pppriv; struct mlx5_txq_data *txq = &txq_ctrl->txq; void *addr; uintptr_t uar_va; @@ -589,20 +592,18 @@ txq_uar_init_secondary(struct mlx5_txq_ctrl *txq_ctrl, int fd) * As rdma-core, UARs are mapped in size of OS page * size. Ref to libmlx5 function: mlx5_init_context() */ - uar_va = (uintptr_t)txq_ctrl->bf_reg; + uar_va = (uintptr_t)primary_ppriv->uar_table[txq->idx]; offset = uar_va & (page_size - 1); /* Offset in page. */ addr = rte_mem_map(NULL, page_size, RTE_PROT_WRITE, RTE_MAP_SHARED, - fd, txq_ctrl->uar_mmap_offset); + fd, txq_ctrl->uar_mmap_offset); if (!addr) { - DRV_LOG(ERR, - "port %u mmap failed for BF reg of txq %u", + DRV_LOG(ERR, "Port %u mmap failed for BF reg of txq %u.", txq->port_id, txq->idx); rte_errno = ENXIO; return -rte_errno; } addr = RTE_PTR_ADD(addr, offset); ppriv->uar_table[txq->idx] = addr; - txq_uar_ncattr_init(txq_ctrl, page_size); return 0; } -- 2.25.1