From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0089.outbound.protection.outlook.com [104.47.42.89]) by dpdk.org (Postfix) with ESMTP id 23F7656A3 for ; Fri, 7 Sep 2018 17:23:27 +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=umEwU/oo7bWs0zD8PqX4XeZyl6Di6SpEJmpyJuL2TJY=; b=NzduwC4KETIuD0K7eM+/CiOxTC28k2E1g322F8+l61hGUUcESCnqFYcg21t74NgQS4k0mSUT1lBqChbLVWGY2aPcgV6gJtsWFELll6ZUL6pwg7qXM0w4Kyg3rkKadd+kQol00JX8w2h/xYUZwXLfCDrjVR2E9cN4kKn/5ikwW6M= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Igor.Russkikh@aquantia.com; Received: from ubuntubox.rdc.aquantia.com (95.79.108.179) by BLUPR0701MB1652.namprd07.prod.outlook.com (2a01:111:e400:58c6::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1122.16; Fri, 7 Sep 2018 15:23:23 +0000 From: Igor Russkikh To: dev@dpdk.org Cc: pavel.belous@aquantia.com, Nadezhda.Krupnina@aquantia.com, igor.russkikh@aquantia.com, Simon.Edelhaus@aquantia.com, Corey Melton , Ashish Kumar Date: Fri, 7 Sep 2018 18:21:50 +0300 Message-Id: <1536333719-32155-13-git-send-email-igor.russkikh@aquantia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536333719-32155-1-git-send-email-igor.russkikh@aquantia.com> References: <1536333719-32155-1-git-send-email-igor.russkikh@aquantia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [95.79.108.179] X-ClientProxiedBy: BN6PR20CA0060.namprd20.prod.outlook.com (2603:10b6:404:151::22) To BLUPR0701MB1652.namprd07.prod.outlook.com (2a01:111:e400:58c6::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8b2b22c0-5797-4050-0106-08d614d5dabf X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BLUPR0701MB1652; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1652; 3:Nu3pe+4rFUlMzS7ozYGyKENls/hx3l+OrmpYPxn6f2BhCTn3ijiqiYA0KiHIzwsRQR4D4xstTXiieDQIy+b2l8/R0+QmdBzhgZ6G5njRdZeWWAtzxpCcdalNJzmUHEQ/fUnXkuScV6HZg7vBbJkWkUKZpzNYSEga9DLGlHVB8uvtLO+UVw7McCDXEuekQD9MWIYNY6UuxZiqbhohkxNR+Hd1kjRO27WDhr3PrNqzK8W1cg4j82xrD+IeXa8BECfm; 25:INZ/fm3QbaO0jURpeTg0t2Q35NsTJ8dA2yOlevEYyOugwX7+nBCIaeokn4jyEWbehI6mn89oSAIUGDSjr2iNcxJsdMgrM2w8t5yKhk5FRknr1pK9DJ/wbsW048Iu5ZlZZDOVMr0WRwKjzv9cSmlLP5YhUbV5U2NBDrQcEQ18Wf8qToBhmduLKEskolJlldlepHO6RNHIoDZN511gWzhL1iuj+WUiofl9usmgDprCCqfm96swtYy6gsDem9Kcz8ScCq/Cg/jLEJcdQpxjF4Rly0dmRbsU1Bm3kYFCgfUUbT5Alhs/2/ZhpL20iAwvJJZjnHf4JHQDBDCHhnRUR3V6qg==; 31:8LhVDit6Ya1MsoZE/QnBbhttkWnJwjngBDFL7RnQIxt/1GKV9bYOMH3DLebeeEs/w9Y8sMFlyQl5uQOPOhDL2NrD3uG0ibdTjT1/iNs9OrDZbYp9m8P+s3hOvqdOxteCqpJ9p8ZkQONOL0AFRP95NTc6QhH6M9pTjVUmDwz6P5NtVIvDXVN7w5tsfo17M0ECULEwqexsPNgcGpmHRI59rHcQEFkDUoqQHKZApf/b4E8= X-MS-TrafficTypeDiagnostic: BLUPR0701MB1652: X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1652; 20:h0YlrMVBi59/eKUB3g6HbJ7KACyfmbKP7bMZ4u9p6MTO/DIbtMejj0UtXNOH5bVLHaU/o8cwBa9C6fwicXFTx1joDSWCSWKj5VtOAP1KvuOJJQnNMQ7soGJ6tu1EmAGTvgF7PIt6gR35OFEDC5hdi2dOwysAoGWOKU69hG6mEnpti1QCU8fEmFX6aliwb5J1NCeF2lGeFSLRxVdIiTgQOUBWSZtPLOC+HeHfkZnHHmJ2Cey000BFgWaUWawdBuxgqUv5TDnTGCt6p9FU95knxFcdsZlmuUL4AmE7uXf037V6CH/qWr0keGR4ugPy3XnmAMkHQyUIXomRz6NkEi27txmeVRGonvAMNOlKbkNPb/G8EI55GTmkEOTedcCh/52Mb8DYUJihbz0Uz5M0mJ/EZj8Gm1YfJW4xOGUdGe2fgqf2HljCZ2+EFP2Anu13ikZSKbWA+l2VP3z8JColI/qq7Xgga6/ThryfpLDtqYZzq6Dj/mjwGdnYLLgO2SFUVDe9; 4:o3ctf90ASzC8xzo6JHx1SPr/RZD2f2E4o/isbpsRpaxHFcdHan4bEmuWunNyM0zEhnREk/oQxpArg7ETQudZAiR+I0C9/KkKg7GrWfKx8p9d+4jxIPr3qBdVHYkWjDRRRgEJPymM8gdiL24jsHU8OHEJ0bg4KO6WTMvV3/tkpckmojx5KT6UF0n9qV10IZ25E5fMhjg911w6jHzNdRZ0KyeQyAuAfnS+OEQfw/0ObHlnKDiWdzoeibDxffiAY/GzKlpGojCt3AyCxkzOFh3eeA== 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)(3231311)(944501410)(52105095)(10201501046)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699050); SRVR:BLUPR0701MB1652; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1652; X-Forefront-PRVS: 07880C4932 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39850400004)(396003)(376002)(366004)(346002)(136003)(189003)(199004)(81156014)(81166006)(44832011)(8936002)(2351001)(486006)(106356001)(2361001)(105586002)(446003)(2906002)(50226002)(476003)(11346002)(956004)(2616005)(305945005)(7736002)(16586007)(316002)(54906003)(14444005)(16526019)(66066001)(26005)(7696005)(52116002)(8676002)(51416003)(76176011)(186003)(386003)(68736007)(478600001)(6666003)(6916009)(6486002)(5660300001)(53936002)(47776003)(4326008)(25786009)(86362001)(48376002)(50466002)(72206003)(6116002)(97736004)(36756003)(3846002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1652; H:ubuntubox.rdc.aquantia.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-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1652; 23:TyPIbYl+ziSmPrFCNimyLvewyuWrjowzEhM4baK?= =?us-ascii?Q?y5dZtQZ+R05K37rAjRrUkXQrrc3IksPiTj3tFF7CAMo/o5XntSdbjkS0+SzP?= =?us-ascii?Q?xDKuy5abP2lgQDj31tviYT3BKW/00qo1zf8EiKb2y5vZcP/udPputQz1hRJm?= =?us-ascii?Q?6urBC2Nc9fNv8z500tERKGb0vwEcmdPl+ye3JWEJgz++SaZzK7CYutefKl5u?= =?us-ascii?Q?2nT39IAtOP+sr1SRLl4kOLRpieRkl+xuoRcnrP8ikDBPoX1D+hR+fw+iWFp+?= =?us-ascii?Q?Frjo/7q++NWulakvKJw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XBxFT6U3l1egHCU0xil2p6X5bihm3FbbHgjIV0XP10NgAdXstvBNmy2VD+/Jn8+bRfPq6bxqTY0LtHaA8GIXKxXpQ5DHduDu7+zjLJ32eKyu5Pk=; 7:hMLZwW7JLAY5tvz/17rzr9tuXmJHPuKtSxDhXN3ODAGiXLF1PmZcPQeWfMY26FFO0hSa9NoJ673Y60I1tb4HHylmL7MQkEO9fQy5G9AQAvRZ6zer4sfBYYeCYh8wAqhhIZUM7wmqJlApdSQgAvfaE7YtLCmw2rJmdBpy4YZMOH68HGrDWNUHBj8VanByj+8AS0nw8YGCNMIblEKh2Gp/PmkEtd66LLYf/M2bBoK33aDhtCc+uewNu6QILg5syu05 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: aquantia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2018 15:23:23.6603 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8b2b22c0-5797-4050-0106-08d614d5dabf X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 83e2e134-991c-4ede-8ced-34d47e38e6b1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1652 Subject: [dpdk-dev] [PATCH 12/21] 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: Fri, 07 Sep 2018 15:23:27 -0000 From: Pavel Belous Signed-off-by: Igor Russkikh --- drivers/net/atlantic/atl_ethdev.c | 50 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index ec1c22886..a95dc87fd 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -66,6 +66,11 @@ static void atl_dev_info_get(struct rte_eth_dev *dev, static const uint32_t *atl_dev_supported_ptypes_get(struct rte_eth_dev *dev); +/* 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); /* Interrupts */ static int atl_dev_rxq_interrupt_setup(struct rte_eth_dev *dev); static int atl_dev_lsc_interrupt_setup(struct rte_eth_dev *dev, uint8_t on); @@ -157,6 +162,10 @@ static const struct eth_dev_ops atl_eth_dev_ops = { /* Link */ .link_update = atl_dev_link_update, + + /* Flow Control */ + .flow_ctrl_get = atl_flow_ctrl_get, + .flow_ctrl_set = atl_flow_ctrl_set, .reta_update = atl_reta_update, .reta_query = atl_reta_query, .rss_hash_update = atl_rss_hash_update, @@ -815,6 +824,47 @@ atl_dev_interrupt_handler(void *param) atl_dev_interrupt_action(dev, dev->intr_handle); } +static int +atl_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) +{ + struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + if (hw->aq_nic_cfg->flow_control == AQ_NIC_FC_OFF) + fc_conf->mode = RTE_FC_NONE; + else if (hw->aq_nic_cfg->flow_control & (AQ_NIC_FC_RX | AQ_NIC_FC_TX)) + fc_conf->mode = RTE_FC_FULL; + else if (hw->aq_nic_cfg->flow_control & AQ_NIC_FC_RX) + fc_conf->mode = RTE_FC_RX_PAUSE; + else if (hw->aq_nic_cfg->flow_control & AQ_NIC_FC_RX) + fc_conf->mode = 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 = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + uint32_t old_flow_control = hw->aq_nic_cfg->flow_control; + + + if (hw->aq_fw_ops->set_flow_control == NULL) + return -ENOTSUP; + + if (fc_conf->mode == RTE_FC_NONE) + hw->aq_nic_cfg->flow_control = AQ_NIC_FC_OFF; + else if (fc_conf->mode == RTE_FC_RX_PAUSE) + hw->aq_nic_cfg->flow_control = AQ_NIC_FC_RX; + else if (fc_conf->mode == RTE_FC_TX_PAUSE) + hw->aq_nic_cfg->flow_control = AQ_NIC_FC_TX; + else if (fc_conf->mode == RTE_FC_FULL) + hw->aq_nic_cfg->flow_control = (AQ_NIC_FC_RX | AQ_NIC_FC_TX); + + if (old_flow_control != 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, -- 2.13.3.windows.1