Deleted Added
full compact
if_hatm_ioctl.c (118205) if_hatm_ioctl.c (118540)
1/*
2 * Copyright (c) 2001-2003
3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 18 unchanged lines hidden (view full) ---

27 * Author: Hartmut Brandt <harti@freebsd.org>
28 *
29 * ForeHE driver.
30 *
31 * Ioctl handler.
32 */
33
34#include <sys/cdefs.h>
1/*
2 * Copyright (c) 2001-2003
3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 18 unchanged lines hidden (view full) ---

27 * Author: Hartmut Brandt <harti@freebsd.org>
28 *
29 * ForeHE driver.
30 *
31 * Ioctl handler.
32 */
33
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: head/sys/dev/hatm/if_hatm_ioctl.c 118205 2003-07-30 11:32:42Z harti $");
35__FBSDID("$FreeBSD: head/sys/dev/hatm/if_hatm_ioctl.c 118540 2003-08-06 13:16:51Z harti $");
36
37#include "opt_inet.h"
38#include "opt_natm.h"
39
40#include <sys/types.h>
41#include <sys/param.h>
42#include <sys/systm.h>
43#include <sys/malloc.h>

--- 148 unchanged lines hidden (view full) ---

192 struct atmio_openvcc *v;
193 int error;
194
195 if ((v = malloc(sizeof(*v), M_TEMP, M_NOWAIT | M_ZERO)) == NULL)
196 return (ENOMEM);
197
198 v->param.flags = ATM_PH_FLAGS(&ph->aph) &
199 (ATM_PH_AAL5 | ATM_PH_LLCSNAP);
36
37#include "opt_inet.h"
38#include "opt_natm.h"
39
40#include <sys/types.h>
41#include <sys/param.h>
42#include <sys/systm.h>
43#include <sys/malloc.h>

--- 148 unchanged lines hidden (view full) ---

192 struct atmio_openvcc *v;
193 int error;
194
195 if ((v = malloc(sizeof(*v), M_TEMP, M_NOWAIT | M_ZERO)) == NULL)
196 return (ENOMEM);
197
198 v->param.flags = ATM_PH_FLAGS(&ph->aph) &
199 (ATM_PH_AAL5 | ATM_PH_LLCSNAP);
200 v->param.flags |= ATMIO_FLAG_ASYNC;
200 v->param.vpi = ATM_PH_VPI(&ph->aph);
201 v->param.vci = ATM_PH_VCI(&ph->aph);
202 v->param.aal = (ATM_PH_FLAGS(&ph->aph) & ATM_PH_AAL5)
203 ? ATMIO_AAL_5 : ATMIO_AAL_0;
204 v->param.traffic = hatm_natm_traffic;
205 v->rxhand = ph->rxhand;
206 if ((v->param.tparam.pcr = hatm_natm_pcr) == 0 ||
207 hatm_natm_pcr > sc->ifatm.mib.pcr)
208 v->param.tparam.pcr = sc->ifatm.mib.pcr;
209 v->param.tparam.mcr = 0;
210
211 error = hatm_open_vcc(sc, v);
201 v->param.vpi = ATM_PH_VPI(&ph->aph);
202 v->param.vci = ATM_PH_VCI(&ph->aph);
203 v->param.aal = (ATM_PH_FLAGS(&ph->aph) & ATM_PH_AAL5)
204 ? ATMIO_AAL_5 : ATMIO_AAL_0;
205 v->param.traffic = hatm_natm_traffic;
206 v->rxhand = ph->rxhand;
207 if ((v->param.tparam.pcr = hatm_natm_pcr) == 0 ||
208 hatm_natm_pcr > sc->ifatm.mib.pcr)
209 v->param.tparam.pcr = sc->ifatm.mib.pcr;
210 v->param.tparam.mcr = 0;
211
212 error = hatm_open_vcc(sc, v);
212 if (error == 0)
213 sc->vccs[HE_CID(v->param.vpi, v->param.vci)]->vflags |=
214 HE_VCC_ASYNC;
215
216 free(v, M_TEMP);
217
218 return (error);
219}
220
221/*
222 * VCC has been finally closed.

--- 43 unchanged lines hidden (view full) ---

266 goto done;
267 }
268
269 if (vcc->vflags & HE_VCC_TX_OPEN)
270 hatm_tx_vcc_close(sc, cid);
271 if (vcc->vflags & HE_VCC_RX_OPEN)
272 hatm_rx_vcc_close(sc, cid);
273
213
214 free(v, M_TEMP);
215
216 return (error);
217}
218
219/*
220 * VCC has been finally closed.

--- 43 unchanged lines hidden (view full) ---

264 goto done;
265 }
266
267 if (vcc->vflags & HE_VCC_TX_OPEN)
268 hatm_tx_vcc_close(sc, cid);
269 if (vcc->vflags & HE_VCC_RX_OPEN)
270 hatm_rx_vcc_close(sc, cid);
271
274 if (vcc->vflags & HE_VCC_ASYNC)
272 if (vcc->param.flags & ATMIO_FLAG_ASYNC)
275 goto done;
276
277 while ((sc->ifatm.ifnet.if_flags & IFF_RUNNING) &&
278 (vcc->vflags & (HE_VCC_TX_CLOSING | HE_VCC_RX_CLOSING)))
279 cv_wait(&sc->vcc_cv, &sc->mtx);
280
281 if (!(sc->ifatm.ifnet.if_flags & IFF_RUNNING)) {
282 error = EIO;

--- 147 unchanged lines hidden ---
273 goto done;
274
275 while ((sc->ifatm.ifnet.if_flags & IFF_RUNNING) &&
276 (vcc->vflags & (HE_VCC_TX_CLOSING | HE_VCC_RX_CLOSING)))
277 cv_wait(&sc->vcc_cv, &sc->mtx);
278
279 if (!(sc->ifatm.ifnet.if_flags & IFF_RUNNING)) {
280 error = EIO;

--- 147 unchanged lines hidden ---