From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0060.outbound.protection.outlook.com [104.47.38.60]) by dpdk.org (Postfix) with ESMTP id 5EFE3917F for ; Wed, 23 Aug 2017 16:03:35 +0200 (CEST) Received: from CY4PR03CA0102.namprd03.prod.outlook.com (2603:10b6:910:4d::43) by SN2PR03MB2270.namprd03.prod.outlook.com (2603:10b6:804:d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1385.9; Wed, 23 Aug 2017 14:03:33 +0000 Received: from BN1BFFO11OLC001.protection.gbl (2a01:111:f400:7c10::1:101) by CY4PR03CA0102.outlook.office365.com (2603:10b6:910:4d::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1362.18 via Frontend Transport; Wed, 23 Aug 2017 14:03:33 +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 BN1BFFO11OLC001.mail.protection.outlook.com (10.58.145.12) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1341.15 via Frontend Transport; Wed, 23 Aug 2017 14:03:33 +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 v7NE2Q3K004389; Wed, 23 Aug 2017 07:03:30 -0700 From: Shreyansh Jain To: CC: , Date: Wed, 23 Aug 2017 19:42:07 +0530 Message-ID: <20170823141213.25476-35-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170823141213.25476-1-shreyansh.jain@nxp.com> References: <1499179471-19145-1-git-send-email-shreyansh.jain@nxp.com> <20170823141213.25476-1-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131479706137298865; (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)(1110001)(1109001)(339900001)(199003)(189002)(50986999)(77096006)(85426001)(6666003)(2950100002)(8656003)(6916009)(86362001)(76176999)(47776003)(54906002)(4326008)(626005)(1076002)(189998001)(48376002)(5660300001)(97736004)(105606002)(106466001)(53936002)(104016004)(2351001)(33646002)(498600001)(50466002)(110136004)(5003940100001)(2906002)(36756003)(50226002)(68736007)(356003)(305945005)(81156014)(8676002)(81166006)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR03MB2270; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11OLC001; 1:KS4y1pq7oGMnkSpag/tMoQMk5sQeazBxSkoX2qVkEbr4a98/IFmZyM49E+FFTjaFdjPES5R3KS9xwWPaV4KoW48JocoEYpPJrMOnwKtVZEZT1vLu6SOGbPAoozM2W3T7 MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ec3859eb-ad2e-46f8-2652-08d4ea2fbdf1 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(2017052603031)(201703131430075)(201703131517081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:SN2PR03MB2270; X-Microsoft-Exchange-Diagn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MCZw6J+9RDbc7AJWORjT/RP/u52Z7xTrXmltYmIOQGePkNBYS2BVjyv3xMoSjwm2444yGxc6qdRcA5Cqfg6VaG2IBhi96t49xAr4KRS/hgW0ewf5NuFwBixLQL2eT4sTURMEmJpgxEYyfcc+G2yJNiH39DSrvxxzOkJFyIoukfPznvzRV/5B42NrUQ59dPkR5Lxh3lcos1MilbxSZ4hBRnDe0HesEi/kaSukYmIAx/2r2G4vwXDfZOcnYZkdnneRnEsNVIoN8= 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)(601004)(2401047)(13016025)(8121501046)(5005006)(13018025)(100000703101)(100105400095)(3002001)(10201501046)(93006095)(93001095)(6055026)(6096035)(20161123561025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123559100)(20161123556025)(20161123565025)(20161123563025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:SN2PR03MB2270; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:SN2PR03MB2270; X-Forefront-PRVS: 040866B734 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR03MB2270; 23:nShhCCsCXkgcy6+5PYGAJatLrmOAUQ1h/yjgD1Fep?= =?us-ascii?Q?3FLmROwK8Xia8376p9pP4giHS1ek/eSVccxiXHMnTQkVtl0y8bp7R7Vz6DE7?= =?us-ascii?Q?SN85e2ERvlV7jdxOWJzNiB9BKVmO/tuPZk6iau/JEZJJz2H+SfcspScTqwyx?= =?us-ascii?Q?Qp3mwqgLpmjUTSIgtlPFnUuMyvH9kyMLgMXIxhY3gfPJY/xBkysEHtk2xV1o?= =?us-ascii?Q?tWQy+B03loGw79KCfFZp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?RTnPpu6NLyGSL5mV9YiESDufyv+vlqy?= X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2270; 6:xioSwBPxPL8EWtlXCxvs/MXZgVypAoRjZBb6NRHv+aXjtxh3ZHMPAy1IoLIKMVOHncyFGNWgq/ZPfmwXoQYU9+/MR+qAq/Dg40kkWdCAPI5/bnFtDKydwjPEEn6kopjYXVFfkhsJsm6AXQCQdiljI3CKkjxOF/x5R1siWCSd4j1y/S3sQv3dfRYPe3uPusl+OCKk3Jn0Wh+aHA8yi+EY15KS4fYm6AY2nJBMI6TAvj2/HFfWxw2KkWMuvEwmIyQJzHcVWWnfCdHEmUsuP7iYxTi1gEhFWJzgh76t3nCUERPyZry4Xkyf1AGo08BYEWRyA0d0Dp6EVAbiBVoblJ9YVQ==; 5:M4Eo581b90ARGmyC+N6zzWvRgx20MLC4tO7L5b4iaN1N3cN6+TCEBF40TbWzSgi2tuA+1Au3o1WnM7O9cpMJrz8Jm8NhfksOvdJtUWYWXar+avHgO7RGTUqfFMmo1FkGZrFYaH5kNc/9SJv+ga9uRg==; 24:42XFfVcoLs6qDa29RqJTmP6TWF201HUN7tuTuFCX0GRfYafnzwoJhtV088nKw00z0k4wBQnpDoUKSrfRnEizS53rJKOi0vANQPMwq1Pav6c=; 7:68IwNRYeuUnURi7X3seke5/5I1t4mrWA/AT466giroQEl+LdukYl9HnVrMNpOhsFKSOu11Zu9QzDTZnQx/cxB5mwcG2owM09ZAADjlhqkOjYiMJe2qwibFG7Dsx4APwEcLiCHhOOcpdjLarzxzaeaFgxgRjlLnEGaYqZ2h/TcnSw+0rljydUdlWD/ftoDXRNTBmtpFBYktq0Tf1ISci7wPk4AawCMBDmUKw3EJoBFKM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2017 14:03:33.3866 (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: SN2PR03MB2270 Subject: [dpdk-dev] [PATCH v3 34/40] 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: Wed, 23 Aug 2017 14:03:35 -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 062f23e..fddd9ec 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, @@ -391,6 +470,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, @@ -407,6 +489,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) @@ -560,6 +669,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