Commit 5f1764dd authored by David S. Miller's avatar David S. Miller

Merge branch 'for-upstream' of...

Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next

Johan Hedberg says:

====================
Here's another set of Bluetooth & ieee802154 patches intended for 4.1:

 - Added support for QCA ROME chipset family in the btusb driver
 - at86rf230 driver fixes & cleanups
 - ieee802154 cleanups
 - Refactoring of Bluetooth mgmt API to allow new users
 - New setting for static Bluetooth address exposed to user space
 - Refactoring of hci_dev flags to remove limit of 32
 - Remove unnecessary fast-connectable setting usage restrictions
 - Fix behavior to be consistent when trying to pair already paired device
 - Service discovery corner-case fixes

Please let me know if there are any issues pulling. Thanks.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 2801be4a b6d595e3
This diff is collapsed.
This diff is collapsed.
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#define IEEE802154_MTU 127 #define IEEE802154_MTU 127
#define IEEE802154_ACK_PSDU_LEN 5 #define IEEE802154_ACK_PSDU_LEN 5
#define IEEE802154_MIN_PSDU_LEN 9 #define IEEE802154_MIN_PSDU_LEN 9
#define IEEE802154_FCS_LEN 2
#define IEEE802154_PAN_ID_BROADCAST 0xffff #define IEEE802154_PAN_ID_BROADCAST 0xffff
#define IEEE802154_ADDR_SHORT_BROADCAST 0xffff #define IEEE802154_ADDR_SHORT_BROADCAST 0xffff
...@@ -39,6 +40,7 @@ ...@@ -39,6 +40,7 @@
#define IEEE802154_LIFS_PERIOD 40 #define IEEE802154_LIFS_PERIOD 40
#define IEEE802154_SIFS_PERIOD 12 #define IEEE802154_SIFS_PERIOD 12
#define IEEE802154_MAX_SIFS_FRAME_SIZE 18
#define IEEE802154_MAX_CHANNEL 26 #define IEEE802154_MAX_CHANNEL 26
#define IEEE802154_MAX_PAGE 31 #define IEEE802154_MAX_PAGE 31
......
...@@ -354,6 +354,9 @@ void l2cap_exit(void); ...@@ -354,6 +354,9 @@ void l2cap_exit(void);
int sco_init(void); int sco_init(void);
void sco_exit(void); void sco_exit(void);
int mgmt_init(void);
void mgmt_exit(void);
void bt_sock_reclassify_lock(struct sock *sk, int proto); void bt_sock_reclassify_lock(struct sock *sk, int proto);
#endif /* __BLUETOOTH_H */ #endif /* __BLUETOOTH_H */
...@@ -179,15 +179,6 @@ enum { ...@@ -179,15 +179,6 @@ enum {
HCI_RESET, HCI_RESET,
}; };
/* BR/EDR and/or LE controller flags: the flags defined here should represent
* states configured via debugfs for debugging and testing purposes only.
*/
enum {
HCI_DUT_MODE,
HCI_FORCE_BREDR_SMP,
HCI_FORCE_STATIC_ADDR,
};
/* /*
* BR/EDR and/or LE controller flags: the flags defined here should represent * BR/EDR and/or LE controller flags: the flags defined here should represent
* states from the controller. * states from the controller.
...@@ -217,6 +208,7 @@ enum { ...@@ -217,6 +208,7 @@ enum {
HCI_HS_ENABLED, HCI_HS_ENABLED,
HCI_LE_ENABLED, HCI_LE_ENABLED,
HCI_ADVERTISING, HCI_ADVERTISING,
HCI_ADVERTISING_CONNECTABLE,
HCI_CONNECTABLE, HCI_CONNECTABLE,
HCI_DISCOVERABLE, HCI_DISCOVERABLE,
HCI_LIMITED_DISCOVERABLE, HCI_LIMITED_DISCOVERABLE,
...@@ -225,13 +217,13 @@ enum { ...@@ -225,13 +217,13 @@ enum {
HCI_FAST_CONNECTABLE, HCI_FAST_CONNECTABLE,
HCI_BREDR_ENABLED, HCI_BREDR_ENABLED,
HCI_LE_SCAN_INTERRUPTED, HCI_LE_SCAN_INTERRUPTED,
};
/* A mask for the flags that are supposed to remain when a reset happens HCI_DUT_MODE,
* or the HCI device is closed. HCI_FORCE_BREDR_SMP,
*/ HCI_FORCE_STATIC_ADDR,
#define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ) | \
BIT(HCI_FAST_CONNECTABLE) | BIT(HCI_LE_ADV)) __HCI_NUM_FLAGS,
};
/* HCI timeouts */ /* HCI timeouts */
#define HCI_DISCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ #define HCI_DISCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
......
...@@ -76,6 +76,7 @@ struct discovery_state { ...@@ -76,6 +76,7 @@ struct discovery_state {
u8 last_adv_data[HCI_MAX_AD_LENGTH]; u8 last_adv_data[HCI_MAX_AD_LENGTH];
u8 last_adv_data_len; u8 last_adv_data_len;
bool report_invalid_rssi; bool report_invalid_rssi;
bool result_filtering;
s8 rssi; s8 rssi;
u16 uuid_count; u16 uuid_count;
u8 (*uuids)[16]; u8 (*uuids)[16];
...@@ -352,8 +353,7 @@ struct hci_dev { ...@@ -352,8 +353,7 @@ struct hci_dev {
struct rfkill *rfkill; struct rfkill *rfkill;
unsigned long dbg_flags; DECLARE_BITMAP(dev_flags, __HCI_NUM_FLAGS);
unsigned long dev_flags;
struct delayed_work le_scan_disable; struct delayed_work le_scan_disable;
struct delayed_work le_scan_restart; struct delayed_work le_scan_restart;
...@@ -501,6 +501,21 @@ extern struct list_head hci_cb_list; ...@@ -501,6 +501,21 @@ extern struct list_head hci_cb_list;
extern rwlock_t hci_dev_list_lock; extern rwlock_t hci_dev_list_lock;
extern struct mutex hci_cb_list_lock; extern struct mutex hci_cb_list_lock;
#define hci_dev_set_flag(hdev, nr) set_bit((nr), (hdev)->dev_flags)
#define hci_dev_clear_flag(hdev, nr) clear_bit((nr), (hdev)->dev_flags)
#define hci_dev_change_flag(hdev, nr) change_bit((nr), (hdev)->dev_flags)
#define hci_dev_test_flag(hdev, nr) test_bit((nr), (hdev)->dev_flags)
#define hci_dev_test_and_set_flag(hdev, nr) test_and_set_bit((nr), (hdev)->dev_flags)
#define hci_dev_test_and_clear_flag(hdev, nr) test_and_clear_bit((nr), (hdev)->dev_flags)
#define hci_dev_test_and_change_flag(hdev, nr) test_and_change_bit((nr), (hdev)->dev_flags)
#define hci_dev_clear_volatile_flags(hdev) \
do { \
hci_dev_clear_flag(hdev, HCI_LE_SCAN); \
hci_dev_clear_flag(hdev, HCI_LE_ADV); \
hci_dev_clear_flag(hdev, HCI_PERIODIC_INQ); \
} while (0)
/* ----- HCI interface to upper protocols ----- */ /* ----- HCI interface to upper protocols ----- */
int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr); int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr);
int l2cap_disconn_ind(struct hci_conn *hcon); int l2cap_disconn_ind(struct hci_conn *hcon);
...@@ -525,6 +540,7 @@ static inline void discovery_init(struct hci_dev *hdev) ...@@ -525,6 +540,7 @@ static inline void discovery_init(struct hci_dev *hdev)
static inline void hci_discovery_filter_clear(struct hci_dev *hdev) static inline void hci_discovery_filter_clear(struct hci_dev *hdev)
{ {
hdev->discovery.result_filtering = false;
hdev->discovery.report_invalid_rssi = true; hdev->discovery.report_invalid_rssi = true;
hdev->discovery.rssi = HCI_RSSI_INVALID; hdev->discovery.rssi = HCI_RSSI_INVALID;
hdev->discovery.uuid_count = 0; hdev->discovery.uuid_count = 0;
...@@ -596,14 +612,14 @@ enum { ...@@ -596,14 +612,14 @@ enum {
static inline bool hci_conn_ssp_enabled(struct hci_conn *conn) static inline bool hci_conn_ssp_enabled(struct hci_conn *conn)
{ {
struct hci_dev *hdev = conn->hdev; struct hci_dev *hdev = conn->hdev;
return test_bit(HCI_SSP_ENABLED, &hdev->dev_flags) && return hci_dev_test_flag(hdev, HCI_SSP_ENABLED) &&
test_bit(HCI_CONN_SSP_ENABLED, &conn->flags); test_bit(HCI_CONN_SSP_ENABLED, &conn->flags);
} }
static inline bool hci_conn_sc_enabled(struct hci_conn *conn) static inline bool hci_conn_sc_enabled(struct hci_conn *conn)
{ {
struct hci_dev *hdev = conn->hdev; struct hci_dev *hdev = conn->hdev;
return test_bit(HCI_SC_ENABLED, &hdev->dev_flags) && return hci_dev_test_flag(hdev, HCI_SC_ENABLED) &&
test_bit(HCI_CONN_SC_ENABLED, &conn->flags); test_bit(HCI_CONN_SC_ENABLED, &conn->flags);
} }
...@@ -965,6 +981,8 @@ struct smp_irk *hci_add_irk(struct hci_dev *hdev, bdaddr_t *bdaddr, ...@@ -965,6 +981,8 @@ struct smp_irk *hci_add_irk(struct hci_dev *hdev, bdaddr_t *bdaddr,
void hci_remove_irk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type); void hci_remove_irk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type);
void hci_smp_irks_clear(struct hci_dev *hdev); void hci_smp_irks_clear(struct hci_dev *hdev);
bool hci_bdaddr_is_paired(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
void hci_remote_oob_data_clear(struct hci_dev *hdev); void hci_remote_oob_data_clear(struct hci_dev *hdev);
struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev, struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev,
bdaddr_t *bdaddr, u8 bdaddr_type); bdaddr_t *bdaddr, u8 bdaddr_type);
...@@ -1021,10 +1039,10 @@ void hci_conn_del_sysfs(struct hci_conn *conn); ...@@ -1021,10 +1039,10 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
#define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE)) #define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE))
#define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR)) #define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR))
#define hdev_is_powered(hdev) (test_bit(HCI_UP, &hdev->flags) && \ #define hdev_is_powered(dev) (test_bit(HCI_UP, &(dev)->flags) && \
!test_bit(HCI_AUTO_OFF, &hdev->dev_flags)) !hci_dev_test_flag(dev, HCI_AUTO_OFF))
#define bredr_sc_enabled(dev) (lmp_sc_capable(dev) && \ #define bredr_sc_enabled(dev) (lmp_sc_capable(dev) && \
test_bit(HCI_SC_ENABLED, &(dev)->dev_flags)) hci_dev_test_flag(dev, HCI_SC_ENABLED))
/* ----- HCI protocols ----- */ /* ----- HCI protocols ----- */
#define HCI_PROTO_DEFER 0x01 #define HCI_PROTO_DEFER 0x01
...@@ -1271,6 +1289,27 @@ void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb); ...@@ -1271,6 +1289,27 @@ void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb);
void hci_sock_dev_event(struct hci_dev *hdev, int event); void hci_sock_dev_event(struct hci_dev *hdev, int event);
#define HCI_MGMT_VAR_LEN (1 << 0)
#define HCI_MGMT_NO_HDEV (1 << 1)
#define HCI_MGMT_UNCONFIGURED (1 << 2)
struct hci_mgmt_handler {
int (*func) (struct sock *sk, struct hci_dev *hdev, void *data,
u16 data_len);
size_t data_len;
unsigned long flags;
};
struct hci_mgmt_chan {
struct list_head list;
unsigned short channel;
size_t handler_count;
const struct hci_mgmt_handler *handlers;
};
int hci_mgmt_chan_register(struct hci_mgmt_chan *c);
void hci_mgmt_chan_unregister(struct hci_mgmt_chan *c);
/* Management interface */ /* Management interface */
#define DISCOV_TYPE_BREDR (BIT(BDADDR_BREDR)) #define DISCOV_TYPE_BREDR (BIT(BDADDR_BREDR))
#define DISCOV_TYPE_LE (BIT(BDADDR_LE_PUBLIC) | \ #define DISCOV_TYPE_LE (BIT(BDADDR_LE_PUBLIC) | \
...@@ -1290,7 +1329,9 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event); ...@@ -1290,7 +1329,9 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event);
#define DISCOV_BREDR_INQUIRY_LEN 0x08 #define DISCOV_BREDR_INQUIRY_LEN 0x08
#define DISCOV_LE_RESTART_DELAY msecs_to_jiffies(200) /* msec */ #define DISCOV_LE_RESTART_DELAY msecs_to_jiffies(200) /* msec */
int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); int mgmt_control(struct hci_mgmt_chan *chan, struct sock *sk,
struct msghdr *msg, size_t msglen);
int mgmt_new_settings(struct hci_dev *hdev); int mgmt_new_settings(struct hci_dev *hdev);
void mgmt_index_added(struct hci_dev *hdev); void mgmt_index_added(struct hci_dev *hdev);
void mgmt_index_removed(struct hci_dev *hdev); void mgmt_index_removed(struct hci_dev *hdev);
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#define MGMT_STATUS_CANCELLED 0x10 #define MGMT_STATUS_CANCELLED 0x10
#define MGMT_STATUS_INVALID_INDEX 0x11 #define MGMT_STATUS_INVALID_INDEX 0x11
#define MGMT_STATUS_RFKILLED 0x12 #define MGMT_STATUS_RFKILLED 0x12
#define MGMT_STATUS_ALREADY_PAIRED 0x13
struct mgmt_hdr { struct mgmt_hdr {
__le16 opcode; __le16 opcode;
...@@ -98,6 +99,7 @@ struct mgmt_rp_read_index_list { ...@@ -98,6 +99,7 @@ struct mgmt_rp_read_index_list {
#define MGMT_SETTING_DEBUG_KEYS 0x00001000 #define MGMT_SETTING_DEBUG_KEYS 0x00001000
#define MGMT_SETTING_PRIVACY 0x00002000 #define MGMT_SETTING_PRIVACY 0x00002000
#define MGMT_SETTING_CONFIGURATION 0x00004000 #define MGMT_SETTING_CONFIGURATION 0x00004000
#define MGMT_SETTING_STATIC_ADDRESS 0x00008000
#define MGMT_OP_READ_INFO 0x0004 #define MGMT_OP_READ_INFO 0x0004
#define MGMT_READ_INFO_SIZE 0 #define MGMT_READ_INFO_SIZE 0
......
...@@ -749,6 +749,13 @@ static int __init bt_init(void) ...@@ -749,6 +749,13 @@ static int __init bt_init(void)
goto sock_err; goto sock_err;
} }
err = mgmt_init();
if (err < 0) {
sco_exit();
l2cap_exit();
goto sock_err;
}
return 0; return 0;
sock_err: sock_err:
...@@ -763,6 +770,8 @@ static int __init bt_init(void) ...@@ -763,6 +770,8 @@ static int __init bt_init(void)
static void __exit bt_exit(void) static void __exit bt_exit(void)
{ {
mgmt_exit();
sco_exit(); sco_exit();
l2cap_exit(); l2cap_exit();
......
...@@ -571,7 +571,7 @@ struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src) ...@@ -571,7 +571,7 @@ struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src)
list_for_each_entry(d, &hci_dev_list, list) { list_for_each_entry(d, &hci_dev_list, list) {
if (!test_bit(HCI_UP, &d->flags) || if (!test_bit(HCI_UP, &d->flags) ||
test_bit(HCI_USER_CHANNEL, &d->dev_flags) || hci_dev_test_flag(d, HCI_USER_CHANNEL) ||
d->dev_type != HCI_BREDR) d->dev_type != HCI_BREDR)
continue; continue;
...@@ -700,7 +700,7 @@ static void hci_req_directed_advertising(struct hci_request *req, ...@@ -700,7 +700,7 @@ static void hci_req_directed_advertising(struct hci_request *req,
* and write a new random address. The flag will be set back on * and write a new random address. The flag will be set back on
* as soon as the SET_ADV_ENABLE HCI command completes. * as soon as the SET_ADV_ENABLE HCI command completes.
*/ */
clear_bit(HCI_LE_ADV, &hdev->dev_flags); hci_dev_clear_flag(hdev, HCI_LE_ADV);
/* Set require_privacy to false so that the remote device has a /* Set require_privacy to false so that the remote device has a
* chance of identifying us. * chance of identifying us.
...@@ -734,7 +734,7 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst, ...@@ -734,7 +734,7 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
int err; int err;
/* Let's make sure that le is enabled.*/ /* Let's make sure that le is enabled.*/
if (!test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) { if (!hci_dev_test_flag(hdev, HCI_LE_ENABLED)) {
if (lmp_le_capable(hdev)) if (lmp_le_capable(hdev))
return ERR_PTR(-ECONNREFUSED); return ERR_PTR(-ECONNREFUSED);
...@@ -799,7 +799,7 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst, ...@@ -799,7 +799,7 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
* anyway have to disable it in order to start directed * anyway have to disable it in order to start directed
* advertising. * advertising.
*/ */
if (test_bit(HCI_LE_ADV, &hdev->dev_flags)) { if (hci_dev_test_flag(hdev, HCI_LE_ADV)) {
u8 enable = 0x00; u8 enable = 0x00;
hci_req_add(&req, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable), hci_req_add(&req, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable),
&enable); &enable);
...@@ -810,7 +810,7 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst, ...@@ -810,7 +810,7 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
/* If we're active scanning most controllers are unable /* If we're active scanning most controllers are unable
* to initiate advertising. Simply reject the attempt. * to initiate advertising. Simply reject the attempt.
*/ */
if (test_bit(HCI_LE_SCAN, &hdev->dev_flags) && if (hci_dev_test_flag(hdev, HCI_LE_SCAN) &&
hdev->le_scan_type == LE_SCAN_ACTIVE) { hdev->le_scan_type == LE_SCAN_ACTIVE) {
skb_queue_purge(&req.cmd_q); skb_queue_purge(&req.cmd_q);
hci_conn_del(conn); hci_conn_del(conn);
...@@ -840,9 +840,9 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst, ...@@ -840,9 +840,9 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
* handler for scan disabling knows to set the correct discovery * handler for scan disabling knows to set the correct discovery
* state. * state.
*/ */
if (test_bit(HCI_LE_SCAN, &hdev->dev_flags)) { if (hci_dev_test_flag(hdev, HCI_LE_SCAN)) {
hci_req_add_le_scan_disable(&req); hci_req_add_le_scan_disable(&req);
set_bit(HCI_LE_SCAN_INTERRUPTED, &hdev->dev_flags); hci_dev_set_flag(hdev, HCI_LE_SCAN_INTERRUPTED);
} }
hci_req_add_le_create_conn(&req, conn); hci_req_add_le_create_conn(&req, conn);
...@@ -864,7 +864,7 @@ struct hci_conn *hci_connect_acl(struct hci_dev *hdev, bdaddr_t *dst, ...@@ -864,7 +864,7 @@ struct hci_conn *hci_connect_acl(struct hci_dev *hdev, bdaddr_t *dst,
{ {
struct hci_conn *acl; struct hci_conn *acl;
if (!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags)) { if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) {
if (lmp_bredr_capable(hdev)) if (lmp_bredr_capable(hdev))
return ERR_PTR(-ECONNREFUSED); return ERR_PTR(-ECONNREFUSED);
...@@ -942,7 +942,7 @@ int hci_conn_check_link_mode(struct hci_conn *conn) ...@@ -942,7 +942,7 @@ int hci_conn_check_link_mode(struct hci_conn *conn)
* Connections is used and the link is encrypted with AES-CCM * Connections is used and the link is encrypted with AES-CCM
* using a P-256 authenticated combination key. * using a P-256 authenticated combination key.
*/ */
if (test_bit(HCI_SC_ONLY, &conn->hdev->flags)) { if (hci_dev_test_flag(conn->hdev, HCI_SC_ONLY)) {
if (!hci_conn_sc_enabled(conn) || if (!hci_conn_sc_enabled(conn) ||
!test_bit(HCI_CONN_AES_CCM, &conn->flags) || !test_bit(HCI_CONN_AES_CCM, &conn->flags) ||
conn->key_type != HCI_LK_AUTH_COMBINATION_P256) conn->key_type != HCI_LK_AUTH_COMBINATION_P256)
......
This diff is collapsed.
...@@ -247,7 +247,7 @@ static ssize_t use_debug_keys_read(struct file *file, char __user *user_buf, ...@@ -247,7 +247,7 @@ static ssize_t use_debug_keys_read(struct file *file, char __user *user_buf,
struct hci_dev *hdev = file->private_data; struct hci_dev *hdev = file->private_data;
char buf[3]; char buf[3];
buf[0] = test_bit(HCI_USE_DEBUG_KEYS, &hdev->dev_flags) ? 'Y': 'N'; buf[0] = hci_dev_test_flag(hdev, HCI_USE_DEBUG_KEYS) ? 'Y': 'N';
buf[1] = '\n'; buf[1] = '\n';
buf[2] = '\0'; buf[2] = '\0';
return simple_read_from_buffer(user_buf, count, ppos, buf, 2); return simple_read_from_buffer(user_buf, count, ppos, buf, 2);
...@@ -265,7 +265,7 @@ static ssize_t sc_only_mode_read(struct file *file, char __user *user_buf, ...@@ -265,7 +265,7 @@ static ssize_t sc_only_mode_read(struct file *file, char __user *user_buf,
struct hci_dev *hdev = file->private_data; struct hci_dev *hdev = file->private_data;
char buf[3]; char buf[3];
buf[0] = test_bit(HCI_SC_ONLY, &hdev->dev_flags) ? 'Y': 'N'; buf[0] = hci_dev_test_flag(hdev, HCI_SC_ONLY) ? 'Y': 'N';
buf[1] = '\n'; buf[1] = '\n';
buf[2] = '\0'; buf[2] = '\0';
return simple_read_from_buffer(user_buf, count, ppos, buf, 2); return simple_read_from_buffer(user_buf, count, ppos, buf, 2);
...@@ -679,7 +679,7 @@ static ssize_t force_static_address_read(struct file *file, ...@@ -679,7 +679,7 @@ static ssize_t force_static_address_read(struct file *file,
struct hci_dev *hdev = file->private_data; struct hci_dev *hdev = file->private_data;
char buf[3]; char buf[3];
buf[0] = test_bit(HCI_FORCE_STATIC_ADDR, &hdev->dbg_flags) ? 'Y': 'N'; buf[0] = hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR) ? 'Y': 'N';
buf[1] = '\n'; buf[1] = '\n';
buf[2] = '\0'; buf[2] = '\0';
return simple_read_from_buffer(user_buf, count, ppos, buf, 2); return simple_read_from_buffer(user_buf, count, ppos, buf, 2);
...@@ -704,10 +704,10 @@ static ssize_t force_static_address_write(struct file *file, ...@@ -704,10 +704,10 @@ static ssize_t force_static_address_write(struct file *file,
if (strtobool(buf, &enable)) if (strtobool(buf, &enable))
return -EINVAL; return -EINVAL;
if (enable == test_bit(HCI_FORCE_STATIC_ADDR, &hdev->dbg_flags)) if (enable == hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR))
return -EALREADY; return -EALREADY;
change_bit(HCI_FORCE_STATIC_ADDR, &hdev->dbg_flags); hci_dev_change_flag(hdev, HCI_FORCE_STATIC_ADDR);
return count; return count;
} }
......
This diff is collapsed.
...@@ -270,7 +270,7 @@ void hci_req_add_le_passive_scan(struct hci_request *req) ...@@ -270,7 +270,7 @@ void hci_req_add_le_passive_scan(struct hci_request *req)
* and 0x01 (whitelist enabled) use the new filter policies * and 0x01 (whitelist enabled) use the new filter policies
* 0x02 (no whitelist) and 0x03 (whitelist enabled). * 0x02 (no whitelist) and 0x03 (whitelist enabled).
*/ */
if (test_bit(HCI_PRIVACY, &hdev->dev_flags) && if (hci_dev_test_flag(hdev, HCI_PRIVACY) &&
(hdev->le_features[0] & HCI_LE_EXT_SCAN_POLICY)) (hdev->le_features[0] & HCI_LE_EXT_SCAN_POLICY))
filter_policy |= 0x02; filter_policy |= 0x02;
...@@ -304,10 +304,10 @@ static void set_random_addr(struct hci_request *req, bdaddr_t *rpa) ...@@ -304,10 +304,10 @@ static void set_random_addr(struct hci_request *req, bdaddr_t *rpa)
* In this kind of scenario skip the update and let the random * In this kind of scenario skip the update and let the random
* address be updated at the next cycle. * address be updated at the next cycle.
*/ */
if (test_bit(HCI_LE_ADV, &hdev->dev_flags) || if (hci_dev_test_flag(hdev, HCI_LE_ADV) ||
hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT)) { hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT)) {
BT_DBG("Deferring random address update"); BT_DBG("Deferring random address update");
set_bit(HCI_RPA_EXPIRED, &hdev->dev_flags); hci_dev_set_flag(hdev, HCI_RPA_EXPIRED);
return; return;
} }
...@@ -324,12 +324,12 @@ int hci_update_random_address(struct hci_request *req, bool require_privacy, ...@@ -324,12 +324,12 @@ int hci_update_random_address(struct hci_request *req, bool require_privacy,
* current RPA has expired or there is something else than * current RPA has expired or there is something else than
* the current RPA in use, then generate a new one. * the current RPA in use, then generate a new one.
*/ */
if (test_bit(HCI_PRIVACY, &hdev->dev_flags)) { if (hci_dev_test_flag(hdev, HCI_PRIVACY)) {
int to; int to;
*own_addr_type = ADDR_LE_DEV_RANDOM; *own_addr_type = ADDR_LE_DEV_RANDOM;
if (!test_and_clear_bit(HCI_RPA_EXPIRED, &hdev->dev_flags) && if (!hci_dev_test_and_clear_flag(hdev, HCI_RPA_EXPIRED) &&
!bacmp(&hdev->random_addr, &hdev->rpa)) !bacmp(&hdev->random_addr, &hdev->rpa))
return 0; return 0;
...@@ -383,9 +383,9 @@ int hci_update_random_address(struct hci_request *req, bool require_privacy, ...@@ -383,9 +383,9 @@ int hci_update_random_address(struct hci_request *req, bool require_privacy,
* and a static address has been configured, then use that * and a static address has been configured, then use that
* address instead of the public BR/EDR address. * address instead of the public BR/EDR address.
*/ */
if (test_bit(HCI_FORCE_STATIC_ADDR, &hdev->dbg_flags) || if (hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR) ||
!bacmp(&hdev->bdaddr, BDADDR_ANY) || !bacmp(&hdev->bdaddr, BDADDR_ANY) ||
(!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags) && (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED) &&
bacmp(&hdev->static_addr, BDADDR_ANY))) { bacmp(&hdev->static_addr, BDADDR_ANY))) {
*own_addr_type = ADDR_LE_DEV_RANDOM; *own_addr_type = ADDR_LE_DEV_RANDOM;
if (bacmp(&hdev->static_addr, &hdev->random_addr)) if (bacmp(&hdev->static_addr, &hdev->random_addr))
...@@ -425,7 +425,7 @@ void __hci_update_page_scan(struct hci_request *req) ...@@ -425,7 +425,7 @@ void __hci_update_page_scan(struct hci_request *req)
struct hci_dev *hdev = req->hdev; struct hci_dev *hdev = req->hdev;
u8 scan; u8 scan;
if (!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags)) if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED))
return; return;
if (!hdev_is_powered(hdev)) if (!hdev_is_powered(hdev))
...@@ -434,7 +434,7 @@ void __hci_update_page_scan(struct hci_request *req) ...@@ -434,7 +434,7 @@ void __hci_update_page_scan(struct hci_request *req)
if (mgmt_powering_down(hdev)) if (mgmt_powering_down(hdev))
return; return;
if (test_bit(HCI_CONNECTABLE, &hdev->dev_flags) || if (hci_dev_test_flag(hdev, HCI_CONNECTABLE) ||
disconnected_whitelist_entries(hdev)) disconnected_whitelist_entries(hdev))
scan = SCAN_PAGE; scan = SCAN_PAGE;
else else
...@@ -443,7 +443,7 @@ void __hci_update_page_scan(struct hci_request *req) ...@@ -443,7 +443,7 @@ void __hci_update_page_scan(struct hci_request *req)
if (test_bit(HCI_PSCAN, &hdev->flags) == !!(scan & SCAN_PAGE)) if (test_bit(HCI_PSCAN, &hdev->flags) == !!(scan & SCAN_PAGE))
return; return;
if (test_bit(HCI_DISCOVERABLE, &hdev->dev_flags)) if (hci_dev_test_flag(hdev, HCI_DISCOVERABLE))
scan |= SCAN_INQUIRY; scan |= SCAN_INQUIRY;
hci_req_add(req, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan); hci_req_add(req, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan);
...@@ -471,14 +471,14 @@ void __hci_update_background_scan(struct hci_request *req) ...@@ -471,14 +471,14 @@ void __hci_update_background_scan(struct hci_request *req)
if (!test_bit(HCI_UP, &hdev->flags) || if (!test_bit(HCI_UP, &hdev->flags) ||
test_bit(HCI_INIT, &hdev->flags) || test_bit(HCI_INIT, &hdev->flags) ||
test_bit(HCI_SETUP, &hdev->dev_flags) || hci_dev_test_flag(hdev, HCI_SETUP) ||
test_bit(HCI_CONFIG, &hdev->dev_flags) || hci_dev_test_flag(hdev, HCI_CONFIG) ||
test_bit(HCI_AUTO_OFF, &hdev->dev_flags) || hci_dev_test_flag(hdev, HCI_AUTO_OFF) ||
test_bit(HCI_UNREGISTER, &hdev->dev_flags)) hci_dev_test_flag(hdev, HCI_UNREGISTER))
return; return;
/* No point in doing scanning if LE support hasn't been enabled */ /* No point in doing scanning if LE support hasn't been enabled */
if (!test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) if (!hci_dev_test_flag(hdev, HCI_LE_ENABLED))
return; return;
/* If discovery is active don't interfere with it */ /* If discovery is active don't interfere with it */
...@@ -502,7 +502,7 @@ void __hci_update_background_scan(struct hci_request *req) ...@@ -502,7 +502,7 @@ void __hci_update_background_scan(struct hci_request *req)
*/ */
/* If controller is not scanning we are done. */ /* If controller is not scanning we are done. */
if (!test_bit(HCI_LE_SCAN, &hdev->dev_flags)) if (!hci_dev_test_flag(hdev, HCI_LE_SCAN))
return; return;
hci_req_add_le_scan_disable(req); hci_req_add_le_scan_disable(req);
...@@ -524,7 +524,7 @@ void __hci_update_background_scan(struct hci_request *req) ...@@ -524,7 +524,7 @@ void __hci_update_background_scan(struct hci_request *req)
/* If controller is currently scanning, we stop it to ensure we /* If controller is currently scanning, we stop it to ensure we
* don't miss any advertising (due to duplicates filter). * don't miss any advertising (due to duplicates filter).
*/ */
if (test_bit(HCI_LE_SCAN, &hdev->dev_flags)) if (hci_dev_test_flag(hdev, HCI_LE_SCAN))
hci_req_add_le_scan_disable(req); hci_req_add_le_scan_disable(req);
hci_req_add_le_passive_scan(req); hci_req_add_le_passive_scan(req);
......
...@@ -31,6 +31,9 @@ ...@@ -31,6 +31,9 @@
#include <net/bluetooth/hci_core.h> #include <net/bluetooth/hci_core.h>
#include <net/bluetooth/hci_mon.h> #include <net/bluetooth/hci_mon.h>
static LIST_HEAD(mgmt_chan_list);
static DEFINE_MUTEX(mgmt_chan_list_lock);
static atomic_t monitor_promisc = ATOMIC_INIT(0); static atomic_t monitor_promisc = ATOMIC_INIT(0);
/* ----- HCI socket interface ----- */ /* ----- HCI socket interface ----- */
...@@ -401,6 +404,56 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event) ...@@ -401,6 +404,56 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event)
} }
} }
static struct hci_mgmt_chan *__hci_mgmt_chan_find(unsigned short channel)
{
struct hci_mgmt_chan *c;
list_for_each_entry(c, &mgmt_chan_list, list) {
if (c->channel == channel)
return c;
}
return NULL;
}
static struct hci_mgmt_chan *hci_mgmt_chan_find(unsigned short channel)
{
struct hci_mgmt_chan *c;
mutex_lock(&mgmt_chan_list_lock);
c = __hci_mgmt_chan_find(channel);
mutex_unlock(&mgmt_chan_list_lock);
return c;
}
int hci_mgmt_chan_register(struct hci_mgmt_chan *c)
{
if (c->channel < HCI_CHANNEL_CONTROL)
return -EINVAL;
mutex_lock(&mgmt_chan_list_lock);
if (__hci_mgmt_chan_find(c->channel)) {
mutex_unlock(&mgmt_chan_list_lock);
return -EALREADY;
}
list_add_tail(&c->list, &mgmt_chan_list);
mutex_unlock(&mgmt_chan_list_lock);
return 0;
}
EXPORT_SYMBOL(hci_mgmt_chan_register);
void hci_mgmt_chan_unregister(struct hci_mgmt_chan *c)
{
mutex_lock(&mgmt_chan_list_lock);
list_del(&c->list);
mutex_unlock(&mgmt_chan_list_lock);
}
EXPORT_SYMBOL(hci_mgmt_chan_unregister);
static int hci_sock_release(struct socket *sock) static int hci_sock_release(struct socket *sock)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
...@@ -421,7 +474,7 @@ static int hci_sock_release(struct socket *sock) ...@@ -421,7 +474,7 @@ static int hci_sock_release(struct socket *sock)
if (hdev) { if (hdev) {
if (hci_pi(sk)->channel == HCI_CHANNEL_USER) { if (hci_pi(sk)->channel == HCI_CHANNEL_USER) {
mgmt_index_added(hdev); mgmt_index_added(hdev);
clear_bit(HCI_USER_CHANNEL, &hdev->dev_flags); hci_dev_clear_flag(hdev, HCI_USER_CHANNEL);
hci_dev_close(hdev->id); hci_dev_close(hdev->id);
} }
...@@ -481,10 +534,10 @@ static int hci_sock_bound_ioctl(struct sock *sk, unsigned int cmd, ...@@ -481,10 +534,10 @@ static int hci_sock_bound_ioctl(struct sock *sk, unsigned int cmd,
if (!hdev) if (!hdev)
return -EBADFD; return -EBADFD;
if (test_bit(HCI_USER_CHANNEL, &hdev->dev_flags)) if (hci_dev_test_flag(hdev, HCI_USER_CHANNEL))
return -EBUSY; return -EBUSY;
if (test_bit(HCI_UNCONFIGURED, &hdev->dev_flags)) if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (hdev->dev_type != HCI_BREDR) if (hdev->dev_type != HCI_BREDR)
...@@ -660,14 +713,14 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr, ...@@ -660,14 +713,14 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr,
if (test_bit(HCI_UP, &hdev->flags) || if (test_bit(HCI_UP, &hdev->flags) ||
test_bit(HCI_INIT, &hdev->flags) || test_bit(HCI_INIT, &hdev->flags) ||
test_bit(HCI_SETUP, &hdev->dev_flags) || hci_dev_test_flag(hdev, HCI_SETUP) ||
test_bit(HCI_CONFIG, &hdev->dev_flags)) { hci_dev_test_flag(hdev, HCI_CONFIG)) {
err = -EBUSY; err = -EBUSY;
hci_dev_put(hdev); hci_dev_put(hdev);
goto done; goto done;
} }
if (test_and_set_bit(HCI_USER_CHANNEL, &hdev->dev_flags)) { if (hci_dev_test_and_set_flag(hdev, HCI_USER_CHANNEL)) {
err = -EUSERS; err = -EUSERS;
hci_dev_put(hdev); hci_dev_put(hdev);
goto done; goto done;
...@@ -677,7 +730,7 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr, ...@@ -677,7 +730,7 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr,
err = hci_dev_open(hdev->id); err = hci_dev_open(hdev->id);
if (err) { if (err) {
clear_bit(HCI_USER_CHANNEL, &hdev->dev_flags); hci_dev_clear_flag(hdev, HCI_USER_CHANNEL);
mgmt_index_added(hdev); mgmt_index_added(hdev);
hci_dev_put(hdev); hci_dev_put(hdev);
goto done; goto done;
...@@ -688,38 +741,39 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr, ...@@ -688,38 +741,39 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr,
hci_pi(sk)->hdev = hdev; hci_pi(sk)->hdev = hdev;
break; break;
case HCI_CHANNEL_CONTROL: case HCI_CHANNEL_MONITOR:
if (haddr.hci_dev != HCI_DEV_NONE) { if (haddr.hci_dev != HCI_DEV_NONE) {
err = -EINVAL; err = -EINVAL;
goto done; goto done;
} }
if (!capable(CAP_NET_ADMIN)) { if (!capable(CAP_NET_RAW)) {
err = -EPERM; err = -EPERM;
goto done; goto done;
} }
send_monitor_replay(sk);
atomic_inc(&monitor_promisc);
break; break;
case HCI_CHANNEL_MONITOR: default:
if (!hci_mgmt_chan_find(haddr.hci_channel)) {
err = -EINVAL;
goto done;
}
if (haddr.hci_dev != HCI_DEV_NONE) { if (haddr.hci_dev != HCI_DEV_NONE) {
err = -EINVAL; err = -EINVAL;
goto done; goto done;
} }
if (!capable(CAP_NET_RAW)) { if (!capable(CAP_NET_ADMIN)) {
err = -EPERM; err = -EPERM;
goto done; goto done;
} }
send_monitor_replay(sk);
atomic_inc(&monitor_promisc);
break; break;
default:
err = -EINVAL;
goto done;
} }
...@@ -833,10 +887,13 @@ static int hci_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, ...@@ -833,10 +887,13 @@ static int hci_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
hci_sock_cmsg(sk, msg, skb); hci_sock_cmsg(sk, msg, skb);
break; break;
case HCI_CHANNEL_USER: case HCI_CHANNEL_USER:
case HCI_CHANNEL_CONTROL:
case HCI_CHANNEL_MONITOR: case HCI_CHANNEL_MONITOR:
sock_recv_timestamp(msg, sk, skb); sock_recv_timestamp(msg, sk, skb);
break; break;
default:
if (hci_mgmt_chan_find(hci_pi(sk)->channel))
sock_recv_timestamp(msg, sk, skb);
break;
} }
skb_free_datagram(sk, skb); skb_free_datagram(sk, skb);
...@@ -848,6 +905,7 @@ static int hci_sock_sendmsg(struct socket *sock, struct msghdr *msg, ...@@ -848,6 +905,7 @@ static int hci_sock_sendmsg(struct socket *sock, struct msghdr *msg,
size_t len) size_t len)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct hci_mgmt_chan *chan;
struct hci_dev *hdev; struct hci_dev *hdev;
struct sk_buff *skb; struct sk_buff *skb;
int err; int err;
...@@ -869,14 +927,18 @@ static int hci_sock_sendmsg(struct socket *sock, struct msghdr *msg, ...@@ -869,14 +927,18 @@ static int hci_sock_sendmsg(struct socket *sock, struct msghdr *msg,
case HCI_CHANNEL_RAW: case HCI_CHANNEL_RAW:
case HCI_CHANNEL_USER: case HCI_CHANNEL_USER:
break; break;
case HCI_CHANNEL_CONTROL:
err = mgmt_control(sk, msg, len);
goto done;
case HCI_CHANNEL_MONITOR: case HCI_CHANNEL_MONITOR:
err = -EOPNOTSUPP; err = -EOPNOTSUPP;
goto done; goto done;
default: default:
err = -EINVAL; mutex_lock(&mgmt_chan_list_lock);
chan = __hci_mgmt_chan_find(hci_pi(sk)->channel);
if (chan)
err = mgmt_control(chan, sk, msg, len);
else
err = -EINVAL;
mutex_unlock(&mgmt_chan_list_lock);
goto done; goto done;
} }
......
...@@ -3900,7 +3900,7 @@ static int l2cap_connect_req(struct l2cap_conn *conn, ...@@ -3900,7 +3900,7 @@ static int l2cap_connect_req(struct l2cap_conn *conn,
return -EPROTO; return -EPROTO;
hci_dev_lock(hdev); hci_dev_lock(hdev);
if (test_bit(HCI_MGMT, &hdev->dev_flags) && if (hci_dev_test_flag(hdev, HCI_MGMT) &&
!test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &hcon->flags)) !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &hcon->flags))
mgmt_device_connected(hdev, hcon, 0, NULL, 0); mgmt_device_connected(hdev, hcon, 0, NULL, 0);
hci_dev_unlock(hdev); hci_dev_unlock(hdev);
...@@ -6987,12 +6987,12 @@ static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon) ...@@ -6987,12 +6987,12 @@ static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon)
conn->local_fixed_chan = L2CAP_FC_SIG_BREDR | L2CAP_FC_CONNLESS; conn->local_fixed_chan = L2CAP_FC_SIG_BREDR | L2CAP_FC_CONNLESS;
if (hcon->type == ACL_LINK && if (hcon->type == ACL_LINK &&
test_bit(HCI_HS_ENABLED, &hcon->hdev->dev_flags)) hci_dev_test_flag(hcon->hdev, HCI_HS_ENABLED))
conn->local_fixed_chan |= L2CAP_FC_A2MP; conn->local_fixed_chan |= L2CAP_FC_A2MP;
if (test_bit(HCI_LE_ENABLED, &hcon->hdev->dev_flags) && if (hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED) &&
(bredr_sc_enabled(hcon->hdev) || (bredr_sc_enabled(hcon->hdev) ||
test_bit(HCI_FORCE_BREDR_SMP, &hcon->hdev->dbg_flags))) hci_dev_test_flag(hcon->hdev, HCI_FORCE_BREDR_SMP)))
conn->local_fixed_chan |= L2CAP_FC_SMP_BREDR; conn->local_fixed_chan |= L2CAP_FC_SMP_BREDR;
mutex_init(&conn->ident_lock); mutex_init(&conn->ident_lock);
...@@ -7112,7 +7112,7 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, ...@@ -7112,7 +7112,7 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
else else
dst_type = ADDR_LE_DEV_RANDOM; dst_type = ADDR_LE_DEV_RANDOM;
if (test_bit(HCI_ADVERTISING, &hdev->dev_flags)) if (hci_dev_test_flag(hdev, HCI_ADVERTISING))
role = HCI_ROLE_SLAVE; role = HCI_ROLE_SLAVE;
else else
role = HCI_ROLE_MASTER; role = HCI_ROLE_MASTER;
......
This diff is collapsed.
...@@ -1231,7 +1231,7 @@ int __init sco_init(void) ...@@ -1231,7 +1231,7 @@ int __init sco_init(void)
return err; return err;
} }
void __exit sco_exit(void) void sco_exit(void)
{ {
bt_procfs_cleanup(&init_net, "sco"); bt_procfs_cleanup(&init_net, "sco");
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
#define SMP_TIMEOUT msecs_to_jiffies(30000) #define SMP_TIMEOUT msecs_to_jiffies(30000)
#define AUTH_REQ_MASK(dev) (test_bit(HCI_SC_ENABLED, &(dev)->dev_flags) ? \ #define AUTH_REQ_MASK(dev) (hci_dev_test_flag(dev, HCI_SC_ENABLED) ? \
0x1f : 0x07) 0x1f : 0x07)
#define KEY_DIST_MASK 0x07 #define KEY_DIST_MASK 0x07
...@@ -589,7 +589,7 @@ static void build_pairing_cmd(struct l2cap_conn *conn, ...@@ -589,7 +589,7 @@ static void build_pairing_cmd(struct l2cap_conn *conn,
struct hci_dev *hdev = hcon->hdev; struct hci_dev *hdev = hcon->hdev;
u8 local_dist = 0, remote_dist = 0, oob_flag = SMP_OOB_NOT_PRESENT; u8 local_dist = 0, remote_dist = 0, oob_flag = SMP_OOB_NOT_PRESENT;
if (test_bit(HCI_BONDABLE, &conn->hcon->hdev->dev_flags)) { if (hci_dev_test_flag(hdev, HCI_BONDABLE)) {
local_dist = SMP_DIST_ENC_KEY | SMP_DIST_SIGN; local_dist = SMP_DIST_ENC_KEY | SMP_DIST_SIGN;
remote_dist = SMP_DIST_ENC_KEY | SMP_DIST_SIGN; remote_dist = SMP_DIST_ENC_KEY | SMP_DIST_SIGN;
authreq |= SMP_AUTH_BONDING; authreq |= SMP_AUTH_BONDING;
...@@ -597,18 +597,18 @@ static void build_pairing_cmd(struct l2cap_conn *conn, ...@@ -597,18 +597,18 @@ static void build_pairing_cmd(struct l2cap_conn *conn,
authreq &= ~SMP_AUTH_BONDING; authreq &= ~SMP_AUTH_BONDING;
} }
if (test_bit(HCI_RPA_RESOLVING, &hdev->dev_flags)) if (hci_dev_test_flag(hdev, HCI_RPA_RESOLVING))
remote_dist |= SMP_DIST_ID_KEY; remote_dist |= SMP_DIST_ID_KEY;
if (test_bit(HCI_PRIVACY, &hdev->dev_flags)) if (hci_dev_test_flag(hdev, HCI_PRIVACY))
local_dist |= SMP_DIST_ID_KEY; local_dist |= SMP_DIST_ID_KEY;
if (test_bit(HCI_SC_ENABLED, &hdev->dev_flags) && if (hci_dev_test_flag(hdev, HCI_SC_ENABLED) &&
(authreq & SMP_AUTH_SC)) { (authreq & SMP_AUTH_SC)) {
struct oob_data *oob_data; struct oob_data *oob_data;
u8 bdaddr_type; u8 bdaddr_type;
if (test_bit(HCI_SSP_ENABLED, &hdev->dev_flags)) { if (hci_dev_test_flag(hdev, HCI_SSP_ENABLED)) {
local_dist |= SMP_DIST_LINK_KEY; local_dist |= SMP_DIST_LINK_KEY;
remote_dist |= SMP_DIST_LINK_KEY; remote_dist |= SMP_DIST_LINK_KEY;
} }
...@@ -692,7 +692,7 @@ static void smp_chan_destroy(struct l2cap_conn *conn) ...@@ -692,7 +692,7 @@ static void smp_chan_destroy(struct l2cap_conn *conn)
* support hasn't been explicitly enabled. * support hasn't been explicitly enabled.
*/ */
if (smp->ltk && smp->ltk->type == SMP_LTK_P256_DEBUG && if (smp->ltk && smp->ltk->type == SMP_LTK_P256_DEBUG &&
!test_bit(HCI_KEEP_DEBUG_KEYS, &hcon->hdev->dev_flags)) { !hci_dev_test_flag(hcon->hdev, HCI_KEEP_DEBUG_KEYS)) {
list_del_rcu(&smp->ltk->list); list_del_rcu(&smp->ltk->list);
kfree_rcu(smp->ltk, rcu); kfree_rcu(smp->ltk, rcu);
smp->ltk = NULL; smp->ltk = NULL;
...@@ -1052,7 +1052,7 @@ static void smp_notify_keys(struct l2cap_conn *conn) ...@@ -1052,7 +1052,7 @@ static void smp_notify_keys(struct l2cap_conn *conn)
/* Don't keep debug keys around if the relevant /* Don't keep debug keys around if the relevant
* flag is not set. * flag is not set.
*/ */
if (!test_bit(HCI_KEEP_DEBUG_KEYS, &hdev->dev_flags) && if (!hci_dev_test_flag(hdev, HCI_KEEP_DEBUG_KEYS) &&
key->type == HCI_LK_DEBUG_COMBINATION) { key->type == HCI_LK_DEBUG_COMBINATION) {
list_del_rcu(&key->list); list_del_rcu(&key->list);
kfree_rcu(key, rcu); kfree_rcu(key, rcu);
...@@ -1604,15 +1604,15 @@ static void build_bredr_pairing_cmd(struct smp_chan *smp, ...@@ -1604,15 +1604,15 @@ static void build_bredr_pairing_cmd(struct smp_chan *smp,
struct hci_dev *hdev = conn->hcon->hdev; struct hci_dev *hdev = conn->hcon->hdev;
u8 local_dist = 0, remote_dist = 0; u8 local_dist = 0, remote_dist = 0;
if (test_bit(HCI_BONDABLE, &hdev->dev_flags)) { if (hci_dev_test_flag(hdev, HCI_BONDABLE)) {
local_dist = SMP_DIST_ENC_KEY | SMP_DIST_SIGN; local_dist = SMP_DIST_ENC_KEY | SMP_DIST_SIGN;
remote_dist = SMP_DIST_ENC_KEY | SMP_DIST_SIGN; remote_dist = SMP_DIST_ENC_KEY | SMP_DIST_SIGN;
} }
if (test_bit(HCI_RPA_RESOLVING, &hdev->dev_flags)) if (hci_dev_test_flag(hdev, HCI_RPA_RESOLVING))
remote_dist |= SMP_DIST_ID_KEY; remote_dist |= SMP_DIST_ID_KEY;
if (test_bit(HCI_PRIVACY, &hdev->dev_flags)) if (hci_dev_test_flag(hdev, HCI_PRIVACY))
local_dist |= SMP_DIST_ID_KEY; local_dist |= SMP_DIST_ID_KEY;
if (!rsp) { if (!rsp) {
...@@ -1664,11 +1664,11 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb) ...@@ -1664,11 +1664,11 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb)
/* We didn't start the pairing, so match remote */ /* We didn't start the pairing, so match remote */
auth = req->auth_req & AUTH_REQ_MASK(hdev); auth = req->auth_req & AUTH_REQ_MASK(hdev);
if (!test_bit(HCI_BONDABLE, &hdev->dev_flags) && if (!hci_dev_test_flag(hdev, HCI_BONDABLE) &&
(auth & SMP_AUTH_BONDING)) (auth & SMP_AUTH_BONDING))
return SMP_PAIRING_NOTSUPP; return SMP_PAIRING_NOTSUPP;
if (test_bit(HCI_SC_ONLY, &hdev->dev_flags) && !(auth & SMP_AUTH_SC)) if (hci_dev_test_flag(hdev, HCI_SC_ONLY) && !(auth & SMP_AUTH_SC))
return SMP_AUTH_REQUIREMENTS; return SMP_AUTH_REQUIREMENTS;
smp->preq[0] = SMP_CMD_PAIRING_REQ; smp->preq[0] = SMP_CMD_PAIRING_REQ;
...@@ -1679,7 +1679,7 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb) ...@@ -1679,7 +1679,7 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb)
if (conn->hcon->type == ACL_LINK) { if (conn->hcon->type == ACL_LINK) {
/* We must have a BR/EDR SC link */ /* We must have a BR/EDR SC link */
if (!test_bit(HCI_CONN_AES_CCM, &conn->hcon->flags) && if (!test_bit(HCI_CONN_AES_CCM, &conn->hcon->flags) &&
!test_bit(HCI_FORCE_BREDR_SMP, &hdev->dbg_flags)) !hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP))
return SMP_CROSS_TRANSP_NOT_ALLOWED; return SMP_CROSS_TRANSP_NOT_ALLOWED;
set_bit(SMP_FLAG_SC, &smp->flags); set_bit(SMP_FLAG_SC, &smp->flags);
...@@ -1743,10 +1743,10 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb) ...@@ -1743,10 +1743,10 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb)
smp->remote_key_dist &= ~SMP_SC_NO_DIST; smp->remote_key_dist &= ~SMP_SC_NO_DIST;
/* Wait for Public Key from Initiating Device */ /* Wait for Public Key from Initiating Device */
return 0; return 0;
} else {
SMP_ALLOW_CMD(smp, SMP_CMD_PAIRING_CONFIRM);
} }
SMP_ALLOW_CMD(smp, SMP_CMD_PAIRING_CONFIRM);
/* Request setup of TK */ /* Request setup of TK */
ret = tk_request(conn, 0, auth, rsp.io_capability, req->io_capability); ret = tk_request(conn, 0, auth, rsp.io_capability, req->io_capability);
if (ret) if (ret)
...@@ -1761,7 +1761,7 @@ static u8 sc_send_public_key(struct smp_chan *smp) ...@@ -1761,7 +1761,7 @@ static u8 sc_send_public_key(struct smp_chan *smp)
BT_DBG(""); BT_DBG("");
if (test_bit(HCI_USE_DEBUG_KEYS, &hdev->dev_flags)) { if (hci_dev_test_flag(hdev, HCI_USE_DEBUG_KEYS)) {
BT_DBG("Using debug keys"); BT_DBG("Using debug keys");
memcpy(smp->local_pk, debug_pk, 64); memcpy(smp->local_pk, debug_pk, 64);
memcpy(smp->local_sk, debug_sk, 32); memcpy(smp->local_sk, debug_sk, 32);
...@@ -1816,7 +1816,7 @@ static u8 smp_cmd_pairing_rsp(struct l2cap_conn *conn, struct sk_buff *skb) ...@@ -1816,7 +1816,7 @@ static u8 smp_cmd_pairing_rsp(struct l2cap_conn *conn, struct sk_buff *skb)
auth = rsp->auth_req & AUTH_REQ_MASK(hdev); auth = rsp->auth_req & AUTH_REQ_MASK(hdev);
if (test_bit(HCI_SC_ONLY, &hdev->dev_flags) && !(auth & SMP_AUTH_SC)) if (hci_dev_test_flag(hdev, HCI_SC_ONLY) && !(auth & SMP_AUTH_SC))
return SMP_AUTH_REQUIREMENTS; return SMP_AUTH_REQUIREMENTS;
smp->prsp[0] = SMP_CMD_PAIRING_RSP; smp->prsp[0] = SMP_CMD_PAIRING_RSP;
...@@ -1926,8 +1926,8 @@ static u8 smp_cmd_pairing_confirm(struct l2cap_conn *conn, struct sk_buff *skb) ...@@ -1926,8 +1926,8 @@ static u8 smp_cmd_pairing_confirm(struct l2cap_conn *conn, struct sk_buff *skb)
if (test_bit(SMP_FLAG_TK_VALID, &smp->flags)) if (test_bit(SMP_FLAG_TK_VALID, &smp->flags))
return smp_confirm(smp); return smp_confirm(smp);
else
set_bit(SMP_FLAG_CFM_PENDING, &smp->flags); set_bit(SMP_FLAG_CFM_PENDING, &smp->flags);
return 0; return 0;
} }
...@@ -2086,7 +2086,7 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb) ...@@ -2086,7 +2086,7 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb)
auth = rp->auth_req & AUTH_REQ_MASK(hdev); auth = rp->auth_req & AUTH_REQ_MASK(hdev);
if (test_bit(HCI_SC_ONLY, &hdev->dev_flags) && !(auth & SMP_AUTH_SC)) if (hci_dev_test_flag(hdev, HCI_SC_ONLY) && !(auth & SMP_AUTH_SC))
return SMP_AUTH_REQUIREMENTS; return SMP_AUTH_REQUIREMENTS;
if (hcon->io_capability == HCI_IO_NO_INPUT_OUTPUT) if (hcon->io_capability == HCI_IO_NO_INPUT_OUTPUT)
...@@ -2107,7 +2107,7 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb) ...@@ -2107,7 +2107,7 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb)
if (!smp) if (!smp)
return SMP_UNSPECIFIED; return SMP_UNSPECIFIED;
if (!test_bit(HCI_BONDABLE, &hcon->hdev->dev_flags) && if (!hci_dev_test_flag(hdev, HCI_BONDABLE) &&
(auth & SMP_AUTH_BONDING)) (auth & SMP_AUTH_BONDING))
return SMP_PAIRING_NOTSUPP; return SMP_PAIRING_NOTSUPP;
...@@ -2141,7 +2141,7 @@ int smp_conn_security(struct hci_conn *hcon, __u8 sec_level) ...@@ -2141,7 +2141,7 @@ int smp_conn_security(struct hci_conn *hcon, __u8 sec_level)
chan = conn->smp; chan = conn->smp;
if (!test_bit(HCI_LE_ENABLED, &hcon->hdev->dev_flags)) if (!hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED))
return 1; return 1;
if (smp_sufficient_security(hcon, sec_level, SMP_USE_LTK)) if (smp_sufficient_security(hcon, sec_level, SMP_USE_LTK))
...@@ -2170,7 +2170,7 @@ int smp_conn_security(struct hci_conn *hcon, __u8 sec_level) ...@@ -2170,7 +2170,7 @@ int smp_conn_security(struct hci_conn *hcon, __u8 sec_level)
authreq = seclevel_to_authreq(sec_level); authreq = seclevel_to_authreq(sec_level);
if (test_bit(HCI_SC_ENABLED, &hcon->hdev->dev_flags)) if (hci_dev_test_flag(hcon->hdev, HCI_SC_ENABLED))
authreq |= SMP_AUTH_SC; authreq |= SMP_AUTH_SC;
/* Require MITM if IO Capability allows or the security level /* Require MITM if IO Capability allows or the security level
...@@ -2606,7 +2606,7 @@ static int smp_sig_channel(struct l2cap_chan *chan, struct sk_buff *skb) ...@@ -2606,7 +2606,7 @@ static int smp_sig_channel(struct l2cap_chan *chan, struct sk_buff *skb)
if (skb->len < 1) if (skb->len < 1)
return -EILSEQ; return -EILSEQ;
if (!test_bit(HCI_LE_ENABLED, &hcon->hdev->dev_flags)) { if (!hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED)) {
reason = SMP_PAIRING_NOTSUPP; reason = SMP_PAIRING_NOTSUPP;
goto done; goto done;
} }
...@@ -2744,16 +2744,16 @@ static void bredr_pairing(struct l2cap_chan *chan) ...@@ -2744,16 +2744,16 @@ static void bredr_pairing(struct l2cap_chan *chan)
return; return;
/* Secure Connections support must be enabled */ /* Secure Connections support must be enabled */
if (!test_bit(HCI_SC_ENABLED, &hdev->dev_flags)) if (!hci_dev_test_flag(hdev, HCI_SC_ENABLED))
return; return;
/* BR/EDR must use Secure Connections for SMP */ /* BR/EDR must use Secure Connections for SMP */
if (!test_bit(HCI_CONN_AES_CCM, &hcon->flags) && if (!test_bit(HCI_CONN_AES_CCM, &hcon->flags) &&
!test_bit(HCI_FORCE_BREDR_SMP, &hdev->dbg_flags)) !hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP))
return; return;
/* If our LE support is not enabled don't do anything */ /* If our LE support is not enabled don't do anything */
if (!test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) if (!hci_dev_test_flag(hdev, HCI_LE_ENABLED))
return; return;
/* Don't bother if remote LE support is not enabled */ /* Don't bother if remote LE support is not enabled */
...@@ -3003,7 +3003,7 @@ static ssize_t force_bredr_smp_read(struct file *file, ...@@ -3003,7 +3003,7 @@ static ssize_t force_bredr_smp_read(struct file *file,
struct hci_dev *hdev = file->private_data; struct hci_dev *hdev = file->private_data;
char buf[3]; char buf[3];
buf[0] = test_bit(HCI_FORCE_BREDR_SMP, &hdev->dbg_flags) ? 'Y': 'N'; buf[0] = hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP) ? 'Y': 'N';
buf[1] = '\n'; buf[1] = '\n';
buf[2] = '\0'; buf[2] = '\0';
return simple_read_from_buffer(user_buf, count, ppos, buf, 2); return simple_read_from_buffer(user_buf, count, ppos, buf, 2);
...@@ -3025,7 +3025,7 @@ static ssize_t force_bredr_smp_write(struct file *file, ...@@ -3025,7 +3025,7 @@ static ssize_t force_bredr_smp_write(struct file *file,
if (strtobool(buf, &enable)) if (strtobool(buf, &enable))
return -EINVAL; return -EINVAL;
if (enable == test_bit(HCI_FORCE_BREDR_SMP, &hdev->dbg_flags)) if (enable == hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP))
return -EALREADY; return -EALREADY;
if (enable) { if (enable) {
...@@ -3044,7 +3044,7 @@ static ssize_t force_bredr_smp_write(struct file *file, ...@@ -3044,7 +3044,7 @@ static ssize_t force_bredr_smp_write(struct file *file,
smp_del_chan(chan); smp_del_chan(chan);
} }
change_bit(HCI_FORCE_BREDR_SMP, &hdev->dbg_flags); hci_dev_change_flag(hdev, HCI_FORCE_BREDR_SMP);
return count; return count;
} }
......
...@@ -113,7 +113,7 @@ static void lowpan_setup(struct net_device *dev) ...@@ -113,7 +113,7 @@ static void lowpan_setup(struct net_device *dev)
{ {
dev->addr_len = IEEE802154_ADDR_LEN; dev->addr_len = IEEE802154_ADDR_LEN;
memset(dev->broadcast, 0xff, IEEE802154_ADDR_LEN); memset(dev->broadcast, 0xff, IEEE802154_ADDR_LEN);
dev->type = ARPHRD_IEEE802154; dev->type = ARPHRD_6LOWPAN;
/* Frame Control + Sequence Number + Address fields + Security Header */ /* Frame Control + Sequence Number + Address fields + Security Header */
dev->hard_header_len = 2 + 1 + 20 + 14; dev->hard_header_len = 2 + 1 + 20 + 14;
dev->needed_tailroom = 2; /* FCS */ dev->needed_tailroom = 2; /* FCS */
......
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
#include "sysfs.h" #include "sysfs.h"
#include "core.h" #include "core.h"
/* name for sysfs, %d is appended */
#define PHY_NAME "phy"
/* RCU-protected (and RTNL for writers) */ /* RCU-protected (and RTNL for writers) */
LIST_HEAD(cfg802154_rdev_list); LIST_HEAD(cfg802154_rdev_list);
int cfg802154_rdev_list_generation; int cfg802154_rdev_list_generation;
...@@ -122,7 +125,7 @@ wpan_phy_new(const struct cfg802154_ops *ops, size_t priv_size) ...@@ -122,7 +125,7 @@ wpan_phy_new(const struct cfg802154_ops *ops, size_t priv_size)
INIT_LIST_HEAD(&rdev->wpan_dev_list); INIT_LIST_HEAD(&rdev->wpan_dev_list);
device_initialize(&rdev->wpan_phy.dev); device_initialize(&rdev->wpan_phy.dev);
dev_set_name(&rdev->wpan_phy.dev, "wpan-phy%d", rdev->wpan_phy_idx); dev_set_name(&rdev->wpan_phy.dev, PHY_NAME "%d", rdev->wpan_phy_idx);
rdev->wpan_phy.dev.class = &wpan_phy_class; rdev->wpan_phy.dev.class = &wpan_phy_class;
rdev->wpan_phy.dev.platform_data = rdev; rdev->wpan_phy.dev.platform_data = rdev;
......
...@@ -76,7 +76,6 @@ static int ieee802154_nl_start_confirm(struct net_device *dev, u8 status) ...@@ -76,7 +76,6 @@ static int ieee802154_nl_start_confirm(struct net_device *dev, u8 status)
nlmsg_free(msg); nlmsg_free(msg);
return -ENOBUFS; return -ENOBUFS;
} }
EXPORT_SYMBOL(ieee802154_nl_start_confirm);
static int ieee802154_nl_fill_iface(struct sk_buff *msg, u32 portid, static int ieee802154_nl_fill_iface(struct sk_buff *msg, u32 portid,
u32 seq, int flags, struct net_device *dev) u32 seq, int flags, struct net_device *dev)
......
...@@ -48,49 +48,6 @@ static ssize_t name_show(struct device *dev, ...@@ -48,49 +48,6 @@ static ssize_t name_show(struct device *dev,
} }
static DEVICE_ATTR_RO(name); static DEVICE_ATTR_RO(name);
#define MASTER_SHOW_COMPLEX(name, format_string, args...) \
static ssize_t name ## _show(struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
struct wpan_phy *phy = container_of(dev, struct wpan_phy, dev); \
int ret; \
\
mutex_lock(&phy->pib_lock); \
ret = snprintf(buf, PAGE_SIZE, format_string "\n", args); \
mutex_unlock(&phy->pib_lock); \
return ret; \
} \
static DEVICE_ATTR_RO(name)
#define MASTER_SHOW(field, format_string) \
MASTER_SHOW_COMPLEX(field, format_string, phy->field)
MASTER_SHOW(current_channel, "%d");
MASTER_SHOW(current_page, "%d");
MASTER_SHOW(transmit_power, "%d +- 1 dB");
MASTER_SHOW_COMPLEX(cca_mode, "%d", phy->cca.mode);
static ssize_t channels_supported_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct wpan_phy *phy = container_of(dev, struct wpan_phy, dev);
int ret;
int i, len = 0;
mutex_lock(&phy->pib_lock);
for (i = 0; i < 32; i++) {
ret = snprintf(buf + len, PAGE_SIZE - len,
"%#09x\n", phy->channels_supported[i]);
if (ret < 0)
break;
len += ret;
}
mutex_unlock(&phy->pib_lock);
return len;
}
static DEVICE_ATTR_RO(channels_supported);
static void wpan_phy_release(struct device *dev) static void wpan_phy_release(struct device *dev)
{ {
struct cfg802154_registered_device *rdev = dev_to_rdev(dev); struct cfg802154_registered_device *rdev = dev_to_rdev(dev);
...@@ -101,12 +58,6 @@ static void wpan_phy_release(struct device *dev) ...@@ -101,12 +58,6 @@ static void wpan_phy_release(struct device *dev)
static struct attribute *pmib_attrs[] = { static struct attribute *pmib_attrs[] = {
&dev_attr_index.attr, &dev_attr_index.attr,
&dev_attr_name.attr, &dev_attr_name.attr,
/* below will be removed soon */
&dev_attr_current_channel.attr,
&dev_attr_current_page.attr,
&dev_attr_channels_supported.attr,
&dev_attr_transmit_power.attr,
&dev_attr_cca_mode.attr,
NULL, NULL,
}; };
ATTRIBUTE_GROUPS(pmib); ATTRIBUTE_GROUPS(pmib);
......
...@@ -65,8 +65,19 @@ void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb, ...@@ -65,8 +65,19 @@ void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb,
{ {
if (ifs_handling) { if (ifs_handling) {
struct ieee802154_local *local = hw_to_local(hw); struct ieee802154_local *local = hw_to_local(hw);
u8 max_sifs_size;
if (skb->len > 18) /* If transceiver sets CRC on his own we need to use lifs
* threshold len above 16 otherwise 18, because it's not
* part of skb->len.
*/
if (hw->flags & IEEE802154_HW_TX_OMIT_CKSUM)
max_sifs_size = IEEE802154_MAX_SIFS_FRAME_SIZE -
IEEE802154_FCS_LEN;
else
max_sifs_size = IEEE802154_MAX_SIFS_FRAME_SIZE;
if (skb->len > max_sifs_size)
hrtimer_start(&local->ifs_timer, hrtimer_start(&local->ifs_timer,
ktime_set(0, hw->phy->lifs_period * NSEC_PER_USEC), ktime_set(0, hw->phy->lifs_period * NSEC_PER_USEC),
HRTIMER_MODE_REL); HRTIMER_MODE_REL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment