From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0074.outbound.protection.outlook.com [157.56.111.74]) by dpdk.org (Postfix) with ESMTP id 0A62FAD7B for ; Tue, 7 Jun 2016 18:42:27 +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=JMbI698ExW+XSqgpjaTzPeVPRjPndyCLgdZhKdtShiU=; b=SiVyyREKfJk3MbbkakZcESrReOGX30lGW9GsM5q4C3upDPL0yFZlsswQrGZ95PIUV6EM0uSoGNa9m8veCCbCklBD5rQdRBt3SInRRvZJE6nn5BDcX4nvb/i58u2PQHEumIEHKLUxzy6UGe8YltBULSUCObaGMrCfuiqAZG+u4OU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.caveonetworks.com (111.93.218.67) by BN3PR0701MB1719.namprd07.prod.outlook.com (10.163.39.18) with Microsoft SMTP Server (TLS) id 15.1.511.8; Tue, 7 Jun 2016 16:42:22 +0000 From: Jerin Jacob To: CC: , , Jerin Jacob , Maciej Czekaj , Kamil Rytarowski , Zyta Szpak , Slawomir Rosek , Radoslaw Biernacki Date: Tue, 7 Jun 2016 22:10:28 +0530 Message-ID: <1465317632-11471-17-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1465317632-11471-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1464540424-12631-1-git-send-email-jerin.jacob@caviumnetworks.com> <1465317632-11471-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MAXPR01CA0054.INDPRD01.PROD.OUTLOOK.COM (10.164.146.154) To BN3PR0701MB1719.namprd07.prod.outlook.com (10.163.39.18) X-MS-Office365-Filtering-Correlation-Id: 138d109a-1442-41d7-0609-08d38ef2b4c3 X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 2:D+IGSxPEmJUMvK/b+avlQEtmkuSU7MQ2HL26pqVH+0Y0WPPNaBYWUJdUeV6R6oyDxFCrvw8MaRkf9yVpOjJnC2WCqZ7voXNr2OUpiVLjbL/YzQcMbM4dJ++xzvYR3ieo//LWk1G4KB/wHChDj1X6aSj7z6cCe2//BP4SYn/K9wZB0VoayxcIkoi2MLFXOygg; 3:++hvI4EdlDiPxTezztFeVKAyyuIAcD2BisOTZUB8QMVzvRxN0xY7Q92mRfr6Q/nporADDRYkSpt1VMVv2/ws7t0zTGfyWMDcccEE+VnxzffyCO2vaVKBzpMAO54YPI5K X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0701MB1719; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 25:sgj7FECcRTcVsnvWCnNnCCiWQFNAtOtL0BI0bYloMQI0frwMdWuWHZuig7s0uyXkXf/3Z6CJ4wDY8JE9C83K8N+SpxJ7Xtlk49i9l7Lmp2iBbvSsZFnkB3QbqX3Sgkyh8AnuQoTq20fY/FijmEEy0HBf+LUfVJF97aTxJsaYPFJPmHXk+8mGo1cVLrYSa+LaUIJCdVZzXu22GnAaUD0Blsf8I8Xo1VZ5soo9XksNJaxCnPMo0IPoyQKcw2hkv/nK5k8PfQ4s/06AvCTa+hFiP9G+SZVObE3JPXxX2ym0l4d/Xolvc0X913jiJshI7NbEGk3eUXDxLNTm1cm3Jqsn6xJVhKUStZbyVoyefQuL3XmdxAdX38fZG7TeZ+EE9rkZNjKcdbxheelC1bXOSnYPtbarCelW5leosuhMrJJw3cO16gi8R/9nJVv0Dl9Ny9Bs5zU0VeJC+G2hzm90tUCRaI1bRiEz5IjbRm/hK/2AaHRZ6tQGrZOyEGVuztQvVrqgxHBrtN3bChfsiBbW2fdLpmJ8jmKq7JJZoet1sQFDaZ6ldUtICasUIEmLOvhyMvfAD4izAVd4X3P14gVJUbawVCHatSRPJs19fQl2L9scfGVMsg7rwSyF1olIsxsGeYdyk2PXOdwn+MA88SKFZanKnYwOPUPHBcluv3u644WraB17yFbSbveO/eGYvAKjfz/F/C+wUshai0BMttJwofsM3P0cntEPJai6hvKEmzHuKazo03mCROQrQnpMfSdSKOCx X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 20:KtRi5nizBECdwTRYTT+fKIF4JD9Qmp9E2jOwtBIlXT8CW1WfKAeXdHdjAEvP8kgJ1lhK+Zl4ptXelj1JaS2sW+IbA/SmqP8MUduD8teF8NP38J1CNROOhacOyQNd5sBgG13KRHUcGHWesEOiRbCF6oNQIwOA5DtZwGFGmajwIOsVGkoJzjhLXXShRYhFM+Lx/S1uOntZZGUWI+RoH7cXD/34yhVFLmVP6Dtxq0qukyjBSU7v+an2KMdgNDUE9CksESRktdEgon9olqlEWdxLBjhOGGLQ7m+Bg3bKJ32j2ICGCxmdTdFfGoFIBbnugsotXZHBj0QSbbgbFcU2+kayveYbG4mxi7NlHfj2H3nkCpfXeywW4QY8rgTfWDWwv3/8zoySyG7tzzEW6u38zao3qTCW97ZnBqUZjWTlwdsFvKYUkTQrC7ydneKTRve4LxxdhXgD3D8lALoLe6aOzSwdexZ+A4phuAAv+E3cLIe8d2yqX/bms3TDQqyCNCikpm2dLJS1/bDMD3VyDRRFOe0gUzNJsN5cqQOVz4YD2JYfEjsHaG+J5YMHTT3CPXbUcd+jPxow7O/eJkpIMGlVeKJrAZFdLAJ6po/JITZXJBJxYEs= 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:BN3PR0701MB1719; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0701MB1719; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 4:xtNcKfMRU2e2OCbZylp5x3HJl9K56osB5FSwUkDrYqZe9P/HkkEm37mAIjLV0EGyI5/3SXhmjPqZ+yS74rzQRMZNOrTKYlP+1G/ltriih1fqmCrMk9gPrsNyL8I6lsg90qOLA7yYAAZPse0SkIzFzwR7/hZYZ0q3yGwHusmW3ltiENC3gTaAV5pEjtg4TvrONRIZO4ixbatpy0LPNG9gr+jYN5gvPacqvNFf8UYCh5ngfLOrnLknUdk3JqGZLMTQ7jH37djFovL6VWdLU6DyT0kHWI4aBQioqhx5e2sJgqEJwOhMYCa2t43BZtco0KBt9oedJ0EgqbaB0z72AKgnatff65OYK36ezcg2umo3FuYZp5Kqns4tJJod3zdf5w0E X-Forefront-PRVS: 09669DB681 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(199003)(189002)(81166006)(8676002)(81156014)(47776003)(66066001)(36756003)(92566002)(2950100001)(586003)(2351001)(48376002)(76506005)(42186005)(50466002)(4326007)(77096005)(3846002)(6116002)(5003940100001)(53416004)(5004730100002)(105586002)(97736004)(2906002)(5008740100001)(106356001)(189998001)(19580395003)(69596002)(101416001)(110136002)(19580405001)(68736007)(33646002)(76176999)(50986999)(229853001)(50226002)(5009440100003)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0701MB1719; H:localhost.caveonetworks.com; 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; BN3PR0701MB1719; 23:KCguzD6g/H//bkdMIqm4TuixBNJr3niTgw61J9f?= =?us-ascii?Q?gk8GHhXeJQFYLZ0hF0vSix6lYVL8IiDglIEM1nC8f/X9c3X75TTHj13MGiDA?= =?us-ascii?Q?rwydJ8vq8Sa5URX/QMEuTuvoRF8zil7dK1YnU0Idv6s42olizvvtB7eS+p8Y?= =?us-ascii?Q?tHwJ65snU6uevTTyfcmh0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ascii?Q?CYSXHwssUfgnPgHphIOX+99CTfuUdgVIoGUwJgcBAEQLykgpOXVEMxJGc09m?= =?us-ascii?Q?rDAj6zWcajtaDfs4T6GVZDZdJ+gWqS+5UI7K1JZEpFGYVb9a/FMNG+g=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 5:ANCHGzVnTaqK+s+Tk7sHtEywxthqyHDOyLssCnI+5sCTDgugP8G826KlnAfxXISfC1ugm4i16MoJGtUqQqMzoS134NLQscJ9+Kq0iIbfhniqxW7Sd8m9DYiSmSWuUZxEG6QSs9u3vBO4A2UwL8mFSg==; 24:8N8W8gvE3YrLJ0UrLnU2TEoW+U0casqtj5S3wwltjF9Uk+6JzeYD8NyHd+BYgcxIDoVwICEHgX09YIoiSzMzJeb+1HNy5wO8gtR7g8JLvzM=; 7:HdQwdebC5oBExO2VNZxJg/z3XmVzlQkjG5Bf5VQkJNwTejwav8u2sMrRZuyKYVWXhJdZCO2A7uzhjaSclUewOsKK10vKKRZjT1guSxrbkunILcRWnS3XV8cobPjA96Fxg5gi219wLIOS8jvSaXueKV9MpkSqXvj92Flye+sFEgdMAHHZx78lGQY8Cs31/doOs0YPSddd8dLRIZvFPXD3RlRQUYbjVAf/MMUjak2Sn6U= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2016 16:42:22.6670 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0701MB1719 Subject: [dpdk-dev] [PATCH v3 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: Tue, 07 Jun 2016 16:42:27 -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 ba32803..baa2e7a 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, @@ -596,6 +598,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) @@ -912,6 +960,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, @@ -1140,6 +1206,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