From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0060.outbound.protection.outlook.com [104.47.32.60]) by dpdk.org (Postfix) with ESMTP id 602481B45F for ; Tue, 9 Oct 2018 11:31:58 +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=svgx4jxJ8TfvO/iD5IPQkwHGcmKZKUoyI7iIE+M+VE8=; b=NOx1z2xu9DNbgXKnYs88kW+9VWd9H0OI+UpaEJB57sR4sY9iuGQ8eKUZ3k8/BuKryzI5KwIFP0Y8SSSodIyhiGi8h5RYDSC35jzuw6yD44YvecjVdLgIZtVYjBf6igE2nXg5Tr6pZGildNSWMND6xtiTdlhSkF7/gmSanLQnO9E= 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:57 +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:57 +0000 From: Igor Russkikh To: "dev@dpdk.org" CC: Pavel Belous , Igor Russkikh , "ferruh.yigit@intel.com" , Pavel Belous Thread-Topic: [PATCH v4 16/22] net/atlantic: flow control configuration Thread-Index: AQHUX7LrjUFFLzwpakO+smxkc+IThg== Date: Tue, 9 Oct 2018 09:31:56 +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: 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:Jnunm4NBAsNZlH1xxy3mu2Xpe/vaD8hsxg6ZMGFsxY9zgft6/5xkNwEwJa3kCc6xTBRAPCSv9aEzGWXCb1N9PxW3z+IxW31WeVomjNAnGn4jqeJjm7dlBVRsWX18y4+wpas8L5XAeq9A9A0pgZnhX2BYUnD71I/zqt6lZjhkpG4hudUqCqkmjWe9QLcYoRjGzs3/ZDaQ60C5PLixbNiIKhUiD1Zxhu6lECw5B5uxuzAv15SxcYws2rD88HcN5jEh1qrvNFXEPlAB7N0yxKbfZgoDPNfcP3vgfXsikOLPsnqDgaj6hD45V4eIcq4NPHTNQhmCiGCdy33fmqESDbAlq0x40nRUknaTB1B3NxS4su67ZfK+iAymHlO08d4xnvUhzkHKCdukS0BdBJYxj94FOdCcu4A7IdZPyALXCsSpz1Gl73Mjoxa5yXiCyvl+VQcM/Ib51yXLv4domx/RMSV81w==; 5:BBS/PJ6F+eugKJNZyzNMJFr2a7UD73v4GgkqA/mev8DafnPKZWS4SLL8SPDmjqbbE/OUmj2XPnXWSnCb3VFNNJ7G/b1iNtc/pTGQh0crttJ9Wp9mSAcUbRYHxFevgq2iEm0lLUGhhDqVIeAw9T8toYb/hwQPLNTRG2OWpFKdYxw=; 7:7otPaeXvdviPW16qKrQNsEP0xquif2fLhnDViKjjFKOY5eDde/9YklWOEd4mOKkma5FiApM5BVIHDes3VfoPd9baZt91y9gjlZnTXYSoN4xPMRdg1ky9uBiFIHHj8lYslujpr593YFnV7bCfRzc7f1JfCSJKi39ADj0E05wHur0WeG/z3MJT1kIT4aNsQfyX5FpXMDcdQXeeOQ+SCIR707u4RaCusUrUX+TCPjVqaKTQEXK3DLD25ZPfYoQHOr9U x-ms-office365-filtering-correlation-id: 597391c4-6771-4f3b-71a8-08d62dca0e2b 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)(14444005)(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: uNu2t+/Qdb+u0VHCsDR3BmMwfVWliSZEtmVjoikFoAv5HfoIhAaYu5Ppphi9/1CGc/FRRLZM9nZzkDvIkM86h5GFvGkyd3YV6RcaIa/tG0M8jztsZJwOlRrmRAx8K8GrLkTWKgKz3AnX/YqFu+ZoMeJyhXEXdbYruPAHR4oUfrPpxwrXG++fL4eQ6AGqnZFSgSD6CsE+fidcxQMF+vkI4SaDOvjDk3sa0ZyDeWkPzIxihezuwVvQpyURbEZnyFS2/BqojQ7z4hKcKJgNfobu792tjuLNkKxFmGtXvs01kEkQzBnq9TJpQnrIHNjZ8Q54u/KFR4pxJnxtNgNtTXo2B8TyiNdzLgVPEnrwd6TyYj8= 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: 597391c4-6771-4f3b-71a8-08d62dca0e2b X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Oct 2018 09:31:57.0030 (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 16/22] 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: Tue, 09 Oct 2018 09:31:58 -0000 From: Pavel Belous Signed-off-by: Igor Russkikh Signed-off-by: Pavel Belous --- drivers/net/atlantic/atl_ethdev.c | 54 +++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 54 insertions(+) diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_e= thdev.c index d6ec20d19a9a..efdd83fb4d6b 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -54,6 +54,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 */ @@ -227,6 +233,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 @@ -360,6 +370,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 @@ -1119,6 +1130,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