From patchwork Wed Oct 11 14:02:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13417462 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DA95CD6E72 for ; Wed, 11 Oct 2023 14:02:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234875AbjJKOCy (ORCPT ); Wed, 11 Oct 2023 10:02:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232202AbjJKOCx (ORCPT ); Wed, 11 Oct 2023 10:02:53 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2BB790; Wed, 11 Oct 2023 07:02:51 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6597EC433C8; Wed, 11 Oct 2023 14:02:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697032971; bh=8y++Dow0qT4H4v31iD3eDd6yuRGhJL1WFuL2+EdHCQw=; h=From:To:Cc:Subject:Date:From; b=nLhar/mHt1fULKI5WRRcM8uDjCXe+qNEBA0GkquKiSy5+2CP4KuA5j9cG01oO9zrL h5+q0O94MLa44OMcxLO+B0q0YkLkMeUrpO6U3c2H+4nTCLSL5nYT6gy7Rff4ZU5rt2 8nQgecvjSMJR7MncavIMjp3WSIxvCxhrn8DUmkeAfuNTtD31OIyOGRiJc+MrDt32qQ O3vnj2591HgL2Zq0GQc3nZDuEX4DXao0Qig6SX7f3sDHWDnbHq0fkQZ6nKKD+LXOGT 4rgRzCRTHk38gdQkxd3+zHSiZrgLzK7UlB6PrX3sN6f1VxCaJSDgod9cyfxRJuv0/O 6K4wutNYJAsDA== 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" , Rodolfo Zitellini , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v2 01/10] appletalk: make localtalk and ppp support conditional Date: Wed, 11 Oct 2023 16:02:16 +0200 Message-Id: <20231011140225.253106-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org From: Arnd Bergmann The last localtalk driver is gone now, and ppp support was never fully merged, but the code to support them for phase1 networking still calls the deprecated .ndo_do_ioctl() helper. In order to better isolate the localtalk and ppp portions of appletalk, guard all of the corresponding code with CONFIG_DEV_APPLETALK checks, including a preprocessor conditional that guards the internal ioctl calls. This is currently all dead code and will now be left out of the module since this Kconfig symbol is always undefined, but there are plans to add a new driver for localtalk again in the future. When that happens, the logic can be cleaned up to work properly without the need for the ioctl. Link: https://lore.kernel.org/lkml/790BA488-B6F6-41ED-96EF-2089EF1C043B@xhero.org/ Signed-off-by: Arnd Bergmann --- v2: only add compile-time consitionals rather than removing localtalk support entirely --- include/linux/atalk.h | 1 - net/appletalk/Makefile | 3 ++- net/appletalk/aarp.c | 24 +++++++++++++++--------- net/appletalk/ddp.c | 24 +++++++++++++----------- 4 files changed, 30 insertions(+), 22 deletions(-) diff --git a/include/linux/atalk.h b/include/linux/atalk.h index a55bfc6567d01..2896f2ac9568e 100644 --- a/include/linux/atalk.h +++ b/include/linux/atalk.h @@ -121,7 +121,6 @@ static inline struct atalk_iface *atalk_find_dev(struct net_device *dev) #endif extern struct atalk_addr *atalk_find_dev_addr(struct net_device *dev); -extern struct net_device *atrtr_get_dev(struct atalk_addr *sa); extern int aarp_send_ddp(struct net_device *dev, struct sk_buff *skb, struct atalk_addr *sa, void *hwaddr); diff --git a/net/appletalk/Makefile b/net/appletalk/Makefile index 33164d972d379..410d52f9113e2 100644 --- a/net/appletalk/Makefile +++ b/net/appletalk/Makefile @@ -5,6 +5,7 @@ obj-$(CONFIG_ATALK) += appletalk.o -appletalk-y := aarp.o ddp.o dev.o +appletalk-y := aarp.o ddp.o appletalk-$(CONFIG_PROC_FS) += atalk_proc.o appletalk-$(CONFIG_SYSCTL) += sysctl_net_atalk.o +appletalk-$(CONFIG_DEV_APPLETALK) += dev.o diff --git a/net/appletalk/aarp.c b/net/appletalk/aarp.c index 9fa0b246902be..b15f67293ac4c 100644 --- a/net/appletalk/aarp.c +++ b/net/appletalk/aarp.c @@ -438,14 +438,17 @@ static struct atalk_addr *__aarp_proxy_find(struct net_device *dev, */ static void aarp_send_probe_phase1(struct atalk_iface *iface) { +#if IS_ENABLED(CONFIG_DEV_APPLETALK) struct ifreq atreq; struct sockaddr_at *sa = (struct sockaddr_at *)&atreq.ifr_addr; const struct net_device_ops *ops = iface->dev->netdev_ops; sa->sat_addr.s_node = iface->address.s_node; sa->sat_addr.s_net = ntohs(iface->address.s_net); - - /* We pass the Net:Node to the drivers/cards by a Device ioctl. */ + /* + * We used to pass the address via device ioctl, this has to + * be rewritten if we bring back localtalk. + */ if (!(ops->ndo_do_ioctl(iface->dev, &atreq, SIOCSIFADDR))) { ops->ndo_do_ioctl(iface->dev, &atreq, SIOCGIFADDR); if (iface->address.s_net != htons(sa->sat_addr.s_net) || @@ -455,13 +458,15 @@ static void aarp_send_probe_phase1(struct atalk_iface *iface) iface->address.s_net = htons(sa->sat_addr.s_net); iface->address.s_node = sa->sat_addr.s_node; } +#endif } void aarp_probe_network(struct atalk_iface *atif) { - if (atif->dev->type == ARPHRD_LOCALTLK || - atif->dev->type == ARPHRD_PPP) + if (IS_ENABLED(CONFIG_DEV_APPLETALK) && + (atif->dev->type == ARPHRD_LOCALTLK || + atif->dev->type == ARPHRD_PPP)) aarp_send_probe_phase1(atif); else { unsigned int count; @@ -488,8 +493,9 @@ int aarp_proxy_probe_network(struct atalk_iface *atif, struct atalk_addr *sa) * we don't currently support LocalTalk or PPP for proxy AARP; * if someone wants to try and add it, have fun */ - if (atif->dev->type == ARPHRD_LOCALTLK || - atif->dev->type == ARPHRD_PPP) + if (IS_ENABLED(CONFIG_DEV_APPLETALK) && + (atif->dev->type == ARPHRD_LOCALTLK || + atif->dev->type == ARPHRD_PPP)) goto out; /* @@ -550,7 +556,8 @@ int aarp_send_ddp(struct net_device *dev, struct sk_buff *skb, skb_reset_network_header(skb); /* Check for LocalTalk first */ - if (dev->type == ARPHRD_LOCALTLK) { + if (IS_ENABLED(CONFIG_DEV_APPLETALK) && + dev->type == ARPHRD_LOCALTLK) { struct atalk_addr *at = atalk_find_dev_addr(dev); struct ddpehdr *ddp = (struct ddpehdr *)skb->data; int ft = 2; @@ -588,7 +595,7 @@ int aarp_send_ddp(struct net_device *dev, struct sk_buff *skb, } /* On a PPP link we neither compress nor aarp. */ - if (dev->type == ARPHRD_PPP) { + if (IS_ENABLED(CONFIG_DEV_APPLETALK) && dev->type == ARPHRD_PPP) { skb->protocol = htons(ETH_P_PPPTALK); skb->dev = dev; goto sendit; @@ -674,7 +681,6 @@ int aarp_send_ddp(struct net_device *dev, struct sk_buff *skb, drop: return NET_XMIT_DROP; } -EXPORT_SYMBOL(aarp_send_ddp); /* * An entry in the aarp unresolved queue has become resolved. Send diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index 8978fb6212ffb..d4dc6a9fd3b6b 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c @@ -473,7 +473,7 @@ static struct atalk_route *atrtr_find(struct atalk_addr *target) * Given an AppleTalk network, find the device to use. This can be * a simple lookup. */ -struct net_device *atrtr_get_dev(struct atalk_addr *sa) +static struct net_device *atrtr_get_dev(struct atalk_addr *sa) { struct atalk_route *atr = atrtr_find(sa); return atr ? atr->dev : NULL; @@ -1947,10 +1947,6 @@ static struct packet_type ppptalk_packet_type __read_mostly = { static unsigned char ddp_snap_id[] = { 0x08, 0x00, 0x07, 0x80, 0x9B }; -/* Export symbols for use by drivers when AppleTalk is a module */ -EXPORT_SYMBOL(atrtr_get_dev); -EXPORT_SYMBOL(atalk_find_dev_addr); - /* Called by proto.c on kernel start up */ static int __init atalk_init(void) { @@ -1971,8 +1967,10 @@ static int __init atalk_init(void) goto out_sock; } - dev_add_pack(<alk_packet_type); - dev_add_pack(&ppptalk_packet_type); + if (IS_ENABLED(CONFIG_DEV_APPLETALK)) { + dev_add_pack(<alk_packet_type); + dev_add_pack(&ppptalk_packet_type); + } rc = register_netdevice_notifier(&ddp_notifier); if (rc) @@ -1998,8 +1996,10 @@ static int __init atalk_init(void) out_dev: unregister_netdevice_notifier(&ddp_notifier); out_snap: - dev_remove_pack(&ppptalk_packet_type); - dev_remove_pack(<alk_packet_type); + if (IS_ENABLED(CONFIG_DEV_APPLETALK)) { + dev_remove_pack(&ppptalk_packet_type); + dev_remove_pack(<alk_packet_type); + } unregister_snap_client(ddp_dl); out_sock: sock_unregister(PF_APPLETALK); @@ -2026,8 +2026,10 @@ static void __exit atalk_exit(void) atalk_proc_exit(); aarp_cleanup_module(); /* General aarp clean-up. */ unregister_netdevice_notifier(&ddp_notifier); - dev_remove_pack(<alk_packet_type); - dev_remove_pack(&ppptalk_packet_type); + if (IS_ENABLED(CONFIG_DEV_APPLETALK)) { + dev_remove_pack(<alk_packet_type); + dev_remove_pack(&ppptalk_packet_type); + } unregister_snap_client(ddp_dl); sock_unregister(PF_APPLETALK); proto_unregister(&ddp_proto); From patchwork Wed Oct 11 14:02:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13417463 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C30ADCD6E72 for ; Wed, 11 Oct 2023 14:03:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235028AbjJKODA (ORCPT ); Wed, 11 Oct 2023 10:03:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232202AbjJKOC6 (ORCPT ); Wed, 11 Oct 2023 10:02:58 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E7D694; Wed, 11 Oct 2023 07:02:55 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA9E7C433C7; Wed, 11 Oct 2023 14:02:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697032974; bh=6P2D1vI9Dnx/ifqCfwETYJ6jqhZEF5cp8roWi8kBEW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U2s0677xncAvMOlfWNE3QyI4+yNHk6Y5IPKJc5pqm6RWeczS1+OvT9Hb1nMFm6lmE lDcFZrPBKY15gv1pVhSgeGAyXSR2MAUNeycjI5SFCL9tCWq7L2NVWG/FEM6FGi3yfd gxAwoZV0f4se1zHrcxxCx7KEmbnlqaTbvLJXhhCLbFHqqwhwXX88+aVXtWmfhjulGG 7eLHUwSZCdOFtkGd2XQ/YbACzZAsH6CQFSaOREw/ESx7FcylrfZUVus43TBwOzzvlT nmrWXkCPMCKXpCFQR3OKWui9YtCoPZMTkOOV+D4L43gknaAB7wMAff/grwI/aMhKeM g7J5ZuA4y0OGQ== 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" , Rodolfo Zitellini , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v2 02/10] ieee802154: avoid deprecated .ndo_do_ioctl callback Date: Wed, 11 Oct 2023 16:02:17 +0200 Message-Id: <20231011140225.253106-2-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231011140225.253106-1-arnd@kernel.org> References: <20231011140225.253106-1-arnd@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org 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); From patchwork Wed Oct 11 14:02:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13417464 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 243CFCD6E73 for ; Wed, 11 Oct 2023 14:03:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346890AbjJKODB (ORCPT ); Wed, 11 Oct 2023 10:03:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235010AbjJKOC7 (ORCPT ); Wed, 11 Oct 2023 10:02:59 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B882FB8; Wed, 11 Oct 2023 07:02:58 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57007C433CD; Wed, 11 Oct 2023 14:02:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697032978; bh=5o5h5CgRG4H4Z5qjk2eknSticE7hPec++pW0EBNapec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OWVOdK03/KwWJmBcC+LI8aDOa3bDpFqUIrBwFqpe3tZwQOVJvD85Tb918ZCwLvjcA p/PH9RLQoG3abHY/EYhuW9aidUAbgTHvt6tog9Uy4YkANKUd5IPWNe1UR8qUurGJqh HsDWm/uH4U3VLAlOQBnhd5o3rrbPx5xi6r14OdqH0wGjXlcmiIHMNWZg1oBLCPk2/E GQZFYEobq+8Wg/9NDW0IQShbNuJGpaNJEc165SF06oH1XzBMmxoWKeQzrJnTHN2Wn4 yRKDcjwL1+lJkuL7r8x3q4mg4FnQRjKCK+GdP/uAvpflLOFGQG7DLaBmusEtZbGWLb w6MmltWuXESBQ== 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" , Rodolfo Zitellini , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v2 03/10] ethernet: sp7021: fix ioctl callback pointer Date: Wed, 11 Oct 2023 16:02:18 +0200 Message-Id: <20231011140225.253106-3-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231011140225.253106-1-arnd@kernel.org> References: <20231011140225.253106-1-arnd@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org From: Arnd Bergmann The old .ndo_do_ioctl() callback is never called any more, instead the driver should set .ndo_eth_ioctl() for the phy operations. Fixes: fd3040b9394c5 ("net: ethernet: Add driver for Sunplus SP7021") Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/sunplus/spl2sw_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/sunplus/spl2sw_driver.c b/drivers/net/ethernet/sunplus/spl2sw_driver.c index 391a1bc7f4463..bb4514f4e8157 100644 --- a/drivers/net/ethernet/sunplus/spl2sw_driver.c +++ b/drivers/net/ethernet/sunplus/spl2sw_driver.c @@ -199,7 +199,7 @@ static const struct net_device_ops netdev_ops = { .ndo_start_xmit = spl2sw_ethernet_start_xmit, .ndo_set_rx_mode = spl2sw_ethernet_set_rx_mode, .ndo_set_mac_address = spl2sw_ethernet_set_mac_address, - .ndo_do_ioctl = phy_do_ioctl, + .ndo_eth_ioctl = phy_do_ioctl, .ndo_tx_timeout = spl2sw_ethernet_tx_timeout, }; From patchwork Wed Oct 11 14:02:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13417465 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46C27CD6E6E for ; Wed, 11 Oct 2023 14:03:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346979AbjJKODL (ORCPT ); Wed, 11 Oct 2023 10:03:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346849AbjJKODJ (ORCPT ); Wed, 11 Oct 2023 10:03:09 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B867D8; Wed, 11 Oct 2023 07:03:02 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D42B9C433C8; Wed, 11 Oct 2023 14:02:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697032981; bh=v2U61JipGRAw5yHfVClf2xeZ1vepHEnTwO9csgoF7y8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ioYLjO1HqpBapuo1S1iyxyyf0UcnmM6CGIlqx/8vb42Do3W/g40+2Uz6P9jaONP2W n8LYIQVU185JW1CaKn5XFRz43CM6jAi9odXt1R1fV9Q7sMtyL5g/WfZ8cIkO+MlUT1 2BjnN+t2hWuuQCq+YScg6YL68GQ0CpyOXslq12lyp0MV90gVKkfblNZM5tJl+SvXV1 7/Sx6ECMSLnfm1EnCySyzR6YwocgBIEK7SxlLgctU3m13uAte80LR3/Sxcf2TS6aFi h048r5MOVltjxnCJ7qTRzXwxyUpU0+AXNgXK7PoUyPSm5ppbgc5KMztdeuKfIAk9Y3 Z9G6PQDpzlx+Q== 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" , Rodolfo Zitellini , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v2 04/10] staging: ks7010: remove unused ioctl handler Date: Wed, 11 Oct 2023 16:02:19 +0200 Message-Id: <20231011140225.253106-4-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231011140225.253106-1-arnd@kernel.org> References: <20231011140225.253106-1-arnd@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org From: Arnd Bergmann The ndo_do_ioctl function has no actual callers, and doesn't do much here, so just remove it entirely as preparation for removing the callback pointer from net_device_ops. Reviewed-by: Greg Kroah-Hartman Signed-off-by: Arnd Bergmann --- drivers/staging/ks7010/ks_wlan_net.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c index 0fb97a79ad0b3..ab7463bb25169 100644 --- a/drivers/staging/ks7010/ks_wlan_net.c +++ b/drivers/staging/ks7010/ks_wlan_net.c @@ -51,8 +51,6 @@ static int ks_wlan_close(struct net_device *dev); static void ks_wlan_set_rx_mode(struct net_device *dev); static struct net_device_stats *ks_wlan_get_stats(struct net_device *dev); static int ks_wlan_set_mac_address(struct net_device *dev, void *addr); -static int ks_wlan_netdev_ioctl(struct net_device *dev, struct ifreq *rq, - int cmd); static atomic_t update_phyinfo; static struct timer_list update_phyinfo_timer; @@ -2458,24 +2456,6 @@ static const struct iw_handler_def ks_wlan_handler_def = { .get_wireless_stats = ks_get_wireless_stats, }; -static int ks_wlan_netdev_ioctl(struct net_device *dev, struct ifreq *rq, - int cmd) -{ - int ret; - struct iwreq *wrq = (struct iwreq *)rq; - - switch (cmd) { - case SIOCIWFIRSTPRIV + 20: /* KS_WLAN_SET_STOP_REQ */ - ret = ks_wlan_set_stop_request(dev, NULL, &wrq->u, NULL); - break; - // All other calls are currently unsupported - default: - ret = -EOPNOTSUPP; - } - - return ret; -} - static struct net_device_stats *ks_wlan_get_stats(struct net_device *dev) { @@ -2608,7 +2588,6 @@ static const struct net_device_ops ks_wlan_netdev_ops = { .ndo_start_xmit = ks_wlan_start_xmit, .ndo_open = ks_wlan_open, .ndo_stop = ks_wlan_close, - .ndo_do_ioctl = ks_wlan_netdev_ioctl, .ndo_set_mac_address = ks_wlan_set_mac_address, .ndo_get_stats = ks_wlan_get_stats, .ndo_tx_timeout = ks_wlan_tx_timeout, From patchwork Wed Oct 11 14:02:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13417466 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8291DCD6E6E for ; Wed, 11 Oct 2023 14:03:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346990AbjJKODT (ORCPT ); Wed, 11 Oct 2023 10:03:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347015AbjJKODL (ORCPT ); Wed, 11 Oct 2023 10:03:11 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19C43E8; Wed, 11 Oct 2023 07:03:06 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6931FC433C7; Wed, 11 Oct 2023 14:03:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697032985; bh=pBsdQK7MCTzPLcjzg3nWmnN/eYz9+yxpVt8ibNe/wD0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GY4SrYYm1sULach12gP79RuJzBdrGKH9urxWH57KQossftjhcRMSTbN8aWZLOJDAn oqxDZ4kf2QEJQ7HqeS76VGZoWpZAMmXbpC1tO+jS6KF55JFX+Fre+cI6xZfRUy7hHs /DanVd8oBgPOOPiqyrSdwaVcfqnd3XP5IqzvOdOuMvbfSa+QnGNYynYBJWoUFJUG0B Ld8YEx8J1Z5vl04grO2Gg5uQ8v4UFNKT/nuuaVciDJWABYjIa2fXEFY5nixlHRHmBj Uhx4//0V2RoZ67CS/P1Uo4JhJAiSWXfp5Kdj7rxpOmo4Ijk1sDssGZHT/JBU91F2N2 qH7bcC+5C6vTw== 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" , Rodolfo Zitellini , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v2 05/10] staging: rtl8192: remove unused legacy ioctl handlers Date: Wed, 11 Oct 2023 16:02:20 +0200 Message-Id: <20231011140225.253106-5-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231011140225.253106-1-arnd@kernel.org> References: <20231011140225.253106-1-arnd@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org From: Arnd Bergmann The .ndo_do_ioctl functions are never called, and can just be removed, especially since this is a staging driver. Reviewed-by: Greg Kroah-Hartman Signed-off-by: Arnd Bergmann --- drivers/staging/rtl8192u/ieee80211/dot11d.c | 41 -- drivers/staging/rtl8192u/ieee80211/dot11d.h | 2 - .../staging/rtl8192u/ieee80211/ieee80211.h | 12 - .../rtl8192u/ieee80211/ieee80211_softmac.c | 563 ------------------ drivers/staging/rtl8192u/r8192U.h | 2 - drivers/staging/rtl8192u/r8192U_core.c | 109 ---- 6 files changed, 729 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/dot11d.c b/drivers/staging/rtl8192u/ieee80211/dot11d.c index ddaf66fa0f936..8a72c1e9eb1e1 100644 --- a/drivers/staging/rtl8192u/ieee80211/dot11d.c +++ b/drivers/staging/rtl8192u/ieee80211/dot11d.c @@ -97,22 +97,6 @@ void dot11d_update_country_ie(struct ieee80211_device *dev, u8 *pTaddr, } EXPORT_SYMBOL(dot11d_update_country_ie); -u8 dot11d_get_max_tx_pwr_in_dbm(struct ieee80211_device *dev, u8 Channel) -{ - struct rt_dot11d_info *dot11d_info = GET_DOT11D_INFO(dev); - u8 MaxTxPwrInDbm = 255; - - if (Channel > MAX_CHANNEL_NUMBER) { - netdev_err(dev->dev, "%s: Invalid Channel\n", __func__); - return MaxTxPwrInDbm; - } - if (dot11d_info->channel_map[Channel]) - MaxTxPwrInDbm = dot11d_info->max_tx_pwr_dbm_list[Channel]; - - return MaxTxPwrInDbm; -} -EXPORT_SYMBOL(dot11d_get_max_tx_pwr_in_dbm); - void dot11d_scan_complete(struct ieee80211_device *dev) { struct rt_dot11d_info *dot11d_info = GET_DOT11D_INFO(dev); @@ -147,28 +131,3 @@ int is_legal_channel(struct ieee80211_device *dev, u8 channel) return 0; } EXPORT_SYMBOL(is_legal_channel); - -int to_legal_channel(struct ieee80211_device *dev, u8 channel) -{ - struct rt_dot11d_info *dot11d_info = GET_DOT11D_INFO(dev); - u8 default_chn = 0; - u32 i = 0; - - for (i = 1; i <= MAX_CHANNEL_NUMBER; i++) { - if (dot11d_info->channel_map[i] > 0) { - default_chn = i; - break; - } - } - - if (channel > MAX_CHANNEL_NUMBER) { - netdev_err(dev->dev, "%s: Invalid Channel\n", __func__); - return default_chn; - } - - if (dot11d_info->channel_map[channel] > 0) - return channel; - - return default_chn; -} -EXPORT_SYMBOL(to_legal_channel); diff --git a/drivers/staging/rtl8192u/ieee80211/dot11d.h b/drivers/staging/rtl8192u/ieee80211/dot11d.h index 8b485fa180898..fd774265211a5 100644 --- a/drivers/staging/rtl8192u/ieee80211/dot11d.h +++ b/drivers/staging/rtl8192u/ieee80211/dot11d.h @@ -49,9 +49,7 @@ void dot11d_update_country_ie(struct ieee80211_device *dev, u8 *addr, u16 coutry_ie_len, u8 *coutry_ie); -u8 dot11d_get_max_tx_pwr_in_dbm(struct ieee80211_device *dev, u8 channel); void dot11d_scan_complete(struct ieee80211_device *dev); int is_legal_channel(struct ieee80211_device *dev, u8 channel); -int to_legal_channel(struct ieee80211_device *dev, u8 channel); #endif /* #ifndef __INC_DOT11D_H */ diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h index 694d1b18f81c7..fc4201757c408 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h @@ -223,11 +223,7 @@ struct cb_desc { #define MAX_IE_LEN 0xff // added for kernel conflict -#define ieee80211_wake_queue ieee80211_wake_queue_rsl -#define ieee80211_stop_queue ieee80211_stop_queue_rsl #define notify_wx_assoc_event notify_wx_assoc_event_rsl -#define SendDisassociation SendDisassociation_rsl - struct ieee_param { u32 cmd; @@ -2152,7 +2148,6 @@ int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len); /* ieee80211_softmac.c */ short ieee80211_is_54g(const struct ieee80211_network *net); -short ieee80211_is_shortslot(const struct ieee80211_network *net); int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, struct ieee80211_rx_stats *rx_stats, @@ -2160,7 +2155,6 @@ int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net); -void SendDisassociation(struct ieee80211_device *ieee, u8 *asSta, u8 asRsn); void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee); @@ -2182,13 +2176,7 @@ void ieee80211_stop_protocol(struct ieee80211_device *ieee); void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee); void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee); void ieee80211_reset_queue(struct ieee80211_device *ieee); -void ieee80211_wake_queue(struct ieee80211_device *ieee); -void ieee80211_stop_queue(struct ieee80211_device *ieee); -struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee); void ieee80211_start_send_beacons(struct ieee80211_device *ieee); -int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, - struct iw_point *p); -void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success); void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 92001cb36730b..8cb2f48dbefec 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -27,12 +27,6 @@ short ieee80211_is_54g(const struct ieee80211_network *net) } EXPORT_SYMBOL(ieee80211_is_54g); -short ieee80211_is_shortslot(const struct ieee80211_network *net) -{ - return net->capability & WLAN_CAPABILITY_SHORT_SLOT; -} -EXPORT_SYMBOL(ieee80211_is_shortslot); - /* returns the total length needed for placing the RATE MFIE * tag and the EXTENDED RATE MFIE tag if needed. * It includes two bytes per tag for the tag itself and its len @@ -154,21 +148,6 @@ static void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb) //return 0; } -static struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee) -{ - struct sk_buff *ret; - - if (ieee->mgmt_queue_tail == ieee->mgmt_queue_head) - return NULL; - - ret = ieee->mgmt_queue_ring[ieee->mgmt_queue_tail]; - - ieee->mgmt_queue_tail = - (ieee->mgmt_queue_tail + 1) % MGMT_QUEUE_NUM; - - return ret; -} - static void init_mgmt_queue(struct ieee80211_device *ieee) { ieee->mgmt_queue_tail = ieee->mgmt_queue_head = 0; @@ -1772,33 +1751,6 @@ void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl) } } -void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success) -{ - unsigned long flags, flags2; - - spin_lock_irqsave(&ieee->lock, flags); - - if (ieee->sta_sleep == 2) { - /* Null frame with PS bit set */ - if (success) { - ieee->sta_sleep = 1; - ieee->enter_sleep_state(ieee->dev, ieee->ps_th, ieee->ps_tl); - } - /* if the card report not success we can't be sure the AP - * has not RXed so we can't assume the AP believe us awake - */ - } else { - /* 21112005 - tx again null without PS bit if lost */ - if ((ieee->sta_sleep == 0) && !success) { - spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); - ieee80211_sta_ps_send_null_frame(ieee, 0); - spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); - } - } - spin_unlock_irqrestore(&ieee->lock, flags); -} -EXPORT_SYMBOL(ieee80211_ps_tx_ack); - static void ieee80211_process_action(struct ieee80211_device *ieee, struct sk_buff *skb) { @@ -2068,7 +2020,6 @@ void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device * * to check it any more. * */ //printk("error:no descriptor left@queue_index %d\n", queue_index); - //ieee80211_stop_queue(ieee); #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE skb_queue_tail(&ieee->skb_drv_aggQ[queue_index], txb->fragments[i]); #else @@ -2089,27 +2040,6 @@ void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device * } EXPORT_SYMBOL(ieee80211_softmac_xmit); -/* called with ieee->lock acquired */ -static void ieee80211_resume_tx(struct ieee80211_device *ieee) -{ - int i; - for (i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) { - if (ieee->queue_stop) { - ieee->tx_pending.frag = i; - return; - } else { - ieee->softmac_data_hard_start_xmit(ieee->tx_pending.txb->fragments[i], - ieee->dev, ieee->rate); - //(i+1)tx_pending.txb->nr_frags); - ieee->stats.tx_packets++; - netif_trans_update(ieee->dev); - } - } - - ieee80211_txb_free(ieee->tx_pending.txb); - ieee->tx_pending.txb = NULL; -} - void ieee80211_reset_queue(struct ieee80211_device *ieee) { unsigned long flags; @@ -2125,59 +2055,6 @@ void ieee80211_reset_queue(struct ieee80211_device *ieee) } EXPORT_SYMBOL(ieee80211_reset_queue); -void ieee80211_wake_queue(struct ieee80211_device *ieee) -{ - unsigned long flags; - struct sk_buff *skb; - struct rtl_80211_hdr_3addr *header; - - spin_lock_irqsave(&ieee->lock, flags); - if (!ieee->queue_stop) - goto exit; - - ieee->queue_stop = 0; - - if (ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE) { - while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))) { - header = (struct rtl_80211_hdr_3addr *)skb->data; - - header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4); - - if (ieee->seq_ctrl[0] == 0xFFF) - ieee->seq_ctrl[0] = 0; - else - ieee->seq_ctrl[0]++; - - ieee->softmac_data_hard_start_xmit(skb, ieee->dev, ieee->basic_rate); - //dev_kfree_skb_any(skb);//edit by thomas - } - } - if (!ieee->queue_stop && ieee->tx_pending.txb) - ieee80211_resume_tx(ieee); - - if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)) { - ieee->softmac_stats.swtxawake++; - netif_wake_queue(ieee->dev); - } -exit: - spin_unlock_irqrestore(&ieee->lock, flags); -} -EXPORT_SYMBOL(ieee80211_wake_queue); - -void ieee80211_stop_queue(struct ieee80211_device *ieee) -{ - //unsigned long flags; - //spin_lock_irqsave(&ieee->lock,flags); - - if (!netif_queue_stopped(ieee->dev)) { - netif_stop_queue(ieee->dev); - ieee->softmac_stats.swtxstop++; - } - ieee->queue_stop = 1; - //spin_unlock_irqrestore(&ieee->lock,flags); -} -EXPORT_SYMBOL(ieee80211_stop_queue); - /* called in user context only */ void ieee80211_start_master_bss(struct ieee80211_device *ieee) { @@ -2438,27 +2315,6 @@ struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee) return skb; } -struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee) -{ - struct sk_buff *skb; - struct ieee80211_probe_response *b; - - skb = ieee80211_get_beacon_(ieee); - if (!skb) - return NULL; - - b = (struct ieee80211_probe_response *)skb->data; - b->header.seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4); - - if (ieee->seq_ctrl[0] == 0xFFF) - ieee->seq_ctrl[0] = 0; - else - ieee->seq_ctrl[0]++; - - return skb; -} -EXPORT_SYMBOL(ieee80211_get_beacon); - void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee) { ieee->sync_scan_hurryup = 1; @@ -2623,425 +2479,6 @@ void ieee80211_softmac_free(struct ieee80211_device *ieee) mutex_unlock(&ieee->wx_mutex); } -/******************************************************** - * Start of WPA code. * - * this is stolen from the ipw2200 driver * - ********************************************************/ -static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value) -{ - /* This is called when wpa_supplicant loads and closes the driver - * interface. */ - printk("%s WPA\n", value ? "enabling" : "disabling"); - ieee->wpa_enabled = value; - return 0; -} - -static void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, - char *wpa_ie, int wpa_ie_len) -{ - /* make sure WPA is enabled */ - ieee80211_wpa_enable(ieee, 1); - - ieee80211_disassociate(ieee); -} - -static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason) -{ - int ret = 0; - - switch (command) { - case IEEE_MLME_STA_DEAUTH: - // silently ignore - break; - - case IEEE_MLME_STA_DISASSOC: - ieee80211_disassociate(ieee); - break; - - default: - printk("Unknown MLME request: %d\n", command); - ret = -EOPNOTSUPP; - } - - return ret; -} - -static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee, - struct ieee_param *param, int plen) -{ - u8 *buf; - - if (param->u.wpa_ie.len > MAX_WPA_IE_LEN) - return -EINVAL; - - if (param->u.wpa_ie.len) { - buf = kmemdup(param->u.wpa_ie.data, param->u.wpa_ie.len, - GFP_KERNEL); - if (!buf) - return -ENOMEM; - - kfree(ieee->wpa_ie); - ieee->wpa_ie = buf; - ieee->wpa_ie_len = param->u.wpa_ie.len; - } else { - kfree(ieee->wpa_ie); - ieee->wpa_ie = NULL; - ieee->wpa_ie_len = 0; - } - - ieee80211_wpa_assoc_frame(ieee, ieee->wpa_ie, ieee->wpa_ie_len); - return 0; -} - -#define AUTH_ALG_OPEN_SYSTEM 0x1 -#define AUTH_ALG_SHARED_KEY 0x2 - -static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value) -{ - struct ieee80211_security sec = { - .flags = SEC_AUTH_MODE, - }; - - if (value & AUTH_ALG_SHARED_KEY) { - sec.auth_mode = WLAN_AUTH_SHARED_KEY; - ieee->open_wep = 0; - ieee->auth_mode = 1; - } else if (value & AUTH_ALG_OPEN_SYSTEM) { - sec.auth_mode = WLAN_AUTH_OPEN; - ieee->open_wep = 1; - ieee->auth_mode = 0; - } else if (value & IW_AUTH_ALG_LEAP) { - sec.auth_mode = WLAN_AUTH_LEAP; - ieee->open_wep = 1; - ieee->auth_mode = 2; - } - - if (ieee->set_security) - ieee->set_security(ieee->dev, &sec); - //else - // ret = -EOPNOTSUPP; - - return 0; -} - -static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value) -{ - int ret = 0; - unsigned long flags; - - switch (name) { - case IEEE_PARAM_WPA_ENABLED: - ret = ieee80211_wpa_enable(ieee, value); - break; - - case IEEE_PARAM_TKIP_COUNTERMEASURES: - ieee->tkip_countermeasures = value; - break; - - case IEEE_PARAM_DROP_UNENCRYPTED: { - /* HACK: - * - * wpa_supplicant calls set_wpa_enabled when the driver - * is loaded and unloaded, regardless of if WPA is being - * used. No other calls are made which can be used to - * determine if encryption will be used or not prior to - * association being expected. If encryption is not being - * used, drop_unencrypted is set to false, else true -- we - * can use this to determine if the CAP_PRIVACY_ON bit should - * be set. - */ - struct ieee80211_security sec = { - .flags = SEC_ENABLED, - .enabled = value, - }; - ieee->drop_unencrypted = value; - /* We only change SEC_LEVEL for open mode. Others - * are set by ipw_wpa_set_encryption. - */ - if (!value) { - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_0; - } else { - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_1; - } - if (ieee->set_security) - ieee->set_security(ieee->dev, &sec); - break; - } - - case IEEE_PARAM_PRIVACY_INVOKED: - ieee->privacy_invoked = value; - break; - - case IEEE_PARAM_AUTH_ALGS: - ret = ieee80211_wpa_set_auth_algs(ieee, value); - break; - - case IEEE_PARAM_IEEE_802_1X: - ieee->ieee802_1x = value; - break; - case IEEE_PARAM_WPAX_SELECT: - // added for WPA2 mixed mode - spin_lock_irqsave(&ieee->wpax_suitlist_lock, flags); - ieee->wpax_type_set = 1; - ieee->wpax_type_notify = value; - spin_unlock_irqrestore(&ieee->wpax_suitlist_lock, flags); - break; - - default: - printk("Unknown WPA param: %d\n", name); - ret = -EOPNOTSUPP; - } - - return ret; -} - -/* implementation borrowed from hostap driver */ -static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee, - struct ieee_param *param, int param_len) -{ - int ret = 0; - const char *module = NULL; - - struct ieee80211_crypto_ops *ops = NULL; - struct ieee80211_crypt_data **crypt; - - struct ieee80211_security sec = { - .flags = 0, - }; - - param->u.crypt.err = 0; - param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0'; - - if (param_len != - (int)((char *)param->u.crypt.key - (char *)param) + - param->u.crypt.key_len) { - printk("Len mismatch %d, %d\n", param_len, - param->u.crypt.key_len); - return -EINVAL; - } - if (is_broadcast_ether_addr(param->sta_addr)) { - if (param->u.crypt.idx >= WEP_KEYS) - return -EINVAL; - crypt = &ieee->crypt[param->u.crypt.idx]; - } else { - return -EINVAL; - } - - if (strcmp(param->u.crypt.alg, "none") == 0) { - if (crypt) { - sec.enabled = 0; - // FIXME FIXME - //sec.encrypt = 0; - sec.level = SEC_LEVEL_0; - sec.flags |= SEC_ENABLED | SEC_LEVEL; - ieee80211_crypt_delayed_deinit(ieee, crypt); - } - goto done; - } - sec.enabled = 1; -// FIXME FIXME -// sec.encrypt = 1; - sec.flags |= SEC_ENABLED; - - /* IPW HW cannot build TKIP MIC, host decryption still needed. */ - if (!(ieee->host_encrypt || ieee->host_decrypt) && - strcmp(param->u.crypt.alg, "TKIP")) - goto skip_host_crypt; - - //set WEP40 first, it will be modified according to WEP104 or WEP40 at other place - if (!strcmp(param->u.crypt.alg, "WEP")) - module = "ieee80211_crypt_wep"; - else if (!strcmp(param->u.crypt.alg, "TKIP")) - module = "ieee80211_crypt_tkip"; - else if (!strcmp(param->u.crypt.alg, "CCMP")) - module = "ieee80211_crypt_ccmp"; - if (module) - ops = try_then_request_module(ieee80211_get_crypto_ops(param->u.crypt.alg), - module); - if (!ops) { - printk("unknown crypto alg '%s'\n", param->u.crypt.alg); - param->u.crypt.err = IEEE_CRYPT_ERR_UNKNOWN_ALG; - ret = -EINVAL; - goto done; - } - - if (!*crypt || (*crypt)->ops != ops) { - struct ieee80211_crypt_data *new_crypt; - - ieee80211_crypt_delayed_deinit(ieee, crypt); - - new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL); - if (!new_crypt) { - ret = -ENOMEM; - goto done; - } - new_crypt->ops = ops; - if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) - new_crypt->priv = - new_crypt->ops->init(param->u.crypt.idx); - - if (!new_crypt->priv) { - kfree(new_crypt); - param->u.crypt.err = IEEE_CRYPT_ERR_CRYPT_INIT_FAILED; - ret = -EINVAL; - goto done; - } - - *crypt = new_crypt; - } - - if (param->u.crypt.key_len > 0 && (*crypt)->ops->set_key && - (*crypt)->ops->set_key(param->u.crypt.key, - param->u.crypt.key_len, param->u.crypt.seq, - (*crypt)->priv) < 0) { - printk("key setting failed\n"); - param->u.crypt.err = IEEE_CRYPT_ERR_KEY_SET_FAILED; - ret = -EINVAL; - goto done; - } - - skip_host_crypt: - if (param->u.crypt.set_tx) { - ieee->tx_keyidx = param->u.crypt.idx; - sec.active_key = param->u.crypt.idx; - sec.flags |= SEC_ACTIVE_KEY; - } else { - sec.flags &= ~SEC_ACTIVE_KEY; - } - memcpy(sec.keys[param->u.crypt.idx], - param->u.crypt.key, - param->u.crypt.key_len); - sec.key_sizes[param->u.crypt.idx] = param->u.crypt.key_len; - sec.flags |= (1 << param->u.crypt.idx); - - if (strcmp(param->u.crypt.alg, "WEP") == 0) { - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_1; - } else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_2; - } else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_3; - } - done: - if (ieee->set_security) - ieee->set_security(ieee->dev, &sec); - - /* Do not reset port if card is in Managed mode since resetting will - * generate new IEEE 802.11 authentication which may end up in looping - * with IEEE 802.1X. If your hardware requires a reset after WEP - * configuration (for example... Prism2), implement the reset_port in - * the callbacks structures used to initialize the 802.11 stack. */ - if (ieee->reset_on_keychange && - ieee->iw_mode != IW_MODE_INFRA && - ieee->reset_port && - ieee->reset_port(ieee->dev)) { - printk("reset_port failed\n"); - param->u.crypt.err = IEEE_CRYPT_ERR_CARD_CONF_FAILED; - return -EINVAL; - } - - return ret; -} - -static inline struct sk_buff *ieee80211_disassociate_skb(struct ieee80211_network *beacon, - struct ieee80211_device *ieee, - u8 asRsn) -{ - struct sk_buff *skb; - struct ieee80211_disassoc *disass; - - skb = dev_alloc_skb(sizeof(struct ieee80211_disassoc)); - if (!skb) - return NULL; - - disass = skb_put(skb, sizeof(struct ieee80211_disassoc)); - disass->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_DISASSOC); - disass->header.duration_id = 0; - - memcpy(disass->header.addr1, beacon->bssid, ETH_ALEN); - memcpy(disass->header.addr2, ieee->dev->dev_addr, ETH_ALEN); - memcpy(disass->header.addr3, beacon->bssid, ETH_ALEN); - - disass->reason = cpu_to_le16(asRsn); - return skb; -} - -void -SendDisassociation(struct ieee80211_device *ieee, - u8 *asSta, - u8 asRsn -) -{ - struct ieee80211_network *beacon = &ieee->current_network; - struct sk_buff *skb; - - skb = ieee80211_disassociate_skb(beacon, ieee, asRsn); - if (skb) { - softmac_mgmt_xmit(skb, ieee); - //dev_kfree_skb_any(skb);//edit by thomas - } -} -EXPORT_SYMBOL(SendDisassociation); - -int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p) -{ - struct ieee_param *param; - int ret = 0; - - mutex_lock(&ieee->wx_mutex); - //IEEE_DEBUG_INFO("wpa_supplicant: len=%d\n", p->length); - - if (p->length < sizeof(struct ieee_param) || !p->pointer) { - ret = -EINVAL; - goto out; - } - - param = memdup_user(p->pointer, p->length); - if (IS_ERR(param)) { - ret = PTR_ERR(param); - goto out; - } - - switch (param->cmd) { - case IEEE_CMD_SET_WPA_PARAM: - ret = ieee80211_wpa_set_param(ieee, param->u.wpa_param.name, - param->u.wpa_param.value); - break; - - case IEEE_CMD_SET_WPA_IE: - ret = ieee80211_wpa_set_wpa_ie(ieee, param, p->length); - break; - - case IEEE_CMD_SET_ENCRYPTION: - ret = ieee80211_wpa_set_encryption(ieee, param, p->length); - break; - - case IEEE_CMD_MLME: - ret = ieee80211_wpa_mlme(ieee, param->u.mlme.command, - param->u.mlme.reason_code); - break; - - default: - printk("Unknown WPA supplicant request: %d\n", param->cmd); - ret = -EOPNOTSUPP; - break; - } - - if (ret == 0 && copy_to_user(p->pointer, param, p->length)) - ret = -EFAULT; - - kfree(param); -out: - mutex_unlock(&ieee->wx_mutex); - - return ret; -} -EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl); - void notify_wx_assoc_event(struct ieee80211_device *ieee) { union iwreq_data wrqu; diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h index ff0ada00bf414..ef59c785f950a 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -453,8 +453,6 @@ typedef enum _WIRELESS_MODE { WIRELESS_MODE_N_5G = 0x20 } WIRELESS_MODE; -#define RTL_IOCTL_WPA_SUPPLICANT (SIOCIWFIRSTPRIV + 30) - typedef struct buffer { struct buffer *next; u32 *buf; diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 0a60ef20107c4..295b514043336 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -3284,114 +3284,6 @@ static int r8192_set_mac_adr(struct net_device *dev, void *mac) return 0; } -/* based on ipw2200 driver */ -static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) -{ - struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); - struct iwreq *wrq = (struct iwreq *)rq; - int ret = -1; - struct ieee80211_device *ieee = priv->ieee80211; - u32 key[4]; - u8 broadcast_addr[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - struct iw_point *p = &wrq->u.data; - struct ieee_param *ipw = NULL; - - mutex_lock(&priv->wx_mutex); - - if (p->length < sizeof(struct ieee_param) || !p->pointer) { - ret = -EINVAL; - goto out; - } - - ipw = memdup_user(p->pointer, p->length); - if (IS_ERR(ipw)) { - ret = PTR_ERR(ipw); - goto out; - } - - switch (cmd) { - case RTL_IOCTL_WPA_SUPPLICANT: - /* parse here for HW security */ - if (ipw->cmd == IEEE_CMD_SET_ENCRYPTION) { - if (ipw->u.crypt.set_tx) { - if (strcmp(ipw->u.crypt.alg, "CCMP") == 0) { - ieee->pairwise_key_type = KEY_TYPE_CCMP; - } else if (strcmp(ipw->u.crypt.alg, "TKIP") == 0) { - ieee->pairwise_key_type = KEY_TYPE_TKIP; - } else if (strcmp(ipw->u.crypt.alg, "WEP") == 0) { - if (ipw->u.crypt.key_len == 13) - ieee->pairwise_key_type = KEY_TYPE_WEP104; - else if (ipw->u.crypt.key_len == 5) - ieee->pairwise_key_type = KEY_TYPE_WEP40; - } else { - ieee->pairwise_key_type = KEY_TYPE_NA; - } - - if (ieee->pairwise_key_type) { - memcpy((u8 *)key, ipw->u.crypt.key, 16); - EnableHWSecurityConfig8192(dev); - /* We fill both index entry and 4th - * entry for pairwise key as in IPW - * interface, adhoc will only get here, - * so we need index entry for its - * default key serching! - */ - setKey(dev, 4, ipw->u.crypt.idx, - ieee->pairwise_key_type, - (u8 *)ieee->ap_mac_addr, - 0, key); - if (ieee->auth_mode != 2) - setKey(dev, ipw->u.crypt.idx, - ipw->u.crypt.idx, - ieee->pairwise_key_type, - (u8 *)ieee->ap_mac_addr, - 0, key); - } - } else { - memcpy((u8 *)key, ipw->u.crypt.key, 16); - if (strcmp(ipw->u.crypt.alg, "CCMP") == 0) { - ieee->group_key_type = KEY_TYPE_CCMP; - } else if (strcmp(ipw->u.crypt.alg, "TKIP") == 0) { - ieee->group_key_type = KEY_TYPE_TKIP; - } else if (strcmp(ipw->u.crypt.alg, "WEP") == 0) { - if (ipw->u.crypt.key_len == 13) - ieee->group_key_type = KEY_TYPE_WEP104; - else if (ipw->u.crypt.key_len == 5) - ieee->group_key_type = KEY_TYPE_WEP40; - } else { - ieee->group_key_type = KEY_TYPE_NA; - } - - if (ieee->group_key_type) { - setKey(dev, ipw->u.crypt.idx, - /* KeyIndex */ - ipw->u.crypt.idx, - /* KeyType */ - ieee->group_key_type, - /* MacAddr */ - broadcast_addr, - /* DefaultKey */ - 0, - /* KeyContent */ - key); - } - } - } - ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, - &wrq->u.data); - break; - - default: - ret = -EOPNOTSUPP; - break; - } - kfree(ipw); - ipw = NULL; -out: - mutex_unlock(&priv->wx_mutex); - return ret; -} - static u8 HwRateToMRate90(bool bIsHT, u8 rate) { u8 ret_rate = 0xff; @@ -4496,7 +4388,6 @@ static const struct net_device_ops rtl8192_netdev_ops = { .ndo_stop = rtl8192_close, .ndo_get_stats = rtl8192_stats, .ndo_tx_timeout = tx_timeout, - .ndo_do_ioctl = rtl8192_ioctl, .ndo_set_rx_mode = r8192_set_multicast, .ndo_set_mac_address = r8192_set_mac_adr, .ndo_validate_addr = eth_validate_addr, From patchwork Wed Oct 11 14:02:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13417467 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 798ADCD6E74 for ; Wed, 11 Oct 2023 14:03:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347056AbjJKODV (ORCPT ); Wed, 11 Oct 2023 10:03:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346999AbjJKODR (ORCPT ); Wed, 11 Oct 2023 10:03:17 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B0BAC4; Wed, 11 Oct 2023 07:03:09 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32CB3C433CC; Wed, 11 Oct 2023 14:03:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697032989; bh=k4v64vdXlavEo9kLUWLKxx3pHDNDWQxvczexvxtQbZ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oK3IFg/pFE4zGL1/r/Ct+4u3hGS8StfN/uiWbC/n8TvbMVsHb3gKi7yzdteb91f67 Y8an+OreGiSvHgVCR6ykm3uODlHrl+zH57eCRnNVH2CQxUpRnLDHrjJX5l2p3pwcZ1 OEBucTPuvF9Pghus2KylDa9kV73fRw8MPf1naZO2zJXHC6IqVh5vwkV+kmLHGRZQeX 7hgEq0saCgubgmTWXvUedHbYkjt1In2YhFtgSUY8/iOfHfcaP2KBkU1mSXsrEZpBk/ 0KP9LX610aszxOye0d+NVcSLirMxUDPRPYgSakwWC7hGkR+o+ddsMgjMsBiEyw7r7m RbWV4f5ADf8qA== 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" , Rodolfo Zitellini , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v2 06/10] staging: rtl8712: remove unused legacy ioctl handlers Date: Wed, 11 Oct 2023 16:02:21 +0200 Message-Id: <20231011140225.253106-6-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231011140225.253106-1-arnd@kernel.org> References: <20231011140225.253106-1-arnd@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org From: Arnd Bergmann The .ndo_do_ioctl functions are never called, and can just be removed, especially since this is a staging driver. Reviewed-by: Greg Kroah-Hartman Signed-off-by: Arnd Bergmann --- drivers/staging/rtl8712/os_intfs.c | 1 - drivers/staging/rtl8712/osdep_intf.h | 2 - drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 124 ------------------ 3 files changed, 127 deletions(-) diff --git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c index b18e6d9c832b8..121edffbd2507 100644 --- a/drivers/staging/rtl8712/os_intfs.c +++ b/drivers/staging/rtl8712/os_intfs.c @@ -191,7 +191,6 @@ static const struct net_device_ops rtl8712_netdev_ops = { .ndo_start_xmit = r8712_xmit_entry, .ndo_set_mac_address = r871x_net_set_mac_address, .ndo_get_stats = r871x_net_get_stats, - .ndo_do_ioctl = r871x_ioctl, }; struct net_device *r8712_init_netdev(void) diff --git a/drivers/staging/rtl8712/osdep_intf.h b/drivers/staging/rtl8712/osdep_intf.h index 9e75116c987ec..ce823030bfec2 100644 --- a/drivers/staging/rtl8712/osdep_intf.h +++ b/drivers/staging/rtl8712/osdep_intf.h @@ -27,6 +27,4 @@ struct intf_priv { struct completion io_retevt_comp; }; -int r871x_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); - #endif /*_OSDEP_INTF_H_*/ diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c index 36f6904d25abc..a4a34c9f00b84 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c @@ -36,8 +36,6 @@ #include #include -#define RTL_IOCTL_WPA_SUPPLICANT (SIOCIWFIRSTPRIV + 0x1E) - #define SCAN_ITEM_SIZE 768 #define MAX_CUSTOM_LEN 64 #define RATE_COUNT 4 @@ -2066,128 +2064,6 @@ static int r871x_wps_start(struct net_device *dev, return 0; } -static int wpa_set_param(struct net_device *dev, u8 name, u32 value) -{ - struct _adapter *padapter = netdev_priv(dev); - - switch (name) { - case IEEE_PARAM_WPA_ENABLED: - padapter->securitypriv.AuthAlgrthm = 2; /* 802.1x */ - switch ((value) & 0xff) { - case 1: /* WPA */ - padapter->securitypriv.ndisauthtype = - Ndis802_11AuthModeWPAPSK; /* WPA_PSK */ - padapter->securitypriv.ndisencryptstatus = - Ndis802_11Encryption2Enabled; - break; - case 2: /* WPA2 */ - padapter->securitypriv.ndisauthtype = - Ndis802_11AuthModeWPA2PSK; /* WPA2_PSK */ - padapter->securitypriv.ndisencryptstatus = - Ndis802_11Encryption3Enabled; - break; - } - break; - case IEEE_PARAM_TKIP_COUNTERMEASURES: - break; - case IEEE_PARAM_DROP_UNENCRYPTED: - /* HACK: - * - * wpa_supplicant calls set_wpa_enabled when the driver - * is loaded and unloaded, regardless of if WPA is being - * used. No other calls are made which can be used to - * determine if encryption will be used or not prior to - * association being expected. If encryption is not being - * used, drop_unencrypted is set to false, else true -- we - * can use this to determine if the CAP_PRIVACY_ON bit should - * be set. - */ - break; - case IEEE_PARAM_PRIVACY_INVOKED: - break; - case IEEE_PARAM_AUTH_ALGS: - return wpa_set_auth_algs(dev, value); - case IEEE_PARAM_IEEE_802_1X: - break; - case IEEE_PARAM_WPAX_SELECT: - /* added for WPA2 mixed mode */ - break; - default: - return -EOPNOTSUPP; - } - return 0; -} - -static int wpa_mlme(struct net_device *dev, u32 command, u32 reason) -{ - struct _adapter *padapter = netdev_priv(dev); - - switch (command) { - case IEEE_MLME_STA_DEAUTH: - if (!r8712_set_802_11_disassociate(padapter)) - return -1; - break; - case IEEE_MLME_STA_DISASSOC: - if (!r8712_set_802_11_disassociate(padapter)) - return -1; - break; - default: - return -EOPNOTSUPP; - } - return 0; -} - -static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p) -{ - struct ieee_param *param; - int ret = 0; - struct _adapter *padapter = netdev_priv(dev); - - if (p->length < sizeof(struct ieee_param) || !p->pointer) - return -EINVAL; - param = memdup_user(p->pointer, p->length); - if (IS_ERR(param)) - return PTR_ERR(param); - switch (param->cmd) { - case IEEE_CMD_SET_WPA_PARAM: - ret = wpa_set_param(dev, param->u.wpa_param.name, - param->u.wpa_param.value); - break; - case IEEE_CMD_SET_WPA_IE: - ret = r871x_set_wpa_ie(padapter, (char *)param->u.wpa_ie.data, - (u16)param->u.wpa_ie.len); - break; - case IEEE_CMD_SET_ENCRYPTION: - ret = wpa_set_encryption(dev, param, p->length); - break; - case IEEE_CMD_MLME: - ret = wpa_mlme(dev, param->u.mlme.command, - param->u.mlme.reason_code); - break; - default: - ret = -EOPNOTSUPP; - break; - } - if (ret == 0 && copy_to_user(p->pointer, param, p->length)) - ret = -EFAULT; - kfree(param); - return ret; -} - -/* based on "driver_ipw" and for hostapd */ -int r871x_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) -{ - struct iwreq *wrq = (struct iwreq *)rq; - - switch (cmd) { - case RTL_IOCTL_WPA_SUPPLICANT: - return wpa_supplicant_ioctl(dev, &wrq->u.data); - default: - return -EOPNOTSUPP; - } - return 0; -} - static iw_handler r8711_handlers[] = { NULL, /* SIOCSIWCOMMIT */ r8711_wx_get_name, /* SIOCGIWNAME */ From patchwork Wed Oct 11 14:02:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13417469 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73D31CD6E72 for ; Wed, 11 Oct 2023 14:03:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347006AbjJKODk (ORCPT ); Wed, 11 Oct 2023 10:03:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347015AbjJKODY (ORCPT ); Wed, 11 Oct 2023 10:03:24 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E739511F; Wed, 11 Oct 2023 07:03:13 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDFBFC433C9; Wed, 11 Oct 2023 14:03:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697032993; bh=ON8dPgWmpLJcEkGa2FCOodOZDrc6vAXIg/afyMW90iQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ewu09q56GxiNFuTIsjUX+r5oUHTNatVfqq1mhuaJwfWPnxEcrjtHetqpBiPOlGws7 bUh6L3lD7QEquXk49vXM/2ROBwda11n9OSqPi24Xctz1i0BzW/5f3EB0KjItDaz8TI fmhMm90M4YbHrCbmrWlmOya16zMWCFCJNLwALmKgkqqccRGc21JYzTcRyfpKSE2f/q mx45f1DPAlFS6nNz514O5DrW1/lQwBDooTB6xDiralaKLmENhagXliJmiPbNevtG1b DskiST9p7JD00Lwg0EaXZrocy8HgHBZC1OZgDPL9i1LsRTWxxpsuJzNRgJQBePEdC7 IeHntmVJrNRBA== 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" , Rodolfo Zitellini , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v2 07/10] staging: rtl8723bs: remove dead code Date: Wed, 11 Oct 2023 16:02:22 +0200 Message-Id: <20231011140225.253106-7-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231011140225.253106-1-arnd@kernel.org> References: <20231011140225.253106-1-arnd@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org From: Arnd Bergmann The .ndo_do_ioctl functions are never called, so the three implementation here is useless but only works as a way to identify the device in the notifiers, which can really be removed as well. Looking through the exported functions, I found a bunch more that have no callers, so just drop all of those. Reviewed-by: Greg Kroah-Hartman Signed-off-by: Arnd Bergmann --- drivers/staging/rtl8723bs/Makefile | 1 - .../staging/rtl8723bs/include/osdep_intf.h | 32 - drivers/staging/rtl8723bs/include/rtw_io.h | 1 - .../staging/rtl8723bs/os_dep/ioctl_linux.c | 1300 ----------------- drivers/staging/rtl8723bs/os_dep/os_intfs.c | 29 - drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 23 +- 6 files changed, 1 insertion(+), 1385 deletions(-) delete mode 100644 drivers/staging/rtl8723bs/os_dep/ioctl_linux.c diff --git a/drivers/staging/rtl8723bs/Makefile b/drivers/staging/rtl8723bs/Makefile index 590bde02058c7..0f3f6dea4955e 100644 --- a/drivers/staging/rtl8723bs/Makefile +++ b/drivers/staging/rtl8723bs/Makefile @@ -50,7 +50,6 @@ r8723bs-y = \ hal/HalHWImg8723B_RF.o \ hal/HalPhyRf_8723B.o \ os_dep/ioctl_cfg80211.o \ - os_dep/ioctl_linux.o \ os_dep/mlme_linux.o \ os_dep/osdep_service.o \ os_dep/os_intfs.o \ diff --git a/drivers/staging/rtl8723bs/include/osdep_intf.h b/drivers/staging/rtl8723bs/include/osdep_intf.h index 111e0179712ac..83a25598e9627 100644 --- a/drivers/staging/rtl8723bs/include/osdep_intf.h +++ b/drivers/staging/rtl8723bs/include/osdep_intf.h @@ -8,33 +8,6 @@ #ifndef __OSDEP_INTF_H_ #define __OSDEP_INTF_H_ - -struct intf_priv { - - u8 *intf_dev; - u32 max_iosz; /* USB2.0: 128, USB1.1: 64, SDIO:64 */ - u32 max_xmitsz; /* USB2.0: unlimited, SDIO:512 */ - u32 max_recvsz; /* USB2.0: unlimited, SDIO:512 */ - - volatile u8 *io_rwmem; - volatile u8 *allocated_io_rwmem; - u32 io_wsz; /* unit: 4bytes */ - u32 io_rsz;/* unit: 4bytes */ - u8 intf_status; - - void (*_bus_io)(u8 *priv); - -/* -Under Sync. IRP (SDIO/USB) -A protection mechanism is necessary for the io_rwmem(read/write protocol) - -Under Async. IRP (SDIO/USB) -The protection mechanism is through the pending queue. -*/ - - struct mutex ioctl_mutex; -}; - struct dvobj_priv *devobj_init(void); void devobj_deinit(struct dvobj_priv *pdvobj); @@ -47,17 +20,12 @@ u32 rtw_start_drv_threads(struct adapter *padapter); void rtw_stop_drv_threads(struct adapter *padapter); void rtw_cancel_all_timer(struct adapter *padapter); -int rtw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); - int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname); struct net_device *rtw_init_netdev(struct adapter *padapter); void rtw_unregister_netdevs(struct dvobj_priv *dvobj); u16 rtw_recv_select_queue(struct sk_buff *skb); -int rtw_ndev_notifier_register(void); -void rtw_ndev_notifier_unregister(void); - void rtw_ips_dev_unload(struct adapter *padapter); int rtw_ips_pwr_up(struct adapter *padapter); diff --git a/drivers/staging/rtl8723bs/include/rtw_io.h b/drivers/staging/rtl8723bs/include/rtw_io.h index e98083a07a660..f92093e73fe67 100644 --- a/drivers/staging/rtl8723bs/include/rtw_io.h +++ b/drivers/staging/rtl8723bs/include/rtw_io.h @@ -72,7 +72,6 @@ #define _INTF_ASYNC_ BIT(0) /* support async io */ -struct intf_priv; struct intf_hdl; struct io_queue; diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c deleted file mode 100644 index c81b30f1f1b05..0000000000000 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ /dev/null @@ -1,1300 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/****************************************************************************** - * - * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. - * - ******************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include - -#define RTL_IOCTL_WPA_SUPPLICANT (SIOCIWFIRSTPRIV + 30) - -static int wpa_set_auth_algs(struct net_device *dev, u32 value) -{ - struct adapter *padapter = rtw_netdev_priv(dev); - int ret = 0; - - if ((value & IW_AUTH_ALG_SHARED_KEY) && (value & IW_AUTH_ALG_OPEN_SYSTEM)) { - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; - padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeAutoSwitch; - padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Auto; - } else if (value & IW_AUTH_ALG_SHARED_KEY) { - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; - - padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeShared; - padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Shared; - } else if (value & IW_AUTH_ALG_OPEN_SYSTEM) { - /* padapter->securitypriv.ndisencryptstatus = Ndis802_11EncryptionDisabled; */ - if (padapter->securitypriv.ndisauthtype < Ndis802_11AuthModeWPAPSK) { - padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeOpen; - padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Open; - } - } else { - ret = -EINVAL; - } - - return ret; -} - -static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, u32 param_len) -{ - int ret = 0; - u8 max_idx; - u32 wep_key_idx, wep_key_len, wep_total_len; - struct ndis_802_11_wep *pwep = NULL; - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct security_priv *psecuritypriv = &padapter->securitypriv; - - param->u.crypt.err = 0; - param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0'; - - if (param_len < (u32)((u8 *)param->u.crypt.key - (u8 *)param) + param->u.crypt.key_len) { - ret = -EINVAL; - goto exit; - } - - if (param->sta_addr[0] != 0xff || param->sta_addr[1] != 0xff || - param->sta_addr[2] != 0xff || param->sta_addr[3] != 0xff || - param->sta_addr[4] != 0xff || param->sta_addr[5] != 0xff) { - ret = -EINVAL; - goto exit; - } - - if (strcmp(param->u.crypt.alg, "WEP") == 0) - max_idx = WEP_KEYS - 1; - else - max_idx = BIP_MAX_KEYID; - - if (param->u.crypt.idx > max_idx) { - netdev_err(dev, "Error crypt.idx %d > %d\n", param->u.crypt.idx, max_idx); - ret = -EINVAL; - goto exit; - } - - if (strcmp(param->u.crypt.alg, "WEP") == 0) { - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; - padapter->securitypriv.dot11PrivacyAlgrthm = _WEP40_; - padapter->securitypriv.dot118021XGrpPrivacy = _WEP40_; - - wep_key_idx = param->u.crypt.idx; - wep_key_len = param->u.crypt.key_len; - - if (wep_key_len > 0) { - wep_key_len = wep_key_len <= 5 ? 5 : 13; - wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, key_material); - /* Allocate a full structure to avoid potentially running off the end. */ - pwep = kzalloc(sizeof(*pwep), GFP_KERNEL); - if (!pwep) { - ret = -ENOMEM; - goto exit; - } - - pwep->key_length = wep_key_len; - pwep->length = wep_total_len; - - if (wep_key_len == 13) { - padapter->securitypriv.dot11PrivacyAlgrthm = _WEP104_; - padapter->securitypriv.dot118021XGrpPrivacy = _WEP104_; - } - } else { - ret = -EINVAL; - goto exit; - } - - pwep->key_index = wep_key_idx; - pwep->key_index |= 0x80000000; - - memcpy(pwep->key_material, param->u.crypt.key, pwep->key_length); - - if (param->u.crypt.set_tx) { - if (rtw_set_802_11_add_wep(padapter, pwep) == (u8)_FAIL) - ret = -EOPNOTSUPP; - } else { - /* don't update "psecuritypriv->dot11PrivacyAlgrthm" and */ - /* psecuritypriv->dot11PrivacyKeyIndex =keyid", but can rtw_set_key to fw/cam */ - - if (wep_key_idx >= WEP_KEYS) { - ret = -EOPNOTSUPP; - goto exit; - } - - memcpy(&psecuritypriv->dot11DefKey[wep_key_idx].skey[0], pwep->key_material, pwep->key_length); - psecuritypriv->dot11DefKeylen[wep_key_idx] = pwep->key_length; - rtw_set_key(padapter, psecuritypriv, wep_key_idx, 0, true); - } - - goto exit; - } - - if (padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) { /* 802_1x */ - struct sta_info *psta, *pbcmc_sta; - struct sta_priv *pstapriv = &padapter->stapriv; - - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_MP_STATE) == true) { /* sta mode */ - psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv)); - if (!psta) { - /* DEBUG_ERR(("Set wpa_set_encryption: Obtain Sta_info fail\n")); */ - } else { - /* Jeff: don't disable ieee8021x_blocked while clearing key */ - if (strcmp(param->u.crypt.alg, "none") != 0) - psta->ieee8021x_blocked = false; - - if ((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled) || - (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) { - psta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm; - } - - if (param->u.crypt.set_tx == 1) { /* pairwise key */ - memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); - - if (strcmp(param->u.crypt.alg, "TKIP") == 0) { /* set mic key */ - /* DEBUG_ERR(("\nset key length :param->u.crypt.key_len =%d\n", param->u.crypt.key_len)); */ - memcpy(psta->dot11tkiptxmickey.skey, ¶m->u.crypt.key[16], 8); - memcpy(psta->dot11tkiprxmickey.skey, ¶m->u.crypt.key[24], 8); - - padapter->securitypriv.busetkipkey = false; - /* _set_timer(&padapter->securitypriv.tkip_timer, 50); */ - } - - rtw_setstakey_cmd(padapter, psta, true, true); - } else { /* group key */ - if (strcmp(param->u.crypt.alg, "TKIP") == 0 || strcmp(param->u.crypt.alg, "CCMP") == 0) { - memcpy(padapter->securitypriv.dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); - /* only TKIP group key need to install this */ - if (param->u.crypt.key_len > 16) { - memcpy(padapter->securitypriv.dot118021XGrptxmickey[param->u.crypt.idx].skey, ¶m->u.crypt.key[16], 8); - memcpy(padapter->securitypriv.dot118021XGrprxmickey[param->u.crypt.idx].skey, ¶m->u.crypt.key[24], 8); - } - padapter->securitypriv.binstallGrpkey = true; - - padapter->securitypriv.dot118021XGrpKeyid = param->u.crypt.idx; - - rtw_set_key(padapter, &padapter->securitypriv, param->u.crypt.idx, 1, true); - } else if (strcmp(param->u.crypt.alg, "BIP") == 0) { - /* printk("BIP key_len =%d , index =%d @@@@@@@@@@@@@@@@@@\n", param->u.crypt.key_len, param->u.crypt.idx); */ - /* save the IGTK key, length 16 bytes */ - memcpy(padapter->securitypriv.dot11wBIPKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); - /*printk("IGTK key below:\n"); - for (no = 0;no<16;no++) - printk(" %02x ", padapter->securitypriv.dot11wBIPKey[param->u.crypt.idx].skey[no]); - printk("\n");*/ - padapter->securitypriv.dot11wBIPKeyid = param->u.crypt.idx; - padapter->securitypriv.binstallBIPkey = true; - } - } - } - - pbcmc_sta = rtw_get_bcmc_stainfo(padapter); - if (!pbcmc_sta) { - /* DEBUG_ERR(("Set OID_802_11_ADD_KEY: bcmc stainfo is null\n")); */ - } else { - /* Jeff: don't disable ieee8021x_blocked while clearing key */ - if (strcmp(param->u.crypt.alg, "none") != 0) - pbcmc_sta->ieee8021x_blocked = false; - - if ((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled) || - (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) { - pbcmc_sta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm; - } - } - } else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) { - /* adhoc mode */ - } - } - -exit: - - kfree(pwep); - return ret; -} - -static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ielen) -{ - u8 *buf = NULL; - int group_cipher = 0, pairwise_cipher = 0; - int ret = 0; - u8 null_addr[] = {0, 0, 0, 0, 0, 0}; - - if (ielen > MAX_WPA_IE_LEN || !pie) { - _clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS); - if (!pie) - return ret; - else - return -EINVAL; - } - - if (ielen) { - buf = rtw_zmalloc(ielen); - if (!buf) { - ret = -ENOMEM; - goto exit; - } - - memcpy(buf, pie, ielen); - - if (ielen < RSN_HEADER_LEN) { - ret = -1; - goto exit; - } - - if (rtw_parse_wpa_ie(buf, ielen, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) { - padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; - padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeWPAPSK; - memcpy(padapter->securitypriv.supplicant_ie, &buf[0], ielen); - } - - if (rtw_parse_wpa2_ie(buf, ielen, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) { - padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; - padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeWPA2PSK; - memcpy(padapter->securitypriv.supplicant_ie, &buf[0], ielen); - } - - if (group_cipher == 0) - group_cipher = WPA_CIPHER_NONE; - if (pairwise_cipher == 0) - pairwise_cipher = WPA_CIPHER_NONE; - - switch (group_cipher) { - case WPA_CIPHER_NONE: - padapter->securitypriv.dot118021XGrpPrivacy = _NO_PRIVACY_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11EncryptionDisabled; - break; - case WPA_CIPHER_WEP40: - padapter->securitypriv.dot118021XGrpPrivacy = _WEP40_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; - break; - case WPA_CIPHER_TKIP: - padapter->securitypriv.dot118021XGrpPrivacy = _TKIP_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption2Enabled; - break; - case WPA_CIPHER_CCMP: - padapter->securitypriv.dot118021XGrpPrivacy = _AES_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled; - break; - case WPA_CIPHER_WEP104: - padapter->securitypriv.dot118021XGrpPrivacy = _WEP104_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; - break; - } - - switch (pairwise_cipher) { - case WPA_CIPHER_NONE: - padapter->securitypriv.dot11PrivacyAlgrthm = _NO_PRIVACY_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11EncryptionDisabled; - break; - case WPA_CIPHER_WEP40: - padapter->securitypriv.dot11PrivacyAlgrthm = _WEP40_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; - break; - case WPA_CIPHER_TKIP: - padapter->securitypriv.dot11PrivacyAlgrthm = _TKIP_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption2Enabled; - break; - case WPA_CIPHER_CCMP: - padapter->securitypriv.dot11PrivacyAlgrthm = _AES_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled; - break; - case WPA_CIPHER_WEP104: - padapter->securitypriv.dot11PrivacyAlgrthm = _WEP104_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; - break; - } - - _clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS); - {/* set wps_ie */ - u16 cnt = 0; - u8 eid, wps_oui[4] = {0x0, 0x50, 0xf2, 0x04}; - - while (cnt < ielen) { - eid = buf[cnt]; - - if ((eid == WLAN_EID_VENDOR_SPECIFIC) && (!memcmp(&buf[cnt + 2], wps_oui, 4))) { - padapter->securitypriv.wps_ie_len = ((buf[cnt + 1] + 2) < MAX_WPS_IE_LEN) ? (buf[cnt + 1] + 2) : MAX_WPS_IE_LEN; - - memcpy(padapter->securitypriv.wps_ie, &buf[cnt], padapter->securitypriv.wps_ie_len); - - set_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS); - - cnt += buf[cnt + 1] + 2; - - break; - } else { - cnt += buf[cnt + 1] + 2; /* goto next */ - } - } - } - } - - /* TKIP and AES disallow multicast packets until installing group key */ - if (padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_ || - padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_WTMIC_ || - padapter->securitypriv.dot11PrivacyAlgrthm == _AES_) - /* WPS open need to enable multicast */ - /* check_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS) == true) */ - rtw_hal_set_hwreg(padapter, HW_VAR_OFF_RCR_AM, null_addr); - -exit: - - kfree(buf); - - return ret; -} - -static int wpa_set_param(struct net_device *dev, u8 name, u32 value) -{ - uint ret = 0; - struct adapter *padapter = rtw_netdev_priv(dev); - - switch (name) { - case IEEE_PARAM_WPA_ENABLED: - - padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; /* 802.1x */ - - /* ret = ieee80211_wpa_enable(ieee, value); */ - - switch ((value) & 0xff) { - case 1: /* WPA */ - padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeWPAPSK; /* WPA_PSK */ - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption2Enabled; - break; - case 2: /* WPA2 */ - padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeWPA2PSK; /* WPA2_PSK */ - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled; - break; - } - - break; - - case IEEE_PARAM_TKIP_COUNTERMEASURES: - /* ieee->tkip_countermeasures =value; */ - break; - - case IEEE_PARAM_DROP_UNENCRYPTED: - { - /* HACK: - * - * wpa_supplicant calls set_wpa_enabled when the driver - * is loaded and unloaded, regardless of if WPA is being - * used. No other calls are made which can be used to - * determine if encryption will be used or not prior to - * association being expected. If encryption is not being - * used, drop_unencrypted is set to false, else true -- we - * can use this to determine if the CAP_PRIVACY_ON bit should - * be set. - */ - break; - } - case IEEE_PARAM_PRIVACY_INVOKED: - - /* ieee->privacy_invoked =value; */ - - break; - - case IEEE_PARAM_AUTH_ALGS: - - ret = wpa_set_auth_algs(dev, value); - - break; - - case IEEE_PARAM_IEEE_802_1X: - - /* ieee->ieee802_1x =value; */ - - break; - - case IEEE_PARAM_WPAX_SELECT: - - /* added for WPA2 mixed mode */ - /* - spin_lock_irqsave(&ieee->wpax_suitlist_lock, flags); - ieee->wpax_type_set = 1; - ieee->wpax_type_notify = value; - spin_unlock_irqrestore(&ieee->wpax_suitlist_lock, flags); - */ - - break; - - default: - - ret = -EOPNOTSUPP; - - break; - } - - return ret; -} - -static int wpa_mlme(struct net_device *dev, u32 command, u32 reason) -{ - int ret = 0; - struct adapter *padapter = rtw_netdev_priv(dev); - - switch (command) { - case IEEE_MLME_STA_DEAUTH: - - if (!rtw_set_802_11_disassociate(padapter)) - ret = -1; - - break; - - case IEEE_MLME_STA_DISASSOC: - - if (!rtw_set_802_11_disassociate(padapter)) - ret = -1; - - break; - - default: - ret = -EOPNOTSUPP; - break; - } - - return ret; -} - -static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p) -{ - struct ieee_param *param; - uint ret = 0; - - /* down(&ieee->wx_sem); */ - - if (!p->pointer || p->length != sizeof(struct ieee_param)) - return -EINVAL; - - param = rtw_malloc(p->length); - if (!param) - return -ENOMEM; - - if (copy_from_user(param, p->pointer, p->length)) { - kfree(param); - return -EFAULT; - } - - switch (param->cmd) { - case IEEE_CMD_SET_WPA_PARAM: - ret = wpa_set_param(dev, param->u.wpa_param.name, param->u.wpa_param.value); - break; - - case IEEE_CMD_SET_WPA_IE: - /* ret = wpa_set_wpa_ie(dev, param, p->length); */ - ret = rtw_set_wpa_ie(rtw_netdev_priv(dev), (char *)param->u.wpa_ie.data, (u16)param->u.wpa_ie.len); - break; - - case IEEE_CMD_SET_ENCRYPTION: - ret = wpa_set_encryption(dev, param, p->length); - break; - - case IEEE_CMD_MLME: - ret = wpa_mlme(dev, param->u.mlme.command, param->u.mlme.reason_code); - break; - - default: - ret = -EOPNOTSUPP; - break; - } - - if (ret == 0 && copy_to_user(p->pointer, param, p->length)) - ret = -EFAULT; - - kfree(param); - - /* up(&ieee->wx_sem); */ - return ret; -} - -static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, u32 param_len) -{ - int ret = 0; - u32 wep_key_idx, wep_key_len, wep_total_len; - struct ndis_802_11_wep *pwep = NULL; - struct sta_info *psta = NULL, *pbcmc_sta = NULL; - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct security_priv *psecuritypriv = &padapter->securitypriv; - struct sta_priv *pstapriv = &padapter->stapriv; - char *txkey = padapter->securitypriv.dot118021XGrptxmickey[param->u.crypt.idx].skey; - char *rxkey = padapter->securitypriv.dot118021XGrprxmickey[param->u.crypt.idx].skey; - char *grpkey = psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey; - - param->u.crypt.err = 0; - param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0'; - - /* sizeof(struct ieee_param) = 64 bytes; */ - /* if (param_len != (u32) ((u8 *) param->u.crypt.key - (u8 *) param) + param->u.crypt.key_len) */ - if (param_len != sizeof(struct ieee_param) + param->u.crypt.key_len) { - ret = -EINVAL; - goto exit; - } - - if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && - param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { - if (param->u.crypt.idx >= WEP_KEYS) { - ret = -EINVAL; - goto exit; - } - } else { - psta = rtw_get_stainfo(pstapriv, param->sta_addr); - if (!psta) - /* ret = -EINVAL; */ - goto exit; - } - - if (strcmp(param->u.crypt.alg, "none") == 0 && !psta) { - /* todo:clear default encryption keys */ - - psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; - psecuritypriv->ndisencryptstatus = Ndis802_11EncryptionDisabled; - psecuritypriv->dot11PrivacyAlgrthm = _NO_PRIVACY_; - psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_; - - goto exit; - } - - if (strcmp(param->u.crypt.alg, "WEP") == 0 && !psta) { - wep_key_idx = param->u.crypt.idx; - wep_key_len = param->u.crypt.key_len; - - if ((wep_key_idx >= WEP_KEYS) || (wep_key_len <= 0)) { - ret = -EINVAL; - goto exit; - } - - if (wep_key_len > 0) { - wep_key_len = wep_key_len <= 5 ? 5 : 13; - wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, key_material); - /* Allocate a full structure to avoid potentially running off the end. */ - pwep = kzalloc(sizeof(*pwep), GFP_KERNEL); - if (!pwep) - goto exit; - - pwep->key_length = wep_key_len; - pwep->length = wep_total_len; - } - - pwep->key_index = wep_key_idx; - - memcpy(pwep->key_material, param->u.crypt.key, pwep->key_length); - - if (param->u.crypt.set_tx) { - psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Auto; - psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled; - psecuritypriv->dot11PrivacyAlgrthm = _WEP40_; - psecuritypriv->dot118021XGrpPrivacy = _WEP40_; - - if (pwep->key_length == 13) { - psecuritypriv->dot11PrivacyAlgrthm = _WEP104_; - psecuritypriv->dot118021XGrpPrivacy = _WEP104_; - } - - psecuritypriv->dot11PrivacyKeyIndex = wep_key_idx; - - memcpy(&psecuritypriv->dot11DefKey[wep_key_idx].skey[0], pwep->key_material, pwep->key_length); - - psecuritypriv->dot11DefKeylen[wep_key_idx] = pwep->key_length; - - rtw_ap_set_wep_key(padapter, pwep->key_material, pwep->key_length, wep_key_idx, 1); - } else { - /* don't update "psecuritypriv->dot11PrivacyAlgrthm" and */ - /* psecuritypriv->dot11PrivacyKeyIndex =keyid", but can rtw_set_key to cam */ - - memcpy(&psecuritypriv->dot11DefKey[wep_key_idx].skey[0], pwep->key_material, pwep->key_length); - - psecuritypriv->dot11DefKeylen[wep_key_idx] = pwep->key_length; - - rtw_ap_set_wep_key(padapter, pwep->key_material, pwep->key_length, wep_key_idx, 0); - } - - goto exit; - } - - if (!psta && check_fwstate(pmlmepriv, WIFI_AP_STATE)) { /* group key */ - if (param->u.crypt.set_tx == 1) { - if (strcmp(param->u.crypt.alg, "WEP") == 0) { - memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); - - psecuritypriv->dot118021XGrpPrivacy = _WEP40_; - if (param->u.crypt.key_len == 13) - psecuritypriv->dot118021XGrpPrivacy = _WEP104_; - - } else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { - psecuritypriv->dot118021XGrpPrivacy = _TKIP_; - - memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); - - /* DEBUG_ERR("set key length :param->u.crypt.key_len =%d\n", param->u.crypt.key_len); */ - /* set mic key */ - memcpy(txkey, ¶m->u.crypt.key[16], 8); - memcpy(psecuritypriv->dot118021XGrprxmickey[param->u.crypt.idx].skey, ¶m->u.crypt.key[24], 8); - - psecuritypriv->busetkipkey = true; - - } else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { - psecuritypriv->dot118021XGrpPrivacy = _AES_; - - memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); - } else { - psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_; - } - - psecuritypriv->dot118021XGrpKeyid = param->u.crypt.idx; - - psecuritypriv->binstallGrpkey = true; - - psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot118021XGrpPrivacy;/* */ - - rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx); - - pbcmc_sta = rtw_get_bcmc_stainfo(padapter); - if (pbcmc_sta) { - pbcmc_sta->ieee8021x_blocked = false; - pbcmc_sta->dot118021XPrivacy = psecuritypriv->dot118021XGrpPrivacy;/* rx will use bmc_sta's dot118021XPrivacy */ - } - } - - goto exit; - } - - if (psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X && psta) { /* psk/802_1x */ - if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { - if (param->u.crypt.set_tx == 1) { - memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); - - if (strcmp(param->u.crypt.alg, "WEP") == 0) { - psta->dot118021XPrivacy = _WEP40_; - if (param->u.crypt.key_len == 13) - psta->dot118021XPrivacy = _WEP104_; - } else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { - psta->dot118021XPrivacy = _TKIP_; - - /* DEBUG_ERR("set key length :param->u.crypt.key_len =%d\n", param->u.crypt.key_len); */ - /* set mic key */ - memcpy(psta->dot11tkiptxmickey.skey, ¶m->u.crypt.key[16], 8); - memcpy(psta->dot11tkiprxmickey.skey, ¶m->u.crypt.key[24], 8); - - psecuritypriv->busetkipkey = true; - - } else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { - psta->dot118021XPrivacy = _AES_; - } else { - psta->dot118021XPrivacy = _NO_PRIVACY_; - } - - rtw_ap_set_pairwise_key(padapter, psta); - - psta->ieee8021x_blocked = false; - - } else { /* group key??? */ - if (strcmp(param->u.crypt.alg, "WEP") == 0) { - memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); - - psecuritypriv->dot118021XGrpPrivacy = _WEP40_; - if (param->u.crypt.key_len == 13) - psecuritypriv->dot118021XGrpPrivacy = _WEP104_; - } else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { - psecuritypriv->dot118021XGrpPrivacy = _TKIP_; - - memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); - - /* DEBUG_ERR("set key length :param->u.crypt.key_len =%d\n", param->u.crypt.key_len); */ - /* set mic key */ - memcpy(txkey, ¶m->u.crypt.key[16], 8); - memcpy(rxkey, ¶m->u.crypt.key[24], 8); - - psecuritypriv->busetkipkey = true; - - } else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { - psecuritypriv->dot118021XGrpPrivacy = _AES_; - - memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); - } else { - psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_; - } - - psecuritypriv->dot118021XGrpKeyid = param->u.crypt.idx; - - psecuritypriv->binstallGrpkey = true; - - psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot118021XGrpPrivacy;/* */ - - rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx); - - pbcmc_sta = rtw_get_bcmc_stainfo(padapter); - if (pbcmc_sta) { - pbcmc_sta->ieee8021x_blocked = false; - pbcmc_sta->dot118021XPrivacy = psecuritypriv->dot118021XGrpPrivacy;/* rx will use bmc_sta's dot118021XPrivacy */ - } - } - } - } - -exit: - kfree(pwep); - - return ret; -} - -static int rtw_set_beacon(struct net_device *dev, struct ieee_param *param, int len) -{ - int ret = 0; - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct sta_priv *pstapriv = &padapter->stapriv; - unsigned char *pbuf = param->u.bcn_ie.buf; - - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) - return -EINVAL; - - memcpy(&pstapriv->max_num_sta, param->u.bcn_ie.reserved, 2); - - if ((pstapriv->max_num_sta > NUM_STA) || (pstapriv->max_num_sta <= 0)) - pstapriv->max_num_sta = NUM_STA; - - if (rtw_check_beacon_data(padapter, pbuf, (len - 12 - 2)) == _SUCCESS)/* 12 = param header, 2:no packed */ - ret = 0; - else - ret = -EINVAL; - - return ret; -} - -static void rtw_hostapd_sta_flush(struct net_device *dev) -{ - /* _irqL irqL; */ - /* struct list_head *phead, *plist; */ - /* struct sta_info *psta = NULL; */ - struct adapter *padapter = rtw_netdev_priv(dev); - /* struct sta_priv *pstapriv = &padapter->stapriv; */ - - flush_all_cam_entry(padapter); /* clear CAM */ - - rtw_sta_flush(padapter); -} - -static int rtw_add_sta(struct net_device *dev, struct ieee_param *param) -{ - int ret = 0; - struct sta_info *psta = NULL; - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct sta_priv *pstapriv = &padapter->stapriv; - - if (check_fwstate(pmlmepriv, (_FW_LINKED | WIFI_AP_STATE)) != true) - return -EINVAL; - - if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && - param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { - return -EINVAL; - } - -/* - psta = rtw_get_stainfo(pstapriv, param->sta_addr); - if (psta) - { - rtw_free_stainfo(padapter, psta); - - psta = NULL; - } -*/ - /* psta = rtw_alloc_stainfo(pstapriv, param->sta_addr); */ - psta = rtw_get_stainfo(pstapriv, param->sta_addr); - if (psta) { - int flags = param->u.add_sta.flags; - - psta->aid = param->u.add_sta.aid;/* aid = 1~2007 */ - - memcpy(psta->bssrateset, param->u.add_sta.tx_supp_rates, 16); - - /* check wmm cap. */ - if (WLAN_STA_WME & flags) - psta->qos_option = 1; - else - psta->qos_option = 0; - - if (pmlmepriv->qospriv.qos_option == 0) - psta->qos_option = 0; - - /* chec 802.11n ht cap. */ - if (WLAN_STA_HT & flags) { - psta->htpriv.ht_option = true; - psta->qos_option = 1; - memcpy((void *)&psta->htpriv.ht_cap, (void *)¶m->u.add_sta.ht_cap, sizeof(struct ieee80211_ht_cap)); - } else { - psta->htpriv.ht_option = false; - } - - if (!pmlmepriv->htpriv.ht_option) - psta->htpriv.ht_option = false; - - update_sta_info_apmode(padapter, psta); - - } else { - ret = -ENOMEM; - } - - return ret; -} - -static int rtw_del_sta(struct net_device *dev, struct ieee_param *param) -{ - int ret = 0; - struct sta_info *psta = NULL; - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct sta_priv *pstapriv = &padapter->stapriv; - - if (check_fwstate(pmlmepriv, (_FW_LINKED | WIFI_AP_STATE)) != true) - return -EINVAL; - - if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && - param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { - return -EINVAL; - } - - psta = rtw_get_stainfo(pstapriv, param->sta_addr); - if (psta) { - u8 updated = false; - - spin_lock_bh(&pstapriv->asoc_list_lock); - if (list_empty(&psta->asoc_list) == false) { - list_del_init(&psta->asoc_list); - pstapriv->asoc_list_cnt--; - updated = ap_free_sta(padapter, psta, true, WLAN_REASON_DEAUTH_LEAVING); - } - spin_unlock_bh(&pstapriv->asoc_list_lock); - - associated_clients_update(padapter, updated); - - psta = NULL; - } - - return ret; -} - -static int rtw_ioctl_get_sta_data(struct net_device *dev, struct ieee_param *param, int len) -{ - int ret = 0; - struct sta_info *psta = NULL; - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct sta_priv *pstapriv = &padapter->stapriv; - struct ieee_param_ex *param_ex = (struct ieee_param_ex *)param; - struct sta_data *psta_data = (struct sta_data *)param_ex->data; - - if (check_fwstate(pmlmepriv, (_FW_LINKED | WIFI_AP_STATE)) != true) - return -EINVAL; - - if (param_ex->sta_addr[0] == 0xff && param_ex->sta_addr[1] == 0xff && - param_ex->sta_addr[2] == 0xff && param_ex->sta_addr[3] == 0xff && - param_ex->sta_addr[4] == 0xff && param_ex->sta_addr[5] == 0xff) { - return -EINVAL; - } - - psta = rtw_get_stainfo(pstapriv, param_ex->sta_addr); - if (psta) { - psta_data->aid = (u16)psta->aid; - psta_data->capability = psta->capability; - psta_data->flags = psta->flags; - -/* - nonerp_set : BIT(0) - no_short_slot_time_set : BIT(1) - no_short_preamble_set : BIT(2) - no_ht_gf_set : BIT(3) - no_ht_set : BIT(4) - ht_20mhz_set : BIT(5) -*/ - - psta_data->sta_set = ((psta->nonerp_set) | - (psta->no_short_slot_time_set << 1) | - (psta->no_short_preamble_set << 2) | - (psta->no_ht_gf_set << 3) | - (psta->no_ht_set << 4) | - (psta->ht_20mhz_set << 5)); - - psta_data->tx_supp_rates_len = psta->bssratelen; - memcpy(psta_data->tx_supp_rates, psta->bssrateset, psta->bssratelen); - memcpy(&psta_data->ht_cap, &psta->htpriv.ht_cap, sizeof(struct ieee80211_ht_cap)); - psta_data->rx_pkts = psta->sta_stats.rx_data_pkts; - psta_data->rx_bytes = psta->sta_stats.rx_bytes; - psta_data->rx_drops = psta->sta_stats.rx_drops; - - psta_data->tx_pkts = psta->sta_stats.tx_pkts; - psta_data->tx_bytes = psta->sta_stats.tx_bytes; - psta_data->tx_drops = psta->sta_stats.tx_drops; - - } else { - ret = -1; - } - - return ret; -} - -static int rtw_get_sta_wpaie(struct net_device *dev, struct ieee_param *param) -{ - int ret = 0; - struct sta_info *psta = NULL; - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct sta_priv *pstapriv = &padapter->stapriv; - - if (check_fwstate(pmlmepriv, (_FW_LINKED | WIFI_AP_STATE)) != true) - return -EINVAL; - - if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && - param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { - return -EINVAL; - } - - psta = rtw_get_stainfo(pstapriv, param->sta_addr); - if (psta) { - if ((psta->wpa_ie[0] == WLAN_EID_RSN) || (psta->wpa_ie[0] == WLAN_EID_VENDOR_SPECIFIC)) { - int wpa_ie_len; - int copy_len; - - wpa_ie_len = psta->wpa_ie[1]; - - copy_len = ((wpa_ie_len + 2) > sizeof(psta->wpa_ie)) ? (sizeof(psta->wpa_ie)) : (wpa_ie_len + 2); - - param->u.wpa_ie.len = copy_len; - - memcpy(param->u.wpa_ie.reserved, psta->wpa_ie, copy_len); - } - } else { - ret = -1; - } - - return ret; -} - -static int rtw_set_wps_beacon(struct net_device *dev, struct ieee_param *param, int len) -{ - int ret = 0; - unsigned char wps_oui[4] = {0x0, 0x50, 0xf2, 0x04}; - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - int ie_len; - - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) - return -EINVAL; - - ie_len = len - 12 - 2;/* 12 = param header, 2:no packed */ - - kfree(pmlmepriv->wps_beacon_ie); - pmlmepriv->wps_beacon_ie = NULL; - - if (ie_len > 0) { - pmlmepriv->wps_beacon_ie = rtw_malloc(ie_len); - pmlmepriv->wps_beacon_ie_len = ie_len; - if (!pmlmepriv->wps_beacon_ie) - return -EINVAL; - - memcpy(pmlmepriv->wps_beacon_ie, param->u.bcn_ie.buf, ie_len); - - update_beacon(padapter, WLAN_EID_VENDOR_SPECIFIC, wps_oui, true); - - pmlmeext->bstart_bss = true; - } - - return ret; -} - -static int rtw_set_wps_probe_resp(struct net_device *dev, struct ieee_param *param, int len) -{ - int ret = 0; - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - int ie_len; - - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) - return -EINVAL; - - ie_len = len - 12 - 2;/* 12 = param header, 2:no packed */ - - kfree(pmlmepriv->wps_probe_resp_ie); - pmlmepriv->wps_probe_resp_ie = NULL; - - if (ie_len > 0) { - pmlmepriv->wps_probe_resp_ie = rtw_malloc(ie_len); - pmlmepriv->wps_probe_resp_ie_len = ie_len; - if (!pmlmepriv->wps_probe_resp_ie) - return -EINVAL; - - memcpy(pmlmepriv->wps_probe_resp_ie, param->u.bcn_ie.buf, ie_len); - } - - return ret; -} - -static int rtw_set_wps_assoc_resp(struct net_device *dev, struct ieee_param *param, int len) -{ - int ret = 0; - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - int ie_len; - - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) - return -EINVAL; - - ie_len = len - 12 - 2;/* 12 = param header, 2:no packed */ - - kfree(pmlmepriv->wps_assoc_resp_ie); - pmlmepriv->wps_assoc_resp_ie = NULL; - - if (ie_len > 0) { - pmlmepriv->wps_assoc_resp_ie = rtw_malloc(ie_len); - pmlmepriv->wps_assoc_resp_ie_len = ie_len; - if (!pmlmepriv->wps_assoc_resp_ie) - return -EINVAL; - - memcpy(pmlmepriv->wps_assoc_resp_ie, param->u.bcn_ie.buf, ie_len); - } - - return ret; -} - -static int rtw_set_hidden_ssid(struct net_device *dev, struct ieee_param *param, int len) -{ - int ret = 0; - struct adapter *adapter = rtw_netdev_priv(dev); - struct mlme_priv *mlmepriv = &adapter->mlmepriv; - struct mlme_ext_priv *mlmeext = &adapter->mlmeextpriv; - struct mlme_ext_info *mlmeinfo = &mlmeext->mlmext_info; - int ie_len; - u8 *ssid_ie; - char ssid[NDIS_802_11_LENGTH_SSID + 1]; - signed int ssid_len; - u8 ignore_broadcast_ssid; - - if (check_fwstate(mlmepriv, WIFI_AP_STATE) != true) - return -EPERM; - - if (param->u.bcn_ie.reserved[0] != 0xea) - return -EINVAL; - - mlmeinfo->hidden_ssid_mode = ignore_broadcast_ssid = param->u.bcn_ie.reserved[1]; - - ie_len = len - 12 - 2;/* 12 = param header, 2:no packed */ - ssid_ie = rtw_get_ie(param->u.bcn_ie.buf, WLAN_EID_SSID, &ssid_len, ie_len); - - if (ssid_ie && ssid_len > 0 && ssid_len <= NDIS_802_11_LENGTH_SSID) { - struct wlan_bssid_ex *pbss_network = &mlmepriv->cur_network.network; - struct wlan_bssid_ex *pbss_network_ext = &mlmeinfo->network; - - memcpy(ssid, ssid_ie + 2, ssid_len); - ssid[ssid_len] = 0x0; - - memcpy(pbss_network->ssid.ssid, (void *)ssid, ssid_len); - pbss_network->ssid.ssid_length = ssid_len; - memcpy(pbss_network_ext->ssid.ssid, (void *)ssid, ssid_len); - pbss_network_ext->ssid.ssid_length = ssid_len; - } - - return ret; -} - -static int rtw_ioctl_acl_remove_sta(struct net_device *dev, struct ieee_param *param, int len) -{ - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) - return -EINVAL; - - if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && - param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { - return -EINVAL; - } - - rtw_acl_remove_sta(padapter, param->sta_addr); - return 0; -} - -static int rtw_ioctl_acl_add_sta(struct net_device *dev, struct ieee_param *param, int len) -{ - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) - return -EINVAL; - - if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && - param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { - return -EINVAL; - } - - return rtw_acl_add_sta(padapter, param->sta_addr); -} - -static int rtw_ioctl_set_macaddr_acl(struct net_device *dev, struct ieee_param *param, int len) -{ - int ret = 0; - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) - return -EINVAL; - - rtw_set_macaddr_acl(padapter, param->u.mlme.command); - - return ret; -} - -static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p) -{ - struct ieee_param *param; - int ret = 0; - struct adapter *padapter = rtw_netdev_priv(dev); - - /* - * this function is expect to call in master mode, which allows no power saving - * so, we just check hw_init_completed - */ - - if (!padapter->hw_init_completed) - return -EPERM; - - if (!p->pointer || p->length != sizeof(*param)) - return -EINVAL; - - param = rtw_malloc(p->length); - if (!param) - return -ENOMEM; - - if (copy_from_user(param, p->pointer, p->length)) { - kfree(param); - return -EFAULT; - } - - switch (param->cmd) { - case RTL871X_HOSTAPD_FLUSH: - - rtw_hostapd_sta_flush(dev); - - break; - - case RTL871X_HOSTAPD_ADD_STA: - - ret = rtw_add_sta(dev, param); - - break; - - case RTL871X_HOSTAPD_REMOVE_STA: - - ret = rtw_del_sta(dev, param); - - break; - - case RTL871X_HOSTAPD_SET_BEACON: - - ret = rtw_set_beacon(dev, param, p->length); - - break; - - case RTL871X_SET_ENCRYPTION: - - ret = rtw_set_encryption(dev, param, p->length); - - break; - - case RTL871X_HOSTAPD_GET_WPAIE_STA: - - ret = rtw_get_sta_wpaie(dev, param); - - break; - - case RTL871X_HOSTAPD_SET_WPS_BEACON: - - ret = rtw_set_wps_beacon(dev, param, p->length); - - break; - - case RTL871X_HOSTAPD_SET_WPS_PROBE_RESP: - - ret = rtw_set_wps_probe_resp(dev, param, p->length); - - break; - - case RTL871X_HOSTAPD_SET_WPS_ASSOC_RESP: - - ret = rtw_set_wps_assoc_resp(dev, param, p->length); - - break; - - case RTL871X_HOSTAPD_SET_HIDDEN_SSID: - - ret = rtw_set_hidden_ssid(dev, param, p->length); - - break; - - case RTL871X_HOSTAPD_GET_INFO_STA: - - ret = rtw_ioctl_get_sta_data(dev, param, p->length); - - break; - - case RTL871X_HOSTAPD_SET_MACADDR_ACL: - - ret = rtw_ioctl_set_macaddr_acl(dev, param, p->length); - - break; - - case RTL871X_HOSTAPD_ACL_ADD_STA: - - ret = rtw_ioctl_acl_add_sta(dev, param, p->length); - - break; - - case RTL871X_HOSTAPD_ACL_REMOVE_STA: - - ret = rtw_ioctl_acl_remove_sta(dev, param, p->length); - - break; - - default: - ret = -EOPNOTSUPP; - break; - } - - if (ret == 0 && copy_to_user(p->pointer, param, p->length)) - ret = -EFAULT; - - kfree(param); - return ret; -} - -/* copy from net/wireless/wext.c end */ - -int rtw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) -{ - struct iwreq *wrq = (struct iwreq *)rq; - int ret = 0; - - switch (cmd) { - case RTL_IOCTL_WPA_SUPPLICANT: - ret = wpa_supplicant_ioctl(dev, &wrq->u.data); - break; - case RTL_IOCTL_HOSTAPD: - ret = rtw_hostapd_ioctl(dev, &wrq->u.data); - break; - default: - ret = -EOPNOTSUPP; - break; - } - - return ret; -} diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c index 68bba3c0e757a..90564fbb78f34 100644 --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c @@ -382,34 +382,6 @@ u16 rtw_recv_select_queue(struct sk_buff *skb) return rtw_1d_to_queue[priority]; } -static int rtw_ndev_notifier_call(struct notifier_block *nb, unsigned long state, void *ptr) -{ - struct net_device *dev = netdev_notifier_info_to_dev(ptr); - - if (dev->netdev_ops->ndo_do_ioctl != rtw_ioctl) - return NOTIFY_DONE; - - netdev_dbg(dev, FUNC_NDEV_FMT " state:%lu\n", FUNC_NDEV_ARG(dev), - state); - - return NOTIFY_DONE; -} - -static struct notifier_block rtw_ndev_notifier = { - .notifier_call = rtw_ndev_notifier_call, -}; - -int rtw_ndev_notifier_register(void) -{ - return register_netdevice_notifier(&rtw_ndev_notifier); -} - -void rtw_ndev_notifier_unregister(void) -{ - unregister_netdevice_notifier(&rtw_ndev_notifier); -} - - static int rtw_ndev_init(struct net_device *dev) { struct adapter *adapter = rtw_netdev_priv(dev); @@ -436,7 +408,6 @@ static const struct net_device_ops rtw_netdev_ops = { .ndo_select_queue = rtw_select_queue, .ndo_set_mac_address = rtw_net_set_mac_address, .ndo_get_stats = rtw_net_get_stats, - .ndo_do_ioctl = rtw_ioctl, }; int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname) diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c index 4904314845242..effe4ffac54eb 100644 --- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c +++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c @@ -383,7 +383,6 @@ static int rtw_drv_init( if (sdio_alloc_irq(dvobj) != _SUCCESS) goto free_if1; - rtw_ndev_notifier_register(); status = _SUCCESS; free_if1: @@ -483,24 +482,4 @@ static int rtw_sdio_resume(struct device *dev) return ret; } -static int __init rtw_drv_entry(void) -{ - int ret; - - ret = sdio_register_driver(&rtl8723bs_sdio_driver); - if (ret != 0) - rtw_ndev_notifier_unregister(); - - return ret; -} - -static void __exit rtw_drv_halt(void) -{ - sdio_unregister_driver(&rtl8723bs_sdio_driver); - - rtw_ndev_notifier_unregister(); -} - - -module_init(rtw_drv_entry); -module_exit(rtw_drv_halt); +module_sdio_driver(rtl8723bs_sdio_driver); From patchwork Wed Oct 11 14:02:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13417468 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CE15CD6E6E for ; Wed, 11 Oct 2023 14:03:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346919AbjJKODk (ORCPT ); Wed, 11 Oct 2023 10:03:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347061AbjJKODX (ORCPT ); Wed, 11 Oct 2023 10:03:23 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 751AAE5; Wed, 11 Oct 2023 07:03:17 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F4D7C433CB; Wed, 11 Oct 2023 14:03:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697032996; bh=N/HC4aN9VSOyAziYJUcabvcvg/4uj3ZeRvuFPX72uUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OURP0UMv6EgweTj0Rs590/LwjwTau2qo9h2IdP8oq7Lq97yicqRuDZrF8QR8zOpJk 760QbfnousJd7q2sYcoh8cs6PFw3zNVsgoUIOTx3Zx2zTjjaaqvPaybtMOJkUNXrzm 0bDPxJVsdOR3EEWDtJ3886RKmBArz3CXm7mTt1Yz61ImKQFzd7/gpiJ5p9rdsdvWDy LefCqIwwWMwFNXs0pOid5iOLu8WkDXpiMdJYDc20wkEQOKD4o0HEvjFOx3EG3iieDZ eRHRPoh8uTfdVGjsxjN663MzrRwnyjNZZwq6Pv4R0Q1fbkxM1scmh7UZlQ7m20Z9vA J7gwh9KhoByEA== 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" , Rodolfo Zitellini , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Kalle Valo Subject: [PATCH v2 08/10] wifi: atmel: remove unused ioctl function Date: Wed, 11 Oct 2023 16:02:23 +0200 Message-Id: <20231011140225.253106-8-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231011140225.253106-1-arnd@kernel.org> References: <20231011140225.253106-1-arnd@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org From: Arnd Bergmann This function has no callers, and for the past 20 years, the request_firmware interface has been in place instead of the custom firmware loader. Acked-by: Kalle Valo Signed-off-by: Arnd Bergmann --- drivers/staging/wireless/atmel/atmel.c | 72 -------------------------- 1 file changed, 72 deletions(-) diff --git a/drivers/staging/wireless/atmel/atmel.c b/drivers/staging/wireless/atmel/atmel.c index 7c2d1c588156d..461dce21de2b0 100644 --- a/drivers/staging/wireless/atmel/atmel.c +++ b/drivers/staging/wireless/atmel/atmel.c @@ -571,7 +571,6 @@ static const struct { { REG_DOMAIN_ISRAEL, 3, 9, "Israel"} }; static void build_wpa_mib(struct atmel_private *priv); -static int atmel_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); static void atmel_copy_to_card(struct net_device *dev, u16 dest, const unsigned char *src, u16 len); static void atmel_copy_to_host(struct net_device *dev, unsigned char *dest, @@ -1487,7 +1486,6 @@ static const struct net_device_ops atmel_netdev_ops = { .ndo_stop = atmel_close, .ndo_set_mac_address = atmel_set_mac_address, .ndo_start_xmit = start_tx, - .ndo_do_ioctl = atmel_ioctl, .ndo_validate_addr = eth_validate_addr, }; @@ -2616,76 +2614,6 @@ static const struct iw_handler_def atmel_handler_def = { .get_wireless_stats = atmel_get_wireless_stats }; -static int atmel_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) -{ - int i, rc = 0; - struct atmel_private *priv = netdev_priv(dev); - struct atmel_priv_ioctl com; - struct iwreq *wrq = (struct iwreq *) rq; - unsigned char *new_firmware; - char domain[REGDOMAINSZ + 1]; - - switch (cmd) { - case ATMELIDIFC: - wrq->u.param.value = ATMELMAGIC; - break; - - case ATMELFWL: - if (copy_from_user(&com, rq->ifr_data, sizeof(com))) { - rc = -EFAULT; - break; - } - - if (!capable(CAP_NET_ADMIN)) { - rc = -EPERM; - break; - } - - new_firmware = memdup_user(com.data, com.len); - if (IS_ERR(new_firmware)) { - rc = PTR_ERR(new_firmware); - break; - } - - kfree(priv->firmware); - - priv->firmware = new_firmware; - priv->firmware_length = com.len; - strncpy(priv->firmware_id, com.id, 31); - priv->firmware_id[31] = '\0'; - break; - - case ATMELRD: - if (copy_from_user(domain, rq->ifr_data, REGDOMAINSZ)) { - rc = -EFAULT; - break; - } - - if (!capable(CAP_NET_ADMIN)) { - rc = -EPERM; - break; - } - - domain[REGDOMAINSZ] = 0; - rc = -EINVAL; - for (i = 0; i < ARRAY_SIZE(channel_table); i++) { - if (!strcasecmp(channel_table[i].name, domain)) { - priv->config_reg_domain = channel_table[i].reg_domain; - rc = 0; - } - } - - if (rc == 0 && priv->station_state != STATION_STATE_DOWN) - rc = atmel_open(dev); - break; - - default: - rc = -EOPNOTSUPP; - } - - return rc; -} - struct auth_body { __le16 alg; __le16 trans_seq; From patchwork Wed Oct 11 14:02:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13417470 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C543CD6E75 for ; Wed, 11 Oct 2023 14:03:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347005AbjJKODn (ORCPT ); Wed, 11 Oct 2023 10:03:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235048AbjJKOD3 (ORCPT ); Wed, 11 Oct 2023 10:03:29 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD565103; Wed, 11 Oct 2023 07:03:21 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5813BC433C8; Wed, 11 Oct 2023 14:03:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697033000; bh=swFjHYRAcIq+7y7eoCfw/OikCf4A6aTlX7mu0sQjbyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WT7PE9Y7o+usoU/jopmxSwxzD0zuzQRSz749t5aYzXMhB9F7lR/Sw/H/Q88nb1gTw fiPHfrm7V4uVQ19XFpYD0srIVnQiUU6bnX3Bmwt08vR2KFcIrahZ1KAh89BwFIbYs0 wlDTk9tm+RLKl6gAVbk69kJBEJJm9QBYsY1tg6ya/L5qXBvUDLXMdQ2+i37dSp+2bz RwW9xj4Es5qrwmSPzZ/74OiXkPqP2ilAFdZcFJzK/cBzoo8h64G1OuWM+g8BZ34nBY S3NyNTbxWoCRGgjn7AmCCBg1PZwMnmyR9Idv9v1y0+m+OL2P+45a9hCHZrE6PSRPWY x9fYPiz9KdpxQ== 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" , Rodolfo Zitellini , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Kalle Valo Subject: [PATCH v2 09/10] wifi: hostap: remove unused ioctl function Date: Wed, 11 Oct 2023 16:02:24 +0200 Message-Id: <20231011140225.253106-9-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231011140225.253106-1-arnd@kernel.org> References: <20231011140225.253106-1-arnd@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org From: Arnd Bergmann The ioctl handler has no actual callers in the kernel and is useless. All the functionality should be reachable through the regualar interfaces. Acked-by: Kalle Valo Signed-off-by: Arnd Bergmann --- drivers/staging/wireless/hostap/hostap.h | 1 - .../staging/wireless/hostap/hostap_ioctl.c | 228 ------------------ drivers/staging/wireless/hostap/hostap_main.c | 3 - 3 files changed, 232 deletions(-) diff --git a/drivers/staging/wireless/hostap/hostap.h b/drivers/staging/wireless/hostap/hostap.h index c17ab6dbbb538..552ae33d78751 100644 --- a/drivers/staging/wireless/hostap/hostap.h +++ b/drivers/staging/wireless/hostap/hostap.h @@ -92,7 +92,6 @@ void hostap_info_process(local_info_t *local, struct sk_buff *skb); extern const struct iw_handler_def hostap_iw_handler_def; extern const struct ethtool_ops prism2_ethtool_ops; -int hostap_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); int hostap_siocdevprivate(struct net_device *dev, struct ifreq *ifr, void __user *data, int cmd); diff --git a/drivers/staging/wireless/hostap/hostap_ioctl.c b/drivers/staging/wireless/hostap/hostap_ioctl.c index b4adfc190ae87..26162f92e3c3d 100644 --- a/drivers/staging/wireless/hostap/hostap_ioctl.c +++ b/drivers/staging/wireless/hostap/hostap_ioctl.c @@ -2316,21 +2316,6 @@ static const struct iw_priv_args prism2_priv[] = { }; -static int prism2_ioctl_priv_inquire(struct net_device *dev, int *i) -{ - struct hostap_interface *iface; - local_info_t *local; - - iface = netdev_priv(dev); - local = iface->local; - - if (local->func->cmd(dev, HFA384X_CMDCODE_INQUIRE, *i, NULL, NULL)) - return -EOPNOTSUPP; - - return 0; -} - - static int prism2_ioctl_priv_prism2_param(struct net_device *dev, struct iw_request_info *info, union iwreq_data *uwrq, char *extra) @@ -2910,146 +2895,6 @@ static int prism2_ioctl_priv_writemif(struct net_device *dev, } -static int prism2_ioctl_priv_monitor(struct net_device *dev, int *i) -{ - struct hostap_interface *iface; - local_info_t *local; - int ret = 0; - union iwreq_data wrqu; - - iface = netdev_priv(dev); - local = iface->local; - - printk(KERN_DEBUG "%s: process %d (%s) used deprecated iwpriv monitor " - "- update software to use iwconfig mode monitor\n", - dev->name, task_pid_nr(current), current->comm); - - /* Backward compatibility code - this can be removed at some point */ - - if (*i == 0) { - /* Disable monitor mode - old mode was not saved, so go to - * Master mode */ - wrqu.mode = IW_MODE_MASTER; - ret = prism2_ioctl_siwmode(dev, NULL, &wrqu, NULL); - } else if (*i == 1) { - /* netlink socket mode is not supported anymore since it did - * not separate different devices from each other and was not - * best method for delivering large amount of packets to - * user space */ - ret = -EOPNOTSUPP; - } else if (*i == 2 || *i == 3) { - switch (*i) { - case 2: - local->monitor_type = PRISM2_MONITOR_80211; - break; - case 3: - local->monitor_type = PRISM2_MONITOR_PRISM; - break; - } - wrqu.mode = IW_MODE_MONITOR; - ret = prism2_ioctl_siwmode(dev, NULL, &wrqu, NULL); - hostap_monitor_mode_enable(local); - } else - ret = -EINVAL; - - return ret; -} - - -static int prism2_ioctl_priv_reset(struct net_device *dev, int *i) -{ - struct hostap_interface *iface; - local_info_t *local; - - iface = netdev_priv(dev); - local = iface->local; - - printk(KERN_DEBUG "%s: manual reset request(%d)\n", dev->name, *i); - switch (*i) { - case 0: - /* Disable and enable card */ - local->func->hw_shutdown(dev, 1); - local->func->hw_config(dev, 0); - break; - - case 1: - /* COR sreset */ - local->func->hw_reset(dev); - break; - - case 2: - /* Disable and enable port 0 */ - local->func->reset_port(dev); - break; - - case 3: - prism2_sta_deauth(local, WLAN_REASON_DEAUTH_LEAVING); - if (local->func->cmd(dev, HFA384X_CMDCODE_DISABLE, 0, NULL, - NULL)) - return -EINVAL; - break; - - case 4: - if (local->func->cmd(dev, HFA384X_CMDCODE_ENABLE, 0, NULL, - NULL)) - return -EINVAL; - break; - - default: - printk(KERN_DEBUG "Unknown reset request %d\n", *i); - return -EOPNOTSUPP; - } - - return 0; -} - - -static int prism2_ioctl_priv_set_rid_word(struct net_device *dev, int *i) -{ - int rid = *i; - int value = *(i + 1); - - printk(KERN_DEBUG "%s: Set RID[0x%X] = %d\n", dev->name, rid, value); - - if (hostap_set_word(dev, rid, value)) - return -EINVAL; - - return 0; -} - - -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT -static int ap_mac_cmd_ioctl(local_info_t *local, int *cmd) -{ - int ret = 0; - - switch (*cmd) { - case AP_MAC_CMD_POLICY_OPEN: - local->ap->mac_restrictions.policy = MAC_POLICY_OPEN; - break; - case AP_MAC_CMD_POLICY_ALLOW: - local->ap->mac_restrictions.policy = MAC_POLICY_ALLOW; - break; - case AP_MAC_CMD_POLICY_DENY: - local->ap->mac_restrictions.policy = MAC_POLICY_DENY; - break; - case AP_MAC_CMD_FLUSH: - ap_control_flush_macs(&local->ap->mac_restrictions); - break; - case AP_MAC_CMD_KICKALL: - ap_control_kickall(local->ap); - hostap_deauth_all_stas(local->dev, local->ap, 0); - break; - default: - ret = -EOPNOTSUPP; - break; - } - - return ret; -} -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - - #ifdef PRISM2_DOWNLOAD_SUPPORT static int prism2_ioctl_priv_download(local_info_t *local, struct iw_point *p) { @@ -3963,79 +3808,6 @@ const struct iw_handler_def hostap_iw_handler_def = .get_wireless_stats = hostap_get_wireless_stats, }; -/* Private ioctls (iwpriv) that have not yet been converted - * into new wireless extensions API */ -int hostap_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) -{ - struct iwreq *wrq = (struct iwreq *) ifr; - struct hostap_interface *iface; - local_info_t *local; - int ret = 0; - - iface = netdev_priv(dev); - local = iface->local; - - switch (cmd) { - case PRISM2_IOCTL_INQUIRE: - if (!capable(CAP_NET_ADMIN)) ret = -EPERM; - else ret = prism2_ioctl_priv_inquire(dev, (int *) wrq->u.name); - break; - - case PRISM2_IOCTL_MONITOR: - if (!capable(CAP_NET_ADMIN)) ret = -EPERM; - else ret = prism2_ioctl_priv_monitor(dev, (int *) wrq->u.name); - break; - - case PRISM2_IOCTL_RESET: - if (!capable(CAP_NET_ADMIN)) ret = -EPERM; - else ret = prism2_ioctl_priv_reset(dev, (int *) wrq->u.name); - break; - - case PRISM2_IOCTL_WDS_ADD: - if (!capable(CAP_NET_ADMIN)) ret = -EPERM; - else ret = prism2_wds_add(local, wrq->u.ap_addr.sa_data, 1); - break; - - case PRISM2_IOCTL_WDS_DEL: - if (!capable(CAP_NET_ADMIN)) ret = -EPERM; - else ret = prism2_wds_del(local, wrq->u.ap_addr.sa_data, 1, 0); - break; - - case PRISM2_IOCTL_SET_RID_WORD: - if (!capable(CAP_NET_ADMIN)) ret = -EPERM; - else ret = prism2_ioctl_priv_set_rid_word(dev, - (int *) wrq->u.name); - break; - -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - case PRISM2_IOCTL_MACCMD: - if (!capable(CAP_NET_ADMIN)) ret = -EPERM; - else ret = ap_mac_cmd_ioctl(local, (int *) wrq->u.name); - break; - - case PRISM2_IOCTL_ADDMAC: - if (!capable(CAP_NET_ADMIN)) ret = -EPERM; - else ret = ap_control_add_mac(&local->ap->mac_restrictions, - wrq->u.ap_addr.sa_data); - break; - case PRISM2_IOCTL_DELMAC: - if (!capable(CAP_NET_ADMIN)) ret = -EPERM; - else ret = ap_control_del_mac(&local->ap->mac_restrictions, - wrq->u.ap_addr.sa_data); - break; - case PRISM2_IOCTL_KICKMAC: - if (!capable(CAP_NET_ADMIN)) ret = -EPERM; - else ret = ap_control_kick_mac(local->ap, local->dev, - wrq->u.ap_addr.sa_data); - break; -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - default: - ret = -EOPNOTSUPP; - break; - } - - return ret; -} /* Private ioctls that are not used with iwpriv; * in SIOCDEVPRIVATE range */ diff --git a/drivers/staging/wireless/hostap/hostap_main.c b/drivers/staging/wireless/hostap/hostap_main.c index 787f685e70b49..bf86ac26c2acc 100644 --- a/drivers/staging/wireless/hostap/hostap_main.c +++ b/drivers/staging/wireless/hostap/hostap_main.c @@ -796,7 +796,6 @@ static const struct net_device_ops hostap_netdev_ops = { .ndo_open = prism2_open, .ndo_stop = prism2_close, - .ndo_do_ioctl = hostap_ioctl, .ndo_siocdevprivate = hostap_siocdevprivate, .ndo_set_mac_address = prism2_set_mac_address, .ndo_set_rx_mode = hostap_set_multicast_list, @@ -809,7 +808,6 @@ static const struct net_device_ops hostap_mgmt_netdev_ops = { .ndo_open = prism2_open, .ndo_stop = prism2_close, - .ndo_do_ioctl = hostap_ioctl, .ndo_siocdevprivate = hostap_siocdevprivate, .ndo_set_mac_address = prism2_set_mac_address, .ndo_set_rx_mode = hostap_set_multicast_list, @@ -822,7 +820,6 @@ static const struct net_device_ops hostap_master_ops = { .ndo_open = prism2_open, .ndo_stop = prism2_close, - .ndo_do_ioctl = hostap_ioctl, .ndo_siocdevprivate = hostap_siocdevprivate, .ndo_set_mac_address = prism2_set_mac_address, .ndo_set_rx_mode = hostap_set_multicast_list, From patchwork Wed Oct 11 14:02:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13417491 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83A31CD6E76 for ; Wed, 11 Oct 2023 14:24:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232597AbjJKOYA (ORCPT ); Wed, 11 Oct 2023 10:24:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235072AbjJKODi (ORCPT ); Wed, 11 Oct 2023 10:03:38 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 754F792; Wed, 11 Oct 2023 07:03:24 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17310C433CC; Wed, 11 Oct 2023 14:03:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697033004; bh=zrhlLGL/7VohDIuN/EnFdfDCdV/hjo/fxSU8flcn0tg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fv1HVdZCtl1nJlrYvL4pbAyBWkP5ONV8qajJUP3MxqjnmH7ue9v7qW5IY/d5p+JX0 XzuLDOSvYdqyJqrMue4njz27bUrf3is+UQkG+0Q30EQsfZtTHlO3p+vWGTF9182BkG UUZPGRKBvYwBTr5nY88nGPXcup+2wbUzlxEAQvEMiapopqvV58MnfdZ/sW10zJPlYl E70dw4/UxSSM1nf7fdjyNjc8LI/n6v2crN/Rbnix/VMb6o8TlrAZtLo1t6rNB+Yq83 wlti2jF0kEbgmTnPqjaS6F5CjSxANi7pncq0av/3EA5s/UOfO5+eMuDlCeAIB06ZzP aRvesvlAVww2Q== 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" , Rodolfo Zitellini , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v2 10/10] net: remove ndo_do_ioctl handler Date: Wed, 11 Oct 2023 16:02:25 +0200 Message-Id: <20231011140225.253106-10-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231011140225.253106-1-arnd@kernel.org> References: <20231011140225.253106-1-arnd@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org From: Arnd Bergmann All of the references to the callback pointer are gone, so remove the pointer itself before we grow new references to it. Signed-off-by: Arnd Bergmann --- Documentation/networking/netdevices.rst | 8 -------- include/linux/netdevice.h | 7 ------- 2 files changed, 15 deletions(-) diff --git a/Documentation/networking/netdevices.rst b/Documentation/networking/netdevices.rst index 9e4cccb90b870..6f9b71c5d37b8 100644 --- a/Documentation/networking/netdevices.rst +++ b/Documentation/networking/netdevices.rst @@ -218,14 +218,6 @@ ndo_stop: Context: process Note: netif_running() is guaranteed false -ndo_do_ioctl: - Synchronization: rtnl_lock() semaphore. - Context: process - - This is only called by network subsystems internally, - not by user space calling ioctl as it was in before - linux-5.14. - ndo_siocbond: Synchronization: rtnl_lock() semaphore. Context: process diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index e070a4540fbaf..8d1cc8f195cb6 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1121,11 +1121,6 @@ struct netdev_net_notifier { * int (*ndo_validate_addr)(struct net_device *dev); * Test if Media Access Control address is valid for the device. * - * int (*ndo_do_ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd); - * Old-style ioctl entry point. This is used internally by the - * appletalk and ieee802154 subsystems but is no longer called by - * the device ioctl handler. - * * int (*ndo_siocbond)(struct net_device *dev, struct ifreq *ifr, int cmd); * Used by the bonding driver for its device specific ioctls: * SIOCBONDENSLAVE, SIOCBONDRELEASE, SIOCBONDSETHWADDR, SIOCBONDCHANGEACTIVE, @@ -1429,8 +1424,6 @@ struct net_device_ops { int (*ndo_set_mac_address)(struct net_device *dev, void *addr); int (*ndo_validate_addr)(struct net_device *dev); - int (*ndo_do_ioctl)(struct net_device *dev, - struct ifreq *ifr, int cmd); int (*ndo_eth_ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd); int (*ndo_siocbond)(struct net_device *dev,