From owner-freebsd-isdn@FreeBSD.ORG Thu Mar 3 23:47:43 2005 Return-Path: Delivered-To: freebsd-isdn@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A4C2916A4CE for ; Thu, 3 Mar 2005 23:47:43 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.206]) by mx1.FreeBSD.org (Postfix) with ESMTP id 39B8E43D4C for ; Thu, 3 Mar 2005 23:47:41 +0000 (GMT) (envelope-from jgale.work@gmail.com) Received: by rproxy.gmail.com with SMTP id a41so491078rng for ; Thu, 03 Mar 2005 15:47:40 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; b=EnVYTBywUSy/BGP/j7BO8Kne1eopHvIkhvcgeXK+lbwS/SobaS0uSIb28TxL0LE6zoqqhyOZITm/x4pZh3rGx8zxikOQZXRonzqECe+xVXrE9VonRS532yImzK7VUAAlhIbsHBzSWeaYsqfJjjuoGdx8WJvvG9cIxSj+1cYvm6g= Received: by 10.38.86.26 with SMTP id j26mr217140rnb; Thu, 03 Mar 2005 15:47:40 -0800 (PST) Received: by 10.38.71.63 with HTTP; Thu, 3 Mar 2005 15:47:40 -0800 (PST) Message-ID: <1a4ba29305030315476c92b656@mail.gmail.com> Date: Thu, 3 Mar 2005 16:47:40 -0700 From: Jeremy Gale To: freebsd-isdn@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Multiple Port Passive ISDN Card X-BeenThere: freebsd-isdn@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Jeremy Gale List-Id: Using ISDN with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Mar 2005 23:47:43 -0000 Hi everyone, I'm trying to evalutate the feasibility of using the i4b framework to write a driver for a multiple port (AKA multiple trunk, multiple span) passive ISDN card. E.g. a card with 8 BRI ports. I'm writing the driver for NetBSD so that's mostly what I've been looking at. If things are significantly different on FreeBSD please let me know. The one problem I've isolated is the l1_token member in the isdn_l3_driver struct. It looks to me that for all passive cards, it is used as a pointer to the l2_softc struct. For the CAPI active cards it points to a capi_softc_t structure. For the incomplete daic driver, the only multiple port card I am aware of, it is a pointer to the structure for the specific port being used. I believe I need to do something similar to the daic driver, but also need the l2_softc pointer. One of the crucial functions seems to be i4b_link_bchandrvr(call_desc_t *cd) for connecting a call to a B channel driver. The function first gets a port-specific l3drv driver 'd', and then calls cd->ilt = d->l3driver->get_linktab(d->l1_token, cd->channelid); I assume the channel ID cannot belong to a huge range (my card could have 130+ B channels) and is specific to the port. So the l1_token needs to be used to specify what port is being used. daic_ret_linktab uses this to calculate which daic_connection linktab to return like so: struct daic_unit *du = token; struct daic_softc *sc = du->du_sc; int port = du->du_port; struct daic_connection *con = &sc->sc_con[port*2+channel]; return(&con->isdn_linktab); I also need to do something like this - index into my large B channel array. Right now I'm thinking of using a hack. Each port will have an l2_softc structure and the member immediately after the structure will be the port number. Then I can use some trickery like: struct l2_softc *l2sc = token; int* port_ptr = (int *) (token + sizeof(l2_softc)); int port = *port_ptr; My pointer arithmetic may be a little off there but you get the idea. Does this seem like a good idea? Is there a cleaner way to do it? Am I likely to encounter other problems trying to develop a multiple port driver? How far along is the daic driver? Is it a proof of concept or farther than that? Thanks very much! Jeremy