From: Kalle Valo <kvalo@qca.qualcomm.com>
To: Raja Mani <rmani@qca.qualcomm.com>
Cc: <linux-wireless@vger.kernel.org>,
Pandiyarajan Pitchaimuthu <c_ppitch@qca.qualcomm.com>,
<ath6kl-devel@qca.qualcomm.com>
Subject: Re: [PATCH] ath6kl: Add rx workqueue for SDIO
Date: Sat, 9 Mar 2013 11:27:51 +0200 [thread overview]
Message-ID: <87obesly7c.fsf@kamboji.qca.qualcomm.com> (raw)
In-Reply-To: <1362732148-26384-1-git-send-email-rmani@qca.qualcomm.com> (Raja Mani's message of "Fri, 8 Mar 2013 14:12:28 +0530")
Raja Mani <rmani@qca.qualcomm.com> writes:
> In the current implementation, all RX packets (data and control)
> are fetched from the chip and processed in ISR handler context.
> ISR handler has to process fetched packets first before it goes
> ahead and fetch further packets from the chip. In high throughput
> scenario, doing everything (read and process) in one context is
> time consuming and it's not quicker way of reading RX packets from
> the chip.
>
> This patch lets ISR to read packets (data and control) from the chip
> and process control packets alone (EP0 pkts). All data packets are
> moved to another queue which is separately processed by another worker
> thread. So that, ISR doesn't have to wait to read further packets until
> fetched data packets are processed. With this change, significant
> improvement is seen both in TCP (around 10 Mpbs) and UDP (around 5 Mpbs)
> down-link case.
>
> Signed-off-by: Pandiyarajan Pitchaimuthu <c_ppitch@qca.qualcomm.com>
> Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Sorry, I think I missed this in our internal review:
> +static void ath6kl_htc_rx_work(struct work_struct *work)
> +{
> + struct htc_target *target;
> + struct htc_packet *packet, *tmp_pkt;
> + struct htc_endpoint *endpoint;
> +
> + target = container_of(work, struct htc_target, rx_work);
> +
> + spin_lock_bh(&target->rx_comp_lock);
> + list_for_each_entry_safe(packet, tmp_pkt, &target->rx_bufq, list) {
> + list_del(&packet->list);
> +
> + spin_unlock_bh(&target->rx_comp_lock);
> + endpoint = &target->endpoint[packet->endpoint];
> +
> + ath6kl_dbg(ATH6KL_DBG_HTC,
> + "htc rx complete ep %d packet 0x%p\n",
> + endpoint->eid, packet);
> +
> + endpoint->ep_cb.rx(endpoint->target, packet);
> + spin_lock_bh(&target->rx_comp_lock);
> + }
> + spin_unlock_bh(&target->rx_comp_lock);
I think there's a (theoretical?) race here. You cannot consume rx_bufq
with a for loop and then release rx_comp_lock inside the loop. Nothing
prevents that rx_bufq is not modified while the lock is released. Ok, in
practise it won't be a problem as ISR is adding them to the end of list.
I think to fix the race the queue should be consumed something like
this (pseudo code):
lock()
while (!list_empty()) {
entry = list_first_entry()
unlock()
do_stuff()
lock()
}
Can someone else comment? Am I on right track?
I so wish sdio.c and htc would use struct sk_buff. It would have all the
infrastructure for this :/
BTW, for consistency please also rename rx_comp_lock to rx_bufq_lock.
--
Kalle Valo
next prev parent reply other threads:[~2013-03-09 9:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-08 8:42 [PATCH] ath6kl: Add rx workqueue for SDIO Raja Mani
2013-03-09 9:27 ` Kalle Valo [this message]
2013-03-09 15:33 ` Adrian Chadd
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=87obesly7c.fsf@kamboji.qca.qualcomm.com \
--to=kvalo@qca.qualcomm.com \
--cc=ath6kl-devel@qca.qualcomm.com \
--cc=c_ppitch@qca.qualcomm.com \
--cc=linux-wireless@vger.kernel.org \
--cc=rmani@qca.qualcomm.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 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.