1. 11 Dec, 2020 35 commits
  2. 10 Dec, 2020 5 commits
    • David S. Miller's avatar
      Merge branch 'add-ppp_generic-ioctls-to-bridge-channels' · 91163f82
      David S. Miller authored
      Tom Parkin says:
      
      ====================
      add ppp_generic ioctl(s) to bridge channels
      Following on from my previous RFC[1], this series adds two ioctl calls
      to the ppp code to implement "channel bridging".
      
      When two ppp channels are bridged, frames presented to ppp_input() on
      one channel are passed to the other channel's ->start_xmit function for
      transmission.
      
      The primary use-case for this functionality is in an L2TP Access
      Concentrator where PPP frames are typically presented in a PPPoE session
      (e.g. from a home broadband user) and are forwarded to the ISP network in
      a PPPoL2TP session.
      
      The two new ioctls, PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN form a
      symmetric pair.
      
      Userspace code testing and illustrating use of the ioctl calls is
      available in the go-l2tp[2] and l2tp-ktest[3] repositories.
      
      [1]. Previous RFC series:
      
      https://lore.kernel.org/netdev/20201106181647.16358-1-tparkin@katalix.com/
      
      [2]. go-l2tp: a Go library for building L2TP applications on Linux
      systems. Support for the PPPIOCBRIDGECHAN ioctl is on a branch:
      
      https://github.com/katalix/go-l2tp/tree/tp_002_pppoe_2
      
      [3]. l2tp-ktest: a test suite for the Linux Kernel L2TP subsystem.
      Support for the PPPIOCBRIDGECHAN ioctl is on a branch:
      
      https://github.com/katalix/l2tp-ktest/tree/tp_ac_pppoe_tests_2
      
      Changelog:
      
      v4:
          * Fix NULL-pointer access in PPPIOCBRIDGECHAN in the case that the
            ID of the channel to be bridged wasn't found.
          * Add comment in ppp_unbridge_channels to better document the
            unbridge process.
      
      v3:
          * Use rcu_dereference_protected for accessing struct channel
            'bridge' field during updates with lock 'upl' held.
          * Avoid race in ppp_unbridge_channels by ensuring that each channel
            in the bridge points to it's peer before decrementing refcounts.
      
      v2:
          * Add missing __rcu annotation to struct channel 'bridge' field in
            order to squash a sparse warning from a C=1 build
          * Integrate review comments from gnault@redhat.com
          * Have ppp_unbridge_channels return -EINVAL if the channel isn't
            part of a bridge: this better aligns with the return code from
            ppp_disconnect_channel.
          * Improve docs update by including information on ioctl arguments
            and error return codes.
      ====================
      Reviewed-by: default avatarGuillaume Nault <gnault@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      91163f82
    • Tom Parkin's avatar
      docs: update ppp_generic.rst to document new ioctls · 563b603b
      Tom Parkin authored
      Add documentation of the newly-added PPPIOCBRIDGECHAN and
      PPPIOCUNBRIDGECHAN ioctls.
      Signed-off-by: default avatarTom Parkin <tparkin@katalix.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      563b603b
    • Tom Parkin's avatar
      ppp: add PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN ioctls · 4cf476ce
      Tom Parkin authored
      This new ioctl pair allows two ppp channels to be bridged together:
      frames arriving in one channel are transmitted in the other channel
      and vice versa.
      
      The practical use for this is primarily to support the L2TP Access
      Concentrator use-case.  The end-user session is presented as a ppp
      channel (typically PPPoE, although it could be e.g. PPPoA, or even PPP
      over a serial link) and is switched into a PPPoL2TP session for
      transmission to the LNS.  At the LNS the PPP session is terminated in
      the ISP's network.
      
      When a PPP channel is bridged to another it takes a reference on the
      other's struct ppp_file.  This reference is dropped when the channels
      are unbridged, which can occur either explicitly on userspace calling
      the PPPIOCUNBRIDGECHAN ioctl, or implicitly when either channel in the
      bridge is unregistered.
      
      In order to implement the channel bridge, struct channel is extended
      with a new field, 'bridge', which points to the other struct channel
      making up the bridge.
      
      This pointer is RCU protected to avoid adding another lock to the data
      path.
      
      To guard against concurrent writes to the pointer, the existing struct
      channel lock 'upl' coverage is extended rather than adding a new lock.
      
      The 'upl' lock is used to protect the existing unit pointer.  Since the
      bridge effectively replaces the unit (they're mutually exclusive for a
      channel) it makes coding easier to use the same lock to cover them
      both.
      Signed-off-by: default avatarTom Parkin <tparkin@katalix.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4cf476ce
    • Jakub Kicinski's avatar
      rtnetlink: RCU-annotate both dimensions of rtnl_msg_handlers · 51e13685
      Jakub Kicinski authored
      We use rcu_assign_pointer to assign both the table and the entries,
      but the entries are not marked as __rcu. This generates sparse
      warnings.
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      51e13685
    • Willy Tarreau's avatar
      Revert "macb: support the two tx descriptors on at91rm9200" · 1d608d2e
      Willy Tarreau authored
      This reverts commit 0a4e9ce1.
      
      The code was developed and tested on an MSC313E SoC, which seems to be
      half-way between the AT91RM9200 and the AT91SAM9260 in that it supports
      both the 2-descriptors mode and a Tx ring.
      
      It turns out that after the code was merged I could notice that the
      controller would sometimes lock up, and only when dealing with sustained
      bidirectional transfers, in which case it would report a Tx overrun
      condition right after having reported being ready, and will stop sending
      even after the status is cleared (a down/up cycle fixes it though).
      
      After adding lots of traces I couldn't spot a sequence pattern allowing
      to predict that this situation would happen. The chip comes with no
      documentation and other bits are often reported with no conclusive
      pattern either.
      
      It is possible that my change is wrong just like it is possible that
      the controller on the chip is bogus or at least unpredictable based on
      existing docs from other chips. I do not have an RM9200 at hand to test
      at the moment and a few tests run on a more recent 9G20 indicate that
      this code path cannot be used there to test the code on a 3rd platform.
      
      Since the MSC313E works fine in the single-descriptor mode, and that
      people using the old RM9200 very likely favor stability over performance,
      better revert this patch until we can test it on the original platform
      this part of the driver was written for. Note that the reverted patch
      was actually tested on MSC313E.
      
      Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
      Cc: Claudiu Beznea <claudiu.beznea@microchip.com>
      Cc: Daniel Palmer <daniel@0x0f.com>
      Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
      Link: https://lore.kernel.org/netdev/20201206092041.GA10646@1wt.eu/Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1d608d2e