09 Nov, 2011

1 commit

  • Alek Du reported that the code erroneously applies time to jiffies
    conversions twice to the t1 and t2 values. In normal use on a modem link
    this cases no visible problem but on a slower link it will break as with
    HZ=1000 as is typical we are running t1/t2 ten times too fast.

    Alek's original patch removed the conversion from the timer setting but we
    in fact have to be more careful as the contents of t1/t2 are visible via
    the device API and we thus need to correct the constants.

    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     

27 Sep, 2011

3 commits

  • n_gsm use a simple approach: every writing to fifo correspond exactly one
    reading from fifo. There are no problem in this approach until we read
    less bytes then we write. As result fifo may owerflow. This leads to packet
    loss and very slow responce.

    For example, this happens with ping packets (about 96 byte each) and default
    gsm->mtu = 64. As result we get 50 sec ping timeout and 20% packet loss.

    Fix the problem by reading and sending all data from the fifo

    Signed-off-by: Mikhail Kshevetskiy
    Signed-off-by: Greg Kroah-Hartman

    Mikhail Kshevetskiy
     
  • in adaption=2 case we should put 1 or 2 byte with modem status bits
    at the beginning of a buffer pointed by "dp". n_gsm use 1 byte case,
    so it allocate a buffer of len + 1 size. As result we should:
    * put 1 byte of modem status bits
    * increase data pointer
    * put "len" bytes of data
    but actually we have:
    * increase first byte with the value of modem status bits
    * decrease "len"
    * put orig_len - 1 bytes of data starting from the buffer beggining
    This is evidently wrong.

    Signed-off-by: Mikhail Kshevetskiy
    Signed-off-by: Greg Kroah-Hartman

    Mikhail Kshevetskiy
     
  • Clear bitmask was not inverted before masking modem_tx.

    Calling ioctl(fd, TIOCMBIC, TIOCM_RTS) results in:

    [ 197.430000] pre_modem_tx: 0x00000006
    [ 197.430000] clear: 0x00000004
    [ 197.430000] set: 0x00000000
    [ 197.440000] post_modem_tx: 0x00000004

    which is wrong.

    Signed-off-by: Nikola Diklic-Perin
    Acked-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Nikola Diklic-Perin
     

27 Aug, 2011

2 commits


26 Jul, 2011

1 commit

  • * 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6: (26 commits)
    amba pl011: workaround for uart registers lockup
    n_gsm: fix the wrong FCS handling
    pch_uart: add missing comment about OKI ML7223
    pch_uart: Add MSI support
    tty: fix "IRQ45: nobody cared"
    PTI feature to allow user to name and mark masterchannel request.
    0 for o PTI Makefile bug.
    tty: serial: samsung.c remove legacy PM code.
    SERIAL: SC26xx: Fix link error.
    serial: mrst_max3110: initialize waitqueue earlier
    mrst_max3110: Change max missing message priority.
    tty: s5pv210: Add delay loop on fifo reset function for UART
    tty/serial: Fix XSCALE serial ports, e.g. ce4100
    serial: bfin_5xx: fix off-by-one with resource size
    drivers/tty: use printk_ratelimited() instead of printk_ratelimit()
    tty: n_gsm: Added refcount usage to gsm_mux and gsm_dlci structs
    tty: n_gsm: Add raw-ip support
    tty: n_gsm: expose gsmtty device nodes at ldisc open time
    pch_phub: Fix register miss-setting issue
    serial: 8250, increase PASS_LIMIT
    ...

    Linus Torvalds
     

09 Jul, 2011

1 commit

  • FCS could be GSM0_SOF, so will break state machine...

    [This byte isn't quoted in any way so a SOF here doesn't imply an error
    occurred.]

    Signed-off-by: Alek Du
    Signed-off-by: Alan Cox
    Cc: stable [3.0]

    [Trivial but best backported once its in 3.1rc I think]
    Signed-off-by: Greg Kroah-Hartman

    Du, Alek
     

02 Jul, 2011

3 commits

  • The gsm_mux is created/destroyed when ldisc is
    opened/closed but clients of the MUX channel devices (gsmttyN)
    may access this structure as long as the TTYs are open.
    For the open, the ldisc open is guaranteed to preceed the TTY open,
    but the close has no such guaranteed ordering. As a result,
    the gsm_mux can be freed in the ldisc close before being accessed
    by one of the TTY clients. This can happen if the ldisc is removed
    while there are open, active MUX channels.
    A similar situation exists for DLCI-0, it is basically a resource
    shared by MUX and DLCI , and should not be freed while they can
    be accessed

    To avoid this, gsm_mux and dlcis now have a reference counter
    ldisc open takes a reference on the mux and all the dlcis
    gsmtty_open takes a reference on the mux, dlci0 and its specific
    dlci. Dropping the last reference initiates the actual free.

    Signed-off-by: Russ Gorby
    Acked-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Russ Gorby
     
  • This patch adds the ability to open a network data connection over a mux
    virtual tty channel. This is for modems that support data connections
    with raw IP frames instead of PPP. On high speed data connections this
    eliminates a significant amount of PPP overhead. To use this interface,
    the application must first tell the modem to open a network connection on
    a virtual tty. Once that has been accomplished, the app will issue an
    IOCTL on that virtual tty to create the network interface. The IOCTL will
    return the index of the interface created.

    The two IOCTL commands are:

    ioctl( fd, GSMIOC_ENABLE_NET );

    ioctl( fd, GSMIOC_DISABLE_NET );

    Signed-off-by: Russ Gorby
    Acked-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Russ Gorby
     
  • The n_gsm driver being an ldisc, does not provide a convenient method
    e.g. udev to create the tty device nodes automatically when the ldisc
    is opened.

    The TTY device nodes are now created via calls to tty_register_device
    from the ldisc open.

    Signed-off-by: Russ Gorby
    Signed-off-by: Greg Kroah-Hartman

    Russ Gorby
     

17 Jun, 2011

2 commits


04 Jun, 2011

1 commit

  • This reverts commit b1c43f82c5aa265442f82dba31ce985ebb7aa71c.

    It was broken in so many ways, and results in random odd pty issues.

    It re-introduced the buggy schedule_work() in flush_to_ldisc() that can
    cause endless work-loops (see commit a5660b41af6a: "tty: fix endless
    work loop when the buffer fills up").

    It also used an "unsigned int" return value fo the ->receive_buf()
    function, but then made multiple functions return a negative error code,
    and didn't actually check for the error in the caller.

    And it didn't actually work at all. BenH bisected down odd tty behavior
    to it:
    "It looks like the patch is causing some major malfunctions of the X
    server for me, possibly related to PTYs. For example, cat'ing a
    large file in a gnome terminal hangs the kernel for -minutes- in a
    loop of what looks like flush_to_ldisc/workqueue code, (some ftrace
    data in the quoted bits further down).

    ...

    Some more data: It -looks- like what happens is that the
    flush_to_ldisc work queue entry constantly re-queues itself (because
    the PTY is full ?) and the workqueue thread will basically loop
    forver calling it without ever scheduling, thus starving the consumer
    process that could have emptied the PTY."

    which is pretty much exactly the problem we fixed in a5660b41af6a.

    Milton Miller pointed out the 'unsigned int' issue.

    Reported-by: Benjamin Herrenschmidt
    Reported-by: Milton Miller
    Cc: Stefan Bigler
    Cc: Toby Gray
    Cc: Felipe Balbi
    Cc: Greg Kroah-Hartman
    Cc: Alan Cox
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

24 May, 2011

1 commit

  • * 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6: (48 commits)
    serial: 8250_pci: add support for Cronyx Omega PCI multiserial board.
    tty/serial: Fix break handling for PORT_TEGRA
    tty/serial: Add explicit PORT_TEGRA type
    n_tracerouter and n_tracesink ldisc additions.
    Intel PTI implementaiton of MIPI 1149.7.
    Kernel documentation for the PTI feature.
    export kernel call get_task_comm().
    tty: Remove to support serial for S5P6442
    pch_phub: Support new device ML7223
    8250_pci: Add support for the Digi/IBM PCIe 2-port Adapter
    ASoC: Update cx20442 for TTY API change
    pch_uart: Support new device ML7223 IOH
    parport: Use request_muxed_region for IT87 probe and lock
    tty/serial: add support for Xilinx PS UART
    n_gsm: Use print_hex_dump_bytes
    drivers/tty/moxa.c: Put correct tty value
    TTY: tty_io, annotate locking functions
    TTY: serial_core, remove superfluous set_task_state
    TTY: serial_core, remove invalid test
    Char: moxa, fix locking in moxa_write
    ...

    Fix up trivial conflicts in drivers/bluetooth/hci_ldisc.c and
    drivers/tty/serial/Makefile.

    I did the hci_ldisc thing as an evil merge, cleaning things up.

    Linus Torvalds
     

10 May, 2011

1 commit


30 Apr, 2011

1 commit

  • Use the standard mechanism to print a hex buffer
    to eliminate empty printf warning.

    A couple % smaller text and data too.

    $ size drivers/tty/n_gsm.o*
    text data bss dec hex filename
    23543 312 6376 30231 7617 drivers/tty/n_gsm.o.new
    24051 408 6496 30955 78eb drivers/tty/n_gsm.o.old

    Signed-off-by: Joe Perches
    Acked-by: Randy Dunlap
    Signed-off-by: Greg Kroah-Hartman

    Joe Perches
     

23 Apr, 2011

1 commit

  • it makes it simpler to keep track of the amount of
    bytes received and simplifies how flush_to_ldisc counts
    the remaining bytes. It also fixes a bug of lost bytes
    on n_tty when flushing too many bytes via the USB
    serial gadget driver.

    Tested-by: Stefan Bigler
    Tested-by: Toby Gray
    Signed-off-by: Felipe Balbi
    Signed-off-by: Greg Kroah-Hartman

    Felipe Balbi
     

20 Apr, 2011

1 commit

  • Problem description:
    gsm_queue() calculate a CRC for arrived frames. As a last step of
    CRC calculation it call

    gsm->fcs = gsm_fcs_add(gsm->fcs, gsm->received_fcs);

    This work perfectly for the case of GSM0 mode as gsm->received_fcs
    contain the last piece of data required to generate final CRC.

    gsm->received_fcs is not used for GSM1 mode. Thus we put an
    additional byte to CRC calculation. As result we get a wrong CRC
    and reject incoming frame.

    Signed-off-by: Mikhail Kshevetskiy
    Acked-by: Alan Cox
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Mikhail Kshevetskiy
     

31 Mar, 2011

1 commit


10 Mar, 2011

1 commit

  • * the GSM 07.10 specification says in 5.4.3.1 that
    'both stations shall set the P bit to 0'
    thanks to Alan Cox for finding this explanation in the spec

    * without this fix, on Telit & Sim.com modems, opening a new DLC
    randomly fails. Not setting PF bit of the control byte gives a
    reliable behaviour on these modems.

    Signed-off-by: Eric Bénard
    Cc: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Eric Bénard
     

25 Feb, 2011

1 commit


18 Feb, 2011

3 commits


04 Feb, 2011

1 commit


08 Jan, 2011

1 commit

  • * 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6: (36 commits)
    serial: apbuart: Fixup apbuart_console_init()
    TTY: Add tty ioctl to figure device node of the system console.
    tty: add 'active' sysfs attribute to tty0 and console device
    drivers: serial: apbuart: Handle OF failures gracefully
    Serial: Avoid unbalanced IRQ wake disable during resume
    tty: fix typos/errors in tty_driver.h comments
    pch_uart : fix warnings for 64bit compile
    8250: fix uninitialized FIFOs
    ip2: fix compiler warning on ip2main_pci_tbl
    specialix: fix compiler warning on specialix_pci_tbl
    rocket: fix compiler warning on rocket_pci_ids
    8250: add a UPIO_DWAPB32 for 32 bit accesses
    8250: use container_of() instead of casting
    serial: omap-serial: Add support for kernel debugger
    serial: fix pch_uart kconfig & build
    drivers: char: hvc: add arm JTAG DCC console support
    RS485 documentation: add 16C950 UART description
    serial: ifx6x60: fix memory leak
    serial: ifx6x60: free IRQ on error
    Serial: EG20T: add PCH_UART driver
    ...

    Fixed up conflicts in drivers/serial/apbuart.c with evil merge that
    makes the code look fairly sane (unlike either side).

    Linus Torvalds
     

17 Dec, 2010

2 commits

  • gsm_data_alloc buffer allocation could fail and it is not being checked.

    Add check for allocated buffer and return if the buffer allocation
    fails.

    Signed-off-by: Ken Mills
    Signed-off-by: Alan Cox
    Cc: stable@kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Ken Mills
     
  • Fix message length handling when building header

    When the message length is greater than 127, the length field in the header
    is built incorrectly. According to the spec, when the length is less than 128
    the length field is a single byte formatted as: bbbbbbb1. When it is greater
    than 127 then the field is two bytes of the format: bbbbbbb0 bbbbbbbb.

    Signed-off-by: Ken Mills
    Signed-off-by: Alan Cox
    Cc: stable@kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Ken Mills
     

12 Nov, 2010

4 commits

  • [Original From Ken Mills but I redid it using pr_ helpers instead]

    Also fix up coding style, there are two warnings left but that is where
    the CodingStyle tools blow up because they cannot handle

    if (blah) {
    foo
    } else switch (x) {
    case 1:
    }

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • The mux supports several encoding schemes. Encoding 0 is a "not
    recommended" mode still sometimes used. This has now been tested with
    hardware that supports this mode, and found wanting.

    Fix the FCS handling in this mode and correct the state machine.

    Signed-off-by: Ken Mills
    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • If the mux is configured with a large mru/mtu the existing code gets the
    byte ordering wrong for the header.

    Signed-off-by: Ken Mills
    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Ken Mills
     
  • The n2 field is settable but didn't get propogated

    Signed-off-by: Ken Mills
    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Ken Mills
     

05 Nov, 2010

1 commit