[lantiq]
[openwrt.git] / target / linux / ar7 / patches-2.6.37 / 973-cpmac_handle_mvswitch.patch
1 --- a/drivers/net/cpmac.c
2 +++ b/drivers/net/cpmac.c
3 @@ -372,6 +372,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 @@ -383,10 +384,15 @@ static struct sk_buff *cpmac_rx_one(stru
12 return NULL;
13 }
14
15 - skb = netdev_alloc_skb_ip_align(priv->dev, CPMAC_SKB_SIZE);
16 + skb = netdev_alloc_skb(priv->dev, CPMAC_SKB_SIZE);
17 if (likely(skb)) {
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 skb_checksum_none_assert(desc->skb);
27 priv->dev->stats.rx_packets++;
28 priv->dev->stats.rx_bytes += desc->datalen;
29 @@ -458,7 +464,12 @@ static int cpmac_poll(struct napi_struct
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 +962,7 @@ static void cpmac_adjust_link(struct net
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 @@ -990,11 +1001,17 @@ static int cpmac_open(struct net_device
53
54 priv->rx_head = &priv->desc_ring[CPMAC_QUEUES];
55 for (i = 0, desc = priv->rx_head; i < priv->ring_size; i++, desc++) {
56 - skb = netdev_alloc_skb_ip_align(dev, CPMAC_SKB_SIZE);
57 + skb = netdev_alloc_skb(dev, CPMAC_SKB_SIZE);
58 if (unlikely(!skb)) {
59 res = -ENOMEM;
60 goto fail_desc;
61 }
62 + offset = 2;
63 + if (priv->phy) {
64 + offset += priv->phy->pkt_align;
65 + }
66 + skb_reserve(skb, offset);
67 +
68 desc->skb = skb;
69 desc->data_mapping = dma_map_single(&dev->dev, skb->data,
70 CPMAC_SKB_SIZE,
This page took 0.052601 seconds and 5 git commands to generate.