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 E36ADF60E for ; Fri, 23 Dec 2016 16:58:50 +0100 (CET) Received: by mail-wj0-f195.google.com with SMTP id hb5so7610668wjc.2 for ; Fri, 23 Dec 2016 07:58:50 -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=B/pcYY+KBV4Luwtlp/tJatcbDIRJLzFHsBcaysG/hF8=; b=uvHqfoCnwZbFVoAKPEFbYW8DqBtmkeBNNXo/RsmQAhf3DYP2/mebq7JdgNTLxnDzZ4 6WVHIjW8h6hAXPlOtW8LfqqwfkX/teultXEau7/PUISTDSSra9W3Jd2whl51hVvz1lmq 2RwDzwSZz4vBBmw0HY5MWO7cUu3H8KULPcKkcqEaEJlP6XDEhdO+2kQ80Q0SU0jNs9iN SNyFqefAqzNBSVCoumeQSiPwy3dyJFmbK4Dl2bbL5sigfTbRztQtiMmLOVyMax87R5L3 A5Yh7TSXgBTkTQPyn6yiT38HRpRuZSTemdX112JjKOxu+Z/20uWGjuI13wqgvDz9HIuW oLKQ== 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=B/pcYY+KBV4Luwtlp/tJatcbDIRJLzFHsBcaysG/hF8=; b=HOfOfist6Gpi0RjGOnumgGRMLP9fB41tQxWqozGlr5BGUa/Z6SCR5w1nnUm1kwBd7l +tSz7nwHaOwqjZriBksJAXYDYfXALCm9GrM7HwCtU1kuRJUzqXzmSn4r13FazS3GKTN3 ixKXOnG3K8gODukjcI9Xz9q8rEJo8VcRpexB6NlrpYR7vhCNslZbkHgcGRqomMScLUBN rUXipIIl+KkfOl2AX6ZtbJglmje4CHfpR29c5N64PHkHFNETVGYHYzCaEE0Jpkvmh/t4 m+iGVeAsJces/wiSIKqLOj0wgf6+6mYuHYlDVG+PyxgYLzI73oQO0PLIdmn0qUp8eylW oYfQ== X-Gm-Message-State: AIkVDXLIv46kzayUePjFuKERfz0puYYXEpt2+O7hQM7Z6OeO5MMJan29FQcTGNbiNqFULQ== X-Received: by 10.195.14.103 with SMTP id ff7mr13631578wjd.126.1482508730656; Fri, 23 Dec 2016 07:58:50 -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.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Dec 2016 07:58:49 -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: Fri, 23 Dec 2016 16:58:09 +0100 Message-Id: <1482508691-11408-19-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 18/20] 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: Fri, 23 Dec 2016 15:58:51 -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 9f60ff3..b455850 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -262,6 +262,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; /* Invoke PMD device initialization function */ @@ -2591,7 +2592,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; @@ -2651,7 +2658,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; @@ -3253,6 +3265,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 272fd41..e1eae65 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1625,6 +1625,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