From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by dpdk.org (Postfix) with ESMTP id DB9D858C5 for ; Mon, 21 Nov 2016 17:57:12 +0100 (CET) Received: by mail-wm0-f68.google.com with SMTP id m203so547725wma.3 for ; Mon, 21 Nov 2016 08:57:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=J28s3DYgTJqYXnpTZsnvKgIFzKeuL9DE5/zzGFTCrx8=; b=M7CPD8fQtsYieeqhoHLzgNZRQmZaa1VOfnQPwBmXQA1hVTIa5TugMxeKNTpbI1rr17 1lrLVUoJVSUH0ZaZlDoHiIwoA9Wxky0yGFsq2VDTE7Pgf9bnugeW7ZdOHErmN4LEDGwv BJW09hPmiKdBYObVIG07trTxHuS5+qHbA/GQFOvHQUt4GupqI5fZqbd3qdEMIxHgzOrU T5y7b+ErIHvN68zHTIxuRLj5RCpXuLiwhLT7a1Ogt8oQOG8AHS1hHn/XAH009HmSpqh1 joC6CYtoFtS5uYC6W1DGVZmsOutJr//roPu1GnuSNuN+Ci2upfxJpukKW/uYqRajiCEU 0xsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=J28s3DYgTJqYXnpTZsnvKgIFzKeuL9DE5/zzGFTCrx8=; b=Hz1d+7tST1lXoR3ez1CYAwmYE+c0Wm5pu6/8Y4RvRf2tiQdjQBnzjxy0WWabtWgKFz 8jWR0MJ7bj7eshbmRwwlAeMasv0FYwqXtOsy0Sazysv6Soxlm1AD3T0qvlZPYRie/+yu D38sCaJLeGUmm+YP51O3978R/lbyYRjuNCeIeYuaYl/kObu9bwUvSr7o+3DlM9C5G6l/ rNdm2BbcbZwBEKJmsztSsgIjQiN/U8XFlMsyS44fKV/wXlll2FfKT1nt6CYdvicxUzi4 VDtDIoF0eB4+sA7BrsGa+RBTsgQ6XnXSiQZJtcX4me7k+f2lmu2Ob2OAaGjvjfq16ocZ XK1Q== X-Gm-Message-State: AKaTC02W13OHPEe7Yph9pHHDaj1RJsLnZqci3CI+nxZfG1g4OK7y4DrZXocKJ0p/rZ/PiQ== X-Received: by 10.28.12.80 with SMTP id 77mr16568519wmm.106.1479747432369; Mon, 21 Nov 2016 08:57:12 -0800 (PST) Received: from weierstrass.local.net ([91.200.110.70]) by smtp.gmail.com with ESMTPSA id v202sm20536051wmv.8.2016.11.21.08.57.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Nov 2016 08:57:11 -0800 (PST) Sender: Jan Blunck From: Jan Blunck To: dev@dpdk.org Cc: shreyansh.jain@nxp.com, david.marchand@6wind.com Date: Mon, 21 Nov 2016 17:55:22 +0100 Message-Id: <1479747322-5774-8-git-send-email-jblunck@infradead.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1479747322-5774-1-git-send-email-jblunck@infradead.org> References: <1479747322-5774-1-git-send-email-jblunck@infradead.org> Subject: [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: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Nov 2016 16:57:13 -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