netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Karsten Keil <keil@b1-systems.de>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	David Miller <davem@davemloft.net>,
	i4ldeveloper@listserv.isdn4linux.de
Subject: Re: [mISDN PATCH v2 09/19] Fix TEI and SAPI handling
Date: Sun, 24 May 2009 01:10:22 +0200	[thread overview]
Message-ID: <20090523231022.GA13203@uranus.ravnborg.org> (raw)
In-Reply-To: <200905231500.38092.keil@b1-systems.de>

> >
> > Unrealted to this specific patch...
> > Are there any specific reason why mISDN prefer bsd style (u_int)
> > rather then linux style (u32)?
> 
> No, this was some historic process with the ISDN code.
> I think, if we want change this we should make a separate  patch to change 
> this in all mISDN code later, I usually prefer shorter type names as well :-).
> So as rule of dumb:
> - Use   uN/sN for all values with constant width N ?
yes

> What should be used on functions which are usually defined as int and
> only return 0 or some negative ERROR code, I think int should be OK here ?
yes - use int here.

> > >  static struct layer2 *
> > > -create_new_tei(struct manager *mgr, int tei)
> > > +create_new_tei(struct manager *mgr, int tei, int sapi)
> > >  {
> >
> > Here tei and sapi are passed as signed.
> > But valid sapi range is [0..63] and tei [0..127].
> > And create_l2 above uses unsigned.
> >
> > This looks confusing.
> 
> I think the signed was selected for error handling, but you are correct then 
> it should be the same in all functions.
The correct values are the range [0..127] so as you also imply
reserving all negative values for error codes seems like the best choice.

So as a matter of consistency you should use int for tei/sapi all over.
> >
> > So get_free_tei() may return a negative value indicating no free tei.
> > So that make my comment above void - but is this really the best way
> > to return an error. Possibly it is..
> >
> We could define 255 as the error value, I will think about this, but in 
> general I prefer negative values for error cases.

Addressed above - agree.

> > >  	if (!(skb->data[1] & 1)) /* invalid EA1 */
> > >  		return -EINVAL;
> > > -	tei = skb->data[1] >> 0;
> > > +	tei = skb->data[1] >> 1;
> >
> > This looks like a bug-fix...
> >
> 
> Yes,  I think fixed TEI was never tested with P2MP,  I know
> no device which really use it with SAPI 0, only in P2P we use a
> fixed TEI  of 0.  Also the test suite used by certifications did
> not check for correct fixed TEI handling, it only checks that a
> fixed TEI is rejected in a dynamic TEI assignment.
> With SAPI != 0 fixed TEIs are more common, so the bug was
> detected now.
Yep - I know we used fixed tei in ptmp configuration
for sapi=16 (packet handling aka X.25 over ISDN).

	Sam

  reply	other threads:[~2009-05-23 23:08 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-22 20:42 [mISDN PATCH v2 00/19] mISDN patchset for next Karsten Keil
2009-05-22 21:04 ` [mISDN PATCH v2 01/19] Add watchdog functionality to hfcmulti driver Karsten Keil
2009-05-22 21:04 ` [mISDN PATCH v2 02/19] DSP now uses ring buffer for echo canceler Karsten Keil
2009-05-22 21:04 ` [mISDN PATCH v2 03/19] Echo canceler now gets delay information from hardware Karsten Keil
2009-05-22 21:04 ` [mISDN PATCH v2 05/19] Reduce stack size in dsp_cmx_send() Karsten Keil
2009-05-22 21:04 ` [mISDN PATCH v2 04/19] Fixed missing spin lock on pipeline process Karsten Keil
2009-05-22 21:04 ` [mISDN PATCH v2 06/19] Added layer-1-hold feature Karsten Keil
2009-05-22 21:04 ` [mISDN PATCH v2 09/19] Fix TEI and SAPI handling Karsten Keil
2009-05-22 21:53   ` Sam Ravnborg
2009-05-23 13:00     ` Karsten Keil
2009-05-23 23:10       ` Sam Ravnborg [this message]
2009-05-24 15:39         ` Karsten Keil
     [not found] ` <cover.1243024967.git.kkeil-Zw2aQviYsaUCyFmpLCWB8V3+hHH5wKcB@public.gmane.org>
2009-05-22 21:04   ` [mISDN PATCH v2 07/19] Fix DTMF locking bug issue Karsten Keil
2009-05-22 21:04   ` [mISDN PATCH v2 08/19] Hardware acceleration is now possible in conjunction with audio recording Karsten Keil
2009-05-22 21:04   ` [mISDN PATCH v2 10/19] Add "sapi" information to debug messages Karsten Keil
2009-05-22 21:04   ` [mISDN PATCH v2 11/19] Add allocation of recvbuf[1500] at run time to reduce stack size Karsten Keil
2009-05-22 21:04   ` [mISDN PATCH v2 12/19] Fix skb leak in error cases Karsten Keil
2009-05-22 21:04   ` [mISDN PATCH v2 14/19] Add XHFC support for embedded Speech-Design board to hfcmulti Karsten Keil
2009-05-22 21:04   ` [mISDN PATCH v2 13/19] isdn: get_free_devid() failure ignored Karsten Keil
2009-05-22 21:04   ` [mISDN PATCH v2 16/19] Added PCI ID for new Junghanns.net Single E1 cards Karsten Keil
2009-05-22 21:04   ` [mISDN PATCH v2 15/19] Add PCI ID for Junghanns 8S card Karsten Keil
2009-05-22 21:04   ` [mISDN PATCH v2 17/19] Cleanup debug messages Karsten Keil
2009-05-22 21:04   ` [mISDN PATCH v2 18/19] Use kernel_{send, recv}msg instead of open coding Karsten Keil
2009-05-22 21:04   ` [mISDN PATCH v2 19/19] Fix DTMF detection enable/disable Karsten Keil
2009-05-25  7:53 ` [mISDN PATCH v2 00/19] mISDN patchset for next David Miller

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=20090523231022.GA13203@uranus.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=davem@davemloft.net \
    --cc=i4ldeveloper@listserv.isdn4linux.de \
    --cc=keil@b1-systems.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.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).