Loading drivers/vhost/net.c +17 −17 Original line number Diff line number Diff line Loading @@ -647,39 +647,39 @@ static void vhost_rx_signal_used(struct vhost_net_virtqueue *nvq) static int vhost_net_rx_peek_head_len(struct vhost_net *net, struct sock *sk) { struct vhost_net_virtqueue *rvq = &net->vqs[VHOST_NET_VQ_RX]; struct vhost_net_virtqueue *nvq = &net->vqs[VHOST_NET_VQ_TX]; struct vhost_virtqueue *vq = &nvq->vq; struct vhost_net_virtqueue *rnvq = &net->vqs[VHOST_NET_VQ_RX]; struct vhost_net_virtqueue *tnvq = &net->vqs[VHOST_NET_VQ_TX]; struct vhost_virtqueue *tvq = &tnvq->vq; unsigned long uninitialized_var(endtime); int len = peek_head_len(rvq, sk); int len = peek_head_len(rnvq, sk); if (!len && vq->busyloop_timeout) { if (!len && tvq->busyloop_timeout) { /* Flush batched heads first */ vhost_rx_signal_used(rvq); vhost_rx_signal_used(rnvq); /* Both tx vq and rx socket were polled here */ mutex_lock_nested(&vq->mutex, 1); vhost_disable_notify(&net->dev, vq); mutex_lock_nested(&tvq->mutex, 1); vhost_disable_notify(&net->dev, tvq); preempt_disable(); endtime = busy_clock() + vq->busyloop_timeout; endtime = busy_clock() + tvq->busyloop_timeout; while (vhost_can_busy_poll(&net->dev, endtime) && !sk_has_rx_data(sk) && vhost_vq_avail_empty(&net->dev, vq)) vhost_vq_avail_empty(&net->dev, tvq)) cpu_relax(); preempt_enable(); if (!vhost_vq_avail_empty(&net->dev, vq)) vhost_poll_queue(&vq->poll); else if (unlikely(vhost_enable_notify(&net->dev, vq))) { vhost_disable_notify(&net->dev, vq); vhost_poll_queue(&vq->poll); if (!vhost_vq_avail_empty(&net->dev, tvq)) { vhost_poll_queue(&tvq->poll); } else if (unlikely(vhost_enable_notify(&net->dev, tvq))) { vhost_disable_notify(&net->dev, tvq); vhost_poll_queue(&tvq->poll); } mutex_unlock(&vq->mutex); mutex_unlock(&tvq->mutex); len = peek_head_len(rvq, sk); len = peek_head_len(rnvq, sk); } return len; Loading Loading
drivers/vhost/net.c +17 −17 Original line number Diff line number Diff line Loading @@ -647,39 +647,39 @@ static void vhost_rx_signal_used(struct vhost_net_virtqueue *nvq) static int vhost_net_rx_peek_head_len(struct vhost_net *net, struct sock *sk) { struct vhost_net_virtqueue *rvq = &net->vqs[VHOST_NET_VQ_RX]; struct vhost_net_virtqueue *nvq = &net->vqs[VHOST_NET_VQ_TX]; struct vhost_virtqueue *vq = &nvq->vq; struct vhost_net_virtqueue *rnvq = &net->vqs[VHOST_NET_VQ_RX]; struct vhost_net_virtqueue *tnvq = &net->vqs[VHOST_NET_VQ_TX]; struct vhost_virtqueue *tvq = &tnvq->vq; unsigned long uninitialized_var(endtime); int len = peek_head_len(rvq, sk); int len = peek_head_len(rnvq, sk); if (!len && vq->busyloop_timeout) { if (!len && tvq->busyloop_timeout) { /* Flush batched heads first */ vhost_rx_signal_used(rvq); vhost_rx_signal_used(rnvq); /* Both tx vq and rx socket were polled here */ mutex_lock_nested(&vq->mutex, 1); vhost_disable_notify(&net->dev, vq); mutex_lock_nested(&tvq->mutex, 1); vhost_disable_notify(&net->dev, tvq); preempt_disable(); endtime = busy_clock() + vq->busyloop_timeout; endtime = busy_clock() + tvq->busyloop_timeout; while (vhost_can_busy_poll(&net->dev, endtime) && !sk_has_rx_data(sk) && vhost_vq_avail_empty(&net->dev, vq)) vhost_vq_avail_empty(&net->dev, tvq)) cpu_relax(); preempt_enable(); if (!vhost_vq_avail_empty(&net->dev, vq)) vhost_poll_queue(&vq->poll); else if (unlikely(vhost_enable_notify(&net->dev, vq))) { vhost_disable_notify(&net->dev, vq); vhost_poll_queue(&vq->poll); if (!vhost_vq_avail_empty(&net->dev, tvq)) { vhost_poll_queue(&tvq->poll); } else if (unlikely(vhost_enable_notify(&net->dev, tvq))) { vhost_disable_notify(&net->dev, tvq); vhost_poll_queue(&tvq->poll); } mutex_unlock(&vq->mutex); mutex_unlock(&tvq->mutex); len = peek_head_len(rvq, sk); len = peek_head_len(rnvq, sk); } return len; Loading