aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/xen-netfront.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/xen-netfront.c')
-rw-r--r--drivers/net/xen-netfront.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index c749bdba214c..c6948d8f53f6 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -239,11 +239,14 @@ static void xennet_alloc_rx_buffers(struct net_device *dev)
239 */ 239 */
240 batch_target = np->rx_target - (req_prod - np->rx.rsp_cons); 240 batch_target = np->rx_target - (req_prod - np->rx.rsp_cons);
241 for (i = skb_queue_len(&np->rx_batch); i < batch_target; i++) { 241 for (i = skb_queue_len(&np->rx_batch); i < batch_target; i++) {
242 skb = __netdev_alloc_skb(dev, RX_COPY_THRESHOLD, 242 skb = __netdev_alloc_skb(dev, RX_COPY_THRESHOLD + NET_IP_ALIGN,
243 GFP_ATOMIC | __GFP_NOWARN); 243 GFP_ATOMIC | __GFP_NOWARN);
244 if (unlikely(!skb)) 244 if (unlikely(!skb))
245 goto no_skb; 245 goto no_skb;
246 246
247 /* Align ip header to a 16 bytes boundary */
248 skb_reserve(skb, NET_IP_ALIGN);
249
247 page = alloc_page(GFP_ATOMIC | __GFP_NOWARN); 250 page = alloc_page(GFP_ATOMIC | __GFP_NOWARN);
248 if (!page) { 251 if (!page) {
249 kfree_skb(skb); 252 kfree_skb(skb);
@@ -471,7 +474,7 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
471 unsigned int offset = offset_in_page(data); 474 unsigned int offset = offset_in_page(data);
472 unsigned int len = skb_headlen(skb); 475 unsigned int len = skb_headlen(skb);
473 476
474 frags += (offset + len + PAGE_SIZE - 1) / PAGE_SIZE; 477 frags += DIV_ROUND_UP(offset + len, PAGE_SIZE);
475 if (unlikely(frags > MAX_SKB_FRAGS + 1)) { 478 if (unlikely(frags > MAX_SKB_FRAGS + 1)) {
476 printk(KERN_ALERT "xennet: skb rides the rocket: %d frags\n", 479 printk(KERN_ALERT "xennet: skb rides the rocket: %d frags\n",
477 frags); 480 frags);
@@ -1794,10 +1797,10 @@ static struct xenbus_driver netfront = {
1794 1797
1795static int __init netif_init(void) 1798static int __init netif_init(void)
1796{ 1799{
1797 if (!is_running_on_xen()) 1800 if (!xen_domain())
1798 return -ENODEV; 1801 return -ENODEV;
1799 1802
1800 if (is_initial_xendomain()) 1803 if (xen_initial_domain())
1801 return 0; 1804 return 0;
1802 1805
1803 printk(KERN_INFO "Initialising Xen virtual ethernet driver.\n"); 1806 printk(KERN_INFO "Initialising Xen virtual ethernet driver.\n");
@@ -1809,7 +1812,7 @@ module_init(netif_init);
1809 1812
1810static void __exit netif_exit(void) 1813static void __exit netif_exit(void)
1811{ 1814{
1812 if (is_initial_xendomain()) 1815 if (xen_initial_domain())
1813 return; 1816 return;
1814 1817
1815 xenbus_unregister_driver(&netfront); 1818 xenbus_unregister_driver(&netfront);