linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Helmut Tschemernjak <helmut@helios.de>
Cc: "Stefan Schmidt" <stefan@datenfreihafen.org>,
	netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	"Jian-Hong Pan" <starnight@g.ncu.edu.tw>,
	"Jiri Pirko" <jiri@resnulli.us>,
	"Marcel Holtmann" <marcel@holtmann.org>,
	"David S . Miller" <davem@davemloft.net>,
	"Matthias Brugger" <mbrugger@suse.com>,
	"Janus Piwek" <jpiwek@arroweurope.com>,
	"Michael Röder" <michael.roeder@avnet.eu>,
	"Dollar Chen" <dollar.chen@wtmec.com>,
	"Ken Yu" <ken.yu@rakwireless.com>,
	"Konstantin Böhm" <konstantin.boehm@ancud.de>,
	"Jan Jongboom" <jan.jongboom@arm.com>,
	"Jon Ortego" <Jon.Ortego@imst.de>,
	contact@snootlab.com, "Ben Whitten" <ben.whitten@lairdtech.com>,
	"Brian Ray" <brian.ray@link-labs.com>,
	lora@globalsat.com.tw, lora@radioshuttle.de,
	"Alexander Graf" <agraf@suse.de>,
	"Michal Kubeček" <mkubecek@suse.cz>,
	"Rob Herring" <robh@kernel.org>,
	devicetree@vger.kernel.org, "Steve deRosier" <derosier@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	linux-spi@vger.kernel.org, "Hasnain Virk" <Hasnain.Virk@arm.com>
Subject: Re: [RFC net-next 00/15] net: A socket API for LoRa
Date: Wed, 11 Jul 2018 04:07:58 +0200	[thread overview]
Message-ID: <23213cab-dc87-118c-1750-cd30d60ce9f8@suse.de> (raw)
In-Reply-To: <5aac9ea5-484c-1b3b-8058-50e11e8d7a9a@helios.de>

Dear Helmut,

Am 05.07.2018 um 12:43 schrieb Helmut Tschemernjak:
> I put the kernel support for the SX1276 LoRa chip in question. I don’t
> think that this kind of device should be in the Linux kernel.

Thanks for sharing your opinion.

> Here are a few facts to consider:
> - A LoRa transaction is very slow  (e.g. SF7 needs about 210 ms, for
> SF12 6280 ms) for 12 bytes user data with acknowledge.

Where do you see a problem? If you look at my SX1276 patch, you will
find that it queues a work item for the transmission (asynchronously)
and has an interrupt handler to get notified of the TX interrupt. It
surely won't get quicker in userspace - and as you point out, we're not
speaking about DPDK performance here, so no need for polling.

> - There are many different implementations for the antenna switch,
> switching between receiving/sending, PA-BOOST, 433, 868/915 MHz. (I know
> SX1276 Heltec ESP32, SX1276 Murata, RFM95-(1276), SX1276 Heltec
> STM32-L4) they are all different regarding this.

Yes, and as demonstrated with this patch series, the kernel is well able
to handle this variety of interfaces. I would say better than userspace!

As noted, I've tested both 868 MHz and 433 MHz modules. My SX1276 driver
uses the Device Tree (radio-frequency) to configure the driver when this
was a property of the module. RN2483 by contrast supports two, so a
netlink interface was suggested to configure this at runtime.

> - The LoRa chip device ID is only 8-bit which is not sufficient for
> larger networks, e.g. our RadioShuttle protocol uses compressed 32-bit
> device IDs.

What does that have to do with anything? The whole reason that you're
CC'ed on this patchset is to make sure that you or someone else can
implement your custom protocol on top of the APIs being proposed. So
my-protocol-is-better-than-theirs is no argument against this project.

The way I understand LoRa and thus designed the struct sockaddr_lora is
that there is no ID involved for LoRa at all - it is essentially a
broadcast. The 8-byte (not 8-bit) EUIs only come into play for LoRaWAN
AFAIU. Am I missing anything?

LoRaWAN, RadioShuttle, RadioHead and LR Base all have their own ways of
addressing - the question here is how to model that in Linux, whether as
one PF_LORA with different protocol options and a growing union
lora_addr inside sockaddr_lora covering all of them, or a protocol
family (requiring global number allocation) for each one of them.

> - The chip can do MTU sizes up to 2048 bytes, most protocols use less
> than 250 bytes.

How would 2048 bytes work? The FIFO buffer fits a maximum of 256 bytes.

IIRC the recommended MTU is also restricted by the airtime, i.e. SF,
bandwidth, preamble and other factors...

Some UART based modules allow a maximum of 64 bytes.

> - Applications do on-the-fly channel and spreading factor switching
> which makes it more difficult for the configuration.

That's exactly the question of how to implement individual options -
Device Tree would be fixed for the system's hardware, netlink would be
user-configurable for the whole network device, whereas socket options
would be per socket/application, and ioctls might be yet another
implementation layer.

> - The chip supports Lora modulation as well as  FSK, GFSK, MSK, GMSK,
> and OOK modulation, for some use cases the other modulations are of
> interest, e.g. to communicated with other devices.

Yes, therefore I raised it in the cover letter as open point 5).

> - Power saving modes, like sleep, suspend may be required for battery
> operation.

The Linux kernel can deal with that much better than userspace. There's
pm hooks that one could implement. And SX1276 returns to standby mode
whenever an operation such as TX is completed. In sleep mode not all
settings get preserved, so they would need to be saved in the private
struct and restored on resume.

> - Cad detection is very flexible and can be differently used.
> 
> - LoRa preamble may be different depending on the protocol used.
> 
> - The new Lora chip SX1262 / 68 (successor of the SX1276) has different
> hardware and all different registers, it is driver incompatible with the
> SX1276. It needs an entire new driver.

Not unexpected, same as SX1301 being different. As this series shows,
multiple drivers can easily be implemented as necessary.

> - The device is not multi-process capable (only a single process can
> communicate with it).

How is that different from other half-duplex network interfaces? The
driver needs to take care of appropriate locking of its operations, and
the socket subsystem should make sure packets get queued accordingly.

> - There are SX1276 LoRa modules with a build-in protocol (LoRaWAN and
> RAW) via a serial connection only, again complete different API compared
> the SX1276 chip. Software updates for this devices are difficult.

Drivers for such modules are already demonstrated in this series.

> - I am even convinced that the LoRaWAN protocol with the concentrator
> concept is not good, the peer to peer communication and a standard MQTT
> gateway (what we do) is way more flexible.

Your opinion in all honors, LoRaWAN is an open specification, whereas
yours is closed. So whatever benefits yours may have, that way you're
unlikely to make LoRaWAN go away. People are rolling out LoRaWAN
gateways, and therefore the question is not which protocol is more
flexible but rather how all of them can be enabled equally for those
that want to use them.

> For all this reasons, I feel a user level driver task implementation is
> way more flexible. I did a lot of work/enhancements on the SX1276 link
> level driver from Semtech, it is available and maintained on mbed.org
> and supports mbed-os, Arduino and is prepared for Linux.
> https://os.mbed.com/users/Helmut64/code/SX1276GenericLib/
> 
> Protocols e.g. our RadioShuttle LoRa peer to peer protocol or the
> LoRaWAN protocol can run on top of the SX1276GenericLib. We may should
> focus on such a driver library getting supported for multiple OS's (Win,
> Linux, mbed, Ardino, etc.)
> 
> Again I feel a Linux kernel device driver for the SX1276 chip make
> little sense for me.

Well, feel free to use spidev if you prefer. As I pointed out, the Linux
spi maintainers don't seem to share your view - instead of white-listing
chipsets for concrete kernel drivers (as you appear to suggest here)
they rather black-list chipsets to be "allowed" to use spidev if all
else fails.

Having already done part of the implementation work, for me the question
is not whether to do a kernel driver but how to do it properly, keeping
all corner cases in mind, such as non-standard protocols like yours.
It's great that you're writing an Open Source library for mbed, but its
name indicates that it offers no abstraction like proposed here.

I'll drop you from v2 then, to not bother you about this Linux kernel
implementation anymore.

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)

  reply	other threads:[~2018-07-11  2:08 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-01 11:07 [RFC net-next 00/15] net: A socket API for LoRa Andreas Färber
2018-07-01 11:07 ` [RFC net-next 01/15] net: Reserve protocol numbers " Andreas Färber
2018-07-01 11:07 ` [RFC net-next 02/15] net: lora: Define sockaddr_lora Andreas Färber
2018-07-01 11:07 ` [RFC net-next 03/15] net: lora: Add protocol numbers Andreas Färber
2018-07-01 11:07 ` [RFC net-next 04/15] net: Add lora subsystem Andreas Färber
2018-07-01 11:07 ` [RFC net-next 05/15] HACK: net: lora: Deal with .poll_mask in 4.18-rc2 Andreas Färber
2018-07-02 16:22   ` Jiri Pirko
2018-07-02 16:59     ` Andreas Färber
2018-07-01 11:07 ` [RFC net-next 06/15] net: lora: Prepare for device drivers Andreas Färber
2018-07-01 11:07 ` [RFC net-next 07/15] net: lora: Add Semtech SX1276 Andreas Färber
2018-07-01 12:02   ` Andreas Färber
2018-07-01 11:07 ` [RFC net-next 08/15] net: lora: sx1276: Add debugfs Andreas Färber
2018-07-02 16:26   ` Jiri Pirko
2018-07-02 17:57     ` Andreas Färber
2018-07-01 11:07 ` [RFC net-next 09/15] net: lora: Prepare EUI helpers Andreas Färber
2018-07-01 11:07 ` [RFC net-next 10/15] net: lora: Add Microchip RN2483 Andreas Färber
2018-07-01 11:08 ` [RFC net-next 11/15] net: lora: Add IMST WiMOD Andreas Färber
2019-01-06 14:57   ` Heinrich Schuchardt
2019-01-07 11:29     ` Andreas Färber
2018-07-01 11:08 ` [RFC net-next 12/15] net: lora: Add USI WM-SG-SM-42 Andreas Färber
2018-07-01 11:08 ` [RFC net-next 13/15] net: lora: Prepare RAK RAK811 Andreas Färber
2018-07-01 11:08 ` [RFC net-next 14/15] net: lora: Prepare Semtech SX1257 Andreas Färber
2018-07-01 11:08 ` [RFC net-next 15/15] net: lora: Add Semtech SX1301 Andreas Färber
2018-07-02 11:51   ` Ben Whitten
2018-07-03  3:01     ` Andreas Färber
2018-07-05  8:59       ` Ben Whitten
2018-07-02 16:12   ` Mark Brown
2018-07-02 17:34     ` Andreas Färber
2018-07-02 20:43       ` Ben Whitten
2018-07-03  3:21         ` Andreas Färber
2018-07-05  8:43           ` Ben Whitten
2018-07-03 14:50       ` Mark Brown
2018-07-03 15:09         ` Andreas Färber
2018-07-03 15:31           ` Mark Brown
2018-07-03 16:40             ` Andreas Färber
2018-07-04 11:43               ` Mark Brown
2018-07-04 13:41                 ` Ben Whitten
2018-07-04 14:32                   ` Mark Brown
2018-07-03 15:11 ` [RFC net-next 00/15] net: A socket API for LoRa Jian-Hong Pan
2018-08-05  0:11   ` Andreas Färber
2018-08-08 20:36     ` Alan Cox
2018-08-08 22:42       ` Andreas Färber
2018-08-09 11:59         ` Alan Cox
2018-08-09 15:02           ` Jian-Hong Pan
2018-08-09 15:21             ` Alexander Aring
2018-08-10 15:57             ` Alan Cox
2018-08-11 18:30               ` Stefan Schmidt
2018-08-12 16:49                 ` Andreas Färber
2018-08-12 16:37               ` Jian-Hong Pan
2018-08-12 17:59                 ` Andreas Färber
2018-08-13 12:36                   ` Alan Cox
2018-08-09 15:12           ` Alexander Aring
2018-08-09  0:50     ` Andreas Färber
2018-07-04 18:26 ` Stefan Schmidt
2018-07-05 10:43   ` Helmut Tschemernjak
2018-07-11  2:07     ` Andreas Färber [this message]
2018-07-11 11:45       ` Helmut Tschemernjak
2018-07-11 15:21 ` Ben Whitten
2018-07-15 18:13   ` Andreas Färber
2018-07-18 11:28     ` Ben Whitten
2018-08-02  7:52       ` Jian-Hong Pan
2018-08-03  8:44         ` linux-lora.git and LoRaWAN (was: [RFC net-next 00/15] net: A socket API for LoRa) Andreas Färber
2018-08-05 12:49           ` Jian-Hong Pan
2018-08-05 13:49       ` [RFC net-next 00/15] net: A socket API for LoRa Andreas Färber

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=23213cab-dc87-118c-1750-cd30d60ce9f8@suse.de \
    --to=afaerber@suse.de \
    --cc=Hasnain.Virk@arm.com \
    --cc=Jon.Ortego@imst.de \
    --cc=agraf@suse.de \
    --cc=ben.whitten@lairdtech.com \
    --cc=brian.ray@link-labs.com \
    --cc=broonie@kernel.org \
    --cc=contact@snootlab.com \
    --cc=davem@davemloft.net \
    --cc=derosier@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dollar.chen@wtmec.com \
    --cc=helmut@helios.de \
    --cc=jan.jongboom@arm.com \
    --cc=jiri@resnulli.us \
    --cc=jpiwek@arroweurope.com \
    --cc=ken.yu@rakwireless.com \
    --cc=konstantin.boehm@ancud.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=lora@globalsat.com.tw \
    --cc=lora@radioshuttle.de \
    --cc=marcel@holtmann.org \
    --cc=mbrugger@suse.com \
    --cc=michael.roeder@avnet.eu \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=starnight@g.ncu.edu.tw \
    --cc=stefan@datenfreihafen.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;
as well as URLs for NNTP newsgroup(s).