Cache a pointer to layer 3 driver state in a call descriptor.
Use this instead of expensive isdn_find_l3_by_bri() calls where possible.
This commit is contained in:
parent
e14f4779db
commit
4afabfd9b3
|
@ -27,7 +27,7 @@
|
|||
* i4b_i4bdrv.c - i4b userland interface driver
|
||||
* --------------------------------------------
|
||||
*
|
||||
* $Id: i4b_i4bdrv.c,v 1.17 2002/03/30 11:15:41 martin Exp $
|
||||
* $Id: i4b_i4bdrv.c,v 1.18 2002/03/30 11:43:33 martin Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
|
@ -36,7 +36,7 @@
|
|||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: i4b_i4bdrv.c,v 1.17 2002/03/30 11:15:41 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: i4b_i4bdrv.c,v 1.18 2002/03/30 11:43:33 martin Exp $");
|
||||
|
||||
#include "isdn.h"
|
||||
|
||||
|
@ -365,6 +365,7 @@ isdnioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
|||
break;
|
||||
}
|
||||
cd->bri = -1;
|
||||
cd->l3drv = NULL;
|
||||
|
||||
d = isdn_find_l3_by_bri(mcr->controller);
|
||||
if (d == NULL) {
|
||||
|
@ -383,6 +384,7 @@ isdnioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
|||
}
|
||||
|
||||
cd->bri = mcr->controller; /* fill cd */
|
||||
cd->l3drv = d;
|
||||
cd->bprot = mcr->bprot;
|
||||
cd->bchan_driver_index = mcr->driver;
|
||||
cd->bchan_driver_unit = mcr->driver_unit;
|
||||
|
@ -672,7 +674,7 @@ isdnioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
|||
|
||||
T400_stop(cd);
|
||||
|
||||
d = isdn_find_l3_by_bri(cd->bri);
|
||||
d = cd->l3drv;
|
||||
if (d == NULL) {
|
||||
error = EINVAL;
|
||||
break;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* i4b_l2if.c - Layer 3 interface to Layer 2
|
||||
* -------------------------------------------
|
||||
*
|
||||
* $Id: i4b_l2if.c,v 1.4 2002/03/24 20:35:59 martin Exp $
|
||||
* $Id: i4b_l2if.c,v 1.5 2002/03/30 11:43:33 martin Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
|
@ -36,7 +36,7 @@
|
|||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: i4b_l2if.c,v 1.4 2002/03/24 20:35:59 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: i4b_l2if.c,v 1.5 2002/03/30 11:43:33 martin Exp $");
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include "i4bq931.h"
|
||||
|
@ -133,7 +133,7 @@ make_q931_cause(cause_t cause)
|
|||
int
|
||||
i4b_get_dl_stat(call_desc_t *cd)
|
||||
{
|
||||
const struct isdn_l3_driver * drv = isdn_find_l3_by_bri(cd->bri);
|
||||
const struct isdn_l3_driver * drv = cd->l3drv;
|
||||
return drv->dl_est;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* i4b_l3l4.h - layer 3 / layer 4 interface
|
||||
* ------------------------------------------
|
||||
*
|
||||
* $Id: i4b_l3l4.h,v 1.12 2002/03/30 11:15:41 martin Exp $
|
||||
* $Id: i4b_l3l4.h,v 1.13 2002/03/30 11:43:33 martin Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
|
@ -66,6 +66,7 @@ typedef struct i4b_isdn_bchan_linktab {
|
|||
} isdn_link_t;
|
||||
|
||||
struct isdn_l4_driver_functions;
|
||||
struct isdn_l3_driver;
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* this structure describes one call/connection on one B-channel
|
||||
|
@ -75,6 +76,7 @@ typedef struct call_desc
|
|||
{
|
||||
u_int cdid; /* call descriptor id */
|
||||
int bri; /* isdn controller number */
|
||||
struct isdn_l3_driver *l3drv;
|
||||
int cr; /* call reference value */
|
||||
|
||||
int crflag; /* call reference flag */
|
||||
|
@ -222,7 +224,6 @@ const struct isdn_l4_driver_functions *isdn_l4_get_driver(int driver_id, int uni
|
|||
/* forward decl. */
|
||||
struct isdn_diagnostic_request;
|
||||
struct isdn_dr_prot;
|
||||
struct isdn_l3_driver;
|
||||
|
||||
/*
|
||||
* functions exported by a layer 3 driver to layer 4
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* i4b_l4.c - kernel interface to userland
|
||||
* -----------------------------------------
|
||||
*
|
||||
* $Id: i4b_l4.c,v 1.19 2002/03/30 11:15:41 martin Exp $
|
||||
* $Id: i4b_l4.c,v 1.20 2002/03/30 11:43:33 martin Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
|
@ -36,7 +36,7 @@
|
|||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: i4b_l4.c,v 1.19 2002/03/30 11:15:41 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: i4b_l4.c,v 1.20 2002/03/30 11:43:33 martin Exp $");
|
||||
|
||||
#include "isdn.h"
|
||||
#include "irip.h"
|
||||
|
@ -633,7 +633,7 @@ i4b_l4_disconnect_ind(call_desc_t *cd)
|
|||
i4b_unlink_bchandrvr(cd);
|
||||
}
|
||||
|
||||
d = isdn_find_l3_by_bri(cd->bri);
|
||||
d = cd->l3drv;
|
||||
|
||||
if((cd->channelid == CHAN_B1) || (cd->channelid == CHAN_B2))
|
||||
{
|
||||
|
@ -808,7 +808,7 @@ i4b_l4_contr_ev_ind(int controller, int attach)
|
|||
static int
|
||||
i4b_link_bchandrvr(call_desc_t *cd)
|
||||
{
|
||||
struct isdn_l3_driver *d = isdn_find_l3_by_bri(cd->bri);
|
||||
struct isdn_l3_driver *d = cd->l3drv;
|
||||
|
||||
if (d == NULL || d->l3driver == NULL || d->l3driver->get_linktab == NULL)
|
||||
{
|
||||
|
@ -849,7 +849,7 @@ i4b_link_bchandrvr(call_desc_t *cd)
|
|||
static void
|
||||
i4b_unlink_bchandrvr(call_desc_t *cd)
|
||||
{
|
||||
struct isdn_l3_driver *d = isdn_find_l3_by_bri(cd->bri);
|
||||
struct isdn_l3_driver *d = cd->l3drv;
|
||||
|
||||
/*
|
||||
* XXX - what's this *cd manipulation for? Shouldn't we
|
||||
|
@ -1057,7 +1057,7 @@ i4b_idle_check(call_desc_t *cd)
|
|||
{
|
||||
if((i4b_get_idletime(cd) + cd->max_idle_time) <= SECOND)
|
||||
{
|
||||
struct isdn_l3_driver *d = isdn_find_l3_by_bri(cd->bri);
|
||||
struct isdn_l3_driver *d = cd->l3drv;
|
||||
NDBGL4(L4_TIMO, "%ld: incoming-call, line idle timeout, disconnecting!", (long)SECOND);
|
||||
d->l3driver->N_DISCONNECT_REQUEST(cd,
|
||||
(CAUSET_I4B << 8) | CAUSE_I4B_NORMAL);
|
||||
|
@ -1100,7 +1100,7 @@ i4b_idle_check(call_desc_t *cd)
|
|||
static void
|
||||
i4b_idle_check_fix_unit(call_desc_t *cd)
|
||||
{
|
||||
struct isdn_l3_driver *d = isdn_find_l3_by_bri(cd->bri);
|
||||
struct isdn_l3_driver *d = cd->l3drv;
|
||||
|
||||
/* simple idletime calculation */
|
||||
|
||||
|
@ -1204,7 +1204,7 @@ i4b_idle_check_var_unit(call_desc_t *cd)
|
|||
}
|
||||
else
|
||||
{ /* no activity, hangup */
|
||||
struct isdn_l3_driver *d = isdn_find_l3_by_bri(cd->bri);
|
||||
struct isdn_l3_driver *d = cd->l3drv;
|
||||
NDBGL4(L4_TIMO, "%ld: outgoing-call, var idle timeout - last activity at %ld", (long)SECOND, (long)i4b_get_idletime(cd));
|
||||
d->l3driver->N_DISCONNECT_REQUEST(cd, (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL);
|
||||
i4b_l4_idle_timeout_ind(cd);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* i4b_l4if.c - Layer 3 interface to Layer 4
|
||||
* -------------------------------------------
|
||||
*
|
||||
* $Id: i4b_l4if.c,v 1.8 2002/03/30 11:15:41 martin Exp $
|
||||
* $Id: i4b_l4if.c,v 1.9 2002/03/30 11:43:33 martin Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
|
@ -36,7 +36,7 @@
|
|||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: i4b_l4if.c,v 1.8 2002/03/30 11:15:41 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: i4b_l4if.c,v 1.9 2002/03/30 11:43:33 martin Exp $");
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include "i4bq931.h"
|
||||
|
@ -236,11 +236,9 @@ n_connect_request(struct call_desc *cd)
|
|||
void
|
||||
n_connect_response(struct call_desc *cd, int response, int cause)
|
||||
{
|
||||
struct isdn_l3_driver *d;
|
||||
struct isdn_l3_driver *d = cd->l3drv;
|
||||
int chstate;
|
||||
|
||||
d = isdn_find_l3_by_bri(cd->bri);
|
||||
|
||||
T400_stop(cd);
|
||||
|
||||
cd->response = response;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* i4b_l4mgmt.c - layer 4 calldescriptor management utilites
|
||||
* -----------------------------------------------------------
|
||||
*
|
||||
* $Id: i4b_l4mgmt.c,v 1.8 2002/03/29 20:29:53 martin Exp $
|
||||
* $Id: i4b_l4mgmt.c,v 1.9 2002/03/30 11:43:33 martin Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
|
@ -36,7 +36,7 @@
|
|||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: i4b_l4mgmt.c,v 1.8 2002/03/29 20:29:53 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: i4b_l4mgmt.c,v 1.9 2002/03/30 11:43:33 martin Exp $");
|
||||
|
||||
#include "isdn.h"
|
||||
|
||||
|
@ -227,6 +227,7 @@ void free_all_cd_of_bri(int bri)
|
|||
i4b_stop_callout(&call_desc[i]);
|
||||
call_desc[i].cdid = CDID_UNUSED;
|
||||
call_desc[i].bri = -1;
|
||||
call_desc[i].l3drv = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* i4b_q931.c - Q931 received messages handling
|
||||
* --------------------------------------------
|
||||
*
|
||||
* $Id: i4b_q931.c,v 1.9 2002/03/30 07:08:14 martin Exp $
|
||||
* $Id: i4b_q931.c,v 1.10 2002/03/30 11:43:33 martin Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
|
@ -36,7 +36,7 @@
|
|||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: i4b_q931.c,v 1.9 2002/03/30 07:08:14 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: i4b_q931.c,v 1.10 2002/03/30 11:43:33 martin Exp $");
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include "i4bq931.h"
|
||||
|
@ -180,10 +180,13 @@ i4b_decode_q931(int bri, int msg_len, u_char *msg_ptr)
|
|||
{
|
||||
if(*msg_ptr == SETUP)
|
||||
{
|
||||
struct isdn_l3_driver *drv = isdn_find_l3_by_bri(bri);
|
||||
|
||||
/* get and init new calldescriptor */
|
||||
|
||||
cd = reserve_cd(); /* cdid filled in */
|
||||
cd->bri = bri;
|
||||
cd->l3drv = drv;
|
||||
cd->cr = crval;
|
||||
cd->crflag = CRF_DEST; /* we are the dest side */
|
||||
cd->l4_driver = NULL; /* reset link tab ptrs */
|
||||
|
|
Loading…
Reference in New Issue