From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by dpdk.org (Postfix) with ESMTP id C827CFAFE for ; Tue, 20 Dec 2016 12:12:25 +0100 (CET) Received: by mail-wm0-f67.google.com with SMTP id g23so23714132wme.1 for ; Tue, 20 Dec 2016 03:12:25 -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=J28s3DYgTJqYXnpTZsnvKgIFzKeuL9DE5/zzGFTCrx8=; b=Z7kM3WcDdMUAMeHUOp5Udh3WUR3kpTgGX0LGF21vMlcEtpBIYr3/U5QA/LaRHUUnif 4ZuXeelPVWRgLcExrIdqNPOYAIC1PWW1w+8cTNhHHvA/518KNiK13SpnPMW/dSEi5hTA HSgdZnkHhM5mnK9E542liXd7ie0CADnpauKti1isRKxg5xkNoisCDv/1OmmkoPeK+plZ yDZOqiZQL3FlQYOi3OFGLwLkrm/siCPzKzBRG+N2hovihZOrlvE8NvLEcf7bNmhFu8ME d/Nwmc21llpqy17JcKFTd305+XGQvATUk2xjvdzHEKMB3L+sKMOxO2qnI0engRpBez9w S26w== 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=J28s3DYgTJqYXnpTZsnvKgIFzKeuL9DE5/zzGFTCrx8=; b=PTJ7u+q0o6qleiiCK/oBzk+99JG+fhR02hSnXtXpNxjGxlL48xU/TzGNZHeK7hKX/n f/gBWtoRH8ns4uiVEn4Mh+ph0aLqsOvY9fLHvpGaOo4CMWqwrhEjM6T0UNdIpDfyRgWO 2p5IO5/CUV36dnkUzUEX4NyLaqrL5f8vXc535LhgxHuWxGXWvqsGMD4+0bu9I2ksVBkZ 5jBWPZzYMs3cPsfhn8Pl/oqvvkZzN1gyTT/ADKfcInOjT1SJd0rQWZs6c1dlGPWktNba OGex8cPiHVW+LGzFJQdkRhTWi71kvkZiQ6HTicjrSjKO0PWD2hBaFkElAKQVFekSgEYd GuWA== X-Gm-Message-State: AIkVDXJJEG/ksso1aJjLvPm6I0NIueOHUSpylzgmHDM0QouY/vGQm4VfbH0QvoiuTooWCQ== X-Received: by 10.28.221.11 with SMTP id u11mr1359157wmg.91.1482232345496; Tue, 20 Dec 2016 03:12:25 -0800 (PST) Received: from weierstrass.local.net ([91.200.109.169]) by smtp.gmail.com with ESMTPSA id q65sm21527756wmd.6.2016.12.20.03.12.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Dec 2016 03:12:24 -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: Tue, 20 Dec 2016 12:11:54 +0100 Message-Id: <1482232315-21626-9-git-send-email-jblunck@infradead.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1482232315-21626-1-git-send-email-jblunck@infradead.org> References: <1482232315-21626-1-git-send-email-jblunck@infradead.org> Subject: [dpdk-dev] [PATCH v3 8/9] 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 11:12:25 -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 --- 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; /** -- 2.7.4