From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0063.outbound.protection.outlook.com [104.47.41.63]) by dpdk.org (Postfix) with ESMTP id 11CE329AC for ; Thu, 28 Sep 2017 13:24:11 +0200 (CEST) Received: from BLUPR0301CA0040.namprd03.prod.outlook.com (10.162.113.178) by CY1PR03MB2361.namprd03.prod.outlook.com (10.166.207.148) 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 11:24:09 +0000 Received: from BY2FFO11FD025.protection.gbl (2a01:111:f400:7c0c::191) by BLUPR0301CA0040.outlook.office365.com (2a01:111:e400:5259::50) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.11 via Frontend Transport; Thu, 28 Sep 2017 11:24:09 +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 BY2FFO11FD025.mail.protection.outlook.com (10.1.15.214) 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 11:24:09 +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 v8SBMpG9016035; Thu, 28 Sep 2017 04:24:06 -0700 From: Shreyansh Jain To: CC: , Date: Thu, 28 Sep 2017 17:03:37 +0530 Message-ID: <20170928113344.12248-34-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170928113344.12248-1-shreyansh.jain@nxp.com> References: <20170909112132.13936-1-shreyansh.jain@nxp.com> <20170928113344.12248-1-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131510714494619240; (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)(7966004)(336005)(346002)(39380400002)(39860400002)(376002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(77096006)(8936002)(76176999)(5660300001)(8676002)(81156014)(50986999)(81166006)(356003)(50466002)(48376002)(6666003)(305945005)(2950100002)(6916009)(4326008)(53936002)(50226002)(97736004)(189998001)(5003940100001)(2906002)(2351001)(498600001)(33646002)(106466001)(105606002)(36756003)(68736007)(104016004)(47776003)(86362001)(16586007)(8656003)(54906003)(85426001)(1076002)(316002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR03MB2361; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD025; 1:/aNiPofNTrnnYDTHDkIj3zPco6lCjYBJa7etBbSXy6AoOjPacYsY7NByeZ1FUkLWCi7RqMM+AY/KuNfPGbKTvugNbF9/wPXUXUF9dfB2mhHjvxWIyqul2HG07nN6B79I MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ef1433de-07b3-40a9-ad08-08d506637010 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017052603199)(201703131430075)(201703131517081); SRVR:CY1PR03MB2361; X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2361; 3:d2jclFb18koT7MuoGp6093DEWFYl42QyF3V6optyAHuhWzUiuVENXhG6iKLHfHFd4+O2GhFm6gXR4VWq6q2qcb8lht73cjyH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VwOLrcMDzmDIj92Zb4BhCoPluUVwSJ+Ho8KfK4vtbTJV0WW+0JgWvX2kOpAWEaVLtPTeF+p03U5eWgaHim+1O8ZLoCWbkd5mLupThQdfTAtR0czKJ7L80wecI4sWZ2PbV0mIEj9EPPks10HmEbH0oTAg4= 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)(93006095)(93001095)(100000703101)(100105400095)(3002001)(10201501046)(6055026)(6096035)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(20161123565025)(20161123563025)(20161123561025)(20161123556025)(20161123559100)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY1PR03MB2361; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY1PR03MB2361; X-Forefront-PRVS: 0444EB1997 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR03MB2361; 23:SkGiKO8DDktU9bx2zWWs7yWueHr5PM6dVwujX5vTy?= =?us-ascii?Q?y6I9E/L1fYosgsX1UPFsg6zPvaUGHLZSREabYqRX72xCVIeynVBZB7eyZQB7?= =?us-ascii?Q?6nIfbX5Nhw6ceGyBrnzSNdTCnpeGreZZ/tlW4+tVWkiD6ZyVtwr7pUPvdhur?= =?us-ascii?Q?F/nPtqfDmHaVfA1U38ZMZ3rH+dNxNx6FqPBK3HxikQS4p+BVv3GDFR2I/TZg?= =?us-ascii?Q?XElOhzA/LYDscUKkVAxRfDUYSHgZr9w9lvYURcqzfkRXj1v3el7U5vr+qv8W?= =?us-ascii?Q?qjnBNapndK/Gd0axpcWwWiYIcOZPq1PERct+YzeuO8PvlZeDkdFdBpvTVQA6?= =?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aH?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2361; 6:Fq+Tpnc55GiSWuqDkBQpBwqJ5QXIXKbVctD8CkC6ktUQmIU9/2siKfPDjYRN5zSi+l8uH53FE2pU8dUvlpG3lnzFddKkNQTgg/i0mny65GFZp8YgNnPdbgw7s25KuDBkzhpWJZUGrphyhX2bdLmXwxxXGh6aAlcxdNLSvDybkpigbCwI486EOSZHRPTIibwUAknF8QFYuiS9bvDjDenVFocVp8iJpayiJz2L1FakN3KcQLJzdhLK10n0exNOL0Z1K4ocBdHJjhcxwSGMRh5MSNBd4nYvpVDxnaazknKgL1LAdzF4+IINYfHxJpqUYrQvF2LUnW6iLPQSc2TIZrfMjw==; 5:S1XZCJP5fgxjtmrvYchY5K/RnqUuHdfnjqaCWkByn8kjS4ViUAKhUZAmsWTJGrEHoVhx4l2jXo/OJCi5i66zYf6f90bSTCFhBWC3YV/RlmVXv02Cnr69NxrKrVYM5/pBe+hAn6I6Q6erGa+Q5aUp6A==; 24:v1z3VsKLBNJ2finfHnsHfotgHd53HDxGSGchET61LTRiZC9Jlv0OgLcvD2HmmpvnZ/zwbZN5/rcl64JWSWzlnU9sYEv6bTvNXQ1thp/lSoU=; 7:/pY9AyraoYGIogfZ28dgNYoBRxZPBsE3ERbocvT09STALzphMW9fRvb5SSleIOQtU4LlLuWEHw7SO1GJg8H011evxf+57O9LTL716PWpz9CAPVSzEtrd5WCZn8+e8rd1qS1/oBigtp+2rhuHHQr7oTnD3fwugio4Ps0obCzNEbnQYRRFPo6cE80dCfnel7kPsxuYJLa98H+oJFAHx8E+PtAKfQoaSw8okcobEwA3nP8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2017 11:24:09.2591 (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: CY1PR03MB2361 Subject: [dpdk-dev] [PATCH v5 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 11:24:11 -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 23a9efd..ebceb8d 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