]> git.pld-linux.org Git - packages/kernel.git/blob - kernel-VLAN_3c59x-3c90x.patch
- ported from linux-2.4.25-atmdd.patch
[packages/kernel.git] / kernel-VLAN_3c59x-3c90x.patch
1 diff -Nur --exclude '*.orig' linux-2.6.8.1.org/drivers/net/3c59x.c linux-2.6.8.1/drivers/net/3c59x.c
2 --- linux-2.6.8.1.org/drivers/net/3c59x.c       2004-11-03 16:45:52.195342248 +0100
3 +++ linux-2.6.8.1/drivers/net/3c59x.c   2004-11-03 16:48:07.570762056 +0100
4 @@ -698,7 +698,7 @@
5         Wn2_ResetOptions=12,
6  };
7  enum Window3 {                 /* Window 3: MAC/config bits. */
8 -       Wn3_Config=0, Wn3_MAC_Ctrl=6, Wn3_Options=8,
9 + Wn3_Config=0, Wn3_MaxPktSize=4, Wn3_MAC_Ctrl=6, Wn3_Options=8,
10  };
11  
12  #define BFEXT(value, offset, bitcount)  \
13 @@ -726,7 +726,8 @@
14         Media_LnkBeat = 0x0800,
15  };
16  enum Window7 {                                 /* Window 7: Bus Master control. */
17 -       Wn7_MasterAddr = 0, Wn7_MasterLen = 6, Wn7_MasterStatus = 12,
18 + Wn7_MasterAddr = 0, Wn7_VlanEtherType=4, Wn7_MasterLen = 6,
19 + Wn7_MasterStatus = 12,
20  };
21  /* Boomerang bus master control registers. */
22  enum MasterCtrl {
23 @@ -822,7 +823,8 @@
24                 pm_state_valid:1,                               /* power_state[] has sane contents */
25                 open:1,
26                 medialock:1,
27 -               must_free_region:1;                             /* Flag: if zero, Cardbus owns the I/O region */
28 +  must_free_region:1,    /* Flag: if zero, Cardbus owns the I/O region */
29 +  large_frames:1;   /* accept large frames */
30         int drv_flags;
31         u16 status_enable;
32         u16 intr_enable;
33 @@ -907,6 +909,8 @@
34  static void vortex_tx_timeout(struct net_device *dev);
35  static void acpi_set_WOL(struct net_device *dev);
36  static struct ethtool_ops vortex_ethtool_ops;
37 +static void set_8021q_mode(struct net_device *dev, int enable);
38 +
39  \f
40  /* This driver uses 'options' to pass the media type, full-duplex flag, etc. */
41  /* Option count limit only -- unlimited interfaces are supported. */
42 @@ -1167,6 +1171,7 @@
43         dev->base_addr = ioaddr;
44         dev->irq = irq;
45         dev->mtu = mtu;
46 + vp->large_frames = mtu > 1500;
47         vp->drv_flags = vci->drv_flags;
48         vp->has_nway = (vci->drv_flags & HAS_NWAY) ? 1 : 0;
49         vp->io_size = vci->io_size;
50 @@ -1619,7 +1624,7 @@
51  
52         /* Set the full-duplex bit. */
53         outw(   ((vp->info1 & 0x8000) || vp->full_duplex ? 0x20 : 0) |
54 -                       (dev->mtu > 1500 ? 0x40 : 0) |
55 +    (vp->large_frames ? 0x40 : 0) |
56                         ((vp->full_duplex && vp->flow_ctrl && vp->partner_flow_ctrl) ? 0x100 : 0),
57                         ioaddr + Wn3_MAC_Ctrl);
58  
59 @@ -1703,6 +1708,8 @@
60         }
61         /* Set receiver mode: presumably accept b-case and phys addr only. */
62         set_rx_mode(dev);
63 + /* enable 802.1q tagged frames */
64 + set_8021q_mode(dev, 1);
65         outw(StatsEnable, ioaddr + EL3_CMD); /* Turn on statistics. */
66  
67  //     issue_and_wait(dev, SetTxStart|0x07ff);
68 @@ -1845,7 +1852,7 @@
69                                                 /* Set the full-duplex bit. */
70                                                 EL3WINDOW(3);
71                                                 outw(   (vp->full_duplex ? 0x20 : 0) |
72 -                                                               (dev->mtu > 1500 ? 0x40 : 0) |
73 +        (vp->large_frames ? 0x40 : 0) |
74                                                                 ((vp->full_duplex && vp->flow_ctrl && vp->partner_flow_ctrl) ? 0x100 : 0),
75                                                                 ioaddr + Wn3_MAC_Ctrl);
76                                                 if (vortex_debug > 1)
77 @@ -2071,6 +2078,8 @@
78                         issue_and_wait(dev, RxReset|0x07);
79                         /* Set the Rx filter to the current state. */
80                         set_rx_mode(dev);
81 +   /* enable 802.1q VLAN tagged frames */
82 +   set_8021q_mode(dev, 1);
83                         outw(RxEnable, ioaddr + EL3_CMD); /* Re-enable the receiver. */
84                         outw(AckIntr | HostError, ioaddr + EL3_CMD);
85                 }
86 @@ -2675,6 +2684,9 @@
87         outw(RxDisable, ioaddr + EL3_CMD);
88         outw(TxDisable, ioaddr + EL3_CMD);
89  
90 + /* Disable receiving 802.1q tagged frames */
91 + set_8021q_mode(dev, 0);
92 +
93         if (dev->if_port == XCVR_10base2)
94                 /* Turn off thinnet power.  Green! */
95                 outw(StopCoax, ioaddr + EL3_CMD);
96 @@ -2950,6 +2962,61 @@
97         outw(new_mode, ioaddr + EL3_CMD);
98  }
99  
100 +#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
101 +/* Setup the card so that it can receive frames with an 802.1q VLAN tag.
102 +   Note that this must be done after each RxReset due to some backwards
103 +   compatibility logic in the Cyclone and Tornado ASICs */
104 +
105 +/* The Ethernet Type used for 802.1q tagged frames */
106 +#define VLAN_ETHER_TYPE 0x8100
107 +
108 +static void set_8021q_mode(struct net_device *dev, int enable)
109 +{
110 + struct vortex_private *vp = (struct vortex_private *)dev->priv;
111 + long ioaddr = dev->base_addr;
112 + int old_window = inw(ioaddr + EL3_CMD);
113 + int mac_ctrl;
114
115 + if ((vp->drv_flags&IS_CYCLONE) || (vp->drv_flags&IS_TORNADO)) {
116 +  /* cyclone and tornado chipsets can recognize 802.1q
117 +   * tagged frames and treat them correctly */
118 +
119 +  int max_pkt_size = dev->mtu+14; /* MTU+Ethernet header */
120 +  if (enable)
121 +   max_pkt_size += 4; /* 802.1Q VLAN tag */
122 +
123 +  EL3WINDOW(3);
124 +  outw(max_pkt_size, ioaddr+Wn3_MaxPktSize);
125 +
126 +  /* set VlanEtherType to let the hardware checksumming
127 +     treat tagged frames correctly */
128 +  EL3WINDOW(7);
129 +  outw(VLAN_ETHER_TYPE, ioaddr+Wn7_VlanEtherType);
130 + } else {
131 +  /* on older cards we have to enable large frames */
132 +
133 +  vp->large_frames = dev->mtu > 1500 || enable;
134 +
135 +  EL3WINDOW(3);
136 +  mac_ctrl = inw(ioaddr+Wn3_MAC_Ctrl);
137 +  if (vp->large_frames)
138 +   mac_ctrl |= 0x40;
139 +  else
140 +   mac_ctrl &= ~0x40;
141 +  outw(mac_ctrl, ioaddr+Wn3_MAC_Ctrl);
142 + }
143 +
144 + EL3WINDOW(old_window);
145 +}
146 +#else
147 +
148 +static void set_8021q_mode(struct net_device *dev, int enable)
149 +{
150 +}
151 +
152 +
153 +#endif
154 +
155  /* MII transceiver control section.
156     Read and write the MII registers using software-generated serial
157     MDIO protocol.  See the MII specifications or DP83840A data sheet
This page took 0.045675 seconds and 3 git commands to generate.