From: Mat Martineau <mathewm@codeaurora.org>
To: Gustavo Padovan <gustavo@padovan.org>
Cc: linux-bluetooth@vger.kernel.org, pkrystad@codeaurora.org,
marcel@holtmann.org
Subject: Re: [PATCH 4/4] Bluetooth: Functions parsing or generating ERTM control fields
Date: Tue, 27 Mar 2012 10:57:26 -0700 (PDT) [thread overview]
Message-ID: <alpine.DEB.2.02.1203271055250.8831@mathewm-linux> (raw)
In-Reply-To: <20120325163420.GD3106@joana>
Gustavo -
On Sun, 25 Mar 2012, Gustavo Padovan wrote:
> Hi Mat,
>
> * Mat Martineau <mathewm@codeaurora.org> [2012-03-23 16:56:58 -0700]:
>
>> These functions encode or decode ERTM control fields (extended or
>> enhanced) to or from the new l2cap_control structure.
>>
>> Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
>> ---
>> net/bluetooth/l2cap_core.c | 120 ++++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 120 insertions(+)
>>
>> diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
>> index ad73696..890cfb9 100644
>> --- a/net/bluetooth/l2cap_core.c
>> +++ b/net/bluetooth/l2cap_core.c
>> @@ -787,6 +787,118 @@ static inline void l2cap_send_rr_or_rnr(struct l2cap_chan *chan, u32 control)
>> l2cap_send_sframe(chan, control);
>> }
>>
>> +static u16 __pack_enhanced_control(struct l2cap_ctrl *control)
>> +{
>> + u16 packed;
>> +
>> + packed = (control->reqseq << L2CAP_CTRL_REQSEQ_SHIFT) &
>> + L2CAP_CTRL_REQSEQ;
>> + packed |= (control->final << L2CAP_CTRL_FINAL_SHIFT) &
>> + L2CAP_CTRL_FINAL;
>> +
>> + if (control->sframe) {
>> + packed |= (control->poll << L2CAP_CTRL_POLL_SHIFT) &
>> + L2CAP_CTRL_POLL;
>> + packed |= (control->super << L2CAP_CTRL_SUPER_SHIFT) &
>> + L2CAP_CTRL_SUPERVISE;
>> + packed |= L2CAP_CTRL_FRAME_TYPE;
>> + } else {
>> + packed |= (control->sar << L2CAP_CTRL_SAR_SHIFT) &
>> + L2CAP_CTRL_SAR;
>> + packed |= (control->txseq << L2CAP_CTRL_TXSEQ_SHIFT) &
>> + L2CAP_CTRL_TXSEQ;
>> + }
>> +
>> + return packed;
>> +}
>> +
>> +static void __get_enhanced_control(u16 enhanced,
>> + struct l2cap_ctrl *control)
>
> wrong style here.
>
>> +{
>> + control->reqseq = (enhanced & L2CAP_CTRL_REQSEQ) >>
>> + L2CAP_CTRL_REQSEQ_SHIFT;
>> + control->final = (enhanced & L2CAP_CTRL_FINAL) >>
>> + L2CAP_CTRL_FINAL_SHIFT;
>> +
>> + if (enhanced & L2CAP_CTRL_FRAME_TYPE) {
>> + /* S-Frame */
>> + control->sframe = 1;
>> + control->poll = (enhanced & L2CAP_CTRL_POLL) >>
>> + L2CAP_CTRL_POLL_SHIFT;
>> + control->super = (enhanced & L2CAP_CTRL_SUPERVISE) >>
>> + L2CAP_CTRL_SUPER_SHIFT;
>> +
>> + control->sar = 0;
>> + control->txseq = 0;
>> + } else {
>> + /* I-Frame */
>> + control->sframe = 0;
>> + control->sar = (enhanced & L2CAP_CTRL_SAR) >>
>> + L2CAP_CTRL_SAR_SHIFT;
>> + control->txseq = (enhanced & L2CAP_CTRL_TXSEQ) >>
>> + L2CAP_CTRL_TXSEQ_SHIFT;
>> +
>> + control->poll = 0;
>> + control->super = 0;
>> + }
>> +}
>> +
>> +static u32 __pack_extended_control(struct l2cap_ctrl *control)
>> +{
>> + u32 packed;
>> +
>> + packed = (control->reqseq << L2CAP_EXT_CTRL_REQSEQ_SHIFT) &
>> + L2CAP_EXT_CTRL_REQSEQ;
>> + packed |= (control->final << L2CAP_EXT_CTRL_FINAL_SHIFT) &
>> + L2CAP_EXT_CTRL_FINAL;
>> +
>> + if (control->sframe) {
>> + packed |= (control->poll << L2CAP_EXT_CTRL_POLL_SHIFT) &
>> + L2CAP_EXT_CTRL_POLL;
>> + packed |= (control->super << L2CAP_EXT_CTRL_SUPER_SHIFT) &
>> + L2CAP_EXT_CTRL_SUPERVISE;
>> + packed |= L2CAP_EXT_CTRL_FRAME_TYPE;
>> + } else {
>> + packed |= (control->sar << L2CAP_EXT_CTRL_SAR_SHIFT) &
>> + L2CAP_EXT_CTRL_SAR;
>> + packed |= (control->txseq << L2CAP_EXT_CTRL_TXSEQ_SHIFT) &
>> + L2CAP_EXT_CTRL_TXSEQ;
>> + }
>> +
>> + return packed;
>> +}
>> +
>> +static void __get_extended_control(u32 extended,
>> + struct l2cap_ctrl *control)
>
> wrong style here
>
Thanks for the review - I made a pass over my code to fix up the
function indentation, but I guess I missed these. I'll update and
re-submit.
--
Mat Martineau
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
next prev parent reply other threads:[~2012-03-27 17:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-23 23:56 [PATCH 0/4] ERTM state machine changes, part 1 Mat Martineau
2012-03-23 23:56 ` [PATCH 1/4] Bluetooth: Add definitions and struct members for new ERTM state machine Mat Martineau
2012-03-24 18:30 ` Marcel Holtmann
2012-03-23 23:56 ` [PATCH 2/4] Bluetooth: Add a structure to carry ERTM data in skb control blocks Mat Martineau
2012-03-24 18:34 ` Marcel Holtmann
2012-03-23 23:56 ` [PATCH 3/4] Bluetooth: Add the l2cap_seq_list structure for tracking frames Mat Martineau
2012-03-24 18:43 ` Marcel Holtmann
2012-03-27 17:54 ` Mat Martineau
2012-03-23 23:56 ` [PATCH 4/4] Bluetooth: Functions parsing or generating ERTM control fields Mat Martineau
2012-03-24 18:48 ` Marcel Holtmann
2012-03-25 16:34 ` Gustavo Padovan
2012-03-27 17:57 ` Mat Martineau [this message]
2012-03-26 15:20 ` Andrei Emeltchenko
2012-03-27 17:59 ` Mat Martineau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.02.1203271055250.8831@mathewm-linux \
--to=mathewm@codeaurora.org \
--cc=gustavo@padovan.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=pkrystad@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox