From: "Jan Beulich" Subject: [PATCH 1/3] linux-2.6.18/net{back, front}: minor cleanup Date: Wed, 16 Oct 2013 14:15:47 +0100 Message-ID: <525EADA302000078000FB7FF@nat28.tlf.novell.com> References: <525EACA402000078000FB7F5@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part66556793.0__=" Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VWQx5-0003Z7-1R for xen-devel@lists.xenproject.org; Wed, 16 Oct 2013 13:15:51 +0000 In-Reply-To: <525EACA402000078000FB7F5@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part66556793.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline - 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; } =20 - frags +=3D (offset + len + PAGE_SIZE - 1) / PAGE_SIZE; + frags +=3D 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++; } =20 -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 =3D np->rx.rsp_cons; --- a/drivers/xen/netback/netback.c +++ b/drivers/xen/netback/netback.c @@ -46,7 +46,7 @@ =20 struct netbk_rx_meta { skb_frag_t frag; - int id; + u16 id; u8 copy:1; }; =20 @@ -1726,10 +1726,12 @@ static int __init netback_init(void) =20 netbk_copy_skb_mode =3D 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 =3D NETBK_ALWAYS_COPY_SKB; else +#endif netbk_copy_skb_mode =3D NETBK_DELAYED_COPY_SKB; } =20 --=__Part66556793.0__= Content-Type: text/plain; name="xenlinux-net-minor-cleanup.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="xenlinux-net-minor-cleanup.patch" net{back,front}: minor cleanup=0A=0A- use PFN_UP() instead of open coding = it=0A- make xennet_get_extras() static=0A- tighten packing of struct = netbk_rx_meta=0A- guard GNTTABOP_unmap_and_replace by CONFIG_XEN_COMPAT = check (mostly=0A for documentation purposes)=0A=0ASigned-off-by: Jan = Beulich =0A=0A--- a/drivers/xen/netfront/netfront.c=0A++= + b/drivers/xen/netfront/netfront.c=0A@@ -33,6 +33,7 @@=0A #include = =0A #include =0A #include = =0A+#include =0A #include =0A #include = =0A #include =0A@@ -971,7 +972,7 @@ static = int network_start_xmit(struct sk_=0A goto drop;=0A }=0A =0A- = frags +=3D (offset + len + PAGE_SIZE - 1) / PAGE_SIZE;=0A+ frags +=3D = PFN_UP(offset + len);=0A if (unlikely(frags > MAX_SKB_FRAGS + 1)) = {=0A printk(KERN_ALERT "xennet: skb rides the rocket: %d = frags\n",=0A frags);=0A@@ -1102,9 +1103,8 @@ static void = xennet_move_rx_slot(struct n=0A np->rx.req_prod_pvt++;=0A }=0A = =0A-int xennet_get_extras(struct netfront_info *np,=0A- = struct netif_extra_info *extras, RING_IDX rp)=0A-=0A+static int xennet_get_= extras(struct netfront_info *np,=0A+ struct = netif_extra_info *extras, RING_IDX rp)=0A {=0A struct netif_extra_info = *extra;=0A RING_IDX cons =3D np->rx.rsp_cons;=0A--- a/drivers/xen/netb= ack/netback.c=0A+++ b/drivers/xen/netback/netback.c=0A@@ -46,7 +46,7 @@=0A = =0A struct netbk_rx_meta {=0A skb_frag_t frag;=0A- int id;=0A+ = u16 id;=0A u8 copy:1;=0A };=0A =0A@@ -1726,10 +1726,12 @@ static int = __init netback_init(void)=0A =0A netbk_copy_skb_mode =3D NETBK_DONT_= COPY_SKB;=0A if (MODPARM_copy_skb) {=0A+#if CONFIG_XEN_COMPAT < = 0x030200=0A if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_and_re= place,=0A NULL, 0))=0A = netbk_copy_skb_mode =3D NETBK_ALWAYS_COPY_SKB;=0A = else=0A+#endif=0A netbk_copy_skb_mode =3D NETBK_DELAY= ED_COPY_SKB;=0A }=0A =0A --=__Part66556793.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part66556793.0__=--