Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 66864
b: refs/heads/master
c: 0d0d9c1
h: refs/heads/master
v: v3
  • Loading branch information
Scott Wood authored and David S. Miller committed Oct 10, 2007
1 parent 46ae3f3 commit 4483307
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c6565331b7162a8348c70c37b4c33bedb6d4f02d
refs/heads/master: 0d0d9c150c046cbd3e507adcfa2d78db82f1f452
21 changes: 19 additions & 2 deletions trunk/drivers/net/fs_enet/fs_enet-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ static void fs_set_multicast_list(struct net_device *dev)
(*fep->ops->set_multicast_list)(dev);
}

static void skb_align(struct sk_buff *skb, int align)
{
int off = ((unsigned long)skb->data) & (align - 1);

if (off)
skb_reserve(skb, align - off);
}

/* NAPI receive function */
static int fs_enet_rx_napi(struct napi_struct *napi, int budget)
{
Expand Down Expand Up @@ -159,9 +167,13 @@ static int fs_enet_rx_napi(struct napi_struct *napi, int budget)
skb = skbn;
skbn = skbt;
}
} else
} else {
skbn = dev_alloc_skb(ENET_RX_FRSIZE);

if (skbn)
skb_align(skbn, ENET_RX_ALIGN);
}

if (skbn != NULL) {
skb_put(skb, pkt_len); /* Make room */
skb->protocol = eth_type_trans(skb, dev);
Expand Down Expand Up @@ -290,9 +302,13 @@ static int fs_enet_rx_non_napi(struct net_device *dev)
skb = skbn;
skbn = skbt;
}
} else
} else {
skbn = dev_alloc_skb(ENET_RX_FRSIZE);

if (skbn)
skb_align(skbn, ENET_RX_ALIGN);
}

if (skbn != NULL) {
skb_put(skb, pkt_len); /* Make room */
skb->protocol = eth_type_trans(skb, dev);
Expand Down Expand Up @@ -502,6 +518,7 @@ void fs_init_bds(struct net_device *dev)
dev->name);
break;
}
skb_align(skb, ENET_RX_ALIGN);
fep->rx_skbuff[i] = skb;
CBDW_BUFADDR(bdp,
dma_map_single(fep->dev, skb->data,
Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/net/fs_enet/fs_enet.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ struct phy_info {
/* Must be a multiple of 32 (to cover both FEC & FCC) */
#define PKT_MAXBLR_SIZE ((PKT_MAXBUF_SIZE + 31) & ~31)
/* This is needed so that invalidate_xxx wont invalidate too much */
#define ENET_RX_FRSIZE L1_CACHE_ALIGN(PKT_MAXBUF_SIZE)
#define ENET_RX_ALIGN 16
#define ENET_RX_FRSIZE L1_CACHE_ALIGN(PKT_MAXBUF_SIZE + ENET_RX_ALIGN - 1)

struct fs_enet_mii_bus {
struct list_head list;
Expand Down

0 comments on commit 4483307

Please sign in to comment.