From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by dpdk.org (Postfix) with ESMTP id 532EE2BF2 for ; Tue, 22 May 2018 17:37:17 +0200 (CEST) Received: by mail-wm0-f68.google.com with SMTP id j4-v6so988128wme.1 for ; Tue, 22 May 2018 08:37:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=jQCCVxoq8EpkXe9anVZyPex5vO+rB8B6Ts4GXA/t67c=; b=vD3KiP9JdmHp4+lAtY5JnlbGexRzHVDlZuLiVRjArtPxnmRcScKgH3yDYh1mpp40/Y AlVWb5tbACu8cKytFDQ8qH30yDF0ksHIKFvJ7ewUFapobyeXOO1WdZnQjFWtp6LbrQiu 98q/F995jGmpr/GGD+2jq8xfCSizQS+k5eYiySiat7pdYP5cDe1malVZUUgRe3TXtU6G nqrZqpW03OqFaXnFa/1z5TkNcTaYtHgM8HAfRIwUC1V+GSz/x3+vyTKfRLx1xbMTu9XH nqiQc0GJ61ZmWpmCfdHgLElFn/R/B7wb4WjayIDBlzoNzNkb603rnN3pNorr9sArTpcG XA/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=jQCCVxoq8EpkXe9anVZyPex5vO+rB8B6Ts4GXA/t67c=; b=RiQ6KHRK/YJO9IWb68GJRxSOT5dUQMKmj7GzajTc2Td+UykOUnwLQxe8wa1Hyy3vOq zKM8IGq6FoY/4/yGQSb7o4Oy/IJZpTqNpbKN2UG3sjStl5/p/khlnipATcme2hkVJOJp sIkUDDJU+vX2xXyW2zVqywxGuRr4+LzvJFe9cdKG+ta+fiLVtUgXZ5S7mhEwWqKxfpn6 NsPT+GGkPIxbyhjYE5YSKdRXlJOIyDBspjAvczIO3aNtKZcHAzUs/WOhT06sxiVP0t2F bNcxJelJOPDTDV7hvf0JeV8fWaq5IWGMSuFSMUVZ/6/OTIj51yFutGrSn6Y9Nd/Odw0b 3V+Q== X-Gm-Message-State: ALKqPweEcnNrSdIwKCzQ1e3v2SWX4Deriz6JlarGonagMhpev7bKMFZY uKVPQRXE5Av593llyXsRLyLZcQ== X-Google-Smtp-Source: AB8JxZqE8E+Jrji01qRV0MQlPzyi4VzQGsnabiEdCGfuZi3y9P9kIGSYBXbXgayAhynW3Sz6tcSeyQ== X-Received: by 2002:a1c:ae0c:: with SMTP id x12-v6mr1778954wme.133.1527003436986; Tue, 22 May 2018 08:37:16 -0700 (PDT) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id n71-v6sm235737wmi.14.2018.05.22.08.37.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 08:37:16 -0700 (PDT) Date: Tue, 22 May 2018 17:37:01 +0200 From: Adrien Mazarguil To: Shahaf Shuler Cc: Ferruh Yigit , dev@dpdk.org, Nelio Laranjeiro , Yongseok Koh Message-ID: <20180522153441.31354-2-adrien.mazarguil@6wind.com> References: <20180522153441.31354-1-adrien.mazarguil@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180522153441.31354-1-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.11.0 Subject: [dpdk-dev] [PATCH 2/2] net/mlx5: remove limitation on number of instances X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2018 15:37:18 -0000 This artificial limitation was inherited from the mlx4 code base and has no purpose other than adding unnecessary noise. This patch is a port of commit f2318196c71a ("net/mlx4: remove limitation on number of instances"). Signed-off-by: Adrien Mazarguil Cc: Nelio Laranjeiro Cc: Yongseok Koh --- drivers/net/mlx5/mlx5.c | 54 +------------------------------------------- 1 file changed, 1 insertion(+), 53 deletions(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 006665600..8d1c2347e 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -396,39 +396,6 @@ const struct eth_dev_ops mlx5_dev_ops_isolate = { .is_removed = mlx5_is_removed, }; -static struct { - struct rte_pci_addr pci_addr; /* associated PCI address */ - uint32_t ports; /* physical ports bitfield. */ -} mlx5_dev[32]; - -/** - * Get device index in mlx5_dev[] from PCI bus address. - * - * @param[in] pci_addr - * PCI bus address to look for. - * - * @return - * mlx5_dev[] index on success, -1 on failure. - */ -static int -mlx5_dev_idx(struct rte_pci_addr *pci_addr) -{ - unsigned int i; - int ret = -1; - - assert(pci_addr != NULL); - for (i = 0; (i != RTE_DIM(mlx5_dev)); ++i) { - if ((mlx5_dev[i].pci_addr.domain == pci_addr->domain) && - (mlx5_dev[i].pci_addr.bus == pci_addr->bus) && - (mlx5_dev[i].pci_addr.devid == pci_addr->devid) && - (mlx5_dev[i].pci_addr.function == pci_addr->function)) - return i; - if ((mlx5_dev[i].ports == 0) && (ret == -1)) - ret = i; - } - return ret; -} - /** * Verify and store value for device argument. * @@ -698,7 +665,6 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, unsigned int mprq_max_stride_size_n = 0; unsigned int mprq_min_stride_num_n = 0; unsigned int mprq_max_stride_num_n = 0; - int idx; int i; struct mlx5dv_context attrs_out = {0}; #ifdef HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT @@ -708,16 +674,6 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, /* Prepare shared data between primary and secondary process. */ mlx5_prepare_shared_data(); assert(pci_drv == &mlx5_driver); - /* Get mlx5_dev[] index. */ - idx = mlx5_dev_idx(&pci_dev->addr); - if (idx == -1) { - DRV_LOG(ERR, "this driver cannot support any more adapters"); - err = ENOMEM; - goto error; - } - DRV_LOG(DEBUG, "using driver device index %d", idx); - /* Save PCI address. */ - mlx5_dev[idx].pci_addr = pci_dev->addr; list = mlx5_glue->get_device_list(&i); if (list == NULL) { assert(errno); @@ -873,7 +829,6 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, char name[RTE_ETH_NAME_MAX_LEN]; int len; uint32_t port = i + 1; /* ports are indexed from one */ - uint32_t test = (1 << i); struct ibv_context *ctx = NULL; struct ibv_port_attr port_attr; struct ibv_pd *pd = NULL; @@ -908,7 +863,6 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, pci_dev->addr.devid, pci_dev->addr.function); if (device_attr.orig_attr.phys_port_cnt > 1) snprintf(name + len, sizeof(name), " port %u", i); - mlx5_dev[idx].ports |= test; if (rte_eal_process_type() == RTE_PROC_SECONDARY) { eth_dev = rte_eth_dev_attach_secondary(name); if (eth_dev == NULL) { @@ -948,7 +902,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, rte_eth_dev_probing_finish(eth_dev); continue; } - DRV_LOG(DEBUG, "using port %u (%08" PRIx32 ")", port, test); + DRV_LOG(DEBUG, "using port %u", port); ctx = mlx5_glue->open_device(ibv_dev); if (ctx == NULL) { err = ENODEV; @@ -979,7 +933,6 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, err = ENOMEM; goto port_error; } - mlx5_dev[idx].ports |= test; /* from rte_ethdev.c */ priv = rte_zmalloc("ethdev private structure", sizeof(*priv), @@ -1210,11 +1163,6 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, * long as the dpdk does not provide a way to deallocate a ethdev and a * way to enumerate the registered ethdevs to free the previous ones. */ - /* no port found, complain */ - if (!mlx5_dev[idx].ports) { - rte_errno = ENODEV; - err = rte_errno; - } error: if (attr_ctx) claim_zero(mlx5_glue->close_device(attr_ctx)); -- 2.11.0