* The virtio device sends us the desc, used and avail ring addresses. * This function then converts these to our address space. */
| 909 | * This function then converts these to our address space. |
| 910 | */ |
| 911 | static int |
| 912 | vhost_user_set_vring_addr(struct virtio_net **pdev, |
| 913 | struct vhu_msg_context *ctx, |
| 914 | int main_fd __rte_unused) |
| 915 | { |
| 916 | struct virtio_net *dev = *pdev; |
| 917 | struct vhost_virtqueue *vq; |
| 918 | struct vhost_vring_addr *addr = &ctx->msg.payload.addr; |
| 919 | bool access_ok; |
| 920 | |
| 921 | if (dev->mem == NULL) |
| 922 | return RTE_VHOST_MSG_RESULT_ERR; |
| 923 | |
| 924 | /* addr->index refers to the queue index. The txq 1, rxq is 0. */ |
| 925 | vq = dev->virtqueue[ctx->msg.payload.addr.index]; |
| 926 | |
| 927 | access_ok = vq->access_ok; |
| 928 | |
| 929 | /* |
| 930 | * Rings addresses should not be interpreted as long as the ring is not |
| 931 | * started and enabled |
| 932 | */ |
| 933 | memcpy(&vq->ring_addrs, addr, sizeof(*addr)); |
| 934 | |
| 935 | vring_invalidate(dev, vq); |
| 936 | |
| 937 | if ((vq->enabled && (dev->features & |
| 938 | (1ULL << VHOST_USER_F_PROTOCOL_FEATURES))) || |
| 939 | access_ok) { |
| 940 | translate_ring_addresses(&dev, &vq); |
| 941 | *pdev = dev; |
| 942 | } |
| 943 | |
| 944 | return RTE_VHOST_MSG_RESULT_OK; |
| 945 | } |
| 946 | |
| 947 | /* |
| 948 | * The virtio device sends us the available ring last used index. |
nothing calls this directly
no test coverage detected