Deleted Added
full compact
if_patm_ioctl.c (139749) if_patm_ioctl.c (147256)
1/*-
2 * Copyright (c) 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:

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

25 * SUCH DAMAGE.
26 *
27 * Author: Hartmut Brandt <harti@freebsd.org>
28 *
29 * Driver for IDT77252 based cards like ProSum's.
30 */
31
32#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 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:

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

25 * SUCH DAMAGE.
26 *
27 * Author: Hartmut Brandt <harti@freebsd.org>
28 *
29 * Driver for IDT77252 based cards like ProSum's.
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/dev/patm/if_patm_ioctl.c 139749 2005-01-06 01:43:34Z imp $");
33__FBSDID("$FreeBSD: head/sys/dev/patm/if_patm_ioctl.c 147256 2005-06-10 16:49:24Z brooks $");
34
35#include "opt_inet.h"
36#include "opt_natm.h"
37
38#include <sys/types.h>
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/malloc.h>

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

102 return (EINVAL);
103
104 /* allocate vcc */
105 vcc = uma_zalloc(sc->vcc_zone, M_NOWAIT | M_ZERO);
106 if (vcc == NULL)
107 return (ENOMEM);
108
109 mtx_lock(&sc->mtx);
34
35#include "opt_inet.h"
36#include "opt_natm.h"
37
38#include <sys/types.h>
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/malloc.h>

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

102 return (EINVAL);
103
104 /* allocate vcc */
105 vcc = uma_zalloc(sc->vcc_zone, M_NOWAIT | M_ZERO);
106 if (vcc == NULL)
107 return (ENOMEM);
108
109 mtx_lock(&sc->mtx);
110 if (!(sc->ifatm.ifnet.if_flags & IFF_RUNNING)) {
110 if (!(sc->ifp->if_flags & IFF_RUNNING)) {
111 /* stopped while we have analyzed the arguments */
112 error = EIO;
113 goto done;
114 }
115 if (sc->vccs[cid] != NULL) {
116 /* ups, already open */
117 error = EBUSY;
118 goto done;

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

195 patm_tx_vcc_open(sc, vcc);
196 if (!(vcc->vcc.flags & ATMIO_FLAG_NORX))
197 patm_rx_vcc_open(sc, vcc);
198
199 if (!reload) {
200 /* inform management about non-NG and NG-PVCs */
201 if (!(vcc->vcc.flags & ATMIO_FLAG_NG) ||
202 (vcc->vcc.flags & ATMIO_FLAG_PVC))
111 /* stopped while we have analyzed the arguments */
112 error = EIO;
113 goto done;
114 }
115 if (sc->vccs[cid] != NULL) {
116 /* ups, already open */
117 error = EBUSY;
118 goto done;

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

195 patm_tx_vcc_open(sc, vcc);
196 if (!(vcc->vcc.flags & ATMIO_FLAG_NORX))
197 patm_rx_vcc_open(sc, vcc);
198
199 if (!reload) {
200 /* inform management about non-NG and NG-PVCs */
201 if (!(vcc->vcc.flags & ATMIO_FLAG_NG) ||
202 (vcc->vcc.flags & ATMIO_FLAG_PVC))
203 ATMEV_SEND_VCC_CHANGED(&sc->ifatm, vcc->vcc.vpi,
203 ATMEV_SEND_VCC_CHANGED(IFP2IFATM(sc->ifp), vcc->vcc.vpi,
204 vcc->vcc.vci, 1);
205 }
206
207 patm_debug(sc, VCC, "Open VCC: now open");
208}
209
210/*
211 * Try to close the given VCC

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

219
220 patm_debug(sc, VCC, "Close VCC: %u.%u", arg->vpi, arg->vci);
221
222 if (!LEGAL_VPI(sc, arg->vpi) || !LEGAL_VCI(sc, arg->vci))
223 return (EINVAL);
224 cid = PATM_CID(sc, arg->vpi, arg->vci);
225
226 mtx_lock(&sc->mtx);
204 vcc->vcc.vci, 1);
205 }
206
207 patm_debug(sc, VCC, "Open VCC: now open");
208}
209
210/*
211 * Try to close the given VCC

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

219
220 patm_debug(sc, VCC, "Close VCC: %u.%u", arg->vpi, arg->vci);
221
222 if (!LEGAL_VPI(sc, arg->vpi) || !LEGAL_VCI(sc, arg->vci))
223 return (EINVAL);
224 cid = PATM_CID(sc, arg->vpi, arg->vci);
225
226 mtx_lock(&sc->mtx);
227 if (!(sc->ifatm.ifnet.if_flags & IFF_RUNNING)) {
227 if (!(sc->ifp->if_flags & IFF_RUNNING)) {
228 /* stopped while we have analyzed the arguments */
229 error = EIO;
230 goto done;
231 }
232
233 vcc = sc->vccs[cid];
234 if (vcc == NULL || !(vcc->vflags & PATM_VCC_OPEN)) {
235 error = ENOENT;

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

241 if (vcc->vflags & PATM_VCC_RX_OPEN)
242 patm_rx_vcc_close(sc, vcc);
243
244 if (vcc->vcc.flags & ATMIO_FLAG_ASYNC)
245 goto done;
246
247 while (vcc->vflags & (PATM_VCC_TX_CLOSING | PATM_VCC_RX_CLOSING)) {
248 cv_wait(&sc->vcc_cv, &sc->mtx);
228 /* stopped while we have analyzed the arguments */
229 error = EIO;
230 goto done;
231 }
232
233 vcc = sc->vccs[cid];
234 if (vcc == NULL || !(vcc->vflags & PATM_VCC_OPEN)) {
235 error = ENOENT;

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

241 if (vcc->vflags & PATM_VCC_RX_OPEN)
242 patm_rx_vcc_close(sc, vcc);
243
244 if (vcc->vcc.flags & ATMIO_FLAG_ASYNC)
245 goto done;
246
247 while (vcc->vflags & (PATM_VCC_TX_CLOSING | PATM_VCC_RX_CLOSING)) {
248 cv_wait(&sc->vcc_cv, &sc->mtx);
249 if (!(sc->ifatm.ifnet.if_flags & IFF_RUNNING)) {
249 if (!(sc->ifp->if_flags & IFF_RUNNING)) {
250 /* ups, has been stopped */
251 error = EIO;
252 goto done;
253 }
254 }
255
256 if (!(vcc->vcc.flags & ATMIO_FLAG_NOTX))
257 patm_tx_vcc_closed(sc, vcc);

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

271 */
272void
273patm_vcc_closed(struct patm_softc *sc, struct patm_vcc *vcc)
274{
275
276 /* inform management about non-NG and NG-PVCs */
277 if (!(vcc->vcc.flags & ATMIO_FLAG_NG) ||
278 (vcc->vcc.flags & ATMIO_FLAG_PVC))
250 /* ups, has been stopped */
251 error = EIO;
252 goto done;
253 }
254 }
255
256 if (!(vcc->vcc.flags & ATMIO_FLAG_NOTX))
257 patm_tx_vcc_closed(sc, vcc);

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

271 */
272void
273patm_vcc_closed(struct patm_softc *sc, struct patm_vcc *vcc)
274{
275
276 /* inform management about non-NG and NG-PVCs */
277 if (!(vcc->vcc.flags & ATMIO_FLAG_NG) ||
278 (vcc->vcc.flags & ATMIO_FLAG_PVC))
279 ATMEV_SEND_VCC_CHANGED(&sc->ifatm, vcc->vcc.vpi,
279 ATMEV_SEND_VCC_CHANGED(IFP2IFATM(sc->ifp), vcc->vcc.vpi,
280 vcc->vcc.vci, 0);
281
282 sc->vccs_open--;
283 sc->vccs[vcc->cid] = NULL;
284 uma_zfree(sc->vcc_zone, vcc);
285}
286
287int

--- 124 unchanged lines hidden ---
280 vcc->vcc.vci, 0);
281
282 sc->vccs_open--;
283 sc->vccs[vcc->cid] = NULL;
284 uma_zfree(sc->vcc_zone, vcc);
285}
286
287int

--- 124 unchanged lines hidden ---