Remove the ATMIOCENA and ATMIOCDIS ioctl. Everyting has been converted

to use the new OPENVCC and CLOSEVCC calls that allow the sepcification
of traffic parameters for the connections.
This commit is contained in:
Hartmut Brandt 2003-08-06 14:53:27 +00:00
parent a808105d63
commit 68ece75839
6 changed files with 23 additions and 176 deletions

View File

@ -1265,7 +1265,7 @@ en_close_finish(struct en_softc *sc, struct en_vcc *vc)
* LOCK: unlocked, needed
*/
static int
en_close_vcc(struct en_softc *sc, struct atmio_closevcc *cl, int wait)
en_close_vcc(struct en_softc *sc, struct atmio_closevcc *cl)
{
uint32_t oldmode, newmode;
struct en_vcc *vc;
@ -1315,10 +1315,8 @@ en_close_vcc(struct en_softc *sc, struct atmio_closevcc *cl, int wait)
vc->vflags |= VCC_DRAIN;
DBG(sc, IOCTL, ("VCI %u now draining", cl->vci));
if (!wait || (vc->vcc.flags & ATMIO_FLAG_ASYNC)) {
vc->vflags |= VCC_ASYNC;
if (vc->vcc.flags & ATMIO_FLAG_ASYNC)
goto done;
}
vc->vflags |= VCC_CLOSE_RX;
while ((sc->ifatm.ifnet.if_flags & IFF_RUNNING) &&
@ -1549,34 +1547,11 @@ en_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
struct en_softc *sc = (struct en_softc *)ifp->if_softc;
struct ifaddr *ifa = (struct ifaddr *)data;
struct ifreq *ifr = (struct ifreq *)data;
struct atm_pseudoioctl *pa = (struct atm_pseudoioctl *)data;
struct atmio_vcctable *vtab;
struct atmio_openvcc ena;
struct atmio_closevcc dis;
int error = 0;
switch (cmd) {
case SIOCATMENA: /* enable circuit for recv */
bzero(&ena, sizeof(ena));
ena.param.flags = ATM_PH_FLAGS(&pa->aph) &
(ATM_PH_AAL5 | ATM_PH_LLCSNAP);
ena.param.vpi = ATM_PH_VPI(&pa->aph);
ena.param.vci = ATM_PH_VCI(&pa->aph);
ena.param.aal = (ATM_PH_FLAGS(&pa->aph) & ATM_PH_AAL5) ?
ATMIO_AAL_5 : ATMIO_AAL_0;
ena.param.traffic = ATMIO_TRAFFIC_UBR;
ena.rxhand = pa->rxhand;
error = en_open_vcc(sc, &ena);
break;
case SIOCATMDIS: /* disable circuit for recv */
bzero(&dis, sizeof(dis));
dis.vpi = ATM_PH_VPI(&pa->aph);
dis.vci = ATM_PH_VCI(&pa->aph);
error = en_close_vcc(sc, &dis, 0);
break;
case SIOCSIFADDR:
EN_LOCK(sc);
ifp->if_flags |= IFF_UP;
@ -1627,12 +1602,12 @@ en_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
error = ifmedia_ioctl(ifp, ifr, &sc->media, cmd);
break;
case SIOCATMOPENVCC: /* netgraph/harp internal use */
case SIOCATMOPENVCC: /* kernel internal use */
error = en_open_vcc(sc, (struct atmio_openvcc *)data);
break;
case SIOCATMCLOSEVCC: /* netgraph and HARP internal use */
error = en_close_vcc(sc, (struct atmio_closevcc *)data, 1);
case SIOCATMCLOSEVCC: /* kernel internal use */
error = en_close_vcc(sc, (struct atmio_closevcc *)data);
break;
case SIOCATMGETVCCS: /* internal netgraph use */
@ -1873,7 +1848,7 @@ en_rx_drain(struct en_softc *sc, u_int drq)
(en_read(sc, MID_VC(vc->vcc.vci)) & MIDV_INSERVICE) == 0 &&
(vc->vflags & VCC_SWSL) == 0) {
vc->vflags &= ~VCC_CLOSE_RX;
if (vc->vflags & VCC_ASYNC)
if (vc->vcc.flags & ATMIO_FLAG_ASYNC)
en_close_finish(sc, vc);
else
cv_signal(&sc->cv_close);

View File

@ -149,7 +149,6 @@ struct en_vcc {
#define VCC_DRAIN 0x0001 /* closed, but draining rx */
#define VCC_SWSL 0x0002 /* on rx software service list */
#define VCC_CLOSE_RX 0x0004 /* currently closing */
#define VCC_ASYNC 0x0008 /* async close */
/*
* softc

View File

@ -2195,7 +2195,7 @@ fatm_waitvcc(struct fatm_softc *sc, struct cmdqueue *q)
* Start to open a VCC. This just initiates the operation.
*/
static int
fatm_open_vcc(struct fatm_softc *sc, struct atmio_openvcc *op, int wait)
fatm_open_vcc(struct fatm_softc *sc, struct atmio_openvcc *op)
{
uint32_t cmd;
int error;
@ -2261,8 +2261,8 @@ fatm_open_vcc(struct fatm_softc *sc, struct atmio_openvcc *op, int wait)
cmd |= (5 << 8);
q = fatm_start_vcc(sc, op->param.vpi, op->param.vci, cmd, 1,
(wait && !(op->param.flags & ATMIO_FLAG_ASYNC)) ?
fatm_cmd_complete : fatm_open_complete);
(op->param.flags & ATMIO_FLAG_ASYNC) ?
fatm_open_complete : fatm_cmd_complete);
if (q == NULL) {
error = EIO;
goto done;
@ -2272,7 +2272,7 @@ fatm_open_vcc(struct fatm_softc *sc, struct atmio_openvcc *op, int wait)
sc->vccs[op->param.vci] = vc;
sc->open_vccs++;
if (wait && !(op->param.flags & ATMIO_FLAG_ASYNC)) {
if (!(op->param.flags & ATMIO_FLAG_ASYNC)) {
error = fatm_waitvcc(sc, q);
if (error != 0) {
sc->vccs[op->param.vci] = NULL;
@ -2336,7 +2336,7 @@ fatm_close_complete(struct fatm_softc *sc, struct cmdqueue *q)
* Initiate closing a VCC
*/
static int
fatm_close_vcc(struct fatm_softc *sc, struct atmio_closevcc *cl, int wait)
fatm_close_vcc(struct fatm_softc *sc, struct atmio_closevcc *cl)
{
int error;
struct cmdqueue *q;
@ -2360,8 +2360,8 @@ fatm_close_vcc(struct fatm_softc *sc, struct atmio_closevcc *cl, int wait)
q = fatm_start_vcc(sc, cl->vpi, cl->vci,
FATM_OP_DEACTIVATE_VCIN | FATM_OP_INTERRUPT_SEL, 1,
(wait && !(vc->param.flags & ATMIO_FLAG_ASYNC)) ?
fatm_cmd_complete : fatm_close_complete);
(vc->param.flags & ATMIO_FLAG_ASYNC) ?
fatm_close_complete : fatm_cmd_complete);
if (q == NULL) {
error = EIO;
goto done;
@ -2370,7 +2370,7 @@ fatm_close_vcc(struct fatm_softc *sc, struct atmio_closevcc *cl, int wait)
vc->vflags &= ~(FATM_VCC_OPEN | FATM_VCC_TRY_OPEN);
vc->vflags |= FATM_VCC_TRY_CLOSE;
if (wait && !(vc->param.flags & ATMIO_FLAG_ASYNC)) {
if (!(vc->param.flags & ATMIO_FLAG_ASYNC)) {
error = fatm_waitvcc(sc, q);
if (error != 0)
goto done;
@ -2395,40 +2395,17 @@ fatm_ioctl(struct ifnet *ifp, u_long cmd, caddr_t arg)
struct ifreq *ifr = (struct ifreq *)arg;
struct atmio_closevcc *cl = (struct atmio_closevcc *)arg;
struct atmio_openvcc *op = (struct atmio_openvcc *)arg;
struct atm_pseudoioctl *pa = (struct atm_pseudoioctl *)arg;
struct atmio_vcctable *vtab;
struct atmio_openvcc ena;
struct atmio_closevcc dis;
error = 0;
switch (cmd) {
case SIOCATMENA: /* internal NATM use */
bzero(&ena, sizeof(ena));
ena.param.flags = ATM_PH_FLAGS(&pa->aph) &
(ATM_PH_AAL5 | ATM_PH_LLCSNAP);
ena.param.vpi = ATM_PH_VPI(&pa->aph);
ena.param.vci = ATM_PH_VCI(&pa->aph);
ena.param.aal = (ATM_PH_FLAGS(&pa->aph) & ATM_PH_AAL5) ?
ATMIO_AAL_5 : ATMIO_AAL_0;
ena.param.traffic = ATMIO_TRAFFIC_UBR;
ena.rxhand = pa->rxhand;
error = fatm_open_vcc(sc, &ena, 0);
case SIOCATMOPENVCC: /* kernel internal use */
error = fatm_open_vcc(sc, op);
break;
case SIOCATMDIS: /* internal NATM use */
bzero(&dis, sizeof(dis));
dis.vpi = ATM_PH_VPI(&pa->aph);
dis.vci = ATM_PH_VCI(&pa->aph);
error = fatm_close_vcc(sc, &dis, 0);
break;
case SIOCATMOPENVCC:
error = fatm_open_vcc(sc, op, 1);
break;
case SIOCATMCLOSEVCC:
error = fatm_close_vcc(sc, cl, 1);
case SIOCATMCLOSEVCC: /* kernel internal use */
error = fatm_close_vcc(sc, cl);
break;
case SIOCSIFADDR:

View File

@ -183,39 +183,6 @@ hatm_open_vcc(struct hatm_softc *sc, struct atmio_openvcc *arg)
return (error);
}
/*
* Enable ioctl for NATM. Map to an open ioctl.
*/
static int
hatm_open_vcc1(struct hatm_softc *sc, struct atm_pseudoioctl *ph)
{
struct atmio_openvcc *v;
int error;
if ((v = malloc(sizeof(*v), M_TEMP, M_NOWAIT | M_ZERO)) == NULL)
return (ENOMEM);
v->param.flags = ATM_PH_FLAGS(&ph->aph) &
(ATM_PH_AAL5 | ATM_PH_LLCSNAP);
v->param.flags |= ATMIO_FLAG_ASYNC;
v->param.vpi = ATM_PH_VPI(&ph->aph);
v->param.vci = ATM_PH_VCI(&ph->aph);
v->param.aal = (ATM_PH_FLAGS(&ph->aph) & ATM_PH_AAL5)
? ATMIO_AAL_5 : ATMIO_AAL_0;
v->param.traffic = hatm_natm_traffic;
v->rxhand = ph->rxhand;
if ((v->param.tparam.pcr = hatm_natm_pcr) == 0 ||
hatm_natm_pcr > sc->ifatm.mib.pcr)
v->param.tparam.pcr = sc->ifatm.mib.pcr;
v->param.tparam.mcr = 0;
error = hatm_open_vcc(sc, v);
free(v, M_TEMP);
return (error);
}
/*
* VCC has been finally closed.
*/
@ -291,17 +258,6 @@ hatm_close_vcc(struct hatm_softc *sc, struct atmio_closevcc *arg)
return (error);
}
static int
hatm_close_vcc1(struct hatm_softc *sc, struct atm_pseudoioctl *ph)
{
struct atmio_closevcc v;
v.vpi = ATM_PH_VPI(&ph->aph);
v.vci = ATM_PH_VCI(&ph->aph);
return (hatm_close_vcc(sc, &v));
}
/*
* IOCTL handler
*/
@ -373,14 +329,6 @@ hatm_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
free(vtab, M_DEVBUF);
break;
case SIOCATMENA: /* NATM internal use */
error = hatm_open_vcc1(sc, (struct atm_pseudoioctl *)data);
break;
case SIOCATMDIS: /* NATM internal use */
error = hatm_close_vcc1(sc, (struct atm_pseudoioctl *)data);
break;
case SIOCATMGETVCCS: /* netgraph internal use */
vtab = atm_getvccs((struct atmio_vcc **)sc->vccs,
HE_MAX_VCCS, sc->open_vccs, &sc->mtx, 0);
@ -391,11 +339,11 @@ hatm_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
*(void **)data = vtab;
break;
case SIOCATMOPENVCC: /* netgraph/harp internal use */
case SIOCATMOPENVCC: /* kernel internal use */
error = hatm_open_vcc(sc, (struct atmio_openvcc *)data);
break;
case SIOCATMCLOSEVCC: /* netgraph and HARP internal use */
case SIOCATMCLOSEVCC: /* kernel internal use */
error = hatm_close_vcc(sc, (struct atmio_closevcc *)data);
break;

View File

@ -199,29 +199,6 @@ patm_open_vcc(struct patm_softc *sc, struct atmio_openvcc *arg)
return (error);
}
/*
* Enable ioctl for NATM. Map to an open ioctl.
*/
static int
patm_open_vcc1(struct patm_softc *sc, struct atm_pseudoioctl *ph)
{
struct atmio_openvcc v;
bzero(&v, sizeof(v));
v.param.flags = ATM_PH_FLAGS(&ph->aph) & (ATM_PH_AAL5 | ATM_PH_LLCSNAP);
v.param.flags |= ATMIO_FLAG_ASYNC;
v.param.vpi = ATM_PH_VPI(&ph->aph);
v.param.vci = ATM_PH_VCI(&ph->aph);
v.param.aal = (ATM_PH_FLAGS(&ph->aph) & ATM_PH_AAL5)
? ATMIO_AAL_5 : ATMIO_AAL_0;
v.param.traffic = ATMIO_TRAFFIC_UBR;;
v.param.tparam.pcr = sc->ifatm.mib.pcr;
v.rxhand = ph->rxhand;
return (patm_open_vcc(sc, &v));
}
/*
* Try to close the given VCC
*/
@ -281,20 +258,6 @@ patm_close_vcc(struct patm_softc *sc, struct atmio_closevcc *arg)
return (error);
}
/*
* Close a VCC asynchronuosly
*/
static int
patm_close_vcc1(struct patm_softc *sc, struct atm_pseudoioctl *ph)
{
struct atmio_closevcc v;
v.vpi = ATM_PH_VPI(&ph->aph);
v.vci = ATM_PH_VCI(&ph->aph);
return (patm_close_vcc(sc, &v));
}
/*
* VCC has been finally closed.
*/
@ -403,22 +366,14 @@ patm_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
ifp->if_mtu = ifr->ifr_mtu;
break;
case SIOCATMOPENVCC: /* netgraph/harp internal use */
case SIOCATMOPENVCC: /* kernel internal use */
error = patm_open_vcc(sc, (struct atmio_openvcc *)data);
break;
case SIOCATMCLOSEVCC: /* netgraph and HARP internal use */
case SIOCATMCLOSEVCC: /* kernel internal use */
error = patm_close_vcc(sc, (struct atmio_closevcc *)data);
break;
case SIOCATMENA: /* NATM internal use */
error = patm_open_vcc1(sc, (struct atm_pseudoioctl *)data);
break;
case SIOCATMDIS: /* NATM internal use */
error = patm_close_vcc1(sc, (struct atm_pseudoioctl *)data);
break;
case SIOCATMGVCCS: /* external use */
/* return vcc table */
vtab = atm_getvccs((struct atmio_vcc **)sc->vccs,

View File

@ -219,7 +219,7 @@ struct atm_pseudohdr {
}
/* use AAL5? (0 == aal0) */
#define ATM_PH_AAL5 0x01
#define ATM_PH_AAL5 0x01
/* use the LLC SNAP encoding (iff aal5) */
#define ATM_PH_LLCSNAP ATMIO_FLAG_LLCSNAP
@ -230,13 +230,6 @@ struct atm_pseudohdr {
/* XXX: could be 9188 with LLC/SNAP according
to comer */
/* atm_pseudoioctl: turns on and off RX VCIs [for internal use only!] */
struct atm_pseudoioctl {
struct atm_pseudohdr aph;
void *rxhand;
};
#define SIOCATMENA _IOWR('a', 123, struct atm_pseudoioctl) /* enable */
#define SIOCATMDIS _IOWR('a', 124, struct atm_pseudoioctl) /* disable */
#define SIOCATMGETVCCS _IOW('a', 125, struct atmio_vcctable)
#define SIOCATMOPENVCC _IOR('a', 126, struct atmio_openvcc)
#define SIOCATMCLOSEVCC _IOR('a', 127, struct atmio_closevcc)