From: Eric Lapuyade <eric.lapuyade@linux.intel.com>
To: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Cc: linux-wireless@vger.kernel.org, linux-nfc@lists.01.org,
sameo@linux.intel.com, eric.lapuyade@intel.com
Subject: Re: [linux-nfc] [PATCH 2/2] NFC: Correct outgoing frame before requeueing
Date: Thu, 06 Sep 2012 18:17:43 +0200 [thread overview]
Message-ID: <5048CCA7.4010604@linux.intel.com> (raw)
In-Reply-To: <1346926937-4968-2-git-send-email-waldemar.rymarkiewicz@tieto.com>
On 09/06/2012 12:22 PM, Waldemar Rymarkiewicz wrote:
> Purge data added by lower layers (len and crc) in the head and tail of the frame
> during initial send. Now, the frame is correct to be resent.
>
> Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
> ---
> net/nfc/hci/shdlc.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/net/nfc/hci/shdlc.c b/net/nfc/hci/shdlc.c
> index 8a5f034..30e353e 100644
> --- a/net/nfc/hci/shdlc.c
> +++ b/net/nfc/hci/shdlc.c
> @@ -241,8 +241,9 @@ static void nfc_shdlc_requeue_ack_pending(struct nfc_shdlc *shdlc)
> pr_debug("ns reset to %d\n", shdlc->dnr);
>
> while ((skb = skb_dequeue_tail(&shdlc->ack_pending_q))) {
> - skb_pull(skb, 2); /* remove len+control */
> - skb_trim(skb, skb->len - 2); /* remove crc */
> + /* remove client head + shdlc control field */
> + skb_pull(skb, shdlc->client_headroom + 1);
> + skb_trim(skb, skb->len - shdlc->client_tailroom);
> skb_queue_head(&shdlc->send_q, skb);
> }
> shdlc->ns = shdlc->dnr;
>
Hi Waldemar,
This patch would work for PN544, but it makes the assumption that the
driver will always insert/append exactly client_headroom/client_tailroom
bytes when xmit is called. This is not specified nor enforced so it may
be a little dangerous.
To correct that, we can :
- either specify that the driver xmit MUST NOT modify skb. We then let
it remove those len and crc before returning from xmit. This is the most
logical since only the driver really knows what it's doing.
- or specify that the driver head/tailroom request MUST BE the exact
number of bytes added to the skb by xmit.
Samuel, what do you think?
Eric
next prev parent reply other threads:[~2012-09-06 16:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-06 10:22 [PATCH 1/2] NFC: Remove crc generation from shdlc layer Waldemar Rymarkiewicz
2012-09-06 10:22 ` [PATCH 2/2] NFC: Correct outgoing frame before requeueing Waldemar Rymarkiewicz
2012-09-06 16:17 ` Eric Lapuyade [this message]
2012-09-07 6:38 ` [linux-nfc] " Rymarkiewicz Waldemar
2012-09-07 7:43 ` Eric Lapuyade
2012-09-07 8:08 ` Rymarkiewicz Waldemar
2012-09-06 16:02 ` [linux-nfc] [PATCH 1/2] NFC: Remove crc generation from shdlc layer Eric Lapuyade
2012-09-07 8:08 ` Eric Lapuyade
2012-09-07 8:11 ` Rymarkiewicz Waldemar
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=5048CCA7.4010604@linux.intel.com \
--to=eric.lapuyade@linux.intel.com \
--cc=eric.lapuyade@intel.com \
--cc=linux-nfc@lists.01.org \
--cc=linux-wireless@vger.kernel.org \
--cc=sameo@linux.intel.com \
--cc=waldemar.rymarkiewicz@tieto.com \
/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;
as well as URLs for NNTP newsgroup(s).