cp.bis.sdu = cpu_to_le16(qos->bcast.out.sdu);
cp.bis.latency = cpu_to_le16(qos->bcast.out.latency);
cp.bis.rtn = qos->bcast.out.rtn;
- cp.bis.phy = qos->bcast.out.phy;
+ cp.bis.phy = qos->bcast.out.phys;
cp.bis.packing = qos->bcast.packing;
cp.bis.framing = qos->bcast.framing;
cp.bis.encryption = qos->bcast.encryption;
cis->cis_id = cis_id;
cis->c_sdu = cpu_to_le16(conn->iso_qos.ucast.out.sdu);
cis->p_sdu = cpu_to_le16(conn->iso_qos.ucast.in.sdu);
- cis->c_phy = qos->ucast.out.phy ? qos->ucast.out.phy :
- qos->ucast.in.phy;
- cis->p_phy = qos->ucast.in.phy ? qos->ucast.in.phy :
- qos->ucast.out.phy;
+ cis->c_phys = qos->ucast.out.phys ? qos->ucast.out.phys :
+ qos->ucast.in.phys;
+ cis->p_phys = qos->ucast.in.phys ? qos->ucast.in.phys :
+ qos->ucast.out.phys;
cis->c_rtn = qos->ucast.out.rtn;
cis->p_rtn = qos->ucast.in.rtn;
}
return cis;
/* Update LINK PHYs according to QoS preference */
- cis->le_tx_phy = qos->ucast.out.phy;
- cis->le_rx_phy = qos->ucast.in.phy;
+ cis->le_tx_phy = qos->ucast.out.phys;
+ cis->le_rx_phy = qos->ucast.in.phys;
/* If output interval is not set use the input interval as it cannot be
* 0x000000.
}
static void hci_iso_qos_setup(struct hci_dev *hdev, struct hci_conn *conn,
- struct bt_iso_io_qos *qos, __u8 phy)
+ struct bt_iso_io_qos *qos, __u8 phys)
{
/* Only set MTU if PHY is enabled */
- if (!qos->sdu && qos->phy)
+ if (!qos->sdu && qos->phys)
qos->sdu = conn->mtu;
/* Use the same PHY as ACL if set to any */
- if (qos->phy == BT_ISO_PHY_ANY)
- qos->phy = phy;
+ if (qos->phys == BT_ISO_PHY_ANY)
+ qos->phys = phys;
/* Use LE ACL connection interval if not set */
if (!qos->interval)
u32 flags = 0;
int err;
- if (qos->bcast.out.phy == 0x02)
+ if (qos->bcast.out.phys == BIT(1))
flags |= MGMT_ADV_FLAG_SEC_2M;
/* Align intervals */
return conn;
/* Update LINK PHYs according to QoS preference */
- conn->le_tx_phy = qos->bcast.out.phy;
- conn->le_tx_phy = qos->bcast.out.phy;
+ conn->le_tx_def_phys = qos->bcast.out.phys;
/* Add Basic Announcement into Peridic Adv Data if BASE is set */
if (base_len && base) {
}
hci_iso_qos_setup(hdev, conn, &qos->bcast.out,
- conn->le_tx_phy ? conn->le_tx_phy :
+ conn->le_tx_def_phys ? conn->le_tx_def_phys :
hdev->le_tx_def_phys);
conn->iso_qos = *qos;
return le;
hci_iso_qos_setup(hdev, le, &qos->ucast.out,
- le->le_tx_phy ? le->le_tx_phy : hdev->le_tx_def_phys);
+ le->le_tx_def_phys ? le->le_tx_def_phys :
+ hdev->le_tx_def_phys);
hci_iso_qos_setup(hdev, le, &qos->ucast.in,
- le->le_rx_phy ? le->le_rx_phy : hdev->le_rx_def_phys);
+ le->le_rx_def_phys ? le->le_rx_def_phys :
+ hdev->le_rx_def_phys);
cis = hci_bind_cis(hdev, dst, dst_type, qos, timeout);
if (IS_ERR(cis)) {
hci_dev_unlock(hdev);
}
+/* Convert LE PHY to QoS PHYs */
+static u8 le_phy_qos(u8 phy)
+{
+ switch (phy) {
+ case 0x01:
+ return HCI_LE_SET_PHY_1M;
+ case 0x02:
+ return HCI_LE_SET_PHY_2M;
+ case 0x03:
+ return HCI_LE_SET_PHY_CODED;
+ }
+
+ return 0;
+}
+
static void hci_le_cis_established_evt(struct hci_dev *hdev, void *data,
struct sk_buff *skb)
{
1000);
qos->ucast.in.sdu = ev->c_bn ? le16_to_cpu(ev->c_mtu) : 0;
qos->ucast.out.sdu = ev->p_bn ? le16_to_cpu(ev->p_mtu) : 0;
- qos->ucast.in.phy = ev->c_phy;
- qos->ucast.out.phy = ev->p_phy;
+ qos->ucast.in.phys = le_phy_qos(ev->c_phy);
+ qos->ucast.out.phys = le_phy_qos(ev->p_phy);
break;
case HCI_ROLE_MASTER:
qos->ucast.in.interval = p_sdu_interval;
1000);
qos->ucast.out.sdu = ev->c_bn ? le16_to_cpu(ev->c_mtu) : 0;
qos->ucast.in.sdu = ev->p_bn ? le16_to_cpu(ev->p_mtu) : 0;
- qos->ucast.out.phy = ev->c_phy;
- qos->ucast.in.phy = ev->p_phy;
+ qos->ucast.out.phys = le_phy_qos(ev->c_phy);
+ qos->ucast.in.phys = le_phy_qos(ev->p_phy);
break;
}
if (conn) {
struct bt_iso_qos *qos = &conn->iso_qos;
- if (qos->bcast.in.phy & BT_ISO_PHY_1M ||
- qos->bcast.in.phy & BT_ISO_PHY_2M) {
+ if (qos->bcast.in.phys & BT_ISO_PHY_1M ||
+ qos->bcast.in.phys & BT_ISO_PHY_2M) {
cp->scanning_phys |= LE_SCAN_PHY_1M;
hci_le_scan_phy_params(phy, type,
interval,
phy++;
}
- if (qos->bcast.in.phy & BT_ISO_PHY_CODED) {
+ if (qos->bcast.in.phys & BT_ISO_PHY_CODED) {
cp->scanning_phys |= LE_SCAN_PHY_CODED;
hci_le_scan_phy_params(phy, type,
interval * 3,
}
/* Fail if out PHYs are marked as disabled */
- if (!iso_pi(sk)->qos.bcast.out.phy) {
+ if (!iso_pi(sk)->qos.bcast.out.phys) {
err = -EINVAL;
goto unlock;
}
}
/* Fail if either PHYs are marked as disabled */
- if (!iso_pi(sk)->qos.ucast.in.phy && !iso_pi(sk)->qos.ucast.out.phy) {
+ if (!iso_pi(sk)->qos.ucast.in.phys && !iso_pi(sk)->qos.ucast.out.phys) {
err = -EINVAL;
goto unlock;
}
.interval = 10000u, \
.latency = 10u, \
.sdu = 40u, \
- .phy = BT_ISO_PHY_2M, \
+ .phys = BT_ISO_PHY_2M, \
.rtn = 2u, \
}
static bool check_io_qos(struct bt_iso_io_qos *qos)
{
/* If no PHY is enable SDU must be 0 */
- if (!qos->phy && qos->sdu)
+ if (!qos->phys && qos->sdu)
return false;
if (qos->interval && (qos->interval < 0xff || qos->interval > 0xfffff))
if (qos->latency && (qos->latency < 0x05 || qos->latency > 0xfa0))
return false;
- if (qos->phy > BT_ISO_PHY_ANY)
+ if (qos->phys > BT_ISO_PHY_ANY)
return false;
return true;