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) Signed-off-by: Jan Beulich --- a/drivers/xen/netfront/netfront.c +++ b/drivers/xen/netfront/netfront.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -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; }