* [PATCH 0/2] sco: BT_DEFER_SETUP for SCO sockets
@ 2012-11-19 16:35 Frédéric Dalleau
2012-11-19 16:35 ` [PATCH 1/2] Bluetooth: Add BT_DEFER_SETUP option to sco socket Frédéric Dalleau
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Frédéric Dalleau @ 2012-11-19 16:35 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Frédéric Dalleau
Hi,
This is a better view about what can be done to implement DEFER_SETUP on SCO
sockets. hci layer get some changes since previous behavior was to accept all
SCO connections.
The ugly hci_proto_defer has been removed and replaced by an additional flag
parameter to hci_proto_connect_ind.
Regarding testing, I'm still stuck by a txt timeout issue however, if the
delay between accept and recv is set to 0, then the connection is working fine.
And I even managed to get the sco connection established correctly once. So I
believed this emulator problem.
Now I'm trying without emulator.
Let me know what you think.
Best regards,
Frédéric
Frédéric Dalleau (2):
Bluetooth: Add BT_DEFER_SETUP option to sco socket
Bluetooth: Implement deferred sco socket setup
include/net/bluetooth/hci_core.h | 9 +++--
net/bluetooth/hci_event.c | 53 +++++++++++++++++++++++++++---
net/bluetooth/sco.c | 67 ++++++++++++++++++++++++++++++++++++--
3 files changed, 119 insertions(+), 10 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH 1/2] Bluetooth: Add BT_DEFER_SETUP option to sco socket 2012-11-19 16:35 [PATCH 0/2] sco: BT_DEFER_SETUP for SCO sockets Frédéric Dalleau @ 2012-11-19 16:35 ` Frédéric Dalleau 2012-11-19 16:35 ` [PATCH 2/2] Bluetooth: Implement deferred sco socket setup Frédéric Dalleau 2012-11-19 20:19 ` [PATCH 0/2] sco: BT_DEFER_SETUP for SCO sockets Gustavo Padovan 2 siblings, 0 replies; 9+ messages in thread From: Frédéric Dalleau @ 2012-11-19 16:35 UTC (permalink / raw) To: linux-bluetooth; +Cc: Frédéric Dalleau This option will set the BT_SK_DEFER_SETUP bit in socket flags. --- net/bluetooth/sco.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index 450cdcd..c6678f2 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c @@ -666,12 +666,31 @@ static int sco_sock_setsockopt(struct socket *sock, int level, int optname, char { struct sock *sk = sock->sk; int err = 0; + u32 opt; BT_DBG("sk %p", sk); lock_sock(sk); switch (optname) { + + case BT_DEFER_SETUP: + if (sk->sk_state != BT_BOUND && sk->sk_state != BT_LISTEN) { + err = -EINVAL; + break; + } + + if (get_user(opt, (u32 __user *) optval)) { + err = -EFAULT; + break; + } + + if (opt) + set_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags); + else + clear_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags); + break; + default: err = -ENOPROTOOPT; break; @@ -753,6 +772,19 @@ static int sco_sock_getsockopt(struct socket *sock, int level, int optname, char lock_sock(sk); switch (optname) { + + case BT_DEFER_SETUP: + if (sk->sk_state != BT_BOUND && sk->sk_state != BT_LISTEN) { + err = -EINVAL; + break; + } + + if (put_user(test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags), + (u32 __user *) optval)) + err = -EFAULT; + + break; + default: err = -ENOPROTOOPT; break; -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] Bluetooth: Implement deferred sco socket setup 2012-11-19 16:35 [PATCH 0/2] sco: BT_DEFER_SETUP for SCO sockets Frédéric Dalleau 2012-11-19 16:35 ` [PATCH 1/2] Bluetooth: Add BT_DEFER_SETUP option to sco socket Frédéric Dalleau @ 2012-11-19 16:35 ` Frédéric Dalleau 2012-11-20 17:37 ` Gustavo Padovan 2012-11-19 20:19 ` [PATCH 0/2] sco: BT_DEFER_SETUP for SCO sockets Gustavo Padovan 2 siblings, 1 reply; 9+ messages in thread From: Frédéric Dalleau @ 2012-11-19 16:35 UTC (permalink / raw) To: linux-bluetooth; +Cc: Frédéric Dalleau In order to authenticate and configure an incoming SCO connection, the BT_DEFER_SETUP option was added. This option is intended to defer reply to Connect Request on SCO sockets. When a connection is requested, the listening socket is unblocked but the effective connection setup happens only on first recv. Any send between accept and recv fails with -ENOTCONN. --- include/net/bluetooth/hci_core.h | 9 ++++--- net/bluetooth/hci_event.c | 53 +++++++++++++++++++++++++++++++++++--- net/bluetooth/sco.c | 35 ++++++++++++++++++++++--- 3 files changed, 87 insertions(+), 10 deletions(-) diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index ef5b85d..8fceb35 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -376,7 +376,7 @@ extern int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt); extern int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags); -extern int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr); +extern int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags); extern void sco_connect_cfm(struct hci_conn *hcon, __u8 status); extern void sco_disconn_cfm(struct hci_conn *hcon, __u8 reason); extern int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb); @@ -577,6 +577,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst); int hci_conn_del(struct hci_conn *conn); void hci_conn_hash_flush(struct hci_dev *hdev); void hci_conn_check_pending(struct hci_dev *hdev); +void hci_conn_accept(struct hci_conn *conn, int mask); struct hci_chan *hci_chan_create(struct hci_conn *conn); void hci_chan_del(struct hci_chan *chan); @@ -779,8 +780,10 @@ void hci_conn_del_sysfs(struct hci_conn *conn); #define lmp_host_le_br_capable(dev) ((dev)->host_features[0] & LMP_HOST_LE_BREDR) /* ----- HCI protocols ----- */ +#define HCI_PROTO_DEFER 0x01 + static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, - __u8 type) + __u8 type, __u8 *flags) { switch (type) { case ACL_LINK: @@ -788,7 +791,7 @@ static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, case SCO_LINK: case ESCO_LINK: - return sco_connect_ind(hdev, bdaddr); + return sco_connect_ind(hdev, bdaddr, flags); default: BT_ERR("unknown link type %d", type); diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 9f5c5f2..f883ef5 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -2047,15 +2047,54 @@ unlock: hci_conn_check_pending(hdev); } +void hci_conn_accept(struct hci_conn *conn, int mask) +{ + struct hci_dev *hdev = conn->hdev; + + BT_DBG("conn %p", conn); + + if (!lmp_esco_capable(hdev)) { + struct hci_cp_accept_conn_req cp; + + conn->state = BT_CONFIG; + bacpy(&cp.bdaddr, &conn->dst); + + if (lmp_rswitch_capable(hdev) && (mask & HCI_LM_MASTER)) + cp.role = 0x00; /* Become master */ + else + cp.role = 0x01; /* Remain slave */ + + hci_send_cmd(hdev, HCI_OP_ACCEPT_CONN_REQ, sizeof(cp), + &cp); + } else /* lmp_esco_capable(hdev)) */ { + struct hci_cp_accept_sync_conn_req cp; + + conn->state = BT_CONFIG; + bacpy(&cp.bdaddr, &conn->dst); + cp.pkt_type = cpu_to_le16(conn->pkt_type); + + cp.tx_bandwidth = __constant_cpu_to_le32(0x00001f40); + cp.rx_bandwidth = __constant_cpu_to_le32(0x00001f40); + cp.max_latency = __constant_cpu_to_le16(0xffff); + cp.content_format = cpu_to_le16(hdev->voice_setting); + cp.retrans_effort = 0xff; + + hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ, + sizeof(cp), &cp); + } +} + static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb) { struct hci_ev_conn_request *ev = (void *) skb->data; int mask = hdev->link_mode; + __u8 flags = 0; BT_DBG("%s bdaddr %pMR type 0x%x", hdev->name, &ev->bdaddr, ev->link_type); - mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type); + mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type, + &flags); if ((mask & HCI_LM_ACCEPT) && !hci_blacklist_lookup(hdev, &ev->bdaddr)) { @@ -2081,12 +2120,13 @@ static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb) } memcpy(conn->dev_class, ev->dev_class, 3); - conn->state = BT_CONNECT; hci_dev_unlock(hdev); - if (ev->link_type == ACL_LINK || !lmp_esco_capable(hdev)) { + if (ev->link_type == ACL_LINK || + (!(flags & HCI_PROTO_DEFER) && !lmp_esco_capable(hdev))) { struct hci_cp_accept_conn_req cp; + conn->state = BT_CONNECT; bacpy(&cp.bdaddr, &ev->bdaddr); @@ -2097,8 +2137,9 @@ static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_send_cmd(hdev, HCI_OP_ACCEPT_CONN_REQ, sizeof(cp), &cp); - } else { + } else if (!(flags & HCI_PROTO_DEFER)) { struct hci_cp_accept_sync_conn_req cp; + conn->state = BT_CONNECT; bacpy(&cp.bdaddr, &ev->bdaddr); cp.pkt_type = cpu_to_le16(conn->pkt_type); @@ -2111,6 +2152,10 @@ static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb) hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ, sizeof(cp), &cp); + } else { + conn->state = BT_CONNECT2; + hci_proto_connect_cfm(conn, 0); + hci_conn_put(conn); } } else { /* Connection rejected */ diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index c6678f2..77210bf 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c @@ -397,6 +397,7 @@ static void sco_sock_init(struct sock *sk, struct sock *parent) if (parent) { sk->sk_type = parent->sk_type; + bt_sk(sk)->flags = bt_sk(parent)->flags; security_sk_clone(parent, sk); } } @@ -662,6 +663,28 @@ static int sco_sock_sendmsg(struct kiocb *iocb, struct socket *sock, return err; } +static int sco_sock_recvmsg(struct kiocb *iocb, struct socket *sock, + struct msghdr *msg, size_t len, int flags) +{ + struct sock *sk = sock->sk; + struct sco_pinfo *pi = sco_pi(sk); + + lock_sock(sk); + + if (sk->sk_state == BT_CONNECT2 && + test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags)) { + hci_conn_accept(pi->conn->hcon, 0); + sk->sk_state = BT_CONFIG; + + release_sock(sk); + return 0; + } + + release_sock(sk); + + return bt_sock_recvmsg(iocb, sock, msg, len, flags); +} + static int sco_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen) { struct sock *sk = sock->sk; @@ -906,7 +929,10 @@ static void sco_conn_ready(struct sco_conn *conn) hci_conn_hold(conn->hcon); __sco_chan_add(conn, sk, parent); - sk->sk_state = BT_CONNECTED; + if (test_bit(BT_SK_DEFER_SETUP, &bt_sk(parent)->flags)) + sk->sk_state = BT_CONNECT2; + else + sk->sk_state = BT_CONNECTED; /* Wake up parent */ parent->sk_data_ready(parent, 1); @@ -919,7 +945,7 @@ done: } /* ----- SCO interface with lower layer (HCI) ----- */ -int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr) +int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags) { struct sock *sk; struct hlist_node *node; @@ -936,6 +962,9 @@ int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr) if (!bacmp(&bt_sk(sk)->src, &hdev->bdaddr) || !bacmp(&bt_sk(sk)->src, BDADDR_ANY)) { lm |= HCI_LM_ACCEPT; + + if (test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags)) + *flags |= HCI_PROTO_DEFER; break; } } @@ -1024,7 +1053,7 @@ static const struct proto_ops sco_sock_ops = { .accept = sco_sock_accept, .getname = sco_sock_getname, .sendmsg = sco_sock_sendmsg, - .recvmsg = bt_sock_recvmsg, + .recvmsg = sco_sock_recvmsg, .poll = bt_sock_poll, .ioctl = bt_sock_ioctl, .mmap = sock_no_mmap, -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] Bluetooth: Implement deferred sco socket setup 2012-11-19 16:35 ` [PATCH 2/2] Bluetooth: Implement deferred sco socket setup Frédéric Dalleau @ 2012-11-20 17:37 ` Gustavo Padovan 2012-11-20 17:55 ` Frédéric Dalleau 0 siblings, 1 reply; 9+ messages in thread From: Gustavo Padovan @ 2012-11-20 17:37 UTC (permalink / raw) To: Frédéric Dalleau; +Cc: linux-bluetooth Hi Frédéric, * Frédéric Dalleau <frederic.dalleau@linux.intel.com> [2012-11-19 17:35:57 +0100]: > In order to authenticate and configure an incoming SCO connection, the > BT_DEFER_SETUP option was added. This option is intended to defer reply > to Connect Request on SCO sockets. > When a connection is requested, the listening socket is unblocked but > the effective connection setup happens only on first recv. Any send > between accept and recv fails with -ENOTCONN. > --- > include/net/bluetooth/hci_core.h | 9 ++++--- > net/bluetooth/hci_event.c | 53 +++++++++++++++++++++++++++++++++++--- > net/bluetooth/sco.c | 35 ++++++++++++++++++++++--- > 3 files changed, 87 insertions(+), 10 deletions(-) > > diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h > index ef5b85d..8fceb35 100644 > --- a/include/net/bluetooth/hci_core.h > +++ b/include/net/bluetooth/hci_core.h > @@ -376,7 +376,7 @@ extern int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt); > extern int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, > u16 flags); > > -extern int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr); > +extern int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags); > extern void sco_connect_cfm(struct hci_conn *hcon, __u8 status); > extern void sco_disconn_cfm(struct hci_conn *hcon, __u8 reason); > extern int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb); > @@ -577,6 +577,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst); > int hci_conn_del(struct hci_conn *conn); > void hci_conn_hash_flush(struct hci_dev *hdev); > void hci_conn_check_pending(struct hci_dev *hdev); > +void hci_conn_accept(struct hci_conn *conn, int mask); > > struct hci_chan *hci_chan_create(struct hci_conn *conn); > void hci_chan_del(struct hci_chan *chan); > @@ -779,8 +780,10 @@ void hci_conn_del_sysfs(struct hci_conn *conn); > #define lmp_host_le_br_capable(dev) ((dev)->host_features[0] & LMP_HOST_LE_BREDR) > > /* ----- HCI protocols ----- */ > +#define HCI_PROTO_DEFER 0x01 > + > static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, > - __u8 type) > + __u8 type, __u8 *flags) Please fix the coding style here. > { > switch (type) { > case ACL_LINK: > @@ -788,7 +791,7 @@ static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, > > case SCO_LINK: > case ESCO_LINK: > - return sco_connect_ind(hdev, bdaddr); > + return sco_connect_ind(hdev, bdaddr, flags); > > default: > BT_ERR("unknown link type %d", type); > diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c > index 9f5c5f2..f883ef5 100644 > --- a/net/bluetooth/hci_event.c > +++ b/net/bluetooth/hci_event.c > @@ -2047,15 +2047,54 @@ unlock: > hci_conn_check_pending(hdev); > } > > +void hci_conn_accept(struct hci_conn *conn, int mask) > +{ > + struct hci_dev *hdev = conn->hdev; > + > + BT_DBG("conn %p", conn); > + > + if (!lmp_esco_capable(hdev)) { > + struct hci_cp_accept_conn_req cp; > + > + conn->state = BT_CONFIG; > + bacpy(&cp.bdaddr, &conn->dst); > + > + if (lmp_rswitch_capable(hdev) && (mask & HCI_LM_MASTER)) > + cp.role = 0x00; /* Become master */ > + else > + cp.role = 0x01; /* Remain slave */ > + > + hci_send_cmd(hdev, HCI_OP_ACCEPT_CONN_REQ, sizeof(cp), > + &cp); I don't think you need to break a line for this hci_send_cmd(), it won't cross the column 80. > + } else /* lmp_esco_capable(hdev)) */ { > + struct hci_cp_accept_sync_conn_req cp; > + > + conn->state = BT_CONFIG; > + bacpy(&cp.bdaddr, &conn->dst); > + cp.pkt_type = cpu_to_le16(conn->pkt_type); > + > + cp.tx_bandwidth = __constant_cpu_to_le32(0x00001f40); > + cp.rx_bandwidth = __constant_cpu_to_le32(0x00001f40); > + cp.max_latency = __constant_cpu_to_le16(0xffff); > + cp.content_format = cpu_to_le16(hdev->voice_setting); > + cp.retrans_effort = 0xff; > + > + hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ, > + sizeof(cp), &cp); > + } > +} > + > static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb) > { > struct hci_ev_conn_request *ev = (void *) skb->data; > int mask = hdev->link_mode; > + __u8 flags = 0; > > BT_DBG("%s bdaddr %pMR type 0x%x", hdev->name, &ev->bdaddr, > ev->link_type); > > - mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type); > + mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type, > + &flags); > > if ((mask & HCI_LM_ACCEPT) && > !hci_blacklist_lookup(hdev, &ev->bdaddr)) { > @@ -2081,12 +2120,13 @@ static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb) > } > > memcpy(conn->dev_class, ev->dev_class, 3); > - conn->state = BT_CONNECT; > > hci_dev_unlock(hdev); > > - if (ev->link_type == ACL_LINK || !lmp_esco_capable(hdev)) { > + if (ev->link_type == ACL_LINK || > + (!(flags & HCI_PROTO_DEFER) && !lmp_esco_capable(hdev))) { > struct hci_cp_accept_conn_req cp; > + conn->state = BT_CONNECT; > > bacpy(&cp.bdaddr, &ev->bdaddr); > > @@ -2097,8 +2137,9 @@ static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb) > > hci_send_cmd(hdev, HCI_OP_ACCEPT_CONN_REQ, sizeof(cp), > &cp); > - } else { > + } else if (!(flags & HCI_PROTO_DEFER)) { > struct hci_cp_accept_sync_conn_req cp; > + conn->state = BT_CONNECT; > > bacpy(&cp.bdaddr, &ev->bdaddr); > cp.pkt_type = cpu_to_le16(conn->pkt_type); > @@ -2111,6 +2152,10 @@ static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb) > > hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ, > sizeof(cp), &cp); > + } else { > + conn->state = BT_CONNECT2; > + hci_proto_connect_cfm(conn, 0); > + hci_conn_put(conn); > } > } else { > /* Connection rejected */ > diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c > index c6678f2..77210bf 100644 > --- a/net/bluetooth/sco.c > +++ b/net/bluetooth/sco.c > @@ -397,6 +397,7 @@ static void sco_sock_init(struct sock *sk, struct sock *parent) > > if (parent) { > sk->sk_type = parent->sk_type; > + bt_sk(sk)->flags = bt_sk(parent)->flags; > security_sk_clone(parent, sk); > } > } > @@ -662,6 +663,28 @@ static int sco_sock_sendmsg(struct kiocb *iocb, struct socket *sock, > return err; > } > > +static int sco_sock_recvmsg(struct kiocb *iocb, struct socket *sock, > + struct msghdr *msg, size_t len, int flags) > +{ > + struct sock *sk = sock->sk; > + struct sco_pinfo *pi = sco_pi(sk); > + > + lock_sock(sk); > + > + if (sk->sk_state == BT_CONNECT2 && > + test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags)) { Wrong coding style here. > + hci_conn_accept(pi->conn->hcon, 0); > + sk->sk_state = BT_CONFIG; Where do you set sk_state to BT_CONNECTED. Doesn't it need to be here? Gustavo ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] Bluetooth: Implement deferred sco socket setup 2012-11-20 17:37 ` Gustavo Padovan @ 2012-11-20 17:55 ` Frédéric Dalleau 2012-11-20 18:01 ` Gustavo Padovan 0 siblings, 1 reply; 9+ messages in thread From: Frédéric Dalleau @ 2012-11-20 17:55 UTC (permalink / raw) To: Gustavo Padovan, linux-bluetooth Hi Gustavo, I'm taking your remarks into account asap On 11/20/2012 06:37 PM, Gustavo Padovan wrote: > Where do you set sk_state to BT_CONNECTED. Doesn't it need to be here? The state is set to BT_CONNECTED in hci_sync_conn_complete_evt. ie when the connection is effectively created. My understanding is that BT_CONFIG state indicate the configuration has been requested, in case recvmsg() is called twice. Regards, Frédéric ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] Bluetooth: Implement deferred sco socket setup 2012-11-20 17:55 ` Frédéric Dalleau @ 2012-11-20 18:01 ` Gustavo Padovan 2012-11-20 18:08 ` Frédéric Dalleau 0 siblings, 1 reply; 9+ messages in thread From: Gustavo Padovan @ 2012-11-20 18:01 UTC (permalink / raw) To: Frédéric Dalleau; +Cc: linux-bluetooth * Frédéric Dalleau <frederic.dalleau@linux.intel.com> [2012-11-20 18:55:39 +0100]: > Hi Gustavo, > > I'm taking your remarks into account asap > > On 11/20/2012 06:37 PM, Gustavo Padovan wrote: > >Where do you set sk_state to BT_CONNECTED. Doesn't it need to be here? > The state is set to BT_CONNECTED in hci_sync_conn_complete_evt. ie when > the connection is effectively created. Are we both talking about the sk_state var? I failed to see how it is set to BT_CONNECTED. Gustavo ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] Bluetooth: Implement deferred sco socket setup 2012-11-20 18:01 ` Gustavo Padovan @ 2012-11-20 18:08 ` Frédéric Dalleau 0 siblings, 0 replies; 9+ messages in thread From: Frédéric Dalleau @ 2012-11-20 18:08 UTC (permalink / raw) To: Gustavo Padovan, linux-bluetooth Hi, On 11/20/2012 07:01 PM, Gustavo Padovan wrote: > * Frédéric Dalleau <frederic.dalleau@linux.intel.com> [2012-11-20 18:55:39 +0100]: > >> Hi Gustavo, >> >> I'm taking your remarks into account asap >> >> On 11/20/2012 06:37 PM, Gustavo Padovan wrote: >>> Where do you set sk_state to BT_CONNECTED. Doesn't it need to be here? >> The state is set to BT_CONNECTED in hci_sync_conn_complete_evt. ie when >> the connection is effectively created. > > Are we both talking about the sk_state var? I failed to see how it is set to > BT_CONNECTED. Yes, hci_sync_conn_complete_evt > hci_proto_connect_cfm > sco_connect_cfm > if there is no error, sco_conn_ready. Since the socket is already created we get in first if branch. Frédéric ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/2] sco: BT_DEFER_SETUP for SCO sockets 2012-11-19 16:35 [PATCH 0/2] sco: BT_DEFER_SETUP for SCO sockets Frédéric Dalleau 2012-11-19 16:35 ` [PATCH 1/2] Bluetooth: Add BT_DEFER_SETUP option to sco socket Frédéric Dalleau 2012-11-19 16:35 ` [PATCH 2/2] Bluetooth: Implement deferred sco socket setup Frédéric Dalleau @ 2012-11-19 20:19 ` Gustavo Padovan 2012-11-20 10:39 ` Frédéric Dalleau 2 siblings, 1 reply; 9+ messages in thread From: Gustavo Padovan @ 2012-11-19 20:19 UTC (permalink / raw) To: Frédéric Dalleau; +Cc: linux-bluetooth Hi Frédéric, * Frédéric Dalleau <frederic.dalleau@linux.intel.com> [2012-11-19 17:35:55 +0100]: > Hi, > > This is a better view about what can be done to implement DEFER_SETUP on SCO > sockets. hci layer get some changes since previous behavior was to accept all > SCO connections. > The ugly hci_proto_defer has been removed and replaced by an additional flag > parameter to hci_proto_connect_ind. > Regarding testing, I'm still stuck by a txt timeout issue however, if the > delay between accept and recv is set to 0, then the connection is working fine. > And I even managed to get the sco connection established correctly once. So I > believed this emulator problem. You are telling me that your patch is not really working, I suggest you call this series RFC before you get everything sorted out. The approach in general is good, but I'd need confirmation that it works for actual defer delays, 3 seconds for example, and not 0. Gustavo ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/2] sco: BT_DEFER_SETUP for SCO sockets 2012-11-19 20:19 ` [PATCH 0/2] sco: BT_DEFER_SETUP for SCO sockets Gustavo Padovan @ 2012-11-20 10:39 ` Frédéric Dalleau 0 siblings, 0 replies; 9+ messages in thread From: Frédéric Dalleau @ 2012-11-20 10:39 UTC (permalink / raw) To: Gustavo Padovan, linux-bluetooth Hi Gustavo, On 11/19/2012 09:19 PM, Gustavo Padovan wrote: > Hi Frédéric, > > * Frédéric Dalleau <frederic.dalleau@linux.intel.com> [2012-11-19 17:35:55 +0100]: >> Regarding testing, I'm still stuck by a txt timeout issue however, if the >> delay between accept and recv is set to 0, then the connection is working fine. >> And I even managed to get the sco connection established correctly once. So I >> believed this emulator problem. > > You are telling me that your patch is not really working, I suggest you call > this series RFC before you get everything sorted out. The approach in general > is good, but I'd need confirmation that it works for actual defer delays, 3 > seconds for example, and not 0. Sorry, I have been a bit premature, but for the reason explained above I was confident. So now I'm quite happy to say I successfully tested this series this morning, based on bluetooth-next, using delays from 0 to 35 secs several times in a row. Regards, Frédéric ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-11-20 18:08 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-11-19 16:35 [PATCH 0/2] sco: BT_DEFER_SETUP for SCO sockets Frédéric Dalleau 2012-11-19 16:35 ` [PATCH 1/2] Bluetooth: Add BT_DEFER_SETUP option to sco socket Frédéric Dalleau 2012-11-19 16:35 ` [PATCH 2/2] Bluetooth: Implement deferred sco socket setup Frédéric Dalleau 2012-11-20 17:37 ` Gustavo Padovan 2012-11-20 17:55 ` Frédéric Dalleau 2012-11-20 18:01 ` Gustavo Padovan 2012-11-20 18:08 ` Frédéric Dalleau 2012-11-19 20:19 ` [PATCH 0/2] sco: BT_DEFER_SETUP for SCO sockets Gustavo Padovan 2012-11-20 10:39 ` Frédéric Dalleau
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).