From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 40CB5A0524; Fri, 31 Jan 2020 16:12:47 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0ED0E1C0D0; Fri, 31 Jan 2020 16:12:47 +0100 (CET) Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40072.outbound.protection.outlook.com [40.107.4.72]) by dpdk.org (Postfix) with ESMTP id 181BF1C0CF for ; Fri, 31 Jan 2020 16:12:45 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PX8uPuiZm2x13qx4wLgMf3q9iUG/BuIcVx2+WPBMyU0pIY6CHpNGbkX5mwHlq3Refa7PxFQwkzpip4Y/XPLIt9/83wTei4Mb0jelX0p6ToYYgdNbfMcebtwclqqxW11DJBhvi8RvI2La/pwnRgL4Shw2BSXF7Z+GZ9q8A49pJ3vjznAz4EycaMWbKpChJGxdrp5lzEoWc/Q+Httceb7b+VAQ4ttP3tR3yY3e8cKzXXGhP38nDP7Taq9KWGFqRiUEsX9w7V9xMSwma3C+otxFRrpS8+t61lFDV6B4rOA034tLZhdiS2Ywh14CKkPzMVxc/+Eely/o5qjn739ApLAH0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mP+POU6pY0NrWGTvkemPyqOgDloRZM3KCxCqUKNWGys=; b=d3Hr210uXbTTk3H5A/1Ry+WrejV9gWef+LFHK+QboYZNxG24/9oft2DLoO7lhSvPphkkR4OQ/+zGKQZXB7LL51khGmoLVCgbe41CwQlLa0FidH4L1BIWxH39fHkrEw/xNKbk9pwa9hIBVHYB25DXZ9xym/HlYqgHcTXqe/p0XDqkbDtFDVEeSWLSgw1jQgdiDFf4LXtMJEzeK3GAkJJ3KCHDMl1sZGsbJ/Lz37UqbjR0U7qGZyuhXE0XkHAJQkgoU/eYSwa0OAhePfMLcffjps7IgTXBYsNy1ziz//fpX3HkuRlMvFE1oSeGuNlk5q+0MWUX3LNERqEHm1at9ImwiQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mP+POU6pY0NrWGTvkemPyqOgDloRZM3KCxCqUKNWGys=; b=g3i7ojSsxiLIMTqgPVVqF4t4dGgA7nXYuwvSfsx7i2qt5iBP5p4S1leSU6IjgruJt3H/ZQcYJIO/PSTi+U5sERUYyIBsg0H0LQJvOUswQTbrcYO96jBaWbu7l0bmSo1sOTdg5Cet+lO49ozPRsZoUiXb8e/EZYH3xRhbJC9niOc= Received: from AM4PR05MB3265.eurprd05.prod.outlook.com (10.171.188.154) by AM4PR05MB3474.eurprd05.prod.outlook.com (10.171.186.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2665.24; Fri, 31 Jan 2020 15:12:42 +0000 Received: from AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::68eb:ad79:71f4:110f]) by AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::68eb:ad79:71f4:110f%3]) with mapi id 15.20.2686.028; Fri, 31 Jan 2020 15:12:42 +0000 From: Slava Ovsiienko To: Alexander Kozyrev , "dev@dpdk.org" CC: Raslan Darawsheh , Matan Azrad , "ferruh.yigit@intel.com" , Thomas Monjalon Thread-Topic: [PATCH] net/mlx5: add Rx/Tx burst mode info callbacks Thread-Index: AQHV14pCSgR/91IctUetEWPZ++06IqgE4psw Date: Fri, 31 Jan 2020 15:12:42 +0000 Message-ID: References: <1580401681-130802-1-git-send-email-akozyrev@mellanox.com> In-Reply-To: <1580401681-130802-1-git-send-email-akozyrev@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=viacheslavo@mellanox.com; x-originating-ip: [77.75.144.194] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 8881326e-7db3-4665-d7b9-08d7a66004ee x-ms-traffictypediagnostic: AM4PR05MB3474:|AM4PR05MB3474: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr,ExtFwd x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:183; x-forefront-prvs: 029976C540 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(39860400002)(366004)(396003)(136003)(346002)(199004)(189003)(8676002)(7696005)(81166006)(81156014)(8936002)(86362001)(4326008)(55016002)(9686003)(64756008)(66476007)(316002)(33656002)(52536014)(478600001)(76116006)(6506007)(71200400001)(186003)(66946007)(66556008)(53546011)(110136005)(5660300002)(66446008)(2906002)(26005)(54906003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3474; H:AM4PR05MB3265.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: B65Knoc3fh5IT9kYE515JwAEd4qk0UkW3mylHM+kTP7OCMN/x16D+rN4bF4a206cuU4xaH0aDgn/MHcT/iLihnz9LxcQp3iZv30cKuiEYpidA3f2nhGzhqf81mxnJu7OpJqpI/7exPRA5ZotMMVZKncbmXI5P5+Fn//4ncL+g9/sHn83mQvrSCALQc3wicCdCeeZZIVuNyKyPVrVXJYFj5e1zvMnU9V2CwZTAlnFKrS9z8WGEvwNajjO/msALUvQAr1ggne1VHTckKmKx7T8bSPTFQ+fq8T4ZRnjrKM9uj6A6bIGWjh5IGUBTshcwk5COgHMU0rwtHU2PHAQYqk39g6Gn0KswVVOxO+BByA1H8MHhvE4G4d7R29g6L7/ddmQI+jYyqQQJweChQ5p2N+TcPKwzDa9sYkmjiVDenIqtmlTSrB4jN3+N+vfv5mQcGZl x-ms-exchange-antispam-messagedata: iKELJpfZE0WYE2qcWDfr//N+PHSl52eOdZnPOXqBceKeqHMjFWJy7o88+CiKThSX/jz0m/Vt9IGlKtZ7T41Nnsg9eWzWZeqTVvqA4Bb8Izlyh3Z/EhgwcTqrYvH60D9ktIAGMqP3jOvskoenUPAncw== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8881326e-7db3-4665-d7b9-08d7a66004ee X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Jan 2020 15:12:42.1380 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Q9Rj3sTgh5mLJVqSXC/YZ1e6Iv+TXbXdpKV6+v9NMpIE4oqUqZ0KcN8oYVy1e58Fwwb8pxezZS9jN6sshHZIUjvocBc6LFgObMBgLY2j+EQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3474 Subject: Re: [dpdk-dev] [PATCH] net/mlx5: add Rx/Tx burst mode info callbacks 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: Alexander Kozyrev > Sent: Thursday, January 30, 2020 18:28 > To: dev@dpdk.org > Cc: Raslan Darawsheh ; Matan Azrad > ; Slava Ovsiienko ; > ferruh.yigit@intel.com; Thomas Monjalon > Subject: [PATCH] net/mlx5: add Rx/Tx burst mode info callbacks >=20 > Get a burst mode information for Rx/Tx queues in mlx5. > Provide callback functions to show this information in a "show rxq info" = and > "show txq info" output. >=20 > Signed-off-by: Alexander Kozyrev Acked-by: Viacheslav Ovsiienko > --- > doc/guides/nics/features/mlx5.ini | 1 + > drivers/net/mlx5/mlx5.c | 12 +++ > drivers/net/mlx5/mlx5_rxtx.c | 172 > ++++++++++++++++++++++++++++++++++++++ > drivers/net/mlx5/mlx5_rxtx.h | 8 ++ > 4 files changed, 193 insertions(+) >=20 > diff --git a/doc/guides/nics/features/mlx5.ini > b/doc/guides/nics/features/mlx5.ini > index b0a2f8e..3d1c5d6 100644 > --- a/doc/guides/nics/features/mlx5.ini > +++ b/doc/guides/nics/features/mlx5.ini > @@ -10,6 +10,7 @@ Link status event =3D Y > Removal event =3D Y > Rx interrupt =3D Y > Queue start/stop =3D Y > +Burst mode info =3D Y > MTU update =3D Y > Jumbo frame =3D Y > Scattered Rx =3D Y > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index > 3b8de8f..ac793bd 100644 > --- a/drivers/net/mlx5/mlx5.c > +++ b/drivers/net/mlx5/mlx5.c > @@ -1389,6 +1389,10 @@ struct mlx5_flow_id_pool * > .filter_ctrl =3D mlx5_dev_filter_ctrl, > .rx_descriptor_status =3D mlx5_rx_descriptor_status, > .tx_descriptor_status =3D mlx5_tx_descriptor_status, > + .rxq_info_get =3D mlx5_rxq_info_get, > + .txq_info_get =3D mlx5_txq_info_get, > + .rx_burst_mode_get =3D mlx5_rx_burst_mode_get, > + .tx_burst_mode_get =3D mlx5_tx_burst_mode_get, > .rx_queue_count =3D mlx5_rx_queue_count, > .rx_queue_intr_enable =3D mlx5_rx_intr_enable, > .rx_queue_intr_disable =3D mlx5_rx_intr_disable, @@ -1411,6 +1415,10 > @@ struct mlx5_flow_id_pool * > .dev_infos_get =3D mlx5_dev_infos_get, > .rx_descriptor_status =3D mlx5_rx_descriptor_status, > .tx_descriptor_status =3D mlx5_tx_descriptor_status, > + .rxq_info_get =3D mlx5_rxq_info_get, > + .txq_info_get =3D mlx5_txq_info_get, > + .rx_burst_mode_get =3D mlx5_rx_burst_mode_get, > + .tx_burst_mode_get =3D mlx5_tx_burst_mode_get, > .get_module_info =3D mlx5_get_module_info, > .get_module_eeprom =3D mlx5_get_module_eeprom, }; @@ -1455,6 > +1463,10 @@ struct mlx5_flow_id_pool * > .filter_ctrl =3D mlx5_dev_filter_ctrl, > .rx_descriptor_status =3D mlx5_rx_descriptor_status, > .tx_descriptor_status =3D mlx5_tx_descriptor_status, > + .rxq_info_get =3D mlx5_rxq_info_get, > + .txq_info_get =3D mlx5_txq_info_get, > + .rx_burst_mode_get =3D mlx5_rx_burst_mode_get, > + .tx_burst_mode_get =3D mlx5_tx_burst_mode_get, > .rx_queue_intr_enable =3D mlx5_rx_intr_enable, > .rx_queue_intr_disable =3D mlx5_rx_intr_disable, > .is_removed =3D mlx5_is_removed, > diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c = index > b14ae31..cd5cf92 100644 > --- a/drivers/net/mlx5/mlx5_rxtx.c > +++ b/drivers/net/mlx5/mlx5_rxtx.c > @@ -535,6 +535,89 @@ enum mlx5_txcmp_code { } >=20 > /** > + * DPDK callback to get the RX queue information > + * > + * @param dev > + * Pointer to the device structure. > + * > + * @param rx_queue_id > + * Rx queue identificator. > + * > + * @param qinfo > + * Pointer to the RX queue information structure. > + * > + * @return > + * None. > + */ > + > +void > +mlx5_rxq_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id, > + struct rte_eth_rxq_info *qinfo) > +{ > + struct mlx5_priv *priv =3D dev->data->dev_private; > + struct mlx5_rxq_data *rxq =3D (*priv->rxqs)[rx_queue_id]; > + struct mlx5_rxq_ctrl *rxq_ctrl =3D > + container_of(rxq, struct mlx5_rxq_ctrl, rxq); > + > + if (!rxq) > + return; > + qinfo->mp =3D mlx5_rxq_mprq_enabled(&rxq_ctrl->rxq) ? > + rxq->mprq_mp : rxq->mp; > + qinfo->conf.rx_thresh.pthresh =3D 0; > + qinfo->conf.rx_thresh.hthresh =3D 0; > + qinfo->conf.rx_thresh.wthresh =3D 0; > + qinfo->conf.rx_free_thresh =3D rxq->rq_repl_thresh; > + qinfo->conf.rx_drop_en =3D 1; > + qinfo->conf.rx_deferred_start =3D rxq_ctrl ? 0 : 1; > + qinfo->conf.offloads =3D dev->data->dev_conf.rxmode.offloads; > + qinfo->scattered_rx =3D dev->data->scattered_rx; > + qinfo->nb_desc =3D 1 << rxq->elts_n; > +} > + > +/** > + * DPDK callback to get the RX packet burst mode information > + * > + * @param dev > + * Pointer to the device structure. > + * > + * @param rx_queue_id > + * Rx queue identificatior. > + * > + * @param mode > + * Pointer to the burts mode information. > + * > + * @return > + * 0 as success, -EINVAL as failure. > + */ > + > +int > +mlx5_rx_burst_mode_get(struct rte_eth_dev *dev, > + uint16_t rx_queue_id __rte_unused, > + struct rte_eth_burst_mode *mode) { > + eth_rx_burst_t pkt_burst =3D dev->rx_pkt_burst; > + > + if (pkt_burst =3D=3D mlx5_rx_burst) { > + snprintf(mode->info, sizeof(mode->info), "%s", "Scalar"); > + } else if (pkt_burst =3D=3D mlx5_rx_burst_mprq) { > + snprintf(mode->info, sizeof(mode->info), "%s", "Multi-Packet > RQ"); > + } else if (pkt_burst =3D=3D mlx5_rx_burst_vec) { #if defined > +RTE_ARCH_X86_64 > + snprintf(mode->info, sizeof(mode->info), "%s", "Vector SSE"); > #elif > +defined RTE_ARCH_ARM64 > + snprintf(mode->info, sizeof(mode->info), "%s", "Vector > Neon"); #elif > +defined RTE_ARCH_PPC_64 > + snprintf(mode->info, sizeof(mode->info), "%s", "Vector > AltiVec"); > +#else > + return -EINVAL; > +#endif > + } else { > + return -EINVAL; > + } > + return 0; > +} > + > +/** > * DPDK callback to get the number of used descriptors in a RX queue > * > * @param dev > @@ -5335,3 +5418,92 @@ enum mlx5_txcmp_code { > } > return txoff_func[m].func; > } > + > +/** > + * DPDK callback to get the TX queue information > + * > + * @param dev > + * Pointer to the device structure. > + * > + * @param tx_queue_id > + * Tx queue identificator. > + * > + * @param qinfo > + * Pointer to the TX queue information structure. > + * > + * @return > + * None. > + */ > + > +void > +mlx5_txq_info_get(struct rte_eth_dev *dev, uint16_t tx_queue_id, > + struct rte_eth_txq_info *qinfo) > +{ > + struct mlx5_priv *priv =3D dev->data->dev_private; > + struct mlx5_txq_data *txq =3D (*priv->txqs)[tx_queue_id]; > + struct mlx5_txq_ctrl *txq_ctrl =3D > + container_of(txq, struct mlx5_txq_ctrl, txq); > + > + if (!txq) > + return; > + qinfo->nb_desc =3D txq->elts_s; > + qinfo->conf.tx_thresh.pthresh =3D 0; > + qinfo->conf.tx_thresh.hthresh =3D 0; > + qinfo->conf.tx_thresh.wthresh =3D 0; > + qinfo->conf.tx_rs_thresh =3D 0; > + qinfo->conf.tx_free_thresh =3D 0; > + qinfo->conf.tx_deferred_start =3D txq_ctrl ? 0 : 1; > + qinfo->conf.offloads =3D dev->data->dev_conf.txmode.offloads; > +} > + > +/** > + * DPDK callback to get the TX packet burst mode information > + * > + * @param dev > + * Pointer to the device structure. > + * > + * @param tx_queue_id > + * Tx queue identificatior. > + * > + * @param mode > + * Pointer to the burts mode information. > + * > + * @return > + * 0 as success, -EINVAL as failure. > + */ > + > +int > +mlx5_tx_burst_mode_get(struct rte_eth_dev *dev, > + uint16_t tx_queue_id __rte_unused, > + struct rte_eth_burst_mode *mode) { > + eth_tx_burst_t pkt_burst =3D dev->tx_pkt_burst; > + unsigned int i, olx; > + > + for (i =3D 0; i < RTE_DIM(txoff_func); i++) { > + if (pkt_burst =3D=3D txoff_func[i].func) { > + olx =3D txoff_func[i].olx; > + snprintf(mode->info, sizeof(mode->info), > + "%s%s%s%s%s%s%s%s", > + (olx & MLX5_TXOFF_CONFIG_EMPW) ? > + ((olx & MLX5_TXOFF_CONFIG_MPW) ? > + "Legacy MPW" : "Enhanced MPW") : "No > MPW", > + (olx & MLX5_TXOFF_CONFIG_MULTI) ? > + " + MULTI" : "", > + (olx & MLX5_TXOFF_CONFIG_TSO) ? > + " + TSO" : "", > + (olx & MLX5_TXOFF_CONFIG_SWP) ? > + " + SWP" : "", > + (olx & MLX5_TXOFF_CONFIG_CSUM) ? > + " + CSUM" : "", > + (olx & MLX5_TXOFF_CONFIG_INLINE) ? > + " + INLINE" : "", > + (olx & MLX5_TXOFF_CONFIG_VLAN) ? > + " + VLAN" : "", > + (olx & MLX5_TXOFF_CONFIG_METADATA) ? > + " + METADATA" : ""); > + return 0; > + } > + } > + return -EINVAL; > +} > diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h > index c2cd23b..10ab7fd 100644 > --- a/drivers/net/mlx5/mlx5_rxtx.h > +++ b/drivers/net/mlx5/mlx5_rxtx.h > @@ -475,6 +475,14 @@ void mlx5_dump_debug_information(const char > *path, const char *title, > const void *buf, unsigned int len); int > mlx5_queue_state_modify_primary(struct rte_eth_dev *dev, > const struct mlx5_mp_arg_queue_state_modify *sm); > +void mlx5_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, > + struct rte_eth_rxq_info *qinfo); void > mlx5_txq_info_get(struct > +rte_eth_dev *dev, uint16_t queue_id, > + struct rte_eth_txq_info *qinfo); int > +mlx5_rx_burst_mode_get(struct rte_eth_dev *dev, uint16_t rx_queue_id, > + struct rte_eth_burst_mode *mode); int > +mlx5_tx_burst_mode_get(struct rte_eth_dev *dev, uint16_t tx_queue_id, > + struct rte_eth_burst_mode *mode); >=20 > /* Vectorized version of mlx5_rxtx.c */ int > mlx5_rxq_check_vec_support(struct mlx5_rxq_data *rxq_data); > -- > 1.8.3.1