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

Function vhost_user_set_config

dpdk/lib/vhost/vhost_user.c:2589–2629  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2587}
2588
2589static int
2590vhost_user_set_config(struct virtio_net **pdev,
2591 struct vhu_msg_context *ctx,
2592 int main_fd __rte_unused)
2593{
2594 struct virtio_net *dev = *pdev;
2595 struct rte_vdpa_device *vdpa_dev = dev->vdpa_dev;
2596 int ret = 0;
2597
2598 if (validate_msg_fds(dev, ctx, 0) != 0)
2599 return RTE_VHOST_MSG_RESULT_ERR;
2600
2601 if (ctx->msg.payload.cfg.size > VHOST_USER_MAX_CONFIG_SIZE) {
2602 VHOST_LOG_CONFIG(dev->ifname, ERR,
2603 "vhost_user_config size: %"PRIu32", should not be larger than %d\n",
2604 ctx->msg.payload.cfg.size, VHOST_USER_MAX_CONFIG_SIZE);
2605 goto out;
2606 }
2607
2608 if (!vdpa_dev) {
2609 VHOST_LOG_CONFIG(dev->ifname, ERR, "is not vDPA device!\n");
2610 goto out;
2611 }
2612
2613 if (vdpa_dev->ops->set_config) {
2614 ret = vdpa_dev->ops->set_config(dev->vid,
2615 ctx->msg.payload.cfg.region,
2616 ctx->msg.payload.cfg.offset,
2617 ctx->msg.payload.cfg.size,
2618 ctx->msg.payload.cfg.flags);
2619 if (ret)
2620 VHOST_LOG_CONFIG(dev->ifname, ERR, "set_config() return error!\n");
2621 } else {
2622 VHOST_LOG_CONFIG(dev->ifname, ERR, "set_config() not supported!\n");
2623 }
2624
2625 return RTE_VHOST_MSG_RESULT_OK;
2626
2627out:
2628 return RTE_VHOST_MSG_RESULT_ERR;
2629}
2630
2631static int
2632vhost_user_iotlb_msg(struct virtio_net **pdev,

Callers

nothing calls this directly

Calls 1

validate_msg_fdsFunction · 0.85

Tested by

no test coverage detected