lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAB_54W68GQmsV70w0uUWvz8-V_Yf+FHfc23k2es53REqWMBY8Q@mail.gmail.com>
Date:   Wed, 12 Jan 2022 17:25:01 -0500
From:   Alexander Aring <alex.aring@...il.com>
To:     Miquel Raynal <miquel.raynal@...tlin.com>
Cc:     Stefan Schmidt <stefan@...enfreihafen.org>,
        linux-wpan - ML <linux-wpan@...r.kernel.org>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        "open list:NETWORKING [GENERAL]" <netdev@...r.kernel.org>,
        Michael Hennerich <michael.hennerich@...log.com>,
        Harry Morris <h.morris@...coda.com>,
        Varka Bhadram <varkabhadram@...il.com>,
        Xue Liu <liuxuenetmail@...il.com>, Alan Ott <alan@...nal11.us>,
        David Girault <david.girault@...vo.com>,
        Romuald Despres <romuald.despres@...vo.com>,
        Frederic Blain <frederic.blain@...vo.com>,
        Nicolas Schodet <nico@...fr.eu.org>,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
        "linux-wireless@...r.kernel.org Wireless" 
        <linux-wireless@...r.kernel.org>
Subject: Re: [wpan-next v2 06/27] net: mac802154: Set the symbol duration automatically

Hi,

On Wed, 12 Jan 2022 at 12:33, Miquel Raynal <miquel.raynal@...tlin.com> wrote:
>
> Now that we have access to all the basic information to know which
> symbol duration should be applied, let's set the symbol duration
> automatically. The two locations that must call for the symbol duration
> to be set are:
> - when manually requesting a channel change though the netlink interface
> - at PHY creation, ieee802154_alloc_hw() already calls
>   ieee802154_change_channel() which will now update the symbol duration
>   accordingly.
>
> If an information is missing, the symbol duration is not touched, a
> debug message is eventually printed. This keeps the compatibility with
> the unconverted drivers for which it was too complicated for me to find
> their precise information. If they initially provided a symbol duration,
> it would be kept. If they don't, the symbol duration value is left
> untouched.
>
> Signed-off-by: Miquel Raynal <miquel.raynal@...tlin.com>
> ---
>  include/net/cfg802154.h |  2 +
>  net/mac802154/cfg.c     |  1 +
>  net/mac802154/main.c    | 93 +++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 96 insertions(+)
>
> diff --git a/include/net/cfg802154.h b/include/net/cfg802154.h
> index 286709a9dd0b..52eefc4b5b4d 100644
> --- a/include/net/cfg802154.h
> +++ b/include/net/cfg802154.h
> @@ -455,4 +455,6 @@ static inline const char *wpan_phy_name(struct wpan_phy *phy)
>         return dev_name(&phy->dev);
>  }
>
> +void ieee802154_set_symbol_duration(struct wpan_phy *phy);
> +
>  #endif /* __NET_CFG802154_H */
> diff --git a/net/mac802154/cfg.c b/net/mac802154/cfg.c
> index 6969f1330ccd..ba57da07c08e 100644
> --- a/net/mac802154/cfg.c
> +++ b/net/mac802154/cfg.c
> @@ -113,6 +113,7 @@ int ieee802154_change_channel(struct wpan_phy *wpan_phy, u8 page, u8 channel)
>         if (!ret) {
>                 wpan_phy->current_page = page;
>                 wpan_phy->current_channel = channel;
> +               ieee802154_set_symbol_duration(wpan_phy);
>         }
>
>         return ret;

We also need to do it in ieee802154_register_hw()?

> diff --git a/net/mac802154/main.c b/net/mac802154/main.c
> index 77a4943f345f..88826c5aa4ba 100644
> --- a/net/mac802154/main.c
> +++ b/net/mac802154/main.c
> @@ -113,6 +113,99 @@ ieee802154_alloc_hw(size_t priv_data_len, const struct ieee802154_ops *ops)
>  }
>  EXPORT_SYMBOL(ieee802154_alloc_hw);
>
> +void ieee802154_set_symbol_duration(struct wpan_phy *phy)
> +{
> +       struct phy_page *page = &phy->supported.page[phy->current_page];
> +       struct phy_channels *chan;
> +       unsigned int chunk;
> +       u32 duration = 0;
> +
> +       for (chunk = 0; chunk < page->nchunks; chunk++) {
> +               if (page->chunk[chunk].channels & phy->current_channel)
> +                       break;
> +       }
> +
> +       if (chunk == page->nchunks)
> +               goto set_duration;
> +
> +       chan = &page->chunk[chunk];
> +       switch (chan->protocol) {
> +       case IEEE802154_BPSK_PHY:
> +               switch (chan->band) {
> +               case IEEE802154_868_MHZ_BAND:
> +                       /* 868 MHz BPSK 802.15.4-2003: 20 ksym/s */
> +                       duration = 50 * 1000;

* NSEC_PER_USEC?

- Alex

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ