From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0067.outbound.protection.outlook.com [104.47.38.67]) by dpdk.org (Postfix) with ESMTP id 2AC631B4D2 for ; Thu, 11 Oct 2018 12:35:28 +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=luI46Zi2q8zJq74+edqEB9IdAYVFSppoODRCUzfqLnc=; b=f1ya4Zc7krxGwJvAmgybDBG6pRXm5y4b4qpf9pQiT/mWr400Q9lKSS0lWNjiScf3ylcZ+8erLpOM9pKW5u7JRtszluhZv5XJa4GjC14K/s6atRqXA12FvrNs1B2l6QxTBc7y57wVUYju2REOjY5QDyMOmQBfJzni0j9+diPx8+0= Received: from BY1PR0701MB1660.namprd07.prod.outlook.com (10.162.110.22) by BY1PR0701MB1206.namprd07.prod.outlook.com (10.160.105.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.24; Thu, 11 Oct 2018 10:35:26 +0000 Received: from BY1PR0701MB1660.namprd07.prod.outlook.com ([fe80::346d:e756:e70e:17]) by BY1PR0701MB1660.namprd07.prod.outlook.com ([fe80::346d:e756:e70e:17%3]) with mapi id 15.20.1228.020; Thu, 11 Oct 2018 10:35:26 +0000 From: Igor Russkikh To: "dev@dpdk.org" CC: Pavel Belous , Igor Russkikh , "ferruh.yigit@intel.com" Thread-Topic: [PATCH v5 14/23] net/atlantic: support for Rx/Tx descriptors information Thread-Index: AQHUYU4fD5BCZtPP00KvWT/Dq7hxkA== Date: Thu, 11 Oct 2018 10:35:26 +0000 Message-ID: <094113568752818a088e48c3ad9b7370185089e4.1539249721.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: VI1PR04CA0088.eurprd04.prod.outlook.com (2603:10a6:803:64::23) To BY1PR0701MB1660.namprd07.prod.outlook.com (2a01:111:e400:522a::22) 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; BY1PR0701MB1206; 6:bEtnddxNMtPCyNOEpWnu7WNW5Qzgt4JgDT+oPaJrx10AwoDEv+6wVfPEdmMEvyE8mzRfpCLp2cOVgBvPFA6Y9Fp1uZ/jC8PnYEN1q/pLn5hXbf2WtJgoW/fNhfteXzPhHOWZVQB6bXQMDS/EbyENqiJA4bJ5mWioSbmnOjz0zeajEuPrqOswf1gy0UcOMvgM3/sjnFFWFdn4LQVXoGH/YAbQK+S2oeOAa/MmD5mt5PjxLDUbK06IxNP0GHHEiPCn6+v+Rj0kXcvEmwXuLx0yMvW2QMWKdHLMF/2QZnEJP7gmtFV71jbt+BVuZgVLVGNIgWiBqRO8VWSA8yZvIutNfh2kS9Mb74XgRatwS3Xvf3/XC2mWFhMy4FFW1SS/KEGzqwO1e/bq2rOQZKBi2kF61Y2DThHRHJd/dILKKoMxNE/naMlHo5zsNBLSnF9enpgPYY+AMpzMto1ApP0vsWUrsQ==; 5:OQ7LO2UwGr10sRtJzzKW7C5wnhxuDbVFdF6gsAKJPysy7dcl/iNuMlAlOBvZxkznnEOyHmTLqZK/HgIHcpdVdbiLmWtLXzFSVorqceVH642k87dhbTrV/EqE/h2HQpKvbLWuAm8Z4zxlVBMzmPHnWEpW00YxtYYp4r07JfAZ6RI=; 7:j00jaPcSa7PE7dzIoHqvIaA17wHnJPE/MfjKXQmxP26fhihmbQbLvNG+tB67Ebg5mwiOBkiPYAbApBvMlsxL30YpzCrDtEewLZV7egT5+Q72SdZgtc7Lj+wvOnxgoB9kSCGT7Yn8cz6AU0YfQ67dQeh2iQ5jR+w18UsYUhzMPnQjpYdB8KzjTvAEOEdsww/eHn2/uXv4CEZAO/6lERZoV8FZW5zQlK8b3HxP9R2sqGrmbvC7SgQX6ksFTeZEOLwv x-ms-office365-filtering-correlation-id: 61de4488-a43c-4e12-bdfd-08d62f654195 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BY1PR0701MB1206; x-ms-traffictypediagnostic: BY1PR0701MB1206: 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)(3002001)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(149066)(150057)(6041310)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(201708071742011)(7699051); SRVR:BY1PR0701MB1206; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1206; x-forefront-prvs: 08220FA8D6 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(1496009)(346002)(136003)(396003)(39850400004)(376002)(366004)(189003)(199004)(486006)(256004)(2351001)(25786009)(186003)(44832011)(2501003)(26005)(6436002)(6512007)(118296001)(478600001)(5640700003)(305945005)(71190400001)(71200400001)(72206003)(4326008)(53936002)(66066001)(7736002)(8676002)(6486002)(102836004)(36756003)(14454004)(81166006)(81156014)(1730700003)(386003)(6506007)(6116002)(3846002)(446003)(54906003)(68736007)(11346002)(476003)(99286004)(76176011)(52116002)(8936002)(316002)(2616005)(86362001)(106356001)(575784001)(5660300001)(97736004)(2900100001)(105586002)(6916009)(5250100002)(2906002); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1206; H:BY1PR0701MB1660.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: 4EkByQ037PqgykXAOi9sTDtMVZ33sDC33dBwKV7knVqHj3Pq35xOQyP/M6C60yOTqZQ8b9cz+TmrDtvC9tdOxkFyyXx1boL3aZKB0ZU4KPtuYAIzk2K+VoIKAQkOxseR7bIFQWDUSgcfBBycXko5OHibBrSyTGUqGtkBtiRQZ77vLpFNze6I2T8rWB5UrkFfbDykqrJLpd5nLUuPSf3vvocy9GiJB0+ofLSYZdOTfagy4hLDmaZkO3qe3YrrfxjJOSFf2KTOV0SKWvQTlJMO1WZW1S3b88lfJUg+pAlYXL51oDYf95sJojRgxij0Bae1isoW2r6sT8OiINHfWPfNuiheCFAmXc2dbp6ptbCOrmM= 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: 61de4488-a43c-4e12-bdfd-08d62f654195 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Oct 2018 10:35:26.3953 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 83e2e134-991c-4ede-8ced-34d47e38e6b1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1206 Subject: [dpdk-dev] [PATCH v5 14/23] 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: Thu, 11 Oct 2018 10:35:28 -0000 From: Pavel Belous Add support for Rx/Tx descriptors status information. Signed-off-by: Igor Russkikh Signed-off-by: Pavel Belous --- doc/guides/nics/features/atlantic.ini | 2 + drivers/net/atlantic/atl_ethdev.c | 8 +++ drivers/net/atlantic/atl_ethdev.h | 12 ++++ drivers/net/atlantic/atl_rxtx.c | 125 ++++++++++++++++++++++++++++++= ++++ 4 files changed, 147 insertions(+) diff --git a/doc/guides/nics/features/atlantic.ini b/doc/guides/nics/featur= es/atlantic.ini index c630496f0ba5..e4b7cc18778f 100644 --- a/doc/guides/nics/features/atlantic.ini +++ b/doc/guides/nics/features/atlantic.ini @@ -13,6 +13,8 @@ CRC offload =3D Y L3 checksum offload =3D Y L4 checksum offload =3D Y Packet type parsing =3D Y +Rx descriptor status =3D Y +Tx descriptor status =3D Y Basic stats =3D Y Extended stats =3D Y Stats per queue =3D Y diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_e= thdev.c index 3c27a5037e03..2af95b457154 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -191,6 +191,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 static inline int32_t 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 4e0ca59943e5..5a49c4fc65e1 100644 --- a/drivers/net/atlantic/atl_rxtx.c +++ b/drivers/net/atlantic/atl_rxtx.c @@ -651,6 +651,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