public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Javier Cardona <javier@cozybit.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH] Assign next hop address to pending mesh frames once the path is resolved.
Date: Wed, 8 Jul 2009 10:02:50 -0700	[thread overview]
Message-ID: <445f43ac0907081002i50c23aeelc2e52d6082f7c9af@mail.gmail.com> (raw)
In-Reply-To: <1247049613.4755.65.camel@johannes.local>

Johannes,

On Wed, Jul 8, 2009 at 3:40 AM, Johannes Berg<johannes@sipsolutions.net> wrote:
> On Tue, 2009-07-07 at 22:53 -0700, Javier Cardona wrote:
>> Regression.  Frames transmitted when a mesh path was wating to be resolved were
>> being transmitted with an invalid Receiver Address.
>
>> -     rcu_assign_pointer(mpath->next_hop, sta);
>> +     struct sk_buff *skb, *skb_first = NULL;
>> +     struct ieee80211_hdr *hdr;
>> +
>> +     rcu_read_lock();
>> +     mpath->next_hop = sta;
>> +
>> +     while ((skb = skb_dequeue(&mpath->frame_queue)) != skb_first) {
>> +             if (!skb_first)
>> +                     skb_first = skb;
>> +             hdr = (struct ieee80211_hdr *) skb->data;
>> +             memcpy(hdr->addr1, sta->sta.addr, ETH_ALEN);
>> +             skb_queue_tail(&mpath->frame_queue, skb);
>> +     }
>> +     if (skb_first)
>> +             skb_queue_tail(&mpath->frame_queue, skb_first);
>> +
>> +     rcu_read_unlock();
>
> Since skb queues have a locks, why use rcu too?

The some mpath members are rcu protected.  I thought I had to extend
the rcu section to cover both mpath->next_hop and mpath->frame_queue.
But now I see that the latter does not need protection, so I'll revert
that to just rcu_assign_pointer(mpath->next_hop, sta);

> Also I think you should probably use a different pattern -- this looks
> prone to breakage, maybe something like
>
>        sk_buff_head tmpq;
>        unsigned long flags;
>
>        __skb_queue_head_init(&tmpq);
>
>        spin_lock_irqsave(&frame_queue->lock);
>
>        while (skb = __skb_dequeue(&frame_queue)) {
>                hdr = (struct ieee80211_hdr *) skb->data;
>                memcpy(hdr->addr1, sta->sta.addr, ETH_ALEN);
>                __skb_queue_tail(&tmpq, skb);
>        }
>
>        skb_queue_splice(&tmpq, frame_queue);
>        spin_unlock_irqrestore(&frame_queue->lock);

Oh, nice, cleaner and less locking. v2 will follow shortly.

Thanks!

Javier

-- 
Javier Cardona
cozybit Inc.
http://www.cozybit.com

  reply	other threads:[~2009-07-08 17:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-08  5:53 [PATCH] Assign next hop address to pending mesh frames once the path is resolved Javier Cardona
2009-07-08 10:40 ` Johannes Berg
2009-07-08 17:02   ` Javier Cardona [this message]
2009-07-09 21:42   ` [PATCH v2] " Javier Cardona
2009-07-09 21:54     ` Johannes Berg

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=445f43ac0907081002i50c23aeelc2e52d6082f7c9af@mail.gmail.com \
    --to=javier@cozybit.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.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