From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 894BEA04B7; Wed, 14 Oct 2020 17:02:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 181AA1DA25; Wed, 14 Oct 2020 17:02:17 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by dpdk.org (Postfix) with ESMTP id 9F1FC1DA12 for ; Wed, 14 Oct 2020 17:02:15 +0200 (CEST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 0B8DA10C5; Wed, 14 Oct 2020 11:02:12 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 14 Oct 2020 11:02:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm2; bh= j+BxpLj9YfVuEOAaDOywZlup0TV5Yr2Gmr2dCZMDeLk=; b=MSU3oz5n1MEE9TS1 rqpokXmahJZQFzINP8J5uMVz2TjvcXyBkZ0v1DgaiNnG8Hm1dXpyVFNUYwonr+6z IyfUAo1UWsWH2x9AMGW86s6aJeSKuU2FdB530uGEVuFMQA0YjUDfIq9cK1UeRUXn wx6Y/jLPd2qeEtUL18ImgSkBc2ZCYQLYNNW2KUkilzgVmoM1L4DdniKOAy6ZqFPW j9WkkLslNpm7v7jCrdmHzPpNMLg92GIv1XvREyZcVyqkejSYdNoWAYJcseQFrObL l5zmoTp/demD0W+rKT4JFutiNIrH86pLtE1/RXCITKvmapBW1Imeg5S5rRg+EosN X8D0eg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=j+BxpLj9YfVuEOAaDOywZlup0TV5Yr2Gmr2dCZMDe Lk=; b=e/Bd4HjLVpX1xBoqqHBIZUToELIK4kjckJyCBju6RXN+/aXdxGJyN+DuM 1rkbuK/WC3NJXOLt0GCGVDh3ptR0kMxhB8rc4TxOTRz6WyUE7MDbmnrb8vTmlbKD /mP++7gg1BevScQiFGklp70Kj1BA5hARDssGffrUEqrYznXyPdbTfNlRfVelZy3o p5+W/eDCFZEMEQfD8H3FnBE1YCom9/wS4ZpW2ebNJprN5KuyZA7jfvHSNyBne//i d4pzvhIpVRvgNVSq9p6xpya+P8InA8jJjqt0DRIRlbnqreA3yPiM7g7DOuYWucfe NFnAZT6zJPmybLGQ938dJMYNZrQgQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedriedugdekfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedugefgvdefudfftdefgeelgffhueekgfffhfeujedtteeutdejueei iedvffegheenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id D1A123064680; Wed, 14 Oct 2020 11:02:09 -0400 (EDT) From: Thomas Monjalon To: Bing Zhao Cc: orika@nvidia.com, ferruh.yigit@intel.com, arybchenko@solarflare.com, mdr@ashroe.eu, nhorman@tuxdriver.com, bernard.iremonger@intel.com, beilei.xing@intel.com, wenzhuo.lu@intel.com, dev@dpdk.org Date: Wed, 14 Oct 2020 17:02:08 +0200 Message-ID: <3677075.ahOdM4pD4X@thomas> In-Reply-To: <1602605957-377464-4-git-send-email-bingz@nvidia.com> References: <1602158717-32038-1-git-send-email-bingz@nvidia.com> <1602605957-377464-1-git-send-email-bingz@nvidia.com> <1602605957-377464-4-git-send-email-bingz@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v4 3/5] ethdev: add API to get hairpin peer ports list 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 13/10/2020 18:19, Bing Zhao: > --- a/lib/librte_ethdev/rte_ethdev.c > +++ b/lib/librte_ethdev/rte_ethdev.c > @@ -2208,6 +2208,30 @@ struct rte_eth_dev * > return ret; > } > > +int > +rte_eth_hairpin_get_peer_ports(uint16_t cur_port, uint16_t *peer_ports, > + size_t len, uint32_t direction) > +{ > + struct rte_eth_dev *dev; > + int ret; > + > + if (!peer_ports || !len) > + return -EINVAL; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(cur_port, -EINVAL); should be -ENODEV > + dev = &rte_eth_devices[cur_port]; > + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_get_peer_ports, > + -ENOTSUP); > + > + ret = (*dev->dev_ops->hairpin_get_peer_ports)(dev, peer_ports, > + len, direction); > + if (ret < 0) > + RTE_ETHDEV_LOG(ERR, "Failed to get %d hairpin peer %s ports", > + cur_port, direction ? "RX" : "TX"); Missing \n > + > + return ret; > +} > --- a/lib/librte_ethdev/rte_ethdev.h > +++ b/lib/librte_ethdev/rte_ethdev.h > * @warning > * @b EXPERIMENTAL: this API may change, or be removed, without prior notice > * > + * Get all the hairpin peer RX / TX ports of the current port. > + * The caller should ensure that the array is large enough to save the ports > + * list. > + * > + * @param cur_port > + * The current port identifier of the Ethernet device. Why current? In general we use "port_id". > + * @param peer_ports > + * Pointer to the array to store the peer ports list. > + * @param len > + * Length of the array to store the port identifiers. > + * @param direction > + * Current port to peer port direction > + * positive - current used as TX to get all peer RX ports. > + * zero - current used as RX to get all peer TX ports. > + * > + * @return > + * - (0 or positive) actual peer ports number. > + * - (-EINVAL) if bad parameter. > + * - (-ENOTSUP) if hardware doesn't support. > + * - Others detailed errors from PMD drivers. Please add ENODEV > + */ > +__rte_experimental > +int rte_eth_hairpin_get_peer_ports(uint16_t cur_port, uint16_t *peer_ports, > + size_t len, uint32_t direction);