1. 01 7月, 2022 3 次提交
    • D
      tty: n_gsm: fix wrong queuing behavior in gsm_dlci_data_output() · 556fc8ac
      Daniel Starke 提交于
      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: NDaniel Starke <daniel.starke@siemens.com>
      Link: https://lore.kernel.org/r/20220701061652.39604-3-daniel.starke@siemens.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      556fc8ac
    • D
      tty: n_gsm: fix tty registration before control channel open · 01aecd91
      Daniel Starke 提交于
      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: NDaniel Starke <daniel.starke@siemens.com>
      Link: https://lore.kernel.org/r/20220701061652.39604-2-daniel.starke@siemens.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      01aecd91
    • D
      tty: n_gsm: fix user open not possible at responder until initiator open · ac77f007
      Daniel Starke 提交于
      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: NDaniel Starke <daniel.starke@siemens.com>
      Link: https://lore.kernel.org/r/20220701061652.39604-1-daniel.starke@siemens.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ac77f007
  2. 10 6月, 2022 1 次提交
  3. 20 5月, 2022 1 次提交
  4. 06 5月, 2022 3 次提交
  5. 26 4月, 2022 1 次提交
  6. 22 4月, 2022 3 次提交
    • D
      tty: n_gsm: fix software flow control handling · f4f7d632
      Daniel Starke 提交于
      n_gsm is based on the 3GPP 07.010 and its newer version is the 3GPP 27.010.
      See https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1516
      The changes from 07.010 to 27.010 are non-functional. Therefore, I refer to
      the newer 27.010 here. Chapter 5.4.8.1 states that XON/XOFF characters
      shall be used instead of Fcon/Fcoff command in advanced option mode to
      handle flow control. Chapter 5.4.8.2 describes how XON/XOFF characters
      shall be handled. Basic option mode only used Fcon/Fcoff commands and no
      XON/XOFF characters. These are treated as data bytes here.
      The current implementation uses the gsm_mux field 'constipated' to handle
      flow control from the remote peer and the gsm_dlci field 'constipated' to
      handle flow control from each DLCI. The later is unrelated to this patch.
      The gsm_mux field is correctly set for Fcon/Fcoff commands in
      gsm_control_message(). However, the same is not true for XON/XOFF
      characters in gsm1_receive().
      Disable software flow control handling in the tty to allow explicit
      handling by n_gsm.
      Add the missing handling in advanced option mode for gsm_mux in
      gsm1_receive() to comply with the standard.
      
      This patch depends on the following commit:
      Commit 8838b2af ("tty: n_gsm: fix SW flow control encoding/handling")
      
      Fixes: e1eaea46 ("tty: n_gsm line discipline")
      Cc: stable@vger.kernel.org
      Signed-off-by: NDaniel Starke <daniel.starke@siemens.com>
      Link: https://lore.kernel.org/r/20220422071025.5490-3-daniel.starke@siemens.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f4f7d632
    • D
      tty: n_gsm: fix invalid use of MSC in advanced option · c19ffe00
      Daniel Starke 提交于
      n_gsm is based on the 3GPP 07.010 and its newer version is the 3GPP 27.010.
      See https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1516
      The changes from 07.010 to 27.010 are non-functional. Therefore, I refer to
      the newer 27.010 here. Chapter 5.4.6.3.7 states that the Modem Status
      Command (MSC) shall only be used if the basic option was chosen.
      The current implementation uses MSC frames even if advanced option was
      chosen to inform the peer about modem line state updates. A standard
      conform peer may choose to discard these frames in advanced option mode.
      Furthermore, gsmtty_modem_update() is not part of the 'tty_operations'
      functions despite its name.
      Rename gsmtty_modem_update() to gsm_modem_update() to clarify this. Split
      its function into gsm_modem_upd_via_data() and gsm_modem_upd_via_msc()
      depending on the encoding and adaption. Introduce gsm_dlci_modem_output()
      as adaption of gsm_dlci_data_output() to encode and queue empty frames in
      advanced option mode. Use it in gsm_modem_upd_via_data().
      gsm_modem_upd_via_msc() is based on the initial gsmtty_modem_update()
      function which used only MSC frames to update modem states.
      
      Fixes: e1eaea46 ("tty: n_gsm line discipline")
      Cc: stable@vger.kernel.org
      Signed-off-by: NDaniel Starke <daniel.starke@siemens.com>
      Link: https://lore.kernel.org/r/20220422071025.5490-2-daniel.starke@siemens.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c19ffe00
    • D
      tty: n_gsm: fix broken virtual tty handling · a8c5b825
      Daniel Starke 提交于
      Dynamic virtual tty registration was introduced to allow the user to handle
      these cases with uevent rules. The following commits relate to this:
      Commit 5b87686e ("tty: n_gsm: Modify gsmtty driver register method when config requester")
      Commit 0b91b533 ("tty: n_gsm: Save dlci address open status when config requester")
      Commit 46292622 ("tty: n_gsm: clean up indenting in gsm_queue()")
      
      However, the following behavior can be seen with this implementation:
      - n_gsm ldisc is activated via ioctl
      - all configuration parameters are set to their default value (initiator=0)
      - the mux gets activated and attached and gsmtty0 is being registered in
        in gsm_dlci_open() after DLCI 0 was established (DLCI 0 is the control
        channel)
      - the user configures n_gsm via ioctl GSMIOC_SETCONF as initiator
      - this re-attaches the n_gsm mux
      - no new gsmtty devices are registered in gsmld_attach_gsm() because the
        mux is already active
      - the initiator side registered only the control channel as gsmtty0
        (which should never happen) and no user channel tty
      
      The commits above make it impossible to operate the initiator side as no
      user channel tty is or will be available.
      On the other hand, this behavior will make it also impossible to allow DLCI
      parameter negotiation on responder side in the future. The responder side
      first needs to provide a device for the application before the application
      can set its parameters of the associated DLCI via ioctl.
      Note that the user application is still able to detect a link establishment
      without relaying to uevent by waiting for DTR open on responder side. This
      is the same behavior as on a physical serial interface. And on initiator
      side a tty hangup can be detected if a link establishment request failed.
      
      Revert the commits above completely to always register all user channels
      and no control channel after mux attachment. No other changes are made.
      
      Fixes: 5b87686e ("tty: n_gsm: Modify gsmtty driver register method when config requester")
      Cc: stable@vger.kernel.org
      Signed-off-by: NDaniel Starke <daniel.starke@siemens.com>
      Link: https://lore.kernel.org/r/20220422071025.5490-1-daniel.starke@siemens.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a8c5b825
  7. 20 4月, 2022 3 次提交
  8. 15 4月, 2022 16 次提交
  9. 22 2月, 2022 7 次提交
  10. 26 1月, 2022 1 次提交
  11. 26 11月, 2021 1 次提交