From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0078.outbound.protection.outlook.com [104.47.41.78]) by dpdk.org (Postfix) with ESMTP id 668216A6E for ; Fri, 17 Mar 2017 14:09:42 +0100 (CET) Received: from BN6PR03CA0048.namprd03.prod.outlook.com (10.175.124.34) by BY2PR03MB191.namprd03.prod.outlook.com (10.242.36.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.977.11; Fri, 17 Mar 2017 13:09:41 +0000 Received: from BN1AFFO11FD005.protection.gbl (2a01:111:f400:7c10::186) by BN6PR03CA0048.outlook.office365.com (2603:10b6:404:10c::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.977.11 via Frontend Transport; Fri, 17 Mar 2017 13:09:40 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; caviumnetworks.com; dkim=none (message not signed) header.d=none; caviumnetworks.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 BN1AFFO11FD005.mail.protection.outlook.com (10.58.52.65) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.977.7 via Frontend Transport; Fri, 17 Mar 2017 13:09:39 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v2HD8peb021077; Fri, 17 Mar 2017 06:09:36 -0700 From: Hemant Agrawal To: CC: , , , , , Date: Fri, 17 Mar 2017 18:38:37 +0530 Message-ID: <1489756124-10805-16-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1489756124-10805-1-git-send-email-hemant.agrawal@nxp.com> References: <1488545223-25739-1-git-send-email-hemant.agrawal@nxp.com> <1489756124-10805-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131342297800270507; (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)(39410400002)(39450400003)(39850400002)(39400400002)(39840400002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(9170700003)(2950100002)(81156014)(38730400002)(5003940100001)(6916009)(15650500001)(5660300001)(81166006)(77096006)(8936002)(86362001)(50226002)(47776003)(2906002)(4326008)(85426001)(110136004)(54906002)(356003)(8676002)(104016004)(36756003)(50986999)(53936002)(189998001)(48376002)(50466002)(2351001)(76176999)(106466001)(8656002)(33646002)(105606002)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR03MB191; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD005; 1:ORFHmnE88soI2khz2prv46r4c1+KzJM43hL2ZeMIC/mnDffdh9Bez3L/kPySy61DWDKR6mBZHi8da+ZpOXkP044f6HcsxhEcbq5Qx6IYI2Vl2VeJnQTE4MX7DYZz5k+ohHzvULNtPigcSBqisyPB1PJbNrx+jzMiLC+ChbNMp3MVignBz+X3ZetMUE4mxwiqadaUr2tHcrR8ijLYN1HHccSmR8pfzrdPoarwMj0TD3OL/3SFCee071fyY7Fuop0ur/ipRNcW/u40VpnsbnTVNqyqzympG1f70VSlylOfHJ5JxzF05Mtx+WhyXzhl8WjUjRojdwBz5t2Pn5bEDnbzxXOIh7P/UEnk24qdZs6czewEGCYD/xsooAxmlYFeBoBpK+LUgLlO7POk9TbwBs6emnhJ/cuWrlaWhYfQDVZjxg66iw5lJ/nh4L7ZP6O7VEhfEQNeahqMwH4bw7LnK7vT/J0yMow4gNERscJrJgyli1gKO8WM/Jkf3MUaEq2DNsvPdd7ORa2+My8Nf4TH6bdLqxXExje/9FhxTtWJJLgp0/vwRYbrGTHyoonuUu2uNRGf1/TOi/VMnqtjbNZ9Tj6IL0jN66IfzNdiVSC/JtpyM7kQt5wxZI3xes5z4X1nFKdpRvJHwocBVINLX4caUNQ5Bg== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 2891500f-a62a-488b-014a-08d46d36ded3 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BY2PR03MB191; X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB191; 3:hgsMpccLt+2M1JHbGG8czvhUXsl5kV51noGUwYLqS882gwJSgBPNqUyfyciCVBexb4RgVwCJKAbOlMS8eAKu08twD/YIH/8wudBzxFKSyo3F+BHxa5pty8qrgOsAOZCC1J5AfRBTG465lBQHFrLl+roUv6CoPLdBIiVwsxB5Q6jAe9FNH/SPVVacCmNvX9hqLjhHuXho554iv7Ety7aiTC2sxdBvL9lrpAlxYk/cDawEfWPIO4B/PMQa+fmaQfW0mQjilXhPdj/0+KK56UapYvq5YTFvcKPKGylIvSo/88YyIDyu9ABWBsydnoZlsEMH6btU97d6XP5eH7oD9neFO87cpzKNXigQDmL1dbhkoD3yskWP0k+JpEcxbya3MpKL; 25:ZGAfpEwZ+PrDuBVcGm84NGQXEU9w6ix5drDHq6svPaPaDyL/gAL4hsT3um2LDKVAxIKTu6guAB/fPEzVE0TedX/Y39aaKR43u9bpuMPkbrg6hPFe+07/Gm7LEm5+KOlpeHXoe5iiKWvdpvNfpzdOflwRa1qgueCzq8Nu7DGL7iP96E/DFAaTk0CTCvRUR3g1XPNI8aHc9bHyaSH5grzNErkcq4OH+17isWAo03yDMgMVmKuuuJS8sQaNMOnpinBcRp/IVnXZODV2OF30RHB5Od+pajqm5ECGSSNNBn1rMr7VIvg19kh/3W1qT9nmZzX7XeeKPDFlEZ4VGr6UFGALgpvXfp+AyFh9OF2KZ7FIo6w0g7iD0JNlEa7jL38jwjWsITR2jYcMmxdLPaib0djrNOeSuNp6RNWuV3lH1wFHhd4SrFntxNNUU8GDXsjQH5/rGcOauk//3H3wr4q0poJ8ag== X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB191; 31:tvcxnjo9TWI+rtLeIjVn5R6s7GqLQ2IB5Yyql65yaFbdfrHQwbVeBTbUNLtgfMFTIA4URKgAH9K3GL8NkBb/g3lzAe6eeHPE42+06Bloush3UMFPU9M1cIHdQduDrjg774IaAYOeDQmPR2wpgES1rkNuqwD25hQNVrtpTaQqh2m+N1C4f1eifj9loD0KJaCSa3kwYdTt54e67oNGeMHt7j8ba7godhqKOjfPdRRvy0a9nWBoPTWkl+ADLckuM2VL X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13017025)(13018025)(13024025)(13023025)(5005006)(13015025)(8121501046)(10201501046)(3002001)(6055026)(6096035)(20161123561025)(20161123559025)(20161123556025)(20161123565025)(20161123563025); SRVR:BY2PR03MB191; BCL:0; PCL:0; RULEID:(400006); SRVR:BY2PR03MB191; X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB191; 4:KWDBsQ0O03dVLZ7j3Ucy237ebVc2Za9Lu6nt9u8L5VtOO8F2GaS9MfZ6CLSXS+Z9xuVi3qht9RNUKF8/8iHrKxIHcAzZm+1YOOalThLmSXAPrs2wsn9pR4zL+A5wa7LUuZBIWvzzW9aMZOPrKDa7OlAXdGhZJJAMvr0wbprTifhinl5wPXc8HPNyiIHTcS74Cie5t5Z+g8+DptPIbnqYeHRsBdisI7JzNnnRJjivIsGMMiEat0OVCc7UuSg6dozqBzy1CY089RewHKlx+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OMnnPbpdkwnlvFh8pu02AJa4UV0A5l6h2Yp2RcW5ov8exwnTp/lYwWBeaqg8vT8/6nIGfrfEcXaqPRmdC8BQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2017 13:09:39.8242 (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: BY2PR03MB191 Subject: [dpdk-dev] [PATCH v9 15/22] net/dpaa2: link status update 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: Fri, 17 Mar 2017 13:09:42 -0000 Signed-off-by: Hemant Agrawal --- doc/guides/nics/features/dpaa2.ini | 1 + drivers/net/dpaa2/dpaa2_ethdev.c | 107 +++++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) diff --git a/doc/guides/nics/features/dpaa2.ini b/doc/guides/nics/features/dpaa2.ini index 0746d4b..0660cab 100644 --- a/doc/guides/nics/features/dpaa2.ini +++ b/doc/guides/nics/features/dpaa2.ini @@ -4,6 +4,7 @@ ; Refer to default.ini for the full list of available PMD features. ; [Features] +Link status = Y Queue start/stop = Y MTU update = Y Promiscuous mode = Y diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 816227b..db4691c 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -54,6 +54,58 @@ static struct rte_dpaa2_driver rte_dpaa2_pmd; +/** + * Atomically reads the link status information from global + * structure rte_eth_dev. + * + * @param dev + * - Pointer to the structure rte_eth_dev to read from. + * - Pointer to the buffer to be saved with the link status. + * + * @return + * - On success, zero. + * - On failure, negative value. + */ +static inline int +dpaa2_dev_atomic_read_link_status(struct rte_eth_dev *dev, + struct rte_eth_link *link) +{ + struct rte_eth_link *dst = link; + struct rte_eth_link *src = &dev->data->dev_link; + + if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst, + *(uint64_t *)src) == 0) + return -1; + + return 0; +} + +/** + * Atomically writes the link status information into global + * structure rte_eth_dev. + * + * @param dev + * - Pointer to the structure rte_eth_dev to read from. + * - Pointer to the buffer to be saved with the link status. + * + * @return + * - On success, zero. + * - On failure, negative value. + */ +static inline int +dpaa2_dev_atomic_write_link_status(struct rte_eth_dev *dev, + struct rte_eth_link *link) +{ + struct rte_eth_link *dst = &dev->data->dev_link; + struct rte_eth_link *src = link; + + if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst, + *(uint64_t *)src) == 0) + return -1; + + return 0; +} + static void dpaa2_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { @@ -430,6 +482,7 @@ struct dpaa2_dev_priv *priv = dev->data->dev_private; struct fsl_mc_io *dpni = (struct fsl_mc_io *)priv->hw; int ret; + struct rte_eth_link link; PMD_INIT_FUNC_TRACE(); @@ -439,6 +492,10 @@ ret, priv->hw_id); return; } + + /* clear the recorded link status */ + memset(&link, 0, sizeof(link)); + dpaa2_dev_atomic_write_link_status(dev, &link); } static void @@ -531,6 +588,55 @@ return 0; } +/* return 0 means link status changed, -1 means not changed */ +static int +dpaa2_dev_link_update(struct rte_eth_dev *dev, + int wait_to_complete __rte_unused) +{ + int ret; + struct dpaa2_dev_priv *priv = dev->data->dev_private; + struct fsl_mc_io *dpni = (struct fsl_mc_io *)priv->hw; + struct rte_eth_link link, old; + struct dpni_link_state state = {0}; + + PMD_INIT_FUNC_TRACE(); + + if (dpni == NULL) { + RTE_LOG(ERR, PMD, "error : dpni is NULL"); + return 0; + } + memset(&old, 0, sizeof(old)); + dpaa2_dev_atomic_read_link_status(dev, &old); + + ret = dpni_get_link_state(dpni, CMD_PRI_LOW, priv->token, &state); + if (ret < 0) { + RTE_LOG(ERR, PMD, "error: dpni_get_link_state %d", ret); + return -1; + } + + if ((old.link_status == state.up) && (old.link_speed == state.rate)) { + RTE_LOG(DEBUG, PMD, "No change in status\n"); + return -1; + } + + memset(&link, 0, sizeof(struct rte_eth_link)); + link.link_status = state.up; + link.link_speed = state.rate; + + if (state.options & DPNI_LINK_OPT_HALF_DUPLEX) + link.link_duplex = ETH_LINK_HALF_DUPLEX; + else + link.link_duplex = ETH_LINK_FULL_DUPLEX; + + dpaa2_dev_atomic_write_link_status(dev, &link); + + if (link.link_status) + PMD_DRV_LOG(INFO, "Port %d Link is Up\n", dev->data->port_id); + else + PMD_DRV_LOG(INFO, "Port %d Link is Down\n", dev->data->port_id); + return 0; +} + static struct eth_dev_ops dpaa2_ethdev_ops = { .dev_configure = dpaa2_eth_dev_configure, .dev_start = dpaa2_dev_start, @@ -538,6 +644,7 @@ .dev_close = dpaa2_dev_close, .promiscuous_enable = dpaa2_dev_promiscuous_enable, .promiscuous_disable = dpaa2_dev_promiscuous_disable, + .link_update = dpaa2_dev_link_update, .dev_infos_get = dpaa2_dev_info_get, .dev_supported_ptypes_get = dpaa2_supported_ptypes_get, .mtu_set = dpaa2_dev_mtu_set, -- 1.9.1