Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BC67C43387 for ; Thu, 17 Jan 2019 18:56:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E91E920855 for ; Thu, 17 Jan 2019 18:56:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MSV+bc0f" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727396AbfAQS4H (ORCPT ); Thu, 17 Jan 2019 13:56:07 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:33796 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725999AbfAQS4H (ORCPT ); Thu, 17 Jan 2019 13:56:07 -0500 Received: by mail-wm1-f66.google.com with SMTP id y185so1748061wmd.1 for ; Thu, 17 Jan 2019 10:56:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=PAgpJHbPLUbraWQfmEjh8VkUBVXJ9k0Rm7MQi+NuyhQ=; b=MSV+bc0fzQ6d3li5PDp0S9Zb1iDut+zXzotzpT80b2l4IP9rgxMNVvuPkTH3vZOafn MzT52GxX0+lky0VkJtU9aw98FRfUqsTw5pZASLOycbvZIAAieFdqoPMVYLb7alhgyyKT PJ1jWjT5VnpAkxGIkYDUrjxLV35056KsLqoyNNIN7ozJTriq2rTzEnUF0tEuKycd+8kW EW+AVqw5Ke8k8HNPKUqN/9VNQnyI9E07UYXhZPJt/m2rkICBXaDCFljdw7dfluCc0RPJ Fo4fqCI2fr2OCItpUr3A1sI5CII9Iy5bRFsQM+4aFIkFHy//H8ePXF+0gsECV9z+o9Vo 2+9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=PAgpJHbPLUbraWQfmEjh8VkUBVXJ9k0Rm7MQi+NuyhQ=; b=WnCmw6Sz9X2UscaCNYV4j0IuJXgwggxvlP7XPb9yNu74CfT6EKddHUue3HZK7sAEzI 2Yp6hiGwwhVmqUakuqlx6iQn5IkJZO6jyfePETj5ZTapxaVpXLS1Gdxreu3rrrsn0m+0 ZOkEpS1NtjORjiL9d5Y+4dLwyj4MWKusyUjQtgC4rOrtZIdv4d0kf/+ICVr2eYLv6Mvw c7ZKCIzEJp0O0YPrRKsXb06JoV7ij28Ft3qxP/y3voj4640SZzBa7lPu3/vR641RFiSn NPPbFSoTmW1Jw8Vyw3yNUmcHaAtjU28DNZkeWwfswXOmz5HT6Oge4WVl3B1nHevJ2FAk 4tlw== X-Gm-Message-State: AJcUukej0PcGdPXbrgmSuo5ZhGSGZlITzwnI54uGCWt0JeFg7wcMdwXW KLynknmYotPY9ey8nl0gHqWyMMFf X-Google-Smtp-Source: ALg8bN4KnnXqxZJufeKG3JpCjK1dMQvP0VuWEp4zI1hdeP1b6oVR5hyyHANtU9cRuX0BR7ys0oXjGw== X-Received: by 2002:a1c:578e:: with SMTP id l136mr12533822wmb.124.1547751365207; Thu, 17 Jan 2019 10:56:05 -0800 (PST) Received: from ?IPv6:2003:ea:8bf1:e200:e16f:df31:daf0:b736? (p200300EA8BF1E200E16FDF31DAF0B736.dip0.t-ipconnect.de. [2003:ea:8bf1:e200:e16f:df31:daf0:b736]) by smtp.googlemail.com with ESMTPSA id p12sm43808578wmi.5.2019.01.17.10.56.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Jan 2019 10:56:04 -0800 (PST) Subject: Re: [PATCH v2 net-next 1/3] net: phy: check that PHY is stopped when entering phy_disconnect From: Heiner Kallweit To: Andrew Lunn Cc: Florian Fainelli , David Miller , "netdev@vger.kernel.org" References: <36e18752-488a-8fa7-ce0a-376446455345@gmail.com> <36d66609-9d1f-a116-c12b-266802eb61de@gmail.com> <20190116214830.GK29244@lunn.ch> <6d1881f9-9c65-8507-1f3f-43757c6631bc@gmail.com> Message-ID: <25121aad-0c6e-5387-4e66-aac96636e611@gmail.com> Date: Thu, 17 Jan 2019 19:55:54 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <6d1881f9-9c65-8507-1f3f-43757c6631bc@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 17.01.2019 07:19, Heiner Kallweit wrote: > On 16.01.2019 22:48, Andrew Lunn wrote: >> On Wed, Jan 16, 2019 at 09:25:15PM +0100, Heiner Kallweit wrote: >>> Every driver should have called phy_stop() before calling >>> phy_disconnect(). Let's check for this and ensure PHY is stopped >>> when starting with the actual work in phy_disconnect(). >> >> Hi Heiner >> >> Looking at the patch, i think why must the MAC driver call phy_stop() >> before phy_disconnect()? It keeps is symmetrical, you need >> phy_connect() and then phy_start(). But if the core can detect that >> phy_stop() has not been called, and can call phy_stop() when needed, >> we can probably simplify the MAC drivers by removing many of the >> phy_stop() calls. >> >> I think it might come down to where the phy_connect()/phy_disconnect() >> is performed. Sometimes it is in probe()/remove(), sometimes it is in >> open()/close(). If phy_disconnect() is in remove(), phy_stop() is >> needed in close(). But if phy_disconnect() is called in close() the >> phy_stop() could be skipped? >> > Right, there may be cases where this is possible. However typically I > see the following in network drivers in close(): > - first different things are stopped / cleaned up, where order is > critical (stopping PHY, tx queues, ..) > - then resources are released (free interrupt, ..) > Therefore I assume that in most cases the split to phy_stop() and > phy_disconnect() is needed. > After thinking about it again I think I'll go with the proposed approach to leave it to the driver whether he wants to call phy_stop() separately or not. So I will just remove the warning. >> Before we start adding warning, we probably should first document the >> expectations. Documentation/networking/phy.txt seems like a good >> place. >> > Indeed, that's something we should do. > >> Andrew >> > Heiner >