Message ID | 20230119122705.73054-2-vladimir.oltean@nxp.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp298386wrn; Thu, 19 Jan 2023 04:30:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXtzMrGiX35rHnYeFVBCImFftMIuGfDGk4ELdMv4BsyKm3ISTh3iIeJ5FDXa5zR8rYDWcag6 X-Received: by 2002:a17:90a:aa83:b0:226:102:2dc9 with SMTP id l3-20020a17090aaa8300b0022601022dc9mr11219784pjq.14.1674131410886; Thu, 19 Jan 2023 04:30:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674131410; cv=pass; d=google.com; s=arc-20160816; b=Aq6kfOIkxhx60qk4+A3xXCWtIcOjYg2XIdlCc20u2/rmsGiCkN1GqBa3FgF/8diIgc K9swMlJPdalCAWpGvPB1RuRtBDgyKPivjv64M5Hc4Xy71A1k0vm4y4Bch5gXzzPtL74p xWzCKex2EnQG/nY/I2RgTBbxCb06/txcpr8iqIgZxuvgj1Uw8bZzPgv8kY2y45YDune2 +ak8T9G3S5Aw/93Zw/LV/fWJOK37Tz7X2qDhVjnrGRWjcZGLMkMvKcct0LLO35r+Gjg4 o8ToV4BHBcO/k9GxYOA15RYd1IOl9Q1EAJ1u8fTZgbqx/R1XwNNwYhC5skwDXqd28yvo wuiA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8VZ1bzQJWNxKiTHPMyICcY5kpOd9iIjikDdZvWhfQ2A=; b=NPMusEAp6mvKBinkwUAZtUBj118j6yOYUMKnNBcFTXV6Qxw4w8DKHknf2ypyRyyJut HIWDRV3uPAntCTVm8ZOWl3Ux88NhCgB4frmKBqsCccptHnx6WptptMSgYvBcPKHZMMEC 643wDbsBhM0T3eZaya5Oz3uL+W6EP+AIS5BWdHhTvUnODkIxRflowCglPPzWvaRENrSf vjzghu7CGRMnE/UKXKDX8Fj2vQT0VoqZCA+7+tul2hO2U8OK2r8KczbbBr5z92rj7YxH 7iU5NlmmiR0sh452I6fKlsi2jfZhVe6cVJ4ahJ48ahTna7uQG81mIX9yyQVrqozecsMH r2/w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=s9ijbTuX; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pf16-20020a17090b1d9000b00229c251a65fsi5803114pjb.152.2023.01.19.04.29.57; Thu, 19 Jan 2023 04:30:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=s9ijbTuX; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230317AbjASM2t (ORCPT <rfc822;pfffrao@gmail.com> + 99 others); Thu, 19 Jan 2023 07:28:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230219AbjASM15 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 19 Jan 2023 07:27:57 -0500 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2079.outbound.protection.outlook.com [40.107.14.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F6DE78A9E; Thu, 19 Jan 2023 04:27:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RaqQolBh8AArE7tEzPD2bUy2maxN+U4/PNftbLZMFiKZMf9+IXmRx9HCP9BaraL4agYJFsLovQDuotm9rYnov17fk6hntxLdhTKl0g8UykzQe2bP4OCZM432BmqESKa53nJQf0uZ4cljI6WfzkqmYoMQmVdSkmk+Am1MK2XXtuE8gLh3XsuhkHTeA2rvfZKyOb06KFDzQnpaT4IaY3dyHOTL51fAINbs83DtlZmb+NOXDSuVLdkLeCqoomSLxj0YNrk7ScZaWpykX1JXDUhd3sqonME5GII7RfrmaKBb2J2svdi8Fehhk4bedG1h2F8qwSdVzYtbU9dcLqEIJWSXig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8VZ1bzQJWNxKiTHPMyICcY5kpOd9iIjikDdZvWhfQ2A=; b=Q5W0O8dBQ04yAYnDLBEXT2TnE6pZlT9tljuLFubeYPY+CkYf/xWmXSaAUkKJlyXWIfZ0CfQBLPsww+IhovT/2ps1jWKD1/n9oWM6KcTSs23xAF3VkcVNYCaoP4jDDzIBnMAsXy/os4Co8ro+40KomoVksZZqmwseEGMrxnHPBnfr9ljeWY5xfYSA857z38Ytubml0P9cIHqL4OveUDa5BBnY9UpJUM/7CRm6eayysoRFsPRj2oecIY+WGm4Yw1qSXmK9aQ/CtVWdgpmT/mit/i9T4ECWge4EiHjk7RhDSjLJhi72ghbUxrxSfc/TxzidGG1cO0FJSAMq3HqgByobAg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8VZ1bzQJWNxKiTHPMyICcY5kpOd9iIjikDdZvWhfQ2A=; b=s9ijbTuX2BK3H2GehcVwTmxQD6echZYISAEkMW/BPw8vuWArhVD6FK33i+e+IhKR8cnZzhiBcCbYs1bqr6zz61Ogw8yCrDSJjIfkY0RuZutaxfqKqY1k8vERkSfy76/A4KS6dsVm2W91U52UMkwXoKsLGLZfZ1jzD2gFX2m+ywA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by PAXPR04MB9376.eurprd04.prod.outlook.com (2603:10a6:102:2b2::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.24; Thu, 19 Jan 2023 12:27:40 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%4]) with mapi id 15.20.6002.024; Thu, 19 Jan 2023 12:27:40 +0000 From: Vladimir Oltean <vladimir.oltean@nxp.com> To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Michal Kubecek <mkubecek@suse.cz>, Claudiu Manoil <claudiu.manoil@nxp.com>, Vinicius Costa Gomes <vinicius.gomes@intel.com>, Xiaoliang Yang <xiaoliang.yang_1@nxp.com>, Kurt Kanzenbach <kurt@linutronix.de>, Rui Sousa <rui.sousa@nxp.com>, Ferenc Fejes <ferenc.fejes@ericsson.com>, Pranavi Somisetty <pranavi.somisetty@amd.com>, Harini Katakam <harini.katakam@amd.com>, Colin Foster <colin.foster@in-advantage.com>, UNGLinuxDriver@microchip.com, Alexandre Belloni <alexandre.belloni@bootlin.com>, Andrew Lunn <andrew@lunn.ch>, Florian Fainelli <f.fainelli@gmail.com> Subject: [PATCH v4 net-next 01/12] net: ethtool: netlink: introduce ethnl_update_bool() Date: Thu, 19 Jan 2023 14:26:53 +0200 Message-Id: <20230119122705.73054-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230119122705.73054-1-vladimir.oltean@nxp.com> References: <20230119122705.73054-1-vladimir.oltean@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: AM8P189CA0020.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:218::25) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PAXPR04MB9376:EE_ X-MS-Office365-Filtering-Correlation-Id: 01459fc2-d1ed-486b-b30f-08dafa188e20 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: C064C50L98v1VwG0X8gzLtSO3p6dID5CD/6b+bbIoStsIlDtQbc7BiHjp1rXilhJdWPC4BSFXWO9Y/c7Yn9QkxcUEVSEO/MHalLmbRuGs8sWuU0WdibamVz9TokgeIUcn+DrN3GfXSzzrJyR0c05yfD7I0zFhJPx9vGY6GM1BFX13uppsqNBYzw1VdxE2ZzaQiVRc8GEE7gu54OMh2Ni6lEEzBW/3IWH9DsIP9bzdWlQAd6522K8YY5nRv7GmbAAVg/77QQ8kqTIYEw3qBT3ohPAeR6a3EDDaMmYmgdLWSJNjPYxhpy+7+uUYQYTxbiE4qOdj/PBqDy8LOt9/k2ENONyZbgBNnXowiF/4gZu4XSsVxARuR76KQ8AMJNj9qaIj9DytdFsNuYBSQRS1h7S4C6tu7vM9GPMDQ4QuLbFlNQGDHMVUgjSE4tu+LqhZNfWXkJJmD4qrp9WW/wmYcUDvtA5XV/RiTGrnvZi6Jodx++uAy9S0eqnDLygmztgJ0dI0m43IAxJy/ecwpvgyHzKpQcqy+FTI4sjbvsb+i8AFdl04m+a/lAC17hkeKYYxjqS8ejbWRtT8Et3xqDi9oXndMUyfE+mQ2JC1FWRbQK4V0NC6Rxot5qnfrjBfunzEfOR03IqF1D5P7qhapzhh8xSziL5pSKcJrWq12lwV/tz6F4mHYJPMGlCQow30EXWueqoNxoS+GYzu8Pbgk7Aq+0vRVke01MQ/mm3RxsYs1TF1lc= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(396003)(39860400002)(376002)(136003)(346002)(366004)(451199015)(6506007)(66946007)(66476007)(44832011)(66556008)(7416002)(8936002)(5660300002)(2906002)(38350700002)(38100700002)(316002)(6666004)(54906003)(52116002)(86362001)(36756003)(4326008)(6486002)(478600001)(6916009)(41300700001)(8676002)(26005)(1076003)(6512007)(186003)(83380400001)(2616005)(309714004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: t1O+m+canfJghtQVAeLHujY8/CCupuaf4TLLRz/yykjf/SNgbUxxdB6MQL5UOyEgNKZIzyZYIWCiyhC4+7npFDJxzBuCDZQw4OiR5NPkOJPankiIZBTu/upG9A2I6ndi5NfSei99nOl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NSxQmkpdmC73h3osH6jbtHQg/mquccKuTxtQSJr6SyiDvaNrOfuxAYz8rX3HFFO6tVjJeLL097ZXU4D4tGAruOQzsgnF7aiVT8+Vd3zuEqBgxoCxdox9NCkSRJCsDuiyelOezTpXIrZcYoAXHPA1/0oUGuSYGc7gA/k1Rp6LOMeDdOJ6UUklSZ0OTUiE4KTKNBiWnySFBhKvFbrYYzuRpVlkom0VRYA1UvXaAh8aTdXjWHuddwiB5p7dNUJ3Yob8MXZg2fpT/n8A5NjTN16Z4+PNzAuauUmxJzs5pHVtT2YGuSQN9LxXOKe2Stwoeut9wd+p1xuAT8EKC9JQHDtEpu1u1rzTOHIvvOMWNFeSG3mP+db1dCSXvCofOAhDlNkLoLIAhqsJdtYh0StgeA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 01459fc2-d1ed-486b-b30f-08dafa188e20 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2023 12:27:40.1700 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: necYRrzVgHbALeF4mNyxezOKvBtIGf/Whs0+FEPH9W+6iF+cqLI2ul0YL+AoWztDpEp6KGQYNXIM4iHPhOTFxA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9376 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755454017979944712?= X-GMAIL-MSGID: =?utf-8?q?1755454017979944712?= |
Series |
ethtool support for IEEE 802.3 MAC Merge layer
|
|
Commit Message
Vladimir Oltean
Jan. 19, 2023, 12:26 p.m. UTC
Due to the fact that the kernel-side data structures have been carried
over from the ioctl-based ethtool, we are now in the situation where we
have an ethnl_update_bool32() function, but the plain function that
operates on a boolean value kept in an actual u8 netlink attribute
doesn't exist.
With new ethtool features that are exposed solely over netlink, the
kernel data structures will use the "bool" type, so we will need this
kind of helper. Introduce it now; it's needed for things like
verify-disabled for the MAC merge configuration.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
v2->v4: none
v1->v2: rewrite commit message
net/ethtool/netlink.h | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/net/ethtool/netlink.h b/net/ethtool/netlink.h index f271266f6e28..f675f62fe181 100644 --- a/net/ethtool/netlink.h +++ b/net/ethtool/netlink.h @@ -111,6 +111,32 @@ static inline void ethnl_update_u8(u8 *dst, const struct nlattr *attr, *mod = true; } +/** + * ethnl_update_bool() - update bool from NLA_U8 attribute + * @dst: value to update + * @attr: netlink attribute with new value or null + * @mod: pointer to bool for modification tracking + * + * Use the u8 value from NLA_U8 netlink attribute @attr to set bool variable + * pointed to by @dst to false (if zero) or 1 (if not); do nothing if @attr is + * null. Bool pointed to by @mod is set to true if this function changed the + * logical value of *dst, otherwise it is left as is. + */ +static inline void ethnl_update_bool(bool *dst, const struct nlattr *attr, + bool *mod) +{ + u8 val; + + if (!attr) + return; + val = !!nla_get_u8(attr); + if (*dst == val) + return; + + *dst = val; + *mod = true; +} + /** * ethnl_update_bool32() - update u32 used as bool from NLA_U8 attribute * @dst: value to update