From d5a157636110ab738ae1c888f97bd3f805d12ebb Mon Sep 17 00:00:00 2001 From: chao an Date: Mon, 19 Sep 2022 19:55:26 +0800 Subject: [PATCH] net/wireless: add support for netdev private ioctl Signed-off-by: chao an Signed-off-by: caohongwei --- include/nuttx/wireless/wireless.h | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/include/nuttx/wireless/wireless.h b/include/nuttx/wireless/wireless.h index 3dd1e15df19..a016ff655a8 100644 --- a/include/nuttx/wireless/wireless.h +++ b/include/nuttx/wireless/wireless.h @@ -150,6 +150,31 @@ #define SIOCSIWPTAPRIO _WLIOC(0x0039) /* Set PTA priority type */ #define SIOCGIWPTAPRIO _WLIOC(0x003a) /* Get PTA priority type */ +/* -------------------- DEV PRIVATE IOCTL LIST -------------------- */ + +/* These 32 ioctl are wireless device private, for 16 commands. + * Each driver is free to use them for whatever purpose it chooses, + * however the driver *must* export the description of those ioctls + * with SIOCGIWPRIV and *must* use arguments as defined below. + */ + +#define SIOCIWFIRSTPRIV _WLIOC(0x00e0) +#define SIOCIWLASTPRIV _WLIOC(0x00ff) + +/* ------------------------- IOCTL STUFF ------------------------- */ + +/* The first and the last (range) */ + +#define SIOCIWFIRST _WLIOC(0x0000) /* First network command */ +#define SIOCIWLAST SIOCIWLASTPRIV /* 0x8bff */ + +#define IW_IOCTL_IDX(cmd) ((cmd) - SIOCIWFIRST) + +/* Odd : get (world access), even : set (root access) */ + +#define IW_IS_SET(cmd) (!((cmd) & 0x1)) +#define IW_IS_GET(cmd) ((cmd) & 0x1) + #define WL_IS80211POINTERCMD(cmd) ((cmd) == SIOCGIWSCAN || \ (cmd) == SIOCSIWSCAN || \ (cmd) == SIOCSIWCOUNTRY || \ @@ -160,11 +185,6 @@ (cmd) == SIOCGIWESSID || \ (cmd) == SIOCSIWESSID) -/* Device-specific network IOCTL commands *******************************************/ - -#define WL_NETFIRST 0x0000 /* First network command */ -#define WL_NNETCMDS 0x003b /* Number of network commands */ - /* ------------------------------ WIRELESS EVENTS --------------------------------- */ /* Those are *NOT* ioctls, do not issue request on them !!! */