1. 01 Jul, 2022 3 commits
    • Daniel Starke's avatar
      tty: n_gsm: fix wrong queuing behavior in gsm_dlci_data_output() · 556fc8ac
      Daniel Starke authored
      1) The function drains the fifo for the given user tty/DLCI without
      considering 'TX_THRESH_HI' and different to gsm_dlci_data_output_framed(),
      which moves only one packet from the user side to the internal transmission
      queue. We can only handle one packet at a time here if we want to allow
      DLCI priority handling in gsm_dlci_data_sweep() to avoid link starvation.
      2) Furthermore, the additional header octet from convergence layer type 2
      is not counted against MTU. It is part of the UI/UIH frame message which
      needs to be limited to MTU. Hence, it is wrong not to consider this octet.
      3) Finally, the waiting user tty is not informed about freed space in its
      send queue.
      
      Take at most one packet worth of data out of the DLCI fifo to fix 1).
      Limit the max user data size per packet to MTU - 1 in case of convergence
      layer type 2 to leave space for the control signal octet which is added in
      the later part of the function. This fixes 2).
      Add tty_port_tty_wakeup() to wake up the user tty if new write space has
      been made available to fix 3).
      
      Fixes: 268e526b ("tty/n_gsm: avoid fifo overflow in gsm_dlci_data_output")
      Signed-off-by: default avatarDaniel Starke <daniel.starke@siemens.com>
      Link: https://lore.kernel.org/r/20220701061652.39604-3-daniel.starke@siemens.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      556fc8ac
    • Daniel Starke's avatar
      tty: n_gsm: fix tty registration before control channel open · 01aecd91
      Daniel Starke authored
      The current implementation registers/deregisters the user ttys at mux
      attach/detach. That means that the user devices are available before any
      control channel is open. However, user channel initialization requires an
      open control channel. Furthermore, the user is not informed if the mux
      restarts due to configuration changes.
      Put the registration/deregistration procedure into separate function to
      improve readability.
      Move registration to mux activation and deregistration to mux cleanup to
      keep the user devices only open as long as a control channel exists. The
      user will be informed via the device driver if the mux was reconfigured in
      a way that required a mux re-activation.
      This makes it necessary to add T2 initialization to gsmld_open() for the
      ldisc open code path (not the reconfiguration code path) to avoid deletion
      of an uninitialized T2 at mux cleanup.
      
      Fixes: d50f6dca ("tty: n_gsm: expose gsmtty device nodes at ldisc open time")
      Signed-off-by: default avatarDaniel Starke <daniel.starke@siemens.com>
      Link: https://lore.kernel.org/r/20220701061652.39604-2-daniel.starke@siemens.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      01aecd91
    • Daniel Starke's avatar
      tty: n_gsm: fix user open not possible at responder until initiator open · ac77f007
      Daniel Starke authored
      After setting up the control channel on both sides the responder side may
      want to open a virtual tty to listen on until the initiator starts an
      application on a user channel. The current implementation allows the
      open() but no other operation, like termios. These fail with EINVAL.
      The responder sided application has no means to detect an open by the
      initiator sided application this way. And the initiator sided applications
      usually expect the responder sided application to listen on the user
      channel upon open.
      Set the user channel into half-open state on responder side once a user
      application opens the virtual tty to allow IO operations on it.
      Furthermore, keep the user channel constipated until the initiator side
      opens it to give the responder sided application the chance to detect the
      new connection and to avoid data loss if the responder sided application
      starts sending before the user channel is open.
      
      Fixes: e1eaea46 ("tty: n_gsm line discipline")
      Signed-off-by: default avatarDaniel Starke <daniel.starke@siemens.com>
      Link: https://lore.kernel.org/r/20220701061652.39604-1-daniel.starke@siemens.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ac77f007
  2. 30 Jun, 2022 10 commits
  3. 27 Jun, 2022 27 commits