aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/networking/bonding.txt59
-rw-r--r--drivers/net/acenic.c4
-rw-r--r--drivers/net/bonding/bond_3ad.c70
-rw-r--r--drivers/net/bonding/bond_main.c228
-rw-r--r--drivers/net/bonding/bond_sysfs.c56
-rw-r--r--drivers/net/bonding/bonding.h34
-rw-r--r--drivers/net/e1000/e1000_hw.h4
-rw-r--r--drivers/net/forcedeth.c8
-rw-r--r--drivers/net/gt64240eth.h402
-rw-r--r--drivers/net/phy/phy_device.c2
-rw-r--r--drivers/net/s2io.c10
-rw-r--r--drivers/net/skge.c357
-rw-r--r--drivers/net/skge.h37
-rw-r--r--drivers/net/smc91x.h18
-rw-r--r--drivers/net/tokenring/lanstreamer.c59
-rw-r--r--drivers/net/tokenring/lanstreamer.h12
-rw-r--r--drivers/net/typhoon.c4
-rw-r--r--include/asm-alpha/libata-portmap.h1
-rw-r--r--include/asm-frv/libata-portmap.h1
-rw-r--r--include/asm-i386/libata-portmap.h1
-rw-r--r--include/asm-ia64/libata-portmap.h1
-rw-r--r--include/asm-powerpc/libata-portmap.h1
-rw-r--r--include/asm-sparc/libata-portmap.h1
-rw-r--r--include/asm-sparc64/libata-portmap.h1
-rw-r--r--include/asm-x86_64/libata-portmap.h1
-rw-r--r--include/linux/if.h2
-rw-r--r--include/linux/libata.h8
-rw-r--r--include/linux/netdevice.h7
28 files changed, 727 insertions, 662 deletions
diff --git a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt
index afac780445cd..dc942eaf490f 100644
--- a/Documentation/networking/bonding.txt
+++ b/Documentation/networking/bonding.txt
@@ -192,6 +192,17 @@ or, for backwards compatibility, the option value. E.g.,
192arp_interval 192arp_interval
193 193
194 Specifies the ARP link monitoring frequency in milliseconds. 194 Specifies the ARP link monitoring frequency in milliseconds.
195
196 The ARP monitor works by periodically checking the slave
197 devices to determine whether they have sent or received
198 traffic recently (the precise criteria depends upon the
199 bonding mode, and the state of the slave). Regular traffic is
200 generated via ARP probes issued for the addresses specified by
201 the arp_ip_target option.
202
203 This behavior can be modified by the arp_validate option,
204 below.
205
195 If ARP monitoring is used in an etherchannel compatible mode 206 If ARP monitoring is used in an etherchannel compatible mode
196 (modes 0 and 2), the switch should be configured in a mode 207 (modes 0 and 2), the switch should be configured in a mode
197 that evenly distributes packets across all links. If the 208 that evenly distributes packets across all links. If the
@@ -213,6 +224,54 @@ arp_ip_target
213 maximum number of targets that can be specified is 16. The 224 maximum number of targets that can be specified is 16. The
214 default value is no IP addresses. 225 default value is no IP addresses.
215 226
227arp_validate
228
229 Specifies whether or not ARP probes and replies should be
230 validated in the active-backup mode. This causes the ARP
231 monitor to examine the incoming ARP requests and replies, and
232 only consider a slave to be up if it is receiving the
233 appropriate ARP traffic.
234
235 Possible values are:
236
237 none or 0
238
239 No validation is performed. This is the default.
240
241 active or 1
242
243 Validation is performed only for the active slave.
244
245 backup or 2
246
247 Validation is performed only for backup slaves.
248
249 all or 3
250
251 Validation is performed for all slaves.
252
253 For the active slave, the validation checks ARP replies to
254 confirm that they were generated by an arp_ip_target. Since
255 backup slaves do not typically receive these replies, the
256 validation performed for backup slaves is on the ARP request
257 sent out via the active slave. It is possible that some
258 switch or network configurations may result in situations
259 wherein the backup slaves do not receive the ARP requests; in
260 such a situation, validation of backup slaves must be
261 disabled.
262
263 This option is useful in network configurations in which
264 multiple bonding hosts are concurrently issuing ARPs to one or
265 more targets beyond a common switch. Should the link between
266 the switch and target fail (but not the switch itself), the
267 probe traffic generated by the multiple bonding instances will
268 fool the standard ARP monitor into considering the links as
269 still up. Use of the arp_validate option can resolve this, as
270 the ARP monitor will only consider ARP requests and replies
271 associated with its own instance of bonding.
272
273 This option was added in bonding version 3.1.0.
274
216downdelay 275downdelay
217 276
218 Specifies the time, in milliseconds, to wait before disabling 277 Specifies the time, in milliseconds, to wait before disabling
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c
index a075246f6f43..71a4f60f7325 100644
--- a/drivers/net/acenic.c
+++ b/drivers/net/acenic.c
@@ -163,11 +163,7 @@ MODULE_DEVICE_TABLE(pci, acenic_pci_tbl);
163#define SET_NETDEV_DEV(net, pdev) do{} while(0) 163#define SET_NETDEV_DEV(net, pdev) do{} while(0)
164#endif 164#endif
165 165
166#if LINUX_VERSION_CODE >= 0x2051c
167#define ace_sync_irq(irq) synchronize_irq(irq) 166#define ace_sync_irq(irq) synchronize_irq(irq)
168#else
169#define ace_sync_irq(irq) synchronize_irq()
170#endif
171 167
172#ifndef offset_in_page 168#ifndef offset_in_page
173#define offset_in_page(ptr) ((unsigned long)(ptr) & ~PAGE_MASK) 169#define offset_in_page(ptr) ((unsigned long)(ptr) & ~PAGE_MASK)
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index 6a407070c2e8..3fb354d9c515 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -85,6 +85,7 @@
85#define AD_LINK_SPEED_BITMASK_10MBPS 0x2 85#define AD_LINK_SPEED_BITMASK_10MBPS 0x2
86#define AD_LINK_SPEED_BITMASK_100MBPS 0x4 86#define AD_LINK_SPEED_BITMASK_100MBPS 0x4
87#define AD_LINK_SPEED_BITMASK_1000MBPS 0x8 87#define AD_LINK_SPEED_BITMASK_1000MBPS 0x8
88#define AD_LINK_SPEED_BITMASK_10000MBPS 0x10
88//endalloun 89//endalloun
89 90
90// compare MAC addresses 91// compare MAC addresses
@@ -99,7 +100,7 @@ static u16 __get_link_speed(struct port *port);
99static u8 __get_duplex(struct port *port); 100static u8 __get_duplex(struct port *port);
100static inline void __initialize_port_locks(struct port *port); 101static inline void __initialize_port_locks(struct port *port);
101//conversions 102//conversions
102static void __ntohs_lacpdu(struct lacpdu *lacpdu); 103static void __htons_lacpdu(struct lacpdu *lacpdu);
103static u16 __ad_timer_to_ticks(u16 timer_type, u16 Par); 104static u16 __ad_timer_to_ticks(u16 timer_type, u16 Par);
104 105
105 106
@@ -330,7 +331,8 @@ static inline void __release_rx_machine_lock(struct port *port)
330 * 0, 331 * 0,
331 * %AD_LINK_SPEED_BITMASK_10MBPS, 332 * %AD_LINK_SPEED_BITMASK_10MBPS,
332 * %AD_LINK_SPEED_BITMASK_100MBPS, 333 * %AD_LINK_SPEED_BITMASK_100MBPS,
333 * %AD_LINK_SPEED_BITMASK_1000MBPS 334 * %AD_LINK_SPEED_BITMASK_1000MBPS,
335 * %AD_LINK_SPEED_BITMASK_10000MBPS
334 */ 336 */
335static u16 __get_link_speed(struct port *port) 337static u16 __get_link_speed(struct port *port)
336{ 338{
@@ -357,6 +359,10 @@ static u16 __get_link_speed(struct port *port)
357 speed = AD_LINK_SPEED_BITMASK_1000MBPS; 359 speed = AD_LINK_SPEED_BITMASK_1000MBPS;
358 break; 360 break;
359 361
362 case SPEED_10000:
363 speed = AD_LINK_SPEED_BITMASK_10000MBPS;
364 break;
365
360 default: 366 default:
361 speed = 0; // unknown speed value from ethtool. shouldn't happen 367 speed = 0; // unknown speed value from ethtool. shouldn't happen
362 break; 368 break;
@@ -414,23 +420,23 @@ static inline void __initialize_port_locks(struct port *port)
414 420
415//conversions 421//conversions
416/** 422/**
417 * __ntohs_lacpdu - convert the contents of a LACPDU to host byte order 423 * __htons_lacpdu - convert the contents of a LACPDU to network byte order
418 * @lacpdu: the speicifed lacpdu 424 * @lacpdu: the speicifed lacpdu
419 * 425 *
420 * For each multi-byte field in the lacpdu, convert its content 426 * For each multi-byte field in the lacpdu, convert its content
421 */ 427 */
422static void __ntohs_lacpdu(struct lacpdu *lacpdu) 428static void __htons_lacpdu(struct lacpdu *lacpdu)
423{ 429{
424 if (lacpdu) { 430 if (lacpdu) {
425 lacpdu->actor_system_priority = ntohs(lacpdu->actor_system_priority); 431 lacpdu->actor_system_priority = htons(lacpdu->actor_system_priority);
426 lacpdu->actor_key = ntohs(lacpdu->actor_key); 432 lacpdu->actor_key = htons(lacpdu->actor_key);
427 lacpdu->actor_port_priority = ntohs(lacpdu->actor_port_priority); 433 lacpdu->actor_port_priority = htons(lacpdu->actor_port_priority);
428 lacpdu->actor_port = ntohs(lacpdu->actor_port); 434 lacpdu->actor_port = htons(lacpdu->actor_port);
429 lacpdu->partner_system_priority = ntohs(lacpdu->partner_system_priority); 435 lacpdu->partner_system_priority = htons(lacpdu->partner_system_priority);
430 lacpdu->partner_key = ntohs(lacpdu->partner_key); 436 lacpdu->partner_key = htons(lacpdu->partner_key);
431 lacpdu->partner_port_priority = ntohs(lacpdu->partner_port_priority); 437 lacpdu->partner_port_priority = htons(lacpdu->partner_port_priority);
432 lacpdu->partner_port = ntohs(lacpdu->partner_port); 438 lacpdu->partner_port = htons(lacpdu->partner_port);
433 lacpdu->collector_max_delay = ntohs(lacpdu->collector_max_delay); 439 lacpdu->collector_max_delay = htons(lacpdu->collector_max_delay);
434 } 440 }
435} 441}
436 442
@@ -490,11 +496,11 @@ static void __record_pdu(struct lacpdu *lacpdu, struct port *port)
490 // validate lacpdu and port 496 // validate lacpdu and port
491 if (lacpdu && port) { 497 if (lacpdu && port) {
492 // record the new parameter values for the partner operational 498 // record the new parameter values for the partner operational
493 port->partner_oper_port_number = lacpdu->actor_port; 499 port->partner_oper_port_number = ntohs(lacpdu->actor_port);
494 port->partner_oper_port_priority = lacpdu->actor_port_priority; 500 port->partner_oper_port_priority = ntohs(lacpdu->actor_port_priority);
495 port->partner_oper_system = lacpdu->actor_system; 501 port->partner_oper_system = lacpdu->actor_system;
496 port->partner_oper_system_priority = lacpdu->actor_system_priority; 502 port->partner_oper_system_priority = ntohs(lacpdu->actor_system_priority);
497 port->partner_oper_key = lacpdu->actor_key; 503 port->partner_oper_key = ntohs(lacpdu->actor_key);
498 // zero partener's lase states 504 // zero partener's lase states
499 port->partner_oper_port_state = 0; 505 port->partner_oper_port_state = 0;
500 port->partner_oper_port_state |= (lacpdu->actor_state & AD_STATE_LACP_ACTIVITY); 506 port->partner_oper_port_state |= (lacpdu->actor_state & AD_STATE_LACP_ACTIVITY);
@@ -561,11 +567,11 @@ static void __update_selected(struct lacpdu *lacpdu, struct port *port)
561 // validate lacpdu and port 567 // validate lacpdu and port
562 if (lacpdu && port) { 568 if (lacpdu && port) {
563 // check if any parameter is different 569 // check if any parameter is different
564 if ((lacpdu->actor_port != port->partner_oper_port_number) || 570 if ((ntohs(lacpdu->actor_port) != port->partner_oper_port_number) ||
565 (lacpdu->actor_port_priority != port->partner_oper_port_priority) || 571 (ntohs(lacpdu->actor_port_priority) != port->partner_oper_port_priority) ||
566 MAC_ADDRESS_COMPARE(&(lacpdu->actor_system), &(port->partner_oper_system)) || 572 MAC_ADDRESS_COMPARE(&(lacpdu->actor_system), &(port->partner_oper_system)) ||
567 (lacpdu->actor_system_priority != port->partner_oper_system_priority) || 573 (ntohs(lacpdu->actor_system_priority) != port->partner_oper_system_priority) ||
568 (lacpdu->actor_key != port->partner_oper_key) || 574 (ntohs(lacpdu->actor_key) != port->partner_oper_key) ||
569 ((lacpdu->actor_state & AD_STATE_AGGREGATION) != (port->partner_oper_port_state & AD_STATE_AGGREGATION)) 575 ((lacpdu->actor_state & AD_STATE_AGGREGATION) != (port->partner_oper_port_state & AD_STATE_AGGREGATION))
570 ) { 576 ) {
571 // update the state machine Selected variable 577 // update the state machine Selected variable
@@ -628,11 +634,11 @@ static void __choose_matched(struct lacpdu *lacpdu, struct port *port)
628 // validate lacpdu and port 634 // validate lacpdu and port
629 if (lacpdu && port) { 635 if (lacpdu && port) {
630 // check if all parameters are alike 636 // check if all parameters are alike
631 if (((lacpdu->partner_port == port->actor_port_number) && 637 if (((ntohs(lacpdu->partner_port) == port->actor_port_number) &&
632 (lacpdu->partner_port_priority == port->actor_port_priority) && 638 (ntohs(lacpdu->partner_port_priority) == port->actor_port_priority) &&
633 !MAC_ADDRESS_COMPARE(&(lacpdu->partner_system), &(port->actor_system)) && 639 !MAC_ADDRESS_COMPARE(&(lacpdu->partner_system), &(port->actor_system)) &&
634 (lacpdu->partner_system_priority == port->actor_system_priority) && 640 (ntohs(lacpdu->partner_system_priority) == port->actor_system_priority) &&
635 (lacpdu->partner_key == port->actor_oper_port_key) && 641 (ntohs(lacpdu->partner_key) == port->actor_oper_port_key) &&
636 ((lacpdu->partner_state & AD_STATE_AGGREGATION) == (port->actor_oper_port_state & AD_STATE_AGGREGATION))) || 642 ((lacpdu->partner_state & AD_STATE_AGGREGATION) == (port->actor_oper_port_state & AD_STATE_AGGREGATION))) ||
637 // or this is individual link(aggregation == FALSE) 643 // or this is individual link(aggregation == FALSE)
638 ((lacpdu->actor_state & AD_STATE_AGGREGATION) == 0) 644 ((lacpdu->actor_state & AD_STATE_AGGREGATION) == 0)
@@ -662,11 +668,11 @@ static void __update_ntt(struct lacpdu *lacpdu, struct port *port)
662 // validate lacpdu and port 668 // validate lacpdu and port
663 if (lacpdu && port) { 669 if (lacpdu && port) {
664 // check if any parameter is different 670 // check if any parameter is different
665 if ((lacpdu->partner_port != port->actor_port_number) || 671 if ((ntohs(lacpdu->partner_port) != port->actor_port_number) ||
666 (lacpdu->partner_port_priority != port->actor_port_priority) || 672 (ntohs(lacpdu->partner_port_priority) != port->actor_port_priority) ||
667 MAC_ADDRESS_COMPARE(&(lacpdu->partner_system), &(port->actor_system)) || 673 MAC_ADDRESS_COMPARE(&(lacpdu->partner_system), &(port->actor_system)) ||
668 (lacpdu->partner_system_priority != port->actor_system_priority) || 674 (ntohs(lacpdu->partner_system_priority) != port->actor_system_priority) ||
669 (lacpdu->partner_key != port->actor_oper_port_key) || 675 (ntohs(lacpdu->partner_key) != port->actor_oper_port_key) ||
670 ((lacpdu->partner_state & AD_STATE_LACP_ACTIVITY) != (port->actor_oper_port_state & AD_STATE_LACP_ACTIVITY)) || 676 ((lacpdu->partner_state & AD_STATE_LACP_ACTIVITY) != (port->actor_oper_port_state & AD_STATE_LACP_ACTIVITY)) ||
671 ((lacpdu->partner_state & AD_STATE_LACP_TIMEOUT) != (port->actor_oper_port_state & AD_STATE_LACP_TIMEOUT)) || 677 ((lacpdu->partner_state & AD_STATE_LACP_TIMEOUT) != (port->actor_oper_port_state & AD_STATE_LACP_TIMEOUT)) ||
672 ((lacpdu->partner_state & AD_STATE_SYNCHRONIZATION) != (port->actor_oper_port_state & AD_STATE_SYNCHRONIZATION)) || 678 ((lacpdu->partner_state & AD_STATE_SYNCHRONIZATION) != (port->actor_oper_port_state & AD_STATE_SYNCHRONIZATION)) ||
@@ -775,6 +781,9 @@ static u32 __get_agg_bandwidth(struct aggregator *aggregator)
775 case AD_LINK_SPEED_BITMASK_1000MBPS: 781 case AD_LINK_SPEED_BITMASK_1000MBPS:
776 bandwidth = aggregator->num_of_ports * 1000; 782 bandwidth = aggregator->num_of_ports * 1000;
777 break; 783 break;
784 case AD_LINK_SPEED_BITMASK_10000MBPS:
785 bandwidth = aggregator->num_of_ports * 10000;
786 break;
778 default: 787 default:
779 bandwidth=0; // to silent the compilor .... 788 bandwidth=0; // to silent the compilor ....
780 } 789 }
@@ -847,7 +856,7 @@ static inline void __update_lacpdu_from_port(struct port *port)
847 */ 856 */
848 857
849 /* Convert all non u8 parameters to Big Endian for transmit */ 858 /* Convert all non u8 parameters to Big Endian for transmit */
850 __ntohs_lacpdu(lacpdu); 859 __htons_lacpdu(lacpdu);
851} 860}
852 861
853////////////////////////////////////////////////////////////////////////////////////// 862//////////////////////////////////////////////////////////////////////////////////////
@@ -2171,7 +2180,6 @@ static void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u
2171 2180
2172 switch (lacpdu->subtype) { 2181 switch (lacpdu->subtype) {
2173 case AD_TYPE_LACPDU: 2182 case AD_TYPE_LACPDU:
2174 __ntohs_lacpdu(lacpdu);
2175 dprintk("Received LACPDU on port %d\n", port->actor_port_number); 2183 dprintk("Received LACPDU on port %d\n", port->actor_port_number);
2176 ad_rx_machine(lacpdu, port); 2184 ad_rx_machine(lacpdu, port);
2177 break; 2185 break;
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 850aae21a2fe..0fb5f653d3ce 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -96,6 +96,7 @@ static char *lacp_rate = NULL;
96static char *xmit_hash_policy = NULL; 96static char *xmit_hash_policy = NULL;
97static int arp_interval = BOND_LINK_ARP_INTERV; 97static int arp_interval = BOND_LINK_ARP_INTERV;
98static char *arp_ip_target[BOND_MAX_ARP_TARGETS] = { NULL, }; 98static char *arp_ip_target[BOND_MAX_ARP_TARGETS] = { NULL, };
99static char *arp_validate = NULL;
99struct bond_params bonding_defaults; 100struct bond_params bonding_defaults;
100 101
101module_param(max_bonds, int, 0); 102module_param(max_bonds, int, 0);
@@ -127,6 +128,8 @@ module_param(arp_interval, int, 0);
127MODULE_PARM_DESC(arp_interval, "arp interval in milliseconds"); 128MODULE_PARM_DESC(arp_interval, "arp interval in milliseconds");
128module_param_array(arp_ip_target, charp, NULL, 0); 129module_param_array(arp_ip_target, charp, NULL, 0);
129MODULE_PARM_DESC(arp_ip_target, "arp targets in n.n.n.n form"); 130MODULE_PARM_DESC(arp_ip_target, "arp targets in n.n.n.n form");
131module_param(arp_validate, charp, 0);
132MODULE_PARM_DESC(arp_validate, "validate src/dst of ARP probes: none (default), active, backup or all");
130 133
131/*----------------------------- Global variables ----------------------------*/ 134/*----------------------------- Global variables ----------------------------*/
132 135
@@ -170,6 +173,14 @@ struct bond_parm_tbl xmit_hashtype_tbl[] = {
170{ NULL, -1}, 173{ NULL, -1},
171}; 174};
172 175
176struct bond_parm_tbl arp_validate_tbl[] = {
177{ "none", BOND_ARP_VALIDATE_NONE},
178{ "active", BOND_ARP_VALIDATE_ACTIVE},
179{ "backup", BOND_ARP_VALIDATE_BACKUP},
180{ "all", BOND_ARP_VALIDATE_ALL},
181{ NULL, -1},
182};
183
173/*-------------------------- Forward declarations ---------------------------*/ 184/*-------------------------- Forward declarations ---------------------------*/
174 185
175static void bond_send_gratuitous_arp(struct bonding *bond); 186static void bond_send_gratuitous_arp(struct bonding *bond);
@@ -638,6 +649,7 @@ verify:
638 case SPEED_10: 649 case SPEED_10:
639 case SPEED_100: 650 case SPEED_100:
640 case SPEED_1000: 651 case SPEED_1000:
652 case SPEED_10000:
641 break; 653 break;
642 default: 654 default:
643 return -1; 655 return -1;
@@ -1210,10 +1222,14 @@ static int bond_compute_features(struct bonding *bond)
1210 unsigned long features = BOND_INTERSECT_FEATURES; 1222 unsigned long features = BOND_INTERSECT_FEATURES;
1211 struct slave *slave; 1223 struct slave *slave;
1212 struct net_device *bond_dev = bond->dev; 1224 struct net_device *bond_dev = bond->dev;
1225 unsigned short max_hard_header_len = ETH_HLEN;
1213 int i; 1226 int i;
1214 1227
1215 bond_for_each_slave(bond, slave, i) 1228 bond_for_each_slave(bond, slave, i) {
1216 features &= (slave->dev->features & BOND_INTERSECT_FEATURES); 1229 features &= (slave->dev->features & BOND_INTERSECT_FEATURES);
1230 if (slave->dev->hard_header_len > max_hard_header_len)
1231 max_hard_header_len = slave->dev->hard_header_len;
1232 }
1217 1233
1218 if ((features & NETIF_F_SG) && 1234 if ((features & NETIF_F_SG) &&
1219 !(features & NETIF_F_ALL_CSUM)) 1235 !(features & NETIF_F_ALL_CSUM))
@@ -1231,6 +1247,7 @@ static int bond_compute_features(struct bonding *bond)
1231 1247
1232 features |= (bond_dev->features & ~BOND_INTERSECT_FEATURES); 1248 features |= (bond_dev->features & ~BOND_INTERSECT_FEATURES);
1233 bond_dev->features = features; 1249 bond_dev->features = features;
1250 bond_dev->hard_header_len = max_hard_header_len;
1234 1251
1235 return 0; 1252 return 0;
1236} 1253}
@@ -1365,6 +1382,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1365 } 1382 }
1366 1383
1367 new_slave->dev = slave_dev; 1384 new_slave->dev = slave_dev;
1385 slave_dev->priv_flags |= IFF_BONDING;
1368 1386
1369 if ((bond->params.mode == BOND_MODE_TLB) || 1387 if ((bond->params.mode == BOND_MODE_TLB) ||
1370 (bond->params.mode == BOND_MODE_ALB)) { 1388 (bond->params.mode == BOND_MODE_ALB)) {
@@ -1417,6 +1435,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1417 1435
1418 bond_compute_features(bond); 1436 bond_compute_features(bond);
1419 1437
1438 new_slave->last_arp_rx = jiffies;
1439
1420 if (bond->params.miimon && !bond->params.use_carrier) { 1440 if (bond->params.miimon && !bond->params.use_carrier) {
1421 link_reporting = bond_check_dev_link(bond, slave_dev, 1); 1441 link_reporting = bond_check_dev_link(bond, slave_dev, 1);
1422 1442
@@ -1493,29 +1513,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1493 1513
1494 switch (bond->params.mode) { 1514 switch (bond->params.mode) {
1495 case BOND_MODE_ACTIVEBACKUP: 1515 case BOND_MODE_ACTIVEBACKUP:
1496 /* if we're in active-backup mode, we need one and 1516 bond_set_slave_inactive_flags(new_slave);
1497 * only one active interface. The backup interfaces 1517 bond_select_active_slave(bond);
1498 * will have their SLAVE_INACTIVE flag set because we
1499 * need them to be drop all packets. Thus, since we
1500 * guarantee that curr_active_slave always point to
1501 * the last usable interface, we just have to verify
1502 * this interface's flag.
1503 */
1504 if (((!bond->curr_active_slave) ||
1505 (bond->curr_active_slave->dev->priv_flags & IFF_SLAVE_INACTIVE)) &&
1506 (new_slave->link != BOND_LINK_DOWN)) {
1507 /* first slave or no active slave yet, and this link
1508 is OK, so make this interface the active one */
1509 bond_change_active_slave(bond, new_slave);
1510 printk(KERN_INFO DRV_NAME
1511 ": %s: first active interface up!\n",
1512 bond->dev->name);
1513 netif_carrier_on(bond->dev);
1514
1515 } else {
1516 dprintk("This is just a backup slave\n");
1517 bond_set_slave_inactive_flags(new_slave);
1518 }
1519 break; 1518 break;
1520 case BOND_MODE_8023AD: 1519 case BOND_MODE_8023AD:
1521 /* in 802.3ad mode, the internal mechanism 1520 /* in 802.3ad mode, the internal mechanism
@@ -1778,7 +1777,8 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
1778 dev_set_mac_address(slave_dev, &addr); 1777 dev_set_mac_address(slave_dev, &addr);
1779 1778
1780 slave_dev->priv_flags &= ~(IFF_MASTER_8023AD | IFF_MASTER_ALB | 1779 slave_dev->priv_flags &= ~(IFF_MASTER_8023AD | IFF_MASTER_ALB |
1781 IFF_SLAVE_INACTIVE); 1780 IFF_SLAVE_INACTIVE | IFF_BONDING |
1781 IFF_SLAVE_NEEDARP);
1782 1782
1783 kfree(slave); 1783 kfree(slave);
1784 1784
@@ -2291,6 +2291,25 @@ static int bond_has_ip(struct bonding *bond)
2291 return 0; 2291 return 0;
2292} 2292}
2293 2293
2294static int bond_has_this_ip(struct bonding *bond, u32 ip)
2295{
2296 struct vlan_entry *vlan, *vlan_next;
2297
2298 if (ip == bond->master_ip)
2299 return 1;
2300
2301 if (list_empty(&bond->vlan_list))
2302 return 0;
2303
2304 list_for_each_entry_safe(vlan, vlan_next, &bond->vlan_list,
2305 vlan_list) {
2306 if (ip == vlan->vlan_ip)
2307 return 1;
2308 }
2309
2310 return 0;
2311}
2312
2294/* 2313/*
2295 * We go to the (large) trouble of VLAN tagging ARP frames because 2314 * We go to the (large) trouble of VLAN tagging ARP frames because
2296 * switches in VLAN mode (especially if ports are configured as 2315 * switches in VLAN mode (especially if ports are configured as
@@ -2429,6 +2448,93 @@ static void bond_send_gratuitous_arp(struct bonding *bond)
2429 } 2448 }
2430} 2449}
2431 2450
2451static void bond_validate_arp(struct bonding *bond, struct slave *slave, u32 sip, u32 tip)
2452{
2453 int i;
2454 u32 *targets = bond->params.arp_targets;
2455
2456 targets = bond->params.arp_targets;
2457 for (i = 0; (i < BOND_MAX_ARP_TARGETS) && targets[i]; i++) {
2458 dprintk("bva: sip %u.%u.%u.%u tip %u.%u.%u.%u t[%d] "
2459 "%u.%u.%u.%u bhti(tip) %d\n",
2460 NIPQUAD(sip), NIPQUAD(tip), i, NIPQUAD(targets[i]),
2461 bond_has_this_ip(bond, tip));
2462 if (sip == targets[i]) {
2463 if (bond_has_this_ip(bond, tip))
2464 slave->last_arp_rx = jiffies;
2465 return;
2466 }
2467 }
2468}
2469
2470static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)
2471{
2472 struct arphdr *arp;
2473 struct slave *slave;
2474 struct bonding *bond;
2475 unsigned char *arp_ptr;
2476 u32 sip, tip;
2477
2478 if (!(dev->priv_flags & IFF_BONDING) || !(dev->flags & IFF_MASTER))
2479 goto out;
2480
2481 bond = dev->priv;
2482 read_lock(&bond->lock);
2483
2484 dprintk("bond_arp_rcv: bond %s skb->dev %s orig_dev %s\n",
2485 bond->dev->name, skb->dev ? skb->dev->name : "NULL",
2486 orig_dev ? orig_dev->name : "NULL");
2487
2488 slave = bond_get_slave_by_dev(bond, orig_dev);
2489 if (!slave || !slave_do_arp_validate(bond, slave))
2490 goto out_unlock;
2491
2492 /* ARP header, plus 2 device addresses, plus 2 IP addresses. */
2493 if (!pskb_may_pull(skb, (sizeof(struct arphdr) +
2494 (2 * dev->addr_len) +
2495 (2 * sizeof(u32)))))
2496 goto out_unlock;
2497
2498 arp = skb->nh.arph;
2499 if (arp->ar_hln != dev->addr_len ||
2500 skb->pkt_type == PACKET_OTHERHOST ||
2501 skb->pkt_type == PACKET_LOOPBACK ||
2502 arp->ar_hrd != htons(ARPHRD_ETHER) ||
2503 arp->ar_pro != htons(ETH_P_IP) ||
2504 arp->ar_pln != 4)
2505 goto out_unlock;
2506
2507 arp_ptr = (unsigned char *)(arp + 1);
2508 arp_ptr += dev->addr_len;
2509 memcpy(&sip, arp_ptr, 4);
2510 arp_ptr += 4 + dev->addr_len;
2511 memcpy(&tip, arp_ptr, 4);
2512
2513 dprintk("bond_arp_rcv: %s %s/%d av %d sv %d sip %u.%u.%u.%u"
2514 " tip %u.%u.%u.%u\n", bond->dev->name, slave->dev->name,
2515 slave->state, bond->params.arp_validate,
2516 slave_do_arp_validate(bond, slave), NIPQUAD(sip), NIPQUAD(tip));
2517
2518 /*
2519 * Backup slaves won't see the ARP reply, but do come through
2520 * here for each ARP probe (so we swap the sip/tip to validate
2521 * the probe). In a "redundant switch, common router" type of
2522 * configuration, the ARP probe will (hopefully) travel from
2523 * the active, through one switch, the router, then the other
2524 * switch before reaching the backup.
2525 */
2526 if (slave->state == BOND_STATE_ACTIVE)
2527 bond_validate_arp(bond, slave, sip, tip);
2528 else
2529 bond_validate_arp(bond, slave, tip, sip);
2530
2531out_unlock:
2532 read_unlock(&bond->lock);
2533out:
2534 dev_kfree_skb(skb);
2535 return NET_RX_SUCCESS;
2536}
2537
2432/* 2538/*
2433 * this function is called regularly to monitor each slave's link 2539 * this function is called regularly to monitor each slave's link
2434 * ensuring that traffic is being sent and received when arp monitoring 2540 * ensuring that traffic is being sent and received when arp monitoring
@@ -2593,7 +2699,8 @@ void bond_activebackup_arp_mon(struct net_device *bond_dev)
2593 */ 2699 */
2594 bond_for_each_slave(bond, slave, i) { 2700 bond_for_each_slave(bond, slave, i) {
2595 if (slave->link != BOND_LINK_UP) { 2701 if (slave->link != BOND_LINK_UP) {
2596 if ((jiffies - slave->dev->last_rx) <= delta_in_ticks) { 2702 if ((jiffies - slave_last_rx(bond, slave)) <=
2703 delta_in_ticks) {
2597 2704
2598 slave->link = BOND_LINK_UP; 2705 slave->link = BOND_LINK_UP;
2599 2706
@@ -2638,7 +2745,7 @@ void bond_activebackup_arp_mon(struct net_device *bond_dev)
2638 2745
2639 if ((slave != bond->curr_active_slave) && 2746 if ((slave != bond->curr_active_slave) &&
2640 (!bond->current_arp_slave) && 2747 (!bond->current_arp_slave) &&
2641 (((jiffies - slave->dev->last_rx) >= 3*delta_in_ticks) && 2748 (((jiffies - slave_last_rx(bond, slave)) >= 3*delta_in_ticks) &&
2642 bond_has_ip(bond))) { 2749 bond_has_ip(bond))) {
2643 /* a backup slave has gone down; three times 2750 /* a backup slave has gone down; three times
2644 * the delta allows the current slave to be 2751 * the delta allows the current slave to be
@@ -2685,7 +2792,7 @@ void bond_activebackup_arp_mon(struct net_device *bond_dev)
2685 * if it is up and needs to take over as the curr_active_slave 2792 * if it is up and needs to take over as the curr_active_slave
2686 */ 2793 */
2687 if ((((jiffies - slave->dev->trans_start) >= (2*delta_in_ticks)) || 2794 if ((((jiffies - slave->dev->trans_start) >= (2*delta_in_ticks)) ||
2688 (((jiffies - slave->dev->last_rx) >= (2*delta_in_ticks)) && 2795 (((jiffies - slave_last_rx(bond, slave)) >= (2*delta_in_ticks)) &&
2689 bond_has_ip(bond))) && 2796 bond_has_ip(bond))) &&
2690 ((jiffies - slave->jiffies) >= 2*delta_in_ticks)) { 2797 ((jiffies - slave->jiffies) >= 2*delta_in_ticks)) {
2691 2798
@@ -2950,7 +3057,7 @@ static void bond_info_show_slave(struct seq_file *seq, const struct slave *slave
2950 seq_printf(seq, "\nSlave Interface: %s\n", slave->dev->name); 3057 seq_printf(seq, "\nSlave Interface: %s\n", slave->dev->name);
2951 seq_printf(seq, "MII Status: %s\n", 3058 seq_printf(seq, "MII Status: %s\n",
2952 (slave->link == BOND_LINK_UP) ? "up" : "down"); 3059 (slave->link == BOND_LINK_UP) ? "up" : "down");
2953 seq_printf(seq, "Link Failure Count: %d\n", 3060 seq_printf(seq, "Link Failure Count: %u\n",
2954 slave->link_failure_count); 3061 slave->link_failure_count);
2955 3062
2956 seq_printf(seq, 3063 seq_printf(seq,
@@ -3210,6 +3317,9 @@ static int bond_netdev_event(struct notifier_block *this, unsigned long event, v
3210 (event_dev ? event_dev->name : "None"), 3317 (event_dev ? event_dev->name : "None"),
3211 event); 3318 event);
3212 3319
3320 if (!(event_dev->priv_flags & IFF_BONDING))
3321 return NOTIFY_DONE;
3322
3213 if (event_dev->flags & IFF_MASTER) { 3323 if (event_dev->flags & IFF_MASTER) {
3214 dprintk("IFF_MASTER\n"); 3324 dprintk("IFF_MASTER\n");
3215 return bond_master_netdev_event(event, event_dev); 3325 return bond_master_netdev_event(event, event_dev);
@@ -3305,6 +3415,21 @@ static void bond_unregister_lacpdu(struct bonding *bond)
3305 dev_remove_pack(&(BOND_AD_INFO(bond).ad_pkt_type)); 3415 dev_remove_pack(&(BOND_AD_INFO(bond).ad_pkt_type));
3306} 3416}
3307 3417
3418void bond_register_arp(struct bonding *bond)
3419{
3420 struct packet_type *pt = &bond->arp_mon_pt;
3421
3422 pt->type = htons(ETH_P_ARP);
3423 pt->dev = NULL; /*bond->dev;XXX*/
3424 pt->func = bond_arp_rcv;
3425 dev_add_pack(pt);
3426}
3427
3428void bond_unregister_arp(struct bonding *bond)
3429{
3430 dev_remove_pack(&bond->arp_mon_pt);
3431}
3432
3308/*---------------------------- Hashing Policies -----------------------------*/ 3433/*---------------------------- Hashing Policies -----------------------------*/
3309 3434
3310/* 3435/*
@@ -3391,6 +3516,9 @@ static int bond_open(struct net_device *bond_dev)
3391 } else { 3516 } else {
3392 arp_timer->function = (void *)&bond_loadbalance_arp_mon; 3517 arp_timer->function = (void *)&bond_loadbalance_arp_mon;
3393 } 3518 }
3519 if (bond->params.arp_validate)
3520 bond_register_arp(bond);
3521
3394 add_timer(arp_timer); 3522 add_timer(arp_timer);
3395 } 3523 }
3396 3524
@@ -3418,9 +3546,11 @@ static int bond_close(struct net_device *bond_dev)
3418 bond_unregister_lacpdu(bond); 3546 bond_unregister_lacpdu(bond);
3419 } 3547 }
3420 3548
3549 if (bond->params.arp_validate)
3550 bond_unregister_arp(bond);
3551
3421 write_lock_bh(&bond->lock); 3552 write_lock_bh(&bond->lock);
3422 3553
3423 bond_mc_list_destroy(bond);
3424 3554
3425 /* signal timers not to re-arm */ 3555 /* signal timers not to re-arm */
3426 bond->kill_timers = 1; 3556 bond->kill_timers = 1;
@@ -3451,8 +3581,6 @@ static int bond_close(struct net_device *bond_dev)
3451 break; 3581 break;
3452 } 3582 }
3453 3583
3454 /* Release the bonded slaves */
3455 bond_release_all(bond_dev);
3456 3584
3457 if ((bond->params.mode == BOND_MODE_TLB) || 3585 if ((bond->params.mode == BOND_MODE_TLB) ||
3458 (bond->params.mode == BOND_MODE_ALB)) { 3586 (bond->params.mode == BOND_MODE_ALB)) {
@@ -4179,6 +4307,7 @@ static int bond_init(struct net_device *bond_dev, struct bond_params *params)
4179 /* Initialize the device options */ 4307 /* Initialize the device options */
4180 bond_dev->tx_queue_len = 0; 4308 bond_dev->tx_queue_len = 0;
4181 bond_dev->flags |= IFF_MASTER|IFF_MULTICAST; 4309 bond_dev->flags |= IFF_MASTER|IFF_MULTICAST;
4310 bond_dev->priv_flags |= IFF_BONDING;
4182 4311
4183 /* At first, we block adding VLANs. That's the only way to 4312 /* At first, we block adding VLANs. That's the only way to
4184 * prevent problems that occur when adding VLANs over an 4313 * prevent problems that occur when adding VLANs over an
@@ -4237,6 +4366,9 @@ static void bond_free_all(void)
4237 list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list) { 4366 list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list) {
4238 struct net_device *bond_dev = bond->dev; 4367 struct net_device *bond_dev = bond->dev;
4239 4368
4369 bond_mc_list_destroy(bond);
4370 /* Release the bonded slaves */
4371 bond_release_all(bond_dev);
4240 unregister_netdevice(bond_dev); 4372 unregister_netdevice(bond_dev);
4241 bond_deinit(bond_dev); 4373 bond_deinit(bond_dev);
4242 } 4374 }
@@ -4270,6 +4402,8 @@ int bond_parse_parm(char *mode_arg, struct bond_parm_tbl *tbl)
4270 4402
4271static int bond_check_params(struct bond_params *params) 4403static int bond_check_params(struct bond_params *params)
4272{ 4404{
4405 int arp_validate_value;
4406
4273 /* 4407 /*
4274 * Convert string parameters. 4408 * Convert string parameters.
4275 */ 4409 */
@@ -4473,6 +4607,29 @@ static int bond_check_params(struct bond_params *params)
4473 arp_interval = 0; 4607 arp_interval = 0;
4474 } 4608 }
4475 4609
4610 if (arp_validate) {
4611 if (bond_mode != BOND_MODE_ACTIVEBACKUP) {
4612 printk(KERN_ERR DRV_NAME
4613 ": arp_validate only supported in active-backup mode\n");
4614 return -EINVAL;
4615 }
4616 if (!arp_interval) {
4617 printk(KERN_ERR DRV_NAME
4618 ": arp_validate requires arp_interval\n");
4619 return -EINVAL;
4620 }
4621
4622 arp_validate_value = bond_parse_parm(arp_validate,
4623 arp_validate_tbl);
4624 if (arp_validate_value == -1) {
4625 printk(KERN_ERR DRV_NAME
4626 ": Error: invalid arp_validate \"%s\"\n",
4627 arp_validate == NULL ? "NULL" : arp_validate);
4628 return -EINVAL;
4629 }
4630 } else
4631 arp_validate_value = 0;
4632
4476 if (miimon) { 4633 if (miimon) {
4477 printk(KERN_INFO DRV_NAME 4634 printk(KERN_INFO DRV_NAME
4478 ": MII link monitoring set to %d ms\n", 4635 ": MII link monitoring set to %d ms\n",
@@ -4481,8 +4638,10 @@ static int bond_check_params(struct bond_params *params)
4481 int i; 4638 int i;
4482 4639
4483 printk(KERN_INFO DRV_NAME 4640 printk(KERN_INFO DRV_NAME
4484 ": ARP monitoring set to %d ms with %d target(s):", 4641 ": ARP monitoring set to %d ms, validate %s, with %d target(s):",
4485 arp_interval, arp_ip_count); 4642 arp_interval,
4643 arp_validate_tbl[arp_validate_value].modename,
4644 arp_ip_count);
4486 4645
4487 for (i = 0; i < arp_ip_count; i++) 4646 for (i = 0; i < arp_ip_count; i++)
4488 printk (" %s", arp_ip_target[i]); 4647 printk (" %s", arp_ip_target[i]);
@@ -4516,6 +4675,7 @@ static int bond_check_params(struct bond_params *params)
4516 params->xmit_policy = xmit_hashtype; 4675 params->xmit_policy = xmit_hashtype;
4517 params->miimon = miimon; 4676 params->miimon = miimon;
4518 params->arp_interval = arp_interval; 4677 params->arp_interval = arp_interval;
4678 params->arp_validate = arp_validate_value;
4519 params->updelay = updelay; 4679 params->updelay = updelay;
4520 params->downdelay = downdelay; 4680 params->downdelay = downdelay;
4521 params->use_carrier = use_carrier; 4681 params->use_carrier = use_carrier;
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index cfe4dc3a93a3..ced9ed8f995a 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -51,6 +51,7 @@ extern struct bond_params bonding_defaults;
51extern struct bond_parm_tbl bond_mode_tbl[]; 51extern struct bond_parm_tbl bond_mode_tbl[];
52extern struct bond_parm_tbl bond_lacp_tbl[]; 52extern struct bond_parm_tbl bond_lacp_tbl[];
53extern struct bond_parm_tbl xmit_hashtype_tbl[]; 53extern struct bond_parm_tbl xmit_hashtype_tbl[];
54extern struct bond_parm_tbl arp_validate_tbl[];
54 55
55static int expected_refcount = -1; 56static int expected_refcount = -1;
56static struct class *netdev_class; 57static struct class *netdev_class;
@@ -503,6 +504,53 @@ out:
503static CLASS_DEVICE_ATTR(xmit_hash_policy, S_IRUGO | S_IWUSR, bonding_show_xmit_hash, bonding_store_xmit_hash); 504static CLASS_DEVICE_ATTR(xmit_hash_policy, S_IRUGO | S_IWUSR, bonding_show_xmit_hash, bonding_store_xmit_hash);
504 505
505/* 506/*
507 * Show and set arp_validate.
508 */
509static ssize_t bonding_show_arp_validate(struct class_device *cd, char *buf)
510{
511 struct bonding *bond = to_bond(cd);
512
513 return sprintf(buf, "%s %d\n",
514 arp_validate_tbl[bond->params.arp_validate].modename,
515 bond->params.arp_validate) + 1;
516}
517
518static ssize_t bonding_store_arp_validate(struct class_device *cd, const char *buf, size_t count)
519{
520 int new_value;
521 struct bonding *bond = to_bond(cd);
522
523 new_value = bond_parse_parm((char *)buf, arp_validate_tbl);
524 if (new_value < 0) {
525 printk(KERN_ERR DRV_NAME
526 ": %s: Ignoring invalid arp_validate value %s\n",
527 bond->dev->name, buf);
528 return -EINVAL;
529 }
530 if (new_value && (bond->params.mode != BOND_MODE_ACTIVEBACKUP)) {
531 printk(KERN_ERR DRV_NAME
532 ": %s: arp_validate only supported in active-backup mode.\n",
533 bond->dev->name);
534 return -EINVAL;
535 }
536 printk(KERN_INFO DRV_NAME ": %s: setting arp_validate to %s (%d).\n",
537 bond->dev->name, arp_validate_tbl[new_value].modename,
538 new_value);
539
540 if (!bond->params.arp_validate && new_value) {
541 bond_register_arp(bond);
542 } else if (bond->params.arp_validate && !new_value) {
543 bond_unregister_arp(bond);
544 }
545
546 bond->params.arp_validate = new_value;
547
548 return count;
549}
550
551static CLASS_DEVICE_ATTR(arp_validate, S_IRUGO | S_IWUSR, bonding_show_arp_validate, bonding_store_arp_validate);
552
553/*
506 * Show and set the arp timer interval. There are two tricky bits 554 * Show and set the arp timer interval. There are two tricky bits
507 * here. First, if ARP monitoring is activated, then we must disable 555 * here. First, if ARP monitoring is activated, then we must disable
508 * MII monitoring. Second, if the ARP timer isn't running, we must 556 * MII monitoring. Second, if the ARP timer isn't running, we must
@@ -914,6 +962,11 @@ static ssize_t bonding_store_miimon(struct class_device *cd, const char *buf, si
914 "ARP monitoring. Disabling ARP monitoring...\n", 962 "ARP monitoring. Disabling ARP monitoring...\n",
915 bond->dev->name); 963 bond->dev->name);
916 bond->params.arp_interval = 0; 964 bond->params.arp_interval = 0;
965 if (bond->params.arp_validate) {
966 bond_unregister_arp(bond);
967 bond->params.arp_validate =
968 BOND_ARP_VALIDATE_NONE;
969 }
917 /* Kill ARP timer, else it brings bond's link down */ 970 /* Kill ARP timer, else it brings bond's link down */
918 if (bond->mii_timer.function) { 971 if (bond->mii_timer.function) {
919 printk(KERN_INFO DRV_NAME 972 printk(KERN_INFO DRV_NAME
@@ -1093,7 +1146,7 @@ static ssize_t bonding_store_active_slave(struct class_device *cd, const char *b
1093 strlen(slave->dev->name)) == 0) { 1146 strlen(slave->dev->name)) == 0) {
1094 old_active = bond->curr_active_slave; 1147 old_active = bond->curr_active_slave;
1095 new_active = slave; 1148 new_active = slave;
1096 if (new_active && (new_active == old_active)) { 1149 if (new_active == old_active) {
1097 /* do nothing */ 1150 /* do nothing */
1098 printk(KERN_INFO DRV_NAME 1151 printk(KERN_INFO DRV_NAME
1099 ": %s: %s is already the current active slave.\n", 1152 ": %s: %s is already the current active slave.\n",
@@ -1273,6 +1326,7 @@ static CLASS_DEVICE_ATTR(ad_partner_mac, S_IRUGO, bonding_show_ad_partner_mac, N
1273static struct attribute *per_bond_attrs[] = { 1326static struct attribute *per_bond_attrs[] = {
1274 &class_device_attr_slaves.attr, 1327 &class_device_attr_slaves.attr,
1275 &class_device_attr_mode.attr, 1328 &class_device_attr_mode.attr,
1329 &class_device_attr_arp_validate.attr,
1276 &class_device_attr_arp_interval.attr, 1330 &class_device_attr_arp_interval.attr,
1277 &class_device_attr_arp_ip_target.attr, 1331 &class_device_attr_arp_ip_target.attr,
1278 &class_device_attr_downdelay.attr, 1332 &class_device_attr_downdelay.attr,
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 0bdfe2c71453..db16fee40a5f 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -22,8 +22,8 @@
22#include "bond_3ad.h" 22#include "bond_3ad.h"
23#include "bond_alb.h" 23#include "bond_alb.h"
24 24
25#define DRV_VERSION "3.0.3" 25#define DRV_VERSION "3.1.0-test"
26#define DRV_RELDATE "March 23, 2006" 26#define DRV_RELDATE "September 9, 2006"
27#define DRV_NAME "bonding" 27#define DRV_NAME "bonding"
28#define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" 28#define DRV_DESCRIPTION "Ethernet Channel Bonding Driver"
29 29
@@ -126,6 +126,7 @@ struct bond_params {
126 int xmit_policy; 126 int xmit_policy;
127 int miimon; 127 int miimon;
128 int arp_interval; 128 int arp_interval;
129 int arp_validate;
129 int use_carrier; 130 int use_carrier;
130 int updelay; 131 int updelay;
131 int downdelay; 132 int downdelay;
@@ -149,8 +150,9 @@ struct slave {
149 struct net_device *dev; /* first - useful for panic debug */ 150 struct net_device *dev; /* first - useful for panic debug */
150 struct slave *next; 151 struct slave *next;
151 struct slave *prev; 152 struct slave *prev;
152 s16 delay; 153 int delay;
153 u32 jiffies; 154 u32 jiffies;
155 u32 last_arp_rx;
154 s8 link; /* one of BOND_LINK_XXXX */ 156 s8 link; /* one of BOND_LINK_XXXX */
155 s8 state; /* one of BOND_STATE_XXXX */ 157 s8 state; /* one of BOND_STATE_XXXX */
156 u32 original_flags; 158 u32 original_flags;
@@ -198,6 +200,7 @@ struct bonding {
198 struct bond_params params; 200 struct bond_params params;
199 struct list_head vlan_list; 201 struct list_head vlan_list;
200 struct vlan_group *vlgrp; 202 struct vlan_group *vlgrp;
203 struct packet_type arp_mon_pt;
201}; 204};
202 205
203/** 206/**
@@ -228,6 +231,25 @@ static inline struct bonding *bond_get_bond_by_slave(struct slave *slave)
228 return (struct bonding *)slave->dev->master->priv; 231 return (struct bonding *)slave->dev->master->priv;
229} 232}
230 233
234#define BOND_ARP_VALIDATE_NONE 0
235#define BOND_ARP_VALIDATE_ACTIVE (1 << BOND_STATE_ACTIVE)
236#define BOND_ARP_VALIDATE_BACKUP (1 << BOND_STATE_BACKUP)
237#define BOND_ARP_VALIDATE_ALL (BOND_ARP_VALIDATE_ACTIVE | \
238 BOND_ARP_VALIDATE_BACKUP)
239
240extern inline int slave_do_arp_validate(struct bonding *bond, struct slave *slave)
241{
242 return bond->params.arp_validate & (1 << slave->state);
243}
244
245extern inline u32 slave_last_rx(struct bonding *bond, struct slave *slave)
246{
247 if (slave_do_arp_validate(bond, slave))
248 return slave->last_arp_rx;
249
250 return slave->dev->last_rx;
251}
252
231static inline void bond_set_slave_inactive_flags(struct slave *slave) 253static inline void bond_set_slave_inactive_flags(struct slave *slave)
232{ 254{
233 struct bonding *bond = slave->dev->master->priv; 255 struct bonding *bond = slave->dev->master->priv;
@@ -235,12 +257,14 @@ static inline void bond_set_slave_inactive_flags(struct slave *slave)
235 bond->params.mode != BOND_MODE_ALB) 257 bond->params.mode != BOND_MODE_ALB)
236 slave->state = BOND_STATE_BACKUP; 258 slave->state = BOND_STATE_BACKUP;
237 slave->dev->priv_flags |= IFF_SLAVE_INACTIVE; 259 slave->dev->priv_flags |= IFF_SLAVE_INACTIVE;
260 if (slave_do_arp_validate(bond, slave))
261 slave->dev->priv_flags |= IFF_SLAVE_NEEDARP;
238} 262}
239 263
240static inline void bond_set_slave_active_flags(struct slave *slave) 264static inline void bond_set_slave_active_flags(struct slave *slave)
241{ 265{
242 slave->state = BOND_STATE_ACTIVE; 266 slave->state = BOND_STATE_ACTIVE;
243 slave->dev->priv_flags &= ~IFF_SLAVE_INACTIVE; 267 slave->dev->priv_flags &= ~(IFF_SLAVE_INACTIVE | IFF_SLAVE_NEEDARP);
244} 268}
245 269
246static inline void bond_set_master_3ad_flags(struct bonding *bond) 270static inline void bond_set_master_3ad_flags(struct bonding *bond)
@@ -284,6 +308,8 @@ int bond_parse_parm(char *mode_arg, struct bond_parm_tbl *tbl);
284const char *bond_mode_name(int mode); 308const char *bond_mode_name(int mode);
285void bond_select_active_slave(struct bonding *bond); 309void bond_select_active_slave(struct bonding *bond);
286void bond_change_active_slave(struct bonding *bond, struct slave *new_active); 310void bond_change_active_slave(struct bonding *bond, struct slave *new_active);
311void bond_register_arp(struct bonding *);
312void bond_unregister_arp(struct bonding *);
287 313
288#endif /* _LINUX_BONDING_H */ 314#endif /* _LINUX_BONDING_H */
289 315
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
index a170e96251f6..4020acb55005 100644
--- a/drivers/net/e1000/e1000_hw.h
+++ b/drivers/net/e1000/e1000_hw.h
@@ -1367,8 +1367,8 @@ struct e1000_hw_stats {
1367 1367
1368/* Structure containing variables used by the shared code (e1000_hw.c) */ 1368/* Structure containing variables used by the shared code (e1000_hw.c) */
1369struct e1000_hw { 1369struct e1000_hw {
1370 uint8_t *hw_addr; 1370 uint8_t __iomem *hw_addr;
1371 uint8_t *flash_address; 1371 uint8_t __iomem *flash_address;
1372 e1000_mac_type mac_type; 1372 e1000_mac_type mac_type;
1373 e1000_phy_type phy_type; 1373 e1000_phy_type phy_type;
1374 uint32_t phy_init_script; 1374 uint32_t phy_init_script;
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 97db910fbc8c..eea1d66c530e 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -3789,6 +3789,12 @@ static int nv_loopback_test(struct net_device *dev)
3789 /* setup packet for tx */ 3789 /* setup packet for tx */
3790 pkt_len = ETH_DATA_LEN; 3790 pkt_len = ETH_DATA_LEN;
3791 tx_skb = dev_alloc_skb(pkt_len); 3791 tx_skb = dev_alloc_skb(pkt_len);
3792 if (!tx_skb) {
3793 printk(KERN_ERR "dev_alloc_skb() failed during loopback test"
3794 " of %s\n", dev->name);
3795 ret = 0;
3796 goto out;
3797 }
3792 pkt_data = skb_put(tx_skb, pkt_len); 3798 pkt_data = skb_put(tx_skb, pkt_len);
3793 for (i = 0; i < pkt_len; i++) 3799 for (i = 0; i < pkt_len; i++)
3794 pkt_data[i] = (u8)(i & 0xff); 3800 pkt_data[i] = (u8)(i & 0xff);
@@ -3853,7 +3859,7 @@ static int nv_loopback_test(struct net_device *dev)
3853 tx_skb->end-tx_skb->data, 3859 tx_skb->end-tx_skb->data,
3854 PCI_DMA_TODEVICE); 3860 PCI_DMA_TODEVICE);
3855 dev_kfree_skb_any(tx_skb); 3861 dev_kfree_skb_any(tx_skb);
3856 3862 out:
3857 /* stop engines */ 3863 /* stop engines */
3858 nv_stop_rx(dev); 3864 nv_stop_rx(dev);
3859 nv_stop_tx(dev); 3865 nv_stop_tx(dev);
diff --git a/drivers/net/gt64240eth.h b/drivers/net/gt64240eth.h
deleted file mode 100644
index 0d6f486e4579..000000000000
--- a/drivers/net/gt64240eth.h
+++ /dev/null
@@ -1,402 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2001 Patton Electronics Company
7 * Copyright (C) 2002 Momentum Computer
8 *
9 * Copyright 2000 MontaVista Software Inc.
10 * Author: MontaVista Software, Inc.
11 * stevel@mvista.com or support@mvista.com
12 *
13 * This program is free software; you can distribute it and/or modify it
14 * under the terms of the GNU General Public License (Version 2) as
15 * published by the Free Software Foundation.
16 *
17 * This program is distributed in the hope it will be useful, but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
25 *
26 * Ethernet driver definitions for the MIPS GT96100 Advanced
27 * Communication Controller.
28 *
29 * Modified for the Marvellous GT64240 Retarded Communication Controller.
30 */
31#ifndef _GT64240ETH_H
32#define _GT64240ETH_H
33
34#include <asm/gt64240.h>
35
36#define ETHERNET_PORTS_DIFFERENCE_OFFSETS 0x400
37
38/* Translate those weanie names from Galileo/VxWorks header files: */
39
40#define GT64240_MRR MAIN_ROUTING_REGISTER
41#define GT64240_CIU_ARBITER_CONFIG COMM_UNIT_ARBITER_CONFIGURATION_REGISTER
42#define GT64240_CIU_ARBITER_CONTROL COMM_UNIT_ARBITER_CONTROL
43#define GT64240_MAIN_LOW_CAUSE LOW_INTERRUPT_CAUSE_REGISTER
44#define GT64240_MAIN_HIGH_CAUSE HIGH_INTERRUPT_CAUSE_REGISTER
45#define GT64240_CPU_LOW_MASK CPU_INTERRUPT_MASK_REGISTER_LOW
46#define GT64240_CPU_HIGH_MASK CPU_INTERRUPT_MASK_REGISTER_HIGH
47#define GT64240_CPU_SELECT_CAUSE CPU_SELECT_CAUSE_REGISTER
48
49#define GT64240_ETH_PHY_ADDR_REG ETHERNET_PHY_ADDRESS_REGISTER
50#define GT64240_ETH_PORT_CONFIG ETHERNET0_PORT_CONFIGURATION_REGISTER
51#define GT64240_ETH_PORT_CONFIG_EXT ETHERNET0_PORT_CONFIGURATION_EXTEND_REGISTER
52#define GT64240_ETH_PORT_COMMAND ETHERNET0_PORT_COMMAND_REGISTER
53#define GT64240_ETH_PORT_STATUS ETHERNET0_PORT_STATUS_REGISTER
54#define GT64240_ETH_IO_SIZE ETHERNET_PORTS_DIFFERENCE_OFFSETS
55#define GT64240_ETH_SMI_REG ETHERNET_SMI_REGISTER
56#define GT64240_ETH_MIB_COUNT_BASE ETHERNET0_MIB_COUNTER_BASE
57#define GT64240_ETH_SDMA_CONFIG ETHERNET0_SDMA_CONFIGURATION_REGISTER
58#define GT64240_ETH_SDMA_COMM ETHERNET0_SDMA_COMMAND_REGISTER
59#define GT64240_ETH_INT_MASK ETHERNET0_INTERRUPT_MASK_REGISTER
60#define GT64240_ETH_INT_CAUSE ETHERNET0_INTERRUPT_CAUSE_REGISTER
61#define GT64240_ETH_CURR_TX_DESC_PTR0 ETHERNET0_CURRENT_TX_DESCRIPTOR_POINTER0
62#define GT64240_ETH_CURR_TX_DESC_PTR1 ETHERNET0_CURRENT_TX_DESCRIPTOR_POINTER1
63#define GT64240_ETH_1ST_RX_DESC_PTR0 ETHERNET0_FIRST_RX_DESCRIPTOR_POINTER0
64#define GT64240_ETH_CURR_RX_DESC_PTR0 ETHERNET0_CURRENT_RX_DESCRIPTOR_POINTER0
65#define GT64240_ETH_HASH_TBL_PTR ETHERNET0_HASH_TABLE_POINTER_REGISTER
66
67/* Turn on NAPI by default */
68
69#define GT64240_NAPI 1
70
71/* Some 64240 settings that SHOULD eventually be setup in PROM monitor: */
72/* (Board-specific to the DSL3224 Rev A board ONLY!) */
73#define D3224_MPP_CTRL0_SETTING 0x66669900
74#define D3224_MPP_CTRL1_SETTING 0x00000000
75#define D3224_MPP_CTRL2_SETTING 0x00887700
76#define D3224_MPP_CTRL3_SETTING 0x00000044
77#define D3224_GPP_IO_CTRL_SETTING 0x0000e800
78#define D3224_GPP_LEVEL_CTRL_SETTING 0xf001f703
79#define D3224_GPP_VALUE_SETTING 0x00000000
80
81/* Keep the ring sizes a power of two for efficiency. */
82//-#define TX_RING_SIZE 16
83#define TX_RING_SIZE 64 /* TESTING !!! */
84#define RX_RING_SIZE 32
85#define PKT_BUF_SZ 1536 /* Size of each temporary Rx buffer. */
86
87#define RX_HASH_TABLE_SIZE 16384
88#define HASH_HOP_NUMBER 12
89
90#define NUM_INTERFACES 3
91
92#define GT64240ETH_TX_TIMEOUT HZ/4
93
94#define MIPS_GT64240_BASE 0xf4000000
95#define GT64240_ETH0_BASE (MIPS_GT64240_BASE + GT64240_ETH_PORT_CONFIG)
96#define GT64240_ETH1_BASE (GT64240_ETH0_BASE + GT64240_ETH_IO_SIZE)
97#define GT64240_ETH2_BASE (GT64240_ETH1_BASE + GT64240_ETH_IO_SIZE)
98
99#if defined(CONFIG_MIPS_DSL3224)
100#define GT64240_ETHER0_IRQ 4
101#define GT64240_ETHER1_IRQ 4
102#else
103#define GT64240_ETHER0_IRQ -1
104#define GT64240_ETHER1_IRQ -1
105#endif
106
107#define REV_GT64240 0x1
108#define REV_GT64240A 0x10
109
110#define GT64240ETH_READ(gp, offset) \
111 GT_READ((gp)->port_offset + (offset))
112
113#define GT64240ETH_WRITE(gp, offset, data) \
114 GT_WRITE((gp)->port_offset + (offset), (data))
115
116#define GT64240ETH_SETBIT(gp, offset, bits) \
117 GT64240ETH_WRITE((gp), (offset), \
118 GT64240ETH_READ((gp), (offset)) | (bits))
119
120#define GT64240ETH_CLRBIT(gp, offset, bits) \
121 GT64240ETH_WRITE((gp), (offset), \
122 GT64240ETH_READ((gp), (offset)) & ~(bits))
123
124#define GT64240_READ(ofs) GT_READ(ofs)
125#define GT64240_WRITE(ofs, data) GT_WRITE((ofs), (data))
126
127/* Bit definitions of the SMI Reg */
128enum {
129 smirDataMask = 0xffff,
130 smirPhyAdMask = 0x1f << 16,
131 smirPhyAdBit = 16,
132 smirRegAdMask = 0x1f << 21,
133 smirRegAdBit = 21,
134 smirOpCode = 1 << 26,
135 smirReadValid = 1 << 27,
136 smirBusy = 1 << 28
137};
138
139/* Bit definitions of the Port Config Reg */
140enum pcr_bits {
141 pcrPM = 1 << 0,
142 pcrRBM = 1 << 1,
143 pcrPBF = 1 << 2,
144 pcrEN = 1 << 7,
145 pcrLPBKMask = 0x3 << 8,
146 pcrLPBKBit = 1 << 8,
147 pcrFC = 1 << 10,
148 pcrHS = 1 << 12,
149 pcrHM = 1 << 13,
150 pcrHDM = 1 << 14,
151 pcrHD = 1 << 15,
152 pcrISLMask = 0x7 << 28,
153 pcrISLBit = 28,
154 pcrACCS = 1 << 31
155};
156
157/* Bit definitions of the Port Config Extend Reg */
158enum pcxr_bits {
159 pcxrIGMP = 1,
160 pcxrSPAN = 2,
161 pcxrPAR = 4,
162 pcxrPRIOtxMask = 0x7 << 3,
163 pcxrPRIOtxBit = 3,
164 pcxrPRIOrxMask = 0x3 << 6,
165 pcxrPRIOrxBit = 6,
166 pcxrPRIOrxOverride = 1 << 8,
167 pcxrDPLXen = 1 << 9,
168 pcxrFCTLen = 1 << 10,
169 pcxrFLP = 1 << 11,
170 pcxrFCTL = 1 << 12,
171 pcxrMFLMask = 0x3 << 14,
172 pcxrMFLBit = 14,
173 pcxrMIBclrMode = 1 << 16,
174 pcxrSpeed = 1 << 18,
175 pcxrSpeeden = 1 << 19,
176 pcxrRMIIen = 1 << 20,
177 pcxrDSCPen = 1 << 21
178};
179
180/* Bit definitions of the Port Command Reg */
181enum pcmr_bits {
182 pcmrFJ = 1 << 15
183};
184
185
186/* Bit definitions of the Port Status Reg */
187enum psr_bits {
188 psrSpeed = 1,
189 psrDuplex = 2,
190 psrFctl = 4,
191 psrLink = 8,
192 psrPause = 1 << 4,
193 psrTxLow = 1 << 5,
194 psrTxHigh = 1 << 6,
195 psrTxInProg = 1 << 7
196};
197
198/* Bit definitions of the SDMA Config Reg */
199enum sdcr_bits {
200 sdcrRCMask = 0xf << 2,
201 sdcrRCBit = 2,
202 sdcrBLMR = 1 << 6,
203 sdcrBLMT = 1 << 7,
204 sdcrPOVR = 1 << 8,
205 sdcrRIFB = 1 << 9,
206 sdcrBSZMask = 0x3 << 12,
207 sdcrBSZBit = 12
208};
209
210/* Bit definitions of the SDMA Command Reg */
211enum sdcmr_bits {
212 sdcmrERD = 1 << 7,
213 sdcmrAR = 1 << 15,
214 sdcmrSTDH = 1 << 16,
215 sdcmrSTDL = 1 << 17,
216 sdcmrTXDH = 1 << 23,
217 sdcmrTXDL = 1 << 24,
218 sdcmrAT = 1 << 31
219};
220
221/* Bit definitions of the Interrupt Cause Reg */
222enum icr_bits {
223 icrRxBuffer = 1,
224 icrTxBufferHigh = 1 << 2,
225 icrTxBufferLow = 1 << 3,
226 icrTxEndHigh = 1 << 6,
227 icrTxEndLow = 1 << 7,
228 icrRxError = 1 << 8,
229 icrTxErrorHigh = 1 << 10,
230 icrTxErrorLow = 1 << 11,
231 icrRxOVR = 1 << 12,
232 icrTxUdr = 1 << 13,
233 icrRxBufferQ0 = 1 << 16,
234 icrRxBufferQ1 = 1 << 17,
235 icrRxBufferQ2 = 1 << 18,
236 icrRxBufferQ3 = 1 << 19,
237 icrRxErrorQ0 = 1 << 20,
238 icrRxErrorQ1 = 1 << 21,
239 icrRxErrorQ2 = 1 << 22,
240 icrRxErrorQ3 = 1 << 23,
241 icrMIIPhySTC = 1 << 28,
242 icrSMIdone = 1 << 29,
243 icrEtherIntSum = 1 << 31
244};
245
246
247/* The Rx and Tx descriptor lists. */
248#ifdef __LITTLE_ENDIAN
249typedef struct {
250 u32 cmdstat;
251 u16 reserved; //-prk21aug01 u32 reserved:16;
252 u16 byte_cnt; //-prk21aug01 u32 byte_cnt:16;
253 u32 buff_ptr;
254 u32 next;
255} gt64240_td_t;
256
257typedef struct {
258 u32 cmdstat;
259 u16 byte_cnt; //-prk21aug01 u32 byte_cnt:16;
260 u16 buff_sz; //-prk21aug01 u32 buff_sz:16;
261 u32 buff_ptr;
262 u32 next;
263} gt64240_rd_t;
264#elif defined(__BIG_ENDIAN)
265typedef struct {
266 u16 byte_cnt; //-prk21aug01 u32 byte_cnt:16;
267 u16 reserved; //-prk21aug01 u32 reserved:16;
268 u32 cmdstat;
269 u32 next;
270 u32 buff_ptr;
271} gt64240_td_t;
272
273typedef struct {
274 u16 buff_sz; //-prk21aug01 u32 buff_sz:16;
275 u16 byte_cnt; //-prk21aug01 u32 byte_cnt:16;
276 u32 cmdstat;
277 u32 next;
278 u32 buff_ptr;
279} gt64240_rd_t;
280#else
281#error Either __BIG_ENDIAN or __LITTLE_ENDIAN must be defined!
282#endif
283
284
285/* Values for the Tx command-status descriptor entry. */
286enum td_cmdstat {
287 txOwn = 1 << 31,
288 txAutoMode = 1 << 30,
289 txEI = 1 << 23,
290 txGenCRC = 1 << 22,
291 txPad = 1 << 18,
292 txFirst = 1 << 17,
293 txLast = 1 << 16,
294 txErrorSummary = 1 << 15,
295 txReTxCntMask = 0x0f << 10,
296 txReTxCntBit = 10,
297 txCollision = 1 << 9,
298 txReTxLimit = 1 << 8,
299 txUnderrun = 1 << 6,
300 txLateCollision = 1 << 5
301};
302
303
304/* Values for the Rx command-status descriptor entry. */
305enum rd_cmdstat {
306 rxOwn = 1 << 31,
307 rxAutoMode = 1 << 30,
308 rxEI = 1 << 23,
309 rxFirst = 1 << 17,
310 rxLast = 1 << 16,
311 rxErrorSummary = 1 << 15,
312 rxIGMP = 1 << 14,
313 rxHashExpired = 1 << 13,
314 rxMissedFrame = 1 << 12,
315 rxFrameType = 1 << 11,
316 rxShortFrame = 1 << 8,
317 rxMaxFrameLen = 1 << 7,
318 rxOverrun = 1 << 6,
319 rxCollision = 1 << 4,
320 rxCRCError = 1
321};
322
323/* Bit fields of a Hash Table Entry */
324enum hash_table_entry {
325 hteValid = 1,
326 hteSkip = 2,
327 hteRD = 4
328};
329
330// The MIB counters
331typedef struct {
332 u32 byteReceived;
333 u32 byteSent;
334 u32 framesReceived;
335 u32 framesSent;
336 u32 totalByteReceived;
337 u32 totalFramesReceived;
338 u32 broadcastFramesReceived;
339 u32 multicastFramesReceived;
340 u32 cRCError;
341 u32 oversizeFrames;
342 u32 fragments;
343 u32 jabber;
344 u32 collision;
345 u32 lateCollision;
346 u32 frames64;
347 u32 frames65_127;
348 u32 frames128_255;
349 u32 frames256_511;
350 u32 frames512_1023;
351 u32 frames1024_MaxSize;
352 u32 macRxError;
353 u32 droppedFrames;
354 u32 outMulticastFrames;
355 u32 outBroadcastFrames;
356 u32 undersizeFrames;
357} mib_counters_t;
358
359
360struct gt64240_private {
361 gt64240_rd_t *rx_ring;
362 gt64240_td_t *tx_ring;
363 // The Rx and Tx rings must be 16-byte aligned
364 dma_addr_t rx_ring_dma;
365 dma_addr_t tx_ring_dma;
366 char *hash_table;
367 // The Hash Table must be 8-byte aligned
368 dma_addr_t hash_table_dma;
369 int hash_mode;
370
371 // The Rx buffers must be 8-byte aligned
372 char *rx_buff;
373 dma_addr_t rx_buff_dma;
374 // Tx buffers (tx_skbuff[i]->data) with less than 8 bytes
375 // of payload must be 8-byte aligned
376 struct sk_buff *tx_skbuff[TX_RING_SIZE];
377 int rx_next_out; /* The next free ring entry to receive */
378 int tx_next_in; /* The next free ring entry to send */
379 int tx_next_out; /* The last ring entry the ISR processed */
380 int tx_count; /* current # of pkts waiting to be sent in Tx ring */
381 int intr_work_done; /* number of Rx and Tx pkts processed in the isr */
382 int tx_full; /* Tx ring is full */
383
384 mib_counters_t mib;
385 struct net_device_stats stats;
386
387 int io_size;
388 int port_num; // 0 or 1
389 u32 port_offset;
390
391 int phy_addr; // PHY address
392 u32 last_psr; // last value of the port status register
393
394 int options; /* User-settable misc. driver options. */
395 int drv_flags;
396 spinlock_t lock; /* Serialise access to device */
397 struct mii_if_info mii_if;
398
399 u32 msg_enable;
400};
401
402#endif /* _GT64240ETH_H */
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 2d1ecfdc80db..ecd3da151e2d 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -522,7 +522,7 @@ EXPORT_SYMBOL(genphy_read_status);
522 522
523static int genphy_config_init(struct phy_device *phydev) 523static int genphy_config_init(struct phy_device *phydev)
524{ 524{
525 u32 val; 525 int val;
526 u32 features; 526 u32 features;
527 527
528 /* For now, I'll claim that the generic driver supports 528 /* For now, I'll claim that the generic driver supports
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index f5dbeb27b6f0..1bf23e41f580 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -2904,7 +2904,7 @@ static void s2io_mdio_write(u32 mmd_type, u64 addr, u16 value, struct net_device
2904{ 2904{
2905 u64 val64 = 0x0; 2905 u64 val64 = 0x0;
2906 nic_t *sp = dev->priv; 2906 nic_t *sp = dev->priv;
2907 XENA_dev_config_t *bar0 = (XENA_dev_config_t *)sp->bar0; 2907 XENA_dev_config_t __iomem *bar0 = sp->bar0;
2908 2908
2909 //address transaction 2909 //address transaction
2910 val64 = val64 | MDIO_MMD_INDX_ADDR(addr) 2910 val64 = val64 | MDIO_MMD_INDX_ADDR(addr)
@@ -2953,7 +2953,7 @@ static u64 s2io_mdio_read(u32 mmd_type, u64 addr, struct net_device *dev)
2953 u64 val64 = 0x0; 2953 u64 val64 = 0x0;
2954 u64 rval64 = 0x0; 2954 u64 rval64 = 0x0;
2955 nic_t *sp = dev->priv; 2955 nic_t *sp = dev->priv;
2956 XENA_dev_config_t *bar0 = (XENA_dev_config_t *)sp->bar0; 2956 XENA_dev_config_t __iomem *bar0 = sp->bar0;
2957 2957
2958 /* address transaction */ 2958 /* address transaction */
2959 val64 = val64 | MDIO_MMD_INDX_ADDR(addr) 2959 val64 = val64 | MDIO_MMD_INDX_ADDR(addr)
@@ -3276,7 +3276,7 @@ static void alarm_intr_handler(struct s2io_nic *nic)
3276 * SUCCESS on success and FAILURE on failure. 3276 * SUCCESS on success and FAILURE on failure.
3277 */ 3277 */
3278 3278
3279static int wait_for_cmd_complete(void *addr, u64 busy_bit) 3279static int wait_for_cmd_complete(void __iomem *addr, u64 busy_bit)
3280{ 3280{
3281 int ret = FAILURE, cnt = 0; 3281 int ret = FAILURE, cnt = 0;
3282 u64 val64; 3282 u64 val64;
@@ -4303,11 +4303,11 @@ static struct net_device_stats *s2io_get_stats(struct net_device *dev)
4303 sp->stats.tx_errors = 4303 sp->stats.tx_errors =
4304 le32_to_cpu(mac_control->stats_info->tmac_any_err_frms); 4304 le32_to_cpu(mac_control->stats_info->tmac_any_err_frms);
4305 sp->stats.rx_errors = 4305 sp->stats.rx_errors =
4306 le32_to_cpu(mac_control->stats_info->rmac_drop_frms); 4306 le64_to_cpu(mac_control->stats_info->rmac_drop_frms);
4307 sp->stats.multicast = 4307 sp->stats.multicast =
4308 le32_to_cpu(mac_control->stats_info->rmac_vld_mcst_frms); 4308 le32_to_cpu(mac_control->stats_info->rmac_vld_mcst_frms);
4309 sp->stats.rx_length_errors = 4309 sp->stats.rx_length_errors =
4310 le32_to_cpu(mac_control->stats_info->rmac_long_frms); 4310 le64_to_cpu(mac_control->stats_info->rmac_long_frms);
4311 4311
4312 return (&sp->stats); 4312 return (&sp->stats);
4313} 4313}
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 9142d91355bc..705e9a8fa30f 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -58,6 +58,7 @@
58#define TX_WATCHDOG (5 * HZ) 58#define TX_WATCHDOG (5 * HZ)
59#define NAPI_WEIGHT 64 59#define NAPI_WEIGHT 64
60#define BLINK_MS 250 60#define BLINK_MS 250
61#define LINK_HZ (HZ/2)
61 62
62MODULE_DESCRIPTION("SysKonnect Gigabit Ethernet driver"); 63MODULE_DESCRIPTION("SysKonnect Gigabit Ethernet driver");
63MODULE_AUTHOR("Stephen Hemminger <shemminger@osdl.org>"); 64MODULE_AUTHOR("Stephen Hemminger <shemminger@osdl.org>");
@@ -605,7 +606,12 @@ static void skge_led(struct skge_port *skge, enum led_mode mode)
605 if (hw->chip_id == CHIP_ID_GENESIS) { 606 if (hw->chip_id == CHIP_ID_GENESIS) {
606 switch (mode) { 607 switch (mode) {
607 case LED_MODE_OFF: 608 case LED_MODE_OFF:
608 xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, PHY_B_PEC_LED_OFF); 609 if (hw->phy_type == SK_PHY_BCOM)
610 xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, PHY_B_PEC_LED_OFF);
611 else {
612 skge_write32(hw, SK_REG(port, TX_LED_VAL), 0);
613 skge_write8(hw, SK_REG(port, TX_LED_CTRL), LED_T_OFF);
614 }
609 skge_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_OFF); 615 skge_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_OFF);
610 skge_write32(hw, SK_REG(port, RX_LED_VAL), 0); 616 skge_write32(hw, SK_REG(port, RX_LED_VAL), 0);
611 skge_write8(hw, SK_REG(port, RX_LED_CTRL), LED_T_OFF); 617 skge_write8(hw, SK_REG(port, RX_LED_CTRL), LED_T_OFF);
@@ -625,8 +631,14 @@ static void skge_led(struct skge_port *skge, enum led_mode mode)
625 skge_write32(hw, SK_REG(port, RX_LED_VAL), 100); 631 skge_write32(hw, SK_REG(port, RX_LED_VAL), 100);
626 skge_write8(hw, SK_REG(port, RX_LED_CTRL), LED_START); 632 skge_write8(hw, SK_REG(port, RX_LED_CTRL), LED_START);
627 633
628 xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, PHY_B_PEC_LED_ON); 634 if (hw->phy_type == SK_PHY_BCOM)
629 break; 635 xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, PHY_B_PEC_LED_ON);
636 else {
637 skge_write8(hw, SK_REG(port, TX_LED_TST), LED_T_ON);
638 skge_write32(hw, SK_REG(port, TX_LED_VAL), 100);
639 skge_write8(hw, SK_REG(port, TX_LED_CTRL), LED_START);
640 }
641
630 } 642 }
631 } else { 643 } else {
632 switch (mode) { 644 switch (mode) {
@@ -879,6 +891,9 @@ static int __xm_phy_read(struct skge_hw *hw, int port, u16 reg, u16 *val)
879 xm_write16(hw, port, XM_PHY_ADDR, reg | hw->phy_addr); 891 xm_write16(hw, port, XM_PHY_ADDR, reg | hw->phy_addr);
880 *val = xm_read16(hw, port, XM_PHY_DATA); 892 *val = xm_read16(hw, port, XM_PHY_DATA);
881 893
894 if (hw->phy_type == SK_PHY_XMAC)
895 goto ready;
896
882 for (i = 0; i < PHY_RETRIES; i++) { 897 for (i = 0; i < PHY_RETRIES; i++) {
883 if (xm_read16(hw, port, XM_MMU_CMD) & XM_MMU_PHY_RDY) 898 if (xm_read16(hw, port, XM_MMU_CMD) & XM_MMU_PHY_RDY)
884 goto ready; 899 goto ready;
@@ -965,7 +980,8 @@ static void genesis_reset(struct skge_hw *hw, int port)
965 xm_write16(hw, port, XM_RX_CMD, 0); /* reset RX CMD Reg */ 980 xm_write16(hw, port, XM_RX_CMD, 0); /* reset RX CMD Reg */
966 981
967 /* disable Broadcom PHY IRQ */ 982 /* disable Broadcom PHY IRQ */
968 xm_write16(hw, port, PHY_BCOM_INT_MASK, 0xffff); 983 if (hw->phy_type == SK_PHY_BCOM)
984 xm_write16(hw, port, PHY_BCOM_INT_MASK, 0xffff);
969 985
970 xm_outhash(hw, port, XM_HSM, zero); 986 xm_outhash(hw, port, XM_HSM, zero);
971} 987}
@@ -1000,60 +1016,64 @@ static void bcom_check_link(struct skge_hw *hw, int port)
1000 1016
1001 if (netif_carrier_ok(dev)) 1017 if (netif_carrier_ok(dev))
1002 skge_link_down(skge); 1018 skge_link_down(skge);
1003 } else { 1019 return;
1004 if (skge->autoneg == AUTONEG_ENABLE && 1020 }
1005 (status & PHY_ST_AN_OVER)) {
1006 u16 lpa = xm_phy_read(hw, port, PHY_BCOM_AUNE_LP);
1007 u16 aux = xm_phy_read(hw, port, PHY_BCOM_AUX_STAT);
1008
1009 if (lpa & PHY_B_AN_RF) {
1010 printk(KERN_NOTICE PFX "%s: remote fault\n",
1011 dev->name);
1012 return;
1013 }
1014 1021
1015 /* Check Duplex mismatch */ 1022 if (skge->autoneg == AUTONEG_ENABLE) {
1016 switch (aux & PHY_B_AS_AN_RES_MSK) { 1023 u16 lpa, aux;
1017 case PHY_B_RES_1000FD:
1018 skge->duplex = DUPLEX_FULL;
1019 break;
1020 case PHY_B_RES_1000HD:
1021 skge->duplex = DUPLEX_HALF;
1022 break;
1023 default:
1024 printk(KERN_NOTICE PFX "%s: duplex mismatch\n",
1025 dev->name);
1026 return;
1027 }
1028 1024
1025 if (!(status & PHY_ST_AN_OVER))
1026 return;
1029 1027
1030 /* We are using IEEE 802.3z/D5.0 Table 37-4 */ 1028 lpa = xm_phy_read(hw, port, PHY_XMAC_AUNE_LP);
1031 switch (aux & PHY_B_AS_PAUSE_MSK) { 1029 if (lpa & PHY_B_AN_RF) {
1032 case PHY_B_AS_PAUSE_MSK: 1030 printk(KERN_NOTICE PFX "%s: remote fault\n",
1033 skge->flow_control = FLOW_MODE_SYMMETRIC; 1031 dev->name);
1034 break; 1032 return;
1035 case PHY_B_AS_PRR: 1033 }
1036 skge->flow_control = FLOW_MODE_REM_SEND;
1037 break;
1038 case PHY_B_AS_PRT:
1039 skge->flow_control = FLOW_MODE_LOC_SEND;
1040 break;
1041 default:
1042 skge->flow_control = FLOW_MODE_NONE;
1043 }
1044 1034
1045 skge->speed = SPEED_1000; 1035 aux = xm_phy_read(hw, port, PHY_BCOM_AUX_STAT);
1036
1037 /* Check Duplex mismatch */
1038 switch (aux & PHY_B_AS_AN_RES_MSK) {
1039 case PHY_B_RES_1000FD:
1040 skge->duplex = DUPLEX_FULL;
1041 break;
1042 case PHY_B_RES_1000HD:
1043 skge->duplex = DUPLEX_HALF;
1044 break;
1045 default:
1046 printk(KERN_NOTICE PFX "%s: duplex mismatch\n",
1047 dev->name);
1048 return;
1046 } 1049 }
1047 1050
1048 if (!netif_carrier_ok(dev)) 1051
1049 genesis_link_up(skge); 1052 /* We are using IEEE 802.3z/D5.0 Table 37-4 */
1053 switch (aux & PHY_B_AS_PAUSE_MSK) {
1054 case PHY_B_AS_PAUSE_MSK:
1055 skge->flow_control = FLOW_MODE_SYMMETRIC;
1056 break;
1057 case PHY_B_AS_PRR:
1058 skge->flow_control = FLOW_MODE_REM_SEND;
1059 break;
1060 case PHY_B_AS_PRT:
1061 skge->flow_control = FLOW_MODE_LOC_SEND;
1062 break;
1063 default:
1064 skge->flow_control = FLOW_MODE_NONE;
1065 }
1066 skge->speed = SPEED_1000;
1050 } 1067 }
1068
1069 if (!netif_carrier_ok(dev))
1070 genesis_link_up(skge);
1051} 1071}
1052 1072
1053/* Broadcom 5400 only supports giagabit! SysKonnect did not put an additional 1073/* Broadcom 5400 only supports giagabit! SysKonnect did not put an additional
1054 * Phy on for 100 or 10Mbit operation 1074 * Phy on for 100 or 10Mbit operation
1055 */ 1075 */
1056static void bcom_phy_init(struct skge_port *skge, int jumbo) 1076static void bcom_phy_init(struct skge_port *skge)
1057{ 1077{
1058 struct skge_hw *hw = skge->hw; 1078 struct skge_hw *hw = skge->hw;
1059 int port = skge->port; 1079 int port = skge->port;
@@ -1144,7 +1164,7 @@ static void bcom_phy_init(struct skge_port *skge, int jumbo)
1144 phy_pause_map[skge->flow_control] | PHY_AN_CSMA); 1164 phy_pause_map[skge->flow_control] | PHY_AN_CSMA);
1145 1165
1146 /* Handle Jumbo frames */ 1166 /* Handle Jumbo frames */
1147 if (jumbo) { 1167 if (hw->dev[port]->mtu > ETH_DATA_LEN) {
1148 xm_phy_write(hw, port, PHY_BCOM_AUX_CTRL, 1168 xm_phy_write(hw, port, PHY_BCOM_AUX_CTRL,
1149 PHY_B_AC_TX_TST | PHY_B_AC_LONG_PACK); 1169 PHY_B_AC_TX_TST | PHY_B_AC_LONG_PACK);
1150 1170
@@ -1157,8 +1177,154 @@ static void bcom_phy_init(struct skge_port *skge, int jumbo)
1157 1177
1158 /* Use link status change interrupt */ 1178 /* Use link status change interrupt */
1159 xm_phy_write(hw, port, PHY_BCOM_INT_MASK, PHY_B_DEF_MSK); 1179 xm_phy_write(hw, port, PHY_BCOM_INT_MASK, PHY_B_DEF_MSK);
1180}
1160 1181
1161 bcom_check_link(hw, port); 1182static void xm_phy_init(struct skge_port *skge)
1183{
1184 struct skge_hw *hw = skge->hw;
1185 int port = skge->port;
1186 u16 ctrl = 0;
1187
1188 if (skge->autoneg == AUTONEG_ENABLE) {
1189 if (skge->advertising & ADVERTISED_1000baseT_Half)
1190 ctrl |= PHY_X_AN_HD;
1191 if (skge->advertising & ADVERTISED_1000baseT_Full)
1192 ctrl |= PHY_X_AN_FD;
1193
1194 switch(skge->flow_control) {
1195 case FLOW_MODE_NONE:
1196 ctrl |= PHY_X_P_NO_PAUSE;
1197 break;
1198 case FLOW_MODE_LOC_SEND:
1199 ctrl |= PHY_X_P_ASYM_MD;
1200 break;
1201 case FLOW_MODE_SYMMETRIC:
1202 ctrl |= PHY_X_P_BOTH_MD;
1203 break;
1204 }
1205
1206 xm_phy_write(hw, port, PHY_XMAC_AUNE_ADV, ctrl);
1207
1208 /* Restart Auto-negotiation */
1209 ctrl = PHY_CT_ANE | PHY_CT_RE_CFG;
1210 } else {
1211 /* Set DuplexMode in Config register */
1212 if (skge->duplex == DUPLEX_FULL)
1213 ctrl |= PHY_CT_DUP_MD;
1214 /*
1215 * Do NOT enable Auto-negotiation here. This would hold
1216 * the link down because no IDLEs are transmitted
1217 */
1218 }
1219
1220 xm_phy_write(hw, port, PHY_XMAC_CTRL, ctrl);
1221
1222 /* Poll PHY for status changes */
1223 schedule_delayed_work(&skge->link_thread, LINK_HZ);
1224}
1225
1226static void xm_check_link(struct net_device *dev)
1227{
1228 struct skge_port *skge = netdev_priv(dev);
1229 struct skge_hw *hw = skge->hw;
1230 int port = skge->port;
1231 u16 status;
1232
1233 /* read twice because of latch */
1234 (void) xm_phy_read(hw, port, PHY_XMAC_STAT);
1235 status = xm_phy_read(hw, port, PHY_XMAC_STAT);
1236
1237 if ((status & PHY_ST_LSYNC) == 0) {
1238 u16 cmd = xm_read16(hw, port, XM_MMU_CMD);
1239 cmd &= ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX);
1240 xm_write16(hw, port, XM_MMU_CMD, cmd);
1241 /* dummy read to ensure writing */
1242 (void) xm_read16(hw, port, XM_MMU_CMD);
1243
1244 if (netif_carrier_ok(dev))
1245 skge_link_down(skge);
1246 return;
1247 }
1248
1249 if (skge->autoneg == AUTONEG_ENABLE) {
1250 u16 lpa, res;
1251
1252 if (!(status & PHY_ST_AN_OVER))
1253 return;
1254
1255 lpa = xm_phy_read(hw, port, PHY_XMAC_AUNE_LP);
1256 if (lpa & PHY_B_AN_RF) {
1257 printk(KERN_NOTICE PFX "%s: remote fault\n",
1258 dev->name);
1259 return;
1260 }
1261
1262 res = xm_phy_read(hw, port, PHY_XMAC_RES_ABI);
1263
1264 /* Check Duplex mismatch */
1265 switch (res & (PHY_X_RS_HD | PHY_X_RS_FD)) {
1266 case PHY_X_RS_FD:
1267 skge->duplex = DUPLEX_FULL;
1268 break;
1269 case PHY_X_RS_HD:
1270 skge->duplex = DUPLEX_HALF;
1271 break;
1272 default:
1273 printk(KERN_NOTICE PFX "%s: duplex mismatch\n",
1274 dev->name);
1275 return;
1276 }
1277
1278 /* We are using IEEE 802.3z/D5.0 Table 37-4 */
1279 if (lpa & PHY_X_P_SYM_MD)
1280 skge->flow_control = FLOW_MODE_SYMMETRIC;
1281 else if ((lpa & PHY_X_RS_PAUSE) == PHY_X_P_ASYM_MD)
1282 skge->flow_control = FLOW_MODE_REM_SEND;
1283 else if ((lpa & PHY_X_RS_PAUSE) == PHY_X_P_BOTH_MD)
1284 skge->flow_control = FLOW_MODE_LOC_SEND;
1285 else
1286 skge->flow_control = FLOW_MODE_NONE;
1287
1288
1289 skge->speed = SPEED_1000;
1290 }
1291
1292 if (!netif_carrier_ok(dev))
1293 genesis_link_up(skge);
1294}
1295
1296/* Poll to check for link coming up.
1297 * Since internal PHY is wired to a level triggered pin, can't
1298 * get an interrupt when carrier is detected.
1299 */
1300static void xm_link_timer(void *arg)
1301{
1302 struct net_device *dev = arg;
1303 struct skge_port *skge = netdev_priv(arg);
1304 struct skge_hw *hw = skge->hw;
1305 int port = skge->port;
1306
1307 if (!netif_running(dev))
1308 return;
1309
1310 if (netif_carrier_ok(dev)) {
1311 xm_read16(hw, port, XM_ISRC);
1312 if (!(xm_read16(hw, port, XM_ISRC) & XM_IS_INP_ASS))
1313 goto nochange;
1314 } else {
1315 if (xm_read32(hw, port, XM_GP_PORT) & XM_GP_INP_ASS)
1316 goto nochange;
1317 xm_read16(hw, port, XM_ISRC);
1318 if (xm_read16(hw, port, XM_ISRC) & XM_IS_INP_ASS)
1319 goto nochange;
1320 }
1321
1322 mutex_lock(&hw->phy_mutex);
1323 xm_check_link(dev);
1324 mutex_unlock(&hw->phy_mutex);
1325
1326nochange:
1327 schedule_delayed_work(&skge->link_thread, LINK_HZ);
1162} 1328}
1163 1329
1164static void genesis_mac_init(struct skge_hw *hw, int port) 1330static void genesis_mac_init(struct skge_hw *hw, int port)
@@ -1189,20 +1355,29 @@ static void genesis_mac_init(struct skge_hw *hw, int port)
1189 * namely for the 1000baseTX cards that use the XMAC's 1355 * namely for the 1000baseTX cards that use the XMAC's
1190 * GMII mode. 1356 * GMII mode.
1191 */ 1357 */
1192 /* Take external Phy out of reset */ 1358 if (hw->phy_type != SK_PHY_XMAC) {
1193 r = skge_read32(hw, B2_GP_IO); 1359 /* Take external Phy out of reset */
1194 if (port == 0) 1360 r = skge_read32(hw, B2_GP_IO);
1195 r |= GP_DIR_0|GP_IO_0; 1361 if (port == 0)
1196 else 1362 r |= GP_DIR_0|GP_IO_0;
1197 r |= GP_DIR_2|GP_IO_2; 1363 else
1364 r |= GP_DIR_2|GP_IO_2;
1198 1365
1199 skge_write32(hw, B2_GP_IO, r); 1366 skge_write32(hw, B2_GP_IO, r);
1200 1367
1368 /* Enable GMII interface */
1369 xm_write16(hw, port, XM_HW_CFG, XM_HW_GMII_MD);
1370 }
1201 1371
1202 /* Enable GMII interface */
1203 xm_write16(hw, port, XM_HW_CFG, XM_HW_GMII_MD);
1204 1372
1205 bcom_phy_init(skge, jumbo); 1373 switch(hw->phy_type) {
1374 case SK_PHY_XMAC:
1375 xm_phy_init(skge);
1376 break;
1377 case SK_PHY_BCOM:
1378 bcom_phy_init(skge);
1379 bcom_check_link(hw, port);
1380 }
1206 1381
1207 /* Set Station Address */ 1382 /* Set Station Address */
1208 xm_outaddr(hw, port, XM_SA, dev->dev_addr); 1383 xm_outaddr(hw, port, XM_SA, dev->dev_addr);
@@ -1335,16 +1510,18 @@ static void genesis_stop(struct skge_port *skge)
1335 skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_SET_MAC_RST); 1510 skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_SET_MAC_RST);
1336 1511
1337 /* For external PHYs there must be special handling */ 1512 /* For external PHYs there must be special handling */
1338 reg = skge_read32(hw, B2_GP_IO); 1513 if (hw->phy_type != SK_PHY_XMAC) {
1339 if (port == 0) { 1514 reg = skge_read32(hw, B2_GP_IO);
1340 reg |= GP_DIR_0; 1515 if (port == 0) {
1341 reg &= ~GP_IO_0; 1516 reg |= GP_DIR_0;
1342 } else { 1517 reg &= ~GP_IO_0;
1343 reg |= GP_DIR_2; 1518 } else {
1344 reg &= ~GP_IO_2; 1519 reg |= GP_DIR_2;
1520 reg &= ~GP_IO_2;
1521 }
1522 skge_write32(hw, B2_GP_IO, reg);
1523 skge_read32(hw, B2_GP_IO);
1345 } 1524 }
1346 skge_write32(hw, B2_GP_IO, reg);
1347 skge_read32(hw, B2_GP_IO);
1348 1525
1349 xm_write16(hw, port, XM_MMU_CMD, 1526 xm_write16(hw, port, XM_MMU_CMD,
1350 xm_read16(hw, port, XM_MMU_CMD) 1527 xm_read16(hw, port, XM_MMU_CMD)
@@ -1406,7 +1583,7 @@ static void genesis_link_up(struct skge_port *skge)
1406 struct skge_hw *hw = skge->hw; 1583 struct skge_hw *hw = skge->hw;
1407 int port = skge->port; 1584 int port = skge->port;
1408 u16 cmd; 1585 u16 cmd;
1409 u32 mode, msk; 1586 u32 mode;
1410 1587
1411 cmd = xm_read16(hw, port, XM_MMU_CMD); 1588 cmd = xm_read16(hw, port, XM_MMU_CMD);
1412 1589
@@ -1454,27 +1631,24 @@ static void genesis_link_up(struct skge_port *skge)
1454 } 1631 }
1455 1632
1456 xm_write32(hw, port, XM_MODE, mode); 1633 xm_write32(hw, port, XM_MODE, mode);
1457 1634 xm_write16(hw, port, XM_IMSK, XM_DEF_MSK);
1458 msk = XM_DEF_MSK;
1459 /* disable GP0 interrupt bit for external Phy */
1460 msk |= XM_IS_INP_ASS;
1461
1462 xm_write16(hw, port, XM_IMSK, msk);
1463 xm_read16(hw, port, XM_ISRC); 1635 xm_read16(hw, port, XM_ISRC);
1464 1636
1465 /* get MMU Command Reg. */ 1637 /* get MMU Command Reg. */
1466 cmd = xm_read16(hw, port, XM_MMU_CMD); 1638 cmd = xm_read16(hw, port, XM_MMU_CMD);
1467 if (skge->duplex == DUPLEX_FULL) 1639 if (hw->phy_type != SK_PHY_XMAC && skge->duplex == DUPLEX_FULL)
1468 cmd |= XM_MMU_GMII_FD; 1640 cmd |= XM_MMU_GMII_FD;
1469 1641
1470 /* 1642 /*
1471 * Workaround BCOM Errata (#10523) for all BCom Phys 1643 * Workaround BCOM Errata (#10523) for all BCom Phys
1472 * Enable Power Management after link up 1644 * Enable Power Management after link up
1473 */ 1645 */
1474 xm_phy_write(hw, port, PHY_BCOM_AUX_CTRL, 1646 if (hw->phy_type == SK_PHY_BCOM) {
1475 xm_phy_read(hw, port, PHY_BCOM_AUX_CTRL) 1647 xm_phy_write(hw, port, PHY_BCOM_AUX_CTRL,
1476 & ~PHY_B_AC_DIS_PM); 1648 xm_phy_read(hw, port, PHY_BCOM_AUX_CTRL)
1477 xm_phy_write(hw, port, PHY_BCOM_INT_MASK, PHY_B_DEF_MSK); 1649 & ~PHY_B_AC_DIS_PM);
1650 xm_phy_write(hw, port, PHY_BCOM_INT_MASK, PHY_B_DEF_MSK);
1651 }
1478 1652
1479 /* enable Rx/Tx */ 1653 /* enable Rx/Tx */
1480 xm_write16(hw, port, XM_MMU_CMD, 1654 xm_write16(hw, port, XM_MMU_CMD,
@@ -2240,6 +2414,8 @@ static int skge_down(struct net_device *dev)
2240 printk(KERN_INFO PFX "%s: disabling interface\n", dev->name); 2414 printk(KERN_INFO PFX "%s: disabling interface\n", dev->name);
2241 2415
2242 netif_stop_queue(dev); 2416 netif_stop_queue(dev);
2417 if (hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC)
2418 cancel_rearming_delayed_work(&skge->link_thread);
2243 2419
2244 skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), LED_OFF); 2420 skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), LED_OFF);
2245 if (hw->chip_id == CHIP_ID_GENESIS) 2421 if (hw->chip_id == CHIP_ID_GENESIS)
@@ -2862,7 +3038,7 @@ static void skge_extirq(void *arg)
2862 if (netif_running(dev)) { 3038 if (netif_running(dev)) {
2863 if (hw->chip_id != CHIP_ID_GENESIS) 3039 if (hw->chip_id != CHIP_ID_GENESIS)
2864 yukon_phy_intr(skge); 3040 yukon_phy_intr(skge);
2865 else 3041 else if (hw->phy_type == SK_PHY_BCOM)
2866 bcom_phy_intr(skge); 3042 bcom_phy_intr(skge);
2867 } 3043 }
2868 } 3044 }
@@ -3014,7 +3190,7 @@ static int skge_reset(struct skge_hw *hw)
3014{ 3190{
3015 u32 reg; 3191 u32 reg;
3016 u16 ctst, pci_status; 3192 u16 ctst, pci_status;
3017 u8 t8, mac_cfg, pmd_type, phy_type; 3193 u8 t8, mac_cfg, pmd_type;
3018 int i; 3194 int i;
3019 3195
3020 ctst = skge_read16(hw, B0_CTST); 3196 ctst = skge_read16(hw, B0_CTST);
@@ -3038,19 +3214,22 @@ static int skge_reset(struct skge_hw *hw)
3038 ctst & (CS_CLK_RUN_HOT|CS_CLK_RUN_RST|CS_CLK_RUN_ENA)); 3214 ctst & (CS_CLK_RUN_HOT|CS_CLK_RUN_RST|CS_CLK_RUN_ENA));
3039 3215
3040 hw->chip_id = skge_read8(hw, B2_CHIP_ID); 3216 hw->chip_id = skge_read8(hw, B2_CHIP_ID);
3041 phy_type = skge_read8(hw, B2_E_1) & 0xf; 3217 hw->phy_type = skge_read8(hw, B2_E_1) & 0xf;
3042 pmd_type = skge_read8(hw, B2_PMD_TYP); 3218 pmd_type = skge_read8(hw, B2_PMD_TYP);
3043 hw->copper = (pmd_type == 'T' || pmd_type == '1'); 3219 hw->copper = (pmd_type == 'T' || pmd_type == '1');
3044 3220
3045 switch (hw->chip_id) { 3221 switch (hw->chip_id) {
3046 case CHIP_ID_GENESIS: 3222 case CHIP_ID_GENESIS:
3047 switch (phy_type) { 3223 switch (hw->phy_type) {
3224 case SK_PHY_XMAC:
3225 hw->phy_addr = PHY_ADDR_XMAC;
3226 break;
3048 case SK_PHY_BCOM: 3227 case SK_PHY_BCOM:
3049 hw->phy_addr = PHY_ADDR_BCOM; 3228 hw->phy_addr = PHY_ADDR_BCOM;
3050 break; 3229 break;
3051 default: 3230 default:
3052 printk(KERN_ERR PFX "%s: unsupported phy type 0x%x\n", 3231 printk(KERN_ERR PFX "%s: unsupported phy type 0x%x\n",
3053 pci_name(hw->pdev), phy_type); 3232 pci_name(hw->pdev), hw->phy_type);
3054 return -EOPNOTSUPP; 3233 return -EOPNOTSUPP;
3055 } 3234 }
3056 break; 3235 break;
@@ -3058,7 +3237,7 @@ static int skge_reset(struct skge_hw *hw)
3058 case CHIP_ID_YUKON: 3237 case CHIP_ID_YUKON:
3059 case CHIP_ID_YUKON_LITE: 3238 case CHIP_ID_YUKON_LITE:
3060 case CHIP_ID_YUKON_LP: 3239 case CHIP_ID_YUKON_LP:
3061 if (phy_type < SK_PHY_MARV_COPPER && pmd_type != 'S') 3240 if (hw->phy_type < SK_PHY_MARV_COPPER && pmd_type != 'S')
3062 hw->copper = 1; 3241 hw->copper = 1;
3063 3242
3064 hw->phy_addr = PHY_ADDR_MARV; 3243 hw->phy_addr = PHY_ADDR_MARV;
@@ -3089,10 +3268,13 @@ static int skge_reset(struct skge_hw *hw)
3089 else 3268 else
3090 hw->ram_size = t8 * 4096; 3269 hw->ram_size = t8 * 4096;
3091 3270
3092 hw->intr_mask = IS_HW_ERR | IS_EXT_REG | IS_PORT_1; 3271 hw->intr_mask = IS_HW_ERR | IS_PORT_1;
3093 if (hw->ports > 1) 3272 if (hw->ports > 1)
3094 hw->intr_mask |= IS_PORT_2; 3273 hw->intr_mask |= IS_PORT_2;
3095 3274
3275 if (!(hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC))
3276 hw->intr_mask |= IS_EXT_REG;
3277
3096 if (hw->chip_id == CHIP_ID_GENESIS) 3278 if (hw->chip_id == CHIP_ID_GENESIS)
3097 genesis_init(hw); 3279 genesis_init(hw);
3098 else { 3280 else {
@@ -3226,6 +3408,9 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port,
3226 3408
3227 skge->port = port; 3409 skge->port = port;
3228 3410
3411 /* Only used for Genesis XMAC */
3412 INIT_WORK(&skge->link_thread, xm_link_timer, dev);
3413
3229 if (hw->chip_id != CHIP_ID_GENESIS) { 3414 if (hw->chip_id != CHIP_ID_GENESIS) {
3230 dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG; 3415 dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
3231 skge->rx_csum = 1; 3416 skge->rx_csum = 1;
diff --git a/drivers/net/skge.h b/drivers/net/skge.h
index 79e09271bcf9..d0b47d46cf9d 100644
--- a/drivers/net/skge.h
+++ b/drivers/net/skge.h
@@ -934,7 +934,7 @@ enum {
934 PHY_XMAC_AUNE_ADV = 0x04,/* 16 bit r/w Auto-Neg. Advertisement */ 934 PHY_XMAC_AUNE_ADV = 0x04,/* 16 bit r/w Auto-Neg. Advertisement */
935 PHY_XMAC_AUNE_LP = 0x05,/* 16 bit r/o Link Partner Abi Reg */ 935 PHY_XMAC_AUNE_LP = 0x05,/* 16 bit r/o Link Partner Abi Reg */
936 PHY_XMAC_AUNE_EXP = 0x06,/* 16 bit r/o Auto-Neg. Expansion Reg */ 936 PHY_XMAC_AUNE_EXP = 0x06,/* 16 bit r/o Auto-Neg. Expansion Reg */
937 PHY_XMAC_NEPG = 0x07,/* 16 bit r/w Next Page Register */ 937 PHY_XMAC_NEPG = 0x07,/* 16 bit r/w Next Page Register */
938 PHY_XMAC_NEPG_LP = 0x08,/* 16 bit r/o Next Page Link Partner */ 938 PHY_XMAC_NEPG_LP = 0x08,/* 16 bit r/o Next Page Link Partner */
939 939
940 PHY_XMAC_EXT_STAT = 0x0f,/* 16 bit r/o Ext Status Register */ 940 PHY_XMAC_EXT_STAT = 0x0f,/* 16 bit r/o Ext Status Register */
@@ -1097,13 +1097,36 @@ enum {
1097 1097
1098/* Pause Bits (PHY_X_AN_PAUSE and PHY_X_RS_PAUSE) encoding */ 1098/* Pause Bits (PHY_X_AN_PAUSE and PHY_X_RS_PAUSE) encoding */
1099enum { 1099enum {
1100 PHY_X_P_NO_PAUSE = 0<<7,/* Bit 8..7: no Pause Mode */ 1100 PHY_X_P_NO_PAUSE= 0<<7,/* Bit 8..7: no Pause Mode */
1101 PHY_X_P_SYM_MD = 1<<7, /* Bit 8..7: symmetric Pause Mode */ 1101 PHY_X_P_SYM_MD = 1<<7, /* Bit 8..7: symmetric Pause Mode */
1102 PHY_X_P_ASYM_MD = 2<<7,/* Bit 8..7: asymmetric Pause Mode */ 1102 PHY_X_P_ASYM_MD = 2<<7,/* Bit 8..7: asymmetric Pause Mode */
1103 PHY_X_P_BOTH_MD = 3<<7,/* Bit 8..7: both Pause Mode */ 1103 PHY_X_P_BOTH_MD = 3<<7,/* Bit 8..7: both Pause Mode */
1104}; 1104};
1105 1105
1106 1106
1107/***** PHY_XMAC_EXT_STAT 16 bit r/w Extended Status Register *****/
1108enum {
1109 PHY_X_EX_FD = 1<<15, /* Bit 15: Device Supports Full Duplex */
1110 PHY_X_EX_HD = 1<<14, /* Bit 14: Device Supports Half Duplex */
1111};
1112
1113/***** PHY_XMAC_RES_ABI 16 bit r/o PHY Resolved Ability *****/
1114enum {
1115 PHY_X_RS_PAUSE = 3<<7, /* Bit 8..7: selected Pause Mode */
1116 PHY_X_RS_HD = 1<<6, /* Bit 6: Half Duplex Mode selected */
1117 PHY_X_RS_FD = 1<<5, /* Bit 5: Full Duplex Mode selected */
1118 PHY_X_RS_ABLMIS = 1<<4, /* Bit 4: duplex or pause cap mismatch */
1119 PHY_X_RS_PAUMIS = 1<<3, /* Bit 3: pause capability mismatch */
1120};
1121
1122/* Remote Fault Bits (PHY_X_AN_RFB) encoding */
1123enum {
1124 X_RFB_OK = 0<<12,/* Bit 13..12 No errors, Link OK */
1125 X_RFB_LF = 1<<12,/* Bit 13..12 Link Failure */
1126 X_RFB_OFF = 2<<12,/* Bit 13..12 Offline */
1127 X_RFB_AN_ERR = 3<<12,/* Bit 13..12 Auto-Negotiation Error */
1128};
1129
1107/* Broadcom-Specific */ 1130/* Broadcom-Specific */
1108/***** PHY_BCOM_1000T_CTRL 16 bit r/w 1000Base-T Control Reg *****/ 1131/***** PHY_BCOM_1000T_CTRL 16 bit r/w 1000Base-T Control Reg *****/
1109enum { 1132enum {
@@ -2158,8 +2181,8 @@ enum {
2158 XM_IS_LNK_AE = 1<<14, /* Bit 14: Link Asynchronous Event */ 2181 XM_IS_LNK_AE = 1<<14, /* Bit 14: Link Asynchronous Event */
2159 XM_IS_TX_ABORT = 1<<13, /* Bit 13: Transmit Abort, late Col. etc */ 2182 XM_IS_TX_ABORT = 1<<13, /* Bit 13: Transmit Abort, late Col. etc */
2160 XM_IS_FRC_INT = 1<<12, /* Bit 12: Force INT bit set in GP */ 2183 XM_IS_FRC_INT = 1<<12, /* Bit 12: Force INT bit set in GP */
2161 XM_IS_INP_ASS = 1<<11, /* Bit 11: Input Asserted, GP bit 0 set */ 2184 XM_IS_INP_ASS = 1<<11, /* Bit 11: Input Asserted, GP bit 0 set */
2162 XM_IS_LIPA_RC = 1<<10, /* Bit 10: Link Partner requests config */ 2185 XM_IS_LIPA_RC = 1<<10, /* Bit 10: Link Partner requests config */
2163 XM_IS_RX_PAGE = 1<<9, /* Bit 9: Page Received */ 2186 XM_IS_RX_PAGE = 1<<9, /* Bit 9: Page Received */
2164 XM_IS_TX_PAGE = 1<<8, /* Bit 8: Next Page Loaded for Transmit */ 2187 XM_IS_TX_PAGE = 1<<8, /* Bit 8: Next Page Loaded for Transmit */
2165 XM_IS_AND = 1<<7, /* Bit 7: Auto-Negotiation Done */ 2188 XM_IS_AND = 1<<7, /* Bit 7: Auto-Negotiation Done */
@@ -2172,9 +2195,7 @@ enum {
2172 XM_IS_RX_COMP = 1<<0, /* Bit 0: Frame Rx Complete */ 2195 XM_IS_RX_COMP = 1<<0, /* Bit 0: Frame Rx Complete */
2173}; 2196};
2174 2197
2175#define XM_DEF_MSK (~(XM_IS_INP_ASS | XM_IS_LIPA_RC | XM_IS_RX_PAGE | \ 2198#define XM_DEF_MSK (~(XM_IS_RXC_OV | XM_IS_TXC_OV | XM_IS_RXF_OV | XM_IS_TXF_UR))
2176 XM_IS_AND | XM_IS_RXC_OV | XM_IS_TXC_OV | \
2177 XM_IS_RXF_OV | XM_IS_TXF_UR))
2178 2199
2179 2200
2180/* XM_HW_CFG 16 bit r/w Hardware Config Register */ 2201/* XM_HW_CFG 16 bit r/w Hardware Config Register */
@@ -2396,6 +2417,7 @@ struct skge_hw {
2396 u8 chip_rev; 2417 u8 chip_rev;
2397 u8 copper; 2418 u8 copper;
2398 u8 ports; 2419 u8 ports;
2420 u8 phy_type;
2399 2421
2400 u32 ram_size; 2422 u32 ram_size;
2401 u32 ram_offset; 2423 u32 ram_offset;
@@ -2422,6 +2444,7 @@ struct skge_port {
2422 2444
2423 struct net_device_stats net_stats; 2445 struct net_device_stats net_stats;
2424 2446
2447 struct work_struct link_thread;
2425 u8 rx_csum; 2448 u8 rx_csum;
2426 u8 blink_on; 2449 u8 blink_on;
2427 u8 flow_control; 2450 u8 flow_control;
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h
index 7aa7fbac8224..c660e33f43a2 100644
--- a/drivers/net/smc91x.h
+++ b/drivers/net/smc91x.h
@@ -379,6 +379,24 @@ static inline void LPD7_SMC_outsw (unsigned char* a, int r,
379 379
380#define SMC_IRQ_FLAGS (0) 380#define SMC_IRQ_FLAGS (0)
381 381
382#elif defined(CONFIG_ARCH_VERSATILE)
383
384#define SMC_CAN_USE_8BIT 1
385#define SMC_CAN_USE_16BIT 1
386#define SMC_CAN_USE_32BIT 1
387#define SMC_NOWAIT 1
388
389#define SMC_inb(a, r) readb((a) + (r))
390#define SMC_inw(a, r) readw((a) + (r))
391#define SMC_inl(a, r) readl((a) + (r))
392#define SMC_outb(v, a, r) writeb(v, (a) + (r))
393#define SMC_outw(v, a, r) writew(v, (a) + (r))
394#define SMC_outl(v, a, r) writel(v, (a) + (r))
395#define SMC_insl(a, r, p, l) readsl((a) + (r), p, l)
396#define SMC_outsl(a, r, p, l) writesl((a) + (r), p, l)
397
398#define SMC_IRQ_FLAGS (0)
399
382#else 400#else
383 401
384#define SMC_CAN_USE_8BIT 1 402#define SMC_CAN_USE_8BIT 1
diff --git a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c
index 0d66700c6ced..bfc8c3eae9a1 100644
--- a/drivers/net/tokenring/lanstreamer.c
+++ b/drivers/net/tokenring/lanstreamer.c
@@ -1876,7 +1876,6 @@ static int sprintf_info(char *buffer, struct net_device *dev)
1876 datap[size+1]=io_word & 0xff; 1876 datap[size+1]=io_word & 0xff;
1877 } 1877 }
1878 1878
1879
1880 size = sprintf(buffer, "\n%6s: Adapter Address : Node Address : Functional Addr\n", dev->name); 1879 size = sprintf(buffer, "\n%6s: Adapter Address : Node Address : Functional Addr\n", dev->name);
1881 1880
1882 size += sprintf(buffer + size, 1881 size += sprintf(buffer + size,
@@ -1932,64 +1931,6 @@ static int sprintf_info(char *buffer, struct net_device *dev)
1932#endif 1931#endif
1933#endif 1932#endif
1934 1933
1935#if STREAMER_IOCTL && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
1936static int streamer_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1937{
1938 int i;
1939 struct streamer_private *streamer_priv = (struct streamer_private *) dev->priv;
1940 u8 __iomem *streamer_mmio = streamer_priv->streamer_mmio;
1941
1942 switch(cmd) {
1943 case IOCTL_SISR_MASK:
1944 writew(SISR_MI, streamer_mmio + SISR_MASK_SUM);
1945 break;
1946 case IOCTL_SPIN_LOCK_TEST:
1947 printk(KERN_INFO "spin_lock() called.\n");
1948 spin_lock(&streamer_priv->streamer_lock);
1949 spin_unlock(&streamer_priv->streamer_lock);
1950 printk(KERN_INFO "spin_unlock() finished.\n");
1951 break;
1952 case IOCTL_PRINT_BDAS:
1953 printk(KERN_INFO "bdas: RXBDA: %x RXLBDA: %x TX2FDA: %x TX2LFDA: %x\n",
1954 readw(streamer_mmio + RXBDA),
1955 readw(streamer_mmio + RXLBDA),
1956 readw(streamer_mmio + TX2FDA),
1957 readw(streamer_mmio + TX2LFDA));
1958 break;
1959 case IOCTL_PRINT_REGISTERS:
1960 printk(KERN_INFO "registers:\n");
1961 printk(KERN_INFO "SISR: %04x MISR: %04x LISR: %04x BCTL: %04x BMCTL: %04x\nmask %04x mask %04x\n",
1962 readw(streamer_mmio + SISR),
1963 readw(streamer_mmio + MISR_RUM),
1964 readw(streamer_mmio + LISR),
1965 readw(streamer_mmio + BCTL),
1966 readw(streamer_mmio + BMCTL_SUM),
1967 readw(streamer_mmio + SISR_MASK),
1968 readw(streamer_mmio + MISR_MASK));
1969 break;
1970 case IOCTL_PRINT_RX_BUFS:
1971 printk(KERN_INFO "Print rx bufs:\n");
1972 for(i=0; i<STREAMER_RX_RING_SIZE; i++)
1973 printk(KERN_INFO "rx_ring %d status: 0x%x\n", i,
1974 streamer_priv->streamer_rx_ring[i].status);
1975 break;
1976 case IOCTL_PRINT_TX_BUFS:
1977 printk(KERN_INFO "Print tx bufs:\n");
1978 for(i=0; i<STREAMER_TX_RING_SIZE; i++)
1979 printk(KERN_INFO "tx_ring %d status: 0x%x\n", i,
1980 streamer_priv->streamer_tx_ring[i].status);
1981 break;
1982 case IOCTL_RX_CMD:
1983 streamer_rx(dev);
1984 printk(KERN_INFO "Sent rx command.\n");
1985 break;
1986 default:
1987 printk(KERN_INFO "Bad ioctl!\n");
1988 }
1989 return 0;
1990}
1991#endif
1992
1993static struct pci_driver streamer_pci_driver = { 1934static struct pci_driver streamer_pci_driver = {
1994 .name = "lanstreamer", 1935 .name = "lanstreamer",
1995 .id_table = streamer_pci_tbl, 1936 .id_table = streamer_pci_tbl,
diff --git a/drivers/net/tokenring/lanstreamer.h b/drivers/net/tokenring/lanstreamer.h
index 5557d8e1e22d..e7bb3494afc7 100644
--- a/drivers/net/tokenring/lanstreamer.h
+++ b/drivers/net/tokenring/lanstreamer.h
@@ -62,18 +62,6 @@
62 62
63#include <linux/version.h> 63#include <linux/version.h>
64 64
65#if STREAMER_IOCTL && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
66#include <asm/ioctl.h>
67#define IOCTL_PRINT_RX_BUFS SIOCDEVPRIVATE
68#define IOCTL_PRINT_TX_BUFS SIOCDEVPRIVATE+1
69#define IOCTL_RX_CMD SIOCDEVPRIVATE+2
70#define IOCTL_TX_CMD SIOCDEVPRIVATE+3
71#define IOCTL_PRINT_REGISTERS SIOCDEVPRIVATE+4
72#define IOCTL_PRINT_BDAS SIOCDEVPRIVATE+5
73#define IOCTL_SPIN_LOCK_TEST SIOCDEVPRIVATE+6
74#define IOCTL_SISR_MASK SIOCDEVPRIVATE+7
75#endif
76
77/* MAX_INTR - the maximum number of times we can loop 65/* MAX_INTR - the maximum number of times we can loop
78 * inside the interrupt function before returning 66 * inside the interrupt function before returning
79 * control to the OS (maximum value is 256) 67 * control to the OS (maximum value is 256)
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
index 8f6f6fd8b87d..d5c32e9caa97 100644
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@ -333,11 +333,7 @@ enum state_values {
333#define TYPHOON_RESET_TIMEOUT_NOSLEEP ((6 * 1000000) / TYPHOON_UDELAY) 333#define TYPHOON_RESET_TIMEOUT_NOSLEEP ((6 * 1000000) / TYPHOON_UDELAY)
334#define TYPHOON_WAIT_TIMEOUT ((1000000 / 2) / TYPHOON_UDELAY) 334#define TYPHOON_WAIT_TIMEOUT ((1000000 / 2) / TYPHOON_UDELAY)
335 335
336#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 28)
337#define typhoon_synchronize_irq(x) synchronize_irq()
338#else
339#define typhoon_synchronize_irq(x) synchronize_irq(x) 336#define typhoon_synchronize_irq(x) synchronize_irq(x)
340#endif
341 337
342#if defined(NETIF_F_TSO) 338#if defined(NETIF_F_TSO)
343#define skb_tso_size(x) (skb_shinfo(x)->gso_size) 339#define skb_tso_size(x) (skb_shinfo(x)->gso_size)
diff --git a/include/asm-alpha/libata-portmap.h b/include/asm-alpha/libata-portmap.h
deleted file mode 100644
index 75484ef0c743..000000000000
--- a/include/asm-alpha/libata-portmap.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/libata-portmap.h>
diff --git a/include/asm-frv/libata-portmap.h b/include/asm-frv/libata-portmap.h
deleted file mode 100644
index 75484ef0c743..000000000000
--- a/include/asm-frv/libata-portmap.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/libata-portmap.h>
diff --git a/include/asm-i386/libata-portmap.h b/include/asm-i386/libata-portmap.h
deleted file mode 100644
index 75484ef0c743..000000000000
--- a/include/asm-i386/libata-portmap.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/libata-portmap.h>
diff --git a/include/asm-ia64/libata-portmap.h b/include/asm-ia64/libata-portmap.h
deleted file mode 100644
index 75484ef0c743..000000000000
--- a/include/asm-ia64/libata-portmap.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/libata-portmap.h>
diff --git a/include/asm-powerpc/libata-portmap.h b/include/asm-powerpc/libata-portmap.h
deleted file mode 100644
index 75484ef0c743..000000000000
--- a/include/asm-powerpc/libata-portmap.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/libata-portmap.h>
diff --git a/include/asm-sparc/libata-portmap.h b/include/asm-sparc/libata-portmap.h
deleted file mode 100644
index 75484ef0c743..000000000000
--- a/include/asm-sparc/libata-portmap.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/libata-portmap.h>
diff --git a/include/asm-sparc64/libata-portmap.h b/include/asm-sparc64/libata-portmap.h
deleted file mode 100644
index 75484ef0c743..000000000000
--- a/include/asm-sparc64/libata-portmap.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/libata-portmap.h>
diff --git a/include/asm-x86_64/libata-portmap.h b/include/asm-x86_64/libata-portmap.h
deleted file mode 100644
index 75484ef0c743..000000000000
--- a/include/asm-x86_64/libata-portmap.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/libata-portmap.h>
diff --git a/include/linux/if.h b/include/linux/if.h
index cd080d765324..8018c2e22c0c 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -59,6 +59,8 @@
59#define IFF_SLAVE_INACTIVE 0x4 /* bonding slave not the curr. active */ 59#define IFF_SLAVE_INACTIVE 0x4 /* bonding slave not the curr. active */
60#define IFF_MASTER_8023AD 0x8 /* bonding master, 802.3ad. */ 60#define IFF_MASTER_8023AD 0x8 /* bonding master, 802.3ad. */
61#define IFF_MASTER_ALB 0x10 /* bonding master, balance-alb. */ 61#define IFF_MASTER_ALB 0x10 /* bonding master, balance-alb. */
62#define IFF_BONDING 0x20 /* bonding master or slave */
63#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
62 64
63#define IF_GET_IFACE 0x0001 /* for querying only */ 65#define IF_GET_IFACE 0x0001 /* for querying only */
64#define IF_GET_PROTO 0x0002 66#define IF_GET_PROTO 0x0002
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 1ef3d3901b47..d6a3d4b345fc 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -36,7 +36,15 @@
36#include <linux/workqueue.h> 36#include <linux/workqueue.h>
37#include <scsi/scsi_host.h> 37#include <scsi/scsi_host.h>
38 38
39/*
40 * Define if arch has non-standard setup. This is a _PCI_ standard
41 * not a legacy or ISA standard.
42 */
43#ifdef CONFIG_ATA_NONSTANDARD
39#include <asm/libata-portmap.h> 44#include <asm/libata-portmap.h>
45#else
46#include <asm-generic/libata-portmap.h>
47#endif
40 48
41/* 49/*
42 * compile-time options: to be removed as soon as all the drivers are 50 * compile-time options: to be removed as soon as all the drivers are
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ac4f50213bc3..13d6d4eb8b3a 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1015,7 +1015,8 @@ static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
1015} 1015}
1016 1016
1017/* On bonding slaves other than the currently active slave, suppress 1017/* On bonding slaves other than the currently active slave, suppress
1018 * duplicates except for 802.3ad ETH_P_SLOW and alb non-mcast/bcast. 1018 * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and
1019 * ARP on active-backup slaves with arp_validate enabled.
1019 */ 1020 */
1020static inline int skb_bond_should_drop(struct sk_buff *skb) 1021static inline int skb_bond_should_drop(struct sk_buff *skb)
1021{ 1022{
@@ -1024,6 +1025,10 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
1024 1025
1025 if (master && 1026 if (master &&
1026 (dev->priv_flags & IFF_SLAVE_INACTIVE)) { 1027 (dev->priv_flags & IFF_SLAVE_INACTIVE)) {
1028 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
1029 skb->protocol == __constant_htons(ETH_P_ARP))
1030 return 0;
1031
1027 if (master->priv_flags & IFF_MASTER_ALB) { 1032 if (master->priv_flags & IFF_MASTER_ALB) {
1028 if (skb->pkt_type != PACKET_BROADCAST && 1033 if (skb->pkt_type != PACKET_BROADCAST &&
1029 skb->pkt_type != PACKET_MULTICAST) 1034 skb->pkt_type != PACKET_MULTICAST)