All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri-rHqAuBHg3fBzbRFIqnYvSA@public.gmane.org>
To: Antonio Quartulli <a@unstable.cc>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	The list for a Better Approach To Mobile Ad-hoc Networking
	<b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org>,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org
Subject: Re: [PATCH 03/17] batman-adv: Add network_coding and mcast sysfs files to README
Date: Sat, 4 Aug 2018 11:36:32 +0200	[thread overview]
Message-ID: <20180804093632.GB2015@nanopsycho> (raw)
In-Reply-To: <113e9222-3310-71c6-7cec-c253b9b5d194-2CpIooy/SPIKlTDg6p0iyA@public.gmane.org>

Sat, Aug 04, 2018 at 11:24:11AM CEST, a@unstable.cc wrote:
>Hi Jiri,
>
>On 20/05/18 14:19, Jiri Pirko wrote:
>> Tue, Mar 27, 2018 at 05:43:08PM CEST, linus.luessing-djzkFPsfvsizQB+pC5nmwQ@public.gmane.org wrote:
>>> On Sat, Oct 29, 2016 at 12:56:28PM +0200, Jiri Pirko wrote:
>>>>>> I strongly believe it is a huge mistake to use sysfs for things like
>>>>>> this. This should be done via generic netlink api.
>>>>>
>>>>> This doesn't change the problem that it is already that way. This patch
>>>>> only adds the list of available files to the README.
>>>>
>>>> Sure. Just found out you did it like that. Therefore I commented. I
>>>> suggest to rework the api to use genl entirely.
>>>
>>> Hi Jiri,
>>>
>>> Thanks for sharing your thoughts!
>>>
>>> Could you explain a bit more on which disadvantages you see in
>>> the usage of sysfs here?
>> 
>> There are 2 major disadvantages.
>> 1) You don't have any events on a change. An app has to poll in order to
>>    know what changed in kernel. Netlink handles this by sending
>>    multicast messages on a specific socket while whoever is interested
>>    gets the messages.
>> 2) In sysfs, everything is string. There are even mixed values like
>>    "1 (means something)". There are no well defined values. Every driver
>>    can expose same things differently. In Netlink, you have well-defined
>>    attributes, with typed values. You can pass multiple attributes for
>>    the same value if needed.
>> 
>> In general, usage of sysfs in netdev subsystem is frowned upon. I would
>> suggest to convert your iface to Generic Netlink API and let the
>> existing sysfs API to rot.
>
>Do you have any pointer about where this discussion took place? I
>imagine it happened in conjunction with some patches intended to other
>drivers/netdev changes.
>
>Reading that could give us a sense of how strict/important/severe this
>decision was and how to prioritize future work.
>
>I am asking because we have been working on a new feature since several
>months and this feature introduces a new sysfs knob.
>
>Now, although I understand the recommendation of switching to netlink, I
>find it a bit impractical to delay a new (and fairly big) feature,
>simply because it uses a potentially obsolete, but current, API.
>
>Any opinion about this?

I agree, that does not make sense.

I just wanted you to consider introducing netlink iface and migrate to
it as it is generally the preffered way to comunicate with userspace in
networking area (I don't have pointer any specific discussion though -
it is just a common knowledge :)). I will be more then happy to help you
with that. You should look at net/core/devlink.c and net/wireless/nl80211.c
to get some inspiration.


>
>
>Thanks a lot
>
>
>Regards,
>
>
>-- 
>Antonio Quartulli
>

WARNING: multiple messages have this Message-ID (diff)
From: Jiri Pirko <jiri@resnulli.us>
To: Antonio Quartulli <a@unstable.cc>
Cc: "The list for a Better Approach To Mobile Ad-hoc Networking"
	<b.a.t.m.a.n@lists.open-mesh.org>,
	"Linus Lüssing" <linus.luessing@c0d3.blue>,
	netdev@vger.kernel.org, davem@davemloft.net
Subject: Re: [B.A.T.M.A.N.] [PATCH 03/17] batman-adv: Add network_coding and mcast sysfs files to README
Date: Sat, 4 Aug 2018 11:36:32 +0200	[thread overview]
Message-ID: <20180804093632.GB2015@nanopsycho> (raw)
In-Reply-To: <113e9222-3310-71c6-7cec-c253b9b5d194@unstable.cc>

Sat, Aug 04, 2018 at 11:24:11AM CEST, a@unstable.cc wrote:
>Hi Jiri,
>
>On 20/05/18 14:19, Jiri Pirko wrote:
>> Tue, Mar 27, 2018 at 05:43:08PM CEST, linus.luessing@c0d3.blue wrote:
>>> On Sat, Oct 29, 2016 at 12:56:28PM +0200, Jiri Pirko wrote:
>>>>>> I strongly believe it is a huge mistake to use sysfs for things like
>>>>>> this. This should be done via generic netlink api.
>>>>>
>>>>> This doesn't change the problem that it is already that way. This patch
>>>>> only adds the list of available files to the README.
>>>>
>>>> Sure. Just found out you did it like that. Therefore I commented. I
>>>> suggest to rework the api to use genl entirely.
>>>
>>> Hi Jiri,
>>>
>>> Thanks for sharing your thoughts!
>>>
>>> Could you explain a bit more on which disadvantages you see in
>>> the usage of sysfs here?
>> 
>> There are 2 major disadvantages.
>> 1) You don't have any events on a change. An app has to poll in order to
>>    know what changed in kernel. Netlink handles this by sending
>>    multicast messages on a specific socket while whoever is interested
>>    gets the messages.
>> 2) In sysfs, everything is string. There are even mixed values like
>>    "1 (means something)". There are no well defined values. Every driver
>>    can expose same things differently. In Netlink, you have well-defined
>>    attributes, with typed values. You can pass multiple attributes for
>>    the same value if needed.
>> 
>> In general, usage of sysfs in netdev subsystem is frowned upon. I would
>> suggest to convert your iface to Generic Netlink API and let the
>> existing sysfs API to rot.
>
>Do you have any pointer about where this discussion took place? I
>imagine it happened in conjunction with some patches intended to other
>drivers/netdev changes.
>
>Reading that could give us a sense of how strict/important/severe this
>decision was and how to prioritize future work.
>
>I am asking because we have been working on a new feature since several
>months and this feature introduces a new sysfs knob.
>
>Now, although I understand the recommendation of switching to netlink, I
>find it a bit impractical to delay a new (and fairly big) feature,
>simply because it uses a potentially obsolete, but current, API.
>
>Any opinion about this?

I agree, that does not make sense.

I just wanted you to consider introducing netlink iface and migrate to
it as it is generally the preffered way to comunicate with userspace in
networking area (I don't have pointer any specific discussion though -
it is just a common knowledge :)). I will be more then happy to help you
with that. You should look at net/core/devlink.c and net/wireless/nl80211.c
to get some inspiration.


>
>
>Thanks a lot
>
>
>Regards,
>
>
>-- 
>Antonio Quartulli
>




  parent reply	other threads:[~2018-08-04  9:36 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-27 19:01 [PATCH 00/17] pull request for net-next: batman-adv 2016-10-27 Simon Wunderlich
2016-10-27 19:01 ` [B.A.T.M.A.N.] " Simon Wunderlich
     [not found] ` <20161027190150.7880-1-sw-2YrNx6rUIHYiY0qSoAWiAoQuADTiUCJX@public.gmane.org>
2016-10-27 19:01   ` [PATCH 01/17] batman-adv: Start new development cycle Simon Wunderlich
2016-10-27 19:01     ` [B.A.T.M.A.N.] " Simon Wunderlich
2016-10-27 19:01   ` [PATCH 02/17] batman-adv: Add B.A.T.M.A.N. V sysfs files to README Simon Wunderlich
2016-10-27 19:01     ` [B.A.T.M.A.N.] " Simon Wunderlich
2016-10-27 19:01   ` [PATCH 03/17] batman-adv: Add network_coding and mcast " Simon Wunderlich
2016-10-27 19:01     ` [B.A.T.M.A.N.] " Simon Wunderlich
2016-10-29 10:33     ` Jiri Pirko
2016-10-29 10:33       ` [B.A.T.M.A.N.] " Jiri Pirko
2016-10-29 10:37       ` Sven Eckelmann
2016-10-29 10:37         ` [B.A.T.M.A.N.] " Sven Eckelmann
2016-10-29 10:56         ` Jiri Pirko
2016-10-29 10:56           ` [B.A.T.M.A.N.] " Jiri Pirko
     [not found]           ` <20161029105628.GE1692-6KJVSR23iU488b5SBfVpbw@public.gmane.org>
2016-10-29 11:46             ` Sven Eckelmann
2016-10-29 11:46               ` [B.A.T.M.A.N.] " Sven Eckelmann
2016-10-29 13:51               ` Jiri Pirko
2016-10-29 13:51                 ` [B.A.T.M.A.N.] " Jiri Pirko
2018-03-27 15:43           ` Linus Lüssing
2018-05-07  6:34             ` Sven Eckelmann
2018-05-07  6:34               ` [B.A.T.M.A.N.] " Sven Eckelmann
2018-05-20  4:37               ` Sven Eckelmann
2018-05-20  4:37                 ` [B.A.T.M.A.N.] " Sven Eckelmann
2018-05-20  6:19             ` Jiri Pirko
2018-05-20  6:19               ` [B.A.T.M.A.N.] " Jiri Pirko
2018-08-04  9:24               ` Antonio Quartulli
     [not found]                 ` <113e9222-3310-71c6-7cec-c253b9b5d194-2CpIooy/SPIKlTDg6p0iyA@public.gmane.org>
2018-08-04  9:36                   ` Jiri Pirko [this message]
2018-08-04  9:36                     ` Jiri Pirko
2018-08-04 11:19                     ` Antonio Quartulli
     [not found]                       ` <f2964fca-072e-2a6c-4ce9-aa7963465195-2CpIooy/SPIKlTDg6p0iyA@public.gmane.org>
2018-08-04 11:52                         ` Jiri Pirko
2018-08-04 11:52                           ` [B.A.T.M.A.N.] " Jiri Pirko
2016-10-27 19:01   ` [PATCH 06/17] batman-adv: Remove unused function batadv_hash_delete Simon Wunderlich
2016-10-27 19:01     ` [B.A.T.M.A.N.] " Simon Wunderlich
2016-10-29 20:28   ` [PATCH 00/17] pull request for net-next: batman-adv 2016-10-27 David Miller
2016-10-29 20:28     ` [B.A.T.M.A.N.] " David Miller
2016-10-27 19:01 ` [PATCH 04/17] batman-adv: Add dat, mcast, nc and neighbor debugfs files to README Simon Wunderlich
2016-10-27 19:01   ` [B.A.T.M.A.N.] " Simon Wunderlich
2016-10-27 19:01 ` [PATCH 05/17] batman-adv: Document new nc, mcast and tpmeter log levels Simon Wunderlich
2016-10-27 19:01   ` [B.A.T.M.A.N.] " Simon Wunderlich
2016-10-27 19:01 ` [PATCH 07/17] batman-adv: Move batadv_sum_counter to soft-interface.c Simon Wunderlich
2016-10-27 19:01   ` [B.A.T.M.A.N.] " Simon Wunderlich
2016-10-27 19:01 ` [PATCH 08/17] batman-adv: Remove unused batadv_icmp_user_cmd_type Simon Wunderlich
2016-10-27 19:01   ` [B.A.T.M.A.N.] " Simon Wunderlich
2016-10-27 19:01 ` [PATCH 09/17] batman-adv: fix batadv_forw_packet kerneldoc for list attribute Simon Wunderlich
2016-10-27 19:01   ` [B.A.T.M.A.N.] " Simon Wunderlich
2016-10-27 19:01 ` [PATCH 10/17] batman-adv: remove unsed argument from batadv_dbg_arp() function Simon Wunderlich
2016-10-27 19:01   ` [B.A.T.M.A.N.] " Simon Wunderlich
2016-10-27 19:01 ` [PATCH 11/17] batman-adv: Allow selecting BATMAN V if CFG80211 is not built Simon Wunderlich
2016-10-27 19:01   ` [B.A.T.M.A.N.] " Simon Wunderlich
2016-10-27 19:01 ` [PATCH 12/17] batman-adv: Less function calls in batadv_is_ap_isolated() after error detection Simon Wunderlich
2016-10-27 19:01   ` [B.A.T.M.A.N.] " Simon Wunderlich
2016-10-27 19:01 ` [PATCH 13/17] batman-adv: Remove needless init of variables on stack Simon Wunderlich
2016-10-27 19:01   ` [B.A.T.M.A.N.] " Simon Wunderlich
2016-10-27 19:01 ` [PATCH 14/17] batman-adv: Use proper name for fragments list head Simon Wunderlich
2016-10-27 19:01   ` [B.A.T.M.A.N.] " Simon Wunderlich
2016-10-27 19:01 ` [PATCH 15/17] batman-adv: Use proper name for gateway " Simon Wunderlich
2016-10-27 19:01   ` [B.A.T.M.A.N.] " Simon Wunderlich
2016-10-27 19:01 ` [PATCH 16/17] batman-adv: Use octal permissions instead of macros Simon Wunderlich
2016-10-27 19:01   ` [B.A.T.M.A.N.] " Simon Wunderlich
2016-10-27 19:01 ` [PATCH 17/17] batman-adv: Avoid precedence issues in macros Simon Wunderlich
2016-10-27 19:01   ` [B.A.T.M.A.N.] " Simon Wunderlich
2016-10-28 21:13   ` Joe Perches
2016-10-28 21:13     ` [B.A.T.M.A.N.] " Joe Perches
2016-10-28 21:27     ` Sven Eckelmann
2016-10-28 21:27       ` [B.A.T.M.A.N.] " Sven Eckelmann
2016-10-29  1:56       ` Joe Perches
2016-10-29  1:56         ` [B.A.T.M.A.N.] " Joe Perches
     [not found]         ` <1477706184.23018.3.camel-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
2016-10-29  6:52           ` Sven Eckelmann
2016-10-29  6:52             ` [B.A.T.M.A.N.] " Sven Eckelmann

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=20180804093632.GB2015@nanopsycho \
    --to=jiri-rhqaubhg3fbzbrfiqnyvsa@public.gmane.org \
    --cc=a@unstable.cc \
    --cc=b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.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.