Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp21181665ybl; Sun, 5 Jan 2020 22:40:01 -0800 (PST) X-Google-Smtp-Source: APXvYqwSVgPt9jdh3YNnQ4I3E3HUx0X39zEhqishbzLoe10S72XoRgSgOnGlylUbIk1ea/yJZQvf X-Received: by 2002:a9d:7c91:: with SMTP id q17mr99999165otn.293.1578292801910; Sun, 05 Jan 2020 22:40:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578292801; cv=none; d=google.com; s=arc-20160816; b=tknmSd5QvgIMa3lRBJqIQHB2UpUct6XU7dona00hgCzyVHXePMBRXBz0cG1zS1bHM6 7sT7zZi82fFSQQKFPQZXn+JPq46OdWmUTOIQxjFwc5aFnvta4ElVuNxrZ3x87b6WpFjh BLM6e/1+PlUhMVcPxj4pzZfhD/z0n9eKxKjIDtGz1d4Vlaux2hFWQLi1U/ZqgMm+pJjz +5d/aFkLKFqh93Y1xlsxRA0LVobnYqRqNEObJWNwarv2dxJynr+ND+o6t3c+DsI8IMzm vfXpCcmlwdGwsDRpJVeuZcV+JogZzPGlCrOP6ceWrzBLHytb90s8rsaq3tXAF5bLgakG YkdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:message-id; bh=v/WHc9oNYxYePqaq1XR9N2wLGPZziPuHM713mcZlfNA=; b=nfBLRKFjwqmIYtseMDnzqEGD+hsZeGl71Icav9bKE7spptJuzS7hac9QqVELYBat5Z MA5omh7qcJSDxWwl9HhENFenvKQh5zqljuDeAA9a4UEPpa7muz6qZL6YpFrjDbrU6abw LCmRBfTdUjhgkPq8QsSZHF1GtUWfD9PuNOe2Yl45vTK+dv1rSvTo2G6avfvu7hbqEhKd OGdqmahvwR59pryorgG8dc602FRYLzJKgR6N9Xm0wVEQuKvnG83azbKzX8xg1bwt+ktY TPshnJpsqXJX3tFUOzEbvijvEijj58lD6/4abvcGRwbV06h8TM68jiG/eom9ekhGEESe /V6g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-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 e63si35405369ote.166.2020.01.05.22.39.42; Sun, 05 Jan 2020 22:40:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-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-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726952AbgAFGj3 (ORCPT + 99 others); Mon, 6 Jan 2020 01:39:29 -0500 Received: from mx2.suse.de ([195.135.220.15]:42554 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726338AbgAFGj3 (ORCPT ); Mon, 6 Jan 2020 01:39:29 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1AF7FADBE; Mon, 6 Jan 2020 06:39:27 +0000 (UTC) Received: by unicorn.suse.cz (Postfix, from userid 1000) id 75D20E048A; Mon, 6 Jan 2020 07:39:26 +0100 (CET) Message-Id: From: Michal Kubecek Subject: [PATCH net-next v2 0/3] ethtool: allow nesting of begin() and complete() callbacks To: "David S. Miller" , netdev@vger.kernel.org Cc: Maya Erez , Kalle Valo , linux-wireless@vger.kernel.org, wil6210@qti.qualcomm.com, Francois Romieu , linux-kernel@vger.kernel.org, Andrew Lunn , Florian Fainelli Date: Mon, 6 Jan 2020 07:39:26 +0100 (CET) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The ethtool ioctl interface used to guarantee that ethtool_ops callbacks were always called in a block between calls to ->begin() and ->complete() (if these are defined) and that this whole block was executed with RTNL lock held: rtnl_lock(); ops->begin(); /* other ethtool_ops calls */ ops->complete(); rtnl_unlock(); This prevented any nesting or crossing of the begin-complete blocks. However, this is no longer guaranteed even for ioctl interface as at least ethtool_phys_id() releases RTNL lock while waiting for a timer. With the introduction of netlink ethtool interface, the begin-complete pairs are naturally nested e.g. when a request triggers a netlink notification. Fortunately, only minority of networking drivers implements begin() and complete() callbacks and most of those that do, fall into three groups: - wrappers for pm_runtime_get_sync() and pm_runtime_put() - wrappers for clk_prepare_enable() and clk_disable_unprepare() - begin() checks netif_running() (fails if false), no complete() First two have their own refcounting, third is safe w.r.t. nesting of the blocks. Only three in-tree networking drivers need an update to deal with nesting of begin() and complete() calls: via-velocity and epic100 perform resume and suspend on their own and wil6210 completely serializes the calls using its own mutex (which would lead to a deadlock if a request request triggered a netlink notification). The series addresses these problems. changes between v1 and v2: - fix inverted condition in epic100 ethtool_begin() (thanks to Andrew Lunn) Michal Kubecek (3): wil6210: get rid of begin() and complete() ethtool_ops via-velocity: allow nesting of ethtool_ops begin() and complete() epic100: allow nesting of ethtool_ops begin() and complete() drivers/net/ethernet/smsc/epic100.c | 7 +++- drivers/net/ethernet/via/via-velocity.c | 14 +++++-- drivers/net/ethernet/via/via-velocity.h | 1 + drivers/net/wireless/ath/wil6210/ethtool.c | 43 ++++++++-------------- 4 files changed, 32 insertions(+), 33 deletions(-) -- 2.24.1