From: Stephen Hemminger Subject: Re: [PATCH] xen-netback: use netdev_alloc_skb_ip_align Date: Tue, 9 Apr 2013 16:07:15 -0700 Message-ID: <20130409160715.24b16ca9@nehalam.linuxnetplumber.net> References: <20130320122130.04039b0d@nehalam.linuxnetplumber.net> <1365506851.10725.23.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1365506851.10725.23.camel@zakaz.uk.xensource.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: Ian Campbell Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On Tue, 9 Apr 2013 12:27:31 +0100 Ian Campbell wrote: > (apologies for the late reply, I've been away) > > On Wed, 2013-03-20 at 19:21 +0000, Stephen Hemminger wrote: > > Use standard helper function to allocate and align received packet. > > Compile tested only > > > > Signed-off-by: Stephen Hemminger > > > > > > --- a/drivers/net/xen-netback/netback.c 2013-03-07 18:12:52.825300956 -0800 > > +++ b/drivers/net/xen-netback/netback.c 2013-03-20 12:09:09.052034865 -0700 > > @@ -1357,8 +1357,8 @@ static unsigned xen_netbk_tx_build_gops( > > ret < MAX_SKB_FRAGS) ? > > PKT_PROT_LEN : txreq.size; > > > > - skb = alloc_skb(data_len + NET_SKB_PAD + NET_IP_ALIGN, > > - GFP_ATOMIC | __GFP_NOWARN); > > + skb = __netdev_alloc_skb_ip_align(vif->dev, data_len, > > + GFP_ATOMIC | __GFP_NOWARN); > > __netdev_alloc_skb_ip_align accounts for NET_IP_ALIGN but not > NET_SKB_PAD, is this aspect of the change intentional? (I'm not really > sure how much NET_SKB_PAD is worth in practice). __nedev_alloc_skb_ip_align(dev, length, gfp) calls __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp) calls __netdev_alloc_skb which adds padding here: struct sk_buff *__netdev_alloc_skb(struct net_device *dev, unsigned int length, gfp_t gfp_mask) { struct sk_buff *skb = NULL; unsigned int fragsz = SKB_DATA_ALIGN(length + NET_SKB_PAD) + SKB_DATA_ALIGN(sizeof(struct skb_shared_info));