Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp165671pxa; Wed, 26 Aug 2020 07:32:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/bcJMPmqa+0/a+bJrwKdjtTNFCr8CKR8XFW+G32K1yQRMzyM81yStwKssLtq30Ipas0Mn X-Received: by 2002:a17:906:c294:: with SMTP id r20mr15626305ejz.280.1598452324662; Wed, 26 Aug 2020 07:32:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598452324; cv=none; d=google.com; s=arc-20160816; b=m8TrRUHf2nromwuJt6vATJf0zedbymtOwf4Cnbh1fK/TD6nxpnFKzVjuYqWfvMJtlt 86ptBnrs6vArxc+sBeKUNs4RGsMMwkgn8TKVIEAZjZGdPpCuija+g1L+NrEZ89SfNYPv AMiiBLgapKCqJziPUeLtThMPkocxv3D5cnA/5BO1UIJ3LNJRWfRu8diKwIPTuyk3RL+Y pmDsMah9ujpUcSUEUonfsTPDUxpVyRYjPI5mJZdT8sydzyF/b2Q0sEeAkl7olK79rms6 vkvKoUeyF3M/11rN9lugkt0hxoHGCiOhJ9kIvoO3tkDyr968/+xyIR4yj9geYPMZHXit s2OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qCBqgznRvgdXg1YTalMza2lz5HPJroBJqXxP5qH6y04=; b=N3BRgJuzyLCuvZ4w25QvWBzPvxOXT0pK34sGmMn1ZeE27jZYp1mD62nju2DgiBeimu ZkbYkr4lyln+ztmUFhfKZGosp+AZyUr+WTC47nlvKBHbgDKgFUhGWdeQ+qu9QBrJ2eDH UzZo+wAjU6YHRtbimwosNvqnYhOItf+fyadWkg2Tp5u/rIuDfr7h368WOOUhTIjXpTV7 XG2jXfF1bCfj2edOzAUgCm3EswfSbnlkzXZvc14/QJjwN+adRPcCfjrQBQIvScEE19U1 Ls+AtIrsPsdK9wLpDDm6isVhQ9CYrkHtqgYg6qkyoEHolstlf2rf+xpVjZw7t4cJPJX3 RSjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DqRxhpi7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jr23si1855497ejb.572.2020.08.26.07.31.41; Wed, 26 Aug 2020 07:32:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DqRxhpi7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729740AbgHZMGk (ORCPT + 99 others); Wed, 26 Aug 2020 08:06:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:38536 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729526AbgHZMD3 (ORCPT ); Wed, 26 Aug 2020 08:03:29 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F3D12208A9; Wed, 26 Aug 2020 12:03:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598443408; bh=O8ZwRVfglmC1HCV5rl0wMfnoGxS661gLxObTPdOyfoo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DqRxhpi7bploDaVXtx1h/mslopTS/QLDu8swSr5aYZgPhMKlFaJLBRDA/GE+uccEy PXCZ5QsdkmL/EYFOy/etybHV1lPUNkPEPPqp1ECSBXf8EqvNm68I7794ehEiCZQROB 8/UWLexQjLwc8OlVjpZkamRK6HZCFx7PE3WPXXYM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Mikityanskiy , Michal Kubecek , "David S. Miller" Subject: [PATCH 5.8 13/16] ethtool: Dont omit the netlink reply if no features were changed Date: Wed, 26 Aug 2020 14:02:50 +0200 Message-Id: <20200826114911.869913007@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200826114911.216745274@linuxfoundation.org> References: <20200826114911.216745274@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maxim Mikityanskiy [ Upstream commit f01204ec8be7ea5e8f0230a7d4200e338d563bde ] The legacy ethtool userspace tool shows an error when no features could be changed. It's useful to have a netlink reply to be able to show this error when __netdev_update_features wasn't called, for example: 1. ethtool -k eth0 large-receive-offload: off 2. ethtool -K eth0 rx-fcs on 3. ethtool -K eth0 lro on Could not change any device features rx-lro: off [requested on] 4. ethtool -K eth0 lro on # The output should be the same, but without this patch the kernel # doesn't send the reply, and ethtool is unable to detect the error. This commit makes ethtool-netlink always return a reply when requested, and it still avoids unnecessary calls to __netdev_update_features if the wanted features haven't changed. Fixes: 0980bfcd6954 ("ethtool: set netdev features with FEATURES_SET request") Signed-off-by: Maxim Mikityanskiy Reviewed-by: Michal Kubecek Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ethtool/features.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) --- a/net/ethtool/features.c +++ b/net/ethtool/features.c @@ -268,14 +268,11 @@ int ethnl_set_features(struct sk_buff *s bitmap_and(req_wanted, req_wanted, req_mask, NETDEV_FEATURE_COUNT); bitmap_andnot(new_wanted, old_wanted, req_mask, NETDEV_FEATURE_COUNT); bitmap_or(req_wanted, new_wanted, req_wanted, NETDEV_FEATURE_COUNT); - if (bitmap_equal(req_wanted, old_wanted, NETDEV_FEATURE_COUNT)) { - ret = 0; - goto out_rtnl; + if (!bitmap_equal(req_wanted, old_wanted, NETDEV_FEATURE_COUNT)) { + dev->wanted_features &= ~dev->hw_features; + dev->wanted_features |= ethnl_bitmap_to_features(req_wanted) & dev->hw_features; + __netdev_update_features(dev); } - - dev->wanted_features &= ~dev->hw_features; - dev->wanted_features |= ethnl_bitmap_to_features(req_wanted) & dev->hw_features; - __netdev_update_features(dev); ethnl_features_to_bitmap(new_active, dev->features); mod = !bitmap_equal(old_active, new_active, NETDEV_FEATURE_COUNT);