Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 377014
b: refs/heads/master
c: 288cfe7
h: refs/heads/master
v: v3
  • Loading branch information
Michael S. Tsirkin authored and David S. Miller committed Jun 11, 2013
1 parent b8e3537 commit 1a26bf0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 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: 05c05351943cc03bf5c77e86953b24ae6fb21368
refs/heads/master: 288cfe78c8173f35c7a94f06859f60b3693d828a
22 changes: 7 additions & 15 deletions trunk/drivers/vhost/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,11 @@ static void vhost_net_ubuf_put_and_wait(struct vhost_net_ubuf_ref *ubufs)

static void vhost_net_clear_ubuf_info(struct vhost_net *n)
{

bool zcopy;
int i;

for (i = 0; i < n->dev.nvqs; ++i) {
zcopy = vhost_net_zcopy_mask & (0x1 << i);
if (zcopy)
kfree(n->vqs[i].ubuf_info);
for (i = 0; i < VHOST_NET_VQ_MAX; ++i) {
kfree(n->vqs[i].ubuf_info);
n->vqs[i].ubuf_info = NULL;
}
}

Expand All @@ -171,7 +168,7 @@ int vhost_net_set_ubuf_info(struct vhost_net *n)
bool zcopy;
int i;

for (i = 0; i < n->dev.nvqs; ++i) {
for (i = 0; i < VHOST_NET_VQ_MAX; ++i) {
zcopy = vhost_net_zcopy_mask & (0x1 << i);
if (!zcopy)
continue;
Expand All @@ -183,25 +180,20 @@ int vhost_net_set_ubuf_info(struct vhost_net *n)
return 0;

err:
while (i--) {
zcopy = vhost_net_zcopy_mask & (0x1 << i);
if (!zcopy)
continue;
kfree(n->vqs[i].ubuf_info);
}
vhost_net_clear_ubuf_info(n);
return -ENOMEM;
}

void vhost_net_vq_reset(struct vhost_net *n)
{
int i;

vhost_net_clear_ubuf_info(n);

for (i = 0; i < VHOST_NET_VQ_MAX; i++) {
n->vqs[i].done_idx = 0;
n->vqs[i].upend_idx = 0;
n->vqs[i].ubufs = NULL;
kfree(n->vqs[i].ubuf_info);
n->vqs[i].ubuf_info = NULL;
n->vqs[i].vhost_hlen = 0;
n->vqs[i].sock_hlen = 0;
}
Expand Down

0 comments on commit 1a26bf0

Please sign in to comment.