Lines Matching +full:chan +full:- +full:name

1 /*-
54 #define VT9P_MTX(_sc) (&(_sc)->vt9p_mtx)
58 "VIRTIO 9P CHAN lock", NULL, MTX_DEF)
107 * This routine will sleep and release the chan mtx during the period.
108 * chan mtx will be acquired again upon return.
111 vt9p_req_wait(struct vt9p_softc *chan, struct p9_req_t *req) in vt9p_req_wait() argument
113 KASSERT(req->tc->tag != req->rc->tag, in vt9p_req_wait()
116 if (msleep(req, VT9P_MTX(chan), 0, "chan lock", vt9p_ackmaxidle * hz)) { in vt9p_req_wait()
125 KASSERT(req->tc->tag == req->rc->tag, in vt9p_req_wait()
142 struct vt9p_softc *chan; in vt9p_request() local
147 chan = handle; in vt9p_request()
148 sg = chan->vt9p_sglist; in vt9p_request()
149 vq = chan->vt9p_vq; in vt9p_request()
154 VT9P_LOCK(chan); in vt9p_request()
158 error = sglist_append(sg, req->tc->sdata, req->tc->size); in vt9p_request()
161 VT9P_UNLOCK(chan); in vt9p_request()
164 readable = sg->sg_nseg; in vt9p_request()
166 error = sglist_append(sg, req->rc->sdata, req->rc->capacity); in vt9p_request()
169 VT9P_UNLOCK(chan); in vt9p_request()
172 writable = sg->sg_nseg - readable; in vt9p_request()
178 * Condvar for the submit queue. Unlock the chan in vt9p_request()
181 cv_wait(&chan->submit_cv, VT9P_MTX(chan)); in vt9p_request()
186 VT9P_UNLOCK(chan); in vt9p_request()
194 error = vt9p_req_wait(chan, req); in vt9p_request()
196 VT9P_UNLOCK(chan); in vt9p_request()
200 VT9P_UNLOCK(chan); in vt9p_request()
215 struct vt9p_softc *chan; in vt9p_intr_complete() local
219 chan = (struct vt9p_softc *)xsc; in vt9p_intr_complete()
220 vq = chan->vt9p_vq; in vt9p_intr_complete()
224 VT9P_LOCK(chan); in vt9p_intr_complete()
227 curreq->rc->tag = curreq->tc->tag; in vt9p_intr_complete()
234 cv_signal(&chan->submit_cv); in vt9p_intr_complete()
235 VT9P_UNLOCK(chan); in vt9p_intr_complete()
247 dev = sc->vt9p_dev; in vt9p_alloc_virtqueue()
249 VQ_ALLOC_INFO_INIT(&vq_info, sc->max_nsegs, in vt9p_alloc_virtqueue()
250 vt9p_intr_complete, sc, &sc->vt9p_vq, in vt9p_alloc_virtqueue()
274 virtqueue_disable_intr(sc->vt9p_vq); in vt9p_stop()
275 virtio_stop(sc->vt9p_dev); in vt9p_stop()
289 if (sc->vt9p_sglist) { in vt9p_detach()
290 sglist_free(sc->vt9p_sglist); in vt9p_detach()
291 sc->vt9p_sglist = NULL; in vt9p_detach()
293 if (sc->mount_tag) { in vt9p_detach()
294 free(sc->mount_tag, M_P9FS_MNTTAG); in vt9p_detach()
295 sc->mount_tag = NULL; in vt9p_detach()
302 cv_destroy(&sc->submit_cv); in vt9p_detach()
313 struct vt9p_softc *chan; in vt9p_attach() local
318 chan = device_get_softc(dev); in vt9p_attach()
319 chan->vt9p_dev = dev; in vt9p_attach()
322 VT9P_LOCK_INIT(chan); in vt9p_attach()
324 cv_init(&chan->submit_cv, "Conditional variable for submit queue" ); in vt9p_attach()
325 chan->max_nsegs = MAX_SUPPORTED_SGS; in vt9p_attach()
326 chan->vt9p_sglist = sglist_alloc(chan->max_nsegs, M_WAITOK); in vt9p_attach()
354 chan->mount_tag_len = mount_tag_len; in vt9p_attach()
355 chan->mount_tag = mount_tag; in vt9p_attach()
360 CTLFLAG_RD, chan->mount_tag, 0, "Mount tag"); in vt9p_attach()
363 error = vt9p_alloc_virtqueue(chan); in vt9p_attach()
373 error = virtqueue_enable_intr(chan->vt9p_vq); in vt9p_attach()
381 STAILQ_INSERT_HEAD(&global_chan_list, chan, chan_next); in vt9p_attach()
398 struct vt9p_softc *sc, *chan; in vt9p_create() local
400 chan = NULL; in vt9p_create()
408 if (!strcmp(sc->mount_tag, mount_tag)) { in vt9p_create()
409 chan = sc; in vt9p_create()
416 * If chan is already attached to a client then it cannot be used for in vt9p_create()
419 if (chan && chan->busy) { in vt9p_create()
420 //p9_debug(TRANS, "Channel busy: used by clnt=%p\n", chan->client); in vt9p_create()
425 if (chan) { in vt9p_create()
426 *handlep = (void *)chan; in vt9p_create()
427 chan->busy = true; in vt9p_create()
440 struct vt9p_softc *chan = handle; in vt9p_close() local
442 chan->busy = false; in vt9p_close()
446 .name = "virtio",