From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0053.outbound.protection.outlook.com [104.47.42.53]) by dpdk.org (Postfix) with ESMTP id AC26A90F2 for ; Thu, 31 Aug 2017 16:56:13 +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=z5s1TsVSEb4Q7SwNbIgMlgoo8TbM3X6H3GcLAUCVoqg=; b=hRPC9NJUncaoFvoDouJN+n9DzvgKYgwJlbaaUDvkxqQZ1IwzVf7gAoRT3pCfG2rzMw4VpwOEDiVwqX70s7co/lfmMy4lzAbJEoIj4TLRPGG12kfikRKFeV/PqdmDkAnM8Uglvu4Lz522NDMBJolADClLn5UZzmi/xPz/sFWWOC0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; Received: from jerin.domain.name (171.76.126.71) by SN2PR07MB2526.namprd07.prod.outlook.com (2603:10b6:804:6::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.13.10; Thu, 31 Aug 2017 14:56:10 +0000 From: Jerin Jacob To: dev@dpdk.org Cc: ferruh.yigit@intel.com, santosh.shukla@caviumnetworks.com, Jerin Jacob Date: Thu, 31 Aug 2017 20:24:31 +0530 Message-Id: <20170831145436.5397-22-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170831145436.5397-1-jerin.jacob@caviumnetworks.com> References: <20170831145436.5397-1-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [171.76.126.71] X-ClientProxiedBy: MA1PR01CA0109.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::25) To SN2PR07MB2526.namprd07.prod.outlook.com (2603:10b6:804:6::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 67181b4a-6fd3-40a2-d8e7-08d4f0806bcc X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:SN2PR07MB2526; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2526; 3:ICBY9/XOGjTLBwRRZwlpMfdGoSGW/75Ke9CPk8ulWztlVjjNgrv9SW54k2pDHTtfNzA4HyuU9XkzSg9XQe6b7g6/uMiGbN5PhoIGY7FnG+i/ak47uauJQBL92Geg+petzHVPsm+bNE/VRWH8ujHbV6i73gbrNr29Pg30TqR8zJP+0mPGYj/1Y5SxhoTPhbiYcaztd2fXPXgAlapshyXGz2zcXCW7voJ03Ys7xmvY91sIUuqtWXyxwc3YHji8FD+Z; 25:eOzPAmdhpNpZSEqFiCRkTylzzDZpwHBu+9tI5p7r8VR+hWo+dl3g5EQOOtusQBAtAhEnWQpQQ/mTHmoc4Yo62BZPRNb2DDFfdAU7SbBUWv8714te7bCYnMKr2g1MuM3adBrZl00YYg6tZPbYa4ChRKi5bUqFjXjyS9wQ4uukwBbKtH6uO8GvJ73jsu9NGvfb9+By96BO50b21bZEoFa84Et7tNxbIrLxIHFkL5auuuUoX+pYO8258b4KvJyx0q7noRtAV0vXnRRP8UFkVG2yOjN806UDqBXfL6NQD86E+c0Oszh2YaImUIHnqMqI2QQjKp0BCu75ihDZCIi80AXU3A==; 31:VsbGrilhKd4dR7FYYPoVb4mLV5nJ/wTiM8A8Ex8NOki1nBO71mEgY/YMXTjx04yDNXXAwu96mkJxs7WTjU/IfRmo3turjYyfLCOH+7lhe2jemaizk4Gs0Q3KhlDEQdu/e5t6KKsHlrCZASlncYD/h9Ii+3R/c+vCD52NO8rEk+RlC3dD8ROEul6vA/PpoYfVEm0jrStZ9ivbmeLaI/ja2un+LnzWYOiVaLTKo8zPZ6Y= X-MS-TrafficTypeDiagnostic: SN2PR07MB2526: X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2526; 20:hAcWpqowfbZdixftmyKGxGN/DhHYe9ic7xuvpB0qFFqogywTAJ0UrhUvaK54+oIWBwq6JLK/LXXR1GO3UIkURwLna1N9puLfOl7uA2TirQEemNh6eeSTfDq7yXG8BW1S/XU61HGIb8IgQMdg6HGYgi100epG4Qz+LJXOXzp7RBIIa8qB3se4VczD6GF/V2sZOe1A1mQHVkr2tyb+ndnwMU09hs9qjH2+PRy0f3v6IKzW0BWZct3N8TQGvKRw2oOy58gfkYVxKBkScuwRt7SwO4IUHhNinpQ2dN8CkmkZJUZOXfnicAUjCxDy5PriAKQ3WOwfHh9pop4W20/5cWSuLW+QKRMFxFM2I1S69Lroaem8FJ+ZiX0maGaHkLgWsvU42H4eolMpozrSUdtZbdBkdLE0IoOAr7idZqCt0YPv7PegL2hQqMNPR3jwbCrkh8RyZT4uoCjB1cp5ijYAFkz56OQIduPvfCJCZHF1EmAOKcqF35EOIbpgtbAJnPEnFx9PL6NqCvBLAgA5KiamTi4yO7Pmz18MTKJxL7DE3himIs4ePW7inMg9bLf84l64JODg8faQ1SHNhxsrKllYArnu7GN0aIb4WphIIRLb+xl64oA=; 4:6hRvkl3BdpBREM5tC68NiZHpD/WrVfPra+XUjl7JvsRv/PstMCY1hTDyDgVycr/pFJRHLGXZt0kUGAUoymxjp3XCp75f8RjYYEhwODLGPSm2kQ+HQK2Jj/7spalWBZiJ70ABK3E7K9DXxomXvDgMl1ry1ZQBroMsXQ7ujJLmn5KLs3itguLI1Jm2K9eygQS6cVPVmeQckbyvxeIQw+SM36gyeGD7QSwD08ECf6zDQvsGjGgeJe1cnCRt4tKP2R0A 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)(601004)(2401047)(5005006)(8121501046)(93006095)(100000703101)(100105400095)(10201501046)(3002001)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123564025)(20161123562025)(20161123560025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:SN2PR07MB2526; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:SN2PR07MB2526; X-Forefront-PRVS: 04163EF38A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(979002)(6009001)(199003)(189002)(25786009)(1076002)(53936002)(3846002)(6116002)(478600001)(110136004)(72206003)(7736002)(6666003)(107886003)(6512007)(305945005)(6506006)(36756003)(6486002)(68736007)(5003940100001)(189998001)(50986999)(42882006)(106356001)(101416001)(76176999)(2950100002)(6916009)(5660300001)(2361001)(33646002)(2351001)(2906002)(4326008)(97736004)(105586002)(48376002)(50466002)(81166006)(66066001)(69596002)(8936002)(47776003)(53416004)(8676002)(50226002)(81156014)(42186005)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR07MB2526; H:jerin.domain.name; 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; SN2PR07MB2526; 23:BFtkfKNQ7iIwj0EckdNtpdV8K8coRqR1GXNnTCsDg?= =?us-ascii?Q?B2h/OIjW6atKoj6J1TmJy2BD96tDw3h1ukCTKnIHH3n5KGo6aRBezor7hdyq?= =?us-ascii?Q?wzO6KqEJozN5peKXtSrSi5JkU53zQ3iYcySnEM2ri1Fkkr80fz5Yc5GTh0vW?= =?us-ascii?Q?oUFlYx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KnHc83qFRwSaeI7BrIAIGoxP6aZuwLG9iQS9lkA3SbHp/IKTt845xtwhu3P/9sFXCGGa+VWl0qm8BQfkw60= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2017 14:56:10.4899 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2526 Subject: [dpdk-dev] [PATCH 21/26] net/octeontx: add Tx queue setup and release ops 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, 31 Aug 2017 14:56:14 -0000 Signed-off-by: Jerin Jacob Co-authored-by: Santosh Shukla --- drivers/net/octeontx/octeontx_ethdev.c | 88 ++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c index e2f1e630b..c5e324346 100644 --- a/drivers/net/octeontx/octeontx_ethdev.c +++ b/drivers/net/octeontx/octeontx_ethdev.c @@ -588,6 +588,92 @@ octeontx_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx) return octeontx_vf_stop_tx_queue(dev, nic, qidx); } +static void +octeontx_dev_tx_queue_release(void *tx_queue) +{ + struct octeontx_txq *txq = tx_queue; + int res; + + PMD_INIT_FUNC_TRACE(); + + if (txq) { + res = octeontx_dev_tx_queue_stop(txq->eth_dev, txq->queue_id); + if (res < 0) + octeontx_log_err("failed stop tx_queue(%d)\n", + txq->queue_id); + + rte_free(txq); + } +} + +static int +octeontx_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx, + uint16_t nb_desc, unsigned int socket_id, + const struct rte_eth_txconf *tx_conf) +{ + struct octeontx_nic *nic = octeontx_pmd_priv(dev); + struct octeontx_txq *txq = NULL; + uint16_t dq_num; + int res = 0; + + RTE_SET_USED(nb_desc); + RTE_SET_USED(socket_id); + RTE_SET_USED(tx_conf); + + dq_num = (nic->port_id * PKO_VF_NUM_DQ) + qidx; + + /* Socket id check */ + if (socket_id != (unsigned int)SOCKET_ID_ANY && + socket_id != (unsigned int)nic->node) + PMD_TX_LOG(INFO, "socket_id expected %d, configured %d", + socket_id, nic->node); + + /* Free memory prior to re-allocation if needed. */ + if (dev->data->tx_queues[qidx] != NULL) { + PMD_TX_LOG(DEBUG, "freeing memory prior to re-allocation %d", + qidx); + octeontx_dev_tx_queue_release(dev->data->tx_queues[qidx]); + dev->data->tx_queues[qidx] = NULL; + } + + /* Allocating tx queue data structure */ + txq = rte_zmalloc_socket("ethdev TX queue", sizeof(struct octeontx_txq), + RTE_CACHE_LINE_SIZE, nic->node); + if (txq == NULL) { + octeontx_log_err("failed to allocate txq=%d", qidx); + res = -ENOMEM; + goto err; + } + + txq->eth_dev = dev; + txq->queue_id = dq_num; + dev->data->tx_queues[qidx] = txq; + dev->data->tx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STOPPED; + + res = octeontx_pko_channel_query_dqs(nic->base_ochan, + &txq->dq, + sizeof(octeontx_dq_t), + txq->queue_id, + octeontx_dq_info_getter); + if (res < 0) { + res = -EFAULT; + goto err; + } + + PMD_TX_LOG(DEBUG, "[%d]:[%d] txq=%p nb_desc=%d lmtline=%p ioreg_va=%p fc_status_va=%p", + qidx, txq->queue_id, txq, nb_desc, txq->dq.lmtline_va, + txq->dq.ioreg_va, + txq->dq.fc_status_va); + + return res; + +err: + if (txq) + rte_free(txq); + + return res; +} + static int octeontx_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx, uint16_t nb_desc, unsigned int socket_id, @@ -766,6 +852,8 @@ static const struct eth_dev_ops octeontx_dev_ops = { .mac_addr_set = octeontx_dev_default_mac_addr_set, .tx_queue_start = octeontx_dev_tx_queue_start, .tx_queue_stop = octeontx_dev_tx_queue_stop, + .tx_queue_setup = octeontx_dev_tx_queue_setup, + .tx_queue_release = octeontx_dev_tx_queue_release, .rx_queue_setup = octeontx_dev_rx_queue_setup, .rx_queue_release = octeontx_dev_rx_queue_release, }; -- 2.14.1