diff options
Diffstat (limited to 'drivers/net/bonding/bond_3ad.c')
-rw-r--r-- | drivers/net/bonding/bond_3ad.c | 70 |
1 files changed, 39 insertions, 31 deletions
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); | |||
99 | static u8 __get_duplex(struct port *port); | 100 | static u8 __get_duplex(struct port *port); |
100 | static inline void __initialize_port_locks(struct port *port); | 101 | static inline void __initialize_port_locks(struct port *port); |
101 | //conversions | 102 | //conversions |
102 | static void __ntohs_lacpdu(struct lacpdu *lacpdu); | 103 | static void __htons_lacpdu(struct lacpdu *lacpdu); |
103 | static u16 __ad_timer_to_ticks(u16 timer_type, u16 Par); | 104 | static 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 | */ |
335 | static u16 __get_link_speed(struct port *port) | 337 | static 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 | */ |
422 | static void __ntohs_lacpdu(struct lacpdu *lacpdu) | 428 | static 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; |