Added ioctl flow specification command on HCI socket
Subsystems (2)
PATCH 1/1 Added ioctl flow specification command on HCI socket
From: Ilia Kolomisnky <[email protected]>
While it is possible to send flow specification HCI command from the user space directly via the send api of HCI socket, a more specific approach is preferable over the opaque HCI command, since it will allow for centralized mangament of flow specifiaction requests for different l2cap flows over the same acl link in future. This feature was used successfully for solving the qos A2DP issue in piconet with concurent file transfer.
Signed-off-by Ilia Kolomisnky <[email protected]>
--- include/net/bluetooth/hci.h | 38 ++++++++++++--- include/net/bluetooth/hci_core.h | 3 + net/bluetooth/hci_conn.c | 1 + net/bluetooth/hci_core.c | 97 ++++++++++++++++++++++++++++++++++++++ net/bluetooth/hci_event.c | 40 ++++++++++++++++ net/bluetooth/hci_sock.c | 2 + 6 files changed, 174 insertions(+), 7 deletions(-)
include/net/bluetooth/hci.h +31 -7
@@ -109,6 +109,8 @@ enum {#define HCISETLINKMODE _IOW('H', 226, int)#define HCISETACLMTU _IOW('H', 227, int)#define HCISETSCOMTU _IOW('H', 228, int) +#define HCISETFLOWSPEC _IOW('H', 229, int) +#define HCIBLOCKADDR _IOW('H', 230, int)#define HCIUNBLOCKADDR _IOW('H', 231, int)
@@ -264,6 +266,13 @@ enum {#define HCI_LK_SMP_IRK 0x82#define HCI_LK_SMP_CSRK 0x83 +/* Flow specification definitions */ +#define HCI_FS_SERVICETYPE_NO_TRAFFIC 0x00 +#define HCI_FS_SERVICETYPE_BEST_EFFORT 0x01 +#define HCI_FS_SERVICETYPE_GUARANTEED 0x02 +#define HCI_FS_DIR_OUTGOING 0x0 +#define HCI_FS_DIR_INCOMING 0x1 +/* ----- HCI Commands ---- */ #define HCI_OP_NOP 0x0000
@@ -478,6 +487,21 @@ struct hci_cp_exit_sniff_mode {__le16 handle; } __packed; +#define HCI_OP_SET_FLOW_SPEC 0x0807 +struct hci_qos { +__u8 service_type; +__u32 token_rate; +__u32 peak_bandwidth; +__u32 latency; +__u32 delay_variation; +} __packed; +struct hci_cp_flowspec { +__le16 handle; +__u8 flags; +__u8 flowdir; +struct hci_qos flowspec; +} __packed; +#define HCI_OP_ROLE_DISCOVERY 0x0809struct hci_cp_role_discovery {__le16 handle;
@@ -869,13 +893,6 @@ struct hci_ev_remote_version { } __packed;#define HCI_EV_QOS_SETUP_COMPLETE 0x0d -struct hci_qos { -__u8 service_type; -__u32 token_rate; -__u32 peak_bandwidth; -__u32 latency; -__u32 delay_variation; -} __packed;struct hci_ev_qos_setup_complete {__u8 status;__le16 handle;
@@ -1299,4 +1316,11 @@ struct hci_inquiry_req { };#define IREQ_CACHE_FLUSH 0x0001 +struct hci_flowspec_req { +__u16 dev_id; +__u16 handle; +__u8 flowdir; +struct hci_qos flowspec; +} __packed; +#endif /* __HCI_H */
include/net/bluetooth/hci_core.h +3 -0
@@ -291,6 +291,8 @@ struct hci_conn {struct hci_conn *link; +struct hci_qos qos_info; +void (*connect_cfm_cb) (struct hci_conn *conn,u8 status);void (*security_cfm_cb) (struct hci_conn *conn,u8 status);void (*disconn_cfm_cb) (struct hci_conn *conn,u8 reason);
@@ -541,6 +543,7 @@ int hci_get_conn_list(void __user *arg);int hci_get_conn_info (struct hci_dev *hdev,void __user *arg);int hci_get_auth_info (struct hci_dev *hdev,void __user *arg);int hci_inquiry (void __user *arg); +int hci_set_flowspec (void __user *arg);struct bdaddr_list *hci_blacklist_lookup (struct hci_dev *hdev,bdaddr_t *bdaddr);int hci_blacklist_clear (struct hci_dev *hdev);
net/bluetooth/hci_conn.c +1 -0
@@ -359,6 +359,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)switch (type) {case ACL_LINK : conn->pkt_type = hdev->pkt_type &ACL_PTYPE_MASK ; + conn->qos_info.service_type =HCI_FS_SERVICETYPE_BEST_EFFORT ;break ;case SCO_LINK :if (lmp_esco_capable (hdev))
net/bluetooth/hci_core.c +97 -0
109 lines not on this page · raw message
net/bluetooth/hci_event.c +40 -0
@@ -949,6 +949,16 @@ static inline void hci_cc_write_le_host_supported(struct hci_dev *hdev,hci_send_cmd (hdev,HCI_OP_READ_LOCAL_EXT_FEATURES ,sizeof (cp), &cp); } +static void hci_cc_set_flow_spec (struct hci_dev *hdev,struct sk_buff *skb) +{ +__u8 status = *((__u8 *) skb->data); + +BT_DBG ("%s status 0x%x" , hdev->name, status); +if (status) { +hci_req_complete (hdev,HCI_OP_SET_FLOW_SPEC , status); + } +} +static inline void hci_cs_inquiry (struct hci_dev *hdev,__u8 status) {BT_DBG ("%s status 0x%x" , hdev->name, status);
@@ -1775,6 +1785,32 @@ static inline void hci_remote_version_evt(struct hci_dev *hdev, struct sk_buff *static inline void hci_qos_setup_complete_evt (struct hci_dev *hdev,struct sk_buff *skb) {BT_DBG ("%s" , hdev->name); +struct hci_ev_qos_setup_complete *ev = (void *) skb->data; +struct hci_conn *conn; + +BT_DBG ("%s status %d" , hdev->name, ev->status); + +printk (KERN_ERR "hci_qos_setup_complete_evt: %s, st: %d\n" , + hdev->name, ev->status ); + +if (!ev->status) { +hci_dev_lock (hdev); + + conn =hci_conn_hash_lookup_handle (hdev,__le16_to_cpu (ev->handle)); +if (conn) { + conn->qos_info.delay_variation = +le32_to_cpu (ev->qos.delay_variation); + conn->qos_info.latency =le32_to_cpu (ev->qos.latency); + conn->qos_info.peak_bandwidth = +le32_to_cpu (ev->qos.peak_bandwidth); + conn->qos_info.service_type = ev->qos.service_type; + conn->qos_info.token_rate =le32_to_cpu (ev->qos.token_rate); + } + +hci_dev_unlock (hdev); + } + +hci_req_complete (hdev,HCI_OP_SET_FLOW_SPEC , ev->status); }static inline void hci_cmd_complete_evt (struct hci_dev *hdev,struct sk_buff *skb)
@@ -1959,6 +1995,10 @@ static inline void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skhci_cc_write_le_host_supported (hdev, skb);break ; +case HCI_OP_SET_FLOW_SPEC : +hci_cc_set_flow_spec (hdev, skb); +break ; +default :BT_DBG ("%s opcode 0x%x" , hdev->name, opcode);break ;
net/bluetooth/hci_sock.c +2 -0
@@ -298,6 +298,8 @@ static int hci_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long acase HCIINQUIRY :return hci_inquiry (argp); +case HCISETFLOWSPEC : +return hci_set_flowspec (argp);default :lock_sock (sk);
Signature · 1 line
1.7.1