From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0063.outbound.protection.outlook.com [104.47.38.63]) by dpdk.org (Postfix) with ESMTP id BB4F71B5B5 for ; Fri, 12 Oct 2018 13:09:42 +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=cj+/LPKMH9jzQa8To/zj8dXxKT4ynBfYbBewPsOhtTo=; b=O6VeKFta9VSiYDN9zjr5UgAmVt0lhGZRzSYwsDm916K/GgvhMCzkQsPRtOjM+FhMBGrAOnp6gu8jUMwVu5x7x1xuCEunBms70PikJ6Xuuk4X2pE6wx8HLSUZefXQb4Srf3oAVUcutMcZZ0+hFxzmqQ8HwsVz/BvBEfg2K0OxvTg= Received: from BY1PR0701MB1660.namprd07.prod.outlook.com (10.162.110.22) by BY1PR0701MB1627.namprd07.prod.outlook.com (10.162.110.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.22; Fri, 12 Oct 2018 11:09:41 +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; Fri, 12 Oct 2018 11:09:41 +0000 From: Igor Russkikh To: "dev@dpdk.org" CC: Pavel Belous , Igor Russkikh , "ferruh.yigit@intel.com" , Pavel Belous Thread-Topic: [PATCH v6 16/22] net/atlantic: add flow control configuration Thread-Index: AQHUYhwSCVpxCk3r1kC4pWP8uLV68g== Date: Fri, 12 Oct 2018 11:09:41 +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: AM5PR0701CA0008.eurprd07.prod.outlook.com (2603:10a6:203:51::18) 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; BY1PR0701MB1627; 6:7fhaFlMyQ76nRs6IXYUrJuRtVyOKkvk0BgTQ0i8TfgIAa0BbyTm0wJrW5lYaOPf+oGVnz7vmGgydL8BVi6n1Boxyk5JbjUv8UlkVxYdYD7Mm/pp+53eNWfXsopY0YSa+7KdzarHCL5eB2Yq+UolklU3z/QUByaHQ46A53g0UxMSgt00Ik0/bltKGWkp0TnTdQ/GB0ShUK1OlW0Xbx9ly3xNyl+NjAoFMeWM7HHika3I8s8Iqi6JwgRopMGnsabdIJoGNsYnRUdpKcXgYmeQYqmtaIfWgmmDy3Jbbbz8RFhJkMoeD74yEQMDMVfr4k8pjqYw0nf974ZlJmTnPlHce6SG7iSVmZtApGC3VoTFq8TZa+dv7dZ3TpKkE01O5DYVgI4kBHmYK8g/m0ODAVhWyAdwDnQ3qLfDon2iVa1DQTUGRNha3fqX8xwFXmTGhieeHJewq5n/5KO9+Ot6rDReNyQX+FV9F6AYHCPcw0s7XO9A=; 5:ehIWat8xWtkAE+mNnM2E3ksYQErbwGPpSK13eDG2r8vRN5m0W9whL5pEzV3pr/DHMWblwDH5d2etFsHExLFVYx23nxMKirwt9Dl41vlFK5D3OfyMUgVwXkc4M+KGAs7BQEGuuV6lGxg+FufVs8kuHIFFofqPNugwEhWEPSxkmqw=; 7:+hKUtIt7p0ZsfgkxVallBocbHlcoIDCUU9FKeU3E9LQ8nOBUaA1AI583xcgwy9ZVXKsg1zwLa4mv6c/IsjZiPASvlEDqgXoStXyzP1kVFRImowdnos6Pu/RWzaRH8BQG8Xs9mRzIz53Ka6yMy/PIMxVPjmyX2H/C3Hmtv0fXHnX/P8SzBGf/ZZRD3dpQKlF3A79XMckGs8gUADmkhprtUikYowipQOL2hdL2Foqj/8+uIhVKgceelT0VyoAhcTkL x-ms-office365-filtering-correlation-id: 0f0cd2a4-606a-4afc-1fe3-08d6303334c2 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BY1PR0701MB1627; x-ms-traffictypediagnostic: BY1PR0701MB1627: 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)(3231355)(944501410)(52105095)(3002001)(93006095)(93001095)(10201501046)(149066)(150057)(6041310)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(201708071742011)(7699051)(76991067); SRVR:BY1PR0701MB1627; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1627; x-forefront-prvs: 0823A5777B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(366004)(376002)(136003)(39850400004)(396003)(189003)(199004)(186003)(6116002)(486006)(5640700003)(446003)(6436002)(6512007)(53936002)(71200400001)(71190400001)(14454004)(72206003)(316002)(2351001)(44832011)(3846002)(7736002)(305945005)(2906002)(4326008)(6486002)(107886003)(97736004)(26005)(2501003)(102836004)(5250100002)(11346002)(86362001)(575784001)(25786009)(476003)(2616005)(106356001)(54906003)(105586002)(256004)(14444005)(5660300001)(66066001)(81166006)(81156014)(1730700003)(8676002)(478600001)(36756003)(68736007)(6916009)(8936002)(99286004)(386003)(6506007)(118296001)(2900100001)(52116002)(76176011); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1627; 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: 5Eq1i1BKn+EsImJFl3owou9eTXpOGFy8AFUHfCqBgeOkcTIFRVEhg0dGzsYczn+c+03e9GIAQHddbTW9NB1BydFJ+lqgdQmF2VjlrivmimaCQm9+c6Mmk08mnANM4WwyTXz8SVZxLueVZxScnPs90/C8sSszibHVy5cdJS9AOSZDqgx5zEqzgfioOmlZ6ah0wR7XWa2yWkBncxwaiAAcuSRlBunpF6BMQFb4wOXIgchwAyPEE9WfMapETYljpKVM+jpdTYBRNM+v3HybubPJ/M/UjICFTtr5RDEdUpHNztCRSsIWlUsZjoJm/xoR95ZkkGi+LzqCaJKuzpt+xj7hGS/ujfJkUvy5p1cGUCPAZ0A= 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: 0f0cd2a4-606a-4afc-1fe3-08d6303334c2 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Oct 2018 11:09:41.1430 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 83e2e134-991c-4ede-8ced-34d47e38e6b1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1627 Subject: [dpdk-dev] [PATCH v6 16/22] net/atlantic: add 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: Fri, 12 Oct 2018 11:09:43 -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 592af817931e..e86707ea5c0a 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 2f365844752c..6ce4454fe2f3 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 */ @@ -219,6 +225,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 @@ -287,6 +297,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 @@ -1026,6 +1037,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