Skip to contentSkip to conversation

xen-netback: use netdev_alloc_skb_ip_align

PATCH New Stephen Hemminger 1 participant 1 message Apr 10, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen-netback: use netdev_alloc_skb_ip_align

Begin forwarded message:

Date: Wed, 10 Apr 2013 14:18:16 +0100
From: Ian Campbell <[email protected]>
To: Stephen Hemminger <[email protected]>
Cc: "[email protected]" <[email protected]>
Subject: Re: [PATCH] xen-netback: use netdev_alloc_skb_ip_align

Quoted 31 lines · Stephen Hemminger
Quoted 15 lines · On Tue, 9 Apr 2013 12:27:31 +0100 Ian Campbell <[email protected]> wrote:

(apologies for the late reply, I've been away)

Quoted 12 lines · Stephen Hemminger

Use standard helper function to allocate and align received packet. Compile tested only

drivers/net/xen-netback/netback.c +0 -0
@@ -1357,8 +1357,8 @@ static unsigned xen_netbk_tx_build_gops(
 			    ret < MAX_SKB_FRAGS) ?
 			PKT_PROT_LEN : txreq.size;
 
Quoted 8 lines

drivers/net/xen-netback/netback.c static unsigned xen_netbk_tx_build_gops( · line 1361

Quoted 4 lines
drivers/net/xen-netback/netback.c +2 -2
-		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

Quoted 7 lines

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

Thanks for the explanation.

I see this wasn't CCd to netdev -- do you want to resend or would you like me to fwd to DaveM for you?

Ian.