Lines Matching defs:c2dev
82 int vq_init(struct c2_dev *c2dev)
84 sprintf(c2dev->vq_cache_name, "c2-vq:dev%c",
85 (char) ('0' + c2dev->devnum));
86 c2dev->host_msg_cache =
87 kmem_cache_create(c2dev->vq_cache_name, c2dev->rep_vq.msg_size, 0,
89 if (c2dev->host_msg_cache == NULL) {
95 void vq_term(struct c2_dev *c2dev)
97 kmem_cache_destroy(c2dev->host_msg_cache);
103 struct c2_vq_req *vq_req_alloc(struct c2_dev *c2dev)
124 void vq_req_free(struct c2_dev *c2dev, struct c2_vq_req *r)
135 void vq_req_get(struct c2_dev *c2dev, struct c2_vq_req *r)
151 void vq_req_put(struct c2_dev *c2dev, struct c2_vq_req *r)
155 vq_repbuf_free(c2dev,
165 void *vq_repbuf_alloc(struct c2_dev *c2dev)
167 return kmem_cache_alloc(c2dev->host_msg_cache, GFP_ATOMIC);
178 int vq_send_wr(struct c2_dev *c2dev, union c2wr *wr)
186 spin_lock(&c2dev->vqlock);
191 msg = c2_mq_alloc(&c2dev->req_vq);
202 add_wait_queue(&c2dev->req_vq_wo, &__wait);
203 spin_unlock(&c2dev->vqlock);
206 if (!c2_mq_full(&c2dev->req_vq)) {
214 remove_wait_queue(&c2dev->req_vq_wo, &__wait);
218 remove_wait_queue(&c2dev->req_vq_wo, &__wait);
219 spin_lock(&c2dev->vqlock);
220 msg = c2_mq_alloc(&c2dev->req_vq);
226 memcpy(msg, wr, c2dev->req_vq.msg_size);
231 c2_mq_produce(&c2dev->req_vq);
236 spin_unlock(&c2dev->vqlock);
244 int vq_wait_for_reply(struct c2_dev *c2dev, struct c2_vq_req *req)
257 void vq_repbuf_free(struct c2_dev *c2dev, void *reply)
259 kmem_cache_free(c2dev->host_msg_cache, reply);