Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1927312rdb; Mon, 9 Oct 2023 07:19:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHyzTRko6vrArFZyYG3/Hac3yHtK5piod61e9SUL59uIgQfd1OS256CNt2pBU3sB+E7qYi9 X-Received: by 2002:a17:902:ce8b:b0:1bc:7441:d81a with SMTP id f11-20020a170902ce8b00b001bc7441d81amr15951403plg.6.1696861191880; Mon, 09 Oct 2023 07:19:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696861191; cv=none; d=google.com; s=arc-20160816; b=bykHrZCmHRt5gTjTB6sBKyWiTfFBpwuT8InkMvTEligZhVG4dnH3/4qI26MuY8C8ew 9w4INHpLNGDr02239Gr40JYNqwXLHP3a4MkDS/PDiq4hvnYKC2KjYiwUZrEYTkcIvFhb KIJMJ0LuXx5B5U3EZArWnnLuL0Sh88Hc7ObUOhDo9G0nZdMd/ec7UhhVBGh/mhvB9jXZ ArmIWovL5rhiFu7JQBCBy961BoI2mUJ58W4XMFLKGENlVEL8jl+4bcSzTrQbwiKjRWY/ BQmkayl4/iYjnqqGYfq82BEW2228aGhgVc02xr7NrtxrI8NgazxqFIizrGoyE5n7OtPu SbEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ds3099JRn9X20hrBQi1kaOF8fWxfplaY7hI1Pji/I8s=; fh=ocKFAYXnDx4VTTGv96jforXecIDhYWw8gY1Cjoj8AGk=; b=jHC/422ZFF/BEB/f4y7RWeaOnqUaBwN92qz4fjWdzh4Gk5JPrCEV3hacMdnqa3Y2A3 E2ZLjufDKI5uanImQYi3ZUOzdMh2UD+pKABQ0AqXFgjN2SkCcujwcfcyQ/ICUtdJdO7J nz3U6kFb0GtEBci+vFg7qW0bEsX0gkKLR2Bwd3CK9dLbJJI82S4wfbKLhiX98xYWInpn MDvRtj+px/asX6K2HrmH/+a4ku/Il73bix5eIE8CTl6cHNH2Z1OLzIsaLbZz9EKIHLKE OICBMyxxwbTn43K+rYLr01YO70oKavLvakldCDETXzDBErO2G+oE5BT7X9g+4RXLYPnJ Rfxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="O/34+P3S"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id k9-20020a170902c40900b001bd9e2b4b46si9924467plk.601.2023.10.09.07.19.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 07:19:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="O/34+P3S"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 501AF8057443; Mon, 9 Oct 2023 07:19:37 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376987AbjJIOTb (ORCPT + 52 others); Mon, 9 Oct 2023 10:19:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376944AbjJIOTa (ORCPT ); Mon, 9 Oct 2023 10:19:30 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A60E8E; Mon, 9 Oct 2023 07:19:29 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3450C433CB; Mon, 9 Oct 2023 14:19:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696861168; bh=6P2D1vI9Dnx/ifqCfwETYJ6jqhZEF5cp8roWi8kBEW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O/34+P3SkBRKau8RaapU8XRh6Q8bNB32+IeJaejY/E6pfXsIx7O54aloUAhzju69S Y91+N4M+O24lO3x8KCe2FzTZUxEbH90NHbSXreR2Xprshc3qbt+rRB3DqwXK/0DUnq 3sBfm2bzkwYpQc4ppQMIIS0E17FcTdD/pounFBR66l8HWjaue5r4K8pKfcyuF+Pyu4 YMMJxUlJoLDa09d4+yaghMNgjm0VG/QQBu+ZUwkslodUn9vdxXCXBIBrYhQ0zIpSBW vcHtV5qHj/DC78HqsLBjfdquC25u8f42g5pxI023bkbdglOznFG0qjyPvhuyT9N+a0 xfsuGlZQ0gyFA== From: Arnd Bergmann To: Jakub Kicinski Cc: netdev@vger.kernel.org, Greg Kroah-Hartman , linux-wireless@vger.kernel.org, Johannes Berg , linux-wpan@vger.kernel.org, Michael Hennerich , Paolo Abeni , Eric Dumazet , "David S . Miller" , linux-kernel@vger.kernel.org, Doug Brown , Arnd Bergmann Subject: [PATCH 02/10] ieee802154: avoid deprecated .ndo_do_ioctl callback Date: Mon, 9 Oct 2023 16:19:00 +0200 Message-Id: <20231009141908.1767241-2-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231009141908.1767241-1-arnd@kernel.org> References: <20231009141908.1767241-1-arnd@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 09 Oct 2023 07:19:37 -0700 (PDT) X-Spam-Level: ** From: Arnd Bergmann The ieee802154 socket implementation is the last remaining caller of the netdevice ioctl callback. In order to completely remove this, add a custom pointer to the existing wpan_dev specific operations structure. Since that structure is currently only used to wrap the 'create' header operation, adjust the naming slightly to make this more generic. It would be a good idea to adjust the calling conventions and split the get/set operations into separate functions, but that can be a follow-up cleanup. For the moment, I kept the actual changes to a minimum to avoid regressions. Signed-off-by: Arnd Bergmann --- include/net/cfg802154.h | 9 +++++---- net/ieee802154/socket.c | 5 +++-- net/mac802154/iface.c | 8 ++++---- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/include/net/cfg802154.h b/include/net/cfg802154.h index f79ce133e51a7..e604df98e2ee9 100644 --- a/include/net/cfg802154.h +++ b/include/net/cfg802154.h @@ -433,15 +433,16 @@ struct ieee802154_llsec_device_key { u32 frame_counter; }; -struct wpan_dev_header_ops { +struct wpan_dev_ops { /* TODO create callback currently assumes ieee802154_mac_cb inside * skb->cb. This should be changed to give these information as * parameter. */ - int (*create)(struct sk_buff *skb, struct net_device *dev, + int (*header_create)(struct sk_buff *skb, struct net_device *dev, const struct ieee802154_addr *daddr, const struct ieee802154_addr *saddr, unsigned int len); + int (*ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd); }; struct wpan_dev { @@ -452,7 +453,7 @@ struct wpan_dev { struct list_head list; struct net_device *netdev; - const struct wpan_dev_header_ops *header_ops; + const struct wpan_dev_ops *ops; /* lowpan interface, set when the wpan_dev belongs to one lowpan_dev */ struct net_device *lowpan_dev; @@ -491,7 +492,7 @@ wpan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, { struct wpan_dev *wpan_dev = dev->ieee802154_ptr; - return wpan_dev->header_ops->create(skb, dev, daddr, saddr, len); + return wpan_dev->ops->header_create(skb, dev, daddr, saddr, len); } #endif diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c index 00302e8b9615b..27e58237091ca 100644 --- a/net/ieee802154/socket.c +++ b/net/ieee802154/socket.c @@ -139,8 +139,9 @@ static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg, if (!dev) return -ENODEV; - if (dev->type == ARPHRD_IEEE802154 && dev->netdev_ops->ndo_do_ioctl) - ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, cmd); + if (dev->type == ARPHRD_IEEE802154 && dev->ieee802154_ptr && + dev->ieee802154_ptr->ops) + ret = dev->ieee802154_ptr->ops->ioctl(dev, &ifr, cmd); if (!ret && put_user_ifreq(&ifr, arg)) ret = -EFAULT; diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c index c0e2da5072bea..4937f8c2fb4cc 100644 --- a/net/mac802154/iface.c +++ b/net/mac802154/iface.c @@ -406,8 +406,9 @@ static int ieee802154_header_create(struct sk_buff *skb, return hlen; } -static const struct wpan_dev_header_ops ieee802154_header_ops = { - .create = ieee802154_header_create, +static const struct wpan_dev_ops ieee802154_ops = { + .header_create = ieee802154_header_create, + .ioctl = mac802154_wpan_ioctl, }; /* This header create functionality assumes a 8 byte array for @@ -495,7 +496,6 @@ static const struct net_device_ops mac802154_wpan_ops = { .ndo_open = mac802154_wpan_open, .ndo_stop = mac802154_slave_close, .ndo_start_xmit = ieee802154_subif_start_xmit, - .ndo_do_ioctl = mac802154_wpan_ioctl, .ndo_set_mac_address = mac802154_wpan_mac_addr, }; @@ -581,7 +581,7 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata, sdata->dev->netdev_ops = &mac802154_wpan_ops; sdata->dev->ml_priv = &mac802154_mlme_wpan; sdata->iface_default_filtering = IEEE802154_FILTERING_4_FRAME_FIELDS; - wpan_dev->header_ops = &ieee802154_header_ops; + wpan_dev->ops = &ieee802154_ops; mutex_init(&sdata->sec_mtx); -- 2.39.2