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 552E1FB35 for ; Tue, 20 Dec 2016 11:51:22 +0100 (CET) Received: by mail-wj0-f195.google.com with SMTP id he10so27138834wjc.2 for ; Tue, 20 Dec 2016 02:51:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=blxym2f69KXEn+IZZa8nRzK4aathRL/EcDlnE47lxmU=; b=P73J9JjevCHaKoI4daa6RYzXadI00/JKYomKq4z8D1JAsWyie1BbRwZ/FVdCpDeZv5 GzT78fwjRQgR8lwdrIRDTk5tKvys2NPu9USubZ67qSk+R+LSjrOL3bzeOgazsr8HUN9z JrLssniTUZLrKxPFadI0d+ySpn5kH8UkkGYTJsI4ApiPHoutkJzJK3LTo16k63RRwIQh ufhDvkxOOmSe1RSZOxWxy0vGvZM2d6cHvWzd5oThSMOCYmknHIic3YNd8bSKZ+WrPoBL TGPEHV1E6pe3XZKAXdBpSotV1RCI4X5X8RNG6o9Y9YM69w0Fj0lo7OcxAk+wJHjUcFot g3wQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=blxym2f69KXEn+IZZa8nRzK4aathRL/EcDlnE47lxmU=; b=dkQ/3IFIjb9zv6DsAslAZevtRriJvA3ePgcMbO4W4a34ojdacqTbIVkERchFxBC3M0 ptXFTnluloRRPp+6VlAKmmDLFJwmrSk8HzfKbm55lAGqX2Aclr4xwjc00SivwVnWotBu WgRlPXX7wVy/5J+On4I245/lbghlHZ6yria3AMnlwMMyaae6Nx5dwF21YcMH3p7HQEYM ipG0HoDL4P5MfhN8ZDcjJ4NACjYraUXC3iXuBSyBLXw7ohoqiMCOVT9m++D87Lir4Si1 iU3Se+6jaQEdVj1U3ymIBAZPShgwZcDwwCEYHD8Qa6IMnnJMvTwO+l0aqJPgRwwGB5oD lvTw== X-Gm-Message-State: AIkVDXJ/DprD4DnMpy2xzAK3CZtlenJmTJAnEriyvq2MTzUtNYH/TGnX2hLwQoNMnYvY/CgQOtyeOx0iz2kbMw== X-Received: by 10.195.30.165 with SMTP id kf5mr17609339wjd.41.1482231081950; Tue, 20 Dec 2016 02:51:21 -0800 (PST) MIME-Version: 1.0 Sender: jblunck@gmail.com Received: by 10.28.63.83 with HTTP; Tue, 20 Dec 2016 02:51:21 -0800 (PST) In-Reply-To: <84460a6f-3574-8da2-3ccc-6f1e23fb50e7@nxp.com> References: <1479747322-5774-1-git-send-email-jblunck@infradead.org> <1479747322-5774-8-git-send-email-jblunck@infradead.org> <84460a6f-3574-8da2-3ccc-6f1e23fb50e7@nxp.com> From: Jan Blunck Date: Tue, 20 Dec 2016 11:51:21 +0100 X-Google-Sender-Auth: SlYXzdgmhO4pdi-Xkl0C-VuZxDQ Message-ID: To: Shreyansh Jain Cc: dev@dpdk.org, David Marchand Content-Type: text/plain; charset=UTF-8 Subject: Re: [dpdk-dev] [PATCH v2 8/8] 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: Tue, 20 Dec 2016 10:51:22 -0000 On Tue, Nov 22, 2016 at 1:57 PM, Shreyansh Jain wrote: > On Monday 21 November 2016 10:25 PM, Jan Blunck wrote: >> >> 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 >> --- >> 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 4288577..4ecea50 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; >> >> @@ -2543,7 +2544,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; >> @@ -2603,7 +2610,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; >> @@ -3205,6 +3217,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 3adbb2b..f1f656a 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; >> /** >> > > Is there another patch which replaces all uses of > eth_dev->pci_dev->intr_handle with that of eth_dev->intr_handle? > > Now that eth_dev has a reference which is initialized as early as probe, we > should use that rather than pci_dev->intr_handle for PCI PMDs. > I've added this indirection because it is required for the ethdev function. The drivers shouldn't use the indirection through ethdev to access the intr_handle because they do have direct access to the device. > OR maybe, ETH_DEV_INTR_HANDLE() like macro which you have introduced in > i40e_ethdev.h. > > - > Shreyansh