7a2ce1453998fe6da1dd4df0233d00a626cefe8c
[openwrt/svn-archive/archive.git] / target / linux / ar7 / patches-2.6.32 / 973-cpmac_handle_mvswitch.patch
1 Index: linux-2.6.32.26/drivers/net/cpmac.c
2 ===================================================================
3 --- linux-2.6.32.26.orig/drivers/net/cpmac.c 2010-11-28 05:23:59.482390691 -0800
4 +++ linux-2.6.32.26/drivers/net/cpmac.c 2010-11-28 05:26:02.494883201 -0800
5 @@ -369,6 +369,7 @@
6 struct cpmac_desc *desc)
7 {
8 struct sk_buff *skb, *result = NULL;
9 + int offset;
10
11 if (unlikely(netif_msg_hw(priv)))
12 cpmac_dump_desc(priv->dev, desc);
13 @@ -382,9 +383,13 @@
14
15 skb = netdev_alloc_skb(priv->dev, CPMAC_SKB_SIZE);
16 if (likely(skb)) {
17 - skb_reserve(skb, 2);
18 + offset = 2;
19 + if (priv->phy) {
20 + offset += priv->phy->pkt_align;
21 + }
22 + skb_reserve(skb, offset);
23 +
24 skb_put(desc->skb, desc->datalen);
25 - desc->skb->protocol = eth_type_trans(desc->skb, priv->dev);
26 desc->skb->ip_summed = CHECKSUM_NONE;
27 priv->dev->stats.rx_packets++;
28 priv->dev->stats.rx_bytes += desc->datalen;
29 @@ -456,7 +461,12 @@
30
31 skb = cpmac_rx_one(priv, desc);
32 if (likely(skb)) {
33 - netif_receive_skb(skb);
34 + if (priv->phy->netif_receive_skb) {
35 + priv->phy->netif_receive_skb(skb);
36 + } else {
37 + skb->protocol = eth_type_trans(skb, priv->dev);
38 + netif_receive_skb(skb);
39 + }
40 received++;
41 }
42 desc = desc->next;
43 @@ -951,7 +961,7 @@
44
45 static int cpmac_open(struct net_device *dev)
46 {
47 - int i, size, res;
48 + int i, size, res, offset;
49 struct cpmac_priv *priv = netdev_priv(dev);
50 struct resource *mem;
51 struct cpmac_desc *desc;
52 @@ -995,7 +1005,12 @@
53 res = -ENOMEM;
54 goto fail_desc;
55 }
56 - skb_reserve(skb, 2);
57 + offset = 2;
58 + if (priv->phy) {
59 + offset += priv->phy->pkt_align;
60 + }
61 + skb_reserve(skb, offset);
62 +
63 desc->skb = skb;
64 desc->data_mapping = dma_map_single(&dev->dev, skb->data,
65 CPMAC_SKB_SIZE,