From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0061.outbound.protection.outlook.com [104.47.32.61]) by dpdk.org (Postfix) with ESMTP id D15547CBC for ; Thu, 13 Sep 2018 13:36:03 +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=O6LkKWMFP9ibME15/C9p8GdSdXok+80U5hQH7KrPXOg=; b=lgR9rPYcUcuyxrzfnoE71E/heQeRDuWio0Zlq77ASo2hMqsQjKKmtV4756g8mVtFib0nP1fMKy6s02uUCG4RLZXrdsVJGp6BIeihN4wt1A+tXT7i3ERKXHe2MsUSIwUjx/aJ3zl2PHcA4cjazgK75aYC4emLdNl7r8ceNr6lXQU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Igor.Russkikh@aquantia.com; Received: from ubuntubox.rdc.aquantia.com (95.79.108.179) by BLUPR0701MB1650.namprd07.prod.outlook.com (2a01:111:e400:58c6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.15; Thu, 13 Sep 2018 11:36:01 +0000 From: Igor Russkikh To: dev@dpdk.org Cc: pavel.belous@aquantia.com, igor.russkikh@aquantia.com Date: Thu, 13 Sep 2018 14:35:19 +0300 Message-Id: <1536838528-11800-12-git-send-email-igor.russkikh@aquantia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536838528-11800-1-git-send-email-igor.russkikh@aquantia.com> References: <1536838528-11800-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: VI1PR0202CA0026.eurprd02.prod.outlook.com (2603:10a6:803:14::39) To BLUPR0701MB1650.namprd07.prod.outlook.com (2a01:111:e400:58c6::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 776c194b-b49b-4565-1b91-08d6196d15b9 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BLUPR0701MB1650; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1650; 3:GWAKlc89msuiLAec8+FdHW0eGcPoX12BN3d82hEp7ZM8bpfjTasqa5E99MJ3hQ78tGCkMS7jnsOcym/F0Ki3nMWE1AV3cM9xTlgKjHXkPUdrBH/J7InQahZiKet4G4FSRJzNXzYRXhyuWMnIa+4g6tTnj8DFURcz9iIIKEsAIRy1LpP1dgx14XYp0du/940oCCg27KMiuZUCw3j63BcD4WgzcoWd7i2nSuTPMeqFpuGrFL66uVAe/zL3vl0MHcFk; 25:JkRvlLzG1gQF4aMpoytP7V5ZC8/8RCXaFgExzdoOb+naREz+NQtqPnsE07bGcqamOstKETJjklva4Rrdkr6iUYlREglHX9CsorqwJG+vgPwv9HEfh3opTqbB6kSHCaxftXVTXwmDPCgfBdFlHj+FtAGtK00NrWWPc4Wl64NglmdWfxpGOinkIMUynBLTg3XAs8i2+3d+ceWdQHDJLM5ukg+im7yGjxeVOUWqFakS/FKwZHTgq2wmINkqhbIQXGGk7wnUWQXl92c5NB+QSwftR4ljZi8zGW5YNaPQ4MYE+k3IlkaHjISianupDtguBSowJUfRwZBNyPe3ccXPdp6nojLpm9XnvIgPcRvoObQyAkk=; 31:5nYp4FdvngTNblzJVQsdlvlblqHcO7pNhtcyU9LWAmVSRJVDuq9PapCvE7/ClIicHxKBBMgF2JZYzgnWRZ7CT7M6VYF0VSOGJWrnkE9ieIWCYhQhwatLvwDUuXjBN5lc8ph07sTvKPyrkQTXJqw7tIsAeNdOAeefu+t2rQ7gHK7K4ydjTx5jrVr8FCOptDDJeKntoIYbUXmHAf9GeIzzfpNbXoOuFnUR/PntyBvjLE0= X-MS-TrafficTypeDiagnostic: BLUPR0701MB1650: X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1650; 20:eI3OxPsiK14NnaxIAcGN+UHPhMkiW7x65LL9m93eGBuQ6+IvjgMeCfpnWGSvPjRN0QZjNxGGQzTDodKANieoLN1Xp7EuIVUDdzX+97RzRwjVZFioHJgFyyKPFuLEgrxgsCLOPUMSuwISay4fIftZaQ3emILvMyk+TEDVl+i9boK+lbeZHZ/DrV812g8sa3De/9rRaIpO/N80b4wmMZ72VW2GO3U8jBI7Wl3hOAqGpQGGlNfZ4w8Bqnl9PTmQeZjEeyoET5paY/Aux3ZYXoU/DFipRZgY2Ux+bcJbIZ14uh+aTHq2hZppiNYKpNFkKue7mXA4Xg4eNdRCEfp8tYLvGPYE64vYA0KGfmzY5Y9KAQ+ZAmE0CySNt04HiObhEWTndYnGJ++kYa4DLOQlVwEMbRj9dljkwgsNDJNh2eaNLcsM/GldhEci1dZs1xcuvoOoZA5sXr26ELe+V0qmJKUzbbInDBK1coV76WN+vODtmhuvqjlOYkNfNhuzkGSXe3mC; 4:9NgGTYnQeTBRiXnoer0dgpqI8ksOOw3JzH3oMehW0DpFzTteqIl8Kh8oaO7ctVboLVOLrCF7jaV+SGCoziFF02wwRIVELw/vrX/PK301LapHmJAJXsXLg9sbRs9N6Y98edaCZXco26se9iHBNAVBYz+6Ptejq8XtpO4iei99nmBEdDXbi3n94rdhmGt8n3vLYwQl6PNVU9XJO0vqBsHO0qmGmzHZeCldmjm6PnsNz+hNMn+NWQIT1EzbYcjp4TApmWhbO+mfuQmqw68/OS/e/A== 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)(93006095)(93001095)(3231311)(944501410)(52105095)(10201501046)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201708071742011)(7699050); SRVR:BLUPR0701MB1650; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1650; X-Forefront-PRVS: 07943272E1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39840400004)(366004)(396003)(376002)(136003)(346002)(199004)(189003)(6666003)(6916009)(97736004)(8936002)(68736007)(25786009)(50226002)(81166006)(81156014)(4326008)(107886003)(6486002)(51416003)(2906002)(53936002)(5660300001)(36756003)(86362001)(316002)(52116002)(8676002)(16586007)(7736002)(305945005)(11346002)(446003)(476003)(956004)(47776003)(72206003)(66066001)(44832011)(478600001)(486006)(186003)(26005)(16526019)(14444005)(386003)(48376002)(2351001)(106356001)(2361001)(2616005)(3846002)(105586002)(50466002)(7696005)(6116002)(76176011); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1650; H:ubuntubox.rdc.aquantia.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-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1650; 23:Ds8shc58XoBDX5PnpyBu1IuCVsc5uniz2E+AE1D?= =?us-ascii?Q?uPAe4G8iVYAoD11DsJ4SJz8OuPL/9qEI3hpXfEPilxDbtOd4/n6Sy9mgfonD?= =?us-ascii?Q?GDuXfE0wbBrcYRYEAS52Ir4SfcQbAIq1E1eHnMJHC4McKZ+lNVIafM1pP+ya?= =?us-ascii?Q?vj5rH+J+g+bbmC7d03nCOVxF4LQe753FaCeoRNM8DbIimrKxKXQyjZlqaBFD?= =?us-ascii?Q?cTDWaXnaOnwgD5GlmQ+Ff6zj8yyi2LKXRVzyLdVk9tKSqwR5CRWjp8rXBAs9?= =?us-ascii?Q?LJ387akIXzV38eJ0pMgorp1gmuOSDdpdmWyL8nRPlGfleunDjfvoyuOxuski?= =?us-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Jresdoz4eyYASA5hwNFpBkLuxBIxHnQ//6fCCS37UQZrxSsSPp42RiIV1BEr5wnRYsFncEXDq2NwXNWIbT8=; 7:RIu5BK3SGNGHMc61W4WHQ2rxLMtvdV8+2NkPZ5o+pMTs9dYmN69KU0Y871KFp7kxanxmxLWpo+/vXfuK4xfLpVBL3PAEqSGNoncFdcMc4iB/F70sIJ53qOjrFqKRbZO5bN60qYtGRYM+NLxy4XAhvJZ3Ya2JkWUnqxzjU0oXFOO8q1xJNnrSVTa0v1fQQCVHzX73jwN/Ao1VTFRHqa4YZJ1JZC+8w5IGRH58gW2Y4ICRQG0G1Ana8cIx8s02aAd6 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: aquantia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2018 11:36:01.7168 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 776c194b-b49b-4565-1b91-08d6196d15b9 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 v2 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: Thu, 13 Sep 2018 11:36:04 -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 b58f684f6..72acb053d 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, @@ -821,6 +830,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