From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0071.outbound.protection.outlook.com [104.47.32.71]) by dpdk.org (Postfix) with ESMTP id 21DCF199C8 for ; Tue, 12 Dec 2017 19:58:43 +0100 (CET) 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=W0a2NsDBuQGwL4mBX7UhD35CicXODNN5uI/EArtkQ0U=; b=YKMMDstyW/9F8SXsaSjqXjF8lh7mMKCVRcFdR7By8yQzQft54903B3xagI3wU40tno5f9pafZ9ce3Uv9jJ0p3IMXOgVD0u3NG0Gf/Y4CD780HyFw2GuXIeOwgO5YqN4sqjTkbXYApcjPC40O5W+byJ4zJ9iSfWBbRnVTVT4O7RE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from localhost.localdomain (111.93.218.67) by DM5PR07MB3468.namprd07.prod.outlook.com (10.164.153.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.302.9; Tue, 12 Dec 2017 18:58:38 +0000 From: Pavan Nikhilesh To: jerin.jacob@caviumnetworks.com, bruce.richardson@intel.com, harry.van.haaren@intel.com, gage.eads@intel.com, hemant.agrawal@nxp.com, nipun.gupta@nxp.com, nikhil.rao@intel.com, santosh.shukla@caviumnetworks.com Cc: dev@dpdk.org, Pavan Nikhilesh Date: Wed, 13 Dec 2017 00:28:09 +0530 Message-Id: <20171212185809.15482-1-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171211150528.13236-1-pbhagavatula@caviumnetworks.com> References: <20171211150528.13236-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: SG2PR06CA0090.apcprd06.prod.outlook.com (10.170.138.16) To DM5PR07MB3468.namprd07.prod.outlook.com (10.164.153.23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c49a4c96-b63c-4f18-48e6-08d541925ca1 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307); SRVR:DM5PR07MB3468; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3468; 3:8YJDQDIRMOOgC3aOPUNsHM2zAPzkZzhfCDRj/TO397BWcRMgb11gvfMapno9ecy8Cuk4EXJFAb34Fbq5W7FcR1TvB9wjWGg5eQ3ffU9aRTLpdfKGBkn/XhoX/d23+bdDERlgWAyDIsRdSp8LnTwpD0TpUb7NSccyWqnYsVZ2KALK0o/HcGvZHjyGv8pjlDx7RAeaJ3W2roVktk2ni8Fs+BHJFatPKiGaJpF9GcsKk0VbcKcowZWODuZHaXYR255n; 25:7GbnLSv19hb+GOsAIlnrwqLMpihh4P/jeFgtWPnScc1BGnaTiT7h5zAXgdenPoNTIG2i7n35k/eOf6Tb2+wZ99XdmQ6cgEiBXUmEB4BN7nG/3ssoAL0HXzOwc9jFjIxBiwxi7Z72Oznmkrk0Z3PueCJHlxwC/5fztC2OvG7PF7B/5FaPVfhMarJk/qRa/rVVLF/UuYzQiOtddqVryhMzow35H43ZmTX7mB+Qx6qiWhSCGvmODZT+HRsGsfbVht69c64xxzPjfvZ6x9Ic7i1AGy2WnzomIZ9zayDorl2HfoYwPjCVlyZ3NpvPtrDAJ/2Ikx3lRA7XzuWHhrHIg/jjgw==; 31:Bsiz37dS27s99KEeTZoTqFrRA4w9oQyGMY1gwXhnrpP54a5VGtpgSXimVylQCXhpnhN0KbZBYWoRYrO8k31I/1x0GHVDiOUqtqYCtRi47FqpjKP+u/WsZuOMAH3eLT/mB0HW1FR2pvwjI9T5QpWR53sSuSrNW6Zcp+7R1Bmp8ltT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qZRXu X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(8121501046)(5005006)(10201501046)(93006095)(3002001)(3231023)(6041248)(20161123564025)(20161123558100)(20161123562025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(6072148)(201708071742011); SRVR:DM5PR07MB3468; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DM5PR07MB3468; X-Forefront-PRVS: 051900244E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(346002)(366004)(376002)(199004)(189003)(81156014)(8676002)(2950100002)(36756003)(7736002)(81166006)(47776003)(6636002)(6666003)(66066001)(4326008)(575784001)(97736004)(8656006)(16586007)(316002)(5660300001)(16526018)(25786009)(50226002)(305945005)(2906002)(52116002)(6486002)(68736007)(6512007)(1076002)(6506006)(42882006)(53936002)(107886003)(478600001)(6116002)(106356001)(105586002)(50466002)(76176011)(3846002)(51416003)(8936002)(5009440100003)(72206003)(48376002)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR07MB3468; H:localhost.localdomain; 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: =?us-ascii?Q?1; DM5PR07MB3468; 23:ixZgzIoyZI7JcsVSlAL4xQI/vA4qAJAMiGnKVsKZB?= =?us-ascii?Q?83OGf4hayaf0hI4iuHfDC61b1lIC12DNlbjw1eKJOjWPWdipRk38xNeDNhnI?= =?us-ascii?Q?9gmdIb5wFdbjf5PnENOlrCP7LQi0aYrbCD/OVF++9Yk4cu/L5Non7hS2qLi0?= =?us-ascii?Q?wIL61XHEetDXC9f4Au25ZomSAWj23+rDV/c8fRatxpDv0+/CegBXvTBl/r15?= =?us-ascii?Q?CbVun6Q510ZnuhNmdwmszs6dy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Z74ze6om44rIvD4wKOPz9k7cjEaWS/HJfcTBVJpYMfT3qyHCA=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3468; 6:D/iDzEDe8fMet2sTvMi/nbD/kYzDBBrFybGLE37VK0RAsPJlmC9SW8vn23JWkkwvVXFxW/X9enVUX1kMqjgUH1Bk6nyeWDZSOJyjKSpv/YwbWblOM2M5OvxKDvHAK+xl/MYMca13bILtKIcFzHrCrZzjg/xKGr7jAPU5DBO1UpkLQuwCFzUWYMPj+x3sKtc3w7rntsR1M2/0G+zIRIlsTrwpM07ZBQYyu3ku3TtsothxW+yup6Vt9omALiDLg+4klkuliSVXRoDZRccUZ6J2mfcL4/SKnrqusDncfPyncfvGz7A988wPZLdZajuIeDH3yP2WEBl/zkgRNcwwHPlBrYpFLWx75qjNTBHlEVxpf5E=; 5:+DbzoBu4Vj9EO6cieLhHNt1klNa9V57GNvVa7VQi5hsM+nTWwnkcBYePgcoJAmU2Nxddub+28By5lac8RfPjgaw417zEDXpxqzO3QkCQuZoCMAXkTzbZ7kBOW14gttH+HkopogAja5+n5sdLt7tv9RGHKdXk2pjmky8jSRDZfAE=; 24:QUuja8M5EcrUYECBHLz6+5vG7jKy4DRsOQSkESzG2XefU2S0TtrV0K9wGDudS9gptqv77pSwMcuRpU0ej1dC7ubHqvGUC6Iuhn0DRX/s8Yc=; 7:eT/QYeuTnVN8ImEZY6PrWpuxiB53uRXQoTPUF0kHzpTnm2+GbjRaVwWwu35rkKA1g2I8PEb+N4TzmubIb5QS9mkBjfzRsJdyStClxkFFP0xAcmb5kWrsJtWuTGA0EF3VY2J/ibrxp9injk6t0XPuuQmO/6v5ig9rGbi/BwMJDx2fcYNptS/AZi8Lm24gJBMvFXFB+fY6hzRxLsdbJKBhT+9MI1XdJJGD2kIE0RqbIqX19wwS2ZVCtLRfc+6oClYH SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2017 18:58:38.5553 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c49a4c96-b63c-4f18-48e6-08d541925ca1 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB3468 Subject: [dpdk-dev] [PATCH v3] eventdev: use links map to unlink queues 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, 12 Dec 2017 18:58:43 -0000 The octeontx event device doesn't store the queues to port mapping as a result it cannot return the exact number of queues unlinked from a port when application wants to unlink all the queues mapped (supplies queues param as NULL). Using links_map we can determine the exact queues mapped to a specific port and unlink them. Signed-off-by: Pavan Nikhilesh Acked-by: Gage Eads --- v3 Changes: - Clean up unneeded variables. v2 Changes: - Fixed issue when invalid queue exists in between valid queue id's of the queue list. lib/librte_eventdev/rte_eventdev.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c index e0c2a7876..fec252bf1 100644 --- a/lib/librte_eventdev/rte_eventdev.c +++ b/lib/librte_eventdev/rte_eventdev.c @@ -888,7 +888,7 @@ rte_event_port_unlink(uint8_t dev_id, uint8_t port_id, { struct rte_eventdev *dev; uint8_t all_queues[RTE_EVENT_MAX_QUEUES_PER_DEV]; - int i, diag; + int i, diag, j; uint16_t *links_map; RTE_EVENTDEV_VALID_DEVID_OR_ERRNO_RET(dev_id, -EINVAL, 0); @@ -906,13 +906,29 @@ rte_event_port_unlink(uint8_t dev_id, uint8_t port_id, return 0; } + links_map = dev->data->links_map; + /* Point links_map to this port specific area */ + links_map += (port_id * RTE_EVENT_MAX_QUEUES_PER_DEV); + if (queues == NULL) { - for (i = 0; i < dev->data->nb_queues; i++) - all_queues[i] = i; + j = 0; + for (i = 0; i < dev->data->nb_queues; i++) { + if (links_map[i] != + EVENT_QUEUE_SERVICE_PRIORITY_INVALID) { + all_queues[j] = i; + j++; + } + } queues = all_queues; - nb_unlinks = dev->data->nb_queues; + } else { + for (j = 0; j < nb_unlinks; j++) { + if (links_map[queues[j]] == + EVENT_QUEUE_SERVICE_PRIORITY_INVALID) + break; + } } + nb_unlinks = j; for (i = 0; i < nb_unlinks; i++) if (queues[i] >= dev->data->nb_queues) { rte_errno = -EINVAL; @@ -925,9 +941,6 @@ rte_event_port_unlink(uint8_t dev_id, uint8_t port_id, if (diag < 0) return diag; - links_map = dev->data->links_map; - /* Point links_map to this port specific area */ - links_map += (port_id * RTE_EVENT_MAX_QUEUES_PER_DEV); for (i = 0; i < diag; i++) links_map[queues[i]] = EVENT_QUEUE_SERVICE_PRIORITY_INVALID; -- 2.14.1