From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM05-DM3-obe.outbound.protection.outlook.com (mail-eopbgr730076.outbound.protection.outlook.com [40.107.73.76]) by dpdk.org (Postfix) with ESMTP id 726D21B125 for ; Sat, 29 Sep 2018 12:32:28 +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=GOjsrWluW/fNOTk8Mnkj7005/UI+HbBjLXKrkK2XACE=; b=MG7/Yxw2MSU7mav8pVpSYQjHgcFF67ybRtY1sYjVkVsB6ZV54UVbPHtrbYDnxpVgAWclY/mDbqnpTB8oAl8GELNFn+52fQdK3lsdMWbNl9TsuuoTLNSurwmQzqJzWei7Z5JBCwJHaRo9Ss3yDAADYpJttTAG/x1mDpbMU2CUudM= 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.1185.22; Sat, 29 Sep 2018 10:32:21 +0000 From: Igor Russkikh To: dev@dpdk.org Cc: pavel.belous@aquantia.com, igor.russkikh@aquantia.com, Pavel Belous Date: Sat, 29 Sep 2018 13:30:30 +0300 Message-Id: <78cfcb87a404faa319b558820d6a0f80294c8464.1538215990.git.igor.russkikh@aquantia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [95.79.108.179] X-ClientProxiedBy: VI1P193CA0009.EURP193.PROD.OUTLOOK.COM (2603:10a6:800:bd::19) To BLUPR0701MB1650.namprd07.prod.outlook.com (2a01:111:e400:58c6::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d0d5cf48-fd69-4a35-3374-08d625f6da3b X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BLUPR0701MB1650; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1650; 3:IjkX3vz0T2Je+3abW2TJG3QxvwmTwc5C4eOnZcma8Yh0Xoq5k0+a5bIbAAJWQV4OqstRv/Z7XpvKloPSTNQTnmbrWXcO9bxGQZXiSpWuJL8zURmd2l2kkY88col9dDoRu7ab4VX9XffF9Hw2pfAbwCaluceW+0ipzLDLutu+OaN7X1IzYY+Eu3ElR9F5irO8kcK+mTR/u4mk4v133MB6OG/y4+ko/wYpETPHkhGz7n2hfkXumQA1VPjrEZUsMQAA; 25:E+ezU4wDmqmTbNeHNDxe9oD+k3cREKt/TrQK2Cj2zWeKWqdqtuXkYkfTy09X3YAY+1h/h8yz+jwcTMpQAFInEE4bExc2YLjGv/Q/877v8wSIZm4AIdW4CG1/qKaRM2++Csdw/x3qgI3/fGE5Dt6QiFX4jyhKQ/czxITHfOUtS9T8N7XoEUB5Vf5jg2zUgAYeQHXW2uVT6bo+/n8Qv/4YbWEPfvet64UD5Wu0mpgMUYjl9BiWpJx2DevhBSiX/j8M74ed/NZDVtS8bJZcS8cK50YrR7D24VmIOnUQrSfunmeBPUMZgMAXw3ibgcH9dLcu/xvDHpkGgL57hm4B4QC//g4s/kL7OWnJaCKaOjJf+c4=; 31:bwp+VaeeO/rvAsOQqUHJF+aUKppFn4ZRpGRt1pQIDllzAp6pi6I8WpqZNwj2gMLe6vPSTeJVudfv1f/XAPtsUlBOhb7OO+FFJ7kSzaS+EhtKMnLV4fp25EMMBIR96UimdygWk+Tlm/AWPc06QEDtLPBlG88vPzhPN+QMcsrnguU/GmLiMGSkb2DBFm7KZwIZCd3Q0YpkWNwmErFF3GDVvxi7EBrpoK3zb03E9xePl7Y= X-MS-TrafficTypeDiagnostic: BLUPR0701MB1650: X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1650; 20:dkzGbu1bb0hsYezEB3rc359xBzTTaIKKxlX06iu1WNn0kwyVJVoXBGE6mGjnIJ3dDfyHB6FqlxVvOKvVTD49t5IgfKsU8bHVwfRXfMT/yrO5j8DiU/k8E+6UgQy62dbe6rAS9k2/F6X4gGpH07dpo+6T+kHuinxBdLO6A7vTdBBnPDRLHMtUh8qex5g5YsTGABDevsLgH1qc7973LjpM/BbAZenwuK7QkH8O39JNkBjXaPWlc81OMrpQwTbtqS6RQ3i3q/XJouHt70l/nhke90RSwm/U+VJruKL7PlYr7YSXBdKFvPrvb2GBEHl9CDyy6EN5mzFrdTbxQdYaC5jF+ckyF3xgkvEkssFKe4Jki9jjFznN6BlDL0xf1hXNpjslfB4qSpcP7UJEG9vViTChu9ztjGcbr3I6lSByhVZDjar7gnNBXUaILQN2LAHyyaN959X1AwlV7hrBzwPWPIFfbQ8XNzs/fkUeClWvKt6HUsUF+iQJmoCBF4EZBDi/HCIs; 4:0+a8Kp6F4UPuBDQFcyMLuQLccJNK/Mqk+rziZKJ1qgcev0UyMAll2+bHdandDWVU19mNzX1q0Mwt6FJsYNviVcrFNpgn6IYQlTNYYE+PiK+CdbMfyE2pVKR4C/LdzXe5gT9hosox2Z6KUOBJdgNLDb/sFA9cXrwjxqo87Kl1tlwhTMUTUmbLRGuzypX0UVPUve9W4enY2sWNc1V/rq5QPnk7YsL0uUgzxRfzpPEJfitfCC/LPgm5VGETIovnmIpguugdrndFoQAl25SoHUIYNA== 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)(3002001)(93006095)(93001095)(3231355)(944501410)(52105095)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123562045)(20161123560045)(201708071742011)(7699051); SRVR:BLUPR0701MB1650; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1650; X-Forefront-PRVS: 0810818DA0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(136003)(396003)(376002)(39850400004)(366004)(189003)(199004)(16526019)(14444005)(446003)(76176011)(2906002)(6916009)(6666003)(97736004)(8676002)(81166006)(81156014)(36756003)(4326008)(316002)(8936002)(50226002)(34290500001)(86362001)(5660300001)(68736007)(16586007)(118296001)(72206003)(3846002)(6116002)(53936002)(386003)(105586002)(6486002)(47776003)(66066001)(486006)(25786009)(305945005)(50466002)(44832011)(956004)(2616005)(26005)(107886003)(52116002)(51416003)(7696005)(186003)(476003)(478600001)(2361001)(7736002)(2351001)(48376002)(106356001)(11346002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1650; 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; BLUPR0701MB1650; 23:c0vgQvNfbgRRPQ9vs2qIfTDRTL4HyiwyhEDYOFi?= =?us-ascii?Q?1W16Wge2D0kR345iHSYJNREnMUtxG/scmYGp1h2aoMrvhzSNhDstOSg07B5h?= =?us-ascii?Q?yxSuvjvW9BCCMR/+rBHAQu/7Zyo6GqmNHruCutDbaEzRyPl6PpPdvo7V325j?= =?us-ascii?Q?sndY/ua7ZVjmV4iJisSfFviu89OhvflldQxNYS8xfuOJIhwBXWfvLOOJkEwr?= =?us-ascii?Q?eHk5LsM+a9TcOgP+F6nOmcAabbMGNHo5GSFoAkKzHpBOsEEwT1tn8+u4O2OR?= =?us-ascii?Q?spn1b2BZSHcMwqfkFJZREnoQ9DabfSVEqCGUKY5OdirYUvtQ2I7ymgSoKzb2?= =?us-ascii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nuqPqgxfxJr7wYbzrzp78AXTZMC9SQDC2S2JpGajVzCqYNolv8yWaaTEvIvRvM4D6zv8YrOrRL8YKnT734sSC+MlbObANM0HQ8rmW02SGONuoveG/0v39mDQTcwsZ8kIdmLT8QF5snlDjM=; 7:8mKynijT5fmobgztybR6uf3MERPrJ6DdT5tHuDR7JTW9tydhbyBCZIRdJFrPPQT1x+ZPaZ+Wa1jpaPG86EFV4VqFihPCFNd5p2KEA7AAZ+3XzZagXMPAUdph7OWhzZrcc7cJJpL+iJZOWuG7K/ZmebjWqlSGbwIQ+mTDgFHP6aar26bMc4W7TuqSjBPM9J4IeqAnEyBcqAmvNT2ubn5zMl0Fcs1tmt4XuPk6j6311xY+La95tXBnzH2CUP6iIa94 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: aquantia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2018 10:32:21.2058 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d0d5cf48-fd69-4a35-3374-08d625f6da3b 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 v3 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: Sat, 29 Sep 2018 10:32:29 -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_ethdev.c index 51e933a3559a..243020dc00a9 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, 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); + static void atl_dev_link_status_print(struct rte_eth_dev *dev); /* Interrupts */ @@ -224,6 +230,10 @@ static const struct eth_dev_ops atl_eth_dev_ops = { .rx_descriptor_status = atl_dev_rx_descriptor_status, .tx_descriptor_status = atl_dev_tx_descriptor_status, + /* Flow Control */ + .flow_ctrl_get = atl_flow_ctrl_get, + .flow_ctrl_set = atl_flow_ctrl_set, + .rxq_info_get = atl_rxq_info_get, .txq_info_get = atl_txq_info_get, @@ -357,6 +367,7 @@ eth_atl_dev_init(struct rte_eth_dev *eth_dev) AQ_NIC_RATE_1G | AQ_NIC_RATE_100M; + adapter->hw_cfg.flow_control = (AQ_NIC_FC_RX | AQ_NIC_FC_TX); adapter->hw_cfg.aq_rss.indirection_table_size = HW_ATL_B0_RSS_REDIRECTION_MAX; @@ -1119,6 +1130,49 @@ 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, struct rte_eth_rss_reta_entry64 *reta_conf, -- 2.7.4