From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0059.outbound.protection.outlook.com [104.47.34.59]) by dpdk.org (Postfix) with ESMTP id A4956D297 for ; Fri, 24 Mar 2017 14:36:34 +0100 (CET) Received: from BN6PR03CA0047.namprd03.prod.outlook.com (10.175.124.33) by BN6PR03MB2785.namprd03.prod.outlook.com (10.173.144.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Fri, 24 Mar 2017 13:36:33 +0000 Received: from BY2FFO11OLC011.protection.gbl (2a01:111:f400:7c0c::175) by BN6PR03CA0047.outlook.office365.com (2603:10b6:404:10c::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.991.14 via Frontend Transport; Fri, 24 Mar 2017 13:36:33 +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 BY2FFO11OLC011.mail.protection.outlook.com (10.1.15.22) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.977.7 via Frontend Transport; Fri, 24 Mar 2017 13:36:32 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v2ODZhg2005481; Fri, 24 Mar 2017 06:36:29 -0700 From: Hemant Agrawal To: CC: , , , , , Date: Fri, 24 Mar 2017 19:05:31 +0530 Message-ID: <1490362538-20854-16-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1490362538-20854-1-git-send-email-hemant.agrawal@nxp.com> References: <1489756124-10805-1-git-send-email-hemant.agrawal@nxp.com> <1490362538-20854-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131348361925857677; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(979002)(6009001)(336005)(39840400002)(39450400003)(39860400002)(39410400002)(39400400002)(39850400002)(39380400002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(9170700003)(53936002)(4326008)(189998001)(5003940100001)(85426001)(76176999)(50986999)(48376002)(356003)(8656002)(50466002)(104016004)(77096006)(38730400002)(110136004)(305945005)(54906002)(36756003)(105606002)(50226002)(86362001)(575784001)(2906002)(47776003)(5660300001)(8936002)(2351001)(8676002)(33646002)(81166006)(2950100002)(6666003)(6916009)(106466001)(15650500001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR03MB2785; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; A:1; MX:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC011; 1:qUjFTjWxaRcQszYy0MzxhCZa1Aec/qsnU8TB0VCv4pQ0T8dt28yiVVo9/41Va5AlMdufIBNIqdBsyaJUQ+5Usb7mZT27Ns0RSpt7QYYLzfDeoaY1L4RHBwF+DTNirHC57KzlzCbxwpqVk2rd+vSpi3SuTsi0MQydTpmizOfNVfopCW607ywdWmRcXDnjflRwGSvfLBF5tVNIPjHq60Ko4IW4RdKD8CgECDO/jtZghKxzI9OxTwniOWY3hB/bjTYgbv866yPwFr6bJcvfHGfTobbf9J7MrULVwWnUC/xXzilrVGOxwxL5KSfobZymU+xGCMrP+1ZgqSFgq6ERpMONyN61O3rkKiFnibng7+EI81a3jP5pKEP1VaJqW0UDEc3eKV92P792VXOSoLYjqWVLRvCijyR3RNTvSVIBxUKU/CSymZuNRyFOW8ex5q7xTlWOLGSzeYshg8mdTDTcLgqnDCuoHu8CUJelTuVRWFvMEJHv6m6hgdUFxQhLe2kxVmKyVXvttgYVqqP+Mimbg8BUu7l4DI10ZdAw5PAaVLbd4uNLuG9tehAtWOE8VNKn6UGOlp8EaZDQLrvaDKcC/HlNQyQmERRHQBRHXz1GeMl6kcEEUPwQ8hpQZhjMzgR5LjOxkov+LETaUhaJUG1P64yUwA== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 88fbd5bc-76d3-4fe4-918d-08d472bac8e2 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BN6PR03MB2785; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2785; 3:dZCeLMEg9qkSoOiM03wdyiu848QaSC18+7E1Kdyx+Zmn3yC+B2Su5I4BTf6xsln6wR6ZTVyrwwc1+TdLX8uSrU8iwAgA7IlYuIFw9nw+lQ7DbgrKsE93c+s8w/fBR653J8bW7nFklkVLnr2hNWi6HvN9VCF092Nwr7YJVT1J97qeOUgTdY6+w+cAYZdlSWOBExRDZ3H6NvGCxK9Zbg8KXtOJ30xaY4I8we1HCHQIal8dG78M/Mw2qJ4Ed+NystZ49kw49tGEPGnb+kPwjnZtrkjVMm5xE+k4SPGHxTAicYltV2KdOkm3S1cosNymaxzR7fyU37qVLgR5mKw9aSGTdvXZJDM6WYPHcrcjG3udgilwccrstjPfFrh7BW/1wRVP; 25:ZtbQpRfoDZJaDOte4piqaYXvKpmYmJC4OhDAeDwXstU3Dhf+lEsaB0I4sV+KKETkcQcZorrep0PcWY5SF5UDsGzZqc6z9fNFttRVeS1Dch48loH8BGXLjaeKZ9yMz4jMnQ11IpBLvUbHBLoxP2RWfjWCdzKxeTlUB0Tq42oJvMnCDoHxj0BzZZ5WlHjxFgkQavEJ+UeYQCd5Q7tmQTeDJJ9ilqGXo1KrtJ5kDKnCC7jKmT+6ksAeJDa7iOfZ4fIkHf9mmPKOhfxZSfH4DpFTW+/G95xUCBgPHl9c9aAq+apBKxxpzXh+UNdpRVRds0AqdJX7bapkNchrgUGcn7VeTNDmS9fMh/+sFKo2oEW7f5BF6F2EEZ4T2/rIQzP7xa9c02YSDOIslNyXVsQdMNSHaNqBbJUYEpZvzq7O8b/xek1CxAVGnNRHNQsjsk+jKsYGoUOwQIblKCpzOHaRVloUXg== X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2785; 31:xk1OKZRiNB9FqZJ7Mfq/O31NXZ/SWyljoCJYVRQ9+GuaHfxUrzigpf/yRKCaDTwGmTQR6LHbGre/MbguHobEWeYvSAKQpUrmMLmxigvCzQSCfVFa2dMv4qCTlcgCvoSjvZvusobFCiCjUj2DkRZ4yFjmnsgv1KJZzsQU2EbTnolWUq/7ElhnHh21gurZokEyj63FqVEm6f2KSLAMwoS50ocgyxAjm6NhLn7S+ZtghY9ZZ7buTDhZE47FeYuytnJcXh5eTbyq2VjIl2t/gLcjEA== 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)(5005006)(13017025)(13015025)(8121501046)(13024025)(13023025)(13018025)(10201501046)(3002001)(6055026)(6096035)(20161123556025)(20161123561025)(20161123563025)(20161123559025)(20161123565025); SRVR:BN6PR03MB2785; BCL:0; PCL:0; RULEID:(400006); SRVR:BN6PR03MB2785; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2785; 4:nCLvtuCG+OGzLvaDRBRQdklb9BEJkp1NwWF5nBTPs2dB1ftz0NV6Q5ahPmlOOckykxjY0h8h0h0tWHsr4qwodtmhjYPPFgz5xmIvsQa4rsMQUb3Dago70Yx/oept0nUvWeOEoiOsqhJQCOq79vk85vlvgcRSDFBQNwHKZesg0lP4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X+jhHiH2Qzb/BdxiVQLSHm/G5hMA/hScE?= =?us-ascii?Q?9+Oy2/R5eAFqcdmgc5lMtU30eBlT1qQaMZv9LSYWifz2Xxm6W+0t7KwcGQnM?= =?us-ascii?Q?lZmaixp+HMUff/O9jM3qjVp8iSFkA12dMVe8TuWKPyIuF1mebXuyRQ6nIXj0?= =?us-ascii?Q?k+p8g=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2785; 6:MJzxZQd545EvQjYsab4kksBh8SeRMFwX0efjom0ezpafJKHUw8yrFTxFoxLUljRUr7DIbVnr5eyjv4v99tUt4lPWIfSf2bXbMqhEeOC+/qb3N+TZtuVjFwuTRl1HxdVBoQzFm7Ij2VLA2WpQ2/4iBv8l/brVlHM5qelF+dj/OYGyZjZdN1p473Bz2762Rpb/VgWTRYTU2E+3hEZ4KxKmvXGyixN9oOXGFDSoPN48wFs9oU9CRnIIS/LBIgrI83wqncFAuX+f92tU3nGU1G6rvGLowqUXF3sI2/75PhCUHH3yGDwrOeTDGaiOlaaWzDAON8wmRAe98sBsoCnip5HPm9VQ+sdMIk+AoEzP2URG/IrrnYppV+xJ48glDm2pydpEzLONOYF1rJQgjKKzQTaNTlJosZs89zG/e1Wfg+LAzT4=; 5:5O42xUsYlgveNcjJIMpZFZzaKTi8hX1Bhvent2495t0ym/NYBY2cOmE/JxaRBlLF7dFz5PQvqT32mIABYmfwGJl2jSJSPBJL+rstEhH2+JLjS88DJwNjIFuhXe9LhP+EgHojgySRlOajltPSpacKpk6fXvwqVZyM2fCGftcxHkLP7HjM6E8O/2zro67WPMES; 24:rJ6ZAnYUqY9DVFsWtMJ5+xYHt59cJOwVaMjW6FKSDTz34cIIqyp9dbZUHzzVG/Nd0yEJDvBVGAmcA6T6VkPRVbyUUolaI3zDMWieOay4VVs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2785; 7:ks4XzxNEHhTyuTYUCIVRJ3MIYyBWyUrYyiO7ey/LMRTD6+VnG5xamAFuZ1+mTc7i1EOXV24XTiF4psBTN+IwcOAAx1YUPytamve9axa7Kd8JECRRYYZAkJcArJIngira1o7IxgoJc/Fi7hmWRHvNFKvyDe9bFeJbDxDQH9RPdPzOcJXAHN2KYnv6yYdqkdeoF/zaADjLAYSeLhc0+e7wZFBYIXo2W0+EoIUr3JAEy/DzJzN6ZCSAnnJHoJ6f9tDyH0eGzyNPSIci5UDjBHYsy1jyvDqHdrEgROtOsrQvIgvH26mtSoezfBZSBtWzBM88JZ/u7YubTUfhdBqnfKaejA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2017 13:36:32.3829 (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: BN6PR03MB2785 Subject: [dpdk-dev] [PATCH v10 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, 24 Mar 2017 13:36:35 -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 9c0efcb..8bf1579 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