From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0066.outbound.protection.outlook.com [104.47.37.66]) by dpdk.org (Postfix) with ESMTP id 4EF051B4FF for ; Thu, 11 Oct 2018 12:35:35 +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=wOxIh1n+8mj3avUmBKbwNkXzui95814T1Fuy6seNgm0=; b=ibETbK0Fclqs/d9rjBYuo9eh4fyhKnKHlgzA6YAHJEqolh4f4Y9KiSYTStnZ5FD8Md7JqLveALkcDS++mntyN7yGCDtqb+NXSXdjZxZvH+UEI/6X1gFy4E3vl8R7eO3AKwS0OyaeRA8zNecrhgZfRJwQAq5BcPjLZvvTtwnD8b4= Received: from BY1PR0701MB1660.namprd07.prod.outlook.com (10.162.110.22) by BY1PR0701MB1208.namprd07.prod.outlook.com (10.160.105.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.27; Thu, 11 Oct 2018 10:35:34 +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:34 +0000 From: Igor Russkikh To: "dev@dpdk.org" CC: Pavel Belous , Igor Russkikh , "ferruh.yigit@intel.com" , Pavel Belous Thread-Topic: [PATCH v5 17/23] net/atlantic: flow control configuration Thread-Index: AQHUYU4jjmYUwx1RAEihOUDMaOOiPg== Date: Thu, 11 Oct 2018 10:35:33 +0000 Message-ID: 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; BY1PR0701MB1208; 6:2HmltxN/n7qI+pTjZUP+v95QkwIssaWjGl4cxKFlepV/gKyjcPzWZDDRInsNC38vIS9UDnIia/fm7H5ZCOQB00LJUENEk4lXJwqtPA+8zVM28GHLggIiIIPUBAIUeFC7I3f0zYJdRTLtUbllj2lzT3B5WoE4q04WbNd1gplRjs4Pk/gAI0TP/AzFrDyfRu2efZdfI9nEzArTINstcvjW66WHIuN1y6NMn2ef6ZAvUGK0qFsn0w9K3J3S9no7Wp3BnHTXIwdqp80pn1I+U8rG289KIoc2ZPwqdHgnsK2fvj5wT+b6fvYr4mYBCpqPdAD9NgbehkA7/UVPynhF6ejiG4AVtrnek7zJoGck01UFPm/7O+0FtHAtQ+vQRd9h3L+LcP9dSHbB3PHJhFgeW+HwK/YaNl6HjU0RhKerJhm96FiZvktLSIagEQLhJY/G4aCEa226xLFPWVE5mFq+cb9wjxXVXV+SwFogcq6TEJXL4+Y=; 5:hqKccCnGLGpnIS8p7fS3MkzYcbcgBfXFYUiFD5yLsStKt0WsXmWlrQmGyCUM9r/PRV+DJq0WYqpE2DO3e3skMP2cnRagHs4J5HuuW3YQkMrUzsJtK8bIPz9kPYqDUjvxcKBeYv14GEG7jPXPHTfoNs0WfqFO0CWACXapplLtdM8=; 7:U7Ae6oSYLP9GaDHCUTz1CHIjc/w2aAe8vIJqlxXz96H4MGDFf6uwbjIqhoePMQ+axgI7IpOBCPpDPBP+fOUyjMQbqBFTPEprlTZHM8451StzZhjT/5auzEaxydRDErj8D+OnQKWy7R/LQsAAbDD9e6TIbtGiQWyk0xGGrpXiNlloLSZAMxRmSgPY4NJRC9IROT828xCILn2RH2B7IR+2jYt5UeIZiP+iq1NAlw8lHSde8EQ4v5Gwgyv7P5xen0Oh x-ms-office365-filtering-correlation-id: bea0f6b4-e4af-442f-5b26-08d62f654627 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BY1PR0701MB1208; x-ms-traffictypediagnostic: BY1PR0701MB1208: 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)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231355)(944501410)(52105095)(149066)(150057)(6041310)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(201708071742011)(7699051); SRVR:BY1PR0701MB1208; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1208; x-forefront-prvs: 08220FA8D6 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(39840400004)(346002)(396003)(136003)(366004)(199004)(189003)(26005)(99286004)(72206003)(478600001)(76176011)(14454004)(486006)(256004)(97736004)(14444005)(8676002)(316002)(5660300001)(8936002)(476003)(66066001)(4326008)(305945005)(11346002)(2616005)(71190400001)(6116002)(2351001)(54906003)(86362001)(446003)(6506007)(6916009)(7736002)(386003)(25786009)(105586002)(106356001)(6512007)(2906002)(36756003)(3846002)(71200400001)(102836004)(68736007)(186003)(118296001)(5250100002)(44832011)(2501003)(81166006)(1730700003)(2900100001)(107886003)(52116002)(53936002)(6486002)(6436002)(81156014)(5640700003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1208; H:BY1PR0701MB1660.namprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: aquantia.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: d9WlrmeZwHk/j2AYvBBX5TDfA3x/yIIVG/jNn4B9+NL84ei2tuSy1clrV79psDn/OmavC4pwiCNgrv7JrrIDPvqF4foN7xDBBmLti5lq4dCuI3pcI3jBH4OlUdEZBYcf2gjJvvxa9/6VmA8+M4tk7knfEMTiCY6tOf/DMIjwar8tv+OlHz50ejnSyomtKyHOOse8GA5yuzg1AzGXThjqgvH5V13/1SmjqsZr61kAN2bO/kFGjORXcy9SuaLWeDN6yPI1LbuTdz3BfQoORDYjtqJr7kM+nfiyYUZTbfNoj4Q/6oTVuiRJQo21rGznAe0U1G5tag/ZkZHE600RwtrR8YspfEh2sdPWXrUKFAbljvU= 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: bea0f6b4-e4af-442f-5b26-08d62f654627 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Oct 2018 10:35:34.0034 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 83e2e134-991c-4ede-8ced-34d47e38e6b1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1208 Subject: [dpdk-dev] [PATCH v5 17/23] net/atlantic: flow control configuration 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:35 -0000 From: Pavel Belous Add support for flow control feature. Signed-off-by: Igor Russkikh Signed-off-by: Pavel Belous --- doc/guides/nics/features/atlantic.ini | 1 + drivers/net/atlantic/atl_ethdev.c | 54 +++++++++++++++++++++++++++++++= ++++ 2 files changed, 55 insertions(+) diff --git a/doc/guides/nics/features/atlantic.ini b/doc/guides/nics/featur= es/atlantic.ini index fa49e48e166d..40a4ddb4cf74 100644 --- a/doc/guides/nics/features/atlantic.ini +++ b/doc/guides/nics/features/atlantic.ini @@ -14,6 +14,7 @@ Allmulticast mode =3D Y RSS hash =3D Y RSS key update =3D Y RSS reta update =3D Y +Flow control =3D Y CRC offload =3D Y L3 checksum offload =3D Y L4 checksum offload =3D Y diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_e= thdev.c index b3f99829ce9f..0645e34df780 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -48,6 +48,12 @@ static void atl_dev_info_get(struct rte_eth_dev *dev, =20 static const uint32_t *atl_dev_supported_ptypes_get(struct rte_eth_dev *de= v); =20 +/* Flow control */ +static int atl_flow_ctrl_get(struct rte_eth_dev *dev, + struct rte_eth_fc_conf *fc_conf); +static int atl_flow_ctrl_set(struct rte_eth_dev *dev, + struct rte_eth_fc_conf *fc_conf); + static void atl_dev_link_status_print(struct rte_eth_dev *dev); =20 /* Interrupts */ @@ -220,6 +226,10 @@ static const struct eth_dev_ops atl_eth_dev_ops =3D { .rx_descriptor_status =3D atl_dev_rx_descriptor_status, .tx_descriptor_status =3D atl_dev_tx_descriptor_status, =20 + /* Flow Control */ + .flow_ctrl_get =3D atl_flow_ctrl_get, + .flow_ctrl_set =3D atl_flow_ctrl_set, + .rxq_info_get =3D atl_rxq_info_get, .txq_info_get =3D atl_txq_info_get, =20 @@ -288,6 +298,7 @@ eth_atl_dev_init(struct rte_eth_dev *eth_dev) AQ_NIC_RATE_1G | AQ_NIC_RATE_100M; =20 + adapter->hw_cfg.flow_control =3D (AQ_NIC_FC_RX | AQ_NIC_FC_TX); adapter->hw_cfg.aq_rss.indirection_table_size =3D HW_ATL_B0_RSS_REDIRECTION_MAX; =20 @@ -1027,6 +1038,49 @@ atl_dev_interrupt_handler(void *param) atl_dev_interrupt_action(dev, dev->intr_handle); } =20 + +static int +atl_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf= ) +{ + struct aq_hw_s *hw =3D ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->aq_nic_cfg->flow_control =3D=3D AQ_NIC_FC_OFF) + fc_conf->mode =3D RTE_FC_NONE; + else if (hw->aq_nic_cfg->flow_control & (AQ_NIC_FC_RX | AQ_NIC_FC_TX)) + fc_conf->mode =3D RTE_FC_FULL; + else if (hw->aq_nic_cfg->flow_control & AQ_NIC_FC_RX) + fc_conf->mode =3D RTE_FC_RX_PAUSE; + else if (hw->aq_nic_cfg->flow_control & AQ_NIC_FC_RX) + fc_conf->mode =3D RTE_FC_TX_PAUSE; + + return 0; +} + +static int +atl_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf= ) +{ + struct aq_hw_s *hw =3D ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + uint32_t old_flow_control =3D hw->aq_nic_cfg->flow_control; + + + if (hw->aq_fw_ops->set_flow_control =3D=3D NULL) + return -ENOTSUP; + + if (fc_conf->mode =3D=3D RTE_FC_NONE) + hw->aq_nic_cfg->flow_control =3D AQ_NIC_FC_OFF; + else if (fc_conf->mode =3D=3D RTE_FC_RX_PAUSE) + hw->aq_nic_cfg->flow_control =3D AQ_NIC_FC_RX; + else if (fc_conf->mode =3D=3D RTE_FC_TX_PAUSE) + hw->aq_nic_cfg->flow_control =3D AQ_NIC_FC_TX; + else if (fc_conf->mode =3D=3D RTE_FC_FULL) + hw->aq_nic_cfg->flow_control =3D (AQ_NIC_FC_RX | AQ_NIC_FC_TX); + + if (old_flow_control !=3D hw->aq_nic_cfg->flow_control) + return hw->aq_fw_ops->set_flow_control(hw); + + return 0; +} + static int atl_reta_update(struct rte_eth_dev *dev, struct rte_eth_rss_reta_entry64 *reta_conf, --=20 2.7.4