From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wj0-f194.google.com (mail-wj0-f194.google.com [209.85.210.194]) by dpdk.org (Postfix) with ESMTP id 4E73710CF8 for ; Wed, 21 Dec 2016 16:10:32 +0100 (CET) Received: by mail-wj0-f194.google.com with SMTP id kp2so32487900wjc.0 for ; Wed, 21 Dec 2016 07:10:32 -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=F7dE8mjH4jdlhl/h1tJPzkJLFuUdzDqxaR74Gw15HrQ=; b=ptyR9a88VsI31ijA6Q26At28qpZI3ptRjQgeiBRMDEI8yZWJ3FjCtKVJ75Q9szz3I3 rCGRJorhjdH1KeqtVyUxnSTwCQwgyMdEG5rN994C1WYK3clkAnJwtfAXRJ/EvShhGFOQ 0xXr+8YJCmtpXofwyQmvTofqLZLrRct0NdptU2fZ5ICjGTzZGhLpBJ6OlIYe7fTvpfK+ M6pwfxtMoDJojJabqHN5wv8i1sgUFMMarID+KCdQqs8JkqRcnv2vh5Jds/eTHZDPl3yp Ty9+7hLCr7q9ji0GIzvLiREpu/06lS60GU2D+Av2E5aUzV+19uppxHZZkhIH5OuDpUUX ygEg== 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=F7dE8mjH4jdlhl/h1tJPzkJLFuUdzDqxaR74Gw15HrQ=; b=iiTN1hTESRkl0JKErToJ3HMUcngsdd02K4/V9Gb27fJbQ6T1xEn/2GzsAEavu49Fmw pL2st+V8UF/lVPu8n7RFSlW3OVYlaj8eWMJh0e+eZOPEQNIH+4KlffMMZIXse3KF+NRQ h6c9b4WPTeIhycDWK1DM4VTJSnGQC/bcrsEu0TfX2zK68E0m7ZwZOFtpYYUuUhQj0r2D gNj3lQdrEm90sJqUw4WE2mTEc8wAJM2ns8dwvOJvvi6dzpuKYUBT94ywVw5cUAwACC0e 3SZjmFshFMD6wqPQiFeuC39CmyjkNniUzuJKEVpYx9Sb0T3Z5/So/q1A2JxwTdJZF8Ao IKbg== X-Gm-Message-State: AIkVDXJyn4HM5DN65hLTe2B6Hv3hDYRXvBf8ILo6yJT5eV8idpGPrA3wrduXzIqViRBOzw== X-Received: by 10.194.151.132 with SMTP id uq4mr1985319wjb.229.1482333032017; Wed, 21 Dec 2016 07:10:32 -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.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Dec 2016 07:10:30 -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:45 +0100 Message-Id: <1482332986-7599-23-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 22/23] ethdev: Decouple interrupt handling from PCI device 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:32 -0000 The struct rte_intr_handle is an abstraction layer for different types of interrupt mechanisms. It is embedded in the low-level device (e.g. PCI). On allocation of a struct rte_eth_dev a reference to the intr_handle should be stored for devices supporting interrupts. Signed-off-by: Jan Blunck Acked-by: Shreyansh Jain --- lib/librte_ether/rte_ethdev.c | 18 ++++++++++++++++-- lib/librte_ether/rte_ethdev.h | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 200e068..764b6cd 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -258,6 +258,7 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv, rte_panic("Cannot allocate memzone for private port data\n"); } eth_dev->pci_dev = pci_dev; + eth_dev->intr_handle = &pci_dev->intr_handle; eth_dev->driver = eth_drv; eth_dev->data->rx_mbuf_alloc_failed = 0; @@ -2555,7 +2556,13 @@ rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int op, void *data) RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); dev = &rte_eth_devices[port_id]; - intr_handle = &dev->pci_dev->intr_handle; + + if (!dev->intr_handle) { + RTE_PMD_DEBUG_TRACE("RX Intr handle unset\n"); + return -ENOTSUP; + } + + intr_handle = dev->intr_handle; if (!intr_handle->intr_vec) { RTE_PMD_DEBUG_TRACE("RX Intr vector unset\n"); return -EPERM; @@ -2615,7 +2622,12 @@ rte_eth_dev_rx_intr_ctl_q(uint8_t port_id, uint16_t queue_id, return -EINVAL; } - intr_handle = &dev->pci_dev->intr_handle; + if (!dev->intr_handle) { + RTE_PMD_DEBUG_TRACE("RX Intr handle unset\n"); + return -ENOTSUP; + } + + intr_handle = dev->intr_handle; if (!intr_handle->intr_vec) { RTE_PMD_DEBUG_TRACE("RX Intr vector unset\n"); return -EPERM; @@ -3217,6 +3229,8 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_de return; } + eth_dev->intr_handle = &pci_dev->intr_handle; + eth_dev->data->dev_flags = 0; if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC) eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_LSC; diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index d6e367c..cc93ca9 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1629,6 +1629,7 @@ struct rte_eth_dev { const struct eth_driver *driver;/**< Driver for this device */ const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */ struct rte_pci_device *pci_dev; /**< PCI info. supplied by probing */ + struct rte_intr_handle *intr_handle; /**< Device interrupt handle */ /** User application callbacks for NIC interrupts */ struct rte_eth_dev_cb_list link_intr_cbs; /** -- 2.7.4