From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM05-DM3-obe.outbound.protection.outlook.com (mail-eopbgr730041.outbound.protection.outlook.com [40.107.73.41]) by dpdk.org (Postfix) with ESMTP id A4EC31B1E8 for ; Sat, 29 Sep 2018 12:32:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=AQUANTIA1COM.onmicrosoft.com; s=selector1-aquantia-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DrvGurQBsp8dKRGPmlT+WwBiohO7swqhIT6PEbBpriQ=; b=JHRbjksyZZMOYfIB3dmGP7GrhzyB3G8g2MJyioUdWcQLowBi49/v7Fxfcdy8JQutMiyYVF7OAC9WxkrlC3/dkPN+UBQPRksR22GdKQPCDrDFrXvUL01h0Qdsyb6nk1FAAh4rEzJVZjVIOwT5nThWxWyCVakV/8sn0NzYfZEtdQY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Igor.Russkikh@aquantia.com; Received: from ubuntubox.rdc.aquantia.com (95.79.108.179) by BLUPR0701MB1650.namprd07.prod.outlook.com (2a01:111:e400:58c6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1185.22; Sat, 29 Sep 2018 10:32:06 +0000 From: Igor Russkikh To: dev@dpdk.org Cc: pavel.belous@aquantia.com, igor.russkikh@aquantia.com Date: Sat, 29 Sep 2018 13:30:27 +0300 Message-Id: <64e175c35ae42681d7dc5cc7b3cbc38871873524.1538215990.git.igor.russkikh@aquantia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [95.79.108.179] X-ClientProxiedBy: VI1P193CA0009.EURP193.PROD.OUTLOOK.COM (2603:10a6:800:bd::19) To BLUPR0701MB1650.namprd07.prod.outlook.com (2a01:111:e400:58c6::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 57453221-237c-447d-d28c-08d625f6ce58 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BLUPR0701MB1650; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1650; 3:HLK9nFlXU7i+vNCJxJGoVNhtyU5LygrYCZdIuJY2zEbpZUmUY9X6YNGoUSV/drLgU/rrBI77Zjy8ZxPjj9kHvrfv7TgSDY+MkG/Uvz8+6YtHNlaszfpZ+RBSFbS7Xz3KPPIqHuyA1kazmxAYyjld+G4Ly73P6P2i8Lu2fnI7OoNIGBA3dhqeSEi/SXpV9FiXqSaRMMWxRXUksuz+6uWw0KfwRELeSzNUPxhpsVlSRZL3ePPAlGOm7Ym7mtJ1swFB; 25:4HKHVTKnG5QM6uyhcC75+PeT9MKxyf/ptnJsOTsBqN3OGwuoWmUKeaaHSCvir9dG+7WV2hx//sq32C2aYXKIcquA1SycW/C238GnF4t+9wHtuOVZWba5FNX4JwtRRBD4Ltb92Ft4Pb9igaqpwXzueaWehCzGz591gLWepOVTvnhCZGD3y65+XTTUBuWiXEM8pd5n7XZsu9bZxDQLwI1lqd1DmWG6mLoP4wYAIN6Dm1hwRd5BqtFIX9uMslpWnm83tAkK7CakC5Gy/Qu8mSvZEiG2EwMlHXs8m5ty5h0jZ5OJyyij8wH0XYZ4/gT+LMjzZi5Legph3fW12FbZm8cbqw==; 31:CKV61jsVhASQs4FHvDPngxjc353a6KzifEb/uIiuzbISDbWu5V/yjMhqQJq+tRCYf5/xvdloR9OXhYn+i8hhQVlnwzpTO1rXiZb9fVEHwQWwnXqxNilMnZF48hjiYyKz5dcsbZp3sQyURR9+wh+ZcV2pRBkdFc6rrkiu8Mli+mXQXGBVtA7g6AOI5mYUTR0kvXbJyLuez1mGaKUnMe0AIiRrxagWFaslYw3XOuQh6Kc= X-MS-TrafficTypeDiagnostic: BLUPR0701MB1650: X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1650; 20:IhFzOjq4+a5eWN1Jlbvusky297lMItAAbYID/QT5AnN/Duj+gdxZBe3s+XeVahMHpZbeKEnd8jPbp9qG88sleNXt/mR407Bg92y7xgZeO4rQVRLC8txyRkcI3Zq/s6yFGDH5SQUFp593eY+QTrPODeN5XNPnqRP/bLDm5OQUsmEJk6v1IOTQh2KAVeuYYfcsZ+CqvIyeankKAzqOpjrxOfnWyVDlbYldsbohs1az6ODfHrDRENUQ3vP+Gk2lK64EgSV91iDLCxr/zLnsfiNV5Diqm8PrsASoE6dvpLuL411m4V9oiJhHWHeET0L3aHp5Q8oHw85umAX21adObBsi1DCD0StJieaxECc0ZSuUFSOh7gpetyeJ5BLOjvmkyVy4cr43cf1PIncVo+NJVGzq4aKQ1x6HfVsbV33nowL41JkuANGo8nXRtekqowA0193nL+S4dchHG+TdHd7NHSlUffFH6pP0Mo5H18viTEUZvCUfIu97ScKsQE131EXzVAll; 4:dVG+O8atn5c39MfU/EMZ0uCHTrU1BY0xbSx3AxFrlyq/2g72W2xEEL3Ug77ioITe32gL+HUPpvKn7HplHcpiO0s9e8GuPStNdLwbLqCk21t6Z4QIXeDUU61N1MXnu5Nov2KjemB4dPOl2C5Jsn4kgNC7k2Kr21WTrko1d0aP6jW0rRp7b7kKIucskwQLxkcrRolj7DXbG/U6km6QL/PRbbY8LyXTTvbYnch0bOSeTPRB+pXTnh/U94zNKdjG99H4Afz+Oa30EKwlA77PhqbAMA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(3231355)(944501410)(52105095)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123562045)(20161123560045)(201708071742011)(7699051); SRVR:BLUPR0701MB1650; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1650; X-Forefront-PRVS: 0810818DA0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(136003)(396003)(376002)(39850400004)(366004)(189003)(199004)(16526019)(446003)(76176011)(2906002)(6916009)(6666003)(97736004)(8676002)(81166006)(81156014)(36756003)(4326008)(316002)(8936002)(50226002)(34290500001)(575784001)(86362001)(5660300001)(68736007)(16586007)(118296001)(72206003)(3846002)(6116002)(53936002)(386003)(105586002)(6486002)(47776003)(66066001)(486006)(25786009)(305945005)(50466002)(44832011)(956004)(2616005)(26005)(107886003)(52116002)(51416003)(7696005)(186003)(476003)(478600001)(2361001)(7736002)(2351001)(48376002)(106356001)(11346002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1650; H:ubuntubox.rdc.aquantia.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: aquantia.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1650; 23:FjumuGsgkLDJdB/WHvRJmuT70D6wpZU+8iCqNdB?= =?us-ascii?Q?i4XP9rW0Qa5w20ODINrVjFJx6Qqtl849joREAWIQG41gJiCsHyOzsXv+UmiU?= =?us-ascii?Q?CeAJHB/vv+kp52V7TWuh9zA61WztwcP/DAG1rRyJn25pGFDT2l8pX4pg+qrh?= =?us-ascii?Q?OvWYul7uF8z+J45ZaEJdnXO1upIGCzq3r7OZhsWthh+tNWpO1op4k01m3aCK?= =?us-ascii?Q?pgqpvKpDFYUsEJC/0SMwPdeqKuvppOxojMfkJ1UF3f3rqDRZHCRC2TyEhCl3?= =?us-ascii?Q?wFrod8S42KNn+3owryhBiamcBt019QUL9z8xUa4G/lgdTgMcyKmLlSjfhOC2?= =?us-ascii?Q?12Um5jsvBT0z+R7GwUg+tiezM2Et9TN49w3ZJeaOO4e3PenB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MDuTo6uQE3oJ6DJXogEAOC2P/l7R9yZNECN6Gsj2oHMCjhdR7zi3qCUWt8g4ezG2hjEBKBVH4dTAg+XRtMJWc=; 7:UA78QpLKlHj8lDJKGOA40oEG7qSdLgpkMiPndEn5bi4ZgGcDmZCei4a/43L4xbVaRVhMRo14ecJCQ9X70b9rTlg5VEFLHM4FRs08k9RzEtrORfJYR5e9VQYp0PB2drd5MlmKKrHFWqg0/v3j7+TghLVQBDovvlfwBKqhsxQHzrYy1SQuZPTbziT76RHpyqOO3uu2gX1WimA8TNVHmlGlDpdr31whQV/FVtpECxtKKmFz0cnUdGePk73KoF5G6pCW SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: aquantia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2018 10:32:06.4707 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 57453221-237c-447d-d28c-08d625f6ce58 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 83e2e134-991c-4ede-8ced-34d47e38e6b1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1650 Subject: [dpdk-dev] [PATCH v3 13/22] net/atlantic: support for RX/TX descriptors information 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: Sat, 29 Sep 2018 10:32:09 -0000 From: Pavel Belous Signed-off-by: Igor Russkikh Signed-off-by: Pavel Belous --- drivers/net/atlantic/atl_ethdev.c | 8 +++ drivers/net/atlantic/atl_ethdev.h | 12 ++++ drivers/net/atlantic/atl_rxtx.c | 125 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 145 insertions(+) diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index fc1d862042d2..bc0cb3da1f66 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -195,6 +195,14 @@ static const struct eth_dev_ops atl_eth_dev_ops = { .rx_queue_intr_enable = atl_dev_rx_queue_intr_enable, .rx_queue_intr_disable = atl_dev_rx_queue_intr_disable, + + .rx_queue_count = atl_rx_queue_count, + .rx_descriptor_done = atl_dev_rx_descriptor_done, + .rx_descriptor_status = atl_dev_rx_descriptor_status, + .tx_descriptor_status = atl_dev_tx_descriptor_status, + + .rxq_info_get = atl_rxq_info_get, + .txq_info_get = atl_txq_info_get, }; diff --git a/drivers/net/atlantic/atl_ethdev.h b/drivers/net/atlantic/atl_ethdev.h index 90d63797b2c6..17c8505e4707 100644 --- a/drivers/net/atlantic/atl_ethdev.h +++ b/drivers/net/atlantic/atl_ethdev.h @@ -51,6 +51,12 @@ int atl_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id, uint16_t nb_tx_desc, unsigned int socket_id, const struct rte_eth_txconf *tx_conf); +uint32_t atl_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id); + +int atl_dev_rx_descriptor_done(void *rx_queue, uint16_t offset); +int atl_dev_rx_descriptor_status(void *rx_queue, uint16_t offset); +int atl_dev_tx_descriptor_status(void *tx_queue, uint16_t offset); + int atl_dev_rx_queue_intr_enable(struct rte_eth_dev *eth_dev, uint16_t queue_id); int atl_dev_rx_queue_intr_disable(struct rte_eth_dev *eth_dev, @@ -69,6 +75,12 @@ int atl_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id); int atl_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id); int atl_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id); +void atl_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, + struct rte_eth_rxq_info *qinfo); + +void atl_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, + struct rte_eth_txq_info *qinfo); + uint16_t atl_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts); diff --git a/drivers/net/atlantic/atl_rxtx.c b/drivers/net/atlantic/atl_rxtx.c index 94054ca5c9fa..ebb606fbcd7c 100644 --- a/drivers/net/atlantic/atl_rxtx.c +++ b/drivers/net/atlantic/atl_rxtx.c @@ -620,6 +620,131 @@ atl_stop_queues(struct rte_eth_dev *dev) return 0; } +void +atl_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, + struct rte_eth_rxq_info *qinfo) +{ + struct atl_rx_queue *rxq; + + PMD_INIT_FUNC_TRACE(); + + rxq = dev->data->rx_queues[queue_id]; + + qinfo->mp = rxq->mb_pool; + qinfo->scattered_rx = dev->data->scattered_rx; + qinfo->nb_desc = rxq->nb_rx_desc; +} + +void +atl_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, + struct rte_eth_txq_info *qinfo) +{ + struct atl_tx_queue *txq; + + PMD_INIT_FUNC_TRACE(); + + txq = dev->data->tx_queues[queue_id]; + + qinfo->nb_desc = txq->nb_tx_desc; +} + +/* Return Rx queue avail count */ + +uint32_t +atl_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id) +{ + struct atl_rx_queue *rxq; + + PMD_INIT_FUNC_TRACE(); + + if (rx_queue_id >= dev->data->nb_rx_queues) { + PMD_DRV_LOG(ERR, "Invalid RX queue id=%d", rx_queue_id); + return 0; + } + + rxq = dev->data->rx_queues[rx_queue_id]; + + if (rxq == NULL) + return 0; + + return rxq->nb_rx_desc - rxq->nb_rx_hold; +} + +int +atl_dev_rx_descriptor_done(void *rx_queue, uint16_t offset) +{ + struct atl_rx_queue *rxq = rx_queue; + struct hw_atl_rxd_wb_s *rxd; + uint32_t idx; + + PMD_INIT_FUNC_TRACE(); + + if (unlikely(offset >= rxq->nb_rx_desc)) + return 0; + + idx = rxq->rx_tail + offset; + + if (idx >= rxq->nb_rx_desc) + idx -= rxq->nb_rx_desc; + + rxd = (struct hw_atl_rxd_wb_s *)&rxq->hw_ring[idx]; + + return rxd->dd; +} + +int +atl_dev_rx_descriptor_status(void *rx_queue, uint16_t offset) +{ + struct atl_rx_queue *rxq = rx_queue; + struct hw_atl_rxd_wb_s *rxd; + uint32_t idx; + + PMD_INIT_FUNC_TRACE(); + + if (unlikely(offset >= rxq->nb_rx_desc)) + return -EINVAL; + + if (offset >= rxq->nb_rx_desc - rxq->nb_rx_hold) + return RTE_ETH_RX_DESC_UNAVAIL; + + idx = rxq->rx_tail + offset; + + if (idx >= rxq->nb_rx_desc) + idx -= rxq->nb_rx_desc; + + rxd = (struct hw_atl_rxd_wb_s *)&rxq->hw_ring[idx]; + + if (rxd->dd) + return RTE_ETH_RX_DESC_DONE; + + return RTE_ETH_RX_DESC_AVAIL; +} + +int +atl_dev_tx_descriptor_status(void *tx_queue, uint16_t offset) +{ + struct atl_tx_queue *txq = tx_queue; + struct hw_atl_txd_s *txd; + uint32_t idx; + + PMD_INIT_FUNC_TRACE(); + + if (unlikely(offset >= txq->nb_tx_desc)) + return -EINVAL; + + idx = txq->tx_tail + offset; + + if (idx >= txq->nb_tx_desc) + idx -= txq->nb_tx_desc; + + txd = &txq->hw_ring[idx]; + + if (txd->dd) + return RTE_ETH_TX_DESC_DONE; + + return RTE_ETH_TX_DESC_FULL; +} + static int atl_rx_enable_intr(struct rte_eth_dev *dev, uint16_t queue_id, bool enable) { -- 2.7.4