All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@gmail.com>
To: Floris Van den Abeele <floris.vandenabeele@intec.ugent.be>
Cc: linux-wpan@vger.kernel.org
Subject: Re: 802.15.4 SoftMAC devices in linux-wpan?
Date: Thu, 5 Nov 2015 20:00:23 +0100	[thread overview]
Message-ID: <20151105190018.GA2641@omega> (raw)
In-Reply-To: <563B8DAA.2050001@intec.ugent.be>

Hi,

On Thu, Nov 05, 2015 at 06:11:06PM +0100, Floris Van den Abeele wrote:
> Hi all,
> 
> I am looking to get a purely PHY radio (so called SoftMAC devices) into
> Linux and up and running on an 802.15.4 network.
> 
> In linux/Documentation/networking/ieee802154.txt I read that only
> monitor mode is supported for SoftMAC devices:
>     NOTE: Currently the only monitor device type is supported - it's
> IEEE 802.15.4
>     stack interface for network sniffers (e.g. WireShark).
> 

This documentation is mostly outdated and need some update. Sorry, we
completely doesn't support HardMAC transceivers, we support SoftMAC
transceivers only.

> When browsing the source files in the linux mainline tree, I also
> couldn't find much on a kernel level CSMA/CA implementation.
> 

Some SoftMAC transceivers also support for timing critical handling
like CSMA/CA, ack handling, etc. via hardware. This is what we indicate
with the hardware flag [0].

The parameters for e.g. CSMA/CA handling can be set then over the right
callbacks.

Well we have currently the use case for it when the transceiver support
it's and the parameters are some registers inside the hardware.

> Are there any other purely PHY devices supported? I saw the cc2520
> listed, which in Contiki at least has its MAC protocol running
> externally (i.e. inside contiki, not on the cc2520).
> How does a cc2520 with linux-wpan perform CSMA/CA (this could help me on
> my way significantly)?

This is not implemented yet. When the hardware itself does not contain
CSMA/CA handling. With that I mean: running the CSMA/CA algorithm on
transceiver side and doing the starting of transmit when CSMA/CA allows
it. Then I would suggest to implement (for now) the CSMA/CA handling
inside the driver layer.

This means:

- Set the IEEE802154_HW_CSMA_PARAMS flag.
- Implement the callbacks for setting csma parameters. This will set
  some internal attributes inside the driver private data. These
  parameters will be evaluated when doing the CSMA/CA algorithm then.
- Use xmit_async callback for transmit and fill the transmit buffer.
  Check CCA status, if fail then repeat it after CCA update, solved by
  hrtimer [1] (the repeat mechanism). If CCA status is fine, then calculate
  the backoff period and starting a hrtimer [1] according the backoff period.
  The complete handler of the hrtimer need to signal the transceiver then
  to start the transmit.
  The CSMA/CA algorithm will be started then over xmit_async and it uses
  internally hrtimers. btw: you can sure there are no others xmit_async
  until calling ieee802154_xmit_complete.

This is currently my idea "how to implement a CSMA/CA handling via
software. Feel free to ask more information about this handling.

Also this handling will then be handled inside the driver-layer only.
This is for me fine, later we can think about to adding some new callbacks,
etc. to move such handling inside the transmit function of 802.15.4
SoftMAC. if the hardware doesn't support CSMA/CA handling and there is
no other chance to implement it. This will provide one CSMA/CA algorithm
for all transceivers which doesn't support such handling via hardware.

I need a more overview about transceivers which doesn't support such
handling by hardware to make a nice interface for it. At first a
driver-layer implementation is fine for me.

> If it doesn't, would it be feasible to implement CSMA/CA inside the
> kernel? I'm mainly concerned about strict timings and concurrency when
> running CSMA/CA in kernel level.
> 

This is impossible with current mainline linux. I think hrtimers is the
best use-case here. Depends also, if you need to wait > 10 usec, then
please use a simple "udelay", see [3]. It takes longer to setup a
hrtimer then.

So far I know, hrtimers/udelay (in xmit_async it's softirq context) it
can be still interrupted by a hardirq, so you can't provide strict
timings here.

- Alex

[0] http://lxr.free-electrons.com/source/include/net/mac802154.h#L138
[1] http://lxr.free-electrons.com/source/Documentation/timers/hrtimers.txt
[2] http://lxr.free-electrons.com/source/Documentation/timers/timers-howto.txt#L57

      reply	other threads:[~2015-11-05 19:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-05 17:11 802.15.4 SoftMAC devices in linux-wpan? Floris Van den Abeele
2015-11-05 19:00 ` Alexander Aring [this message]

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=20151105190018.GA2641@omega \
    --to=alex.aring@gmail.com \
    --cc=floris.vandenabeele@intec.ugent.be \
    --cc=linux-wpan@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 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.