mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-05 12:56:08 +00:00
Implement a basic radar parameter API in the dfs_null module.
Since no actual radar data is ever handled, this won't do anything. It's mostly here as a reference for those who wish to experiment with radar detection. Approved by: re (kib)
This commit is contained in:
parent
9381916024
commit
c5f2a23c79
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=224267
@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <net/bpf.h>
|
||||
|
||||
#ifdef INET
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/if_ether.h>
|
||||
#endif
|
||||
|
||||
@ -141,12 +141,80 @@ ath_dfs_tasklet_needed(struct ath_softc *sc, struct ieee80211_channel *chan)
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle ioctl requests from the diagnostic interface
|
||||
* Handle ioctl requests from the diagnostic interface.
|
||||
*
|
||||
* The initial part of this code resembles ath_ioctl_diag();
|
||||
* it's likely a good idea to reduce duplication between
|
||||
* these two routines.
|
||||
*/
|
||||
int
|
||||
ath_ioctl_phyerr(struct ath_softc *sc, struct ath_diag *ad)
|
||||
{
|
||||
return 1;
|
||||
unsigned int id = ad->ad_id & ATH_DIAG_ID;
|
||||
void *indata = NULL;
|
||||
void *outdata = NULL;
|
||||
u_int32_t insize = ad->ad_in_size;
|
||||
u_int32_t outsize = ad->ad_out_size;
|
||||
int error = 0;
|
||||
HAL_PHYERR_PARAM peout;
|
||||
HAL_PHYERR_PARAM *pe;
|
||||
|
||||
if (ad->ad_id & ATH_DIAG_IN) {
|
||||
/*
|
||||
* Copy in data.
|
||||
*/
|
||||
indata = malloc(insize, M_TEMP, M_NOWAIT);
|
||||
if (indata == NULL) {
|
||||
error = ENOMEM;
|
||||
goto bad;
|
||||
}
|
||||
error = copyin(ad->ad_in_data, indata, insize);
|
||||
if (error)
|
||||
goto bad;
|
||||
}
|
||||
if (ad->ad_id & ATH_DIAG_DYN) {
|
||||
/*
|
||||
* Allocate a buffer for the results (otherwise the HAL
|
||||
* returns a pointer to a buffer where we can read the
|
||||
* results). Note that we depend on the HAL leaving this
|
||||
* pointer for us to use below in reclaiming the buffer;
|
||||
* may want to be more defensive.
|
||||
*/
|
||||
outdata = malloc(outsize, M_TEMP, M_NOWAIT);
|
||||
if (outdata == NULL) {
|
||||
error = ENOMEM;
|
||||
goto bad;
|
||||
}
|
||||
}
|
||||
switch (id) {
|
||||
case DFS_SET_THRESH:
|
||||
if (insize < sizeof(HAL_PHYERR_PARAM)) {
|
||||
error = -EINVAL;
|
||||
break;
|
||||
}
|
||||
pe = (HAL_PHYERR_PARAM *) indata;
|
||||
ath_hal_enabledfs(sc->sc_ah, pe);
|
||||
break;
|
||||
case DFS_GET_THRESH:
|
||||
memset(&peout, 0, sizeof(peout));
|
||||
outsize = sizeof(HAL_PHYERR_PARAM);
|
||||
ath_hal_getdfsthresh(sc->sc_ah, &peout);
|
||||
pe = (HAL_PHYERR_PARAM *) outdata;
|
||||
memcpy(pe, &peout, sizeof(*pe));
|
||||
break;
|
||||
default:
|
||||
error = -EINVAL;
|
||||
}
|
||||
if (outsize < ad->ad_out_size)
|
||||
ad->ad_out_size = outsize;
|
||||
if (outdata && copyout(outdata, ad->ad_out_data, ad->ad_out_size))
|
||||
error = -EFAULT;
|
||||
bad:
|
||||
if ((ad->ad_id & ATH_DIAG_IN) && indata != NULL)
|
||||
free(indata, M_TEMP);
|
||||
if ((ad->ad_id & ATH_DIAG_DYN) && outdata != NULL)
|
||||
free(outdata, M_TEMP);
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user