From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0049.outbound.protection.outlook.com [104.47.41.49]) by dpdk.org (Postfix) with ESMTP id 79B732BBB for ; Fri, 31 Mar 2017 15:58:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=7lkLg/HE9nnRVJMdJb9c3MNrEEsvTMOdkJMf+5NC9J8=; b=Va/kILTfOv3ZIveQJoiBVtRCO0DXN9h2KK/db4OuSMNtfsPy2HABrwYu+ar3zBSHdaFVgNhBdpymyIhcl+3u/Zhgr8qA3QLyAkKCZ19Q+9DXaOhyAHJA8Atb9pS+MFd9NNXirphHEBnyJ13u0wZvoTZrgVrha2L3DqwAUNCtQ2U= Authentication-Results: caviumnetworks.com; dkim=none (message not signed) header.d=none;caviumnetworks.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from b.semihalf.local (31.172.191.173) by BLUPR0701MB1028.namprd07.prod.outlook.com (10.160.35.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1005.10; Fri, 31 Mar 2017 13:58:09 +0000 From: Andriy Berestovskyy To: Jerin Jacob , Maciej Czekaj Cc: dev@dpdk.org Date: Fri, 31 Mar 2017 15:57:49 +0200 Message-Id: <1490968669-9161-2-git-send-email-Andriy.Berestovskyy@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490968669-9161-1-git-send-email-Andriy.Berestovskyy@caviumnetworks.com> References: <1490968669-9161-1-git-send-email-Andriy.Berestovskyy@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [31.172.191.173] X-ClientProxiedBy: HE1PR0701CA0070.eurprd07.prod.outlook.com (10.168.122.14) To BLUPR0701MB1028.namprd07.prod.outlook.com (10.160.35.20) X-MS-Office365-Filtering-Correlation-Id: d06e7baf-12a4-4770-ee8e-08d4783df777 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:BLUPR0701MB1028; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1028; 3:fFUpspzxzV1u3UkFnGdYr4R1qaWLOYF6tzFy9MpCPqk3noZU0Nyd02CosxbccsYyUdY8oQ3J8Y1diD2otqEKrMg1vTEO1gyD1TJ6QoOFp++rZAFxusRoUo/M89oarZfDdkacJSHWUURpighpiORRjKVV2CgDtwM88Ym6IqXlTK3gwkVottCK1+r0eK7XT9oCLVUTVbahGbg2wz860BGho9um/4i7N4Ihcau/qoEDHNSJkilt95SKF7VZWodsQZrwCXbOoDC+l/+5MTlYSG+m1zwD9azB55gk4+onqucfvNzk8b9ETarlqtrinL5Srp5mnToBcmPpPiAbCffYbF+8Hw==; 25:VoT1ad2LnWNcQ3D0CSIY0xI2E22bb/wrt+iXZHrql8y/GG8KE6wPaa+J5rkK1ffA3I4sNUyh4UyoiP/0P+5hnFh6Mow12fOc3KoA5jd7zztni/8JoW2HW/1b6fzzk7+s6A2ee56E8UdnDoXtysCFqBNvvYm/l8S8VqedkTLLqf/G5Rx1lvK+yejGM+NRPaoYlXRXyDI6Hka1xmB5cjGZOFrsB080dajgaPIcJ/uJI1oigSySHfDQGOmwniEfnHhOSJZcfXJrfQWGQa6TPZb3NHLk3oj9zvyO0JomIQ+9WHefQGeKhD9o4o8mg587MVyfZH8eyudohBf9TOYmKV9DHNjpAHCy2+ZcNoK7Xd2Zpwy558dplnqDqCl1kWZV+luJmt9CW5Ea9ly+8bJ0l4lMRg1fE9MqeoH/12uSBFItBrCafkkDQe1QbdzNbokQxkmiDvwVNQIy78/Shhy2BDpKfw== X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1028; 31:NPpJoOPwLxk2iVxzfoK3YG+GCnzgonvEJhfmBN8b3FjI/4oPAv4vdq6wxarEK+UxUOgUJCtfOhgnXFX+XmeVCWav2JIw1aAP+Aj3W1wSrOx6lRRwjuzzGSYDuIMHosE7CkF1GzNacnz8p5nMcIM0jo2XhgMR4HMs519eQzIrYv+4+8GbOa2aratWgh+3vJWd/yu1i+H4MbpUO66w24VEnVcZu8n7J956qqCvtPI6LEE=; 20:JeuOcAP2GkvO6M7Hb/OSerY9WfgB101sNFXQUpRhKOcLk+2GE+/3ZyM1H3OTo3DiIAFK4hc/ZBDAzvuL0RQzfQsDTgt50l63T8SjEucgyqf6CLi9zrR61CzgLn1prBq9miSA/toxxYu8+QbnnWaidH4Ab20sk3KHVXWxVY1HozFeD3cHUKoJyvTOizxJx1oU8vx58AVDWzT+LpmyuwSwRBjrNH0A5DCRaCqmO0TKudTwE0Aw/gvvtJdyvjXKw8ktgIQ/aS5ApC9aNcOyJgMc3RMec2acVpRyIU8WPVkTdEfU9XeFzh9O033XEHgaBMejU35p9Dg2TJXeWDotUzvFVH0Oy64v3vWv+kYbZTQXXBGrGnO5t/vHYaCnJxJ9zP+u740e3aVgQibTTwIFv2OSe4uWWjVU4zquE9niqn9RvUekcJiZOm8x8R1ypRID66dFMHi5hRoRPjfpqbSlHnA/n9JFKeMAYF4of5ylU8QH3phYeJsBYIyFZquMDJafKtQidxwJok3FNgXqDOsmhIwKeKN16MlPnVyar4PORghmrNnsHFPcJdnoC42MrHe9C6Gl+FzdfzgfgCaz5DcF41JfhGBqBnqPIrKcz+OU3XRaaJg= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(278428928389397); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(6041248)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(20161123562025)(20161123560025)(20161123555025)(6072148); SRVR:BLUPR0701MB1028; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1028; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1028; 4:RzLy/F60MFM5geToPIV6L3z1O+Om75gRxRhIsbJGtBVH+aBbjnmChKhGztAGEaR2Ax41kxMTbjcyWuyDrvCl/nrEiDHimPu+Qf9kqbU4dYBIC6jdtjfWbMPO2KeeBSFIRCWrN1iQe3lZ3WlcW0wQzn31Y+a6K37wpTZBdcreXTmn5iKcipbg5OOLrdXiBDmHFwkAvecg/9DCGaSbpRrlVd9kCeMiUA3Od2gbB2f04m1qSsny6gow2dcICedPD3r9eupY1ZVL2fdlGsCnKi8y/PYtYsvILxA4rUS3zDjXIQAT4bC6MqndC8hmZ69HsaYPowI3uSskIbMgUq0FkANns3wz1DouhTtf3ZVEJwzRqZW6Uuqh7tF3cm+EO1ErR5v3sS2Q3RQOXnLhDVDIcHh7DrRdxWXSEit/oEunYurj5+LLXbwgrl2aPDgA+qy6HkrfF5KOOujOilVh3TztKo6yZ06NL+ys1w0nxRr0OSkdUYA/IBZ/SOilnJeuBb0y8ZqJZbJk6AjtztRarF/6uRK0qUPsaw1YP27B+bspq57+TC9NMNzrbDw7viYg2vKiF+rd5CrbfsevC69Xr5LsvFU6x8ynWyR/LKnTj9hTUcX57WxcDYMAK+xmyzYg2Rv0rCPd7LPPHu4KiJCtyVk9efjAuI0r1WkoBdOLPHtInNvKELyQD2dXhQNfqDnnYwMoF/lpapJYKMYJub6YvIwazi9+YsBnmevxZm+yjxe1gP7zCXAp+D0IHwMyTlqezH41fsEy X-Forefront-PRVS: 02638D901B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39840400002)(39450400003)(39400400002)(39850400002)(39410400002)(47776003)(6512007)(8676002)(5003940100001)(6636002)(48376002)(2906002)(36756003)(6506006)(2950100002)(42882006)(53936002)(6486002)(81166006)(6666003)(5660300001)(50226002)(189998001)(4326008)(7736002)(50986999)(76176999)(38730400002)(42186005)(25786009)(66066001)(305945005)(6116002)(3846002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1028; H:b.semihalf.local; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1028; 23:k1JV+/2iLbPwM+b25YC0S8mcw3UDdyPN+Ay/pkb5fkwrW9eAdf+949+7sbestSS0MHMy27MismeQLuSZJJ5jpkKA7fgROkFXLQeroXvhDU/tWbvoEpPro+9CgnS/8C/X6lqxu+SCg2sYt/n71oxM8fPp8ZEhxH/4j1ZzWaoZYoBrUJc1ChqThkDJUCxMVMTeR16IMVzOAHUQcj6c/Ovlptr9RaZXvru4QyJ3EriwJGse0AzBW68fSZOv6zK7jHX9FfIL4v59jS/a+rHycKRl19hdXkQ0zszlS3/R2VagK+7izYRKOHdpXMm345y9wRxdnNmf73GvM7+FU0GPdQynbbAIYOEWR/eKkKRCbFfkpLYkkgaMwLzVcofKhBF2z+2dxHNiDO3wXHpph8NtrgWqjlJA2VrYMkToP/my3tomzU702PbZyAzxh9Hjc6jGzgZWuovc9c8G/ZxdGuqzw8F/nXu+OiaCecIbAT8/7xfN/2L96yU84ksGJU2dXd2nELBv7oCCsWSr1vj2nIKyCVQybxesOeZ259dM+Ky0QlnMgTEnGlGj6lVX9UnFxXsDutY95df2KwqySERlg5Ha9gr16UYF5dN14Pa5fKMp/mPPP95pFd67rRR6E325bAEG07tA+vy2dqTuZ41Sx05rzLFYX7ewCoQQGFrLrH8zeE7Ei23QhKxjUvqkxfTsrO1ajDKchkkTb9Itm4+J1y0pNIT7mXxnyj3zagvgPNXAsTJQ+dAd6eHe799LBGlxFutj68//tUIBlsVV1Ut4B66bNXSot6BPL3wrZOS5PQMlmIsWjXFjavTjoytT5ogw7kUCBfTEUiqyqvrh3exR04Khp+rEgkCrYGfnoUv+Pt3/wesbxctHnl0Hti0/IMvnODhtlBCm3hNxhhUKb8h6uQIpAXhN8jTdX87ygp8kC1mP1L9wwoSUmRHaPOHUNfIV3n0FauWE X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1028; 6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B9i7F00FRUk04dntAI3N7Ip9ddAaT/Q== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2017 13:58:09.8284 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1028 Subject: [dpdk-dev] [PATCH 2/2] net/thunderx: wait to complete during link 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, 31 Mar 2017 13:58:12 -0000 Some DPDK applications/examples check link status on their start. NICVF does not wait for the link, so those apps fail. Wait up to 9 seconds for the link as other PMDs do in order to fix those apps/examples. Signed-off-by: Andriy Berestovskyy --- drivers/net/thunderx/nicvf_ethdev.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index 984c218..2fe653a 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -145,16 +145,29 @@ nicvf_periodic_alarm_stop(void (fn)(void *), void *arg) * Return 0 means link status changed, -1 means not changed */ static int -nicvf_dev_link_update(struct rte_eth_dev *dev, - int wait_to_complete __rte_unused) +nicvf_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete) { +#define CHECK_INTERVAL 100 /* 100ms */ +#define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */ struct rte_eth_link link; struct nicvf *nic = nicvf_pmd_priv(dev); + int i; PMD_INIT_FUNC_TRACE(); - memset(&link, 0, sizeof(link)); - nicvf_set_eth_link_status(nic, &link); + if (wait_to_complete) { + /* rte_eth_link_get() might need to wait up to 9 seconds */ + for (i = 0; i < MAX_CHECK_TIME; i++) { + memset(&link, 0, sizeof(link)); + nicvf_set_eth_link_status(nic, &link); + if (link.link_status) + break; + rte_delay_ms(CHECK_INTERVAL); + } + } else { + memset(&link, 0, sizeof(link)); + nicvf_set_eth_link_status(nic, &link); + } return nicvf_atomic_write_link_status(dev, &link); } -- 2.7.4