From: Chen Gang <gang.chen@asianux.com>
To: Paul Fulghum <paulkf@microgate.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
Greg KH <gregkh@linuxfoundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-serial@vger.kernel.org
Subject: Re: [PATCH] synclink fix ldisc buffer argument
Date: Wed, 05 Dec 2012 09:57:34 +0800 [thread overview]
Message-ID: <50BEAA0E.9000603@asianux.com> (raw)
In-Reply-To: <50BCCD4C.8050209@microgate.com>
于 2012年12月04日 00:03, Paul Fulghum 写道:
> On 12/2/2012 8:20 PM, Chen Gang wrote:
>> pardon (I am just learning)
>> does 65535 mean HDLC_MAX_FRAME_SIZE ?
>> why do we need info->max_frame_size >= 4096 ?
>> in drivers/tty/synclink_gt.c:
>> 3550 if (info->max_frame_size < 4096)
>> 3551 info->max_frame_size = 4096;
>> 3552 else if (info->max_frame_size > 65535)
>> 3553 info->max_frame_size = 65535;
>> 3554
>> ...
>> 3603 info->max_frame_size = 4096;
>
> The hardware can send and receive HDLC frames up to
> 64K in size. The driver defaults to 4K max frame size
> to save buffer space for the common case
> (line 3603 in alloc_dev()).
>
> The module parameter max_frame_size can override the default
> in add_device() (lines 3550-3554 are from add_device()
> range checking the module parameter)
>
thank you.
sorry for reply late (yesterday, I have an annual leave for personal things, and not connect net).
by the way:
does it also need check the length in function rx_get_buf ?
(it seems not, but I am not quite sure, can you give a confirm ?)
4779 /*
4780 * pass receive buffer (RAW synchronous mode) to tty layer
4781 * return true if buffer available, otherwise false
4782 */
4783 static bool rx_get_buf(struct slgt_info *info)
4784 {
4785 unsigned int i = info->rbuf_current;
4786 unsigned int count;
4787
4788 if (!desc_complete(info->rbufs[i]))
4789 return false;
4790 count = desc_count(info->rbufs[i]);
4791 switch(info->params.mode) {
4792 case MGSL_MODE_MONOSYNC:
4793 case MGSL_MODE_BISYNC:
4794 case MGSL_MODE_XSYNC:
4795 /* ignore residue in byte synchronous modes */
4796 if (desc_residue(info->rbufs[i]))
4797 count--;
4798 break;
4799 }
4800 DBGDATA(info, info->rbufs[i].buf, count, "rx");
4801 DBGINFO(("rx_get_buf size=%d\n", count));
4802 if (count)
4803 ldisc_receive_buf(info->port.tty, info->rbufs[i].buf,
4804 info->flag_buf, count);
4805 free_rbufs(info, i, i);
4806 return true;
4807 }
--
Chen Gang
Asianux Corporation
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Chen Gang <gang.chen@asianux.com>
To: Paul Fulghum <paulkf@microgate.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
Greg KH <gregkh@linuxfoundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-serial@vger.kernel.org
Subject: Re: [PATCH] synclink fix ldisc buffer argument
Date: Wed, 05 Dec 2012 09:57:34 +0800 [thread overview]
Message-ID: <50BEAA0E.9000603@asianux.com> (raw)
In-Reply-To: <50BCCD4C.8050209@microgate.com>
于 2012年12月04日 00:03, Paul Fulghum 写道:
> On 12/2/2012 8:20 PM, Chen Gang wrote:
>> pardon (I am just learning)
>> does 65535 mean HDLC_MAX_FRAME_SIZE ?
>> why do we need info->max_frame_size >= 4096 ?
>> in drivers/tty/synclink_gt.c:
>> 3550 if (info->max_frame_size < 4096)
>> 3551 info->max_frame_size = 4096;
>> 3552 else if (info->max_frame_size > 65535)
>> 3553 info->max_frame_size = 65535;
>> 3554
>> ...
>> 3603 info->max_frame_size = 4096;
>
> The hardware can send and receive HDLC frames up to
> 64K in size. The driver defaults to 4K max frame size
> to save buffer space for the common case
> (line 3603 in alloc_dev()).
>
> The module parameter max_frame_size can override the default
> in add_device() (lines 3550-3554 are from add_device()
> range checking the module parameter)
>
thank you.
sorry for reply late (yesterday, I have an annual leave for personal things, and not connect net).
by the way:
does it also need check the length in function rx_get_buf ?
(it seems not, but I am not quite sure, can you give a confirm ?)
4779 /*
4780 * pass receive buffer (RAW synchronous mode) to tty layer
4781 * return true if buffer available, otherwise false
4782 */
4783 static bool rx_get_buf(struct slgt_info *info)
4784 {
4785 unsigned int i = info->rbuf_current;
4786 unsigned int count;
4787
4788 if (!desc_complete(info->rbufs[i]))
4789 return false;
4790 count = desc_count(info->rbufs[i]);
4791 switch(info->params.mode) {
4792 case MGSL_MODE_MONOSYNC:
4793 case MGSL_MODE_BISYNC:
4794 case MGSL_MODE_XSYNC:
4795 /* ignore residue in byte synchronous modes */
4796 if (desc_residue(info->rbufs[i]))
4797 count--;
4798 break;
4799 }
4800 DBGDATA(info, info->rbufs[i].buf, count, "rx");
4801 DBGINFO(("rx_get_buf size=%d\n", count));
4802 if (count)
4803 ldisc_receive_buf(info->port.tty, info->rbufs[i].buf,
4804 info->flag_buf, count);
4805 free_rbufs(info, i, i);
4806 return true;
4807 }
--
Chen Gang
Asianux Corporation
next prev parent reply other threads:[~2012-12-05 1:56 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <50B6E751.9000000@asianux.com>
2012-11-29 5:07 ` [Suggestion] drivers/tty: drivers/char/: for MAX_ASYNC_BUFFER_SIZE Chen Gang
2012-11-29 13:41 ` Alan Cox
2012-11-30 2:27 ` Chen Gang
2012-11-30 3:39 ` Chen Gang
2012-11-29 5:13 ` 【Suggestion】drivers/tty: " Greg KH
2012-11-29 5:57 ` [Suggestion] drivers/tty: " Chen Gang
2012-11-29 6:14 ` [PATCH] MAINTAINERS: TTY - Add linux-serial mailing list Joe Perches
2012-11-29 6:27 ` Chen Gang
2012-11-29 6:27 ` Chen Gang
2012-11-29 8:23 ` Jiri Slaby
2012-11-29 18:32 ` [Suggestion] drivers/tty: drivers/char/: for MAX_ASYNC_BUFFER_SIZE Greg KH
2012-11-30 2:52 ` Chen Gang
2012-11-30 2:52 ` Chen Gang
[not found] ` <C7D3911F-7B6B-4353-A84B-0218FAB27198@microgate.com>
2012-11-30 6:28 ` Chen Gang
2012-11-30 7:14 ` Chen Gang
2012-11-30 16:24 ` Paul Fulghum
2012-11-30 19:46 ` [PATCH] synclink fix ldisc buffer argument Paul Fulghum
2012-12-02 15:13 ` Alan Cox
[not found] ` <F6B8A325-7DBF-4623-B16C-CDC5642EFD16@microgate.com>
2012-12-02 18:10 ` Alan Cox
2012-12-02 18:10 ` Alan Cox
[not found] ` <989CB961-79F8-479B-B16C-41358A60AC94@microgate.com>
2012-12-03 2:20 ` Chen Gang
2012-12-03 16:03 ` Paul Fulghum
2012-12-05 1:57 ` Chen Gang [this message]
2012-12-05 1:57 ` Chen Gang
2012-12-19 2:23 ` Chen Gang
2012-12-19 2:23 ` Chen Gang
2012-12-19 4:09 ` Greg KH
2012-12-19 4:10 ` Chen Gang
2012-12-19 4:10 ` Chen Gang
2012-12-20 4:16 ` [PATCH] drivers/tty/synclink: let receive buffer size match max frame size Chen Gang
2012-12-03 17:13 ` [PATCH] synclink fix ldisc buffer argument Paul Fulghum
2012-12-05 1:35 ` Chen Gang
2012-12-05 1:35 ` Chen Gang
2012-12-07 2:15 ` Chen Gang
2012-12-07 2:15 ` Chen Gang
2012-12-10 1:32 ` [Consult]: " Chen Gang
2012-12-10 1:32 ` Chen Gang
2012-12-01 9:01 ` [Suggestion] drivers/tty: drivers/char/: for MAX_ASYNC_BUFFER_SIZE Chen Gang
2012-12-01 9:01 ` Chen Gang
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=50BEAA0E.9000603@asianux.com \
--to=gang.chen@asianux.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=paulkf@microgate.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.