From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0087.outbound.protection.outlook.com [104.47.32.87]) by dpdk.org (Postfix) with ESMTP id 7FE551B43A for ; Tue, 9 Oct 2018 11:31:52 +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=sqBkKAXYbG0Z3gZTsKeqj5hzEGWzyc3aap+tk3v//yo=; b=RpmAxDN06UobsawYpsfEW6S9UIDNSnDx9/NaWwWjtuf/CBMHbFK8SA5rdaNKIIMmEPXwOFmeckSc69Kb2MQo0NGQoqU5IzmZAj5do5KwVMCmQnnGsZU6EJ2YqFDEdcXOcPBBpaNDFL1mZ3EIUCkNOMQrLSrOTVLHLIr0BUIEBQc= Received: from BLUPR0701MB1651.namprd07.prod.outlook.com (10.163.84.21) by BLUPR0701MB1650.namprd07.prod.outlook.com (10.163.84.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.23; Tue, 9 Oct 2018 09:31:51 +0000 Received: from BLUPR0701MB1651.namprd07.prod.outlook.com ([fe80::7c97:1527:4c0:8b46]) by BLUPR0701MB1651.namprd07.prod.outlook.com ([fe80::7c97:1527:4c0:8b46%3]) with mapi id 15.20.1207.024; Tue, 9 Oct 2018 09:31:51 +0000 From: Igor Russkikh To: "dev@dpdk.org" CC: Pavel Belous , Igor Russkikh , "ferruh.yigit@intel.com" , Pavel Belous Thread-Topic: [PATCH v4 13/22] net/atlantic: support for RX/TX descriptors information Thread-Index: AQHUX7Lo7fFrwNUUWUuHqPwRMOiOAw== Date: Tue, 9 Oct 2018 09:31:51 +0000 Message-ID: <3db2d21c28f50e81bb994382c1162b6d49bc1497.1539075891.git.igor.russkikh@aquantia.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM0PR01CA0028.eurprd01.prod.exchangelabs.com (2603:10a6:208:69::41) To BLUPR0701MB1651.namprd07.prod.outlook.com (2a01:111:e400:58c6::21) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Igor.Russkikh@aquantia.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [95.79.108.179] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BLUPR0701MB1650; 6:1xED4gNUfh/XZDY/8SsTWolYbvxTka9M5XZxKtBa1GBGI1/2c1VbJP+I5tph8XUNFI5fbeXOAwpuT9AA62saaUrNeApQoL6ZvMGf1qXBlCO566kHUNMoKs3Z0W9u8dQBLqbUbDx7Gc1X5djLKYhkDQsrH5fG7bRKvKfg+oYb3CxNn2PebkqMm2Rtz0+FcoP3ES8cBH3123/yaHC6AXMS90jR2jgmQrfAq+K88nlbD1+DglL8A9x1tF1Q0xlgc7QLcBs4h7Uf/W4mhbJs07mtOfd9r0SCUqh0S7LOiUtoybHLxITMEILairVYZiy85h1gsOJSRDJvQRvmlD8UosbarHjQCuQYsvfL3gNn4MnRhf0E2/LMPFuWEmQg4kbjOiDybNGJHYHo6KUWJO78X1DPcACXGqAniWO84A0J4/KNi+V0cF0ZKWVige2NMi3iDZy2CDda70BpkOjCrD2jfQxCTw==; 5:lysvbdQKoiNxl/HyFRhFnKnU6+DKGIr6wPORYA3uZc7ekfsTk08xdaQDyfH8HiTy5KA0Hig6Bn7iQgnCe4U6ANj19SpfxTid8PfQSathz0AwDtyZY8LKGot+FI5b3qi1QHDI3efp7XpcOM8eoswR+oVEbTrUIi2+nhYnmdfH4Sc=; 7:Ex7hpGLPkC3BsHXozBl8lH5UaHWupOaJjgRN2DymQgXQbfVEe7pvmP2wGj7lIBEUETOzvE7yNteNJCEdTBqug1bWB1t8t9kl6D2R73ylHdcihJA21p/1OcClfn2A7ThkjA2vTi8WT/EfAN8LpRTBe7e/IlcZCPyKRem1aPcyJywgbTgB2nll3Bsc2CNNrAW8Ql94HmsHEiCv0aMC2ryyZimF7C7/v2Gbfx00flDlwKA/ekzpo3OhBZpCciLaU8fB x-ms-office365-filtering-correlation-id: d5f41743-fab5-40cc-40dd-08d62dca0adf x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BLUPR0701MB1650; x-ms-traffictypediagnostic: BLUPR0701MB1650: 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)(3231355)(944501410)(52105095)(93006095)(93001095)(3002001)(149066)(150057)(6041310)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(201708071742011)(7699051); SRVR:BLUPR0701MB1650; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1650; x-forefront-prvs: 08200063E9 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(39850400004)(346002)(376002)(396003)(136003)(189003)(199004)(81156014)(5640700003)(6116002)(71200400001)(105586002)(68736007)(316002)(3846002)(107886003)(71190400001)(26005)(118296001)(2616005)(5250100002)(25786009)(4326008)(102836004)(44832011)(446003)(476003)(11346002)(186003)(2906002)(106356001)(97736004)(2501003)(2351001)(486006)(478600001)(99286004)(53936002)(386003)(1730700003)(5660300001)(6506007)(36756003)(66066001)(54906003)(305945005)(256004)(86362001)(7736002)(2900100001)(76176011)(8936002)(52116002)(8676002)(6486002)(72206003)(6436002)(14454004)(81166006)(6512007)(6916009); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1650; H:BLUPR0701MB1651.namprd07.prod.outlook.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-antispam-message-info: 6hklfhS4FfChgOvu8DXNZCC0SY8Yng/cc4mbXMuscxGaBJqSw1cm++malpVmTaJ0gNFsNfY3byRQAPFJkvoOZW8+AaimMqwlmgBNtDO3S5LSP9jvxiekyrE1QlW+0N+MD6Qs2PucOpXkmytHWhwaSiyHe1eVxKxNH9KmnCNC9olhlPaj8hByudu4KcgGZPUAN5eGEXPyv1aGNgKRhi8I9MUto5fTAFiNwL4oFnGQD7mXij5/tirwy2/zJXD4thVfYT2eWHVYdjLtzUG/Bv+dr8HSHTOWQ3mK1dGhQwS8zQLGxFmiCwvj5/6Ptfw28tbwTGveT4458hwfU4M8UiGufzgEtxj9J2oTP1xJYmO21aw= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: aquantia.com X-MS-Exchange-CrossTenant-Network-Message-Id: d5f41743-fab5-40cc-40dd-08d62dca0adf X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Oct 2018 09:31:51.2133 (UTC) 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 v4 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: Tue, 09 Oct 2018 09:31:53 -0000 From: Pavel Belous Signed-off-by: Igor Russkikh Signed-off-by: Pavel Belous 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_e= thdev.c index 30a800da0209..afae232cb22c 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -198,6 +198,14 @@ static const struct eth_dev_ops atl_eth_dev_ops =3D { =20 .rx_queue_intr_enable =3D atl_dev_rx_queue_intr_enable, .rx_queue_intr_disable =3D atl_dev_rx_queue_intr_disable, + + .rx_queue_count =3D atl_rx_queue_count, + .rx_descriptor_done =3D atl_dev_rx_descriptor_done, + .rx_descriptor_status =3D atl_dev_rx_descriptor_status, + .tx_descriptor_status =3D atl_dev_tx_descriptor_status, + + .rxq_info_get =3D atl_rxq_info_get, + .txq_info_get =3D atl_txq_info_get, }; =20 =20 diff --git a/drivers/net/atlantic/atl_ethdev.h b/drivers/net/atlantic/atl_e= thdev.h index dc48c134b7b8..dbb42140816b 100644 --- a/drivers/net/atlantic/atl_ethdev.h +++ b/drivers/net/atlantic/atl_ethdev.h @@ -52,6 +52,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); =20 +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, @@ -70,6 +76,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); =20 +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); =20 diff --git a/drivers/net/atlantic/atl_rxtx.c b/drivers/net/atlantic/atl_rxt= x.c index e9be6d85e647..88801822262f 100644 --- a/drivers/net/atlantic/atl_rxtx.c +++ b/drivers/net/atlantic/atl_rxtx.c @@ -632,6 +632,131 @@ atl_stop_queues(struct rte_eth_dev *dev) return 0; } =20 +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 =3D dev->data->rx_queues[queue_id]; + + qinfo->mp =3D rxq->mb_pool; + qinfo->scattered_rx =3D dev->data->scattered_rx; + qinfo->nb_desc =3D 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 =3D dev->data->tx_queues[queue_id]; + + qinfo->nb_desc =3D 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 >=3D dev->data->nb_rx_queues) { + PMD_DRV_LOG(ERR, "Invalid RX queue id=3D%d", rx_queue_id); + return 0; + } + + rxq =3D dev->data->rx_queues[rx_queue_id]; + + if (rxq =3D=3D 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 =3D rx_queue; + struct hw_atl_rxd_wb_s *rxd; + uint32_t idx; + + PMD_INIT_FUNC_TRACE(); + + if (unlikely(offset >=3D rxq->nb_rx_desc)) + return 0; + + idx =3D rxq->rx_tail + offset; + + if (idx >=3D rxq->nb_rx_desc) + idx -=3D rxq->nb_rx_desc; + + rxd =3D (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 =3D rx_queue; + struct hw_atl_rxd_wb_s *rxd; + uint32_t idx; + + PMD_INIT_FUNC_TRACE(); + + if (unlikely(offset >=3D rxq->nb_rx_desc)) + return -EINVAL; + + if (offset >=3D rxq->nb_rx_desc - rxq->nb_rx_hold) + return RTE_ETH_RX_DESC_UNAVAIL; + + idx =3D rxq->rx_tail + offset; + + if (idx >=3D rxq->nb_rx_desc) + idx -=3D rxq->nb_rx_desc; + + rxd =3D (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 =3D tx_queue; + struct hw_atl_txd_s *txd; + uint32_t idx; + + PMD_INIT_FUNC_TRACE(); + + if (unlikely(offset >=3D txq->nb_tx_desc)) + return -EINVAL; + + idx =3D txq->tx_tail + offset; + + if (idx >=3D txq->nb_tx_desc) + idx -=3D txq->nb_tx_desc; + + txd =3D &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= ) { --=20 2.7.4