From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 766B8A3168 for ; Wed, 16 Oct 2019 09:42:22 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 365511E901; Wed, 16 Oct 2019 09:42:22 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130072.outbound.protection.outlook.com [40.107.13.72]) by dpdk.org (Postfix) with ESMTP id 2025D1E8FF for ; Wed, 16 Oct 2019 09:42:20 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hBdGRuSvj68TFhMUoe/OPJrXHUkK0krL0+KFG17U9WNA2x3hW/4nFsUwkvYZJXtAgzdVAUngLM/I8pPLU9yoBK3V8ZcCIvxLja7CUiYKKL0PHH5Xq81/8epcVoezObAf8wvMUXX5nIi0OT1vsBdoaOP/+P64ni2hdQIxwzkWk2m4Js1ciTnQbddvQYX9Od72KFDwtQVZy8Gsb1ZiJzjwB8pmmqtCGl+9WS9xwv7GrLFMQ+d9XB9PVQr02dZXwKD03IwhxBaCpf4bBxiyOwsA4ZJQ+x8Ge8+ZBXfWna8gbGyvmir2WPCC+njhgXIKWbTqRtEhFZ5lKhbXI4CpVA7t1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=A2ksbCFNdzM1AYxZjI2P0NMJ30h23MDVhUyJKkyX7wQ=; b=j8nZsQQRDwQ6LfXUBbfiSFTqjo8Z2pbXBewHAv2KcvaCn6FKlbheDnAcEyTOz++W67W5Hfprxs32GMJdJDp2610iU73g9/ujTokzS5HxBzXjBbBsVRhUzSF5XMIY2jWDMdnC4fhMNYypQjNZpuyQCf+G0OKxKPehFZI0ATldmTgJwN+Wo2obgg9B1Jdi9sHd4V/HRhWE7eCh30p7jdBpQwNWMcqBmDxEUu+ZuXGSAqjP2NzE0NpVIb/vuwdto3ajCrC0wh8ReaujFATsrCZ4gCNcKoStrsisMLOS5dAE8tamxzTyz1o62+T/uPSFinDBZA3uUHURuAS7GY99O7porg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=A2ksbCFNdzM1AYxZjI2P0NMJ30h23MDVhUyJKkyX7wQ=; b=PLpwjXMehLRljJeSb4YWucxP3yP4z09mA2z0AnY6Gr/voXg1fHZCv5PN3upCAc4VOiD6VinuXzuRxu6wcPMavE4QkV/Z4hlmNStc7hhhgri2wCtEu9DRt1Dy9HLpkncOlbNlxlKNxfeZgG1M//+lpQxu+ZDYonL2nBTG1+BRU94= Received: from AM4PR05MB3265.eurprd05.prod.outlook.com (10.171.188.154) by AM4PR05MB3284.eurprd05.prod.outlook.com (10.171.186.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.21; Wed, 16 Oct 2019 07:42:19 +0000 Received: from AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::edab:529f:d14e:d3b]) by AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::edab:529f:d14e:d3b%7]) with mapi id 15.20.2347.021; Wed, 16 Oct 2019 07:42:19 +0000 From: Slava Ovsiienko To: Moti Haimovsky , Raslan Darawsheh CC: "dev@dpdk.org" Thread-Topic: [PATCH v2] net/mlx5: retry when link update fails Thread-Index: AQHVg/QZMjGf72ZHFki5/ca+8q9mKqdc4WXg Date: Wed, 16 Oct 2019 07:42:18 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=viacheslavo@mellanox.com; x-originating-ip: [95.67.35.250] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7c6251c7-9c39-485c-7fcc-08d7520c5f75 x-ms-office365-filtering-ht: Tenant x-ms-traffictypediagnostic: AM4PR05MB3284:|AM4PR05MB3284: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtFwd x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5516; x-forefront-prvs: 0192E812EC x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(396003)(346002)(39860400002)(376002)(366004)(136003)(13464003)(189003)(199004)(55016002)(64756008)(66446008)(14454004)(52536014)(66066001)(66556008)(8676002)(5660300002)(81166006)(81156014)(9686003)(71200400001)(66946007)(71190400001)(66476007)(8936002)(229853002)(76116006)(6436002)(4326008)(486006)(26005)(256004)(6246003)(15650500001)(33656002)(476003)(2906002)(99286004)(6636002)(478600001)(102836004)(76176011)(14444005)(25786009)(86362001)(186003)(305945005)(7736002)(3846002)(6116002)(7696005)(446003)(6506007)(11346002)(53546011)(110136005)(316002)(74316002)(309714004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3284; H:AM4PR05MB3265.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 9+mPA3GM4SKpqoHpqY3wgbtYfqmbEX13LaZsy7rcgOHIom+7ZNJSqKcR0MPNsh9+o5MVp6ye1ww84aACmmDQgR3fWpmRZt48kjeTla6r1C8zimSDT1Jzz3vmrJcpstW9nujQLeOKAdfbJ21l1DXtWexk5xk6TvaYlbsmlvyqpJIghtcok2kMIXuGKttC5u6xggJFx1hgSn68yqDNWk3VURJSvArSK4WWJUefz0tCnRLyO6WQhPPZGtk29GzvYIIFAnDmPX4Yc6T6SfYKPeN7FltQi0fGtEMgcwk0kDOvQxL3u37s0ryrPjduWcxe6s5oTe/cpmp86MxJB2eWypVlI6DqFe3GCZZDqgpGxoKdfmZZuYKWQqcRctGuF237N99xtDPcJkTARvu1fonqeDle+zy6MA0f9Usa+wS8yP28G00= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7c6251c7-9c39-485c-7fcc-08d7520c5f75 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Oct 2019 07:42:19.0186 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: xfcOVZO/iv2U8wzDa6BrvMT0m6hnb8Ir2O2dxK5pXADXrd8NXx2VkFV4DSRImJKzgdMi21Ed+VSXb9sObmJ3Is8/L0gbN91cYTWbhSFplMc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3284 Subject: Re: [dpdk-dev] [PATCH v2] net/mlx5: retry when link update fails 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: Moti Haimovsky > Sent: Wednesday, October 16, 2019 10:34 > To: Slava Ovsiienko ; Raslan Darawsheh > > Cc: dev@dpdk.org > Subject: [PATCH v2] net/mlx5: retry when link update fails >=20 > mlx5_link_update immediately returns when called with no-wait parameter > and its call for retrieving the link status returns with EAGAIN error. > This is too harsh on busy systems where a first call fails with EAGAIN fr= om > time to time. > This patch adds a (very limited) retry on such cases in order to allow > retrieving the link status. >=20 > Signed-off-by: Moti Haimovsky Acked-by: Viacheslav Ovsiienko > --- > V2: > * Code rebase > --- > drivers/net/mlx5/mlx5_defs.h | 3 +++ > drivers/net/mlx5/mlx5_ethdev.c | 5 +++-- > 2 files changed, 6 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_defs.h b/drivers/net/mlx5/mlx5_defs.h > index 180122d..248ef3c 100644 > --- a/drivers/net/mlx5/mlx5_defs.h > +++ b/drivers/net/mlx5/mlx5_defs.h > @@ -105,6 +105,9 @@ > /* Timeout in seconds to get a valid link status. */ #define > MLX5_LINK_STATUS_TIMEOUT 10 >=20 > +/* Number of times to retry retrieving the physical link information. > +*/ #define MLX5_GET_LINK_STATUS_RETRY_COUNT 3 > + > /* Maximum number of UAR pages used by a port, > * These are the size and mask for an array of mutexes used to synchroni= ze > * the access to port's UARs on platforms that do not support 64 bit wri= tes. > diff --git a/drivers/net/mlx5/mlx5_ethdev.c > b/drivers/net/mlx5/mlx5_ethdev.c index f2b1752..5f05b2b 100644 > --- a/drivers/net/mlx5/mlx5_ethdev.c > +++ b/drivers/net/mlx5/mlx5_ethdev.c > @@ -999,6 +999,7 @@ int mlx5_fw_version_get(struct rte_eth_dev *dev, > char *fw_ver, size_t fw_size) > int ret; > struct rte_eth_link dev_link; > time_t start_time =3D time(NULL); > + int retry =3D MLX5_GET_LINK_STATUS_RETRY_COUNT; >=20 > do { > ret =3D mlx5_link_update_unlocked_gs(dev, &dev_link); @@ - > 1007,7 +1008,7 @@ int mlx5_fw_version_get(struct rte_eth_dev *dev, char > *fw_ver, size_t fw_size) > if (ret =3D=3D 0) > break; > /* Handle wait to complete situation. */ > - if (wait_to_complete && ret =3D=3D -EAGAIN) { > + if ((wait_to_complete || retry) && ret =3D=3D -EAGAIN) { > if (abs((int)difftime(time(NULL), start_time)) < > MLX5_LINK_STATUS_TIMEOUT) { > usleep(0); > @@ -1019,7 +1020,7 @@ int mlx5_fw_version_get(struct rte_eth_dev *dev, > char *fw_ver, size_t fw_size) > } else if (ret < 0) { > return ret; > } > - } while (wait_to_complete); > + } while (wait_to_complete || retry-- > 0); > ret =3D !!memcmp(&dev->data->dev_link, &dev_link, > sizeof(struct rte_eth_link)); > dev->data->dev_link =3D dev_link; > -- > 1.8.3.1