Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 341911
b: refs/heads/master
c: cedb9bd
h: refs/heads/master
i:
  341909: 2de3f14
  341907: 61876dd
  341903: db7b87b
v: v3
  • Loading branch information
Michael S. Tsirkin committed Dec 6, 2012
1 parent 9474ad4 commit 79e3808
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1280c27f8e29acf4af2da914e80ec27c3dbd5c01
refs/heads/master: cedb9bdce099206290a2bdd02ce47a7b253b6a84
11 changes: 7 additions & 4 deletions trunk/drivers/vhost/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ static void handle_tx(struct vhost_net *net)
size_t hdr_size;
struct socket *sock;
struct vhost_ubuf_ref *uninitialized_var(ubufs);
bool zcopy;
bool zcopy, zcopy_used;

/* TODO: check that we are running from vhost_worker? */
sock = rcu_dereference_check(vq->private_data, 1);
Expand Down Expand Up @@ -319,8 +319,11 @@ static void handle_tx(struct vhost_net *net)
iov_length(vq->hdr, s), hdr_size);
break;
}
zcopy_used = zcopy && (len >= VHOST_GOODCOPY_LEN ||
vq->upend_idx != vq->done_idx);

/* use msg_control to pass vhost zerocopy ubuf info to skb */
if (zcopy) {
if (zcopy_used) {
vq->heads[vq->upend_idx].id = head;
if (!vhost_net_tx_select_zcopy(net) ||
len < VHOST_GOODCOPY_LEN) {
Expand Down Expand Up @@ -348,7 +351,7 @@ static void handle_tx(struct vhost_net *net)
/* TODO: Check specific error and bomb out unless ENOBUFS? */
err = sock->ops->sendmsg(NULL, sock, &msg, len);
if (unlikely(err < 0)) {
if (zcopy) {
if (zcopy_used) {
if (ubufs)
vhost_ubuf_put(ubufs);
vq->upend_idx = ((unsigned)vq->upend_idx - 1) %
Expand All @@ -362,7 +365,7 @@ static void handle_tx(struct vhost_net *net)
if (err != len)
pr_debug("Truncated TX packet: "
" len %d != %zd\n", err, len);
if (!zcopy)
if (!zcopy_used)
vhost_add_used_and_signal(&net->dev, vq, head, 0);
else
vhost_zerocopy_signal_used(net, vq);
Expand Down

0 comments on commit 79e3808

Please sign in to comment.