From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 67EB356A1 for ; Thu, 15 Sep 2016 15:02:22 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP; 15 Sep 2016 06:02:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,339,1470726000"; d="scan'208";a="1040364049" Received: from dhunt5-mobl.ger.corp.intel.com (HELO [10.237.220.115]) ([10.237.220.115]) by fmsmga001.fm.intel.com with ESMTP; 15 Sep 2016 06:02:20 -0700 To: Shreyansh Jain , dev@dpdk.org References: <1451682326-5834-1-git-send-email-viktorin@rehivetech.com> <1473410639-10367-1-git-send-email-shreyansh.jain@nxp.com> <1473410639-10367-13-git-send-email-shreyansh.jain@nxp.com> Cc: viktorin@rehivetech.com, hemant.agrawal@nxp.com From: "Hunt, David" Message-ID: <1378dc00-7fa7-6679-1118-5992cfd1adfd@intel.com> Date: Thu, 15 Sep 2016 14:02:19 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <1473410639-10367-13-git-send-email-shreyansh.jain@nxp.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v3 12/15] ether: extract function eth_dev_get_intr_handle 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: Thu, 15 Sep 2016 13:02:22 -0000 On 9/9/2016 9:43 AM, Shreyansh Jain wrote: > We abstract access to the intr_handle here as we want to get > it either from the pci_dev or soc_dev. > > Signed-off-by: Jan Viktorin > Signed-off-by: Shreyansh Jain > Signed-off-by: Hemant Agrawal > --- > lib/librte_ether/rte_ethdev.c | 15 +++++++++++++-- > 1 file changed, 13 insertions(+), 2 deletions(-) > > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > index e9f5467..104ea4a 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -2526,6 +2526,17 @@ _rte_eth_dev_callback_process(struct rte_eth_dev *dev, > rte_spinlock_unlock(&rte_eth_dev_cb_lock); > } > > +static inline > +struct rte_intr_handle *eth_dev_get_intr_handle(struct rte_eth_dev *dev) > +{ > + if (dev->pci_dev) { > + return &dev->pci_dev->intr_handle; > + } > + > + RTE_VERIFY(0); Rather than RTE_VERIFY(0), might I suggest using rte_panic with a more relevant error message? > + return NULL; > +} > + > int > rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int op, void *data) > { > @@ -2538,7 +2549,7 @@ 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; > + intr_handle = eth_dev_get_intr_handle(dev); > if (!intr_handle->intr_vec) { > RTE_PMD_DEBUG_TRACE("RX Intr vector unset\n"); > return -EPERM; > @@ -2598,7 +2609,7 @@ rte_eth_dev_rx_intr_ctl_q(uint8_t port_id, uint16_t queue_id, > return -EINVAL; > } > > - intr_handle = &dev->pci_dev->intr_handle; > + intr_handle = eth_dev_get_intr_handle(dev); > if (!intr_handle->intr_vec) { > RTE_PMD_DEBUG_TRACE("RX Intr vector unset\n"); > return -EPERM;