From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0075.outbound.protection.outlook.com [104.47.36.75]) by dpdk.org (Postfix) with ESMTP id 03EBC1B027 for ; Sat, 9 Sep 2017 13:11:37 +0200 (CEST) Received: from BN6PR03CA0013.namprd03.prod.outlook.com (2603:10b6:404:23::23) by DM2PR03MB559.namprd03.prod.outlook.com (2a01:111:e400:241d::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.13.10; Sat, 9 Sep 2017 11:11:36 +0000 Received: from BN1AFFO11FD042.protection.gbl (2a01:111:f400:7c10::130) by BN6PR03CA0013.outlook.office365.com (2603:10b6:404:23::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.35.12 via Frontend Transport; Sat, 9 Sep 2017 11:11:36 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD042.mail.protection.outlook.com (10.58.52.253) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1385.11 via Frontend Transport; Sat, 9 Sep 2017 11:11:35 +0000 Received: from Tophie.ap.freescale.net ([10.232.14.39]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v89BAUhY026326; Sat, 9 Sep 2017 04:11:33 -0700 From: Shreyansh Jain To: CC: , Date: Sat, 9 Sep 2017 16:51:25 +0530 Message-ID: <20170909112132.13936-35-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170909112132.13936-1-shreyansh.jain@nxp.com> References: <20170823141213.25476-1-shreyansh.jain@nxp.com> <20170909112132.13936-1-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131494290958486078; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39380400002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(356003)(50226002)(8936002)(33646002)(86362001)(2351001)(8676002)(81156014)(81166006)(105606002)(106466001)(1076002)(36756003)(5003940100001)(47776003)(8656003)(54906002)(53936002)(104016004)(50466002)(305945005)(48376002)(4326008)(110136004)(2906002)(85426001)(50986999)(76176999)(5660300001)(189998001)(68736007)(77096006)(97736004)(6916009)(2950100002)(6666003)(498600001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR03MB559; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD042; 1:eYMCu1giJKClr2WkoMOauvXTqLxLsSa4VOTuIu1Pbv3Qz8PQKd3XChVGhBOqWzMrddyguYlkRF0ICgjlQuHpb0pnzY98IybKK3a3Zy75eqNA6y2BD+DjEH5bNT1LBYzy MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 12ad81d5-12fd-4554-28dc-08d4f7738907 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(2017052603199)(201703131430075)(201703131517081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DM2PR03MB559; X-Microsoft-Exchange-Diagnostics: 1; DM2PR03MB559; 3:bUNfK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JVI0ffiKe4eL+ZNrjDwx0jNnDJmqo8ZjC1gCqhUgAAHsyMJT8tIYz3zDMVpZeavF6Gbm/gyoZzAY8eDcvLrTwwElqxUqN+NfgxiQFfMR8me0u6YGW5G9R6IkVjX2Hgeqou+k4tQWoUNLnpX2Cv5Kb7+pFvspojeu2zquTpo51aRQqxLArjYJNAxq2IhhyosbAVYx4tk/fL0JCK47TuUaDn0HxSLrZpFIP/iqERGMq42QHuQkc= X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(6055026)(6096035)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123559100)(20161123561025)(20161123563025)(20161123556025)(20161123565025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM2PR03MB559; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM2PR03MB559; X-Forefront-PRVS: 0425A67DEF X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR03MB559; 23:3XqGLtC+fYjCBJud99li0TtOV4pAxbYsJ42xOr78rv?= =?us-ascii?Q?7f/GieIKsaqc6pcNagLVI5/Jp0KpO68gMdCc2JdfNPSh5arfTdhtAJLpFIcv?= =?us-ascii?Q?HTa5q/+VZL91inQdgR6pImHsWTL5alF/vD8ZlXhjBD4PECX+NDxSCZLGyp2e?= =?us-ascii?Q?IgORpNjQlifIvLRpXUsBSVtx1Y5I/C5fcMfS4jjoYwiE6CMGXf6PvFq63wOD?= =?us-ascii?Q?l+ox0FtlUPJSXWW39UDTQf2Pmm0ZY9FVaQsiHK+DMgtbMl/VR8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UR2+BM+NMd3ZT88CxBqFc5L?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR03MB559; 6:v33YpDbW358wgQmRL700ES27bsd7vQOoccwdwQnBEVGis2clmbgK+VOcHmJrx/84/pQabe8i9BjDB8kY+arH35ABbCa22xjWrqd6EECdV/WLaQn9BTkUta6F69QppYRSVMpR9lWEfQkiSYnNm76Z+0QGalevuMwkMzLTSZATiEkjxXozRjP3qxOt3XHiBhfv6/qM6iwsciFJzwZDq/X1xyR46g1TaLhnrWxbXF90GMR1xo7jl6TuDsY+0Y950/wrKKoetohAKq+8CT49N72nZaY77uVyR0BkW5dV2UgQGOW8oZwmXKJ3L9M80e+JH8deDKPQ0ne5lUmBIGjOrv+BCA==; 5:PyJQn3L4Na+NMcG3/EBvKF/6DwGv9UjuAmhui4TUAFHr8mlOTVXxPW5i/Ym9tm/JEJ7bOpFwamPrYUSWPNqf7G3qE9a+3OSGVu65JJECFsrOKEhz26ccT6t8epIMAxKcUwLHcvSPinkVVqt4C3O3sg==; 24:MA0Z4DFOx9c4vjPVsoyGR7AAkRRl0h5kKPUoyDljiZoFrDR7MDk3SlB2+jxp/HserbZqxg13XzttrcaMw78HMEZJBkZ5hX3kSHATMq2/rEE=; 7:NYolAAqMPWJdABWIIeewBx0BzylTJcp9dZd4eslPIgj7GeCaaQbvD8VtylUMMYULHG4ybyTV3sjoV7OR3mf02zFydnk7WWglxgGFIzZzbK4N3UkQu3a6lV0lqCqUbR47Q8FGaCMn5SWm3tEEiBX+F9xqVp4fKpz58JKKcDdRsKvlR+ilyRzyjL2Xe27c+dnlhifne8ACP1lKPopPkZOIK26/DROQzftaeG7jRUij/b8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2017 11:11:35.6614 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR03MB559 Subject: [dpdk-dev] [PATCH v4 34/41] net/dpaa: add support for flow control 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, 09 Sep 2017 11:11:38 -0000 Signed-off-by: Hemant Agrawal Signed-off-by: Shreyansh Jain --- doc/guides/nics/features/dpaa.ini | 1 + drivers/net/dpaa/dpaa_ethdev.c | 112 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+) diff --git a/doc/guides/nics/features/dpaa.ini b/doc/guides/nics/features/dpaa.ini index c09efd8..1ba6b11 100644 --- a/doc/guides/nics/features/dpaa.ini +++ b/doc/guides/nics/features/dpaa.ini @@ -11,6 +11,7 @@ MTU update = Y Promiscuous mode = Y Allmulticast mode = Y Unicast MAC filter = Y +Flow control = Y Basic stats = Y ARMv8 = Y Usage doc = Y diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 178508e..f423e51 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -329,6 +329,85 @@ static int dpaa_link_up(struct rte_eth_dev *dev) } static int +dpaa_flow_ctrl_set(struct rte_eth_dev *dev, + struct rte_eth_fc_conf *fc_conf) +{ + struct dpaa_if *dpaa_intf = dev->data->dev_private; + struct rte_eth_fc_conf *net_fc; + + PMD_INIT_FUNC_TRACE(); + + if (!(dpaa_intf->fc_conf)) { + dpaa_intf->fc_conf = rte_zmalloc(NULL, + sizeof(struct rte_eth_fc_conf), MAX_CACHELINE); + if (!dpaa_intf->fc_conf) { + DPAA_PMD_ERR("unable to save flow control info"); + return -ENOMEM; + } + } + net_fc = dpaa_intf->fc_conf; + + if (fc_conf->high_water < fc_conf->low_water) { + DPAA_PMD_ERR("Incorrect Flow Control Configuration"); + return -EINVAL; + } + + if (fc_conf->mode == RTE_FC_NONE) { + return 0; + } else if (fc_conf->mode == RTE_FC_TX_PAUSE || + fc_conf->mode == RTE_FC_FULL) { + fman_if_set_fc_threshold(dpaa_intf->fif, fc_conf->high_water, + fc_conf->low_water, + dpaa_intf->bp_info->bpid); + if (fc_conf->pause_time) + fman_if_set_fc_quanta(dpaa_intf->fif, + fc_conf->pause_time); + } + + /* Save the information in dpaa device */ + net_fc->pause_time = fc_conf->pause_time; + net_fc->high_water = fc_conf->high_water; + net_fc->low_water = fc_conf->low_water; + net_fc->send_xon = fc_conf->send_xon; + net_fc->mac_ctrl_frame_fwd = fc_conf->mac_ctrl_frame_fwd; + net_fc->mode = fc_conf->mode; + net_fc->autoneg = fc_conf->autoneg; + + return 0; +} + +static int +dpaa_flow_ctrl_get(struct rte_eth_dev *dev, + struct rte_eth_fc_conf *fc_conf) +{ + struct dpaa_if *dpaa_intf = dev->data->dev_private; + struct rte_eth_fc_conf *net_fc = dpaa_intf->fc_conf; + int ret; + + PMD_INIT_FUNC_TRACE(); + + if (net_fc) { + fc_conf->pause_time = net_fc->pause_time; + fc_conf->high_water = net_fc->high_water; + fc_conf->low_water = net_fc->low_water; + fc_conf->send_xon = net_fc->send_xon; + fc_conf->mac_ctrl_frame_fwd = net_fc->mac_ctrl_frame_fwd; + fc_conf->mode = net_fc->mode; + fc_conf->autoneg = net_fc->autoneg; + return 0; + } + ret = fman_if_get_fc_threshold(dpaa_intf->fif); + if (ret) { + fc_conf->mode = RTE_FC_TX_PAUSE; + fc_conf->pause_time = fman_if_get_fc_quanta(dpaa_intf->fif); + } else { + fc_conf->mode = RTE_FC_NONE; + } + + return 0; +} + +static int dpaa_dev_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr, uint32_t index, @@ -384,6 +463,9 @@ static struct eth_dev_ops dpaa_devops = { .rx_queue_release = dpaa_eth_rx_queue_release, .tx_queue_release = dpaa_eth_tx_queue_release, + .flow_ctrl_get = dpaa_flow_ctrl_get, + .flow_ctrl_set = dpaa_flow_ctrl_set, + .link_update = dpaa_eth_link_update, .stats_get = dpaa_eth_stats_get, .stats_reset = dpaa_eth_stats_reset, @@ -400,6 +482,33 @@ static struct eth_dev_ops dpaa_devops = { }; +static int dpaa_fc_set_default(struct dpaa_if *dpaa_intf) +{ + struct rte_eth_fc_conf *fc_conf; + int ret; + + PMD_INIT_FUNC_TRACE(); + + if (!(dpaa_intf->fc_conf)) { + dpaa_intf->fc_conf = rte_zmalloc(NULL, + sizeof(struct rte_eth_fc_conf), MAX_CACHELINE); + if (!dpaa_intf->fc_conf) { + DPAA_PMD_ERR("unable to save flow control info"); + return -ENOMEM; + } + } + fc_conf = dpaa_intf->fc_conf; + ret = fman_if_get_fc_threshold(dpaa_intf->fif); + if (ret) { + fc_conf->mode = RTE_FC_TX_PAUSE; + fc_conf->pause_time = fman_if_get_fc_quanta(dpaa_intf->fif); + } else { + fc_conf->mode = RTE_FC_NONE; + } + + return 0; +} + /* Initialise an Rx FQ */ static int dpaa_rx_queue_init(struct qman_fq *fq, uint32_t fqid) @@ -553,6 +662,9 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) DPAA_PMD_DEBUG("All frame queues created"); + /* Get the initial configuration for flow control */ + dpaa_fc_set_default(dpaa_intf); + /* reset bpool list, initialize bpool dynamically */ list_for_each_entry_safe(bp, tmp_bp, &cfg->fman_if->bpool_list, node) { list_del(&bp->node); -- 2.9.3