lkml.org 
[lkml]   [2007]   [Feb]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 5/8] lguest: trivial guest network driver
From
Date
On Wed, 2007-02-14 at 01:06 +1100, Herbert Xu wrote:
> On Tue, Feb 13, 2007 at 01:15:18PM +1100, Rusty Russell wrote:
> >
> > Good spotting! This function needs to be passed skb_headlen(skb),
> > rather than skb->len. Patch is below (I renamed the parameter as well,
> > for clarity).
>
> How about just dropping that parameter and using skb_headlen(skb)
> directly?

It's also used to generate dma structs for outgoing packets. In that
case, skb_headlen() == 0:

static struct sk_buff *lguestnet_alloc_skb(struct net_device *dev, int gfpflags)
{
struct sk_buff *skb;

skb = alloc_skb(16 + ETH_HLEN + DATA_SIZE, gfpflags);
if (!skb)
return NULL;

skb->dev = dev;
skb_reserve(skb, 16);
return skb;
}

/* Find a new skb to put in this slot in shared mem. */
static int fill_slot(struct net_device *dev, unsigned int slot)
{
struct lguestnet_info *info = dev->priv;
/* Try to create and register a new one. */
info->skb[slot] = lguestnet_alloc_skb(dev, GFP_ATOMIC);
if (!info->skb[slot]) {
printk("%s: could not fill slot %i\n", dev->name, slot);
return -ENOMEM;
}

skb_to_dma(info->skb[slot], ETH_HLEN + DATA_SIZE, &info->dma[slot]);

Cheers,
Rusty.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-02-14 05:51    [W:0.049 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site