From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id CD8BD3772 for ; Fri, 23 Dec 2016 16:58:37 +0100 (CET) Received: by mail-wm0-f65.google.com with SMTP id u144so42247214wmu.0 for ; Fri, 23 Dec 2016 07:58:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=Lnz4Y74C6JFpSFNZKFNXN3C2oPZghN60Reny18enmZ0=; b=HhWauA48qDPoj0fKIzQOz3o6KwMzHE/jouZqBNS8cHSHw1L8PgdCBf9cAzmbHDBpxE pMHj+PZQf3KZswkXIE/tiFUv0k4jr2NJzu6DEBWXqYPNEniFQ0kLht1BgNXlEi4dKXwV 29WjHE4nMFvpIK5rnf1GQdW62tSfpAZP7tb5U3yDdc269JlrlWDrkwPLrVtqwa+bErRt BlDwFRpfWJOwZg6uQ2uvJqYcXBUS8k9uWP+2ltuRHCc7ZmwgBwsCDKr0UGbJdZyINKYk 45Ehom4lRw5hhSUlceQz22u0B3WPYClML6/AGEBntNjToaa6xYfRUttZu6oFlb9enDoL FJPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references; bh=Lnz4Y74C6JFpSFNZKFNXN3C2oPZghN60Reny18enmZ0=; b=kDXWUPQUZsO+sfRF1u8CoBgDFT6BZlw9T6ti2x4ThTYSiwvOZJN+MZyrhBzETEt9Nl wy57YT8FJVk7u4tzEKdynWbDQooUW4Ax4KcyCeqGLmlPkw2+pStvqJl4LEa+cuWvw/Dx +ep7F0XK/9FmqpmLe6DL9Gq4mjOWEUtqXMmigFSZY8KDsXFxhYMSYpwB9i9t73uEOZ9M WoIQXXqjuxG71wYKe93MAOojWv9BhXG9j98BCWpgjBXpSDMZyfas2EwZxcw6FJbntA+R nVUW56oBluHGfVTz42fkrbFYIYq5XeQTo8qNyq/t1P0YNe16ZoQpBPW3TF3zE7OdnS+t XbtQ== X-Gm-Message-State: AIkVDXIYdYRmYizkRJP6WuCvHmhtzeqzSwB+/3Hjv7r8wZJPPF0cy8XiBiEO4Zajxvz41w== X-Received: by 10.28.217.195 with SMTP id q186mr16810831wmg.17.1482508717473; Fri, 23 Dec 2016 07:58:37 -0800 (PST) Received: from weierstrass.local.net ([91.200.109.169]) by smtp.gmail.com with ESMTPSA id jm6sm41027072wjb.27.2016.12.23.07.58.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Dec 2016 07:58:36 -0800 (PST) Sender: Jan Blunck From: Jan Blunck To: dev@dpdk.org Cc: Stephen Hemminger , shreyansh.jain@nxp.com, david.marchand@6wind.com, Stephen Hemminger Date: Fri, 23 Dec 2016 16:57:59 +0100 Message-Id: <1482508691-11408-9-git-send-email-jblunck@infradead.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1482508691-11408-1-git-send-email-jblunck@infradead.org> References: <1482508691-11408-1-git-send-email-jblunck@infradead.org> In-Reply-To: <1482332986-7599-1-git-send-email-jblunck@infradead.org> References: <1482332986-7599-1-git-send-email-jblunck@infradead.org> Subject: [dpdk-dev] [PATCH v5 08/20] broadcom: localize mapping from eth_dev to pci 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: Fri, 23 Dec 2016 15:58:38 -0000 From: Stephen Hemminger Use existing information about pci and interrupt handle to minimize the number of places that assume eth_dev contains pci_device information. Signed-off-by: Stephen Hemminger Acked-by: Jan Blunck --- drivers/net/bnxt/bnxt_ethdev.c | 22 +++++++++++++--------- drivers/net/bnxt/bnxt_ring.c | 16 ++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index a24e153..97f5a79 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -743,6 +743,8 @@ static int bnxt_reta_query_op(struct rte_eth_dev *eth_dev, { struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private; struct bnxt_vnic_info *vnic = &bp->vnic_info[0]; + struct rte_intr_handle *intr_handle + = &bp->pdev->intr_handle; /* Retrieve from the default VNIC */ if (!vnic) @@ -759,7 +761,7 @@ static int bnxt_reta_query_op(struct rte_eth_dev *eth_dev, /* EW - need to revisit here copying from u64 to u16 */ memcpy(reta_conf, vnic->rss_table, reta_size); - if (rte_intr_allow_others(ð_dev->pci_dev->intr_handle)) { + if (rte_intr_allow_others(intr_handle)) { if (eth_dev->data->dev_conf.intr_conf.lsc != 0) bnxt_dev_lsc_intr_setup(eth_dev); } @@ -1009,11 +1011,12 @@ static bool bnxt_vf_pciid(uint16_t id) static int bnxt_init_board(struct rte_eth_dev *eth_dev) { - int rc; struct bnxt *bp = eth_dev->data->dev_private; + struct rte_pci_device *pci_dev = eth_dev->pci_dev; + int rc; /* enable device (incl. PCI PM wakeup), and bus-mastering */ - if (!eth_dev->pci_dev->mem_resource[0].addr) { + if (!pci_dev->mem_resource[0].addr) { RTE_LOG(ERR, PMD, "Cannot find PCI device base address, aborting\n"); rc = -ENODEV; @@ -1021,9 +1024,9 @@ static int bnxt_init_board(struct rte_eth_dev *eth_dev) } bp->eth_dev = eth_dev; - bp->pdev = eth_dev->pci_dev; + bp->pdev = pci_dev; - bp->bar0 = (void *)eth_dev->pci_dev->mem_resource[0].addr; + bp->bar0 = (void *)pci_dev->mem_resource[0].addr; if (!bp->bar0) { RTE_LOG(ERR, PMD, "Cannot map device registers, aborting\n"); rc = -ENOMEM; @@ -1043,6 +1046,7 @@ static int bnxt_init_board(struct rte_eth_dev *eth_dev) static int bnxt_dev_init(struct rte_eth_dev *eth_dev) { + struct rte_pci_device *pci_dev = eth_dev->pci_dev; static int version_printed; struct bnxt *bp; int rc; @@ -1050,10 +1054,10 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev) if (version_printed++ == 0) RTE_LOG(INFO, PMD, "%s", bnxt_version); - rte_eth_copy_pci_info(eth_dev, eth_dev->pci_dev); + rte_eth_copy_pci_info(eth_dev, pci_dev); bp = eth_dev->data->dev_private; - if (bnxt_vf_pciid(eth_dev->pci_dev->id.device_id)) + if (bnxt_vf_pciid(pci_dev->id.device_id)) bp->flags |= BNXT_FLAG_VF; rc = bnxt_init_board(eth_dev); @@ -1121,8 +1125,8 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev) RTE_LOG(INFO, PMD, DRV_MODULE_NAME " found at mem %" PRIx64 ", node addr %pM\n", - eth_dev->pci_dev->mem_resource[0].phys_addr, - eth_dev->pci_dev->mem_resource[0].addr); + pci_dev->mem_resource[0].phys_addr, + pci_dev->mem_resource[0].addr); bp->dev_stopped = 0; diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c index 3f81ffc..0fafa13 100644 --- a/drivers/net/bnxt/bnxt_ring.c +++ b/drivers/net/bnxt/bnxt_ring.c @@ -209,6 +209,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx, */ int bnxt_alloc_hwrm_rings(struct bnxt *bp) { + struct rte_pci_device *pci_dev = bp->pdev; unsigned int i; int rc = 0; @@ -222,8 +223,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp) 0, HWRM_NA_SIGNATURE); if (rc) goto err_out; - cpr->cp_doorbell = - (char *)bp->eth_dev->pci_dev->mem_resource[2].addr; + cpr->cp_doorbell = pci_dev->mem_resource[2].addr; B_CP_DIS_DB(cpr, cpr->cp_raw_cons); bp->grp_info[0].cp_fw_ring_id = cp_ring->fw_ring_id; } @@ -242,8 +242,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp) idx, HWRM_NA_SIGNATURE); if (rc) goto err_out; - cpr->cp_doorbell = - (char *)bp->eth_dev->pci_dev->mem_resource[2].addr + + cpr->cp_doorbell = (char *)pci_dev->mem_resource[2].addr + idx * 0x80; bp->grp_info[idx].cp_fw_ring_id = cp_ring->fw_ring_id; B_CP_DIS_DB(cpr, cpr->cp_raw_cons); @@ -255,8 +254,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp) if (rc) goto err_out; rxr->rx_prod = 0; - rxr->rx_doorbell = - (char *)bp->eth_dev->pci_dev->mem_resource[2].addr + + rxr->rx_doorbell = (char *)pci_dev->mem_resource[2].addr + idx * 0x80; bp->grp_info[idx].rx_fw_ring_id = ring->fw_ring_id; B_RX_DB(rxr->rx_doorbell, rxr->rx_prod); @@ -283,8 +281,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp) if (rc) goto err_out; - cpr->cp_doorbell = - (char *)bp->eth_dev->pci_dev->mem_resource[2].addr + + cpr->cp_doorbell = (char *)pci_dev->mem_resource[2].addr + idx * 0x80; bp->grp_info[idx].cp_fw_ring_id = cp_ring->fw_ring_id; B_CP_DIS_DB(cpr, cpr->cp_raw_cons); @@ -296,8 +293,7 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp) if (rc) goto err_out; - txr->tx_doorbell = - (char *)bp->eth_dev->pci_dev->mem_resource[2].addr + + txr->tx_doorbell = (char *)pci_dev->mem_resource[2].addr + idx * 0x80; } -- 2.7.4