target/linux: refresh 2.6.32 patches
[openwrt/openwrt.git] / target / linux / atheros / patches-2.6.32 / 200-ar2313_enable_mvswitch.patch
1 --- a/drivers/net/ar231x.c
2 +++ b/drivers/net/ar231x.c
3 @@ -735,6 +735,7 @@ static void ar231x_load_rx_ring(struct n
4 for (i = 0; i < nr_bufs; i++) {
5 struct sk_buff *skb;
6 ar231x_descr_t *rd;
7 + int offset = RX_OFFSET;
8
9 if (sp->rx_skb[idx])
10 break;
11 @@ -750,7 +751,9 @@ static void ar231x_load_rx_ring(struct n
12 * Make sure IP header starts on a fresh cache line.
13 */
14 skb->dev = dev;
15 - skb_reserve(skb, RX_OFFSET);
16 + if (sp->phy_dev)
17 + offset += sp->phy_dev->pkt_align;
18 + skb_reserve(skb, offset);
19 sp->rx_skb[idx] = skb;
20
21 rd = (ar231x_descr_t *) & sp->rx_ring[idx];
22 @@ -824,20 +827,23 @@ static int ar231x_rx_int(struct net_devi
23 /* alloc new buffer. */
24 skb_new = netdev_alloc_skb(dev, AR2313_BUFSIZE + RX_OFFSET);
25 if (skb_new != NULL) {
26 + int offset;
27
28 skb = sp->rx_skb[idx];
29 /* set skb */
30 skb_put(skb,
31 ((status >> DMA_RX_LEN_SHIFT) & 0x3fff) - CRC_LEN);
32 -
33 dev->stats.rx_bytes += skb->len;
34 - skb->protocol = eth_type_trans(skb, dev);
35 - /* pass the packet to upper layers */
36 - netif_rx(skb);
37
38 + /* pass the packet to upper layers */
39 + sp->rx(skb);
40 skb_new->dev = dev;
41 +
42 /* 16 bit align */
43 - skb_reserve(skb_new, RX_OFFSET);
44 + offset = RX_OFFSET;
45 + if (sp->phy_dev)
46 + offset += sp->phy_dev->pkt_align;
47 + skb_reserve(skb_new, offset);
48 /* reset descriptor's curr_addr */
49 rxdesc->addr = virt_to_phys(skb_new->data);
50
51 @@ -1239,6 +1245,8 @@ static int ar231x_mdiobus_probe (struct
52 return PTR_ERR(phydev);
53 }
54
55 + sp->rx = phydev->netif_rx;
56 +
57 /* mask with MAC supported features */
58 phydev->supported &= (SUPPORTED_10baseT_Half
59 | SUPPORTED_10baseT_Full
60 --- a/drivers/net/ar231x.h
61 +++ b/drivers/net/ar231x.h
62 @@ -221,6 +221,8 @@ typedef struct {
63 */
64 struct ar231x_private {
65 struct net_device *dev;
66 + int (*rx)(struct sk_buff *skb);
67 +
68 int version;
69 u32 mb[2];
70