From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0077.outbound.protection.outlook.com [104.47.41.77]) by dpdk.org (Postfix) with ESMTP id 853F57CC4 for ; Thu, 1 Jun 2017 10:06:52 +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=+kDjzHHy6u+yDv0dze3rTedix11yCi9/MNTeLBZFeYA=; b=inbQpPOb1FJGolq2OFOHc/uGC8PsMccKkIuJAFxqLX+cc9HaBvv9Mp47hiQz3wzCU0CQ1b36Rzl4zXbFTDpS4sI+OzWWPmcbHrk8Nk8axUzBnaridj9fzmfDmS8BkjicDnxhM+que71VeSr551g/8JXCpQbOMbIzmpfI+gEqw8M= Authentication-Results: 6wind.com; dkim=none (message not signed) header.d=none;6wind.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from localhost.localdomain (14.140.2.178) by DM5PR07MB3098.namprd07.prod.outlook.com (10.172.85.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1143.10; Thu, 1 Jun 2017 08:06:47 +0000 From: Santosh Shukla To: olivier.matz@6wind.com, dev@dpdk.org Cc: hemant.agrawal@nxp.com, jerin.jacob@caviumnetworks.com, Santosh Shukla Date: Thu, 1 Jun 2017 13:35:59 +0530 Message-Id: <20170601080559.10684-3-santosh.shukla@caviumnetworks.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170601080559.10684-1-santosh.shukla@caviumnetworks.com> References: <20170601080559.10684-1-santosh.shukla@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: MA1PR01CA0102.INDPRD01.PROD.OUTLOOK.COM (10.174.56.146) To DM5PR07MB3098.namprd07.prod.outlook.com (10.172.85.8) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR07MB3098: X-MS-Office365-Filtering-Correlation-Id: 83e90e53-d325-474e-38e0-08d4a8c5286a X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:DM5PR07MB3098; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3098; 3:hE5aSVrxMiyqX1lNoEpj3bZfKuJy+YEMo7W9uicfwXAp47+pvEnAzxcvJiio1+AdDRa1OYVE8UwOov2QCNlb1DwOUd7DGKy/epG4JL9V6Wdcrtu4ZgPMIQprzSa8SY6IXEm3Kwr4oWgCYxKGiobei+Iyr2M3kJ1qrSDOXB+21qPl3HhuGI4Ugd/2hTfXi2P75mK1I9E2UmYAd58U28ty3XuJuX5/zR5PAVpdiIFjzRLl9PDxtt5PqQW1CCs0zSpCBCZnMb1zSQTLwH8H0s4f50oF75HvHbi+nbiR+nRKFj57yzLMSR++iqeGjyAnUd11fK+/GgErkWKc/OgnhPTunQ==; 25:ut87uheZgQTcyaqgjqIGcY/NiBb6B8uxkjqGm9yZL0n+G1p8v5wsGqnbkG+P6r0WUJ4amzViVZlHkG7gGUD/9Li01M3emMj+ygJ5B92XQ1V2MqIygyC1KE+y+7cfB0CqovZcQ1+cdnJ4LZFeEwkE7WzKxqjawxfbg4mhp/NmvIpmjgWDR7rSg33vK7OdnClljGBFWFGDr8Ec0O+ZcImGSCXYPDk9HbKyCdORNutx+z1AofxnD1mbzW69/ZdLq5XCi8zQyvY2Bne4FR47wm1QsjtsfG6CI4lq0jiTF2inqebAMXs0K3SNs8tUxEOax+2iDW8+4bu1UvVAA9SH51yIZAjKgYPpb8qdcYxKcKXGBeFTsyQZTubAkrgqaGjTnQsHFwbsZjIjpC9q+kubjOMQwfg+mBlhcCMUCIXJxobR89LNeQcn0aTZTEYvnia3zJ02MBRFjX2p/YuF4bk2HAY89Tt5w/TpgCb/WVnjBDr5hPE= X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3098; 31:TytNQrIcPI7gaQUfwSyfzopMWZ2UsAftZ9NP3EHicIIg7Ac9Pwl9W4AstZ4Om1qt2HCtowSy8t7puYIa2PZ4gsopmnI9u8++AXP9hP+tc9TzV4AEgoHVQdTL5uPoby1pwGc+vUAIe4cJDjJyq53Z3nl+xFuvNgRpnPZ5d1UMmjr2n8qQtk2Vn+SHROlu+f+ssYQ8aglCIY713+NAlwe04znhwIaKgB9S2OxRNXjLYP0=; 20:YT61Y82zCM9Gwp5olbJkzM1A9F8T/qkBrfVQxQi4pnA4r9LdjQ0Juqt6LdZ/kQ2IOVX31s3r4WraYZnwXlCe6+biNofzIFbIsqGffrVEL+b4z/l/0WwMe7x84CxreZrmPsHur9+UqStGjuo9fX4wifjcqMaavnhxambFbY43WF8Zt4Qhqe/1rIN4NfQXOI27HLbiRfvonj/qf2EGTPi8XtSIvXOEaiYN+OjkjuqZkPeh6NNS5MmduQBnggOrd9Hticy0t1P7+J2uHiQkvO6sEmHhxDolVco09O4fo5hJLDa3ehIRqvO5gYAh9PTDMmnrhv24cVm7OBN3zCTon52PeJtcXvwMH3vc5c4NboGaF7LMW70B6oAfB6R74prdZNT7C79aJ8UBHeVXO0xfMDWy9k8XXa4xewkjfccjDCMRcf5ssfKefMMzHlukmCnkzk5RVKYkwwOqovTzUbsX0P6+4SScOQW6Z/+mRxp4iGwPCrRv4FrcLyjjvboyWlZTsM5NvRWX7V/b5YJlz03ZemWq0ZOObZsyS5qLgSiB1umfuHHHHI83RyugPxffXooAR1mHDi70BHyerFFoHp5Wor8dfpC+NDsAFKhqjDAh78SFBHQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700087)(100105000095)(100000701087)(100105300095)(100000702087)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(100000703087)(100105400095)(93006095)(10201501046)(3002001)(6041248)(20161123564025)(20161123555025)(20161123562025)(20161123558100)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(100000704087)(100105200095)(100000705087)(100105500095); SRVR:DM5PR07MB3098; BCL:0; PCL:0; RULEID:(100000800087)(100110000095)(100000801087)(100110300095)(100000802087)(100110100095)(100000803087)(100110400095)(100000804087)(100110200095)(100000805087)(100110500095); SRVR:DM5PR07MB3098; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR07MB3098; 4:PTHOBI+pe1o/znsfRh+s938/kjNyxxHgO3lsXZi2zU?= =?us-ascii?Q?1lu/Iqh0Jts1TnqNb4zatSqr0NEwaNR7ldVNFVuexU4BoWvnLbVj3QHEf6N/?= =?us-ascii?Q?i0NMUcmceUk/pZfJdFrG9XkFWavEYzUcXYYpg74m7oRwVNFG8BMK/Sv1FXvo?= =?us-ascii?Q?HqQLY15fI6/1CXFEtH82iJ/Wi8qggIrQQj0x+LCcuFXuZ35FRXJmrCkg2oYp?= =?us-ascii?Q?n2Opg+DTbb7tk0VzW88FH8LlHYGrmWN3jRR2yZZlnxBZWuK8bdkrEEQznLkg?= =?us-ascii?Q?k47raKfW/sBeKAD1+TQ6wrd3EdjSKTLibqmxY+Nii52oKp+RpcBAUUwa2R96?= =?us-ascii?Q?T/gx28/yQhtEB/B50AVwHcyH4AH0ANbHiEvlpLG37j2K9WCbT9pSWLgLuJzZ?= =?us-ascii?Q?oimvZLUfgjuqPVd9XUJoJynzslyRy3VgdT4Nw1ceAV+dvcjm3kzZ0AoRGzfZ?= =?us-ascii?Q?Y5Rzvx2blXirs0Qb8F2y+1ZBt3cxz6n9yTx927k1hmQkiZx64g1e/Qzpf2wD?= =?us-ascii?Q?iYajVbZ47JcM1C55kpdRD1x6CuD5oLIPJHLxb6M7c7zUVguPJdLvrKC4YuQ9?= =?us-ascii?Q?+RCS4zJPsD+Y/QwGLCy6hfoddfqGTlqrfaMV/qOn5JECAw3TO/Hwj+l4pCu/?= =?us-ascii?Q?fd8pGnIrBvAUuC5YgCpCbIUfKhyefDuiG7aN0y7xIWIEOtDLtU2utuXu9g8w?= =?us-ascii?Q?HukGvWD89ppPN7jjQe41mJNpj9pYRQSx754U6iXqSONKVvQ6spmCJTvCMgzj?= =?us-ascii?Q?klILEsL76iREgoI+3+g4X6BN+AjttQLq8xZ7fQj7GqUPuHQR2+qOcraPUQNh?= =?us-ascii?Q?1JwrHb/tgiGIqBwow6v3bDmgNgd+X065MlsZhG18YLgXYMCk+9M15lm7g+pu?= =?us-ascii?Q?D9UwYpUQXF8YQHxlGGIzCIyuo8I1DfUNNVbOdq4i1o564uTHBc7AKBtBCaZf?= =?us-ascii?Q?Dqxy185svu6qBcmvlJTzisGr6FWG/PqqF0yHuLV/M5Xl395apUcn4W9rWSWk?= =?us-ascii?Q?s2kIIi1vu+K75PmJA+20XmdaiAD7luSGh/RefQ7D60xwmM6j3/yiZXfhHxFn?= =?us-ascii?Q?Ljl+asBBIzLVy1MoQdctQ267jBZvwpr2HCIfvjUikWXGHCp0x+gBDa0QQo0L?= =?us-ascii?Q?roJi7QX7U=3D?= X-Forefront-PRVS: 0325F6C77B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(39450400003)(39850400002)(39840400002)(39400400002)(39410400002)(189998001)(66066001)(47776003)(107886003)(38730400002)(110136004)(6116002)(3846002)(5660300001)(5009440100003)(2906002)(48376002)(50466002)(478600001)(50226002)(8676002)(81166006)(53936002)(1076002)(76176999)(25786009)(305945005)(50986999)(6666003)(7736002)(2950100002)(42882006)(6486002)(6512007)(5003940100001)(33646002)(72206003)(8656002)(42186005)(36756003)(6506006)(4326008)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR07MB3098; H:localhost.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR07MB3098; 23:kDoCzdhTqpI/Nr8WRYYw59rYk0QMO84vCSN9VAxXd?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JJlM2Vv1KyOE2/zPoaDvfum4CiXsI+80hQ9IC0H3gKCceH5uDojweuSgEAp7Qq1yoZ6NsMP7dK1zIYsgSe/KO1jOYhhSo2WSmKTro5t1nuqJuSmH5+Q6mMo8ik+ApgTK8ahhWtoe1LQVE3yLQUFDdZk85XMka76T2ypfxlYwaN+G+YBwRqvRG/kRZpMrxoPXCUJdt9YQiaSUyaaPujDvDWBHD92bSIMbcCe7DJyA5r37XM7l9RZ8qetjTo7//tmA80n6D+Z7I148hmYtqamoxLIBrSU+AnvHA44FIIpsevOwnqhB3ftkWDdXCol5zkbbzguIa0wEFTnTPrkGqCCQGa5I0SGF3sfB3KmpgpsTVKBfV; 24:RO531245NZQutcCs2qEFgrTBZv6gCpKTEJE+PHpVFBRA/zYpzrmesJRbkC0B1tLwcI0fBQv4zAFbSHAho3rAMh3Hrji08/l+CPururVqzqQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3098; 7:wLalFNPmPX69D0K2ImmYxnhzRdDE29PQpvDRZiZeFMApsDN6IUGfpkILnsnaSpteChzuwGohHFZ00J1TQQBARPobTfRf6kHP/uwFaahgwEmxOYRvuXvKoq9mNoheCrPy4IvymB0g3eJ5MnGLq0Dew2F76AUxWQgv6wcDdJqnf10+UY4CjUC3/WlyGZVcDMoUbRCK+FArmZuuAv0qS/rwSyGOGiTJC4FwBCawBEUU3g1+n/53y9SlW1e14dwxtJbw8+V4MX0zzWoGYcjrC8pclVPoi0L4XwWrpdFP3Cd89VfYC0ZX8FAV4Qh5O3J2z8DL5fw/fHkMetKSMYUu5TlCMw== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2017 08:06:47.9124 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB3098 Subject: [dpdk-dev] [PATCH 2/2] ether/ethdev: Allow pmd to advertise preferred pool capability 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: Thu, 01 Jun 2017 08:06:53 -0000 Platform with two different NICs like external PCI NIC and Integrated NIC, May want to use their preferred pool handle. Right now there is no way that two different NICs on same board, Could use their choice of a pool. Both NICs forced to use same pool, Which is statically configured by setting CONFIG_RTE_MEMPOOL_DEFAULT_OPS=. So Introducing get_preferred_pool() API. Which allows PMD driver to advertise their pool capability to Application. Based on that hint, Application creates separate pool for That driver. Signed-off-by: Santosh Shukla --- lib/librte_ether/rte_ethdev.c | 16 ++++++++++++++++ lib/librte_ether/rte_ethdev.h | 21 +++++++++++++++++++++ lib/librte_ether/rte_ether_version.map | 7 +++++++ 3 files changed, 44 insertions(+) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 83898a8f7..4068a05b1 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -3472,3 +3472,19 @@ rte_eth_dev_l2_tunnel_offload_set(uint8_t port_id, -ENOTSUP); return (*dev->dev_ops->l2_tunnel_offload_set)(dev, l2_tunnel, mask, en); } + +int +rte_eth_dev_get_preferred_pool(uint8_t port_id, const char *pool) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + + dev = &rte_eth_devices[port_id]; + + if (*dev->dev_ops->get_preferred_pool == NULL) { + pool = RTE_MBUF_DEFAULT_MEMPOOL_OPS; + return 0; + } + return (*dev->dev_ops->get_preferred_pool)(dev, pool); +} diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 0f38b45f8..8e5b06af7 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1381,6 +1381,10 @@ typedef int (*eth_l2_tunnel_offload_set_t) uint8_t en); /**< @internal enable/disable the l2 tunnel offload functions */ +typedef int (*eth_get_preferred_pool_t)(struct rte_eth_dev *dev, + const char *pool); +/**< @internal Get preferred pool handler for a device */ + #ifdef RTE_NIC_BYPASS enum { @@ -1573,6 +1577,8 @@ struct eth_dev_ops { /**< Get extended device statistic values by ID. */ eth_xstats_get_names_by_id_t xstats_get_names_by_id; /**< Get name of extended device statistics by ID. */ + eth_get_preferred_pool_t get_preferred_pool; + /**< Get preferred pool handler for a device */ }; /** @@ -4607,6 +4613,21 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id); int rte_eth_dev_get_name_by_port(uint8_t port_id, char *name); +/** + * Get preferred pool handle for a device + * + * @param port_id + * port identifier of the device + * @param [out] pool + * Preferred pool handle for this device. + * Pool len shouldn't more than 256B. Allocated by pmd driver. + * @return + * - (0) if successful. + * - (-EINVAL) on failure. + */ +int +rte_eth_dev_get_preferred_pool(uint8_t port_id, const char *pool); + #ifdef __cplusplus } #endif diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map index d6726bb1b..819fe800e 100644 --- a/lib/librte_ether/rte_ether_version.map +++ b/lib/librte_ether/rte_ether_version.map @@ -156,3 +156,10 @@ DPDK_17.05 { rte_eth_xstats_get_names_by_id; } DPDK_17.02; + +DPDK_17.08 { + global: + + rte_eth_dev_get_preferred_pool; + +} DPDK_17.05; -- 2.11.0