summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2003-08-07 14:30:58 +0000
committerharti <harti@FreeBSD.org>2003-08-07 14:30:58 +0000
commit09a493cb3159d48ff7266b56e6875e37cdf0646d (patch)
tree7314f39ce75409c72438a82e1d8191ef8f5cb9dc /sys
parent6c92eabed547d8c0f01573c11526ecd9642e6483 (diff)
downloadFreeBSD-src-09a493cb3159d48ff7266b56e6875e37cdf0646d.zip
FreeBSD-src-09a493cb3159d48ff7266b56e6875e37cdf0646d.tar.gz
Make open channels persist across ifconfig down and up. All channels
that are not currently closing when the interface is configured down will be brough up as soon as the interface is configured up.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/patm/if_patm.c20
-rw-r--r--sys/dev/patm/if_patm_ioctl.c37
-rw-r--r--sys/dev/patm/if_patmvar.h4
3 files changed, 40 insertions, 21 deletions
diff --git a/sys/dev/patm/if_patm.c b/sys/dev/patm/if_patm.c
index cc2db4a..6d97061 100644
--- a/sys/dev/patm/if_patm.c
+++ b/sys/dev/patm/if_patm.c
@@ -211,6 +211,10 @@ patm_initialize(struct patm_softc *sc)
IDT_CFG_TXUIE | IDT_CFG_TXSFI | IDT_CFG_PHYIE;
patm_nor_write(sc, IDT_NOR_CFG, cfg);
+ for (i = 0; i < sc->mmap->max_conn; i++)
+ if (sc->vccs[i] != NULL)
+ patm_load_vc(sc, sc->vccs[i], 1);
+
ATMEV_SEND_IFSTATE_CHANGED(&sc->ifatm,
sc->utopia.carrier == UTP_CARR_OK);
}
@@ -284,17 +288,21 @@ patm_stop(struct patm_softc *sc)
/* freeing partial receive chains and reset vcc state */
for (i = 0; i < sc->mmap->max_conn; i++) {
if (sc->vccs[i] != NULL) {
- if (sc->vccs[i]->chain != NULL)
+ if (sc->vccs[i]->chain != NULL) {
m_freem(sc->vccs[i]->chain);
+ sc->vccs[i]->chain = NULL;
+ sc->vccs[i]->last = NULL;
+ }
- if (sc->vccs[i]->vcc.flags & ATMIO_FLAG_NG) {
+ if (sc->vccs[i]->vflags & (PATM_VCC_RX_CLOSING |
+ PATM_VCC_TX_CLOSING)) {
uma_zfree(sc->vcc_zone, sc->vccs[i]);
sc->vccs[i] = NULL;
} else {
- /* keep HARP and NG */
- sc->vccs[i]->chain = NULL;
- sc->vccs[i]->last = NULL;
- sc->vccs[i]->vflags = 0;
+ /* keep */
+ sc->vccs[i]->vflags &= ~PATM_VCC_OPEN;
+ sc->vccs[i]->cps = 0;
+ sc->vccs[i]->scd = NULL;
}
}
}
diff --git a/sys/dev/patm/if_patm_ioctl.c b/sys/dev/patm/if_patm_ioctl.c
index bbabf97..d5e7c152 100644
--- a/sys/dev/patm/if_patm_ioctl.c
+++ b/sys/dev/patm/if_patm_ioctl.c
@@ -171,24 +171,10 @@ patm_open_vcc(struct patm_softc *sc, struct atmio_openvcc *arg)
/* ok - go ahead */
sc->vccs[cid] = vcc;
-
- patm_debug(sc, VCC, "Open VCC: opening");
- if (!(vcc->vcc.flags & ATMIO_FLAG_NOTX))
- patm_tx_vcc_open(sc, vcc);
- if (!(vcc->vcc.flags & ATMIO_FLAG_NORX))
- patm_rx_vcc_open(sc, vcc);
-
- /* inform management about non-NG and NG-PVCs */
- if (!(vcc->vcc.flags & ATMIO_FLAG_NG) ||
- (vcc->vcc.flags & ATMIO_FLAG_PVC))
- ATMEV_SEND_VCC_CHANGED(&sc->ifatm, vcc->vcc.vpi,
- vcc->vcc.vci, 1);
-
- patm_debug(sc, VCC, "Open VCC: now open");
+ patm_load_vc(sc, vcc, 0);
/* don't free below */
vcc = NULL;
-
sc->vccs_open++;
/* done */
@@ -199,6 +185,27 @@ patm_open_vcc(struct patm_softc *sc, struct atmio_openvcc *arg)
return (error);
}
+void
+patm_load_vc(struct patm_softc *sc, struct patm_vcc *vcc, int reload)
+{
+
+ patm_debug(sc, VCC, "Open VCC: opening");
+ if (!(vcc->vcc.flags & ATMIO_FLAG_NOTX))
+ patm_tx_vcc_open(sc, vcc);
+ if (!(vcc->vcc.flags & ATMIO_FLAG_NORX))
+ patm_rx_vcc_open(sc, vcc);
+
+ if (!reload) {
+ /* inform management about non-NG and NG-PVCs */
+ if (!(vcc->vcc.flags & ATMIO_FLAG_NG) ||
+ (vcc->vcc.flags & ATMIO_FLAG_PVC))
+ ATMEV_SEND_VCC_CHANGED(&sc->ifatm, vcc->vcc.vpi,
+ vcc->vcc.vci, 1);
+ }
+
+ patm_debug(sc, VCC, "Open VCC: now open");
+}
+
/*
* Try to close the given VCC
*/
diff --git a/sys/dev/patm/if_patmvar.h b/sys/dev/patm/if_patmvar.h
index 5a350ed..f26cf17 100644
--- a/sys/dev/patm/if_patmvar.h
+++ b/sys/dev/patm/if_patmvar.h
@@ -196,6 +196,7 @@ struct patm_vcc {
uint32_t opackets; /* packets sent */
uint64_t ibytes; /* bytes received */
uint64_t obytes; /* bytes sent */
+
struct mbuf *chain; /* currently received chain */
struct mbuf *last; /* end of chain */
u_int cid; /* index */
@@ -382,6 +383,9 @@ void patm_intr(void *);
/* check RSQ */
void patm_intr_rsq(struct patm_softc *sc);
+/* enable the vcc */
+void patm_load_vc(struct patm_softc *sc, struct patm_vcc *vcc, int reload);
+
/* close the given vcc for transmission */
void patm_tx_vcc_close(struct patm_softc *, struct patm_vcc *);
OpenPOWER on IntegriCloud