diff --git a/tools/iso-tester.c b/tools/iso-tester.c
index 2c67417..6aefb51 100644
--- a/tools/iso-tester.c
+++ b/tools/iso-tester.c
bool reconnect;
bool suspending;
struct tx_tstamp_data tx_ts;
+ int seqnum;
};
struct iso_client_data {
bool pa_bind;
bool big;
+ /* Enable BT_PKT_SEQNUM for RX packet sequence numbers */
+ bool pkt_seqnum;
+
/* Enable SO_TIMESTAMPING with these flags */
uint32_t so_timestamping;
.pkt_status = 0x02,
};
+static const struct iso_client_data listen_16_2_1_recv_pkt_seqnum = {
+ .qos = QOS_16_2_1,
+ .expect_err = 0,
+ .recv = &send_16_2_1,
+ .server = true,
+ .pkt_seqnum = true,
+};
+
static const struct iso_client_data listen_16_2_1_recv_rx_timestamping = {
.qos = QOS_16_2_1,
.expect_err = 0,
return FALSE;
}
+ if (isodata->pkt_seqnum) {
+ struct cmsghdr *cmsg;
+ uint16_t pkt_seqnum = 0;
+
+ for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL;
+ cmsg = CMSG_NXTHDR(&msg, cmsg)) {
+ if (cmsg->cmsg_level != SOL_BLUETOOTH)
+ continue;
+
+ if (cmsg->cmsg_type == BT_SCM_PKT_SEQNUM) {
+ memcpy(&pkt_seqnum, CMSG_DATA(cmsg),
+ sizeof(pkt_seqnum));
+ tester_debug("BT_SCM_PKT_SEQNUM = 0x%2.2x",
+ pkt_seqnum);
+ break;
+ }
+ }
+
+ if (data->seqnum < 0)
+ data->seqnum = pkt_seqnum;
+ else
+ data->seqnum++;
+
+ if (pkt_seqnum != data->seqnum) {
+ tester_warn("isodata->pkt_seqnum 0x%2.2x != 0x%2.2x "
+ "pkt_seqnum", pkt_seqnum, data->seqnum);
+ tester_test_failed();
+ return FALSE;
+ }
+ }
+
if (isodata->so_timestamping & SOF_TIMESTAMPING_RX_SOFTWARE)
rx_timestamp_check(&msg);
+ if (data->step) {
+ data->step--;
+ } else {
+ tester_test_failed();
+ return FALSE;
+ }
+
if (memcmp(buf, isodata->recv->iov_base, ret))
tester_test_failed();
+ else if (data->step)
+ return TRUE;
else
tester_test_passed();
const struct iso_client_data *isodata = data->test_data;
struct bthost *host;
static uint16_t sn;
+ int j, count;
tester_print("Receive %zu bytes of data", isodata->recv->iov_len);
return;
host = hciemu_client_get_host(data->hciemu);
- bthost_send_iso(host, data->handle, isodata->ts, sn++, 0,
- isodata->pkt_status, isodata->recv, 1);
+
+ count = isodata->pkt_seqnum ? 2 : 1;
+ for (j = 0; j < count; ++j) {
+ bthost_send_iso(host, data->handle, isodata->ts, sn++, 0,
+ isodata->pkt_status, isodata->recv, 1);
+ data->step++;
+ }
data->io_id[0] = g_io_add_watch(io, G_IO_IN, iso_recv_data, data);
}
}
}
+ if (isodata->pkt_seqnum) {
+ int opt = 1;
+
+ data->seqnum = -1;
+
+ if (setsockopt(new_sk, SOL_BLUETOOTH, BT_PKT_SEQNUM, &opt,
+ sizeof(opt)) < 0) {
+ tester_print("Can't set socket BT_PKT_SEQNUM option: "
+ "%s (%d)", strerror(errno), errno);
+ tester_test_failed();
+ return false;
+ }
+ }
+
ret = iso_connect(new_io, cond, user_data);
g_io_channel_unref(new_io);
&listen_16_2_1_recv_pkt_status,
setup_powered, test_listen);
+ test_iso("ISO Receive Packet Seqnum - Success",
+ &listen_16_2_1_recv_pkt_seqnum,
+ setup_powered, test_listen);
+
test_iso("ISO Receive - RX Timestamping",
&listen_16_2_1_recv_rx_timestamping,
setup_powered, test_listen);