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 BD82AC43387 for ; Thu, 17 Jan 2019 06:19:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8798820855 for ; Thu, 17 Jan 2019 06:19:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Mrs5dx3v" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730058AbfAQGT4 (ORCPT ); Thu, 17 Jan 2019 01:19:56 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:33477 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730039AbfAQGT4 (ORCPT ); Thu, 17 Jan 2019 01:19:56 -0500 Received: by mail-wr1-f68.google.com with SMTP id c14so9657371wrr.0 for ; Wed, 16 Jan 2019 22:19:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=2mxfWCaC5J6sJIzQ48kutLOvpynEp4HfRP2pdb94KPU=; b=Mrs5dx3vF7yVswSJW/B14vpTSfqEXvt3lI/DZVBOIFEpZHVQOh0hZyfiUVKCQcMAk6 zsseudrCrl8Plt7QKnq9ELy5z6mUiLY8bJNZ2IJ5CIDKZBL2saz4TRc7m+kVi6nM4cuc FEQXU/utN0p4Mbafc+4i7GjR2OtBJFuvxhJR6cqvQ2y38mHjK7GwzsG6NZgB/ypRRggj j3Cd6pp1ZzmPOFvyESBBZlqkOYsSQHlXgULVeZgw791DGLrxQPUTpTJvORwRzDAe1opA NM895B/NFV42VvtohVT1KNPUgDJ2Zsi1QoQx4QXx1EMsb2+sgt1a21g9kePdKBLM8UYy FAcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=2mxfWCaC5J6sJIzQ48kutLOvpynEp4HfRP2pdb94KPU=; b=i/apkpOgp5eiWCDuj20HHax3Ce4EKW4Mg1iH8nughvzYjHaE/N9GeG1RcnyJQXpZto +kGVChHM20DZlkCJqAHaCvH12wP6+D9TyrZumAo+/updyV33oowIa0QDknSjpebadD82 CiuD66E8ixo66jDNBsoNFpNUB3ZfYo0anQSBOt1e2cSJ7lpwKpyCmntLCz7WDPyoCPfl +1Qo+xj6rf9vJYS/dK9H5HcmlUqigLcJK5Ut5nkcCgBCoE7zAoDC7K8OCy9J9jy+ah/m sVmCkdPBjBGnWc1jYOJ3mvxVGclsmaCYQfGcdUvmS9bdUSjbwuld8ABhKnrd89wEuBsz pn7g== X-Gm-Message-State: AJcUukcWSuLMjtWbvzuWZBvLwfPemqkZRPSYKQbl7zCJ1CwszzgGGTb4 JLkVcbRjJhEQgsSq4gWZ59F8RqGX X-Google-Smtp-Source: ALg8bN51u+Fv4SLyP0MCJslligvQlJhirNOIKlK7jdqE7wbiu15SjxjdjQXfPhm4bA+/37yCjTQXVg== X-Received: by 2002:adf:ae41:: with SMTP id u1mr9995817wrd.20.1547705994281; Wed, 16 Jan 2019 22:19:54 -0800 (PST) Received: from ?IPv6:2003:ea:8bf1:e200:f186:f86:d850:f99e? (p200300EA8BF1E200F1860F86D850F99E.dip0.t-ipconnect.de. [2003:ea:8bf1:e200:f186:f86:d850:f99e]) by smtp.googlemail.com with ESMTPSA id 129sm63886446wmd.18.2019.01.16.22.19.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Jan 2019 22:19:53 -0800 (PST) Subject: Re: [PATCH v2 net-next 1/3] net: phy: check that PHY is stopped when entering phy_disconnect 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> From: Heiner Kallweit Message-ID: <6d1881f9-9c65-8507-1f3f-43757c6631bc@gmail.com> Date: Thu, 17 Jan 2019 07:19:44 +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: <20190116214830.GK29244@lunn.ch> 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 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. > 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