Deleted Added
full compact
if_hatm_ioctl.c (147721) if_hatm_ioctl.c (148887)
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 147721 2005-07-01 10:45:02Z harti $");
35__FBSDID("$FreeBSD: head/sys/dev/hatm/if_hatm_ioctl.c 148887 2005-08-09 10:20:02Z rwatson $");
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>

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

111 (arg->param.flags & ATMIO_FLAG_NORX))
112 return (EINVAL);
113
114 vcc = uma_zalloc(sc->vcc_zone, M_NOWAIT | M_ZERO);
115 if (vcc == NULL)
116 return (ENOMEM);
117
118 mtx_lock(&sc->mtx);
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>

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

111 (arg->param.flags & ATMIO_FLAG_NORX))
112 return (EINVAL);
113
114 vcc = uma_zalloc(sc->vcc_zone, M_NOWAIT | M_ZERO);
115 if (vcc == NULL)
116 return (ENOMEM);
117
118 mtx_lock(&sc->mtx);
119 if (!(sc->ifp->if_flags & IFF_RUNNING)) {
119 if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) {
120 error = EIO;
121 goto done;
122 }
123 if (sc->vccs[cid] != NULL) {
124 error = EBUSY;
125 goto done;
126 }
127 vcc->param = arg->param;

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

225 if((arg->vpi & ~HE_VPI_MASK) ||
226 (arg->vci & ~HE_VCI_MASK) ||
227 (arg->vci == 0))
228 return (EINVAL);
229 cid = HE_CID(arg->vpi, arg->vci);
230
231 mtx_lock(&sc->mtx);
232 vcc = sc->vccs[cid];
120 error = EIO;
121 goto done;
122 }
123 if (sc->vccs[cid] != NULL) {
124 error = EBUSY;
125 goto done;
126 }
127 vcc->param = arg->param;

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

225 if((arg->vpi & ~HE_VPI_MASK) ||
226 (arg->vci & ~HE_VCI_MASK) ||
227 (arg->vci == 0))
228 return (EINVAL);
229 cid = HE_CID(arg->vpi, arg->vci);
230
231 mtx_lock(&sc->mtx);
232 vcc = sc->vccs[cid];
233 if (!(sc->ifp->if_flags & IFF_RUNNING)) {
233 if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) {
234 error = EIO;
235 goto done;
236 }
237
238 if (vcc == NULL || !(vcc->vflags & HE_VCC_OPEN)) {
239 error = ENOENT;
240 goto done;
241 }
242
243 if (vcc->vflags & HE_VCC_TX_OPEN)
244 hatm_tx_vcc_close(sc, cid);
245 if (vcc->vflags & HE_VCC_RX_OPEN)
246 hatm_rx_vcc_close(sc, cid);
247
248 if (vcc->param.flags & ATMIO_FLAG_ASYNC)
249 goto done;
250
234 error = EIO;
235 goto done;
236 }
237
238 if (vcc == NULL || !(vcc->vflags & HE_VCC_OPEN)) {
239 error = ENOENT;
240 goto done;
241 }
242
243 if (vcc->vflags & HE_VCC_TX_OPEN)
244 hatm_tx_vcc_close(sc, cid);
245 if (vcc->vflags & HE_VCC_RX_OPEN)
246 hatm_rx_vcc_close(sc, cid);
247
248 if (vcc->param.flags & ATMIO_FLAG_ASYNC)
249 goto done;
250
251 while ((sc->ifp->if_flags & IFF_RUNNING) &&
251 while ((sc->ifp->if_drv_flags & IFF_DRV_RUNNING) &&
252 (vcc->vflags & (HE_VCC_TX_CLOSING | HE_VCC_RX_CLOSING)))
253 cv_wait(&sc->vcc_cv, &sc->mtx);
254
252 (vcc->vflags & (HE_VCC_TX_CLOSING | HE_VCC_RX_CLOSING)))
253 cv_wait(&sc->vcc_cv, &sc->mtx);
254
255 if (!(sc->ifp->if_flags & IFF_RUNNING)) {
255 if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) {
256 error = EIO;
257 goto done;
258 }
259
260 if (!(vcc->vflags & ATMIO_FLAG_NOTX))
261 hatm_tx_vcc_closed(sc, cid);
262
263 hatm_vcc_closed(sc, cid);

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

279 struct atmio_vcctable *vtab;
280 int error = 0;
281
282 switch (cmd) {
283
284 case SIOCSIFADDR:
285 mtx_lock(&sc->mtx);
286 ifp->if_flags |= IFF_UP;
256 error = EIO;
257 goto done;
258 }
259
260 if (!(vcc->vflags & ATMIO_FLAG_NOTX))
261 hatm_tx_vcc_closed(sc, cid);
262
263 hatm_vcc_closed(sc, cid);

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

279 struct atmio_vcctable *vtab;
280 int error = 0;
281
282 switch (cmd) {
283
284 case SIOCSIFADDR:
285 mtx_lock(&sc->mtx);
286 ifp->if_flags |= IFF_UP;
287 if (!(ifp->if_flags & IFF_RUNNING))
287 if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
288 hatm_initialize(sc);
289 switch (ifa->ifa_addr->sa_family) {
290
291#ifdef INET
292 case AF_INET:
293 case AF_INET6:
294 ifa->ifa_rtrequest = atm_rtrequest;
295 break;
296#endif
297 default:
298 break;
299 }
300 mtx_unlock(&sc->mtx);
301 break;
302
303 case SIOCSIFFLAGS:
304 mtx_lock(&sc->mtx);
305 if (ifp->if_flags & IFF_UP) {
288 hatm_initialize(sc);
289 switch (ifa->ifa_addr->sa_family) {
290
291#ifdef INET
292 case AF_INET:
293 case AF_INET6:
294 ifa->ifa_rtrequest = atm_rtrequest;
295 break;
296#endif
297 default:
298 break;
299 }
300 mtx_unlock(&sc->mtx);
301 break;
302
303 case SIOCSIFFLAGS:
304 mtx_lock(&sc->mtx);
305 if (ifp->if_flags & IFF_UP) {
306 if (!(ifp->if_flags & IFF_RUNNING)) {
306 if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
307 hatm_initialize(sc);
308 }
309 } else {
307 hatm_initialize(sc);
308 }
309 } else {
310 if (ifp->if_flags & IFF_RUNNING) {
310 if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
311 hatm_stop(sc);
312 }
313 }
314 mtx_unlock(&sc->mtx);
315 break;
316
317 case SIOCGIFMEDIA:
318 case SIOCSIFMEDIA:

--- 66 unchanged lines hidden ---
311 hatm_stop(sc);
312 }
313 }
314 mtx_unlock(&sc->mtx);
315 break;
316
317 case SIOCGIFMEDIA:
318 case SIOCSIFMEDIA:

--- 66 unchanged lines hidden ---