From: Denis Joseph Barrow <D.Barow-x9gZzRpC1QbQT0dZR+AlfA@public.gmane.org>
To: Jeff Garzik <jgarzik-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
Cc: greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org,
Linux USB kernel mailing list
<linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: hso driver dropping characters on serial port & hacky fix
Date: Wed, 27 Aug 2008 12:54:17 +0200 [thread overview]
Message-ID: <48B53259.90005@option.com> (raw)
In-Reply-To: <48B52064.9070700-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
Hi,
We have a problem with the hso driver serial ports.
The problem is a little complex but I hope I can explain it adequetely.
If you are unfamiliar with USB URBS are basically buffers we give to usb
hardware to recieve or transmit packets to a USB device.
The problem manifests itself when our hardware guys at option
have a userland diagnostics program going & on a system under
heavy load, the tty layers buffers belonging to our emulated serial port
fill up because the userland program gets no
chance to chance to empty data on the modems emulated serial port.
If we modify put_rxbuf_data(struct urb *urb, struct hso_serial *serial)
with the copied check below we get printks under heavy load
> copied=tty_insert_flip_string(tty, urb->transfer_buffer,
> urb->actual_length);
> if(copied<urb->actual_length)
> printk(KERN_ERR" hso: put_rxbuf_data did not "
> "copy full rx buffer copied=%d asked to copy=%d\n",
> copied,urb->actual_length);
In the current driver code you've got the driver drops packets silently.
I initially thought that this was not our problem/bug because I
thought we had no means for USB flow control & told our diagnostic
guys to go away & stop annoying me.
However I was talking to the firmware developer of our feama 3G modem
& he says that the modem will stall gracefully if it doesn't
have outstanding bulk_urbs on the emulated serial ports.
i.e. we have a mechanism to do flow control on our emulated serial
ports & get away without dropping packets or data corruption.
If I redesign the code.
We run into a problem if we have no outstanding urbs on
the serial recieve channel as we will get no more read channel callback
interrupts. We need to poll the tty layer to
see if we have free space to put data from the
urbs we have not yet processed on the read channel or go with my hack.
The hack I'm suggesting which Filip Aben is worried that wont
get accepted by you is to put a change the line discipline function pointer
for the hso driver i.e. the bit that calls
disc->ops->receive_buf(tty, char_buf,flag_buf, count);
in
static void flush_to_ldisc(struct work_struct *work)
in
/drivers/char/tty_io.c
to point to our own special function in the hso driver where we call the original
disc->ops->receive_buf so we get automatically
notified when we have free space in the hso drivers tty buffers.
Short of modifying the tty layer I can see no other way of doing this
efficently.
Is this acceptable to you guys.
This is the most elegant hack I can see to solve this problem,
if any of ye have a cleaner suggestion let me know.
Sincerely,
D.J. Barrow
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2008-08-27 10:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20080820010353.593820280@mini.kroah.org>
[not found] ` <20080820010738.GA3365-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2008-08-20 1:07 ` [patch 01/02] hso: icon 322 detection fix greg-U8xfFu+wG4EAvxtiuMwx3w
[not found] ` <20080820010752.GB3365-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2008-08-27 9:37 ` Jeff Garzik
[not found] ` <48B52064.9070700-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2008-08-27 10:54 ` Denis Joseph Barrow [this message]
2008-08-27 15:55 ` question wrt /drivers/char/tty_io.c in pre 2.6.16 code Denis Joseph Barrow
[not found] ` <48B578F3.1050908-x9gZzRpC1QbQT0dZR+AlfA@public.gmane.org>
2008-08-27 16:19 ` Greg KH
2008-08-27 16:37 ` Alan Cox
2008-08-28 7:47 ` Denis Joseph Barrow
2008-08-20 1:07 ` [patch 02/02] hso: dev_kfree_skb crash fix greg-U8xfFu+wG4EAvxtiuMwx3w
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48B53259.90005@option.com \
--to=d.barow-x9gzzrpc1qbqt0dzr+alfa@public.gmane.org \
--cc=greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org \
--cc=jgarzik-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).