Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2164850ybi; Thu, 4 Jul 2019 06:12:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqxOGKf8TQ/XYS5cEitibol3tP1VbEfnY24daV09vu+R0oeAEBpemzRzd5QB+GfRovBsf/Ad X-Received: by 2002:a17:90a:24ac:: with SMTP id i41mr19508831pje.124.1562245950793; Thu, 04 Jul 2019 06:12:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562245950; cv=none; d=google.com; s=arc-20160816; b=GsW9iX5HaA9ZCoihOvXF7N0V0wE1cKnzGenrlMM0bHvRvMNRLq1P1wGwd8u6qiCV9i j99R2Vs3I/5SrxEcHc6zEGrj00kjIg7FPZJ/YyFEljeBI6hBXZKg3V+qN/vEbhsKfspX iiYKemdq+1AoKNmDRZ3KWVKjnk+B0As0vob0dawrO7suL31cmlkHyUV910W8XjR+f8BX Z9YC5dArVe/NLO4bGUAFF5YzG0g5Lh6qpmY9tITqtu5uvHcKx6ijMfgWY/NAJ2aFpuut oC2Y/MD2q+W9btQURp5alq4tnQLW5HwGdYrJOxpLifTH3LRQGzh2r7btfm5GdXk6+O/8 6h0A== 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 :references:in-reply-to:date:cc:to:from:subject:message-id; bh=clgvo8RTbvLW1KnP5mnkK7e4P3fVcbcXIZMaeoN/2TM=; b=sXNQrEyzMYX3YZcWu02myXGAF5zU3ECBM+6iWn0kb0A3hzMUk38yroKaGayykCkMDG u77kqcH6Q2BqnfB/yIQ/Ec46weK82G3s0l3lqxHKEFuwx09NwIIdvHnEdZPyUngLgE2Q nI6AmA3n3f42ZkWqpjnXVdZyFXtdBgcpYE/sOv3geSnTFsrjX8A+ThnZdgPs9rez9DUN xUeANtVRONC4CIsXjxGR0dGUmov6kQFWTczOABdv5nSUqjYxS8Wp7EgoTXWKqEZtHpvA VROJEkNfOG+Ep2BqOtevfC4rfipljqA2XelJW9wW00eudJhHu3nJx6eBvbf+6Wehqw8X XLdw== 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 t2si5286726pgp.343.2019.07.04.06.12.14; Thu, 04 Jul 2019 06:12:30 -0700 (PDT) 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 S1727237AbfGDNKU (ORCPT + 99 others); Thu, 4 Jul 2019 09:10:20 -0400 Received: from s3.sipsolutions.net ([144.76.43.62]:34078 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726791AbfGDNKU (ORCPT ); Thu, 4 Jul 2019 09:10:20 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1hj1V6-0007UI-Gl; Thu, 04 Jul 2019 15:10:12 +0200 Message-ID: Subject: Re: [PATCH net-next v6 06/15] ethtool: netlink bitset handling From: Johannes Berg To: Michal Kubecek , netdev@vger.kernel.org Cc: Jiri Pirko , David Miller , Jakub Kicinski , Andrew Lunn , Florian Fainelli , John Linville , Stephen Hemminger , linux-kernel@vger.kernel.org Date: Thu, 04 Jul 2019 15:10:11 +0200 In-Reply-To: <20190704125315.GT20101@unicorn.suse.cz> References: <20190703114933.GW2250@nanopsycho> <20190703181851.GP20101@unicorn.suse.cz> <20190704080435.GF2250@nanopsycho> <20190704115236.GR20101@unicorn.suse.cz> <6c070d62ffe342f5bc70556ef0f85740d04ae4a3.camel@sipsolutions.net> <20190704121718.GS20101@unicorn.suse.cz> <2f1a8edb0b000b4eb7adcaca0d1fb05fdd73a587.camel@sipsolutions.net> <20190704125315.GT20101@unicorn.suse.cz> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-3.fc28) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2019-07-04 at 14:53 +0200, Michal Kubecek wrote: > > > value: 0b00000000'000000xx'xxxxxxxx'xxxxxxxx > > mask: 0b00000000'00000011'11111111'11111111 > > One scenario that I can see from the top of my head would be user > running > > ethtool -s advertise 0x... The "0x..." here would be the *value* in the NLA_BITFIELD32 parlance, right? What would the "selector" be? I assume the selector would be "whatever ethtool knows about"? > with hex value representing some subset of link modes. Now if ethtool > version is behind kernel and recognizes fewer link modes than kernel > but in a way that the number rounded up to bytes or words would be the > same, kernel has no way to recognize of those zero bits on top of the > mask are zero on purpose or just because userspace doesn't know about > them. In general, I believe the absence of bit length information is > something protocols would have to work around sometimes. > > The submitted implementation doesn't have this problem as it can tell > kernel "this is a list" (i.e. I'm not sending a value/mask pair, I want > exactly these bits to be set). OK, here I guess I see what you mean. You're saying if ethtool were to send a value/mask of "0..0100/0..0111" you wouldn't know what to do with BIT(4) as long as the kernel knows about that bit? I guess the difference now is depending on the operation. NLA_BITFIELD32 is sort of built on the assumption of having a "toggle" operation. If you want to have a "set to" operation, then you don't really need the selector/mask at all, just the value. johannes