From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by dpdk.org (Postfix) with ESMTP id 965EA1B493 for ; Fri, 28 Sep 2018 14:47:07 +0200 (CEST) Received: by mail-pg1-f195.google.com with SMTP id t70-v6so4387414pgd.12 for ; Fri, 28 Sep 2018 05:47:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8V8527AfsiyYzOQTckjYLrYeOSrFodKK0HgnEtHPNwU=; b=PvAILwnr5EPDeodysgqnlVxX62BcY6esUVcwkXZrTQUYuVdplh83vZ+k/KaDI7rzx7 gBmZx11rjgoKKdmp1P0aHnJYwzEAfqoz3kpu7RJHH47O0u5Ri/MooPMNIIBYcsKr+7nS LBrEc7u+c3ROS2ZeydzWKG8O1xVN0tfNGMkvvuKGsjITtCRvQuOjlm63+ELou55M//Ie vHsh2jlfIiq1slNtu97znwy0IxIlrBseGcZjuN4SlBBjMlHpEEMfa1AQNSVvs9whIyCu k4OoFAkfMePSLQ5ER4tYAgPc5eeTDJuwlLmypJcYxyfWZQrX5+B9M8kN2fEproOBh0ly rZaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8V8527AfsiyYzOQTckjYLrYeOSrFodKK0HgnEtHPNwU=; b=ofYktB5OiPUr3g48XDaGOFUnvot1qB1wdiJIKkHF/+qSZOPLtP/oZTLoqJtpS5LTT4 WANqWyY7OHCI5BU/124GI9zPW/Nn9ONqNEbGNH9gHBfSf1jfOv+1y+JagCVPuGpcqkp3 4jx6i7eYG5DOKM6hFwY/6adV5DweIpMEUrLZIfCm+tUwFVlto85Xq4I7MBLgzFi5p2NQ NK8zl9GfTVmPujg0YDO4DZgh7ln426abKpVaQS3AYs6BmV7cKnLM6TzE7/PhWhuTAHXQ REXNDPYObeIgCsW4KZNvJA3LbAMBen2ElCUMTV4w1EoGLCmGRYjVT5Oi9JQZa1ePRz0R 1ZVQ== X-Gm-Message-State: ABuFfojnEhAoJTsqxSG1/kFO6ks32wNr7p4PWbHIuVOnyzOK0TtbZXPm h3Zzwkn3C781miz5AET5iqioI08+NbS/KBpQozAhqg== X-Google-Smtp-Source: ACcGV602BVFQjEgLtCMa0d6aqXJU0RURrWoXAdYJjxwUbmS/dcBU6BaOxlKAFvryARnXCXo7NzDjWjH7umu3bbJYf9E= X-Received: by 2002:a63:4a09:: with SMTP id x9-v6mr5601528pga.34.1538138826573; Fri, 28 Sep 2018 05:47:06 -0700 (PDT) MIME-Version: 1.0 References: <20180928034331.25147-1-xiaoyun.li@intel.com> In-Reply-To: <20180928034331.25147-1-xiaoyun.li@intel.com> From: Stephen Hemminger Date: Fri, 28 Sep 2018 14:46:54 +0200 Message-ID: To: "Li, Xiaoyun" Cc: Ferruh Yigit , Thomas Monjalon , helin.zhang@intel.com, damarion@cisco.com, ray.kinsella@intel.com, dev@dpdk.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH] ethdev: get rxq interrupt fd 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, 28 Sep 2018 12:47:07 -0000 In general, an API is less error prone if it only does return by value. What about just returning fd or -1? On Fri, Sep 28, 2018, 5:55 AM Xiaoyun Li wrote: > Some users want to use their own epoll instances to control both > DPDK rxq interrupt fds and their own other fds. So added a function > to get rxq interrupt fd based on port id and queue id. > > Signed-off-by: Xiaoyun Li > --- > lib/librte_ethdev/rte_ethdev.c | 37 ++++++++++++++++++++++++++++++++++ > lib/librte_ethdev/rte_ethdev.h | 3 +++ > 2 files changed, 40 insertions(+) > > diff --git a/lib/librte_ethdev/rte_ethdev.c > b/lib/librte_ethdev/rte_ethdev.c > index ef99f7068..c21124e32 100644 > --- a/lib/librte_ethdev/rte_ethdev.c > +++ b/lib/librte_ethdev/rte_ethdev.c > @@ -3433,6 +3433,43 @@ rte_eth_dev_rx_intr_ctl(uint16_t port_id, int epfd, > int op, void *data) > return 0; > } > > +int > +rte_eth_dev_rx_intr_ctl_q_get_fd(uint16_t port_id, uint16_t queue_id, > + int *fd) > +{ > + struct rte_intr_handle *intr_handle; > + struct rte_eth_dev *dev; > + unsigned int efd_idx; > + uint32_t vec; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > + > + dev = &rte_eth_devices[port_id]; > + > + if (queue_id >= dev->data->nb_rx_queues) { > + RTE_ETHDEV_LOG(ERR, "Invalid RX queue_id=%u\n", queue_id); > + return -EINVAL; > + } > + > + if (!dev->intr_handle) { > + RTE_ETHDEV_LOG(ERR, "RX Intr handle unset\n"); > + return -ENOTSUP; > + } > + > + intr_handle = dev->intr_handle; > + if (!intr_handle->intr_vec) { > + RTE_ETHDEV_LOG(ERR, "RX Intr vector unset\n"); > + return -EPERM; > + } > + > + vec = intr_handle->intr_vec[queue_id]; > + efd_idx = (vec >= RTE_INTR_VEC_RXTX_OFFSET) ? > + (vec - RTE_INTR_VEC_RXTX_OFFSET) : vec; > + *fd = intr_handle->efds[efd_idx]; > + > + return 0; > +} > + > const struct rte_memzone * > rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char > *ring_name, > uint16_t queue_id, size_t size, unsigned align, > diff --git a/lib/librte_ethdev/rte_ethdev.h > b/lib/librte_ethdev/rte_ethdev.h > index 012577b0a..3670d7249 100644 > --- a/lib/librte_ethdev/rte_ethdev.h > +++ b/lib/librte_ethdev/rte_ethdev.h > @@ -2719,6 +2719,9 @@ int rte_eth_dev_rx_intr_ctl(uint16_t port_id, int > epfd, int op, void *data); > int rte_eth_dev_rx_intr_ctl_q(uint16_t port_id, uint16_t queue_id, > int epfd, int op, void *data); > > +int rte_eth_dev_rx_intr_ctl_q_get_fd(uint16_t port_id, uint16_t queue_id, > + int *fd); > + > /** > * Turn on the LED on the Ethernet device. > * This function turns on the LED on the Ethernet device. > -- > 2.17.1 > >