Skip to content

Commit

Permalink
Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/bluetooth/bluetooth-next

Johan Hedberg <johan.hedberg@gmail.com> says:

"Here's another bluetooth-next pull request for 3.19. We've got:

 - Various fixes, cleanups and improvements to ieee802154/mac802154
 - Support for a Broadcom BCM20702A1 variant
 - Lots of lockdep fixes
 - Fixed handling of LE CoC errors that should trigger SMP"

Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
John W. Linville committed Nov 18, 2014
2 parents 47b6308 + a86c02e commit f48ecb1
Show file tree
Hide file tree
Showing 43 changed files with 2,214 additions and 365 deletions.
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -4699,6 +4699,7 @@ F: net/mac802154/
F: drivers/net/ieee802154/
F: include/linux/nl802154.h
F: include/linux/ieee802154.h
F: include/net/nl802154.h
F: include/net/mac802154.h
F: include/net/af_ieee802154.h
F: include/net/cfg802154.h
Expand Down
2 changes: 2 additions & 0 deletions drivers/bluetooth/btusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ static const struct usb_device_id btusb_table[] = {
{ USB_DEVICE(0x0b05, 0x17b5) },
{ USB_DEVICE(0x0b05, 0x17cb) },
{ USB_DEVICE(0x413c, 0x8197) },
{ USB_DEVICE(0x13d3, 0x3404),
.driver_info = BTUSB_BCM_PATCHRAM },

/* Foxconn - Hon Hai */
{ USB_VENDOR_AND_INTERFACE_INFO(0x0489, 0xff, 0x01, 0x01) },
Expand Down
2 changes: 1 addition & 1 deletion drivers/bluetooth/hci_ath.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static int ath_wakeup_ar3k(struct tty_struct *tty)

status = tty->driver->ops->tiocmget(tty);

/* Disable Automatic RTSCTS */
/* Enable Automatic RTSCTS */
ktermios.c_cflag |= CRTSCTS;
status = tty_set_termios(tty, &ktermios);

Expand Down
80 changes: 38 additions & 42 deletions drivers/net/ieee802154/at86rf230.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ struct at86rf2xx_chip_data {
u16 t_off_to_tx_on;
u16 t_frame;
u16 t_p_ack;
/* short interframe spacing time */
u16 t_sifs;
/* long interframe spacing time */
u16 t_lifs;
/* completion timeout for tx in msecs */
u16 t_tx_timeout;
int rssi_base_val;
Expand Down Expand Up @@ -719,19 +715,10 @@ at86rf230_tx_complete(void *context)

enable_irq(lp->spi->irq);

if (lp->max_frame_retries <= 0) {
/* Interfame spacing time, which is phy depend.
* TODO
* Move this handling in MAC 802.15.4 layer.
* This is currently a workaround to avoid fragmenation issues.
*/
if (skb->len > 18)
udelay(lp->data->t_lifs);
else
udelay(lp->data->t_sifs);
}

ieee802154_xmit_complete(lp->hw, skb);
if (lp->max_frame_retries <= 0)
ieee802154_xmit_complete(lp->hw, skb, true);
else
ieee802154_xmit_complete(lp->hw, skb, false);
}

static void
Expand Down Expand Up @@ -1038,6 +1025,36 @@ at86rf212_set_channel(struct at86rf230_local *lp, u8 page, u8 channel)
if (rc < 0)
return rc;

/* This sets the symbol_duration according frequency on the 212.
* TODO move this handling while set channel and page in cfg802154.
* We can do that, this timings are according 802.15.4 standard.
* If we do that in cfg802154, this is a more generic calculation.
*
* This should also protected from ifs_timer. Means cancel timer and
* init with a new value. For now, this is okay.
*/
if (channel == 0) {
if (page == 0) {
/* SUB:0 and BPSK:0 -> BPSK-20 */
lp->hw->phy->symbol_duration = 50;
} else {
/* SUB:1 and BPSK:0 -> BPSK-40 */
lp->hw->phy->symbol_duration = 25;
}
} else {
if (page == 0)
/* SUB:0 and BPSK:1 -> OQPSK-100/200/400 */
lp->hw->phy->symbol_duration = 40;
else
/* SUB:1 and BPSK:1 -> OQPSK-250/500/1000 */
lp->hw->phy->symbol_duration = 16;
}

lp->hw->phy->lifs_period = IEEE802154_LIFS_PERIOD *
lp->hw->phy->symbol_duration;
lp->hw->phy->sifs_period = IEEE802154_SIFS_PERIOD *
lp->hw->phy->symbol_duration;

return at86rf230_write_subreg(lp, SR_CHANNEL, channel);
}

Expand All @@ -1047,23 +1064,11 @@ at86rf230_channel(struct ieee802154_hw *hw, u8 page, u8 channel)
struct at86rf230_local *lp = hw->priv;
int rc;

if (page > 31 ||
!(lp->hw->phy->channels_supported[page] & BIT(channel))) {
WARN_ON(1);
return -EINVAL;
}

rc = lp->data->set_channel(lp, page, channel);
if (rc < 0)
return rc;

/* Wait for PLL */
usleep_range(lp->data->t_channel_switch,
lp->data->t_channel_switch + 10);
hw->phy->current_channel = channel;
hw->phy->current_page = page;

return 0;
return rc;
}

static int
Expand Down Expand Up @@ -1179,9 +1184,6 @@ at86rf230_set_csma_params(struct ieee802154_hw *hw, u8 min_be, u8 max_be,
struct at86rf230_local *lp = hw->priv;
int rc;

if (min_be > max_be || max_be > 8 || retries > 5)
return -EINVAL;

rc = at86rf230_write_subreg(lp, SR_MIN_BE, min_be);
if (rc)
return rc;
Expand All @@ -1199,9 +1201,6 @@ at86rf230_set_frame_retries(struct ieee802154_hw *hw, s8 retries)
struct at86rf230_local *lp = hw->priv;
int rc = 0;

if (retries < -1 || retries > 15)
return -EINVAL;

lp->tx_aret = retries >= 0;
lp->max_frame_retries = retries;

Expand Down Expand Up @@ -1263,8 +1262,6 @@ static struct at86rf2xx_chip_data at86rf233_data = {
.t_off_to_tx_on = 80,
.t_frame = 4096,
.t_p_ack = 545,
.t_sifs = 192,
.t_lifs = 640,
.t_tx_timeout = 2000,
.rssi_base_val = -91,
.set_channel = at86rf23x_set_channel,
Expand All @@ -1279,8 +1276,6 @@ static struct at86rf2xx_chip_data at86rf231_data = {
.t_off_to_tx_on = 110,
.t_frame = 4096,
.t_p_ack = 545,
.t_sifs = 192,
.t_lifs = 640,
.t_tx_timeout = 2000,
.rssi_base_val = -91,
.set_channel = at86rf23x_set_channel,
Expand All @@ -1295,8 +1290,6 @@ static struct at86rf2xx_chip_data at86rf212_data = {
.t_off_to_tx_on = 200,
.t_frame = 4096,
.t_p_ack = 545,
.t_sifs = 192,
.t_lifs = 640,
.t_tx_timeout = 2000,
.rssi_base_val = -100,
.set_channel = at86rf212_set_channel,
Expand Down Expand Up @@ -1432,6 +1425,7 @@ at86rf230_detect_device(struct at86rf230_local *lp)
lp->data = &at86rf231_data;
lp->hw->phy->channels_supported[0] = 0x7FFF800;
lp->hw->phy->current_channel = 11;
lp->hw->phy->symbol_duration = 16;
break;
case 7:
chip = "at86rf212";
Expand All @@ -1441,6 +1435,7 @@ at86rf230_detect_device(struct at86rf230_local *lp)
lp->hw->phy->channels_supported[0] = 0x00007FF;
lp->hw->phy->channels_supported[2] = 0x00007FF;
lp->hw->phy->current_channel = 5;
lp->hw->phy->symbol_duration = 25;
} else {
rc = -ENOTSUPP;
}
Expand All @@ -1450,6 +1445,7 @@ at86rf230_detect_device(struct at86rf230_local *lp)
lp->data = &at86rf233_data;
lp->hw->phy->channels_supported[0] = 0x7FFF800;
lp->hw->phy->current_channel = 13;
lp->hw->phy->symbol_duration = 16;
break;
default:
chip = "unkown";
Expand Down
3 changes: 0 additions & 3 deletions drivers/net/ieee802154/fakelb.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ fakelb_hw_channel(struct ieee802154_hw *hw, u8 page, u8 channel)
{
pr_debug("set channel to %d\n", channel);

hw->phy->current_page = page;
hw->phy->current_channel = channel;

return 0;
}

Expand Down
10 changes: 10 additions & 0 deletions include/linux/ieee802154.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,18 @@
#define IEEE802154_MTU 127
#define IEEE802154_MIN_PSDU_LEN 5

#define IEEE802154_PAN_ID_BROADCAST 0xffff
#define IEEE802154_ADDR_SHORT_BROADCAST 0xffff
#define IEEE802154_ADDR_SHORT_UNSPEC 0xfffe

#define IEEE802154_EXTENDED_ADDR_LEN 8

#define IEEE802154_LIFS_PERIOD 40
#define IEEE802154_SIFS_PERIOD 12

#define IEEE802154_MAX_CHANNEL 26
#define IEEE802154_MAX_PAGE 31

#define IEEE802154_FC_TYPE_BEACON 0x0 /* Frame is beacon */
#define IEEE802154_FC_TYPE_DATA 0x1 /* Frame is data */
#define IEEE802154_FC_TYPE_ACK 0x2 /* Frame is acknowledgment */
Expand Down
12 changes: 6 additions & 6 deletions include/net/bluetooth/hci.h
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ struct hci_cp_user_passkey_reply {
struct hci_cp_remote_oob_data_reply {
bdaddr_t bdaddr;
__u8 hash[16];
__u8 randomizer[16];
__u8 rand[16];
} __packed;

#define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY 0x0433
Expand Down Expand Up @@ -731,9 +731,9 @@ struct hci_rp_set_csb {
struct hci_cp_remote_oob_ext_data_reply {
bdaddr_t bdaddr;
__u8 hash192[16];
__u8 randomizer192[16];
__u8 rand192[16];
__u8 hash256[16];
__u8 randomizer256[16];
__u8 rand256[16];
} __packed;

#define HCI_OP_SNIFF_MODE 0x0803
Expand Down Expand Up @@ -940,7 +940,7 @@ struct hci_cp_write_ssp_mode {
struct hci_rp_read_local_oob_data {
__u8 status;
__u8 hash[16];
__u8 randomizer[16];
__u8 rand[16];
} __packed;

#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58
Expand Down Expand Up @@ -1024,9 +1024,9 @@ struct hci_cp_write_sc_support {
struct hci_rp_read_local_oob_ext_data {
__u8 status;
__u8 hash192[16];
__u8 randomizer192[16];
__u8 rand192[16];
__u8 hash256[16];
__u8 randomizer256[16];
__u8 rand256[16];
} __packed;

#define HCI_OP_READ_LOCAL_VERSION 0x1001
Expand Down
16 changes: 9 additions & 7 deletions include/net/bluetooth/hci_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ struct smp_csrk {

struct smp_ltk {
struct list_head list;
struct rcu_head rcu;
bdaddr_t bdaddr;
u8 bdaddr_type;
u8 authenticated;
Expand All @@ -120,6 +121,7 @@ struct smp_ltk {

struct smp_irk {
struct list_head list;
struct rcu_head rcu;
bdaddr_t rpa;
bdaddr_t bdaddr;
u8 addr_type;
Expand All @@ -138,9 +140,9 @@ struct oob_data {
struct list_head list;
bdaddr_t bdaddr;
u8 hash192[16];
u8 randomizer192[16];
u8 rand192[16];
u8 hash256[16];
u8 randomizer256[16];
u8 rand256[16];
};

#define HCI_MAX_SHORT_NAME_LENGTH 10
Expand Down Expand Up @@ -941,10 +943,10 @@ void hci_remote_oob_data_clear(struct hci_dev *hdev);
struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev,
bdaddr_t *bdaddr);
int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr,
u8 *hash, u8 *randomizer);
u8 *hash, u8 *rand);
int hci_add_remote_oob_ext_data(struct hci_dev *hdev, bdaddr_t *bdaddr,
u8 *hash192, u8 *randomizer192,
u8 *hash256, u8 *randomizer256);
u8 *hash192, u8 *rand192,
u8 *hash256, u8 *rand256);
int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr);

void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);
Expand Down Expand Up @@ -1372,8 +1374,8 @@ void mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class,
u8 status);
void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status);
void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192,
u8 *randomizer192, u8 *hash256,
u8 *randomizer256, u8 status);
u8 *rand192, u8 *hash256, u8 *rand256,
u8 status);
void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
u8 addr_type, u8 *dev_class, s8 rssi, u32 flags,
u8 *eir, u16 eir_len, u8 *scan_rsp, u8 scan_rsp_len);
Expand Down
15 changes: 14 additions & 1 deletion include/net/bluetooth/l2cap.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#define __L2CAP_H

#include <asm/unaligned.h>
#include <linux/atomic.h>

/* L2CAP defaults */
#define L2CAP_DEFAULT_MTU 672
Expand Down Expand Up @@ -481,6 +482,7 @@ struct l2cap_chan {
struct hci_conn *hs_hcon;
struct hci_chan *hs_hchan;
struct kref kref;
atomic_t nesting;

__u8 state;

Expand Down Expand Up @@ -713,6 +715,17 @@ enum {
FLAG_HOLD_HCI_CONN,
};

/* Lock nesting levels for L2CAP channels. We need these because lockdep
* otherwise considers all channels equal and will e.g. complain about a
* connection oriented channel triggering SMP procedures or a listening
* channel creating and locking a child channel.
*/
enum {
L2CAP_NESTING_SMP,
L2CAP_NESTING_NORMAL,
L2CAP_NESTING_PARENT,
};

enum {
L2CAP_TX_STATE_XMIT,
L2CAP_TX_STATE_WAIT_F,
Expand Down Expand Up @@ -778,7 +791,7 @@ void l2cap_chan_put(struct l2cap_chan *c);

static inline void l2cap_chan_lock(struct l2cap_chan *chan)
{
mutex_lock(&chan->lock);
mutex_lock_nested(&chan->lock, atomic_read(&chan->nesting));
}

static inline void l2cap_chan_unlock(struct l2cap_chan *chan)
Expand Down
12 changes: 6 additions & 6 deletions include/net/bluetooth/mgmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,28 +299,28 @@ struct mgmt_cp_user_passkey_neg_reply {
#define MGMT_READ_LOCAL_OOB_DATA_SIZE 0
struct mgmt_rp_read_local_oob_data {
__u8 hash[16];
__u8 randomizer[16];
__u8 rand[16];
} __packed;
struct mgmt_rp_read_local_oob_ext_data {
__u8 hash192[16];
__u8 randomizer192[16];
__u8 rand192[16];
__u8 hash256[16];
__u8 randomizer256[16];
__u8 rand256[16];
} __packed;

#define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0021
struct mgmt_cp_add_remote_oob_data {
struct mgmt_addr_info addr;
__u8 hash[16];
__u8 randomizer[16];
__u8 rand[16];
} __packed;
#define MGMT_ADD_REMOTE_OOB_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 32)
struct mgmt_cp_add_remote_oob_ext_data {
struct mgmt_addr_info addr;
__u8 hash192[16];
__u8 randomizer192[16];
__u8 rand192[16];
__u8 hash256[16];
__u8 randomizer256[16];
__u8 rand256[16];
} __packed;
#define MGMT_ADD_REMOTE_OOB_EXT_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 64)

Expand Down
Loading

0 comments on commit f48ecb1

Please sign in to comment.