Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * This file implement the Wireless Extensions spy API.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Authors :	Jean Tourrilhes - HPL - <jt@hpl.hp.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (c) 1997-2007 Jean Tourrilhes, All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * (As all part of the Linux kernel, this file is GPL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/wireless.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/netdevice.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/etherdevice.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/export.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <net/iw_handler.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <net/arp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <net/wext.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) static inline struct iw_spy_data *get_spydata(struct net_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 	/* This is the new way */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	if (dev->wireless_data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 		return dev->wireless_data->spy_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) int iw_handler_set_spy(struct net_device *	dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 		       struct iw_request_info *	info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 		       union iwreq_data *	wrqu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 		       char *			extra)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	struct iw_spy_data *	spydata = get_spydata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	struct sockaddr *	address = (struct sockaddr *) extra;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	/* Make sure driver is not buggy or using the old API */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	if (!spydata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 		return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	/* Disable spy collection while we copy the addresses.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	 * While we copy addresses, any call to wireless_spy_update()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	 * will NOP. This is OK, as anyway the addresses are changing. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	spydata->spy_number = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	/* We want to operate without locking, because wireless_spy_update()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	 * most likely will happen in the interrupt handler, and therefore
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	 * have its own locking constraints and needs performance.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	 * The rtnl_lock() make sure we don't race with the other iw_handlers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	 * This make sure wireless_spy_update() "see" that the spy list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	 * is temporarily disabled. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	smp_wmb();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	/* Are there are addresses to copy? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	if (wrqu->data.length > 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 		int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 		/* Copy addresses */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 		for (i = 0; i < wrqu->data.length; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 			memcpy(spydata->spy_address[i], address[i].sa_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 			       ETH_ALEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 		/* Reset stats */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 		memset(spydata->spy_stat, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 		       sizeof(struct iw_quality) * IW_MAX_SPY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	/* Make sure above is updated before re-enabling */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	smp_wmb();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	/* Enable addresses */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	spydata->spy_number = wrqu->data.length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) EXPORT_SYMBOL(iw_handler_set_spy);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) int iw_handler_get_spy(struct net_device *	dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 		       struct iw_request_info *	info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 		       union iwreq_data *	wrqu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 		       char *			extra)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	struct iw_spy_data *	spydata = get_spydata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	struct sockaddr *	address = (struct sockaddr *) extra;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	int			i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	/* Make sure driver is not buggy or using the old API */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	if (!spydata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 		return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	wrqu->data.length = spydata->spy_number;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	/* Copy addresses. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	for (i = 0; i < spydata->spy_number; i++) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 		memcpy(address[i].sa_data, spydata->spy_address[i], ETH_ALEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 		address[i].sa_family = AF_UNIX;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	/* Copy stats to the user buffer (just after). */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	if (spydata->spy_number > 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 		memcpy(extra  + (sizeof(struct sockaddr) *spydata->spy_number),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 		       spydata->spy_stat,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 		       sizeof(struct iw_quality) * spydata->spy_number);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	/* Reset updated flags. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	for (i = 0; i < spydata->spy_number; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 		spydata->spy_stat[i].updated &= ~IW_QUAL_ALL_UPDATED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) EXPORT_SYMBOL(iw_handler_get_spy);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) /*------------------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)  * Standard Wireless Handler : set spy threshold
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) int iw_handler_set_thrspy(struct net_device *	dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 			  struct iw_request_info *info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 			  union iwreq_data *	wrqu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 			  char *		extra)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	struct iw_spy_data *	spydata = get_spydata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	struct iw_thrspy *	threshold = (struct iw_thrspy *) extra;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	/* Make sure driver is not buggy or using the old API */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	if (!spydata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 		return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	/* Just do it */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	spydata->spy_thr_low = threshold->low;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	spydata->spy_thr_high = threshold->high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	/* Clear flag */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	memset(spydata->spy_thr_under, '\0', sizeof(spydata->spy_thr_under));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) EXPORT_SYMBOL(iw_handler_set_thrspy);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) /*------------------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)  * Standard Wireless Handler : get spy threshold
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) int iw_handler_get_thrspy(struct net_device *	dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 			  struct iw_request_info *info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 			  union iwreq_data *	wrqu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 			  char *		extra)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	struct iw_spy_data *	spydata = get_spydata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	struct iw_thrspy *	threshold = (struct iw_thrspy *) extra;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	/* Make sure driver is not buggy or using the old API */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	if (!spydata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 		return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	/* Just do it */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	threshold->low = spydata->spy_thr_low;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	threshold->high = spydata->spy_thr_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) EXPORT_SYMBOL(iw_handler_get_thrspy);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) /*------------------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)  * Prepare and send a Spy Threshold event
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) static void iw_send_thrspy_event(struct net_device *	dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 				 struct iw_spy_data *	spydata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 				 unsigned char *	address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 				 struct iw_quality *	wstats)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	union iwreq_data	wrqu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	struct iw_thrspy	threshold;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	/* Init */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	wrqu.data.length = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	wrqu.data.flags = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	/* Copy address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	memcpy(threshold.addr.sa_data, address, ETH_ALEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	threshold.addr.sa_family = ARPHRD_ETHER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	/* Copy stats */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	threshold.qual = *wstats;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	/* Copy also thresholds */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	threshold.low = spydata->spy_thr_low;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	threshold.high = spydata->spy_thr_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	/* Send event to user space */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	wireless_send_event(dev, SIOCGIWTHRSPY, &wrqu, (char *) &threshold);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) /* ---------------------------------------------------------------- */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)  * Call for the driver to update the spy data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)  * For now, the spy data is a simple array. As the size of the array is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)  * small, this is good enough. If we wanted to support larger number of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)  * spy addresses, we should use something more efficient...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) void wireless_spy_update(struct net_device *	dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 			 unsigned char *	address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 			 struct iw_quality *	wstats)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	struct iw_spy_data *	spydata = get_spydata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	int			i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	int			match = -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	/* Make sure driver is not buggy or using the old API */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	if (!spydata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	/* Update all records that match */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	for (i = 0; i < spydata->spy_number; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 		if (ether_addr_equal(address, spydata->spy_address[i])) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 			memcpy(&(spydata->spy_stat[i]), wstats,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 			       sizeof(struct iw_quality));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 			match = i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	/* Generate an event if we cross the spy threshold.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	 * To avoid event storms, we have a simple hysteresis : we generate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	 * event only when we go under the low threshold or above the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	 * high threshold. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	if (match >= 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 		if (spydata->spy_thr_under[match]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 			if (wstats->level > spydata->spy_thr_high.level) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 				spydata->spy_thr_under[match] = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 				iw_send_thrspy_event(dev, spydata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 						     address, wstats);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 			if (wstats->level < spydata->spy_thr_low.level) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 				spydata->spy_thr_under[match] = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 				iw_send_thrspy_event(dev, spydata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 						     address, wstats);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) EXPORT_SYMBOL(wireless_spy_update);