1. 13 May, 2021 15 commits
    • David S. Miller's avatar
      Merge branch 'bridge-split-ipv4-ipv6-mc-router-state' · d38717af
      David S. Miller authored
      Linus Lüssing says:
      
      ====================
      net: bridge: split IPv4/v6 mc router state and export for batman-adv
      
      The following patches are splitting the so far combined multicast router
      state in the Linux bridge into two ones, one for IPv4 and one for IPv6,
      for a more fine-grained detection of multicast routers. This avoids
      sending IPv4 multicast packets to an IPv6-only multicast router and
      avoids sending IPv6 multicast packets to an IPv4-only multicast router.
      This also allows batman-adv to make use of the now split information in
      the final patch.
      
      The first eight patches prepare the bridge code to avoid duplicate
      code or IPv6-#ifdef clutter for the multicast router state split. And
      contain no functional changes yet.
      
      The ninth patch then implements the IPv4+IPv6 multicast router state
      split.
      
      Patch number ten adds IPv4+IPv6 specific timers to the mdb netlink
      router port dump, so that the timers validity can be checked individually
      from userspace.
      
      The final, eleventh patch exports this now per protocol family multicast
      router state so that batman-adv can then later make full use of the
      Multicast Router Discovery (MRD) support in the Linux bridge. The
      batman-adv protocol format currently expects separate multicast router
      states for IPv4 and IPv6, therefore it depends on the first patch.
      batman-adv will then make use of this newly exported functions like
      this[0].
      
      Regards, Linus
      
      [0]: https://git.open-mesh.org/batman-adv.git/shortlog/refs/heads/linus/multicast-routeable-mrd
           -> https://git.open-mesh.org/batman-adv.git/commit/d4bed3a92427445708baeb1f2d1841c5fb816fd4
      
      Changelog v3:
      
      * Patch 01/11:
        * fixed/added missing rename of br->router_list to
          br->ip4_mc_router_list in br_multicast_flood()
      * Patch 02/11:
        * moved inline functions from br_forward.c to br_private.h
      * Patch 03/11:
        * removed inline attribute from functions added to br_mdb.c
      * Patch 04/11:
        * unchanged
      * Patch 05/11:
        * converted if()'s into switch-case in br_multicast_is_router()
      * Patch 06/11:
        * removed inline attribute from function added to br_multicast.c
      * Patch 07/11:
        * added missing static attribute to function
          br_ip4_multicast_get_rport_slot() added to br_multicast.c
      * Patch 08/11:
        * removed inline attribute from function added to br_multicast.c
      * Patch 09/11:
        * added missing static attribute to function
          br_ip6_multicast_get_rport_slot() added to br_multicast.c
        * removed inline attribute from function added to br_multicast.c
      * Patch 10/11:
        * unchanged
      * Patch 11/11:
        * simplified bridge check in br_multicast_has_router_adjacent()
          by using br_port_get_check_rcu()
        * added missing declaration for br_multicast_has_router_adjacent()
          in include/linux/if_bridge.h
      
      Changelog v2:
      
      * split into multiple patches as suggested by Nikolay
      * added helper functions to br_multicast_flood(), avoiding
        IPv6 #ifdef clutter
      * fixed reverse xmas tree ordering in br_rports_fill_info() and
        added helper functions to avoid IPv6 #ifdef clutter
      * Added a common br_multicast_add_router() and a helper function
        to retrieve the correct slot to avoid duplicate code for an
        ip4 and ip6 variant
      * replaced the "1" and "2" constants in br_multicast_is_router()
        with the appropriate enums
      * added br_{ip4,ip6}_multicast_rport_del() wrappers to reduce
        IPv6 #ifdef clutter
      * added return values to br_*multicast_rport_del() to only notify
        if the port was actually removed and did not race with a readdition
        somewhere else
      * added empty, void br_ip6_multicast_mark_router() if compiled
        without IPv6, to reduce IPv6 #ifdef clutter
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d38717af
    • Linus Lüssing's avatar
      net: bridge: mcast: export multicast router presence adjacent to a port · 3b85f9ba
      Linus Lüssing authored
      To properly support routable multicast addresses in batman-adv in a
      group-aware way, a batman-adv node needs to know if it serves multicast
      routers.
      
      This adds a function to the bridge to export this so that batman-adv
      can then make full use of the Multicast Router Discovery capability of
      the bridge.
      Signed-off-by: default avatarLinus Lüssing <linus.luessing@c0d3.blue>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3b85f9ba
    • Linus Lüssing's avatar
      net: bridge: mcast: add ip4+ip6 mcast router timers to mdb netlink · b7fb0916
      Linus Lüssing authored
      Now that we have split the multicast router state into two, one for IPv4
      and one for IPv6, also add individual timers to the mdb netlink router
      port dump. Leaving the old timer attribute for backwards compatibility.
      Signed-off-by: default avatarLinus Lüssing <linus.luessing@c0d3.blue>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b7fb0916
    • Linus Lüssing's avatar
      net: bridge: mcast: split multicast router state for IPv4 and IPv6 · a3c02e76
      Linus Lüssing authored
      A multicast router for IPv4 does not imply that the same host also is a
      multicast router for IPv6 and vice versa.
      
      To reduce multicast traffic when a host is only a multicast router for
      one of these two protocol families, keep router state for IPv4 and IPv6
      separately. Similar to how querier state is kept separately.
      
      For backwards compatibility for netlink and switchdev notifications
      these two will still only notify if a port switched from either no
      IPv4/IPv6 multicast router to any IPv4/IPv6 multicast router or the
      other way round. However a full netlink MDB router dump will now also
      include a multicast router timeout for both IPv4 and IPv6.
      Signed-off-by: default avatarLinus Lüssing <linus.luessing@c0d3.blue>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a3c02e76
    • Linus Lüssing's avatar
      net: bridge: mcast: split router port del+notify for mcast router split · ed2d3597
      Linus Lüssing authored
      In preparation for the upcoming split of multicast router state into
      their IPv4 and IPv6 variants split router port deletion and notification
      into two functions. When we disable a port for instance later we want to
      only send one notification to switchdev and netlink for compatibility
      and want to avoid sending one for IPv4 and one for IPv6. For that the
      split is needed.
      Signed-off-by: default avatarLinus Lüssing <linus.luessing@c0d3.blue>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ed2d3597
    • Linus Lüssing's avatar
      net: bridge: mcast: prepare add-router function for mcast router split · d9b8c4d8
      Linus Lüssing authored
      In preparation for the upcoming split of multicast router state into
      their IPv4 and IPv6 variants move the protocol specific router list
      and timer access to ip4 wrapper functions.
      Signed-off-by: default avatarLinus Lüssing <linus.luessing@c0d3.blue>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d9b8c4d8
    • Linus Lüssing's avatar
      net: bridge: mcast: prepare expiry functions for mcast router split · ee5fb222
      Linus Lüssing authored
      In preparation for the upcoming split of multicast router state into
      their IPv4 and IPv6 variants move the protocol specific timer access to
      an ip4 wrapper function.
      Signed-off-by: default avatarLinus Lüssing <linus.luessing@c0d3.blue>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ee5fb222
    • Linus Lüssing's avatar
      net: bridge: mcast: prepare is-router function for mcast router split · 1a3065a2
      Linus Lüssing authored
      In preparation for the upcoming split of multicast router state into
      their IPv4 and IPv6 variants make br_multicast_is_router() protocol
      family aware.
      
      Note that for now br_ip6_multicast_is_router() uses the currently still
      common ip4_mc_router_timer for now. It will be renamed to
      ip6_mc_router_timer later when the split is performed.
      
      While at it also renames the "1" and "2" constants in
      br_multicast_is_router() to the MDB_RTR_TYPE_TEMP_QUERY and
      MDB_RTR_TYPE_PERM enums.
      Signed-off-by: default avatarLinus Lüssing <linus.luessing@c0d3.blue>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1a3065a2
    • Linus Lüssing's avatar
      net: bridge: mcast: prepare query reception for mcast router split · b19232ef
      Linus Lüssing authored
      In preparation for the upcoming split of multicast router state into
      their IPv4 and IPv6 variants and as the br_multicast_mark_router() will
      be split for that remove the select querier wrapper and instead add
      ip4 and ip6 variants for br_multicast_query_received().
      Signed-off-by: default avatarLinus Lüssing <linus.luessing@c0d3.blue>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b19232ef
    • Linus Lüssing's avatar
      net: bridge: mcast: prepare mdb netlink for mcast router split · ff391c5d
      Linus Lüssing authored
      In preparation for the upcoming split of multicast router state into
      their IPv4 and IPv6 variants and to avoid IPv6 #ifdef clutter later add
      some inline functions for the protocol specific parts in the mdb router
      netlink code. Also the we need iterate over the port instead of router
      list to be able put one router port entry with both the IPv4 and IPv6
      multicast router info later.
      Signed-off-by: default avatarLinus Lüssing <linus.luessing@c0d3.blue>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ff391c5d
    • Linus Lüssing's avatar
      net: bridge: mcast: add wrappers for router node retrieval · 44ebb081
      Linus Lüssing authored
      In preparation for the upcoming split of multicast router state into
      their IPv4 and IPv6 variants and to avoid IPv6 #ifdef clutter later add
      two wrapper functions for router node retrieval in the payload
      forwarding code.
      Signed-off-by: default avatarLinus Lüssing <linus.luessing@c0d3.blue>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      44ebb081
    • Linus Lüssing's avatar
      net: bridge: mcast: rename multicast router lists and timers · ce6f7097
      Linus Lüssing authored
      In preparation for the upcoming split of multicast router state into
      their IPv4 and IPv6 variants, rename the affected variable to the IPv4
      version first to avoid some renames in later commits.
      Signed-off-by: default avatarLinus Lüssing <linus.luessing@c0d3.blue>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ce6f7097
    • Sebastian Andrzej Siewior's avatar
      net: Treat __napi_schedule_irqoff() as __napi_schedule() on PREEMPT_RT · 8380c81d
      Sebastian Andrzej Siewior authored
      __napi_schedule_irqoff() is an optimized version of __napi_schedule()
      which can be used where it is known that interrupts are disabled,
      e.g. in interrupt-handlers, spin_lock_irq() sections or hrtimer
      callbacks.
      
      On PREEMPT_RT enabled kernels this assumptions is not true. Force-
      threaded interrupt handlers and spinlocks are not disabling interrupts
      and the NAPI hrtimer callback is forced into softirq context which runs
      with interrupts enabled as well.
      
      Chasing all usage sites of __napi_schedule_irqoff() is a whack-a-mole
      game so make __napi_schedule_irqoff() invoke __napi_schedule() for
      PREEMPT_RT kernels.
      
      The callers of ____napi_schedule() in the networking core have been
      audited and are correct on PREEMPT_RT kernels as well.
      Reported-by: default avatarJuri Lelli <juri.lelli@redhat.com>
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: default avatarJuri Lelli <juri.lelli@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8380c81d
    • Johannes Berg's avatar
      alx: use fine-grained locking instead of RTNL · 4a5fe57e
      Johannes Berg authored
      In the alx driver, all locking depended on the RTNL, but
      that causes issues with ipconfig ("ip=..." command line)
      because that waits for the netdev to have a carrier while
      holding the RTNL, but the alx workers etc. require RTNL,
      so the carrier won't be set until the RTNL is dropped and
      can be acquired by alx workers. This causes long delays
      at boot, as reported by Nikolai Zhubr.
      
      Really the only sensible thing to do here is to not use
      the RTNL for everything, but instead have fine-grained
      locking for just the driver. Do that, it's not that hard.
      Reported-by: default avatarNikolai Zhubr <zhubr.2@gmail.com>
      Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4a5fe57e
    • Yannick Vignon's avatar
      net: taprio offload: enforce qdisc to netdev queue mapping · 13511704
      Yannick Vignon authored
      Even though the taprio qdisc is designed for multiqueue devices, all the
      queues still point to the same top-level taprio qdisc. This works and is
      probably required for software taprio, but at least with offload taprio,
      it has an undesirable side effect: because the whole qdisc is run when a
      packet has to be sent, it allows packets in a best-effort class to be
      processed in the context of a task sending higher priority traffic. If
      there are packets left in the qdisc after that first run, the NET_TX
      softirq is raised and gets executed immediately in the same process
      context. As with any other softirq, it runs up to 10 times and for up to
      2ms, during which the calling process is waiting for the sendmsg call (or
      similar) to return. In my use case, that calling process is a real-time
      task scheduled to send a packet every 2ms, so the long sendmsg calls are
      leading to missed timeslots.
      
      By attaching each netdev queue to its own qdisc, as it is done with
      the "classic" mq qdisc, each traffic class can be processed independently
      without touching the other classes. A high-priority process can then send
      packets without getting stuck in the sendmsg call anymore.
      Signed-off-by: default avatarYannick Vignon <yannick.vignon@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      13511704
  2. 12 May, 2021 2 commits
  3. 11 May, 2021 5 commits
    • Guenter Roeck's avatar
      net/sched: taprio: Drop unnecessary NULL check after container_of · faa5f5da
      Guenter Roeck authored
      The rcu_head pointer passed to taprio_free_sched_cb is never NULL.
      That means that the result of container_of() operations on it is also
      never NULL, even though rcu_head is the first element of the structure
      embedding it. On top of that, it is misleading to perform a NULL check
      on the result of container_of() because the position of the contained
      element could change, which would make the check invalid. Remove the
      unnecessary NULL check.
      
      This change was made automatically with the following Coccinelle script.
      
      @@
      type t;
      identifier v;
      statement s;
      @@
      
      <+...
      (
        t v = container_of(...);
      |
        v = container_of(...);
      )
        ...
        when != v
      - if (\( !v \| v == NULL \) ) s
      ...+>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      faa5f5da
    • Loic Poulain's avatar
      usb: class: cdc-wdm: WWAN framework integration · cac6fb01
      Loic Poulain authored
      The WWAN framework provides a unified way to handle WWAN/modems and its
      control port(s). It has initially been introduced to support MHI/PCI
      modems, offering the same control protocols as the USB variants such as
      MBIM, QMI, AT... The WWAN framework exposes these control protocols as
      character devices, similarly to cdc-wdm, but in a bus agnostic fashion.
      
      This change adds registration of the USB modem cdc-wdm control endpoints
      to the WWAN framework as standard control ports (wwanXpY...).
      
      Exposing cdc-wdm through WWAN framework normally maintains backward
      compatibility, e.g:
          $ qmicli --device-open-qmi -d /dev/wwan0p1QMI --dms-get-ids
      instead of
          $ qmicli --device-open-qmi -d /dev/cdc-wdm0 --dms-get-ids
      
      However, some tools may rely on cdc-wdm driver/device name for device
      detection. It is then safer to keep the 'legacy' cdc-wdm character
      device to prevent any breakage. This is handled in this change by
      API mutual exclusion, only one access method can be used at a time,
      either cdc-wdm chardev or WWAN API.
      
      Note that unknown channel types (other than MBIM, AT or MBIM) are not
      registered to the WWAN framework.
      Signed-off-by: default avatarLoic Poulain <loic.poulain@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cac6fb01
    • Loic Poulain's avatar
      net: wwan: Add unknown port type · bf30396c
      Loic Poulain authored
      Some devices may have ports with unknown type/protocol which need to
      be tagged (though not supported by WWAN core). This will be the case
      for cdc-wdm based drivers.
      Signed-off-by: default avatarLoic Poulain <loic.poulain@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bf30396c
    • Zou Wei's avatar
      mISDN: fix possible use-after-free in HFC_cleanup() · 009fc857
      Zou Wei authored
      This module's remove path calls del_timer(). However, that function
      does not wait until the timer handler finishes. This means that the
      timer handler may still be running after the driver's remove function
      has finished, which would result in a use-after-free.
      
      Fix by calling del_timer_sync(), which makes sure the timer handler
      has finished, and unable to re-schedule itself.
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarZou Wei <zou_wei@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      009fc857
    • Zou Wei's avatar
      atm: iphase: fix possible use-after-free in ia_module_exit() · 1c72e6ab
      Zou Wei authored
      This module's remove path calls del_timer(). However, that function
      does not wait until the timer handler finishes. This means that the
      timer handler may still be running after the driver's remove function
      has finished, which would result in a use-after-free.
      
      Fix by calling del_timer_sync(), which makes sure the timer handler
      has finished, and unable to re-schedule itself.
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarZou Wei <zou_wei@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1c72e6ab
  4. 10 May, 2021 18 commits