From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0086.outbound.protection.outlook.com [104.47.37.86]) by dpdk.org (Postfix) with ESMTP id D66CF3230 for ; Mon, 25 Sep 2017 23:52:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=bN7uzyS8X5UApwTXxE0xoWPfIiBsTJqUGjpQgKRd234=; b=fMrmRSj9sK4/gHQEGVWkWeCuURjzZcIE8uWT3C0uqrP0K+NKdbuj5DMnYd8iKvQdlTgvMLMCj7CMIoVsnIKc5lA6FiiQeoFGOQCy3CUY9ELOkefVw8ltHgDBIeF8NE/JjY0XE3Tazeo3wGPRgBU/iZC1jzxJgGKsB9FxEdSM8Tw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from [192.168.89.224] (31.216.236.195) by MWHPR07MB3103.namprd07.prod.outlook.com (10.172.95.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Mon, 25 Sep 2017 21:52:50 +0000 To: Olivier MATZ References: <20170815080717.9413-1-santosh.shukla@caviumnetworks.com> <20170911151837.25092-1-santosh.shukla@caviumnetworks.com> <20170911151837.25092-3-santosh.shukla@caviumnetworks.com> <20170925073728.auchwn7mxx63b32j@platinum> Cc: dev@dpdk.org, thomas@monjalon.net, jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com From: santosh Message-ID: <8b832367-e8fa-077a-1732-50627e977f9c@caviumnetworks.com> Date: Mon, 25 Sep 2017 22:52:31 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20170925073728.auchwn7mxx63b32j@platinum> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Originating-IP: [31.216.236.195] X-ClientProxiedBy: DB6P190CA0015.EURP190.PROD.OUTLOOK.COM (10.175.240.28) To MWHPR07MB3103.namprd07.prod.outlook.com (10.172.95.9) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 05b585b1-c29a-46f7-296c-08d5045fc788 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:MWHPR07MB3103; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3103; 3:26/hDkqAXJUoP0gdeIpxAtuuTGN9WINxNg9dzi7CYmkHzrXN6U0RT4gh+zJsAwsjPV2DmmPwf2wlADYIry4ZRTIliWPqpsyUYZVVYUmD9hwexITeiOdHAs4PYX0EbTIe2gDV8A+/jj4syMZzcBHHYd/Vqj2c7tNsX13G/qO3rQOU/xeZpVdZrdcuAMbazm68IjvdDEQJAIGT3nIuv+H2BZLY2c/0Jub29ySyjQ8DAhYg00YNNJPeYmgRfuaV9ZHz; 25:cfKtV41qE++CxLoZwxXBe5LoYlp+Lv7088vkadQAokBZK25sQLj6TBJHDlaZr9FYMI1Uxt1lhy2vSTyEyaPzqbTZ2Z8Oyso8diQpI3CG5QNg56JZ0HrW30ab4SWR1TIlhzSTUqCW/RgkbagQ2LARGOYe3z5DpO3plJ2N2r+RZ/urWQYDrIxI/GefsG61wnmJlv30QZk5OyZj5826vD1iDF24Il7hgUjix+92CUq/OfrtVLKUfCLMsMnhFPCvkDsxzOFMGRYYlgCTVpyPHx/sua4y7haA0Dly9rzfq00k92wAjYTAh31cMkvjAtq1dRiFYIdzX+ctIOhTC3dGvEB1fA==; 31:1I0MoNqjyBFhiajCYjhYuq9IEtupN/1fwFF5L2hXH4dZKM1tzQM5b7sw2o0BFwkLLsDaZKKtMoJucP8YL9J9/0wrr/0Mk7btzviDD7+U3Bp56gBaS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tcBR9 X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(100000703101)(100105400095)(93006095)(3002001)(10201501046)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123555025)(20161123558100)(20161123562025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:MWHPR07MB3103; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:MWHPR07MB3103; X-Forefront-PRVS: 04410E544A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(979002)(6009001)(6049001)(376002)(346002)(199003)(377454003)(189002)(51444003)(24454002)(8656003)(6486002)(77096006)(64126003)(31696002)(106356001)(65806001)(8936002)(90366009)(65956001)(66066001)(93886005)(42882006)(68736007)(189998001)(81156014)(31686004)(81166006)(105586002)(53936002)(6916009)(8676002)(2950100002)(47776003)(36756003)(50466002)(76176999)(65826007)(229853002)(58126008)(54356999)(25786009)(50986999)(6116002)(230700001)(101416001)(305945005)(97736004)(6246003)(33646002)(3846002)(2906002)(86152003)(6666003)(478600001)(117156002)(316002)(83506001)(7736002)(5660300001)(4326008)(23746002)(16576012)(72206003)(16526017)(15583001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR07MB3103; H:[192.168.89.224]; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1; MWHPR07MB3103; 23:aMEhHUkm4qVkiB1bn8VHW9czbuVLx7EU6w6Vs?= =?Windows-1252?Q?nloM5Lr4odsBK7eAtDY7JAq5fYHrf2vAHMngrsD+PL7yNCiJ9X5GUSzz?= =?Windows-1252?Q?y/kGvpozTW35RHDhwVMb8OSfJASGm/GLc+SLvNwNaw+hEVcR/oNEd8Ov?= =?Windows-1252?Q?rBmLRk4iZrjh4SXggQ/ys0riB1g1ntmKP6a/Lyc5G9hdNDKqVL1YoHHK?= =?Windows-1252?Q?yy0M4Zz0YlX0+6j3qHpCzBnJCUksXJR8VQqdlUYaCqdafbXIIroUHxnD?= =?Windows-1252?Q?nq8kBschuO1WQXKT/NSzNZc5Z9OPFnMKY2A4LcwjXu4AchGIltv2QHfh?= =?Windows-1252?Q?F96+f/SA81DoOG9EzqKEpSVzTSyUomMI6Tpr71cYXYoY87+ix2rOHPvX?= =?Windows-1252?Q?3J2AwzrbuiIuerCIYqzvdMmby2fQdz7MVCbayBwsnmpu0iha762iu7n8?= =?Windows-1252?Q?L1jabOQeitQSbq7eNFNVbouBgDqNbpY437VXjnIiIzrNTH5QwLh+Wt9X?= =?Windows-1252?Q?b8Yw0WVV3lYOv1lP/OPygGk1cdPgyFw5jhUno0mWOuxXSEpOB28MPFPe?= =?Windows-1252?Q?K/RFCGlhZ/6o+T+UyiaPYH7/FpQpYx1GB6yqqjKgK1VZ9zOkduV0Bck1?= =?Windows-1252?Q?FeCxP+ENw7OIkRKqSq+Ub8Z4rNYs1loaehWu7uuV8aF6F4J346E+nlSv?= =?Windows-1252?Q?JBrirk00aFuwnwU+kLP5Xvh00MD+PxXKQdcNPp1/jgtfa92H1w/R6OGI?= =?Windows-1252?Q?cNlT3dkjkU8KC67+HDeFYZOiHbqknBUZuRjuucNDrEJoWGSySLOqHSsE?= =?Windows-1252?Q?3DE37W0cciR0z7E8AUVjmfLL/FDIuDuxXMWM4lIf1v9i9gGmtijIM5rq?= =?Windows-1252?Q?lQtzz06rWcuaWw/BK4Yhn6QJzDuV5IaKvlVCu7e9UbAHd71na1WclwIt?= =?Windows-1252?Q?cn0b7niLu84uGXaDsAa9jtGD8Vhc8P3Xhxe0+cPMJ8InYGrdML333gMR?= =?Windows-1252?Q?ElGHuzE0y0bxeH1gLeLX7Z0lsWUA9v9SzSJLzBhRvnOlky0AzJU2gf2Y?= =?Windows-1252?Q?lBvaZGnk8+j3KJzJEa5prPLvuSzs3IT+OxCmhfPxrz5zby7CwPUQ2hzu?= =?Windows-1252?Q?ZI23DsnuGfGYShHwzHFepHhZxIS9ZNTkN0OVExIklVaE/bm3p6ZbgSTD?= =?Windows-1252?Q?78oDagIF/TVMEKd2u+Qp8RIptyfLABd3xI1b/Fx2ob0Xc6rT0DvBob4K?= =?Windows-1252?Q?WQfyGJ81Q0koML9yUvoJbVSxKZ0MqC1oI5Bf4ntEFaCqRCu/y+ucHpz2?= =?Windows-1252?Q?Hyf0DyuS8OdZnSk1ZfikETh9Tx6r7a9y6AJnvyPvfFee9oVf7ixLNj66?= =?Windows-1252?Q?FVnxu+/C/xyStqtdgyJLan255WrKmHZAMd1bI/dpziXpvLPmSxZYEd85?= =?Windows-1252?Q?T/bgjGzgXs+zX7alvzzhW/HdDYO4u/uhWoob3A1faDHgyulpH1RH5tWP?= =?Windows-1252?Q?VOxXlxrBLxt+aWkny1K2KPWDAgjQOZ25bF2Tg1yq3/bESENLur1s6qqb?= =?Windows-1252?Q?4EB5WleQSN3Dnef62Cl13x7xd2vRiGyOY2gTJsVW4Am77dnETlaPRBn4?= =?Windows-1252?Q?OHIIzYOOR3Zj/fA6flK+Ti9U4XysvW1la20MAd96EeXGfu6wMLhYdJ2R?= =?Windows-1252?Q?keyZhN+mm5Oa3jQ5AhLRFb/sQxibrU=3D?= X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3103; 6:0P7utdpouLBrOYEcY8vP5Oj/Uud7QUpPzDuxpahVTQbbUGIOj1YSIfSnVaLD9p0KwNy8tjwGSdM6EsoafwxEfxle6rrLDuzrqP+K/Ezss1wnDkaX8oEDLAz74x4Q/v3z0hLqhnUVJBsgraL1JCux5cMFp2mTKPfJhefxOAEPwEABpuOtDO0TjKbcYt1C4JHyn0FZvVvdyv/MWWzqGq4zlMeJQOUOHYsK9M0t3vT3hhqcqbEyuv2erzASpM2Qfdp4F5fRfDbTu/579XrgWILvuP3sT11yQmS3VNHXRVV3QPQZ5PEmuful/Y6X5dywauz96uMraqYuy6a86WuFBI7mrg==; 5:f+wWBFiwGaBPQeIHesTfva8QoRHtijPHyTnG60A69QQoRcgAWq25lr+iEQb/f1S/i5aMDNHcx6OmInFxc8OJSbAJrNQolqka57n+O1N977+Mw8cnCln4ADQNNkG7LubP7aduRoDHOxDvrfMz+2li/A==; 24:GkdtAu7HXjVPIo9rN5yxUaIp1Lez/u8Y4cZio5gkxMfxtAkFRWhhjUmp1kWQfKo7IcS5DTXYkhMpNSaYUnXQfkQ5rcebPgZ/BwyRdoNDwpc=; 7:3ku56wTCL2AKEafJmD+v+H0+kOoJnAjOZRLHEB/d7n7wvz18MOKyf/dgHJEFow6kAnPwwfLA/wg+//OUQ3Hvva/80CoA7It6e/s/kQPombcL0LnxrtM4zSc+j2tNXFdrMtC4CCyVVms13ac254RfMys4bEEy/bq+BoxVDZ0hT/cw53Cm+IJNeRn2ylAlBdPzJ3Lt7yA152rWC0Ti3kKZF+cn1jYIVo9LKmZ6SafPPQI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2017 21:52:50.2380 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3103 Subject: Re: [dpdk-dev] [PATCH v4 2/2] ethdev: get the supported pools for a port 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, 25 Sep 2017 21:52:58 -0000 Hi Olivier, On Monday 25 September 2017 08:37 AM, Olivier MATZ wrote: > Hi, > > On Mon, Sep 11, 2017 at 08:48:37PM +0530, Santosh Shukla wrote: >> Now that dpdk supports more than one mempool drivers and >> each mempool driver works best for specific PMD, example: >> - sw ring based mempool for Intel PMD drivers. >> - dpaa2 HW mempool manager for dpaa2 PMD driver. >> - fpa HW mempool manager for Octeontx PMD driver. >> >> Application would like to know the best mempool handle >> for any port. >> >> Introducing rte_eth_dev_pools_ops_supported() API, >> which allows PMD driver to advertise >> his supported pools capability to the application. >> >> Supported pools are categorized in below priority:- >> - Best mempool handle for this port (Highest priority '0') >> - Port supports this mempool handle (Priority '1') >> >> Signed-off-by: Santosh Shukla >> >> [...] >> >> +int >> +rte_eth_dev_pools_ops_supported(uint8_t port_id, const char *pool) > pools -> pool? ok. >> +{ >> + struct rte_eth_dev *dev; >> + const char *tmp; >> + >> + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); >> + >> + if (pool == NULL) >> + return -EINVAL; >> + >> + dev = &rte_eth_devices[port_id]; >> + >> + if (*dev->dev_ops->pools_ops_supported == NULL) { >> + tmp = rte_eal_mbuf_default_mempool_ops(); >> + if (!strcmp(tmp, pool)) >> + return 0; >> + else >> + return -ENOTSUP; > I don't understand why we are comparing with > rte_eal_mbuf_default_mempool_ops(). > > It means that the result of the function would be influenced > by the parameter given by the user. But that will be only for ops not supported case and in that case, function _must_ make sure that if inputted param is _default_ops_name then function should return ops supported correct info (whether returning '0' : Best ops or '1': ops does support , this part is arguable.. meaning One can say that default_ops ='handle-name' is best possible handle Or one of handle which platform supports). > I think that a PMD that does not implement ->pools_ops_supported > should always return 1 (mempool is supported). Return 1 says: PMD support this ops.. So if ops is not supported and func returns with 1, then which ops application will use? If that ops is default_ops.. then How application will distinguish when to use default ops or param ops?.. as because in both cases func will return with value 1. The approach in the patch takes care of that condition and func will return -ENOTSUP if (ops not support || inputted param not matching with default ops) otherwise will return 0 or 1. At application side; For error case: In case of -ENOTSUP, its upto application to use _default_ops or exit. For good case: 0 or 1 case, func gaurantee that handle is either best handle for pool or pool supports that handle.. However in your suggestion if ops not supported case returns 1 then application is not sure which ops to use.. default_ops Or input ops given to func. make sense? >> + } >> + >> + return (*dev->dev_ops->pools_ops_supported)(dev, pool); >> +} >> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h >> index 0adf3274a..d90029b1e 100644 >> --- a/lib/librte_ether/rte_ethdev.h >> +++ b/lib/librte_ether/rte_ethdev.h >> @@ -1425,6 +1425,10 @@ typedef int (*eth_get_dcb_info)(struct rte_eth_dev *dev, >> struct rte_eth_dcb_info *dcb_info); >> /**< @internal Get dcb information on an Ethernet device */ >> >> +typedef int (*eth_pools_ops_supported_t)(struct rte_eth_dev *dev, >> + const char *pool); >> +/**< @internal Get the supported pools for a port */ >> + > The comment should be something like: > Test if a port supports specific mempool ops. > >> /** >> * @internal A structure containing the functions exported by an Ethernet driver. >> */ >> @@ -1544,6 +1548,8 @@ struct eth_dev_ops { >> >> eth_tm_ops_get_t tm_ops_get; >> /**< Get Traffic Management (TM) operations. */ >> + eth_pools_ops_supported_t pools_ops_supported; >> + /**< Get the supported pools for a port */ > Same > >> }; >> >> /** >> @@ -4436,6 +4442,24 @@ int rte_eth_dev_adjust_nb_rx_tx_desc(uint8_t port_id, >> uint16_t *nb_rx_desc, >> uint16_t *nb_tx_desc); >> >> + >> +/** >> + * Get the supported pools for a port > Same > >> + * >> + * @param port_id >> + * Port identifier of the Ethernet device. >> + * @param [in] pool >> + * The supported pool handle for this port. > The name of the pool operations to test ok, v5. >> + * Maximum length of pool handle name is RTE_MEMPOOL_OPS_NAMESIZE. > I don't think we should keep this > Ok > > Thanks, > Olivier