From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wj0-f195.google.com (mail-wj0-f195.google.com [209.85.210.195]) by dpdk.org (Postfix) with ESMTP id C478810CB4 for ; Wed, 21 Dec 2016 16:10:29 +0100 (CET) Received: by mail-wj0-f195.google.com with SMTP id xy5so32460992wjc.1 for ; Wed, 21 Dec 2016 07:10:29 -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=C4c+TLj6+F8aluMWsH5C8xj7OBVJPcQZg+zE3ty8ywY=; b=SMF/n4wGGx6L6GTHy71bAmPOY+J6Vh/jgkVBNAMslawPxCmL7DDxmArqrdd2mXY5SD aNLFISzqIIaghY3AqsddarNrI0X3AtBUc1r+A2P89yshjP5adbhE4+UoaGy+uDOEgPQl d2yDPL/Sawj18FHCrPvMnTtlyb3Jp5Ef1RIYWrCX8//RrAzdCpH67KAy6BeizGsXxzaM VsgSxd8NPDAuAiXGoTWXYtNYSAdI3Myk3wAWqQPLWcC12cuqVoADx2Du5UsssOW2oI++ kQgkE3VwlweIn+yMJCyv36wxWgAtGDmd8K2D0nSW/g+Mq6sSFduw33V2g4As+gOJuAMK xtrw== 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=C4c+TLj6+F8aluMWsH5C8xj7OBVJPcQZg+zE3ty8ywY=; b=r8UY/v2MaDNcTnkRxIQLZmEWQbobv2kDOL5nwcUc82uZfmwzS0JOM/RO2biG9Lh8E6 sFZfByYozg/k/2eDCta+WnDsISKsGbirTLgVD8A/Jl4M+eqcw15CannXMotHS4fYlIj4 GJbENpggs7vYpACh+8k/1XHSriSfX9Z6YJ8zKn0kcYw57DBLj32GzyzxMRABHxj8R+am a/2JnKrBg3c66dRyTlcyAWhuyu08C1eQP9gXLHm22Ya2MJvbycW5tpOClz7ILC+cGQZR Yed80eN5DXUgJyZf8FGZmyOzkMDJIBWBbwuoK1g4VZqDTKpA0gHW8KkBqHlbrIFwatrC 3IiA== X-Gm-Message-State: AIkVDXLnxF79NU6+HTgMH0/asjtMsEqYiFBejJ8hy8BoguKHBuAJqlj8fW6cjV5Q+3lTow== X-Received: by 10.194.56.99 with SMTP id z3mr2809038wjp.55.1482333029367; Wed, 21 Dec 2016 07:10:29 -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.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Dec 2016 07:10:28 -0800 (PST) Sender: Jan Blunck From: Jan Blunck To: dev@dpdk.org Cc: shreyansh.jain@nxp.com, david.marchand@6wind.com, stephen@networkplumber.org Date: Wed, 21 Dec 2016 16:09:43 +0100 Message-Id: <1482332986-7599-21-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 20/23] drivers: Use rte_eth_dev_to_pci() helper 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:30 -0000 The drivers should not directly access the rte_eth_dev->pci_dev but use a helper instead. This is a preparation for replacing the pci_dev with a struct rte_device member in the future. Signed-off-by: Jan Blunck Acked-by: Shreyansh Jain --- drivers/net/bnx2x/bnx2x_ethdev.c | 2 +- drivers/net/bnxt/bnxt_ethdev.c | 4 ++-- drivers/net/cxgbe/cxgbe_ethdev.c | 2 +- drivers/net/ena/ena_ethdev.c | 2 +- drivers/net/enic/enic_ethdev.c | 2 +- drivers/net/fm10k/fm10k_ethdev.c | 16 ++++++++-------- drivers/net/nfp/nfp_net.c | 8 ++++---- drivers/net/qede/qede_ethdev.c | 4 ++-- drivers/net/szedata2/rte_eth_szedata2.c | 4 ++-- drivers/net/thunderx/nicvf_ethdev.c | 5 +++-- drivers/net/virtio/virtio_ethdev.c | 2 +- drivers/net/vmxnet3/vmxnet3_ethdev.c | 2 +- 12 files changed, 27 insertions(+), 26 deletions(-) diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index ef2026a..f59488e 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -516,7 +516,7 @@ bnx2x_common_dev_init(struct rte_eth_dev *eth_dev, int is_vf) PMD_INIT_FUNC_TRACE(); eth_dev->dev_ops = is_vf ? &bnx2xvf_eth_dev_ops : &bnx2x_eth_dev_ops; - pci_dev = eth_dev->pci_dev; + pci_dev = rte_eth_dev_to_pci(eth_dev); rte_eth_copy_pci_info(eth_dev, pci_dev); diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 529b6c8..2864ef3 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -1012,7 +1012,7 @@ static bool bnxt_vf_pciid(uint16_t id) static int bnxt_init_board(struct rte_eth_dev *eth_dev) { struct bnxt *bp = eth_dev->data->dev_private; - struct rte_pci_device *pci_dev = eth_dev->pci_dev; + struct rte_pci_device *pci_dev = rte_eth_dev_to_pci(eth_dev); int rc; /* enable device (incl. PCI PM wakeup), and bus-mastering */ @@ -1046,7 +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; + struct rte_pci_device *pci_dev = rte_eth_dev_to_pci(eth_dev); static int version_printed; struct bnxt *bp; int rc; diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index b7f28eb..bb1f3b3 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -1005,7 +1005,7 @@ static int eth_cxgbe_dev_init(struct rte_eth_dev *eth_dev) if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; - pci_dev = eth_dev->pci_dev; + pci_dev = rte_eth_dev_to_pci(eth_dev); snprintf(name, sizeof(name), "cxgbeadapter%d", eth_dev->data->port_id); adapter = rte_zmalloc(name, sizeof(*adapter), 0); diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index ab9a178..552d3ed 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1278,7 +1278,7 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev) if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; - pci_dev = eth_dev->pci_dev; + pci_dev = rte_eth_dev_to_pci(eth_dev); adapter->pdev = pci_dev; PMD_INIT_LOG(INFO, "Initializing %x:%x:%x.%d\n", diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 2b154ec..92df191 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -621,7 +621,7 @@ static int eth_enicpmd_dev_init(struct rte_eth_dev *eth_dev) eth_dev->rx_pkt_burst = &enic_recv_pkts; eth_dev->tx_pkt_burst = &enic_xmit_pkts; - pdev = eth_dev->pci_dev; + pdev = rte_eth_dev_to_pci(eth_dev); rte_eth_copy_pci_info(eth_dev, pdev); enic->pdev = pdev; addr = &pdev->addr; diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 2f6c628..140e235 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -711,7 +711,7 @@ fm10k_dev_rx_init(struct rte_eth_dev *dev) { struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct fm10k_macvlan_filter_info *macvlan; - struct rte_pci_device *pdev = dev->pci_dev; + struct rte_pci_device *pdev = rte_eth_dev_to_pci(dev); struct rte_intr_handle *intr_handle = &pdev->intr_handle; int i, ret; struct fm10k_rx_queue *rxq; @@ -1172,7 +1172,7 @@ static void fm10k_dev_stop(struct rte_eth_dev *dev) { struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct rte_pci_device *pdev = dev->pci_dev; + struct rte_pci_device *pdev = rte_eth_dev_to_pci(dev); struct rte_intr_handle *intr_handle = &pdev->intr_handle; int i; @@ -1389,7 +1389,7 @@ fm10k_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct rte_pci_device *pdev = dev->pci_dev; + struct rte_pci_device *pdev = rte_eth_dev_to_pci(dev); PMD_INIT_FUNC_TRACE(); @@ -2336,7 +2336,7 @@ static int fm10k_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) { struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct rte_pci_device *pdev = dev->pci_dev; + struct rte_pci_device *pdev = rte_eth_dev_to_pci(dev); /* Enable ITR */ if (hw->mac.type == fm10k_mac_pf) @@ -2353,7 +2353,7 @@ static int fm10k_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id) { struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct rte_pci_device *pdev = dev->pci_dev; + struct rte_pci_device *pdev = rte_eth_dev_to_pci(dev); /* Disable ITR */ if (hw->mac.type == fm10k_mac_pf) @@ -2369,7 +2369,7 @@ static int fm10k_dev_rxq_interrupt_setup(struct rte_eth_dev *dev) { struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct rte_pci_device *pdev = dev->pci_dev; + struct rte_pci_device *pdev = rte_eth_dev_to_pci(dev); struct rte_intr_handle *intr_handle = &pdev->intr_handle; uint32_t intr_vector, vec; uint16_t queue_id; @@ -2833,7 +2833,7 @@ static int eth_fm10k_dev_init(struct rte_eth_dev *dev) { struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct rte_pci_device *pdev = dev->pci_dev; + struct rte_pci_device *pdev = rte_eth_dev_to_pci(dev); struct rte_intr_handle *intr_handle = &pdev->intr_handle; int diag, i; struct fm10k_macvlan_filter_info *macvlan; @@ -3012,7 +3012,7 @@ static int eth_fm10k_dev_uninit(struct rte_eth_dev *dev) { struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct rte_pci_device *pdev = dev->pci_dev; + struct rte_pci_device *pdev = rte_eth_dev_to_pci(dev); struct rte_intr_handle *intr_handle = &pdev->intr_handle; PMD_INIT_FUNC_TRACE(); diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index 2609f97..43bd262 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -723,7 +723,7 @@ nfp_net_close(struct rte_eth_dev *dev) PMD_INIT_LOG(DEBUG, "Close\n"); hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); - pci_dev = dev->pci_dev; + pci_dev = rte_eth_dev_to_pci(dev); /* * We assume that the DPDK application is stopping all the @@ -1124,7 +1124,7 @@ nfp_net_rx_queue_count(struct rte_eth_dev *dev, uint16_t queue_idx) static void nfp_net_dev_link_status_print(struct rte_eth_dev *dev) { - struct rte_pci_device *pci_dev = dev->pci_dev; + struct rte_pci_device *pci_dev = rte_eth_dev_to_pci(dev); struct rte_eth_link link; memset(&link, 0, sizeof(link)); @@ -1158,7 +1158,7 @@ nfp_net_irq_unmask(struct rte_eth_dev *dev) struct rte_pci_device *pci_dev; hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); - pci_dev = dev->pci_dev; + pci_dev = rte_eth_dev_to_pci(dev); if (hw->ctrl & NFP_NET_CFG_CTRL_MSIXAUTO) { /* If MSI-X auto-masking is used, clear the entry */ @@ -2335,7 +2335,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev) if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; - pci_dev = eth_dev->pci_dev; + pci_dev = rte_eth_dev_to_pci(eth_dev); rte_eth_copy_pci_info(eth_dev, pci_dev); hw->device_id = pci_dev->id.device_id; diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index a50bd5f..ea65895 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -809,7 +809,7 @@ static void qede_poll_sp_sb_cb(void *param) static void qede_dev_close(struct rte_eth_dev *eth_dev) { - struct rte_pci_device *pci_dev = eth_dev->pci_dev; + struct rte_pci_device *pci_dev = rte_eth_dev_to_pci(eth_dev); struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev); struct ecore_dev *edev = QEDE_INIT_EDEV(qdev); int rc; @@ -1404,7 +1404,7 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) /* Extract key data structures */ adapter = eth_dev->data->dev_private; edev = &adapter->edev; - pci_dev = eth_dev->pci_dev; + pci_dev = rte_eth_dev_to_pci(eth_dev); pci_addr = pci_dev->addr; PMD_INIT_FUNC_TRACE(edev); diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c index 8dc94c5..7f86dc9 100644 --- a/drivers/net/szedata2/rte_eth_szedata2.c +++ b/drivers/net/szedata2/rte_eth_szedata2.c @@ -1429,7 +1429,7 @@ rte_szedata2_eth_dev_init(struct rte_eth_dev *dev) struct szedata *szedata_temp; int ret; uint32_t szedata2_index; - struct rte_pci_device *pci_dev = dev->pci_dev; + struct rte_pci_device *pci_dev = rte_eth_dev_to_pci(dev); struct rte_pci_addr *pci_addr = &pci_dev->addr; struct rte_mem_resource *pci_rsc = &pci_dev->mem_resource[PCI_RESOURCE_NUMBER]; @@ -1552,7 +1552,7 @@ rte_szedata2_eth_dev_init(struct rte_eth_dev *dev) static int rte_szedata2_eth_dev_uninit(struct rte_eth_dev *dev) { - struct rte_pci_device *pci_dev = dev->pci_dev; + struct rte_pci_device *pci_dev = rte_eth_dev_to_pci(dev); struct rte_pci_addr *pci_addr = &pci_dev->addr; rte_free(dev->data->mac_addrs); diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index 466e49c..113f1e2 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -1335,6 +1335,7 @@ static void nicvf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct nicvf *nic = nicvf_pmd_priv(dev); + struct rte_pci_device *pci_dev = rte_eth_dev_to_pci(dev); PMD_INIT_FUNC_TRACE(); @@ -1345,7 +1346,7 @@ nicvf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_tx_queues = (uint16_t)MAX_SND_QUEUES_PER_QS * (MAX_SQS_PER_VF + 1); dev_info->max_mac_addrs = 1; - dev_info->max_vfs = dev->pci_dev->max_vfs; + dev_info->max_vfs = pci_dev->max_vfs; dev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP; dev_info->tx_offload_capa = @@ -1975,7 +1976,7 @@ nicvf_eth_dev_init(struct rte_eth_dev *eth_dev) } } - pci_dev = eth_dev->pci_dev; + pci_dev = rte_eth_dev_to_pci(eth_dev); rte_eth_copy_pci_info(eth_dev, pci_dev); nic->device_id = pci_dev->id.device_id; diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 58c03d8..251ef07 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1321,7 +1321,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) * virtio_user_eth_dev_alloc() before eth_virtio_dev_init() is called. */ if (!hw->virtio_user_dev) { - ret = vtpci_init(eth_dev->pci_dev, hw, &dev_flags); + ret = vtpci_init(rte_eth_dev_to_pci(eth_dev), hw, &dev_flags); if (ret) return ret; } diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 20a7966..1c51619 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -237,7 +237,7 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev) eth_dev->dev_ops = &vmxnet3_eth_dev_ops; eth_dev->rx_pkt_burst = &vmxnet3_recv_pkts; eth_dev->tx_pkt_burst = &vmxnet3_xmit_pkts; - pci_dev = eth_dev->pci_dev; + pci_dev = rte_eth_dev_to_pci(eth_dev); /* * for secondary processes, we don't initialize any further as primary -- 2.7.4