From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id E0D2B2C16 for ; Tue, 25 Apr 2017 09:40:04 +0200 (CEST) Received: from pure.maildistiller.com (unknown [10.110.50.29]) by dispatch1-us1.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTP id 6FAE780053; Tue, 25 Apr 2017 07:40:04 +0000 (UTC) X-Virus-Scanned: Proofpoint Essentials engine Received: from mx7-us1.ppe-hosted.com (unknown [10.110.49.251]) by pure.maildistiller.com (Proofpoint Essentials ESMTP Server) with ESMTPS id E59026004B; Tue, 25 Apr 2017 07:40:03 +0000 (UTC) Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx7-us1.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id BB9E254006E; Tue, 25 Apr 2017 07:40:01 +0000 (UTC) Received: from [192.168.38.17] (84.52.89.52) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Tue, 25 Apr 2017 00:39:58 -0700 To: Thomas Monjalon , , Roman Zhukov References: <1488459935-13273-1-git-send-email-arybchenko@solarflare.com> <1488459935-13273-2-git-send-email-arybchenko@solarflare.com> <2685953.rHhyh0R7Aq@xps> From: Andrew Rybchenko Message-ID: Date: Tue, 25 Apr 2017 10:39:54 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <2685953.rHhyh0R7Aq@xps> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [84.52.89.52] X-ClientProxiedBy: ocex03.SolarFlarecom.com (10.20.40.36) To ocex03.SolarFlarecom.com (10.20.40.36) X-MDID: 1493106004-HIJnmdAiVR9z 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: Tue, 25 Apr 2017 07:40:05 -0000 Hi, On 04/24/2017 06:13 PM, Thomas Monjalon wrote: > 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. Thanks, we'll prepare patch series which updates alll example applications to use the helper. Andrew. > 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); >> +