MCPcopy Create free account
hub / github.com/F-Stack/f-stack / virtio_net_ctrl_handle

Function virtio_net_ctrl_handle

dpdk/lib/vhost/virtio_net_ctrl.c:244–282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242}
243
244int
245virtio_net_ctrl_handle(struct virtio_net *dev)
246{
247 int ret = 0;
248
249 if (dev->features & (1ULL << VIRTIO_F_RING_PACKED)) {
250 VHOST_LOG_CONFIG(dev->ifname, ERR, "Packed ring not supported yet\n");
251 return -1;
252 }
253
254 if (!dev->cvq) {
255 VHOST_LOG_CONFIG(dev->ifname, ERR, "missing control queue\n");
256 return -1;
257 }
258
259 rte_rwlock_read_lock(&dev->cvq->access_lock);
260 vhost_user_iotlb_rd_lock(dev->cvq);
261
262 while (1) {
263 struct virtio_net_ctrl_elem ctrl_elem;
264
265 memset(&ctrl_elem, 0, sizeof(struct virtio_net_ctrl_elem));
266
267 ret = virtio_net_ctrl_pop(dev, dev->cvq, &ctrl_elem);
268 if (ret <= 0)
269 break;
270
271 *ctrl_elem.desc_ack = virtio_net_ctrl_handle_req(dev, ctrl_elem.ctrl_req);
272
273 ret = virtio_net_ctrl_push(dev, &ctrl_elem);
274 if (ret < 0)
275 break;
276 }
277
278 vhost_user_iotlb_rd_unlock(dev->cvq);
279 rte_rwlock_read_unlock(&dev->cvq->access_lock);
280
281 return ret;
282}

Callers 1

Calls 4

memsetFunction · 0.85
virtio_net_ctrl_popFunction · 0.85
virtio_net_ctrl_pushFunction · 0.85

Tested by

no test coverage detected