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 E4C15A056F; Tue, 3 Mar 2020 09:20:30 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D1FA31C012; Tue, 3 Mar 2020 09:20:22 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2054.outbound.protection.outlook.com [40.107.236.54]) by dpdk.org (Postfix) with ESMTP id 2C3FA2C02 for ; Tue, 3 Mar 2020 09:20:20 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vzzktss7MBer/xgiB/5HN8pR+T7xkraq+Vk2+YuzHVYAitZvwtCxcMuIac43Bw+nr/nanrKZJlwuRJ0/rlGNYKWhBDBC9N/PQQHLsOl/km600WyK1KOBUweZZ/z4tcuJhSIZB2V21ObAn2spuirC/u/B8MNtjg1O39JmT+1Gym+xGAINvh2/uZb5ysHjeZwe5rFV03ZPWEZrQL64ZYkIPgM8i9481N0xuRiu/4wL+/RjqFZMlYtitwvHhOVpOSzEHFBuRWqXqIEi2RhkSs+fh1hXXAgqDZHq/o18VXbcM80asIrnHlFTJ3BG7F6qn6KYshEMaWs5WPlQDO65zJWAew== 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=+7IC5G7WDk7MZD7juR/MjnTbfPVIZVwwjRnNlsnGjV4=; b=ZBYVZHYzMjq15AQtsvY1iHyRqMMUvsY7ee/CCJuhRI+D9RyHVL/3hUJGmzrL6rMPkGuQUTNZ5WtkwTNA1gersQsK9r8R7+nPwb2AWXnyaqsrt3q+3yYKikphiuJpErhOlDmR/yI8BHKqzAAAhGx1ulIBZZUkWwxMUgmJTY07TwWBDJVQCRIY4D3M//ZFr3bgSEDDnV60L8ewIDWrnSQz+9KXnZD9TbSqgbvbHiiIVh5YRBP3LMvGJ+HYDxUXTQKNJc9UIe6tK+sfq+Dtab/F41XI/tv9LN0uIPSVRWaBhfmNbbyM+iOjegR1lY2F+RgqzE2MR0QwnANKTPvqaI0A7w== 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=+7IC5G7WDk7MZD7juR/MjnTbfPVIZVwwjRnNlsnGjV4=; b=1ffHTGr4xFVJ7uFGgZKXxnttWAgEElcnV16T3tyf8E9h8xr53kRZ6jR0uhL2ufAMiCH/aq+UUkqtfecDohzZKB/GZLLnfwfavUCyYxmsvBaOQ5Iw7ygnc8w05DW9odTkJpF3vHb7aNNsd4UOttvlybGAjM84bYPKIPfEBRpVEqU= 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 DM5PR1201MB0140.namprd12.prod.outlook.com (2603:10b6:4:57::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.14; Tue, 3 Mar 2020 08:20:19 +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; Tue, 3 Mar 2020 08:20:19 +0000 From: asomalap@amd.com To: dev@dpdk.org Cc: Ravi1.Kumar@amd.com Date: Tue, 3 Mar 2020 13:49:58 +0530 Message-Id: <20200303081958.71437-2-asomalap@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200303081958.71437-1-asomalap@amd.com> References: <20200303081958.71437-1-asomalap@amd.com> Content-Type: text/plain X-ClientProxiedBy: MA1PR0101CA0045.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::31) 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 MA1PR0101CA0045.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.15 via Frontend Transport; Tue, 3 Mar 2020 08:20:17 +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: 6e33cabf-b683-4f0c-ab4f-08d7bf4bb5bf X-MS-TrafficTypeDiagnostic: DM5PR1201MB0140:|DM5PR1201MB0140: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2000; X-Forefront-PRVS: 03319F6FEF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4636009)(346002)(366004)(39860400002)(136003)(396003)(376002)(199004)(189003)(8676002)(8936002)(2906002)(6666004)(316002)(66946007)(81156014)(7696005)(1076003)(81166006)(52116002)(5660300002)(66476007)(66556008)(6916009)(956004)(6486002)(186003)(16526019)(26005)(36756003)(2616005)(478600001)(9686003)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR1201MB0140; 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: 7xj7xkpyqMSFq/gv5VCC+IExqX2SEgvBD5EbinKa20aS8fYeC4opiFolVhrAOemLK3TzRaddNEXud0LlXVfyAeOuHZb1TgXjwZE9jAJF3yjca6lNDp5lBYBVLwERLKCwzulYM4ymrIBb5b5GUEYl4uHqza5FTYzkTRELRXyzkpT2ioIm1CneAmIzCDGC6viDfpHS2DrgODz06aXbpsLyen8mv1N31O37iFrVsi75pAs16LKnsiCIyF5gb0NQGGVKzHU50N7nb9Hfqo+1pGbEyISWdKTlIoMPh9pCpyNDA0l+rORNc0+46XOKDcRm5kiNWE4jaxbX9mhQ2IV35t1rDbvAt3wg1qspDLl2Le91As/yxUydZ9+weSs7GgHPzBuyF/w9HSr9NEPAsWWRyji8q33YdXqfIol74lvFuYfqt1nrRsklZZCLA58mY5bWOhBn X-MS-Exchange-AntiSpam-MessageData: aZdoBDEZVaQrqOASqK6Cxycbqepihec+YQnQAewF+6AiXxQLAw08pA4NEe3ymiqtJ8rLmK/HfKeBfSknS2etJBRBSX0mLyVwtGgbxwT+0FgjnYWxrhfRHyKoeqi0iPtnVOSQKa5LYpL/F66OcYdweQ== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6e33cabf-b683-4f0c-ab4f-08d7bf4bb5bf X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2020 08:20:19.3472 (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: GK1tZX7EGz+S+ibBiSkvMM+AUgio2UjPOVKF49uJtVaVSxWfzzYTU5UuVp8YgzExNq9PV8PkqPseERefuxjKPg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0140 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_common.h | 16 ++++++ drivers/net/axgbe/axgbe_ethdev.c | 94 ++++++++++++++++++++++++++++++++ drivers/net/axgbe/axgbe_ethdev.h | 1 + 3 files changed, 111 insertions(+) diff --git a/drivers/net/axgbe/axgbe_common.h b/drivers/net/axgbe/axgbe_common.h index 2ac4d8946..bdd85a341 100644 --- a/drivers/net/axgbe/axgbe_common.h +++ b/drivers/net/axgbe/axgbe_common.h @@ -835,6 +835,22 @@ #define MTL_TC_ETSCR_TSA_WIDTH 2 #define MTL_TC_QWR_QW_INDEX 0 #define MTL_TC_QWR_QW_WIDTH 21 +#define MTL_TCPM0R_PSTC0_INDEX 0 +#define MTL_TCPM0R_PSTC0_WIDTH 8 +#define MTL_TCPM0R_PSTC1_INDEX 8 +#define MTL_TCPM0R_PSTC1_WIDTH 8 +#define MTL_TCPM0R_PSTC2_INDEX 16 +#define MTL_TCPM0R_PSTC2_WIDTH 8 +#define MTL_TCPM0R_PSTC3_INDEX 24 +#define MTL_TCPM0R_PSTC3_WIDTH 8 +#define MTL_TCPM1R_PSTC4_INDEX 0 +#define MTL_TCPM1R_PSTC4_WIDTH 8 +#define MTL_TCPM1R_PSTC5_INDEX 8 +#define MTL_TCPM1R_PSTC5_WIDTH 8 +#define MTL_TCPM1R_PSTC6_INDEX 16 +#define MTL_TCPM1R_PSTC6_WIDTH 8 +#define MTL_TCPM1R_PSTC7_INDEX 24 +#define MTL_TCPM1R_PSTC7_WIDTH 8 /* MTL traffic class register value */ #define MTL_TSA_SP 0x00 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; diff --git a/drivers/net/axgbe/axgbe_ethdev.h b/drivers/net/axgbe/axgbe_ethdev.h index 436d780c9..1d70559bf 100644 --- a/drivers/net/axgbe/axgbe_ethdev.h +++ b/drivers/net/axgbe/axgbe_ethdev.h @@ -586,6 +586,7 @@ struct axgbe_port { unsigned int rx_rfa[AXGBE_MAX_QUEUES]; unsigned int rx_rfd[AXGBE_MAX_QUEUES]; unsigned int fifo; + unsigned int pfc_map[AXGBE_MAX_QUEUES]; /* Receive Side Scaling settings */ u8 rss_key[AXGBE_RSS_HASH_KEY_SIZE]; -- 2.17.1