From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0064.outbound.protection.outlook.com [207.46.100.64]) by dpdk.org (Postfix) with ESMTP id 0B37E5A4C for ; Sat, 7 May 2016 17:19:04 +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=XVEjyIE+LHGDlMTvBKNgl8jDbzdehGAKmJi33cwf6eg=; b=LTbX6Ew45UbOYQIO05aOMtDBVAB4nuZWubPd085R4nLzgKcv4WmZ7kWvvSfl2GsQlnSlmMmmGnqFHo7nvsG+310TcsI2y/WJ+kLDGsN35QRDiBl0KuHxToRHq4iwvQE/a0+SJKw1XkYe6vHexyLkXtTe2s/YX40Q6Wcw4/Qvq8s= 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.10.92) by BN3PR0701MB1718.namprd07.prod.outlook.com (10.163.39.17) with Microsoft SMTP Server (TLS) id 15.1.492.11; Sat, 7 May 2016 15:18:57 +0000 From: Jerin Jacob To: CC: , , Jerin Jacob , Maciej Czekaj , Kamil Rytarowski , Zyta Szpak , Slawomir Rosek , Radoslaw Biernacki Date: Sat, 7 May 2016 20:46:34 +0530 Message-ID: <1462634198-2289-17-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1462634198-2289-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1462634198-2289-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [122.167.10.92] X-ClientProxiedBy: PN1PR01CA0050.INDPRD01.PROD.OUTLOOK.COM (10.164.136.150) To BN3PR0701MB1718.namprd07.prod.outlook.com (10.163.39.17) X-MS-Office365-Filtering-Correlation-Id: ab79d787-b705-4917-50e3-08d3768aeb99 X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 2:cZcqofrdp3MHX4fgYDMFWlLm3PgZpCcDtvBnyEAsb++TG6TcRdgcMXM3JcDrsXpGX1zNZ9OqPQMoNHKgkUtHiV9iRJf0Jrq7QO6uZ9lpoOe6kYkAnUmmKOB8Ikl8abBZYOUd/BTShjXpLsXV8ESsBBHh0ENN8sIQtUcxwQNLvIc7BA1eMiDj0slKTh1uKSSg; 3:yUETUZXKUWMYVyiLekx/XLWtfDxuam+Z1UmjlWK+l8yYpVO+7eDIC+xErnsX6cVe+gRsoYI01Uwo+uYimL5gw0FAERq54tXxbSWM5PdTE2AvIkYSrEO2uYpZgKj66F+N X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0701MB1718; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 25:TzRNsLQfRds7h58cQB+WAVnBze25F3ysOZs6f3I1Dm8c2Xxb/ygasiUnFdsPfcsuvEekkNU8bx+z+qX0a0LBiNW1qcYI/9dRiJuj/+6sPY9uxFTqZgNBuF/tUYIwM/FpnQyUqOFaTwPbTR0XsMo09uSgVrAMyju0k0t0zzO2mNiEea42CJeSbZ6SVqfiuqSHrOPB3QpycaA5pV4uV/K1Xm4f01tMT2e9joSnIkz1gQi5kzzn95zj1Jy4Zxru6cLxE9kNY2q6JakZQU63BEe2//FSdzdwUXRUnL8YaMPB5DyPEkHULmgg4RP16iIKcK3hbCAAiRyHvikhF5Ja7asLSUpnfF0s1K5hNVTblW9zMUSseqEH0HKNk2rdPcxBMrY7JVbgfuuNiPJ03JvCTSHaFRlhGCuffbqLQYLXbO8ULfK5jP33R4RXZnXtTHQWERsbT0aFPN2TCQUD1E+iKsCQu3AqryFNbMrHccw+lxSIQqi0HhqRQgloFHgPIs3rXuSQzFjJt2LXRfBy8iQgx3ImCZvaRbLJ8ldV6BtnNIsl/HbvsCyfN4UhptKGS6fAPjgQabPkb3DbffvECj9FDL7xe4e9eEZa3RUEjddtqblYnmf2Vtz/bmhYAcwpznM9mqz2azDEk8c21l4ImcwnrBFDiLqv53q5r2pM2LvdlZNZnRQFqSai3RBM+fLu9djxBroZLLGT8lE48KaQfkeXN5yvR4jajLDTwCJjEg4wMl735SFSLJFEzFdraO2hH5D/7KIp X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 20:F4daoui80FwfFjDDoyWLKgnaDZ9+N3uKlDMIGy/M3547OuaNR6ONYFfu/1rb6YbammxwMfrxAZcSL76ggGPbyJvofyfOqtxXDAwj5OFj9+AWfGp4zzmliE1xiVEOe0K/guNsVpOuadNv/tf5Dfm22NkD0+CpJhuM99a3FRpAHqpmCoGT2ga0Q4Bbj8P0miMiHKYmwj7VN2m0n91n/rNucyFHj3O2wgtNHf8moSN/bFljNy++VKR+G7ERdAnfM77WyV/fEwkMqxZvmwvfNeRw81Rtm2VqbXE2bZ9ttybpO1F8Orp83y+CmfeZUtmiVlB45akFhdTXzkqYBYJ8YcI1nbCKxooFeJsiNaZQJyojOhFS1ZfN9m/qKonN8A8nm+M6so+lg3sZKX75hd71amsXsb0lhw0et881PC/iNn/m4bzjHUFNWgZSO6DiAD6EEeIELKOs5z8X9xjsaALWXqfdukjoHf+ePlFXLkhX9sm9dpITQSxYNPe2yZ3ap1zhr8ALImv1qa/ZLREnT/Mr0y2eRIUjBrz79oRIvz22tGziU+wHFLXOk8Ao3/qf1Iird5y4s6wD8Hds6JvTf5BTxt7ntMCVawS8xjeSnv5jkEm1IZw= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:BN3PR0701MB1718; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0701MB1718; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 4:K0Vx4a67qNn0caf89ZErdh3exuPwUVVL6cLgn1nG28py4eGu3U0P5z+GNCOnZxaz0grANsGU5lLSMPXNUqgJ94YGffvmLxuGMHrj7w7e0GmHtJAwmjzopbgaYT7mv7CkPIhzQhlYUIVXw3WaY1U6Q/1/LS0U7DJSBZlo+/zmNICzNlTZvkcAWsqEIzX2jHLI1nrkETt2rt7HQJGArs460YSV982qK5x5mvl0UYUCNp74Mgyei5CcU5nzexMZNE2GZSs/05e3H49jyEJ66U0tudj6QTv5bkOMtM0ovYSOQmwESbTnIszMu6iCItyD6rkYqBhOAV68R1o5Jqy2CeeKanAtf0bBdT/rEl4qGTWKiiAS4BBBac2cjN6C5gWnVc4f X-Forefront-PRVS: 09352FD734 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(50226002)(77096005)(2950100001)(48376002)(81166005)(50466002)(66066001)(47776003)(92566002)(5003940100001)(4326007)(2906002)(110136002)(50986999)(2351001)(33646002)(586003)(3846002)(6116002)(229853001)(5004730100002)(76176999)(19580395003)(19580405001)(189998001)(5008740100001)(42186005)(36756003)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0701MB1718; H:localhost.localdomain.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 23:QmzgwGF5X0M2ozluYo0LS6pLa3F+ZE95pzciULCoRfZQv1PzldtZsd8jvxHew90HqkrBmO6AF6MYf7uGeWF+CQV5Q7nUnIcmfWagM7Yv+PaRajkUkWF+I+GAdOSvVaGItCk+o9y3mB6zGIMxxvN3cVGH8mq2iwgn6hq7WMyHEQ+RNseJLyhSiJY3aAVDU1RIiwTfOoNzq0VZkut5Fwx0nh4F1AkrEgYQC3XzxuRwXi1OQJlpGkfQzvUqbCaQ68ueO7KE0qxscIqgwT62pvkya16yt7etIOAyNo+v+TWMSJ4SZUouOf9WouUP7HIirYdy2m1TSDJkarZuMpN/KwE5r40wStDm/HPrdQvHWHc5XY38kuVzTCkGsvL7Kxm/fwSFjwQB1FsBST3X5ilS4XQ3dXtmikih+9zWmWDLzSie041WC8SYBuFc9P3O+Lx0oj+jKiwAwTr9FOfYpet35KjqRvhjsTh8MaDY27yJ1VlWJD+MDysd/TH2vsVykgkfm/XrICgZ/CNsrzMIhDm8SPUZQ6jCxBOEEGODlyU5jSAmMDcG0//e8FIDGTkITsVY7oAWzJ2VqojhcyVzkL+FXSd6MX4FJTRJcpnFixTH2q587IxG5qfAKMhdb075M06w+aidjT8XA3S6d6NblsGS/Y/O2fEWHBU1U/y5ccIZ43A4/+42LMY2eylg87PH61fj8vfN/qTwpD8lwN0vF1eaXmQ1UIzpD3rNmtACH+XusfT61+9LLJn5RD90Lh+8DKfZQ9MbssWTDoaYH1QtnaH3dWP0Ug1KddalFl42aw7ssA3UIrR9vcLKznVJJeF5C4O3dGljc+9RitFTjumsqaUqrC4Gd9zabfHl+Do++3FYQNeR5LKZUP1ZMBN+sucUmGMqAXug X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 5:/V6ldZSa9C2DFupBfQT7Ia+IFhWIZuRzEDc3NZqvPitvw8IH0TkWshZSiy9b0kzCux1FdjXceXd3EBrhOthkvtQ6GCZGQnIr1v9XcGCkz1oXY56PBhLqfh7wlm5AIw5wQT9KRYQkAZBHv10iR4GoWw==; 24:ZkKy84LPxXLC6RZAb8Gddkn4mwofJ8ngcwRdsH1Sws3pAYzDDaBkWUMBq7V/JwJvcSGH+GVu3iVvuRyU0N9uZzksqSFNgKpSmUbVh37l+AM=; 7:t+TEjERfCDf96PiAejS3L0949L/on14EcOW8q1fTrmiqdDtdrhzuYe9inb4xd4PfwSvk8ZRZvqNqFvY83AMJfIpb+XPuF2egF1EJBjtSEprUosmXJIer2P9EyeQ+9hA5YCKWvs/mZkF3y4ahPVXInKwVoFxHg471zu40wr7rWuysaJbzsHKmueG+EOWh+q5v SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2016 15:18:57.3534 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0701MB1718 Subject: [dpdk-dev] [PATCH 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: Sat, 07 May 2016 15:19:04 -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 9b917c1..d717edc 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) @@ -930,6 +978,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, @@ -1158,6 +1224,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.1.0