From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0069.outbound.protection.outlook.com [104.47.38.69]) by dpdk.org (Postfix) with ESMTP id DBB752BF2 for ; Thu, 28 Sep 2017 14:20:13 +0200 (CEST) Received: from BLUPR0301CA0016.namprd03.prod.outlook.com (10.162.113.154) by CY4PR03MB2694.namprd03.prod.outlook.com (10.173.43.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Thu, 28 Sep 2017 12:20:12 +0000 Received: from BN1BFFO11FD046.protection.gbl (2a01:111:f400:7c10::1:145) by BLUPR0301CA0016.outlook.office365.com (2a01:111:e400:5259::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.9 via Frontend Transport; Thu, 28 Sep 2017 12:20:12 +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 BN1BFFO11FD046.mail.protection.outlook.com (10.58.145.1) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.56.11 via Frontend Transport; Thu, 28 Sep 2017 12:20:12 +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 v8SCJ72Q008785; Thu, 28 Sep 2017 05:20:09 -0700 From: Shreyansh Jain To: CC: , Date: Thu, 28 Sep 2017 17:59:53 +0530 Message-ID: <20170928123000.1711-34-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170928123000.1711-1-shreyansh.jain@nxp.com> References: <20170928113344.12248-1-shreyansh.jain@nxp.com> <20170928123000.1711-1-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131510748124941556; (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)(7966004)(39860400002)(376002)(346002)(39380400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(498600001)(2906002)(316002)(77096006)(81156014)(81166006)(54906003)(8936002)(48376002)(8676002)(50226002)(356003)(47776003)(85426001)(5660300001)(50466002)(16586007)(1076002)(68736007)(305945005)(2351001)(6916009)(33646002)(6666003)(2950100002)(189998001)(4326008)(8656003)(104016004)(76176999)(50986999)(86362001)(5003940100001)(106466001)(97736004)(105606002)(53936002)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR03MB2694; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD046; 1:F3QKcD1CeeOevSzda0T5Gu6JB/ZlvIwfovjw/M55Z6j+P4njqFJC2066v20Mro2uB4YAn/20Ma/a15Omojpfp8Ze9WBob/LDDPtHeZMcD1/tuH2NiUde+b3ybrs8g+ef MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 25afec8d-4345-4b2b-0cf4-08d5066b4499 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017052603199)(201703131430075)(201703131517081); SRVR:CY4PR03MB2694; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2694; 3:5D7jFeyrGvcSQFAlFTFsl5QWN5XswriYp8qZ4AxQKWyF95tOsx2EVfoEpmKHIRyEE+idL31SlrLZkOau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6SDmxmCHzzPtkfk4/BuwvGnrAgoiGk14FzIf2GUkDIdAvTXDsK9dzDS/0aBODNu+5GpxHYLHX3GPzAGFZCHiw4YbAb1MZCLPctlW6o+GMzKfV6IYbUk/mpHYl6ID64chz6rfN1YA+KGoEQN4Qh2ja17WOKq4vwk+E32GtY= 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)(8121501046)(5005006)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(93001095)(6055026)(6096035)(20161123561025)(20161123556025)(20161123565025)(201703131430075)(201703131433075)(201703131441075)(201703131448075)(201703161259150)(20161123563025)(20161123559100)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR03MB2694; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR03MB2694; X-Forefront-PRVS: 0444EB1997 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR03MB2694; 23:xkpLiRnvalwo4Dlev+2ndOSl9jAo+5Qeig/zeK6QG?= =?us-ascii?Q?FuV03KnTUaYJh6ov2WvPDJP+qC+1dAZqSB/LQfRdKTxo9oWNtQ8TOXzQ5OFa?= =?us-ascii?Q?ZFuSOdL037TyeodozwA3gIzb1Hmeu8TqiaOLiS1rg08NiJx6ApADHRMbHZ4m?= =?us-ascii?Q?Cqn8Pn8VfGjiDhfEF0OskQhaDGSZj9m5cNkE70v8KyR2mYZtaIy75WDA8YpA?= =?us-ascii?Q?y8f9EdmMRqJlSdnmuKUShRyHSotAI6f6tZdBPUubva++hK4z8uq6aQkHzi7J?= =?us-ascii?Q?f+QpUkdmkqw50c1/7PEwFjpdhB9Gihmv+mgLY5p4i3Tzk1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Mtt0bp/coL75XTK3e/37iwQnyCK?= X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2694; 6:OdndDF942kKr+2hWjAGZ3VB9taANv36IVQLBN7IRA4Kg0ZpPZV71BvC9+O75NGU09xIAgGGG7y9/uifenpRd/78foC5pkAWK6JFp4GlzZujE9a2elU9qN7HllxeDWvzfN7/FcAi0xMBPCBGC/hYwBEew49VmA5evTbiJUg5joquEHKX9N1a/vOlR8IUwOSTPHtW8y8v6+/wNWOVOJsMHSG6n+bET//gTQeOPhFikowAa7aFyN1p6XUW7GsFKnSIJmO0x3lPVdNQmeln6fMvfycHzLS9PDhJ+/mD7tI4VsRXTqjn983sZ9WX4HmGw1HSxptTA6cJtakEc1bfUazGIvQ==; 5:xJiLPQ9/8fj7W99KGWo0nDKGotA0l74c4bLgt1z2yCFbkVZxC1mtvkV5PXOV11TUVzXcjomhm2nhBkDjzyLSKc5lEdfI9rO40EbA/rI9TXmu2YaL/23D7AaweHeGueZ/uxFsvfrLD3A5c6WKxu63MA==; 24:Z1YmN0wTV0l+RO755SNBai9VDk2EoKxPEw5s9/xLEViUxbIIoYgGG5p1gxM5BTMrunKxSLBeB9Fr6uk9NikBHvQ19H0QSTOvc7u0Ja4WYro=; 7:BCBLsae4WZD78mjW23sEe93iuwJcQWq/ngbn79BwzYifHDpTOz/FToO8667KmMobCEBqlB5DLvz8IKz/ccg/ltFo/hEdqsdYctpsl55fLQSL64rTs732q8mqgvZkTmb1YXO468DjrO46qzkH/hyIwIkbzO0pu9IYo1v8PeOqi8OR2iNQuJfmqx4rYpYGO1et9SFWU9zYm3Pae5iMMxraQRDsM+1LfqdhbykjfZOf4sk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2017 12:20:12.2913 (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: CY4PR03MB2694 Subject: [dpdk-dev] [PATCH v6 33/40] net/dpaa: support 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: Thu, 28 Sep 2017 12:20:14 -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 bcd6013..054d4bb 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