From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id 66CC110CAF for ; Wed, 21 Dec 2016 16:10:11 +0100 (CET) Received: by mail-wm0-f66.google.com with SMTP id g23so31083381wme.1 for ; Wed, 21 Dec 2016 07:10:11 -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; bh=+LR4I1zve0KqPGOMEMr5hVDRRu/jYtoGYsp1Px/pE5k=; b=L4q7F+mInahjC4dqc5g9mlXlQi/qbOIOYm/eeT1AXsylldq+BPb4zW6jXzaIhpLSX6 2UOjovt6qDD6PW3ztJJUJqnhdNKbD/tCr0HeTMTcVKFf7y6/ILlBqZzb3RfT9fAn8JrG amecsf8j9NRp4N8CPvAycDfmX9E4pN3lwjZYvuLImAjsatiMDTlg05rmyfvizEpIkqkF i/GSMw4cL41QacslS0BuCLxYxcQMG97keWM8lD9L+7K3MHrMwXoe3M28ipsU0g+HVqs0 oPT5GoS3XFfYaOh8UCDVmKZMwowv2z07mDV5jSrNLzjUDx3uAXDukAJT9+fxSZCztNzP Ei7A== 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; bh=+LR4I1zve0KqPGOMEMr5hVDRRu/jYtoGYsp1Px/pE5k=; b=ceQkCmB2waMVD4vNBE8UQ99QGNVqPnWxk0zlnG96DoNXOgnVfEu4TsoFxxdOPf1eVP dCWm+55SwBJhgN6FoJrKc/GodwCW/YanM8QVTxOE3pswZvSY7Aa6V0i+opczgrsihbau 1WN3qAKr9H1YHgc6FHn/2gJQQ/3qGwP+0r+oW/RG85Ptv0mC4xCUfFM7nKSgepqFUrau OnGxUXEBvsghYkCGUFtNnq8he3Hfx6J0xMWceO6Fk6zfkR34BsPulfWLwU7T6+Qc8jjh JAcX5iTPnG6ZuhWxEwtBHIiu2igIRaagx1HlTVVAB/1i7VzY6nLI9m1ayJ5rzzgMhkIK P0QQ== X-Gm-Message-State: AIkVDXJ2m0TU0fTOP9IEHNSJxuzICW3tuCZ+6bfRLpNnAnhTYKgSR7IQyoQ3Uq8GmO1WDw== X-Received: by 10.28.136.198 with SMTP id k189mr5242926wmd.24.1482333011019; Wed, 21 Dec 2016 07:10:11 -0800 (PST) Received: from weierstrass.local.net ([91.200.109.169]) by smtp.gmail.com with ESMTPSA id 135sm27627375wmh.14.2016.12.21.07.10.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Dec 2016 07:10:10 -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: Wed, 21 Dec 2016 16:09:31 +0100 Message-Id: <1482332986-7599-9-git-send-email-jblunck@infradead.org> X-Mailer: git-send-email 2.7.4 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 v4 08/23] 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: Wed, 21 Dec 2016 15:10:11 -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 035fe07..529b6c8 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