Lines Matching +full:9 +full:- +full:channel
1 /*-
27 * The Virtio 9P transport driver. This file contains all functions related to
54 #define VT9P_MTX(_sc) (&(_sc)->vt9p_mtx)
58 "VIRTIO 9P CHAN lock", NULL, MTX_DEF)
76 /* Global channel list, Each channel will correspond to a mount point */
80 MTX_SYSINIT(global_chan_list_mtx, &global_chan_list_mtx, "9pglobal", MTX_DEF);
83 { VIRTIO_9PNET_F_MOUNT_TAG, "9PMountTag" },
94 SYSCTL_NODE(_vfs, OID_AUTO, 9p, CTLFLAG_RW, 0, "9P File System Protocol");
113 KASSERT(req->tc->tag != req->rc->tag, in vt9p_req_wait()
125 KASSERT(req->tc->tag == req->rc->tag, in vt9p_req_wait()
148 sg = chan->vt9p_sglist; in vt9p_request()
149 vq = chan->vt9p_vq; in vt9p_request()
153 /* Grab the channel lock*/ in vt9p_request()
158 error = sglist_append(sg, req->tc->sdata, req->tc->size); 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()
172 writable = sg->sg_nseg - readable; in vt9p_request()
181 cv_wait(&chan->submit_cv, VT9P_MTX(chan)); in vt9p_request()
220 vq = chan->vt9p_vq; 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()
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()
256 /* Probe for existence of 9P virtio channels */
261 /* If the virtio device type is a 9P device, then we claim and attach it */ in vt9p_probe()
264 device_set_desc(dev, "VirtIO 9P Transport"); in vt9p_probe()
274 virtqueue_disable_intr(sc->vt9p_vq); in vt9p_stop()
275 virtio_stop(sc->vt9p_dev); in vt9p_stop()
278 /* Detach the 9P virtio PCI device */
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()
307 /* Attach the 9P virtio PCI device */
319 chan->vt9p_dev = dev; in vt9p_attach()
321 /* Init the channel lock. */ 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()
373 error = virtqueue_enable_intr(chan->vt9p_vq); in vt9p_attach()
380 /* Insert the channel in global channel list */ in vt9p_attach()
392 * Allocate a new virtio channel. This sets up a transport channel
393 * for 9P communication
403 * Find out the corresponding channel for a client from global list in vt9p_create()
408 if (!strcmp(sc->mount_tag, mount_tag)) { 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()
427 chan->busy = true; in vt9p_create()
429 P9_DEBUG(TRANS, "%s: No Global channel with mount_tag=%s\n", in vt9p_create()
442 chan->busy = false; in vt9p_close()