* [PATCH] *** SUBJECT HERE *** @ 2009-04-30 1:42 ngh 2009-04-30 1:42 ` [PATCH] Add support for negotiating new L2CAP options after a failed configuration ngh 2009-04-30 2:01 ` [PATCH] *** SUBJECT HERE *** Marcel Holtmann 0 siblings, 2 replies; 6+ messages in thread From: ngh @ 2009-04-30 1:42 UTC (permalink / raw) To: linux-bluetooth; +Cc: Nathan Holstein From: Nathan Holstein <nathan@lampreynetworks.com> This is a revamping of the previous patches that I submited. I started from scratch, rebase all the changes onto the latest bluetooth-testing (2.6.30-rc3). While applying the changes, I attempted to clean up the code and apply the input from Marcel and Gustavo. Unfortunately, I did not get a chance to test this for regressions vs. the previous version of the code. I did remove the code which segmented outgoing PDUs: it wouldn't have worked with the current tx window=1, and would have produced memory leaks. The code is available from git://staticfree.info/git/el2cap on branch "ertm". Nathan Holstein (9): Add #defines and data structures for enhanced L2CAP Add support for sending enhanced L2CAP data Add support for sending L2CAP S-frames. Append RFC option when configuring an L2CAP socket. Add support for parsing enhanced L2CAP configuration options. Add support for receiving data over an enhanced L2CAP channel Check the FCS of a received L2CAP packet. Reassemble segmented L2CAP PDUs upon reception Add support for negotiating new L2CAP options after a failed configuration include/net/bluetooth/bluetooth.h | 3 +- include/net/bluetooth/l2cap.h | 124 +++++++- net/bluetooth/l2cap.c | 607 ++++++++++++++++++++++++++++++++++--- 3 files changed, 673 insertions(+), 61 deletions(-) ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] Add support for negotiating new L2CAP options after a failed configuration 2009-04-30 1:42 [PATCH] *** SUBJECT HERE *** ngh @ 2009-04-30 1:42 ` ngh 2009-04-30 2:01 ` [PATCH] *** SUBJECT HERE *** Marcel Holtmann 1 sibling, 0 replies; 6+ messages in thread From: ngh @ 2009-04-30 1:42 UTC (permalink / raw) To: linux-bluetooth; +Cc: Nathan Holstein From: Nathan Holstein <nathan@lampreynetworks.com> When negotiating the configuration of an L2CAP socket, the remote may reject the initial configuration that was sent. This patch adds allows selecting differing configuration values. --- net/bluetooth/l2cap.c | 106 ++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 97 insertions(+), 9 deletions(-) diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 7505137..528c72d 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c @@ -2016,6 +2016,70 @@ static int l2cap_parse_conf_req(struct sock *sk, void *data) return ptr - data; } +static inline int l2cap_parse_conf_rsp(struct sock *sk, void *rsp, int len, void *_req, u16 *result) +{ + struct l2cap_pinfo *pi = l2cap_pi(sk); + struct l2cap_conf_req *req = _req; + void *ptr = req->data; + int type, hint, olen; + unsigned long val; + struct l2cap_conf_rfc rfc; + + BT_DBG("sk %p, rsp %p, len %d, req %p", sk, rsp, len, _req); + + while (len >= L2CAP_CONF_OPT_SIZE) { + len -= l2cap_get_conf_opt(&rsp, &type, &olen, &val); + + hint = type & L2CAP_CONF_HINT; + type &= 0x7f; + + switch (type) { + case L2CAP_CONF_MTU: + if (val < L2CAP_CONF_MIN_MTU) + { + *result = L2CAP_CONF_UNACCEPT; + pi->omtu = L2CAP_CONF_MIN_MTU; + } + else + pi->omtu = val; + l2cap_add_conf_opt(&ptr, L2CAP_CONF_MTU, 2, pi->omtu); + break; + + case L2CAP_CONF_FLUSH_TO: + pi->flush_to = val; + l2cap_add_conf_opt(&ptr, L2CAP_CONF_FLUSH_TO, 2, + pi->flush_to); + break; + + case L2CAP_CONF_QOS: + break; + + case L2CAP_CONF_RFC: + /* Currently, the code does not support negotiating to + * use a different mode than was initially created. This + * can be used for switching between ERTM/Streaming, and + * will be useful for implementing MCAP/HDP on top of + * eL2CAP. */ + *result = L2CAP_CONF_UNACCEPT; + if (pi->mode == L2CAP_MODE_BASIC) + pi->fcs = 0; + l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, + sizeof(rfc), (unsigned long) &rfc); + break; + + case L2CAP_CONF_FCS: + pi->fcs = val; + l2cap_add_conf_opt(&ptr, L2CAP_CONF_FCS, 1, pi->fcs); + } + } + + req->dcid = cpu_to_le16(pi->dcid); + req->flags = cpu_to_le16(0x0000); + + BT_DBG("ptr %p, req->data %p", ptr, req->data); + return ptr - _req; +} + static int l2cap_build_conf_rsp(struct sock *sk, void *data, u16 result, u16 flags) { struct l2cap_conf_rsp *rsp = data; @@ -2237,6 +2301,15 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr if (sk->sk_state == BT_DISCONN) goto unlock; + /* Reject if connected and in eL2CAP mode. */ + if (sk->sk_state == BT_CONNECTED && l2cap_pi(sk)->mode != L2CAP_MODE_BASIC) + { + l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP, + l2cap_build_conf_rsp(sk, rsp, + L2CAP_CONF_REJECT, flags), rsp); + goto unlock; + } + /* Reject if config buffer is too small. */ len = cmd_len - sizeof(*req); if (l2cap_pi(sk)->conf_len + len > sizeof(l2cap_pi(sk)->conf_req)) { @@ -2305,21 +2378,36 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr if (!sk) return 0; + /* Reject if connected and in eL2CAP mode. */ + if (sk->sk_state == BT_CONNECTED && l2cap_pi(sk)->mode != L2CAP_MODE_BASIC) + { + l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP, + l2cap_build_conf_rsp(sk, rsp, + L2CAP_CONF_REJECT, flags), rsp); + goto done; + } + switch (result) { case L2CAP_CONF_SUCCESS: break; case L2CAP_CONF_UNACCEPT: if (++l2cap_pi(sk)->conf_retry < L2CAP_CONF_MAX_RETRIES) { - char req[128]; - /* It does not make sense to adjust L2CAP parameters - * that are currently defined in the spec. We simply - * resend config request that we sent earlier. It is - * stupid, but it helps qualification testing which - * expects at least some response from us. */ - l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ, - l2cap_build_conf_req(sk, req), req); - goto done; + int len = cmd->len - sizeof(*rsp); + char req[64]; + + /* throw out any old conf requests we stored */ + result = L2CAP_CONF_SUCCESS; + len = l2cap_parse_conf_rsp(sk, rsp->data, len, req, + &result); + + BT_DBG("len %d", len); + l2cap_send_cmd(conn, l2cap_get_ident(conn), + L2CAP_CONF_REQ, len, req); + if (result == L2CAP_CONF_SUCCESS) + break; + else + goto done; } default: -- 1.6.0.6 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] *** SUBJECT HERE *** 2009-04-30 1:42 [PATCH] *** SUBJECT HERE *** ngh 2009-04-30 1:42 ` [PATCH] Add support for negotiating new L2CAP options after a failed configuration ngh @ 2009-04-30 2:01 ` Marcel Holtmann 2009-04-30 16:12 ` Gustavo F. Padovan 1 sibling, 1 reply; 6+ messages in thread From: Marcel Holtmann @ 2009-04-30 2:01 UTC (permalink / raw) To: ngh; +Cc: linux-bluetooth, Nathan Holstein Hi Nathan, > This is a revamping of the previous patches that I submited. I started from > scratch, rebase all the changes onto the latest bluetooth-testing (2.6.30-rc3). > While applying the changes, I attempted to clean up the code and apply the > input from Marcel and Gustavo. > > Unfortunately, I did not get a chance to test this for regressions vs. the > previous version of the code. I did remove the code which segmented outgoing > PDUs: it wouldn't have worked with the current tx window=1, and would have > produced memory leaks. > > The code is available from git://staticfree.info/git/el2cap on branch "ertm". no idea why are using a branch for this. Just a remote repository should be enough. Anyhow you have to add Signed-off-by statements to your patches. Otherwise I can't apply them. Regards Marcel ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] *** SUBJECT HERE *** 2009-04-30 2:01 ` [PATCH] *** SUBJECT HERE *** Marcel Holtmann @ 2009-04-30 16:12 ` Gustavo F. Padovan 0 siblings, 0 replies; 6+ messages in thread From: Gustavo F. Padovan @ 2009-04-30 16:12 UTC (permalink / raw) To: Nathan Holstein; +Cc: ngh, linux-bluetooth, Marcel Holtmann Hi Nathan, On Wed, Apr 29, 2009 at 11:01 PM, Marcel Holtmann <marcel@holtmann.org> wro= te: > Hi Nathan, > >> This is a revamping of the previous patches that I submited. =A0I starte= d from >> scratch, rebase all the changes onto the latest bluetooth-testing (2.6.3= 0-rc3). >> While applying the changes, I attempted to clean up the code and apply t= he >> input from Marcel and Gustavo. >> >> Unfortunately, I did not get a chance to test this for regressions vs. t= he >> previous version of the code. =A0I did remove the code which segmented o= utgoing >> PDUs: it wouldn't have worked with the current tx window=3D1, and would = have >> produced memory leaks. >> >> The code is available from git://staticfree.info/git/el2cap on branch "e= rtm". > > no idea why are using a branch for this. Just a remote repository should > be enough. Anyhow you have to add Signed-off-by statements to your > patches. Otherwise I can't apply them. Also add -n to your git format-patch options to number the patches(e.g. [PATCH 01/07]...) > > Regards > > Marcel > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-bluetooth= " in > the body of a message to majordomo@vger.kernel.org > More majordomo info at =A0http://vger.kernel.org/majordomo-info.html > --=20 Gustavo F. Padovan http://padovan.org ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] *** SUBJECT HERE *** @ 2009-02-10 20:00 Jeremy Fitzhardinge 0 siblings, 0 replies; 6+ messages in thread From: Jeremy Fitzhardinge @ 2009-02-10 20:00 UTC (permalink / raw) Cc: Ingo Molnar, x86, Linux Kernel Mailing List, Yinghai Lu Hi all, This series of patches (against tip/x86/apic) makes some fairly uncontroversial changes and cleanups to lay the groundwork for some more Xen-specific patches (which will no doubt cause more of a discussion). These changes can also be pulled from git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen.git x86/apic Thanks, J Ian Campbell (1): xen: expose enable_IO_APIC for 32-bit Jeremy Fitzhardinge (4): x86: make apic_* operations inline functions x86: unstatic mp_find_ioapic so it can be used elsewhere x86: add mp_find_ioapic_pin x86: unstatic ioapic entry funcs arch/x86/include/asm/apic.h | 35 +++++++++++++++++++++++++++++------ arch/x86/include/asm/hw_irq.h | 2 -- arch/x86/include/asm/io_apic.h | 6 ++++++ arch/x86/include/asm/mpspec.h | 2 ++ arch/x86/kernel/acpi/boot.c | 18 ++++++++++++++---- arch/x86/kernel/io_apic.c | 10 +++++----- 6 files changed, 56 insertions(+), 17 deletions(-) ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fix build for beagleboard
@ 2008-09-11 18:15 Tony Lindgren
2008-09-12 10:32 ` [PATCH] *** SUBJECT HERE *** Peter 'p2' De Schrijver
0 siblings, 1 reply; 6+ messages in thread
From: Tony Lindgren @ 2008-09-11 18:15 UTC (permalink / raw)
To: Peter 'p2' De Schrijver; +Cc: linux-omap
* Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com> [080911 04:50]:
Signed-off-by?
Tony
> ---
> drivers/i2c/chips/twl4030-power.c | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/i2c/chips/twl4030-power.c b/drivers/i2c/chips/twl4030-power.c
> index 195c3c4..04a13aa 100644
> --- a/drivers/i2c/chips/twl4030-power.c
> +++ b/drivers/i2c/chips/twl4030-power.c
> @@ -149,7 +149,7 @@ struct triton_ins t2_wrst_seq[] __initdata = {
> struct triton_ins sleep_on_seq[] __initdata = {
> {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_RC, RES_TYPE_ALL, RES_TYPE2_R0,
> RES_STATE_SLEEP), 4},
> - {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_ALL, RES_TYPE_R7,
> + {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_ALL, RES_TYPE2_R0,
> RES_STATE_SLEEP), 4},
> };
>
> @@ -160,6 +160,9 @@ struct triton_ins sleep_off_seq[] __initdata = {
> {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_ALL, RES_TYPE2_R0,
> RES_STATE_ACTIVE), 0x2},
> };
> +
> +struct triton_ins t2_wrst_seq[] __initdata = { };
> +
> #endif
>
> static int __init twl4030_write_script_byte(u8 address, u8 byte)
> --
> 1.5.6.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] *** SUBJECT HERE *** 2008-09-11 18:15 [PATCH] Fix build for beagleboard Tony Lindgren @ 2008-09-12 10:32 ` Peter 'p2' De Schrijver 0 siblings, 0 replies; 6+ messages in thread From: Peter 'p2' De Schrijver @ 2008-09-12 10:32 UTC (permalink / raw) To: linux-omap; +Cc: Peter 'p2' De Schrijver *** BLURB HERE *** Peter 'p2' De Schrijver (1): Fix build for beagleboard drivers/i2c/chips/twl4030-power.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-04-30 16:12 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2009-04-30 1:42 [PATCH] *** SUBJECT HERE *** ngh 2009-04-30 1:42 ` [PATCH] Add support for negotiating new L2CAP options after a failed configuration ngh 2009-04-30 2:01 ` [PATCH] *** SUBJECT HERE *** Marcel Holtmann 2009-04-30 16:12 ` Gustavo F. Padovan -- strict thread matches above, loose matches on Subject: below -- 2009-02-10 20:00 Jeremy Fitzhardinge 2008-09-11 18:15 [PATCH] Fix build for beagleboard Tony Lindgren 2008-09-12 10:32 ` [PATCH] *** SUBJECT HERE *** Peter 'p2' De Schrijver
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.