Skip to contentSkip to conversation

appletalk: make localtalk and ppp support conditional

PATCH In review Arnd Bergmann 5 participants 18 messages Oct 11, 2023 – Oct 18, 2023

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/10 appletalk: make localtalk and ppp support conditional

From: Arnd Bergmann <[email protected]>

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.

---
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(-)
include/linux/atalk.h +0 -1
index a55bfc6567d01..2896f2ac9568e 100644
@@ -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);
net/appletalk/Makefile +2 -1
index 33164d972d379..410d52f9113e2 100644
@@ -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
net/appletalk/aarp.c +15 -9
index 9fa0b246902be..b15f67293ac4c 100644
@@ -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
net/appletalk/ddp.c +13 -11
index 8978fb6212ffb..d4dc6a9fd3b6b 100644
@@ -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(&ltalk_packet_type);
-	dev_add_pack(&ppptalk_packet_type);
+	if (IS_ENABLED(CONFIG_DEV_APPLETALK)) {
+		dev_add_pack(&ltalk_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(&ltalk_packet_type);
+	if (IS_ENABLED(CONFIG_DEV_APPLETALK)) {
+		dev_remove_pack(&ppptalk_packet_type);
+		dev_remove_pack(&ltalk_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(&ltalk_packet_type);
-	dev_remove_pack(&ppptalk_packet_type);
+	if (IS_ENABLED(CONFIG_DEV_APPLETALK)) {
+		dev_remove_pack(&ltalk_packet_type);
+		dev_remove_pack(&ppptalk_packet_type);
+	}
 	unregister_snap_client(ddp_dl);
 	sock_unregister(PF_APPLETALK);
 	proto_unregister(&ddp_proto);
Signature · 1 line
2.39.2
#1 lore raw

PATCH v2 2/10 ieee802154: avoid deprecated .ndo_do_ioctl callback

From: Arnd Bergmann <[email protected]>

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.

---
 include/net/cfg802154.h | 9 +++++----
 net/ieee802154/socket.c | 5 +++--
 net/mac802154/iface.c   | 8 ++++----
 3 files changed, 12 insertions(+), 10 deletions(-)
include/net/cfg802154.h +5 -4
index f79ce133e51a7..e604df98e2ee9 100644
@@ -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
 
net/ieee802154/socket.c +3 -2
index 00302e8b9615b..27e58237091ca 100644
@@ -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;
net/mac802154/iface.c +4 -4
index c0e2da5072bea..4937f8c2fb4cc 100644
@@ -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);
 
Signature · 1 line
2.39.2
#2 lore raw

PATCH v2 3/10 ethernet: sp7021: fix ioctl callback pointer

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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")
---
 drivers/net/ethernet/sunplus/spl2sw_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/sunplus/spl2sw_driver.c +1 -1
index 391a1bc7f4463..bb4514f4e8157 100644
@@ -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,
 };
 
Signature · 1 line
2.39.2
#3 lore raw

PATCH v2 4/10 staging: ks7010: remove unused ioctl handler

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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.

---
 drivers/staging/ks7010/ks_wlan_net.c | 21 ---------------------
 1 file changed, 21 deletions(-)
drivers/staging/ks7010/ks_wlan_net.c +0 -21
index 0fb97a79ad0b3..ab7463bb25169 100644
@@ -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,
Signature · 1 line
2.39.2
#4 lore raw

PATCH v2 5/10 staging: rtl8192: remove unused legacy ioctl handlers

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The .ndo_do_ioctl functions are never called, and can just be removed, especially since this is a staging driver.

---
 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(-)
drivers/staging/rtl8192u/ieee80211/dot11d.c +0 -41
index ddaf66fa0f936..8a72c1e9eb1e1 100644
@@ -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);
drivers/staging/rtl8192u/ieee80211/dot11d.h +0 -2
index 8b485fa180898..fd774265211a5 100644
@@ -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 */
drivers/staging/rtl8192u/ieee80211/ieee80211.h +0 -12
index 694d1b18f81c7..fc4201757c408 100644
@@ -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);
 
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +0 -563

611 lines not on this page · raw message

drivers/staging/rtl8192u/r8192U.h +0 -2
index ff0ada00bf414..ef59c785f950a 100644
@@ -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;
drivers/staging/rtl8192u/r8192U_core.c +0 -109

121 lines not on this page · raw message

Signature · 1 line
2.39.2
#5 lore raw

PATCH v2 6/10 staging: rtl8712: remove unused legacy ioctl handlers

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The .ndo_do_ioctl functions are never called, and can just be removed, especially since this is a staging driver.

---
 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(-)
drivers/staging/rtl8712/os_intfs.c +0 -1
index b18e6d9c832b8..121edffbd2507 100644
@@ -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)
drivers/staging/rtl8712/osdep_intf.h +0 -2
index 9e75116c987ec..ce823030bfec2 100644
@@ -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_*/
drivers/staging/rtl8712/rtl871x_ioctl_linux.c +0 -124

136 lines not on this page · raw message

Signature · 1 line
2.39.2
#6 lore raw

PATCH v2 7/10 staging: rtl8723bs: remove dead code

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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.

---
 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
drivers/staging/rtl8723bs/Makefile +0 -1
index 590bde02058c7..0f3f6dea4955e 100644
@@ -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 \
drivers/staging/rtl8723bs/include/osdep_intf.h +0 -32
index 111e0179712ac..83a25598e9627 100644
@@ -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);
drivers/staging/rtl8723bs/include/rtw_io.h +0 -1
index e98083a07a660..f92093e73fe67 100644
@@ -72,7 +72,6 @@
 
 #define _INTF_ASYNC_	BIT(0)	/* support async io */
 
-struct intf_priv;
 struct intf_hdl;
 struct io_queue;
 
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c deleted +0 -1300

1,300 lines not on this page · raw message

drivers/staging/rtl8723bs/os_dep/os_intfs.c +0 -29
index 68bba3c0e757a..90564fbb78f34 100644
@@ -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)
drivers/staging/rtl8723bs/os_dep/sdio_intf.c +1 -22
index 4904314845242..effe4ffac54eb 100644
@@ -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);
Signature · 1 line
2.39.2
#7 lore raw

PATCH v2 8/10 wifi: atmel: remove unused ioctl function

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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.

---
 drivers/staging/wireless/atmel/atmel.c | 72 --------------------------
 1 file changed, 72 deletions(-)
drivers/staging/wireless/atmel/atmel.c +0 -72
index 7c2d1c588156d..461dce21de2b0 100644
@@ -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;
Signature · 1 line
2.39.2
#9 lore raw

PATCH v2 9/10 wifi: hostap: remove unused ioctl function

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The ioctl handler has no actual callers in the kernel and is useless. All the functionality should be reachable through the regualar interfaces.

---
 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(-)
drivers/staging/wireless/hostap/hostap.h +0 -1
index c17ab6dbbb538..552ae33d78751 100644
@@ -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);
 
drivers/staging/wireless/hostap/hostap_ioctl.c +0 -228

246 lines not on this page · raw message

drivers/staging/wireless/hostap/hostap_main.c +0 -3
index 787f685e70b49..bf86ac26c2acc 100644
@@ -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,
Signature · 1 line
2.39.2
#10 lore raw

PATCH v2 10/10 net: remove ndo_do_ioctl handler

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

All of the references to the callback pointer are gone, so remove the pointer itself before we grow new references to it.

---
 Documentation/networking/netdevices.rst | 8 --------
 include/linux/netdevice.h               | 7 -------
 2 files changed, 15 deletions(-)
Documentation/networking/netdevices.rst +0 -8
index 9e4cccb90b870..6f9b71c5d37b8 100644
@@ -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
include/linux/netdevice.h +0 -7
index e070a4540fbaf..8d1cc8f195cb6 100644
@@ -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,
Signature · 1 line
2.39.2
#12 lore raw
Quoted 1 line · Jiri Pirko

Could you provide a cover letter for the set please?

Subject: [PATCH v2 00/10] remove final .ndo_do_ioctl references

The .ndo_do_ioctl() netdev operation used to be how one communicates with a network driver from userspace, but since my previous cleanup [1], it is purely internal to the kernel.

Removing the cops appletalk/localtalk driver made me revisit the missing pieces from that older series, removing all the unused implementations in wireless drivers as well as the two kernel-internal callers in the ieee802154 and appletalk stacks.

One ethernet driver was already merged in the meantime that should have used .ndo_eth_ioctl instead of .ndo_do_ioctl, so fix that as well. With the complete removal, any future drivers making this mistake cause build failures that are easier to spot.

[1] https://lore.kernel.org/netdev/[email protected]/

----
Hope that helps, I had commented on the cops removal about sending this but of course not everyone here saw that. Let me know if I should resend the patches together with the cover letter.

Arnd

#13 lore raw
Quoted 14 lines · Wed, Oct 11, 2023 at 05:57:38PM CEST, [email protected] wrote:
Quoted 1 line · Jiri Pirko

Could you provide a cover letter for the set please?

Subject: [PATCH v2 00/10] remove final .ndo_do_ioctl references

The .ndo_do_ioctl() netdev operation used to be how one communicates with a network driver from userspace, but since my previous cleanup [1], it is purely internal to the kernel.

Removing the cops appletalk/localtalk driver made me revisit the missing pieces from that older series, removing all the unused implementations in wireless drivers as well as the two kernel-internal callers in the ieee802154 and appletalk stacks.

Quoted 4 lines

One ethernet driver was already merged in the meantime that should have used .ndo_eth_ioctl instead of .ndo_do_ioctl, so fix that as well. With the complete removal, any future drivers making this mistake cause build failures that are easier to spot.

Looks fine.

Quoted 7 lines

[1] https://lore.kernel.org/netdev/[email protected]/

----
Hope that helps, I had commented on the cops removal about sending this but of course not everyone here saw that. Let me know if I should resend the patches together with the cover letter.

Yes please. Thanks!

Quoted 2 lines

Arnd

maintainer
#14 lore raw
In reply to Arnd Bergmann
Quoted 9 lines · On Wed, 11 Oct 2023 17:57:38 +0200 Arnd Bergmann wrote:

The .ndo_do_ioctl() netdev operation used to be how one communicates with a network driver from userspace, but since my previous cleanup [1], it is purely internal to the kernel.

Removing the cops appletalk/localtalk driver made me revisit the missing pieces from that older series, removing all the unused implementations in wireless drivers as well as the two kernel-internal callers in the ieee802154 and appletalk stacks.

Quoted 6 lines

One ethernet driver was already merged in the meantime that should have used .ndo_eth_ioctl instead of .ndo_do_ioctl, so fix that as well. With the complete removal, any future drivers making this mistake cause build failures that are easier to spot.

[1] https://lore.kernel.org/netdev/[email protected]/

Kalle, Johannes, do these apply for you?
I'm getting a small conflict on patch 8 and bigger one on patch 9. If this applies for you maybe you can take it and flush out wireless-next soon after?

#15 lore raw
Quoted 15 lines · Jakub Kicinski
Quoted 14 lines · On Wed, 11 Oct 2023 17:57:38 +0200 Arnd Bergmann wrote:

The .ndo_do_ioctl() netdev operation used to be how one communicates with a network driver from userspace, but since my previous cleanup [1], it is purely internal to the kernel.

Removing the cops appletalk/localtalk driver made me revisit the missing pieces from that older series, removing all the unused implementations in wireless drivers as well as the two kernel-internal callers in the ieee802154 and appletalk stacks.

One ethernet driver was already merged in the meantime that should have used .ndo_eth_ioctl instead of .ndo_do_ioctl, so fix that as well. With the complete removal, any future drivers making this mistake cause build failures that are easier to spot.

Quoted 4 lines
Quoted 1 line

[1] https://lore.kernel.org/netdev/[email protected]/

Kalle, Johannes, do these apply for you?
I'm getting a small conflict on patch 8 and bigger one on patch 9.

Yes, 'git am -3' was able to solve the conflicts automatically and these do apply to wireless-next.

Quoted 2 lines

If this applies for you maybe you can take it and flush out wireless-next soon after?

Ok, we'll do that. Does next Wednesday sound soon enough? :)

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#8 lore raw

Re: [PATCH v2 08/10] wifi: atmel: remove unused ioctl function

In reply to Arnd Bergmann
Quoted 7 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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.

2 patches applied to wireless-next.git, thanks.

166ab7ca3418 wifi: atmel: remove unused ioctl function f35ccb65bd18 wifi: hostap: remove unused ioctl function

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
maintainer
#16 lore raw
In reply to Arnd Bergmann
Quoted 10 lines · On Wed, 11 Oct 2023 16:02:16 +0200 Arnd Bergmann wrote:

From: Arnd Bergmann <[email protected]>

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.

Quoted 5 lines

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.

Hi Arnd, the WiFi changes are now in net, could you rebase & repost?

maintainer
#17 lore raw
Quoted 1 line · On Tue, 17 Oct 2023 17:22:02 -0700 Jakub Kicinski wrote:

Hi Arnd, the WiFi changes are now in net, could you rebase & repost?

s/net/net-next/ to be more clear this time..