mirror of
https://github.com/armbian/linux.git
synced 2026-01-06 10:13:00 -08:00
Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next
Johan Hedberg say: ==================== pull request: bluetooth-next 2014-12-31 Here's the first batch of bluetooth patches for 3.20. - Cleanups & fixes to ieee802154 drivers - Fix synchronization of mgmt commands with respective HCI commands - Add self-tests for LE pairing crypto functionality - Remove 'BlueFritz!' specific handling from core using a new quirk flag - Public address configuration support for ath3012 - Refactor debugfs support into a dedicated file - Initial support for LE Data Length Extension feature from Bluetooth 4.2 Please let me know if there are any issues pulling. Thanks. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -696,6 +696,8 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
|
||||
hdev->flush = bfusb_flush;
|
||||
hdev->send = bfusb_send_frame;
|
||||
|
||||
set_bit(HCI_QUIRK_BROKEN_LOCAL_COMMANDS, &hdev->quirks);
|
||||
|
||||
if (hci_register_dev(hdev) < 0) {
|
||||
BT_ERR("Can't register HCI device");
|
||||
hci_free_dev(hdev);
|
||||
|
||||
@@ -49,6 +49,7 @@ static struct usb_driver btusb_driver;
|
||||
#define BTUSB_INTEL_BOOT 0x200
|
||||
#define BTUSB_BCM_PATCHRAM 0x400
|
||||
#define BTUSB_MARVELL 0x800
|
||||
#define BTUSB_AVM 0x1000
|
||||
|
||||
static const struct usb_device_id btusb_table[] = {
|
||||
/* Generic Bluetooth USB device */
|
||||
@@ -85,7 +86,7 @@ static const struct usb_device_id btusb_table[] = {
|
||||
{ USB_DEVICE(0x05ac, 0x8281) },
|
||||
|
||||
/* AVM BlueFRITZ! USB v2.0 */
|
||||
{ USB_DEVICE(0x057c, 0x3800) },
|
||||
{ USB_DEVICE(0x057c, 0x3800), .driver_info = BTUSB_AVM },
|
||||
|
||||
/* Bluetooth Ultraport Module from IBM */
|
||||
{ USB_DEVICE(0x04bf, 0x030a) },
|
||||
@@ -1943,6 +1944,31 @@ static int btusb_set_bdaddr_bcm(struct hci_dev *hdev, const bdaddr_t *bdaddr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int btusb_set_bdaddr_ath3012(struct hci_dev *hdev,
|
||||
const bdaddr_t *bdaddr)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
u8 buf[10];
|
||||
long ret;
|
||||
|
||||
buf[0] = 0x01;
|
||||
buf[1] = 0x01;
|
||||
buf[2] = 0x00;
|
||||
buf[3] = sizeof(bdaddr_t);
|
||||
memcpy(buf + 4, bdaddr, sizeof(bdaddr_t));
|
||||
|
||||
skb = __hci_cmd_sync(hdev, 0xfc0b, sizeof(buf), buf, HCI_INIT_TIMEOUT);
|
||||
if (IS_ERR(skb)) {
|
||||
ret = PTR_ERR(skb);
|
||||
BT_ERR("%s: Change address command failed (%ld)",
|
||||
hdev->name, ret);
|
||||
return ret;
|
||||
}
|
||||
kfree_skb(skb);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int btusb_probe(struct usb_interface *intf,
|
||||
const struct usb_device_id *id)
|
||||
{
|
||||
@@ -2055,9 +2081,15 @@ static int btusb_probe(struct usb_interface *intf,
|
||||
if (id->driver_info & BTUSB_MARVELL)
|
||||
hdev->set_bdaddr = btusb_set_bdaddr_marvell;
|
||||
|
||||
if (id->driver_info & BTUSB_AVM)
|
||||
set_bit(HCI_QUIRK_BROKEN_LOCAL_COMMANDS, &hdev->quirks);
|
||||
|
||||
if (id->driver_info & BTUSB_INTEL_BOOT)
|
||||
set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks);
|
||||
|
||||
if (id->driver_info & BTUSB_ATH3012)
|
||||
hdev->set_bdaddr = btusb_set_bdaddr_ath3012;
|
||||
|
||||
/* Interface numbers are hardcoded in the specification */
|
||||
data->isoc = usb_ifnum_to_if(data->udev, 1);
|
||||
|
||||
|
||||
@@ -450,7 +450,7 @@ at86rf230_async_error_recover(void *context)
|
||||
ieee802154_wake_queue(lp->hw);
|
||||
}
|
||||
|
||||
static void
|
||||
static inline void
|
||||
at86rf230_async_error(struct at86rf230_local *lp,
|
||||
struct at86rf230_state_change *ctx, int rc)
|
||||
{
|
||||
@@ -524,7 +524,6 @@ at86rf230_async_state_assert(void *context)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dev_warn(&lp->spi->dev, "unexcept state change from 0x%02x to 0x%02x. Actual state: 0x%02x\n",
|
||||
ctx->from_state, ctx->to_state, trx_state);
|
||||
}
|
||||
@@ -655,7 +654,7 @@ at86rf230_async_state_change_start(void *context)
|
||||
if (ctx->irq_enable)
|
||||
enable_irq(lp->spi->irq);
|
||||
|
||||
at86rf230_async_error(lp, &lp->state, rc);
|
||||
at86rf230_async_error(lp, ctx, rc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -715,10 +714,7 @@ at86rf230_tx_complete(void *context)
|
||||
|
||||
enable_irq(lp->spi->irq);
|
||||
|
||||
if (lp->max_frame_retries <= 0)
|
||||
ieee802154_xmit_complete(lp->hw, skb, true);
|
||||
else
|
||||
ieee802154_xmit_complete(lp->hw, skb, false);
|
||||
ieee802154_xmit_complete(lp->hw, skb, !lp->tx_aret);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -753,16 +749,13 @@ at86rf230_tx_trac_check(void *context)
|
||||
* to STATE_FORCE_TRX_OFF then STATE_TX_ON to recover the transceiver
|
||||
* state to TX_ON.
|
||||
*/
|
||||
if (trac) {
|
||||
if (trac)
|
||||
at86rf230_async_state_change(lp, ctx, STATE_FORCE_TRX_OFF,
|
||||
at86rf230_tx_trac_error, true);
|
||||
return;
|
||||
}
|
||||
|
||||
at86rf230_tx_on(context);
|
||||
else
|
||||
at86rf230_tx_on(context);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
at86rf230_tx_trac_status(void *context)
|
||||
{
|
||||
@@ -1082,7 +1075,7 @@ at86rf230_set_hw_addr_filt(struct ieee802154_hw *hw,
|
||||
u16 addr = le16_to_cpu(filt->short_addr);
|
||||
|
||||
dev_vdbg(&lp->spi->dev,
|
||||
"at86rf230_set_hw_addr_filt called for saddr\n");
|
||||
"at86rf230_set_hw_addr_filt called for saddr\n");
|
||||
__at86rf230_write(lp, RG_SHORT_ADDR_0, addr);
|
||||
__at86rf230_write(lp, RG_SHORT_ADDR_1, addr >> 8);
|
||||
}
|
||||
@@ -1091,7 +1084,7 @@ at86rf230_set_hw_addr_filt(struct ieee802154_hw *hw,
|
||||
u16 pan = le16_to_cpu(filt->pan_id);
|
||||
|
||||
dev_vdbg(&lp->spi->dev,
|
||||
"at86rf230_set_hw_addr_filt called for pan id\n");
|
||||
"at86rf230_set_hw_addr_filt called for pan id\n");
|
||||
__at86rf230_write(lp, RG_PAN_ID_0, pan);
|
||||
__at86rf230_write(lp, RG_PAN_ID_1, pan >> 8);
|
||||
}
|
||||
@@ -1101,14 +1094,14 @@ at86rf230_set_hw_addr_filt(struct ieee802154_hw *hw,
|
||||
|
||||
memcpy(addr, &filt->ieee_addr, 8);
|
||||
dev_vdbg(&lp->spi->dev,
|
||||
"at86rf230_set_hw_addr_filt called for IEEE addr\n");
|
||||
"at86rf230_set_hw_addr_filt called for IEEE addr\n");
|
||||
for (i = 0; i < 8; i++)
|
||||
__at86rf230_write(lp, RG_IEEE_ADDR_0 + i, addr[i]);
|
||||
}
|
||||
|
||||
if (changed & IEEE802154_AFILT_PANC_CHANGED) {
|
||||
dev_vdbg(&lp->spi->dev,
|
||||
"at86rf230_set_hw_addr_filt called for panc change\n");
|
||||
"at86rf230_set_hw_addr_filt called for panc change\n");
|
||||
if (filt->pan_coord)
|
||||
at86rf230_write_subreg(lp, SR_AACK_I_AM_COORD, 1);
|
||||
else
|
||||
@@ -1146,11 +1139,37 @@ at86rf230_set_lbt(struct ieee802154_hw *hw, bool on)
|
||||
}
|
||||
|
||||
static int
|
||||
at86rf230_set_cca_mode(struct ieee802154_hw *hw, u8 mode)
|
||||
at86rf230_set_cca_mode(struct ieee802154_hw *hw,
|
||||
const struct wpan_phy_cca *cca)
|
||||
{
|
||||
struct at86rf230_local *lp = hw->priv;
|
||||
u8 val;
|
||||
|
||||
return at86rf230_write_subreg(lp, SR_CCA_MODE, mode);
|
||||
/* mapping 802.15.4 to driver spec */
|
||||
switch (cca->mode) {
|
||||
case NL802154_CCA_ENERGY:
|
||||
val = 1;
|
||||
break;
|
||||
case NL802154_CCA_CARRIER:
|
||||
val = 2;
|
||||
break;
|
||||
case NL802154_CCA_ENERGY_CARRIER:
|
||||
switch (cca->opt) {
|
||||
case NL802154_CCA_OPT_ENERGY_CARRIER_AND:
|
||||
val = 3;
|
||||
break;
|
||||
case NL802154_CCA_OPT_ENERGY_CARRIER_OR:
|
||||
val = 0;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return at86rf230_write_subreg(lp, SR_CCA_MODE, val);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -1400,7 +1419,7 @@ at86rf230_detect_device(struct at86rf230_local *lp)
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
rc = __at86rf230_read(lp, RG_PART_NUM, &version);
|
||||
rc = __at86rf230_read(lp, RG_VERSION_NUM, &version);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
@@ -1410,11 +1429,12 @@ at86rf230_detect_device(struct at86rf230_local *lp)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
lp->hw->extra_tx_headroom = 0;
|
||||
lp->hw->flags = IEEE802154_HW_TX_OMIT_CKSUM | IEEE802154_HW_AACK |
|
||||
IEEE802154_HW_TXPOWER | IEEE802154_HW_ARET |
|
||||
IEEE802154_HW_AFILT | IEEE802154_HW_PROMISCUOUS;
|
||||
|
||||
lp->hw->phy->cca.mode = NL802154_CCA_ENERGY;
|
||||
|
||||
switch (part) {
|
||||
case 2:
|
||||
chip = "at86rf230";
|
||||
@@ -1429,16 +1449,12 @@ at86rf230_detect_device(struct at86rf230_local *lp)
|
||||
break;
|
||||
case 7:
|
||||
chip = "at86rf212";
|
||||
if (version == 1) {
|
||||
lp->data = &at86rf212_data;
|
||||
lp->hw->flags |= IEEE802154_HW_LBT;
|
||||
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;
|
||||
}
|
||||
lp->data = &at86rf212_data;
|
||||
lp->hw->flags |= IEEE802154_HW_LBT;
|
||||
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;
|
||||
break;
|
||||
case 11:
|
||||
chip = "at86rf233";
|
||||
@@ -1448,7 +1464,7 @@ at86rf230_detect_device(struct at86rf230_local *lp)
|
||||
lp->hw->phy->symbol_duration = 16;
|
||||
break;
|
||||
default:
|
||||
chip = "unkown";
|
||||
chip = "unknown";
|
||||
rc = -ENOTSUPP;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/pinctrl/consumer.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/ieee802154.h>
|
||||
|
||||
@@ -513,7 +512,6 @@ err_tx:
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
static int cc2520_rx(struct cc2520_private *priv)
|
||||
{
|
||||
u8 len = 0, lqi = 0, bytes = 1;
|
||||
@@ -652,6 +650,7 @@ static int cc2520_register(struct cc2520_private *priv)
|
||||
priv->hw->parent = &priv->spi->dev;
|
||||
priv->hw->extra_tx_headroom = 0;
|
||||
priv->hw->vif_data_size = sizeof(*priv);
|
||||
ieee802154_random_extended_addr(&priv->hw->phy->perm_extended_addr);
|
||||
|
||||
/* We do support only 2.4 Ghz */
|
||||
priv->hw->phy->channels_supported[0] = 0x7FFF800;
|
||||
@@ -842,24 +841,15 @@ done:
|
||||
static int cc2520_probe(struct spi_device *spi)
|
||||
{
|
||||
struct cc2520_private *priv;
|
||||
struct pinctrl *pinctrl;
|
||||
struct cc2520_platform_data *pdata;
|
||||
int ret;
|
||||
|
||||
priv = devm_kzalloc(&spi->dev,
|
||||
sizeof(struct cc2520_private), GFP_KERNEL);
|
||||
if (!priv) {
|
||||
ret = -ENOMEM;
|
||||
goto err_ret;
|
||||
}
|
||||
priv = devm_kzalloc(&spi->dev, sizeof(*priv), GFP_KERNEL);
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
|
||||
spi_set_drvdata(spi, priv);
|
||||
|
||||
pinctrl = devm_pinctrl_get_select_default(&spi->dev);
|
||||
if (IS_ERR(pinctrl))
|
||||
dev_warn(&spi->dev,
|
||||
"pinctrl pins are not configured\n");
|
||||
|
||||
pdata = cc2520_get_platform_data(spi);
|
||||
if (!pdata) {
|
||||
dev_err(&spi->dev, "no platform data\n");
|
||||
@@ -870,10 +860,8 @@ static int cc2520_probe(struct spi_device *spi)
|
||||
|
||||
priv->buf = devm_kzalloc(&spi->dev,
|
||||
SPI_COMMAND_BUFFER, GFP_KERNEL);
|
||||
if (!priv->buf) {
|
||||
ret = -ENOMEM;
|
||||
goto err_ret;
|
||||
}
|
||||
if (!priv->buf)
|
||||
return -ENOMEM;
|
||||
|
||||
mutex_init(&priv->buffer_mutex);
|
||||
INIT_WORK(&priv->fifop_irqwork, cc2520_fifop_irqwork);
|
||||
@@ -947,7 +935,6 @@ static int cc2520_probe(struct spi_device *spi)
|
||||
if (ret)
|
||||
goto err_hw_init;
|
||||
|
||||
|
||||
gpio_set_value(pdata->vreg, HIGH);
|
||||
usleep_range(100, 150);
|
||||
|
||||
@@ -991,8 +978,6 @@ static int cc2520_probe(struct spi_device *spi)
|
||||
err_hw_init:
|
||||
mutex_destroy(&priv->buffer_mutex);
|
||||
flush_work(&priv->fifop_irqwork);
|
||||
|
||||
err_ret:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -289,7 +289,7 @@ static int mrf24j40_read_rx_buf(struct mrf24j40 *devrec,
|
||||
goto out;
|
||||
|
||||
/* Range check the RX FIFO length, accounting for the one-byte
|
||||
* length field at the begining. */
|
||||
* length field at the beginning. */
|
||||
if (rx_len > RX_FIFO_SIZE-1) {
|
||||
dev_err(printdev(devrec), "Invalid length read from device. Performing short read.\n");
|
||||
rx_len = RX_FIFO_SIZE-1;
|
||||
@@ -323,7 +323,7 @@ static int mrf24j40_read_rx_buf(struct mrf24j40 *devrec,
|
||||
|
||||
#ifdef DEBUG
|
||||
print_hex_dump(KERN_DEBUG, "mrf24j40 rx: ",
|
||||
DUMP_PREFIX_OFFSET, 16, 1, data, *len, 0);
|
||||
DUMP_PREFIX_OFFSET, 16, 1, data, *len, 0);
|
||||
pr_debug("mrf24j40 rx: lqi: %02hhx rssi: %02hhx\n",
|
||||
lqi_rssi[0], lqi_rssi[1]);
|
||||
#endif
|
||||
@@ -521,7 +521,7 @@ static int mrf24j40_filter(struct ieee802154_hw *hw,
|
||||
*/
|
||||
|
||||
dev_dbg(printdev(devrec), "Set Pan Coord to %s\n",
|
||||
filt->pan_coord ? "on" : "off");
|
||||
filt->pan_coord ? "on" : "off");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -102,6 +102,16 @@ enum {
|
||||
*/
|
||||
HCI_QUIRK_FIXUP_BUFFER_SIZE,
|
||||
|
||||
/* When this quirk is set, then the HCI Read Local Supported
|
||||
* Commands command is not supported. In general Bluetooth 1.2
|
||||
* and later controllers should support this command. However
|
||||
* some controllers indicate Bluetooth 1.2 support, but do
|
||||
* not support this command.
|
||||
*
|
||||
* This quirk must be set before hci_register_dev is called.
|
||||
*/
|
||||
HCI_QUIRK_BROKEN_LOCAL_COMMANDS,
|
||||
|
||||
/* When this quirk is set, then no stored link key handling
|
||||
* is performed. This is mainly due to the fact that the
|
||||
* HCI Delete Stored Link Key command is advertised, but
|
||||
@@ -343,6 +353,7 @@ enum {
|
||||
#define HCI_LE_ENCRYPTION 0x01
|
||||
#define HCI_LE_CONN_PARAM_REQ_PROC 0x02
|
||||
#define HCI_LE_PING 0x10
|
||||
#define HCI_LE_DATA_LEN_EXT 0x20
|
||||
#define HCI_LE_EXT_SCAN_POLICY 0x80
|
||||
|
||||
/* Connection modes */
|
||||
@@ -1371,6 +1382,39 @@ struct hci_cp_le_conn_param_req_neg_reply {
|
||||
__u8 reason;
|
||||
} __packed;
|
||||
|
||||
#define HCI_OP_LE_SET_DATA_LEN 0x2022
|
||||
struct hci_cp_le_set_data_len {
|
||||
__le16 handle;
|
||||
__le16 tx_len;
|
||||
__le16 tx_time;
|
||||
} __packed;
|
||||
struct hci_rp_le_set_data_len {
|
||||
__u8 status;
|
||||
__le16 handle;
|
||||
} __packed;
|
||||
|
||||
#define HCI_OP_LE_READ_DEF_DATA_LEN 0x2023
|
||||
struct hci_rp_le_read_def_data_len {
|
||||
__u8 status;
|
||||
__le16 tx_len;
|
||||
__le16 tx_time;
|
||||
} __packed;
|
||||
|
||||
#define HCI_OP_LE_WRITE_DEF_DATA_LEN 0x2024
|
||||
struct hci_cp_le_write_def_data_len {
|
||||
__le16 tx_len;
|
||||
__le16 tx_time;
|
||||
} __packed;
|
||||
|
||||
#define HCI_OP_LE_READ_MAX_DATA_LEN 0x202f
|
||||
struct hci_rp_le_read_max_data_len {
|
||||
__u8 status;
|
||||
__le16 tx_len;
|
||||
__le16 tx_time;
|
||||
__le16 rx_len;
|
||||
__le16 rx_time;
|
||||
} __packed;
|
||||
|
||||
/* ---- HCI Events ---- */
|
||||
#define HCI_EV_INQUIRY_COMPLETE 0x01
|
||||
|
||||
@@ -1796,6 +1840,15 @@ struct hci_ev_le_remote_conn_param_req {
|
||||
__le16 timeout;
|
||||
} __packed;
|
||||
|
||||
#define HCI_EV_LE_DATA_LEN_CHANGE 0x07
|
||||
struct hci_ev_le_data_len_change {
|
||||
__le16 handle;
|
||||
__le16 tx_len;
|
||||
__le16 tx_time;
|
||||
__le16 rx_len;
|
||||
__le16 rx_time;
|
||||
} __packed;
|
||||
|
||||
#define HCI_EV_LE_DIRECT_ADV_REPORT 0x0B
|
||||
struct hci_ev_le_direct_adv_info {
|
||||
__u8 evt_type;
|
||||
|
||||
@@ -220,6 +220,12 @@ struct hci_dev {
|
||||
__u16 le_conn_max_interval;
|
||||
__u16 le_conn_latency;
|
||||
__u16 le_supv_timeout;
|
||||
__u16 le_def_tx_len;
|
||||
__u16 le_def_tx_time;
|
||||
__u16 le_max_tx_len;
|
||||
__u16 le_max_tx_time;
|
||||
__u16 le_max_rx_len;
|
||||
__u16 le_max_rx_time;
|
||||
__u16 discov_interleaved_timeout;
|
||||
__u16 conn_info_min_age;
|
||||
__u16 conn_info_max_age;
|
||||
@@ -434,6 +440,7 @@ struct hci_conn {
|
||||
struct delayed_work le_conn_timeout;
|
||||
|
||||
struct device dev;
|
||||
struct dentry *debugfs;
|
||||
|
||||
struct hci_dev *hdev;
|
||||
void *l2cap_data;
|
||||
@@ -920,8 +927,6 @@ struct hci_conn_params *hci_conn_params_lookup(struct hci_dev *hdev,
|
||||
bdaddr_t *addr, u8 addr_type);
|
||||
struct hci_conn_params *hci_conn_params_add(struct hci_dev *hdev,
|
||||
bdaddr_t *addr, u8 addr_type);
|
||||
int hci_conn_params_set(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type,
|
||||
u8 auto_connect);
|
||||
void hci_conn_params_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type);
|
||||
void hci_conn_params_clear_all(struct hci_dev *hdev);
|
||||
void hci_conn_params_clear_disabled(struct hci_dev *hdev);
|
||||
@@ -930,8 +935,6 @@ struct hci_conn_params *hci_pend_le_action_lookup(struct list_head *list,
|
||||
bdaddr_t *addr,
|
||||
u8 addr_type);
|
||||
|
||||
void hci_update_background_scan(struct hci_dev *hdev);
|
||||
|
||||
void hci_uuids_clear(struct hci_dev *hdev);
|
||||
|
||||
void hci_link_keys_clear(struct hci_dev *hdev);
|
||||
@@ -1284,30 +1287,8 @@ static inline int hci_check_conn_params(u16 min, u16 max, u16 latency,
|
||||
int hci_register_cb(struct hci_cb *hcb);
|
||||
int hci_unregister_cb(struct hci_cb *hcb);
|
||||
|
||||
struct hci_request {
|
||||
struct hci_dev *hdev;
|
||||
struct sk_buff_head cmd_q;
|
||||
|
||||
/* If something goes wrong when building the HCI request, the error
|
||||
* value is stored in this field.
|
||||
*/
|
||||
int err;
|
||||
};
|
||||
|
||||
void hci_req_init(struct hci_request *req, struct hci_dev *hdev);
|
||||
int hci_req_run(struct hci_request *req, hci_req_complete_t complete);
|
||||
void hci_req_add(struct hci_request *req, u16 opcode, u32 plen,
|
||||
const void *param);
|
||||
void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen,
|
||||
const void *param, u8 event);
|
||||
void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status);
|
||||
bool hci_req_pending(struct hci_dev *hdev);
|
||||
|
||||
void hci_req_add_le_scan_disable(struct hci_request *req);
|
||||
void hci_req_add_le_passive_scan(struct hci_request *req);
|
||||
|
||||
void hci_update_page_scan(struct hci_dev *hdev, struct hci_request *req);
|
||||
|
||||
struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen,
|
||||
const void *param, u32 timeout);
|
||||
struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen,
|
||||
@@ -1417,8 +1398,6 @@ u8 hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, u16 latency,
|
||||
void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __le64 rand,
|
||||
__u8 ltk[16]);
|
||||
|
||||
int hci_update_random_address(struct hci_request *req, bool require_privacy,
|
||||
u8 *own_addr_type);
|
||||
void hci_copy_identity_address(struct hci_dev *hdev, bdaddr_t *bdaddr,
|
||||
u8 *bdaddr_type);
|
||||
|
||||
|
||||
@@ -248,6 +248,7 @@ struct l2cap_conn_rsp {
|
||||
#define L2CAP_PSM_SDP 0x0001
|
||||
#define L2CAP_PSM_RFCOMM 0x0003
|
||||
#define L2CAP_PSM_3DSP 0x0021
|
||||
#define L2CAP_PSM_IPSP 0x0023 /* 6LoWPAN */
|
||||
|
||||
/* channel identifier */
|
||||
#define L2CAP_CID_SIGNALING 0x0001
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
#ifndef __RFCOMM_H
|
||||
#define __RFCOMM_H
|
||||
|
||||
#define RFCOMM_PSM 3
|
||||
|
||||
#define RFCOMM_CONN_TIMEOUT (HZ * 30)
|
||||
#define RFCOMM_DISC_TIMEOUT (HZ * 20)
|
||||
#define RFCOMM_AUTH_TIMEOUT (HZ * 25)
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <net/nl802154.h>
|
||||
|
||||
struct wpan_phy;
|
||||
struct wpan_phy_cca;
|
||||
|
||||
struct cfg802154_ops {
|
||||
struct net_device * (*add_virtual_intf_deprecated)(struct wpan_phy *wpan_phy,
|
||||
@@ -39,6 +40,8 @@ struct cfg802154_ops {
|
||||
int (*del_virtual_intf)(struct wpan_phy *wpan_phy,
|
||||
struct wpan_dev *wpan_dev);
|
||||
int (*set_channel)(struct wpan_phy *wpan_phy, u8 page, u8 channel);
|
||||
int (*set_cca_mode)(struct wpan_phy *wpan_phy,
|
||||
const struct wpan_phy_cca *cca);
|
||||
int (*set_pan_id)(struct wpan_phy *wpan_phy,
|
||||
struct wpan_dev *wpan_dev, __le16 pan_id);
|
||||
int (*set_short_addr)(struct wpan_phy *wpan_phy,
|
||||
@@ -56,6 +59,11 @@ struct cfg802154_ops {
|
||||
struct wpan_dev *wpan_dev, bool mode);
|
||||
};
|
||||
|
||||
struct wpan_phy_cca {
|
||||
enum nl802154_cca_modes mode;
|
||||
enum nl802154_cca_opts opt;
|
||||
};
|
||||
|
||||
struct wpan_phy {
|
||||
struct mutex pib_lock;
|
||||
|
||||
@@ -76,7 +84,7 @@ struct wpan_phy {
|
||||
u8 current_page;
|
||||
u32 channels_supported[IEEE802154_MAX_PAGE + 1];
|
||||
s8 transmit_power;
|
||||
u8 cca_mode;
|
||||
struct wpan_phy_cca cca;
|
||||
|
||||
__le64 perm_extended_addr;
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/ieee802154.h>
|
||||
|
||||
#include <net/cfg802154.h>
|
||||
|
||||
struct ieee802154_sechdr {
|
||||
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
||||
u8 level:3,
|
||||
@@ -337,7 +339,7 @@ struct ieee802154_mac_params {
|
||||
s8 frame_retries;
|
||||
|
||||
bool lbt;
|
||||
u8 cca_mode;
|
||||
struct wpan_phy_cca cca;
|
||||
s32 cca_ed_level;
|
||||
};
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include <linux/ieee802154.h>
|
||||
#include <linux/skbuff.h>
|
||||
|
||||
#include <net/cfg802154.h>
|
||||
|
||||
/* General MAC frame format:
|
||||
* 2 bytes: Frame Control
|
||||
* 1 byte: Sequence Number
|
||||
@@ -212,7 +214,8 @@ struct ieee802154_ops {
|
||||
unsigned long changed);
|
||||
int (*set_txpower)(struct ieee802154_hw *hw, int db);
|
||||
int (*set_lbt)(struct ieee802154_hw *hw, bool on);
|
||||
int (*set_cca_mode)(struct ieee802154_hw *hw, u8 mode);
|
||||
int (*set_cca_mode)(struct ieee802154_hw *hw,
|
||||
const struct wpan_phy_cca *cca);
|
||||
int (*set_cca_ed_level)(struct ieee802154_hw *hw,
|
||||
s32 level);
|
||||
int (*set_csma_params)(struct ieee802154_hw *hw,
|
||||
|
||||
@@ -82,7 +82,7 @@ enum nl802154_attrs {
|
||||
NL802154_ATTR_TX_POWER,
|
||||
|
||||
NL802154_ATTR_CCA_MODE,
|
||||
NL802154_ATTR_CCA_MODE3_AND,
|
||||
NL802154_ATTR_CCA_OPT,
|
||||
NL802154_ATTR_CCA_ED_LEVEL,
|
||||
|
||||
NL802154_ATTR_MAX_FRAME_RETRIES,
|
||||
@@ -119,4 +119,47 @@ enum nl802154_iftype {
|
||||
NL802154_IFTYPE_MAX = NUM_NL802154_IFTYPES - 1
|
||||
};
|
||||
|
||||
/**
|
||||
* enum nl802154_cca_modes - cca modes
|
||||
*
|
||||
* @__NL802154_CCA_INVALID: cca mode number 0 is reserved
|
||||
* @NL802154_CCA_ENERGY: Energy above threshold
|
||||
* @NL802154_CCA_CARRIER: Carrier sense only
|
||||
* @NL802154_CCA_ENERGY_CARRIER: Carrier sense with energy above threshold
|
||||
* @NL802154_CCA_ALOHA: CCA shall always report an idle medium
|
||||
* @NL802154_CCA_UWB_SHR: UWB preamble sense based on the SHR of a frame
|
||||
* @NL802154_CCA_UWB_MULTIPEXED: UWB preamble sense based on the packet with
|
||||
* the multiplexed preamble
|
||||
* @__NL802154_CCA_ATTR_AFTER_LAST: Internal
|
||||
* @NL802154_CCA_ATTR_MAX: Maximum CCA attribute number
|
||||
*/
|
||||
enum nl802154_cca_modes {
|
||||
__NL802154_CCA_INVALID,
|
||||
NL802154_CCA_ENERGY,
|
||||
NL802154_CCA_CARRIER,
|
||||
NL802154_CCA_ENERGY_CARRIER,
|
||||
NL802154_CCA_ALOHA,
|
||||
NL802154_CCA_UWB_SHR,
|
||||
NL802154_CCA_UWB_MULTIPEXED,
|
||||
|
||||
/* keep last */
|
||||
__NL802154_CCA_ATTR_AFTER_LAST,
|
||||
NL802154_CCA_ATTR_MAX = __NL802154_CCA_ATTR_AFTER_LAST - 1
|
||||
};
|
||||
|
||||
/**
|
||||
* enum nl802154_cca_opts - additional options for cca modes
|
||||
*
|
||||
* @NL802154_CCA_OPT_ENERGY_CARRIER_OR: NL802154_CCA_ENERGY_CARRIER with OR
|
||||
* @NL802154_CCA_OPT_ENERGY_CARRIER_AND: NL802154_CCA_ENERGY_CARRIER with AND
|
||||
*/
|
||||
enum nl802154_cca_opts {
|
||||
NL802154_CCA_OPT_ENERGY_CARRIER_AND,
|
||||
NL802154_CCA_OPT_ENERGY_CARRIER_OR,
|
||||
|
||||
/* keep last */
|
||||
__NL802154_CCA_OPT_ATTR_AFTER_LAST,
|
||||
NL802154_CCA_OPT_ATTR_MAX = __NL802154_CCA_OPT_ATTR_AFTER_LAST - 1
|
||||
};
|
||||
|
||||
#endif /* __NL802154_H */
|
||||
|
||||
@@ -64,4 +64,31 @@ config BT_6LOWPAN
|
||||
help
|
||||
IPv6 compression over Bluetooth Low Energy.
|
||||
|
||||
config BT_SELFTEST
|
||||
bool "Bluetooth self testing support"
|
||||
depends on BT && DEBUG_KERNEL
|
||||
help
|
||||
Run self tests when initializing the Bluetooth subsystem. This
|
||||
is a developer option and can cause significant delay when booting
|
||||
the system.
|
||||
|
||||
When the Bluetooth subsystem is built as module, then the test
|
||||
cases are run first thing at module load time. When the Bluetooth
|
||||
subsystem is compiled into the kernel image, then the test cases
|
||||
are run late in the initcall hierarchy.
|
||||
|
||||
config BT_SELFTEST_ECDH
|
||||
bool "ECDH test cases"
|
||||
depends on BT_LE && BT_SELFTEST
|
||||
help
|
||||
Run test cases for ECDH cryptographic functionality used by the
|
||||
Bluetooth Low Energy Secure Connections feature.
|
||||
|
||||
config BT_SELFTEST_SMP
|
||||
bool "SMP test cases"
|
||||
depends on BT_LE && BT_SELFTEST
|
||||
help
|
||||
Run test cases for SMP cryptographic functionality, including both
|
||||
legacy SMP as well as the Secure Connections features.
|
||||
|
||||
source "drivers/bluetooth/Kconfig"
|
||||
|
||||
@@ -13,6 +13,8 @@ bluetooth_6lowpan-y := 6lowpan.o
|
||||
|
||||
bluetooth-y := af_bluetooth.o hci_core.o hci_conn.o hci_event.o mgmt.o \
|
||||
hci_sock.o hci_sysfs.o l2cap_core.o l2cap_sock.o smp.o sco.o lib.o \
|
||||
a2mp.o amp.o ecc.o
|
||||
a2mp.o amp.o ecc.o hci_request.o hci_debugfs.o
|
||||
|
||||
bluetooth-$(CONFIG_BT_SELFTEST) += selftest.o
|
||||
|
||||
subdir-ccflags-y += -D__CHECK_ENDIAN__
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#include <net/bluetooth/bluetooth.h>
|
||||
#include <linux/proc_fs.h>
|
||||
|
||||
#include "selftest.h"
|
||||
|
||||
#define VERSION "2.20"
|
||||
|
||||
/* Bluetooth sockets */
|
||||
@@ -716,6 +718,10 @@ static int __init bt_init(void)
|
||||
|
||||
BT_INFO("Core ver %s", VERSION);
|
||||
|
||||
err = bt_selftest();
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
bt_debugfs = debugfs_create_dir("bluetooth", NULL);
|
||||
|
||||
err = bt_sysfs_init();
|
||||
|
||||
@@ -25,11 +25,13 @@
|
||||
/* Bluetooth HCI connection handling. */
|
||||
|
||||
#include <linux/export.h>
|
||||
#include <linux/debugfs.h>
|
||||
|
||||
#include <net/bluetooth/bluetooth.h>
|
||||
#include <net/bluetooth/hci_core.h>
|
||||
#include <net/bluetooth/l2cap.h>
|
||||
|
||||
#include "hci_request.h"
|
||||
#include "smp.h"
|
||||
#include "a2mp.h"
|
||||
|
||||
@@ -546,6 +548,8 @@ int hci_conn_del(struct hci_conn *conn)
|
||||
|
||||
hci_conn_del_sysfs(conn);
|
||||
|
||||
debugfs_remove_recursive(conn->debugfs);
|
||||
|
||||
if (test_bit(HCI_CONN_PARAM_REMOVAL_PEND, &conn->flags))
|
||||
hci_conn_params_del(conn->hdev, &conn->dst, conn->dst_type);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
1076
net/bluetooth/hci_debugfs.c
Normal file
1076
net/bluetooth/hci_debugfs.c
Normal file
File diff suppressed because it is too large
Load Diff
26
net/bluetooth/hci_debugfs.h
Normal file
26
net/bluetooth/hci_debugfs.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
BlueZ - Bluetooth protocol stack for Linux
|
||||
Copyright (C) 2014 Intel Corporation
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License version 2 as
|
||||
published by the Free Software Foundation;
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
|
||||
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
|
||||
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
|
||||
SOFTWARE IS DISCLAIMED.
|
||||
*/
|
||||
|
||||
void hci_debugfs_create_common(struct hci_dev *hdev);
|
||||
void hci_debugfs_create_bredr(struct hci_dev *hdev);
|
||||
void hci_debugfs_create_le(struct hci_dev *hdev);
|
||||
void hci_debugfs_create_conn(struct hci_conn *conn);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user