Skip to content

Commit

Permalink
xen-netback: Move grant_copy_op array back into struct xenvif.
Browse files Browse the repository at this point in the history
This array was allocated separately in commit ac3d5ac ("xen-netback:
fix guest-receive-side array sizes") due to it being very large, and a
struct xenvif is allocated as the netdev_priv part of a struct
net_device, i.e. via kmalloc() but falling back to vmalloc() if the
initial alloc. fails.

In preparation for the multi-queue patches, where this array becomes
part of struct xenvif_queue and is always allocated through vzalloc(),
move this back into the struct xenvif.

Signed-off-by: Andrew J. Bennieston <[email protected]>
Acked-by: Wei Liu <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
ajbennieston authored and davem330 committed Jun 4, 2014
1 parent 9bcc14d commit a55d976
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
3 changes: 1 addition & 2 deletions drivers/net/xen-netback/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ struct xenvif {

struct timer_list wake_queue;

/* This array is allocated seperately as it is large */
struct gnttab_copy *grant_copy_op;
struct gnttab_copy grant_copy_op[MAX_GRANT_COPY_OPS];

/* We create one meta structure per ring request we consume, so
* the maximum number is the same as the ring size.
Expand Down
9 changes: 0 additions & 9 deletions drivers/net/xen-netback/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,14 +334,6 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,

vif = netdev_priv(dev);

vif->grant_copy_op = vmalloc(sizeof(struct gnttab_copy) *
MAX_GRANT_COPY_OPS);
if (vif->grant_copy_op == NULL) {
pr_warn("Could not allocate grant copy space for %s\n", name);
free_netdev(dev);
return ERR_PTR(-ENOMEM);
}

vif->domid = domid;
vif->handle = handle;
vif->can_sg = 1;
Expand Down Expand Up @@ -601,7 +593,6 @@ void xenvif_free(struct xenvif *vif)

unregister_netdev(vif->dev);

vfree(vif->grant_copy_op);
free_netdev(vif->dev);

module_put(THIS_MODULE);
Expand Down

0 comments on commit a55d976

Please sign in to comment.