[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 1/3] linux-2.6.18/net{back, front}: minor cleanup


  • To: "xen-devel" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Jan Beulich" <JBeulich@xxxxxxxx>
  • Date: Wed, 16 Oct 2013 14:15:47 +0100
  • Delivery-date: Wed, 16 Oct 2013 13:16:02 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

- use PFN_UP() instead of open coding it
- make xennet_get_extras() static
- tighten packing of struct netbk_rx_meta
- guard GNTTABOP_unmap_and_replace by CONFIG_XEN_COMPAT check (mostly
  for documentation purposes)

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/drivers/xen/netfront/netfront.c
+++ b/drivers/xen/netfront/netfront.c
@@ -33,6 +33,7 @@
 #include <linux/module.h>
 #include <linux/version.h>
 #include <linux/kernel.h>
+#include <linux/pfn.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/string.h>
@@ -971,7 +972,7 @@ static int network_start_xmit(struct sk_
                goto drop;
        }
 
-       frags += (offset + len + PAGE_SIZE - 1) / PAGE_SIZE;
+       frags += PFN_UP(offset + len);
        if (unlikely(frags > MAX_SKB_FRAGS + 1)) {
                printk(KERN_ALERT "xennet: skb rides the rocket: %d frags\n",
                       frags);
@@ -1102,9 +1103,8 @@ static void xennet_move_rx_slot(struct n
        np->rx.req_prod_pvt++;
 }
 
-int xennet_get_extras(struct netfront_info *np,
-                     struct netif_extra_info *extras, RING_IDX rp)
-
+static int xennet_get_extras(struct netfront_info *np,
+                            struct netif_extra_info *extras, RING_IDX rp)
 {
        struct netif_extra_info *extra;
        RING_IDX cons = np->rx.rsp_cons;
--- a/drivers/xen/netback/netback.c
+++ b/drivers/xen/netback/netback.c
@@ -46,7 +46,7 @@
 
 struct netbk_rx_meta {
        skb_frag_t frag;
-       int id;
+       u16 id;
        u8 copy:1;
 };
 
@@ -1726,10 +1726,12 @@ static int __init netback_init(void)
 
        netbk_copy_skb_mode = NETBK_DONT_COPY_SKB;
        if (MODPARM_copy_skb) {
+#if CONFIG_XEN_COMPAT < 0x030200
                if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_and_replace,
                                              NULL, 0))
                        netbk_copy_skb_mode = NETBK_ALWAYS_COPY_SKB;
                else
+#endif
                        netbk_copy_skb_mode = NETBK_DELAYED_COPY_SKB;
        }
 



Attachment: xenlinux-net-minor-cleanup.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.