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