Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp930323rwb; Thu, 19 Jan 2023 04:41:13 -0800 (PST) X-Google-Smtp-Source: AMrXdXtW1WFbvE+NVU38aBQhS9EhmipCBIeGsLTHuZWyEXkm8SzMuYO/vqZYwF18Mn3Y+2FiRRmp X-Received: by 2002:a05:6a20:8b91:b0:b8:a1f4:a27c with SMTP id m17-20020a056a208b9100b000b8a1f4a27cmr11329302pzh.30.1674132073101; Thu, 19 Jan 2023 04:41:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674132073; cv=pass; d=google.com; s=arc-20160816; b=j8J9J8W/l8mbTjSLaSk237M8/T/BtMFt1MkpEExE0nkMH94+uKM+BERL7sU6ejeLLs 2Tc5ESqCJtcx29Xg32W9o6eZRPzQs0bT73+PnW/MItVPtSAk3fi7bMYqoblghl6SolQf t4HvJtYJC/C70edt0WDsW7DHXY1g7/Xhv9xM+Exp7woaeI6aF1N3Fe9+Jk/iN34f6fhf kl0JcIK7ln9XcOIb9lheX95P4upgnxBPVkqm4V4KS2aqdiImBymAyfhiZTmUNA05oVxB 9P/8s4k8BF5NtujUxEm2Hxhb4GMJ3/aHwHu8mE9maktAbHvwhtLhqDt5buYI35wcLYBA SQgA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h37-20020a631225000000b00476db6fe4cfsi37609078pgl.829.2023.01.19.04.41.07; Thu, 19 Jan 2023 04:41:13 -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 + 44 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 ); 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 To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Michal Kubecek , Claudiu Manoil , Vinicius Costa Gomes , Xiaoliang Yang , Kurt Kanzenbach , Rui Sousa , Ferenc Fejes , Pranavi Somisetty , Harini Katakam , Colin Foster , UNGLinuxDriver@microchip.com, Alexandre Belloni , Andrew Lunn , Florian Fainelli 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: =?us-ascii?Q?t1O+m+canfJghtQVAeLHujY8/CCupuaf4TLLRz/yykjf/SNgbUxxdB6MQL5U?= =?us-ascii?Q?OyEgNKZIzyZYIWCiyhC4+7npFDJxzBuCDZQw4OiR5NPkOJPankiIZBTu/upG?= =?us-ascii?Q?9A2I6ndi5NfSei99nOlGllR9ndSq9z8p1vQTMrJC2d4lpEiyoAwJ4fcgd4ko?= =?us-ascii?Q?yhDpq4uXZrzYpM54r089wJIqYgd1Al8rqSqd0VjAOhuVJ3DpP0bgYmtbMBZy?= =?us-ascii?Q?pvZF543r/3AFKNVuPvj4k6CDLPBUKhmvJFST3TGrC1GE/Kko5O3JejRZct5U?= =?us-ascii?Q?av8lQkuTSPEh3wRlAftHLrdveBRSY5cnVq7j99ZXat7TLYa7AcxJOrT+acQU?= =?us-ascii?Q?Su9DNtZ/pR7/6aYhxRhBw1hV8EOk8alzCf/smjrAsH6NrJFZqLbo+6fNzRkC?= =?us-ascii?Q?hIEswCO0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aiVT8+V?= =?us-ascii?Q?d3zuEqBgxoCxdox9NCkSRJCsDuiyelOezTpXIrZcYoAXHPA1/0oUGuSYGc7g?= =?us-ascii?Q?A/k1Rp6LOMeDdOJ6UUklSZ0OTUiE4KTKNBiWnySFBhKvFbrYYzuRpVlkom0V?= =?us-ascii?Q?RYA1UvXaAh8aTdXjWHuddwiB5p7dNUJ3Yob8MXZg2fpT/n8A5NjTN16Z4+PN?= =?us-ascii?Q?zAuauUmxJzs5pHVtT2YGuSQN9LxXOKe2Stwoeut9wd+p1xuAT8EKC9JQHDtE?= =?us-ascii?Q?pu1u1rzTOHIvvOMWNFeSG3mP+db1dCSXvCofOAhDlNkLoLIAhqsJdtYh0Stg?= =?us-ascii?Q?eA=3D=3D?= 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: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 -- 2.34.1