All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@gmail.com>
To: Stefan Schmidt <stefan@osg.samsung.com>
Cc: linux-wpan@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH bluetooth-next 2/4] mac802154: remove pib lock
Date: Fri, 22 May 2015 14:41:32 +0200	[thread overview]
Message-ID: <20150522124128.GB748@omega> (raw)
In-Reply-To: <555F1EB9.2070206@osg.samsung.com>

On Fri, May 22, 2015 at 02:19:05PM +0200, Stefan Schmidt wrote:

...

> >  	if (local->hw.flags & IEEE802154_HW_PROMISCUOUS) {
> >  		rc = drv_set_promiscuous_mode(local,
> >  					      wpan_dev->promiscuous_mode);
> >@@ -295,11 +292,7 @@ static int mac802154_wpan_open(struct net_device *dev)
> >  			goto out;
> >  	}
> >-	mutex_unlock(&phy->pib_lock);
> >-	return 0;
> 
> Hmm, why did you remove the return 0; here? Is this supposed to fall through
> to out: and use the return rc now?
> 

This function is the netdev open call of an wpan interface. In this call
we do at the moment all MAC dependent settings which are done by phy.
e.g. address filtering, frame reties, etc...

When this call failed the interface is still down. This callback is
usually called on an ifup. If it's successful it's up, if not still down.

The last call is:

        if (local->hw.flags & IEEE802154_HW_FRAME_RETRIES) {
                rc = drv_set_max_frame_retries(local, wpan_dev->frame_retries);
                if (rc < 0)
                        goto out;
        }

Which is the driver callback which have an identically return value
indicator, means -ERRNO if failed, according to the netdev open call.


We can still use the return 0 on successful or the rc. It's a silent
cleanup which I did here (hope that was okay).


btw:
Also I don't know why there is a pib hold, when some of them are mib
attributes. This all makes no sense for me.

To hold the pib_lock will represent the documentation of driver_ops, but
this makes no sense when you hold the pib lock for mib attributes in
this case of callback and when accessing mib attributes over netlink or
such else to hold the mib lock and not the pib lock, something is wrong
there.

Now, we doing everything over rtnl, which can be indicated by [0] flag
to hold this lock while netlink command and the _most_ mib attributes are
readonly while interface up. This will occur that we need don't care
about locking if the interface is up. For attributes like address
filtering this is also "impossible" to set address filtering registers
while the interface is running. The best option here is to set address
filtering while ifup and then don't allo the change the addresses while
having the interface up. This is what we have now.


The dsn/bsn values are special here, this need to be writeable while ifup.
Also we need to think about handling setting of short_address while
assoc with coordinators, but I think this will take some time to support
such feature. I am sure we will find some solution.

- Alex

[0] http://lxr.free-electrons.com/source/net/ieee802154/nl802154.c#L799

  reply	other threads:[~2015-05-22 12:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-22  8:57 [PATCH bluetooth-next 0/4] mac802154: remove pib/mib locks and locking fixes Alexander Aring
2015-05-22  8:57 ` [PATCH bluetooth-next 1/4] mac802154: fix hold rtnl while ioctl Alexander Aring
2015-05-22 12:15   ` Stefan Schmidt
2015-05-22  8:57 ` [PATCH bluetooth-next 2/4] mac802154: remove pib lock Alexander Aring
2015-05-22 12:19   ` Stefan Schmidt
2015-05-22 12:41     ` Alexander Aring [this message]
2015-05-22 12:48       ` Stefan Schmidt
2015-05-22  8:57 ` [PATCH bluetooth-next 3/4] mac802154: remove mib lock Alexander Aring
2015-05-22 12:25   ` Stefan Schmidt
2015-05-22  8:57 ` [PATCH bluetooth-next 4/4] mac802154: use atomic ops for sequence incrementation Alexander Aring
2015-05-22  8:59   ` Marc Kleine-Budde
2015-05-22 10:30     ` Stefan Schmidt
2015-05-22 10:34       ` Marc Kleine-Budde
2015-05-22 10:40         ` Stefan Schmidt
2015-05-22 12:12         ` Alexander Aring
2015-05-22 12:33           ` Stefan Schmidt
2015-05-22 12:27   ` Stefan Schmidt

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=20150522124128.GB748@omega \
    --to=alex.aring@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-wpan@vger.kernel.org \
    --cc=stefan@osg.samsung.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.