From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0058.outbound.protection.outlook.com [65.55.169.58]) by dpdk.org (Postfix) with ESMTP id A09FF68F8 for ; Sun, 29 May 2016 18:55:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=vvwhYTpWie5ENPABO8p4nStxbtAbVZYUwhefCR9TBJ8=; b=QkU6Hg2S2T7Nj5NNZpmHxTkyix14ZMU+B1RKCenbEgyxfwVyMIFfOSyQAScOGTQZjVEFkIpV+J8FU2nHCB5p0rUrMYU1vw15yM9295rNSgqhgW8X7WoUj9iIf4ylvXUXwl0iplB8Dsxig3hVKdl948kZZYXFB+RYqN/luXd7vDs= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=caviumnetworks.com; Received: from localhost.localdomain.localdomain (122.167.187.184) by BY1PR0701MB1722.namprd07.prod.outlook.com (10.162.111.141) with Microsoft SMTP Server (TLS) id 15.1.501.7; Sun, 29 May 2016 16:55:31 +0000 From: Jerin Jacob To: CC: , , , Jerin Jacob , Maciej Czekaj , Kamil Rytarowski , Zyta Szpak , Slawomir Rosek , Radoslaw Biernacki Date: Sun, 29 May 2016 22:24:23 +0530 Message-ID: <1464540867-13115-6-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1464540867-13115-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1462634198-2289-1-git-send-email-jerin.jacob@caviumnetworks.com> <1464540867-13115-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [122.167.187.184] X-ClientProxiedBy: PN1PR01CA0029.INDPRD01.PROD.OUTLOOK.COM (10.164.137.36) To BY1PR0701MB1722.namprd07.prod.outlook.com (10.162.111.141) X-MS-Office365-Filtering-Correlation-Id: d97b6f4a-539c-41a7-2f5f-08d387e20dd1 X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1722; 2:jKb2V+UxO5WhSjtVOhz4GuX031rFpErdOnC4RKqTnn2+bJ674iNHEFRSf+Sl28L7F5XPAwC1lBXaDfkjFMks3QYSTsN8DHkBnjiPQTvs3pjj7VZ1Pp1LClYBa6O0lrcDFU19OLJqG/ATiRaGNI1BUD3K/MjG3yWKsyCXW9b5xab4BUdVS1aA5aZbXB39h2u2; 3:Htt1/F7DQhEJb0HBFgEBMUQkZvV8PE0XdyxrQg7gBTZo9667r44TqElnqmPdRpAb/XFye9zz7F1HFZVonm9VnkN9ORU2dpHA38w8F0XBbZnCcbpd4Mt5CxEcO+x6Irjb X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0701MB1722; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1722; 25:8iuXvxLd0E/HuSE3KfQa01CJs8Wdfv9e9pRuqmJLtA8XgjUIuo32cwdNZ1oRCb3vMb8Wlob6UVlSdYmqGYQdAtjKdflf41RbPQlt+6N3UJqviMCG0plBEo2i73iTjh/BERaq1w6pXQjezJsXZcvxBYmVbI5fLfiI0XE89fN9s/UwVyO9TSZWyKHc26r4Q0aUO2s47UQeVrE2M6XUJM4gYpyaQ9rjWCnQ1AJyG+hnugxHHqMMoZcFn0VvF15YjvX5Vq5EaJ/wNkYJKgXtu8h4kvy4uQXVAN6EBr7m+Qvk9sSy/f+5NGUWqn6jfNPWZw8Ewq6pZF2Z4NKEWB5KKygmtoXvd/SvPvrNr6KvNRI0snOJLdxT2ENfsd83MC47Cm3JbqxOytnvZPCnPUCS8Ag0ZAG2DYvvBOq2l6U9nMpEKYfTlFtdwv9NcJ9GGe9Py/eaL94a0CC5qFkkW6fievGIilP/ktPZgJWb2QwC3ySUhHdxuc3UcddRKCzP64DZa4B0nRfIsxBenGUeNiHxfQXvDIE99kyap02nKIjgMziW3Dn3+5zvYbM5Czr+Z5e35T+F7DkaFX/69iqOgeEq8JyJF1zn+6jVnSFDMrvB7HCPuNiikuRNbpx+YrDIVDGQ4sv6gSBjKisKMEA9QQptDAXn72w/bkCig1+J2zRZrfYsiGvDJDCOXbkJ2JCuO2DGHa2wZgKygNy6YWVdFogtFbFNQpqI3RDDbsn6zSjDE79fr4vjNi4FZTc2FRtgjToRbEga X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1722; 20:b1aId4msTPNk63gEdmT+nVs9BUMQT5mpBPp6/AUxq6ta4jExdhYUvFzUNLq7X+rQm3a1DC3Fb1oTu4qP5UqnwybXIulwMxkmOGH3LXT62eLD1XPi7xuo1rkVrEcxke6bL6RX0Oag6hCWll1148WGKLMbcSG7fvzhpOyRZuePg9LlI5Ct/ypBbnC1vz96WPbJQL819Cu6T6zM1aBeLaSBIzf5xmIbdc68ApqrkLfYH28a9xLCM730NeAXajPrXN87nX7A1v7PqDNgfT2KyW4pTWVRsSGYjHiZMRok46Ctc3tNREKNvErxACLeB90CDHDmateAZ3rVW+61ev79ANswfxJO1GuWqfvxJEDPhy/obAlh+WBXw/K7d39dYG91J3akDo1090FUptRIYvFbWKMMPrPfhJadOdcpWyMx0uayboktLnpLbWCOmDMIkv3DvHjZMF9uj6TAyKvd8DCVF1a7YtgqdWCWHfvL0uP1rsDc9mkzcDUA5/5xdgCYYXtAoFdY+7WIa8ij2ozs2bY8rd21Nfv9fI3E5h9i2i9XdMAcV53Bkq1m8wtVMQxQKWrsvwu+5OV2bKTeK5rc18g97K1Rhk/VOvDNcKFiiVNKunN38Bc= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046); SRVR:BY1PR0701MB1722; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1722; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1722; 4:IyYG8kzvjeU6Hgw/ay3jIOBDe/p2oCB/2IVsT1wytm1qrgty8fUrHs853in241+ZeS1OYN9W9F0l7XBE2eXR1N8zdqyqTpkrIsHeqbnK2LduTxCubUzSFmn67kKYH0lZJWfa0/w6ghg2ZNs2QW92wQpGENs+316ogx7WXNImAS/IayhEfyse9lNMtfmPVxGSHUE+mVgoyxxlIT7jZDX2XtOczQjyvip0O40h3DNKs/zXlv8eKlW8WKjl/wFMmar/4LQx8stF6vVythGJ704cNLiQ+xHOXShraMsRwsyGVOzXM+K2ZQOwHE6vwpATUV7onRTpA2z9+mk/RgjOQWvHpjJuO+534aLJMb2y8pUOk98WptWCugb9hUvJhu4EC3Zr X-Forefront-PRVS: 0957AD37A0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6069001)(33646002)(42186005)(50466002)(92566002)(50226002)(229853001)(2351001)(5003940100001)(189998001)(2950100001)(110136002)(77096005)(36756003)(47776003)(5004730100002)(48376002)(2906002)(586003)(8676002)(5008740100001)(19580395003)(66066001)(4326007)(76176999)(81166006)(3846002)(6116002)(50986999)(19580405001)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1722; H:localhost.localdomain.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1722; 23:l31G7n/i1bb+bXXVsPNEEYd9WM+hLITqT7r+Dz7gmI4YoCFtUa10X6EY/vaPwxwooJQwIyPwxCYbLiT9GfGfeXoeYZow64KAoWxTFK4pd7yFni5dI4KBIYoJUhqoJHw4lpLRyy9FCQewOGhTdbSCrPsH959Sl2C2zzlV/fND6awzSTeGE8X6IHmaHs5gtjDmBIST9yPkOxaZjSD1ZA5U/x4ARjrkqQYYc/DjpTYKyhs8crCDPhODYE7Dpk1JV5xg0J618Dr1ZUnr0qA5TEIzWbHkdjRLkP2O94TVUyxeyY4xCYjXO6IOaDe36VaV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nosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 May 2016 16:55:31.8542 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1722 Subject: [dpdk-dev] [PATCH v2 16/20] thunderx/nicvf: add tx queue start and stop support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2016 16:55:37 -0000 Signed-off-by: Jerin Jacob Signed-off-by: Maciej Czekaj Signed-off-by: Kamil Rytarowski Signed-off-by: Zyta Szpak Signed-off-by: Slawomir Rosek Signed-off-by: Radoslaw Biernacki --- drivers/net/thunderx/nicvf_ethdev.c | 68 +++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index 6a3c01b..3d45986 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -90,6 +90,8 @@ static int nicvf_dev_rss_hash_conf_get(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); static int nicvf_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t qidx); static int nicvf_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx); +static int nicvf_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t qidx); +static int nicvf_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx); static int nicvf_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx, uint16_t nb_desc, unsigned int socket_id, const struct rte_eth_rxconf *rx_conf, @@ -618,6 +620,52 @@ nicvf_tx_queue_reset(struct nicvf_txq *txq) txq->xmit_bufs = 0; } +static inline int +nicvf_start_tx_queue(struct rte_eth_dev *dev, uint16_t qidx) +{ + struct nicvf_txq *txq; + int ret; + + if (dev->data->tx_queue_state[qidx] == + RTE_ETH_QUEUE_STATE_STARTED) + return 0; + + txq = dev->data->tx_queues[qidx]; + txq->pool = NULL; + ret = nicvf_qset_sq_config(nicvf_pmd_priv(dev), qidx, txq); + if (ret) { + PMD_INIT_LOG(ERR, "Failed to configure sq %d %d", qidx, ret); + goto config_sq_error; + } + + dev->data->tx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STARTED; + return ret; + +config_sq_error: + nicvf_qset_sq_reclaim(nicvf_pmd_priv(dev), qidx); + return ret; +} + +static inline int +nicvf_stop_tx_queue(struct rte_eth_dev *dev, uint16_t qidx) +{ + struct nicvf_txq *txq; + int ret; + + if (dev->data->tx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STOPPED) + return 0; + + ret = nicvf_qset_sq_reclaim(nicvf_pmd_priv(dev), qidx); + if (ret) + PMD_INIT_LOG(ERR, "Failed to reclaim sq %d %d", qidx, ret); + + txq = dev->data->tx_queues[qidx]; + nicvf_tx_queue_release_mbufs(txq); + nicvf_tx_queue_reset(txq); + + dev->data->tx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STOPPED; + return ret; +} static inline int nicvf_configure_cpi(struct rte_eth_dev *dev) @@ -934,6 +982,24 @@ nicvf_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx) } static int +nicvf_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t qidx) +{ + if (qidx >= nicvf_pmd_priv(dev)->eth_dev->data->nb_tx_queues) + return -EINVAL; + + return nicvf_start_tx_queue(dev, qidx); +} + +static int +nicvf_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx) +{ + if (qidx >= nicvf_pmd_priv(dev)->eth_dev->data->nb_tx_queues) + return -EINVAL; + + return nicvf_stop_tx_queue(dev, qidx); +} + +static int nicvf_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx, uint16_t nb_desc, unsigned int socket_id, const struct rte_eth_rxconf *rx_conf, @@ -1162,6 +1228,8 @@ static const struct eth_dev_ops nicvf_eth_dev_ops = { .rss_hash_conf_get = nicvf_dev_rss_hash_conf_get, .rx_queue_start = nicvf_dev_rx_queue_start, .rx_queue_stop = nicvf_dev_rx_queue_stop, + .tx_queue_start = nicvf_dev_tx_queue_start, + .tx_queue_stop = nicvf_dev_tx_queue_stop, .rx_queue_setup = nicvf_dev_rx_queue_setup, .rx_queue_release = nicvf_dev_rx_queue_release, .rx_queue_count = nicvf_dev_rx_queue_count, -- 2.5.5