*/Ģ93 static void handle_tx(struct vhost_net *net)Ģ95 struct vhost_net_virtqueue *nvq = &net->vqs Ģ96 struct vhost_virtqueue *vq = &nvq->vq ģ73 /* use msg_control to pass vhost zerocopy ubuf info to skb */ģ76 ubuf = nvq->ubuf_info + nvq->upend_idx ģ78 vq->heads.id = cpu_to_vhost32(vq, head) ģ79 vq->heads.len = VHOST_DMA_IN_PROGRESS ģ80 ubuf->callback = vhost_zerocopy_callback ģ87 nvq->upend_idx = (nvq->upend_idx + 1) % UIO_MAXIOV ģ92 /* TODO: Check specific error and bomb out unless ENOBUFS? */ģ93 err = sock->ops->sendmsg(sock, &msg, len) ġ502 static int tun_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len)ġ505 struct tun_file *tfile = container_of(sock, struct tun_file, socket) ġ506 struct tun_struct *tun = _tun_get(tfile) ġ511 ret = tun_get_user(tun, tfile, m->msg_control, &m->msg_iter,ġ080 /* Get packet from user space buffer */ġ081 static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,ġ082 void *msg_control, struct iov_iter *from,ġ249 /* copy skb_ubuf_info for callback when skb has no error */ġ251 skb_shinfo(skb)->destructor_arg = msg_control ġ252 skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY ġ253 skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG Ħ71 void _kfree_skb(struct sk_buff *skb)Ħ54 /* Free everything but the sk_buff shell. Shinfo->destructor_arg ** "struct ubuf_info *ubuf " and ubuf->callback is called.Ģ91 /* Expects to be always run from workqueue - which acts asĢ92 * read-size critical section for our kind of RCU. Tun_get_user ** set destructor_arg as "struct ubuf_info *ubuf ", and set SKBTX_DEV_ZEROCOPY If performance regression is observed, or if host CPU utilization is not a concern, zero copy transmit mode can be disabled by setting experimental_zcopytx to 0. Enabling zero copy transmit disables this threat mitigation technique. To enable zero copy transmit mode, set the experimental_zcopytx kernel module parameter for the vhost_net module to 1.Īn additional data copy is normally created during transmit as a threat mitigation technique against denial of service and information leak attacks. It does not affect performance for guest-to-guest, guest-to-host, or small packet workloads.īridge zero copy transmit is fully supported on Red Hat Enterprise Linux 7 virtual machines, but disabled by default. It typically reduces the host CPU overhead by up to 15% when transmitting large packets between a guest network and an external network, without affecting throughput. Mostly I am trying to get feedback about two things: My strategy of copying pointers rather than data by allocating all the memory initially in the constructor and then just copying pointers rather than entire structures during push. Zero copy transmit mode is effective on large packet sizes. By 'zero copy' I mean no copying of data (mostly C++ structures) will take place during push and pop operations.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |