wireless/bluetooth: Add IOCTL commands to support MTU exchange.

This commit is contained in:
Gregory Nutt
2018-04-19 15:51:40 -06:00
parent 0a8dd2a778
commit 71b8d408e2
3 changed files with 122 additions and 17 deletions
+33 -3
View File
@@ -60,7 +60,7 @@
/* Bluetooth network device IOCTL commands. */
#if !defined(WL_BLUETOOTHCMDS) || WL_BLUETOOTHCMDS != 18
#if !defined(WL_BLUETOOTHCMDS) || WL_BLUETOOTHCMDS != 20
# error Incorrect setting for number of Bluetooth IOCTL commands
#endif
@@ -165,6 +165,10 @@
/* GATT
*
* SIOCBTEXCHANGE
* Exchange MTUs
* SIOCBTEXRESULT
* Get the result of the MTU exchange
* SIOCBTDISCOVER
* Starts GATT discovery
* SIOCBTDISCGET
@@ -172,8 +176,10 @@
* SIOCBTDISCGET command was invoked.
*/
#define SIOCBTDISCOVER _WLIOC(WL_BLUETOOTHFIRST + 16)
#define SIOCBTDISCGET _WLIOC(WL_BLUETOOTHFIRST + 17)
#define SIOCBTEXCHANGE _WLIOC(WL_BLUETOOTHFIRST + 16)
#define SIOCBTEXRESULT _WLIOC(WL_BLUETOOTHFIRST + 17)
#define SIOCBTDISCOVER _WLIOC(WL_BLUETOOTHFIRST + 18)
#define SIOCBTDISCGET _WLIOC(WL_BLUETOOTHFIRST + 19)
/* Definitions associated with struct btreg_s *******************************/
/* struct btreq_s union field accessors */
@@ -206,6 +212,11 @@
#define btr_secaddr btru.btrse.btrse_secaddr
#define btr_seclevel btru.btrse.btrse_seclevel
#define btr_expeer btru.btmx.btmx_expeer
#define btr_expending btru.btmxr.mx_pending
#define btr_exresult btru.btmxr.mx_result
#define btr_dtype btru.btrds.btrds_dtype
#define btr_dpeer btru.btrds.btrds_dpeer
#define btr_duuid16 btru.btrds.btrds_duuid16
@@ -263,6 +274,14 @@ struct bt_discresonse_s
uint8_t dr_perm; /* Permissions */
};
/* MTU exchange state variables. */
struct bt_exchangeresult_s
{
bool mx_pending; /* True: We have not yet received the result */
uint8_t mx_result; /* The result of the MTU exchange */
};
/* Bluetooth statistics */
struct bt_stats_s
@@ -362,6 +381,17 @@ struct btreq_s
enum bt_security_e btrse_seclevel; /* Security level */
} btrse;
/* Read-only data that accompanies SIOCBTEXCHANGE command */
struct
{
bt_addr_le_t btmx_expeer; /* Peer address for MTU exchange */
} btmx;
/* Write result that accompanies SIOCBTEXRESULT command */
struct bt_exchangeresult_s btmxr;
/* Read-only data that accompanies SIOCBTDISCOVER command */
struct
+1 -1
View File
@@ -160,7 +160,7 @@
/* Reserved for Bluetooth network devices (see bt_ioctls.h) */
#define WL_BLUETOOTHFIRST (WL_NETFIRST + WL_NNETCMDS)
#define WL_BLUETOOTHCMDS (18)
#define WL_BLUETOOTHCMDS (20)
#define WL_IBLUETOOTHCMD(cmd) (_WLIOCVALID(cmd) && \
_IOC_NR(cmd) >= WL_BLUETOOTHFIRST && \
_IOC_NR(cmd) < (WL_BLUETOOTHFIRST + WL_BLUETOOTHCMDS))