Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp723061imu; Tue, 27 Nov 2018 05:28:23 -0800 (PST) X-Google-Smtp-Source: AFSGD/UvRuJv5dGgFmtMkowY/AGSNp1vKBsjRlSkNaRpXjE/TVXa6Rdom2H7gIjavQgXmJKzY8/w X-Received: by 2002:a62:62c5:: with SMTP id w188mr13811767pfb.160.1543325303836; Tue, 27 Nov 2018 05:28:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543325303; cv=none; d=google.com; s=arc-20160816; b=SQodGyPkcyeDCLlG6lpivc+z9fFwxM0R/QIn6Cp8TrHySswf1N3Pv8/bBxH2VU632W NMXpO/A9aylDmDalETvBvpOf0Ymr3R5COqIwx9cogr2Xsk5YBMIkbA0wrBomDwN6Hgb5 Jk2jhJ7OIP5qwPbXVq9AF0lFm6l5UnffDE9VKk5mOaHya7W3DcIcsfmY3TmhmBiav1Ob yuybZPQDIOshXtpqlW5s7XmK6WPpAzPML6UgAr9XKm+h0enHJ9lKJTpf6ZFoJbCaxwUv duVPN4JaqJRXcDyb1I9McsDF6UjSo1GhUC4SZvD/eT+8gn66grXlaSNvJWvy5+uOtKIo yLtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=Y08LsoIPBnrDcbGcz3cWKb7D9hVOHDZAlTkgiibhUg4=; b=i81aIh7OXd723Ph8N6YkF2vnc1PO6UY0+g8C4r0P7LJo4aA0xtSW8m0weeY4wIZTei O8ELXZEcOWOTtBn+Pb1VB4h7iw20zpkD03tZ0opGKG+zFkT0BfAeld9rURZ/9I/8TcG8 GWYefC1d+95MpO8cOd2ta8DOvQkljhU/vV4z4aCYxeerIlrmA+/ENXQwaby33dO95nKN +Jd0tNpjXJQ/o4PcqJWNbwHg8N/szJsePLPF8okyFDvdz59LWQR8KQ4XTeRPQmohRMZJ zNeG6CKn52Tqtim8QBq5yo9e92yC3YmNqCvLsb95IFEMv4U/h1EBfiDrtny8N7/afOYE uhVQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d77si4087517pfj.124.2018.11.27.05.27.30; Tue, 27 Nov 2018 05:28:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729611AbeK0VrJ (ORCPT + 99 others); Tue, 27 Nov 2018 16:47:09 -0500 Received: from mail-oi1-f196.google.com ([209.85.167.196]:44677 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726576AbeK0VrJ (ORCPT ); Tue, 27 Nov 2018 16:47:09 -0500 Received: by mail-oi1-f196.google.com with SMTP id m6so7181287oig.11; Tue, 27 Nov 2018 02:49:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Y08LsoIPBnrDcbGcz3cWKb7D9hVOHDZAlTkgiibhUg4=; b=uheck62QOf7NC9e0vwIFdIunrA2wQegR3QfJ7qHXevmZTwku9IqImTuXapGK53XBR8 drXcjlAtrFCMrsnS+yA33pJLtuQHyNJ7Qdb2g2rAXh0tlXPNs5lXxfaZb/roLMHecUiT pD/e1eQ3qhFalNudWg2R5y3o8/NNZxWrBOwxfnyJ1KExI0CcG99wCLoVSvcNzT1l8Iuv n5YvuyB0zamhfJRN/o8hmzIPPFCtJG6nu8yKWP5DIVRIctIPb7vzJwNHWoQBmLDdrc50 0B6c1Whvcnb3YiinDchdEuN+Vh0rHJoZgxzAwhZ8goS5fuV2xHg8k2FDk4U9YRcWYuBb ucdg== X-Gm-Message-State: AGRZ1gKqG+Qe1bascLCeE7z1DZUpiKIBGXDthsgIMrZ62wnaATEaVduI wzAZc4qDv25ku2VJKm3Dg8nxXhjOLuiFjSPqeX4= X-Received: by 2002:aca:7581:: with SMTP id q123mr18526913oic.176.1543315779234; Tue, 27 Nov 2018 02:49:39 -0800 (PST) MIME-Version: 1.0 References: <1543216072-9623-1-git-send-email-harini.katakam@xilinx.com> <1543216072-9623-2-git-send-email-harini.katakam@xilinx.com> <5de882e3-65ac-7ff1-bb55-7537666dfc77@microchip.com> <20181126145210.GD12116@lunn.ch> <74937246-dc7d-db1c-df00-5db856192eac@microchip.com> In-Reply-To: <74937246-dc7d-db1c-df00-5db856192eac@microchip.com> From: Harini Katakam Date: Tue, 27 Nov 2018 16:19:28 +0530 Message-ID: Subject: Re: [PATCH v2 1/4] net: macb: Check MDIO state before read/write and use timeouts To: Claudiu Beznea Cc: Andrew Lunn , Harini Katakam , Nicolas Ferre , David Miller , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Michal Simek , Shubhrajyoti Datta , sai.pavan.boddu@xilinx.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Claudiu, > >>>> > >>>> Replace the while loop in MDIO read/write functions with a timeout. > >>>> In addition, add a check for MDIO bus busy before initiating a new > >>>> operation as well to make sure there is no ongoing MDIO operation. > >>> > >>> Is this MDIO bus busy check necessary? The caller of > >>> macb_mdio_read/macb_mdio_write locks the mdio bus mutex before calling it > >>> (e.g. mdiobus_read). > >> > >> Hi Claudiu > >> > >> It depends on the implementation. A write operation you could just > >> launch, but not wait for it to complete, allowing you to do other > >> stuff while the hardware is busy. For the next operation you then do > >> need to check the previous operation has completed. > >> > >> I've not checked it is actually implemented this way. > > > > Yes, as Andrew mentioned, a previous MDIO bus operation cannot > > be assumed to be complete always - for ex., in case of a timeout. > > There is a chance that the MDIO bus bit is busy when mdio_read/write > > is called. > > Thank you for your responses. I see it now. > > Then, do you think it would be better to have a new API part of struct > mii_bus that drivers should register so that, the mii core to check if the > bus is idle before lunching a new request? Sure, let me explore this option. Regards, Harini