From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 025CA2904 for ; Mon, 24 Apr 2017 17:13:56 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id A23AE20AF5; Mon, 24 Apr 2017 11:13:56 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Mon, 24 Apr 2017 11:13:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=OFARQKYX9n0X3tp jZF87r1/JWNOGC2aN01DRBihDdVI=; b=aWbJpb5yRQt3+gbYZFQ6h/qIkZYeCF8 maZsSI2nehaBonlfhYmQcJVxhL4c3lwcGx7DisdsJqBzkE2G2rRbAZsldlPS5S3w JH3VqDGGN/pQGXtywLhdlZk4gZvahbXrfawRM/X9Q80JuwiNMjSOHyHrKBDos8AF v6tbBpfWb9NU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= fm1; bh=OFARQKYX9n0X3tpjZF87r1/JWNOGC2aN01DRBihDdVI=; b=kIE5E0MF /aRkR0oxeANtiZfsgm9i9jpZoiTW47LdpI61yuudcDHqVdwqoy5Xzd8Z+gZoJfY6 pa9x1L2TlQbRAUriKEmaOZLJ7agKe2IC3DBjAHJiJikeVXtHRv1Te6eHOvVLAIHd BTttL/bP/PyukstkJ3pMYD5ofE9Pzh0SDelzw1/FVQArJT30MeaqC7Qbi7In5nGc ZO+gw+PG76vUXvzxXpdZ1GJMw8GXmN6GLxjZMDd93wamitvngv95Tn2ItlYZbsJq ojrTuez5Xci6yaXvzX6HCR5z/ITR1hnCGL3r2KzyrfvAaIdqrMkGVvwl7DuGEyHa a7bMUDCCWmMmqg== X-ME-Sender: X-Sasl-enc: 9ALoosBh/t5cLgtjXsN4fWul+Q5S/U+gbLF0qU5W2zV+ 1493046836 Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 517F924774; Mon, 24 Apr 2017 11:13:56 -0400 (EDT) From: Thomas Monjalon To: Andrew Rybchenko , dev@dpdk.org, Roman Zhukov Date: Mon, 24 Apr 2017 17:13:55 +0200 Message-ID: <2685953.rHhyh0R7Aq@xps> In-Reply-To: <1488459935-13273-2-git-send-email-arybchenko@solarflare.com> References: <1488459935-13273-1-git-send-email-arybchenko@solarflare.com> <1488459935-13273-2-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [RFC PATCH 1/2] ethdev: add function to adjust number of descriptors 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: Mon, 24 Apr 2017 15:13:57 -0000 Hi, 02/03/2017 14:05, Andrew Rybchenko: > From: Roman Zhukov > > Check that numbers of Rx and Tx descriptors satisfy descriptors limits > from the Ethernet device information, otherwise adjust them to boundaries. > > Signed-off-by: Roman Zhukov > Signed-off-by: Andrew Rybchenko I think this helper is OK. We could add it in 17.08. Is there any comment from PMD maintainers? [...] > +static void > +rte_eth_dev_adjust_nb_desc(uint16_t *nb_desc, > + const struct rte_eth_desc_lim *desc_lim) > +{ > + if (desc_lim->nb_align != 0) > + *nb_desc = RTE_ALIGN_CEIL(*nb_desc, desc_lim->nb_align); > + > + if (desc_lim->nb_max != 0) > + *nb_desc = RTE_MIN(*nb_desc, desc_lim->nb_max); > + > + *nb_desc = RTE_MAX(*nb_desc, desc_lim->nb_min); > +} > + > +int > +rte_eth_dev_adjust_nb_rx_tx_desc(uint8_t port_id, > + uint16_t *nb_rx_desc, > + uint16_t *nb_tx_desc) > +{ > + struct rte_eth_dev *dev; > + struct rte_eth_dev_info dev_info; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > + > + dev = &rte_eth_devices[port_id]; > + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP); > + > + rte_eth_dev_info_get(port_id, &dev_info); > + > + if (nb_rx_desc != NULL) > + rte_eth_dev_adjust_nb_desc(nb_rx_desc, &dev_info.rx_desc_lim); > + > + if (nb_tx_desc != NULL) > + rte_eth_dev_adjust_nb_desc(nb_tx_desc, &dev_info.tx_desc_lim); > + > + return 0; > +} [...] > +/** > + * Check that numbers of Rx and Tx descriptors satisfy descriptors limits from > + * the ethernet device information, otherwise adjust them to boundaries. > + * > + * @param port_id > + * The port identifier of the Ethernet device. > + * @param nb_rx_desc > + * A pointer to a uint16_t where the number of receive > + * descriptors stored. > + * @param nb_tx_desc > + * A pointer to a uint16_t where the number of transmit > + * descriptors stored. > + * @return > + * - (0) if successful. > + * - (-ENOTSUP, -ENODEV or -EINVAL) on failure. > + */ > +int rte_eth_dev_adjust_nb_rx_tx_desc(uint8_t port_id, > + uint16_t *nb_rx_desc, > + uint16_t *nb_tx_desc); > +