netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Andrew J. Bennieston" <andrew.bennieston@citrix.com>
To: <xen-devel@lists.xenproject.org>, <davem@davemloft.net>
Cc: wei.liu2@citrix.com, ian.campbell@citrix.com,
	netdev@vger.kernel.org, paul.durrant@citrix.com,
	david.vrabel@citrix.com, zoltan.kiss@citrix.com,
	"Andrew J. Bennieston" <andrew.bennieston@citrix.com>
Subject: [PATCH V8 net-next 1/6] xen-netback: Move grant_copy_op array back into struct xenvif.
Date: Wed, 14 May 2014 14:52:25 +0100	[thread overview]
Message-ID: <1400075550-4580-2-git-send-email-andrew.bennieston@citrix.com> (raw)
In-Reply-To: <1400075550-4580-1-git-send-email-andrew.bennieston@citrix.com>

From: "Andrew J. Bennieston" <andrew.bennieston@citrix.com>

This array was allocated separately in commit ac3d5ac2 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 <andrew.bennieston@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
---
 drivers/net/xen-netback/common.h    |    3 +--
 drivers/net/xen-netback/interface.c |    9 ---------
 2 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h
index 630a3fc..747853e 100644
--- a/drivers/net/xen-netback/common.h
+++ b/drivers/net/xen-netback/common.h
@@ -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.
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
index a755733..93ca3ee 100644
--- a/drivers/net/xen-netback/interface.c
+++ b/drivers/net/xen-netback/interface.c
@@ -358,14 +358,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;
@@ -625,7 +617,6 @@ void xenvif_free(struct xenvif *vif)
 
 	unregister_netdev(vif->dev);
 
-	vfree(vif->grant_copy_op);
 	free_netdev(vif->dev);
 
 	module_put(THIS_MODULE);
-- 
1.7.10.4

  reply	other threads:[~2014-05-14 13:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-14 13:52 [PATCH V8 net-next 0/6] xen-net{back, front}: Multiple transmit and receive queues Andrew J. Bennieston
2014-05-14 13:52 ` Andrew J. Bennieston [this message]
2014-05-14 13:52 ` [PATCH V8 net-next 2/6] xen-netback: Factor queue-specific data into queue struct Andrew J. Bennieston
2014-05-14 13:58   ` Wei Liu
2014-05-14 13:52 ` [PATCH V8 net-next 3/6] xen-netback: Add support for multiple queues Andrew J. Bennieston
2014-05-14 13:59   ` Wei Liu
2014-05-14 13:52 ` [PATCH V8 net-next 4/6] xen-netfront: Factor queue-specific data into queue struct Andrew J. Bennieston
2014-05-14 13:52 ` [PATCH V8 net-next 5/6] xen-netfront: Add support for multiple queues Andrew J. Bennieston
2014-05-14 13:52 ` [PATCH V8 net-next 6/6] xen-net{back, front}: Document multi-queue feature in netif.h Andrew J. Bennieston
2014-05-14 14:09 ` [Xen-devel] [PATCH V8 net-next 0/6] xen-net{back, front}: Multiple transmit and receive queues Sander Eikelenboom
2014-05-14 14:13   ` Wei Liu
2014-05-14 16:18     ` Andrew Bennieston
2014-05-14 18:37       ` Sander Eikelenboom
2014-05-14 21:24         ` Wei Liu
2014-05-14 21:36           ` Sander Eikelenboom
2014-05-21 14:42         ` Paul Durrant
2014-05-27 23:10           ` [Xen-devel] " Wei Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1400075550-4580-2-git-send-email-andrew.bennieston@citrix.com \
    --to=andrew.bennieston@citrix.com \
    --cc=davem@davemloft.net \
    --cc=david.vrabel@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=netdev@vger.kernel.org \
    --cc=paul.durrant@citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    --cc=zoltan.kiss@citrix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).