From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 83CD0A0568; Mon, 2 Mar 2020 09:16:06 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4C05F1C001; Mon, 2 Mar 2020 09:16:01 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2049.outbound.protection.outlook.com [40.107.94.49]) by dpdk.org (Postfix) with ESMTP id 8D4D12E81 for ; Mon, 2 Mar 2020 09:15:58 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CM7/ClhW8y5KJMVI35eKmkgulX6GtlsYbVAKM5PExveRrMbAkOu38kVD070lYbR+3hLaLYGvcc8s7v615j/DdnZrAljNJ0//6U6LqtDkSOTnvZGXOAWHuaSNRpIwoClL9ipg7AKC35E+qmQIkG2zsC0yv0OrVRjjZVpKh3wP/MN9RcodCy3npyvqCXAusRDopkz36sPrQubUEMwM5Dw3FhfEL65ihVP61P3G8qc63vd/rLt0TRCsGZDn8Ex87wffWPHB97pvq1U7U5AYtq4byeBiXllrJcovFAb5y9pu1I4AetXRG5qp3U18ZrCVqWjzmmRW/qPm8digyKFddjyUOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5V7pz00i4ja/12Jz/+eBzTtRMWmtzExgL9XXwyPHAZY=; b=BNIG/kY0/rjAZ3/7mIXdCoZpCQsE+JTwxc3PAjphfGiW4c6RaRBh58V/mOXJ2zvTUIl45I3KPK7usrgTwTRxhyoNf6XW1oOx4+HLpfdxhGSain4LhM/nvssbFZTJF3CCxFVUwdt889t53KBek1SuG8w0fkNeQYOZFgmJLswuGtq17jQkb4Q9n7jbJeFVxA6LBrEs+AnZYnrfPCajXZXP4kNJ5qj9vhCbV/f8lYbTMn58aCwhsr+thz9UTgsPbA4yLnMw5Rhlo7FELBJAebFjets3Vk3mDYGqacagpxaI6+m86UNEpRJ+2Q7GCvOTeCHHctDsmzTHXJtCAW9+kOcXBw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5V7pz00i4ja/12Jz/+eBzTtRMWmtzExgL9XXwyPHAZY=; b=4bBv6jXjRt3bfZIYwa2hWfkGvw0W5Yey0A/o1V3eI8c3BTbIpf6UnTGgYXLk7iqF4eLTky+sSsgEe3Oq1yB3GBhLDfjinS53NkcHirhnMl+Az781x/CxG8M4fobABCIqyO9k1vlZTlwa7eAY3jjNApk2sdJhQxKImaOYXdGIXXU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Amaranath.Somalapuram@amd.com; Received: from DM5PR1201MB2474.namprd12.prod.outlook.com (2603:10b6:3:e3::8) by DM5PR1201MB0026.namprd12.prod.outlook.com (2603:10b6:4:52::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.18; Mon, 2 Mar 2020 08:15:57 +0000 Received: from DM5PR1201MB2474.namprd12.prod.outlook.com ([fe80::f914:4efa:e6a:8d81]) by DM5PR1201MB2474.namprd12.prod.outlook.com ([fe80::f914:4efa:e6a:8d81%11]) with mapi id 15.20.2772.019; Mon, 2 Mar 2020 08:15:57 +0000 From: asomalap@amd.com To: dev@dpdk.org Cc: Ravi1.Kumar@amd.com Date: Mon, 2 Mar 2020 13:45:33 +0530 Message-Id: <20200302081533.99889-2-asomalap@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200302081533.99889-1-asomalap@amd.com> References: <20200302081533.99889-1-asomalap@amd.com> Content-Type: text/plain X-ClientProxiedBy: MAXPR0101CA0018.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:c::28) To DM5PR1201MB2474.namprd12.prod.outlook.com (2603:10b6:3:e3::8) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from amd.amd.com (165.204.156.251) by MAXPR0101CA0018.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:c::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.14 via Frontend Transport; Mon, 2 Mar 2020 08:15:56 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [165.204.156.251] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 54dc6a76-5590-42b6-446c-08d7be81ef5e X-MS-TrafficTypeDiagnostic: DM5PR1201MB0026:|DM5PR1201MB0026: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2000; X-Forefront-PRVS: 033054F29A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(346002)(39860400002)(136003)(396003)(366004)(199004)(189003)(7696005)(52116002)(16526019)(6666004)(36756003)(2906002)(26005)(478600001)(2616005)(956004)(316002)(186003)(66946007)(5660300002)(81156014)(81166006)(8936002)(9686003)(6486002)(4326008)(8676002)(1076003)(6916009)(66556008)(66476007); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR1201MB0026; H:DM5PR1201MB2474.namprd12.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GvjuPnKPL0jOMTQ9vzEdkl0557HD+gWjyMzo000vapgpsu3GrLrdf/26sgjcZn1k0WFW5E6ScdZ6Y324oHlAqimJ71jUqTfetLygBfT4oQA8HJbLvDClQdg0J8igvgHFKAi1SxoCjGNNV6SPOp33D5K4xE8DoqVZTpLtOxpn0o7/PYz8/57ZNSTTmsAILGSWur36+vDli2mHmpBLggNe4X/oboJ5aqMXumejcUxEyvGslB2UZxaDuX8F5OVZc2UcGvnjqgoHAsZje/BGMYL37YnkDmDYCPFNsQpsns6bnvAlWQPSZdbs//5dLIMI1O6dxkLhTTIO2NbQVoXP6Jvbk9FfwDz8mt5uLl1DhH9i3u2l02nj+ZgqZSE3qnop8W/nDbStHZOl/ndBv+MvC+bj6PZCWMKe1cklqHOw8YqbfSHTciySe+r4veGAD14VyqiI X-MS-Exchange-AntiSpam-MessageData: qJXRw8BQWIt3G+6HjGAmuKu5Y2JE2OKmohsWh9teimK8DCVo3eQwwkEWOulS3nkhnOdDx5VNUnC0Z+wIy5H8ckcgW96V4FHvYAEZVQmPlugMMd6THC1WmF16qKHo+5ssjWrJami3w09qD8/nAhU2lw== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 54dc6a76-5590-42b6-446c-08d7be81ef5e X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2020 08:15:57.3355 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rXMvNxBRrbIs2M5nSVWaQr/rhoePQmqvZX3UmzqMlQ5t8qTWC8dM2z0jndX+79mEC0ov43HGJ0Of0w3pcRaU5g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0026 Subject: [dpdk-dev] [PATCH v4 2/2] net/axgbe: support priority flow control API 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Amaranath Somalapuram Adding API for priority_flow_ctrl_set. Priority flow control to set water high and low, pause_time and priority. Signed-off-by: Amaranath Somalapuram --- drivers/net/axgbe/axgbe_ethdev.c | 94 ++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c index 867c4744f..e7b731b2e 100644 --- a/drivers/net/axgbe/axgbe_ethdev.c +++ b/drivers/net/axgbe/axgbe_ethdev.c @@ -51,6 +51,8 @@ static int axgbe_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf); static int axgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf); +static int axgbe_priority_flow_ctrl_set(struct rte_eth_dev *dev, + struct rte_eth_pfc_conf *pfc_conf); struct axgbe_xstats { char name[RTE_ETH_XSTATS_NAME_SIZE]; @@ -180,6 +182,7 @@ static const struct eth_dev_ops axgbe_eth_dev_ops = { .tx_queue_release = axgbe_dev_tx_queue_release, .flow_ctrl_get = axgbe_flow_ctrl_get, .flow_ctrl_set = axgbe_flow_ctrl_set, + .priority_flow_ctrl_set = axgbe_priority_flow_ctrl_set, }; static int axgbe_phy_reset(struct axgbe_port *pdata) @@ -927,6 +930,97 @@ axgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) return 0; } +static int +axgbe_priority_flow_ctrl_set(struct rte_eth_dev *dev, + struct rte_eth_pfc_conf *pfc_conf) +{ + struct axgbe_port *pdata = dev->data->dev_private; + struct xgbe_fc_info fc = pdata->fc; + uint8_t tc_num; + + tc_num = pdata->pfc_map[pfc_conf->priority]; + + if (pfc_conf->priority >= pdata->hw_feat.tc_cnt) { + PMD_INIT_LOG(ERR, "Max supported traffic class: %d\n", + pdata->hw_feat.tc_cnt); + return -EINVAL; + } + + pdata->pause_autoneg = pfc_conf->fc.autoneg; + pdata->phy.pause_autoneg = pdata->pause_autoneg; + fc.send_xon = pfc_conf->fc.send_xon; + AXGMAC_MTL_IOWRITE_BITS(pdata, tc_num, MTL_Q_RQFCR, RFA, + AXGMAC_FLOW_CONTROL_VALUE(1024 * pfc_conf->fc.high_water)); + AXGMAC_MTL_IOWRITE_BITS(pdata, tc_num, MTL_Q_RQFCR, RFD, + AXGMAC_FLOW_CONTROL_VALUE(1024 * pfc_conf->fc.low_water)); + + switch (tc_num) { + case 0: + AXGMAC_IOWRITE_BITS(pdata, MTL_TCPM0R, + PSTC0, pfc_conf->fc.pause_time); + break; + case 1: + AXGMAC_IOWRITE_BITS(pdata, MTL_TCPM0R, + PSTC1, pfc_conf->fc.pause_time); + break; + case 2: + AXGMAC_IOWRITE_BITS(pdata, MTL_TCPM0R, + PSTC2, pfc_conf->fc.pause_time); + break; + case 3: + AXGMAC_IOWRITE_BITS(pdata, MTL_TCPM0R, + PSTC3, pfc_conf->fc.pause_time); + break; + case 4: + AXGMAC_IOWRITE_BITS(pdata, MTL_TCPM1R, + PSTC4, pfc_conf->fc.pause_time); + break; + case 5: + AXGMAC_IOWRITE_BITS(pdata, MTL_TCPM1R, + PSTC5, pfc_conf->fc.pause_time); + break; + case 7: + AXGMAC_IOWRITE_BITS(pdata, MTL_TCPM1R, + PSTC6, pfc_conf->fc.pause_time); + break; + case 6: + AXGMAC_IOWRITE_BITS(pdata, MTL_TCPM1R, + PSTC7, pfc_conf->fc.pause_time); + break; + } + + fc.mode = pfc_conf->fc.mode; + + if (fc.mode == RTE_FC_FULL) { + pdata->tx_pause = 1; + pdata->rx_pause = 1; + AXGMAC_IOWRITE_BITS(pdata, MAC_RFCR, PFCE, 1); + } else if (fc.mode == RTE_FC_RX_PAUSE) { + pdata->tx_pause = 0; + pdata->rx_pause = 1; + AXGMAC_IOWRITE_BITS(pdata, MAC_RFCR, PFCE, 1); + } else if (fc.mode == RTE_FC_TX_PAUSE) { + pdata->tx_pause = 1; + pdata->rx_pause = 0; + AXGMAC_IOWRITE_BITS(pdata, MAC_RFCR, PFCE, 0); + } else { + pdata->tx_pause = 0; + pdata->rx_pause = 0; + AXGMAC_IOWRITE_BITS(pdata, MAC_RFCR, PFCE, 0); + } + + if (pdata->tx_pause != (unsigned int)pdata->phy.tx_pause) + pdata->hw_if.config_tx_flow_control(pdata); + + if (pdata->rx_pause != (unsigned int)pdata->phy.rx_pause) + pdata->hw_if.config_rx_flow_control(pdata); + pdata->hw_if.config_flow_control(pdata); + pdata->phy.tx_pause = pdata->tx_pause; + pdata->phy.rx_pause = pdata->rx_pause; + + return 0; +} + static void axgbe_get_all_hw_features(struct axgbe_port *pdata) { unsigned int mac_hfr0, mac_hfr1, mac_hfr2; -- 2.17.1