Skip to contentSkip to conversation

linux-2.6.18: assorted minor cleanup

PATCH New Jan Beulich 1 participant 4 messages Oct 16, 2013 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

cover linux-2.6.18: assorted minor cleanup

Stuff that accumulated over the last half year or so.

1: net{back,front}: minor cleanup
2: x86/time: replace deprecated SA_INTERRUPT
3: x86/time: remove dead code

#1 lore raw

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

- 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)

drivers/xen/netfront/netfront.c +4 -4
@@ -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;
drivers/xen/netback/netback.c +3 -1
@@ -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;
 	}
 

net{back,front}: minor cleanup

- 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)

drivers/xen/netfront/netfront.c +4 -4
@@ -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;
drivers/xen/netback/netback.c +3 -1
@@ -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;
 	}
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw

PATCH 3/3 linux-2.6.18/x86/time: remove dead code

In reply to Jan Beulich
arch/i386/kernel/time-xen.c +0 -31
@@ -45,7 +45,6 @@
 #include <linux/sysdev.h>
 #include <linux/bcd.h>
 #include <linux/efi.h>
-#include <linux/mca.h>
 #include <linux/sysctl.h>
 #include <linux/percpu.h>
 #include <linux/kernel_stat.h>
@@ -97,10 +96,6 @@ extern unsigned long wall_jiffies;
 DEFINE_SPINLOCK(rtc_lock);
 EXPORT_SYMBOL(rtc_lock);
 
-extern struct init_timer_opts timer_tsc_init;
-extern struct timer_opts timer_tsc;
-#define timer_none timer_tsc
-
 /* These are peridically updated in shared_info, and then copied here. */
 struct shadow_time_info {
 	u64 tsc_timestamp;     /* TSC at last update of time vals.  */
@@ -172,24 +167,6 @@ static int __init __permitted_clock_jitt
 }
 __setup("permitted_clock_jitter=", __permitted_clock_jitter);
 
-#if 0
-static void delay_tsc(unsigned long loops)
-{
-	unsigned long bclock, now;
-
-	rdtscl(bclock);
-	do {
-		rep_nop();
-		rdtscl(now);
-	} while ((now - bclock) < loops);
-}
-
-struct timer_opts timer_tsc = {
-	.name = "tsc",
-	.delay = delay_tsc,
-};
-#endif
-
 /*
  * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction,
  * yielding a 64-bit result.
@@ -226,14 +203,6 @@ static inline u64 scale_delta(u64 delta,
 	return product;
 }
 
-#if 0 /* defined (__i386__) */
-int read_current_timer(unsigned long *timer_val)
-{
-	rdtscl(*timer_val);
-	return 0;
-}
-#endif
-
 void init_cpu_khz(void)
 {
 	u64 __cpu_khz = 1000000ULL << 32;

x86/time: remove dead code

arch/i386/kernel/time-xen.c +0 -31
@@ -45,7 +45,6 @@
 #include <linux/sysdev.h>
 #include <linux/bcd.h>
 #include <linux/efi.h>
-#include <linux/mca.h>
 #include <linux/sysctl.h>
 #include <linux/percpu.h>
 #include <linux/kernel_stat.h>
@@ -97,10 +96,6 @@ extern unsigned long wall_jiffies;
 DEFINE_SPINLOCK(rtc_lock);
 EXPORT_SYMBOL(rtc_lock);
 
-extern struct init_timer_opts timer_tsc_init;
-extern struct timer_opts timer_tsc;
-#define timer_none timer_tsc
-
 /* These are peridically updated in shared_info, and then copied here. */
 struct shadow_time_info {
 	u64 tsc_timestamp;     /* TSC at last update of time vals.  */
@@ -172,24 +167,6 @@ static int __init __permitted_clock_jitt
 }
 __setup("permitted_clock_jitter=", __permitted_clock_jitter);
 
-#if 0
-static void delay_tsc(unsigned long loops)
-{
-	unsigned long bclock, now;
-
-	rdtscl(bclock);
-	do {
-		rep_nop();
-		rdtscl(now);
-	} while ((now - bclock) < loops);
-}
-
-struct timer_opts timer_tsc = {
-	.name = "tsc",
-	.delay = delay_tsc,
-};
-#endif
-
 /*
  * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction,
  * yielding a 64-bit result.
@@ -226,14 +203,6 @@ static inline u64 scale_delta(u64 delta,
 	return product;
 }
 
-#if 0 /* defined (__i386__) */
-int read_current_timer(unsigned long *timer_val)
-{
-	rdtscl(*timer_val);
-	return 0;
-}
-#endif
-
 void init_cpu_khz(void)
 {
 	u64 __cpu_khz = 1000000ULL << 32;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel