From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0061.outbound.protection.outlook.com [104.47.36.61]) by dpdk.org (Postfix) with ESMTP id 6A0C01B260 for ; Sun, 8 Oct 2017 14:46:15 +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=kLuXojywiRlvb9AdNK7cFAPnRq2nNqBxrC5zu4AHTiE=; b=QuOjoGSQqZgoxfMxLDmyEZStRCMG/dQ8XGKZNKFJuhc8IWRkP0tG4G51VzMovZlvk5CFNPSx3s7/acp9JOi5RpyZXXCnUW1B8j4/DsER4Ear5LtRRGAuGU6KAR5L/r8ZAPWxju9T6HM5VDlC4OMKgnnS5p9GGNF9vOCyeWW1wdw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from localhost.localdomain (14.140.2.178) by BN6PR07MB3089.namprd07.prod.outlook.com (10.172.105.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Sun, 8 Oct 2017 12:46:12 +0000 From: Santosh Shukla To: dev@dpdk.org Cc: ferruh.yigit@intel.com, jerin.jacob@caviumnetworks.com, Santosh Shukla Date: Sun, 8 Oct 2017 18:14:25 +0530 Message-Id: <20171008124430.1866-22-santosh.shukla@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171008124430.1866-1-santosh.shukla@caviumnetworks.com> References: <20170831145436.5397-1-jerin.jacob@caviumnetworks.com> <20171008124430.1866-1-santosh.shukla@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: MA1PR01CA0113.INDPRD01.PROD.OUTLOOK.COM (10.174.56.157) To BN6PR07MB3089.namprd07.prod.outlook.com (10.172.105.7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4c50fe66-e601-464b-eb66-08d50e4a8fa3 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:BN6PR07MB3089; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3089; 3:a+tcr/sq8gnfNA8+wRBgErcXMb8nI1ev625uobB933nMemEGW2sC5CkOdwWaxFLRLr0J0uVlFbQXgaO0E62VJt1pcG8LwIX65lvNrdBIkHe8DnQx3LMqqxQhKgLaw6MYa56M+CggCQspqaKDPy0n2JyPDnC5ojYpYc+VbaR+rFFB5gK4GgaJtlO77nkb/NRFA5HWl71Y9dWmJksPynD5bfVuinzm/hDJggkGnf3fJ/cI85SVK0h1/WSqqI2tiiV7; 25:E55WLzskSR9I27/PqNeb2pEsIiSgg/QueU2Y2b9imNU1//TbYTwy1yFftus8cYZDUNT/Y289SoufYjwidosaZYOWxhU2Z4oLZai8VsiF98StTNWsiAUZBVW4xTYJ3V8awckEJofyhIN8XVrYlhWx9JtgBybWcaIi2V3yWOPALNiBqhVS/Jn5acw/ykdUOZmdsXri+e22Qbx+zs2G4bekkbsNh+kF6V/brlt5ss8qt9jSSRzlY2paXx2yEsQ/9VBA0oPISgOVRnU3tGrlmu9aQzH2te/cMiW9QgXBrNbYGSeFgyxV55SOeBsdCVDN0b9Zc64UoCJfy2Q17Mm+UduUdw==; 31:O2ovGPRu7P5oHhgIUk9wBEXiT5VWAm5lyXKTmWKcWTPvBpshIL5FI82ESTPBopK610BsJiKhcy5X6TapgqLSlt4uA65mIoItXxVat7xQesXMiobs8CbSY8U4YL6n+PSkBM2wIddAkmpaV4YfUg34gfEVNRl3hxXPnXP0Gv6vpAl9CJdr4sYNYCYFigI/Fb2mVnQFdi9bZUR0oIiYg9I5GLbZehoLKmeUGuO3WXHXdNg= X-MS-TrafficTypeDiagnostic: BN6PR07MB3089: X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3089; 20:0mVNaYDPiw5+glGxIZtJ9IqEkOIb4b7eK3smTYYDCliqZZoVH6xXRsjYWfcMyEinlXpMWxuX5a5LlWEqVGsc173rrHUQ5clyWNpjlsmnSXwutIXImAbdmQ8JIHxqFvXj9/hvsyXF8oa97+w2V1NbWzRjRVqkvOg7ROzOqZxSXjx4GykzMfwo19Pz08OPaKPPF9tlj+NXWcK3ccANvorpSVHeTxMxVZNKR7PNSTlArCKVFUSDRdFwNS43NnP3VoEgU2Myk6c0C6lza7+pQfQNb/FcpELcZypFjEgLKh0TfzabMXqoGhm48LvYKJkj49tNFhZU7/VGtilSw7+RWqh8FAoqabNhxypksM3rXr3O8PcnhRw5fdiYBMpiQ5X4MYm1L52EWTm/OaompPwNqECwB4iXdBAxONY2Eui6wu+JWjQ0+18zsBA+h3kv8FbzzAVND82Dttxm6b7lxJTaAIitGnXXunhGnu451+OsZ6UayLCw1fGSeL5fGJjC+5y1YPMXeYkJy8Or++bZr9c/eM1d2ftOzEStvSbaBHToc0MLchFfalR24iZ24XCbNKvReVSv8MAlm44Cu3JVGvt3ZhGVwK92wPQwZc5kQRGuKRotQyM=; 4:/aRoacTZhQ1Bch0CEfq4UIZki/xK/txsI4PeLU34vgayhGky+bWAEIFtx67ohsmK8HX+732bMz07Pz2/byhmSwu1R0zH90UQxaX5oOLh7Teako0Wsns3r31kLIPoBVFqAvhqXd15veNJwtZyYrcI+G57oK6ncTlRnee7NfjlXgk1YTGV6Xfc5GS2D6ckS1XVBco2jcS0q1YLLk44tZSId4FnZXIeFK+B0U1FEXG+FN0uoIUSB9bsCiUw1UMjTjwr 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)(8121501046)(5005006)(3002001)(10201501046)(93006095)(100000703101)(100105400095)(6041248)(20161123562025)(20161123558100)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR07MB3089; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR07MB3089; X-Forefront-PRVS: 0454444834 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(6009001)(376002)(346002)(199003)(189002)(6916009)(42882006)(81166006)(2950100002)(81156014)(8936002)(50226002)(6486002)(16526018)(6666003)(189998001)(16586007)(316002)(6116002)(1076002)(6506006)(3846002)(7736002)(305945005)(8676002)(106356001)(105586002)(5009440100003)(53936002)(4326008)(66066001)(107886003)(47776003)(2906002)(5660300001)(6512007)(76176999)(5003940100001)(50986999)(97736004)(25786009)(101416001)(68736007)(48376002)(50466002)(478600001)(72206003)(2351001)(2361001)(33646002)(36756003)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR07MB3089; 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; BN6PR07MB3089; 23:/PXOoz5Rl4XuBuJH0xt6W0LHwSsKxSTwMdntWZUkr?= =?us-ascii?Q?VKLGIt0OC65FaJN9nXLYxSg1fIZYX2fIv+UQkFkolqSQpGV539G2xsd1AIdz?= =?us-ascii?Q?L8i42wilgt82rbzeK3YJw4fadGGdB4lsisYo4ast+yaRpXbcPwHGuqBnRSvW?= =?us-ascii?Q?MPMfc/mWRrQccf8LYUDYQfGTaOrBopvU8atzdqND4nh65jOeIHVo5zJEGcfV?= =?us-ascii?Q?ce+rkdp+1To3Fzomxn6Tn+t0H2KmIqpDuhYVGTdgWGX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CHR78cqlaydSrkuc0Puuf7JPX3AvkCiTKuoSEhY?= =?us-ascii?Q?rCVBelhlj5429z2RUOsyF3HkjRqJTa0i1VnAndAzdD8dUGPik7zVcDP3Q=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3089; 6:3+pg0cf8LLr6rN/deDHr8Q4frzUx991mJCtGSGSNdS6ou46qgiI7KMLYU0iUxXlMeHMk+8nIkY7IGmqe1TnTfZnLdriSA9bcl7GA2g56w78+l93PfqibLD3nwRrPpS1U2qssRZYGuG/0+xM1gaiTDlDwXR8x78Cxp9CqSQdVr+fFQFsVAnwGwaUsvg9MzYPLUTkf2pnZNzks3BHn/I4y40/sS7crI5hNfGkTX4dPk04FZzQHASVI4aFzyDwnIYN3MZEHYCRobwXYrPkdLMqBBCzmlu19JSf4YrubvFNDv0jcyQwRxR/4sAyHUobk1jxTCq5K3PsM4j85VDMQpOihTQ==; 5:2iL+aG9CoU70BCc65BGWwBuaeUCMLRd3N7bhV70OMrjVCVMrW5he1Povys3aogkaCS6hlXkVuSliRIFpbvZrW2AvHTLpoEPZs3rPIcLFNAJoTycngvAilYiFyXCUJd39bm10gYu9rkX4Ans2WlEhcg==; 24:PGE4W0KegUdUj+fZRQSnirLyR+B27cqfLW3ozKmWYGQsuRaWzIyi95IhYj7/z18zkkuR4vWNYYxeTJT53C+2bOtDuqX/MjYr64dWbtY9huU=; 7:a4HDjw9wlENsyB69Ybg+/DMwrOF+uKGnaspuL5Z9D8ilSrtpPLN8f+AxR9nq1H04vUFwU5kEhk5EHE/DytxRLCDczRoJn69c/5N+j4N5mEc0HTnm00htC0dGtG21Nj+yMwZsrVQDkC8OsBmTdLZAtjrzZacmHPvNtd+mFh5n0HTXTuOOLvnn8loH7z4ZKdSHpa5SOHJeRpWv9a+F60vDeKNPp23Jkg1Q0x1RofPsriI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2017 12:46:12.4320 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB3089 Subject: [dpdk-dev] [PATCH v2 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: Sun, 08 Oct 2017 12:46:16 -0000 From: Jerin Jacob Signed-off-by: Jerin Jacob Co-authored-by: Santosh Shukla Signed-off-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