@@ -533,17 +533,23 @@ static int from_fw_port_mod_type(enum fw_port_type port_type,
533
533
static unsigned int speed_to_fw_caps (int speed )
534
534
{
535
535
if (speed == 100 )
536
- return FW_PORT_CAP_SPEED_100M ;
536
+ return FW_PORT_CAP32_SPEED_100M ;
537
537
if (speed == 1000 )
538
- return FW_PORT_CAP_SPEED_1G ;
538
+ return FW_PORT_CAP32_SPEED_1G ;
539
539
if (speed == 10000 )
540
- return FW_PORT_CAP_SPEED_10G ;
540
+ return FW_PORT_CAP32_SPEED_10G ;
541
541
if (speed == 25000 )
542
- return FW_PORT_CAP_SPEED_25G ;
542
+ return FW_PORT_CAP32_SPEED_25G ;
543
543
if (speed == 40000 )
544
- return FW_PORT_CAP_SPEED_40G ;
544
+ return FW_PORT_CAP32_SPEED_40G ;
545
+ if (speed == 50000 )
546
+ return FW_PORT_CAP32_SPEED_50G ;
545
547
if (speed == 100000 )
546
- return FW_PORT_CAP_SPEED_100G ;
548
+ return FW_PORT_CAP32_SPEED_100G ;
549
+ if (speed == 200000 )
550
+ return FW_PORT_CAP32_SPEED_200G ;
551
+ if (speed == 400000 )
552
+ return FW_PORT_CAP32_SPEED_400G ;
547
553
return 0 ;
548
554
}
549
555
@@ -560,12 +566,13 @@ static void fw_caps_to_lmm(enum fw_port_type port_type,
560
566
unsigned int fw_caps ,
561
567
unsigned long * link_mode_mask )
562
568
{
563
- #define SET_LMM (__lmm_name ) __set_bit(ETHTOOL_LINK_MODE_ ## __lmm_name \
564
- ## _BIT, link_mode_mask)
569
+ #define SET_LMM (__lmm_name ) \
570
+ __set_bit(ETHTOOL_LINK_MODE_ ## __lmm_name ## _BIT, \
571
+ link_mode_mask)
565
572
566
573
#define FW_CAPS_TO_LMM (__fw_name , __lmm_name ) \
567
574
do { \
568
- if (fw_caps & FW_PORT_CAP_ ## __fw_name) \
575
+ if (fw_caps & FW_PORT_CAP32_ ## __fw_name) \
569
576
SET_LMM(__lmm_name); \
570
577
} while (0)
571
578
@@ -645,7 +652,10 @@ static void fw_caps_to_lmm(enum fw_port_type port_type,
645
652
case FW_PORT_TYPE_KR4_100G :
646
653
case FW_PORT_TYPE_CR4_QSFP :
647
654
SET_LMM (FIBRE );
648
- SET_LMM (100000b aseCR4_Full );
655
+ FW_CAPS_TO_LMM (SPEED_40G , 40000b aseSR4_Full );
656
+ FW_CAPS_TO_LMM (SPEED_25G , 25000b aseCR_Full );
657
+ FW_CAPS_TO_LMM (SPEED_50G , 50000b aseCR2_Full );
658
+ FW_CAPS_TO_LMM (SPEED_100G , 100000b aseCR4_Full );
649
659
break ;
650
660
651
661
default :
@@ -663,8 +673,7 @@ static void fw_caps_to_lmm(enum fw_port_type port_type,
663
673
/**
664
674
* lmm_to_fw_caps - translate ethtool Link Mode Mask to Firmware
665
675
* capabilities
666
- *
667
- * @link_mode_mask: ethtool Link Mode Mask
676
+ * @et_lmm: ethtool Link Mode Mask
668
677
*
669
678
* Translate ethtool Link Mode Mask into a Firmware Port capabilities
670
679
* value.
@@ -677,14 +686,15 @@ static unsigned int lmm_to_fw_caps(const unsigned long *link_mode_mask)
677
686
do { \
678
687
if (test_bit(ETHTOOL_LINK_MODE_ ## __lmm_name ## _BIT, \
679
688
link_mode_mask)) \
680
- fw_caps |= FW_PORT_CAP_ ## __fw_name; \
689
+ fw_caps |= FW_PORT_CAP32_ ## __fw_name; \
681
690
} while (0)
682
691
683
692
LMM_TO_FW_CAPS (100b aseT_Full , SPEED_100M );
684
693
LMM_TO_FW_CAPS (1000b aseT_Full , SPEED_1G );
685
694
LMM_TO_FW_CAPS (10000b aseT_Full , SPEED_10G );
686
695
LMM_TO_FW_CAPS (40000b aseSR4_Full , SPEED_40G );
687
696
LMM_TO_FW_CAPS (25000b aseCR_Full , SPEED_25G );
697
+ LMM_TO_FW_CAPS (50000b aseCR2_Full , SPEED_50G );
688
698
LMM_TO_FW_CAPS (100000b aseCR4_Full , SPEED_100G );
689
699
690
700
#undef LMM_TO_FW_CAPS
@@ -698,17 +708,17 @@ static int get_link_ksettings(struct net_device *dev,
698
708
struct port_info * pi = netdev_priv (dev );
699
709
struct ethtool_link_settings * base = & link_ksettings -> base ;
700
710
701
- ethtool_link_ksettings_zero_link_mode (link_ksettings , supported );
702
- ethtool_link_ksettings_zero_link_mode (link_ksettings , advertising );
703
- ethtool_link_ksettings_zero_link_mode (link_ksettings , lp_advertising );
704
-
705
711
/* For the nonce, the Firmware doesn't send up Port State changes
706
712
* when the Virtual Interface attached to the Port is down. So
707
713
* if it's down, let's grab any changes.
708
714
*/
709
715
if (!netif_running (dev ))
710
716
(void )t4_update_port_info (pi );
711
717
718
+ ethtool_link_ksettings_zero_link_mode (link_ksettings , supported );
719
+ ethtool_link_ksettings_zero_link_mode (link_ksettings , advertising );
720
+ ethtool_link_ksettings_zero_link_mode (link_ksettings , lp_advertising );
721
+
712
722
base -> port = from_fw_port_mod_type (pi -> port_type , pi -> mod_type );
713
723
714
724
if (pi -> mdio_addr >= 0 ) {
@@ -721,11 +731,11 @@ static int get_link_ksettings(struct net_device *dev,
721
731
base -> mdio_support = 0 ;
722
732
}
723
733
724
- fw_caps_to_lmm (pi -> port_type , pi -> link_cfg .supported ,
734
+ fw_caps_to_lmm (pi -> port_type , pi -> link_cfg .pcaps ,
725
735
link_ksettings -> link_modes .supported );
726
- fw_caps_to_lmm (pi -> port_type , pi -> link_cfg .advertising ,
736
+ fw_caps_to_lmm (pi -> port_type , pi -> link_cfg .acaps ,
727
737
link_ksettings -> link_modes .advertising );
728
- fw_caps_to_lmm (pi -> port_type , pi -> link_cfg .lp_advertising ,
738
+ fw_caps_to_lmm (pi -> port_type , pi -> link_cfg .lpacaps ,
729
739
link_ksettings -> link_modes .lp_advertising );
730
740
731
741
if (netif_carrier_ok (dev )) {
@@ -736,8 +746,24 @@ static int get_link_ksettings(struct net_device *dev,
736
746
base -> duplex = DUPLEX_UNKNOWN ;
737
747
}
738
748
749
+ if (pi -> link_cfg .fc & PAUSE_RX ) {
750
+ if (pi -> link_cfg .fc & PAUSE_TX ) {
751
+ ethtool_link_ksettings_add_link_mode (link_ksettings ,
752
+ advertising ,
753
+ Pause );
754
+ } else {
755
+ ethtool_link_ksettings_add_link_mode (link_ksettings ,
756
+ advertising ,
757
+ Asym_Pause );
758
+ }
759
+ } else if (pi -> link_cfg .fc & PAUSE_TX ) {
760
+ ethtool_link_ksettings_add_link_mode (link_ksettings ,
761
+ advertising ,
762
+ Asym_Pause );
763
+ }
764
+
739
765
base -> autoneg = pi -> link_cfg .autoneg ;
740
- if (pi -> link_cfg .supported & FW_PORT_CAP_ANEG )
766
+ if (pi -> link_cfg .pcaps & FW_PORT_CAP32_ANEG )
741
767
ethtool_link_ksettings_add_link_mode (link_ksettings ,
742
768
supported , Autoneg );
743
769
if (pi -> link_cfg .autoneg )
@@ -748,8 +774,7 @@ static int get_link_ksettings(struct net_device *dev,
748
774
}
749
775
750
776
static int set_link_ksettings (struct net_device * dev ,
751
- const struct ethtool_link_ksettings
752
- * link_ksettings )
777
+ const struct ethtool_link_ksettings * link_ksettings )
753
778
{
754
779
struct port_info * pi = netdev_priv (dev );
755
780
struct link_config * lc = & pi -> link_cfg ;
@@ -762,12 +787,12 @@ static int set_link_ksettings(struct net_device *dev,
762
787
if (base -> duplex != DUPLEX_FULL )
763
788
return - EINVAL ;
764
789
765
- if (!(lc -> supported & FW_PORT_CAP_ANEG )) {
790
+ if (!(lc -> pcaps & FW_PORT_CAP32_ANEG )) {
766
791
/* PHY offers a single speed. See if that's what's
767
792
* being requested.
768
793
*/
769
794
if (base -> autoneg == AUTONEG_DISABLE &&
770
- (lc -> supported & speed_to_fw_caps (base -> speed )))
795
+ (lc -> pcaps & speed_to_fw_caps (base -> speed )))
771
796
return 0 ;
772
797
return - EINVAL ;
773
798
}
@@ -776,18 +801,17 @@ static int set_link_ksettings(struct net_device *dev,
776
801
if (base -> autoneg == AUTONEG_DISABLE ) {
777
802
fw_caps = speed_to_fw_caps (base -> speed );
778
803
779
- if (!(lc -> supported & fw_caps ))
804
+ if (!(lc -> pcaps & fw_caps ))
780
805
return - EINVAL ;
781
- lc -> requested_speed = fw_caps ;
782
- lc -> advertising = 0 ;
806
+ lc -> speed_caps = fw_caps ;
807
+ lc -> acaps = 0 ;
783
808
} else {
784
809
fw_caps =
785
- lmm_to_fw_caps (link_ksettings -> link_modes .advertising );
786
-
787
- if (!(lc -> supported & fw_caps ))
810
+ lmm_to_fw_caps (link_ksettings -> link_modes .advertising );
811
+ if (!(lc -> pcaps & fw_caps ))
788
812
return - EINVAL ;
789
- lc -> requested_speed = 0 ;
790
- lc -> advertising = fw_caps | FW_PORT_CAP_ANEG ;
813
+ lc -> speed_caps = 0 ;
814
+ lc -> acaps = fw_caps | FW_PORT_CAP32_ANEG ;
791
815
}
792
816
lc -> autoneg = base -> autoneg ;
793
817
@@ -806,9 +830,9 @@ static inline unsigned int fwcap_to_eth_fec(unsigned int fw_fec)
806
830
{
807
831
unsigned int eth_fec = 0 ;
808
832
809
- if (fw_fec & FW_PORT_CAP_FEC_RS )
833
+ if (fw_fec & FW_PORT_CAP32_FEC_RS )
810
834
eth_fec |= ETHTOOL_FEC_RS ;
811
- if (fw_fec & FW_PORT_CAP_FEC_BASER_RS )
835
+ if (fw_fec & FW_PORT_CAP32_FEC_BASER_RS )
812
836
eth_fec |= ETHTOOL_FEC_BASER ;
813
837
814
838
/* if nothing is set, then FEC is off */
@@ -864,7 +888,7 @@ static int get_fecparam(struct net_device *dev, struct ethtool_fecparam *fec)
864
888
* always support IEEE 802.3 "automatic" selection of Link FEC type if
865
889
* any FEC is supported.
866
890
*/
867
- fec -> fec = fwcap_to_eth_fec (lc -> supported );
891
+ fec -> fec = fwcap_to_eth_fec (lc -> pcaps );
868
892
if (fec -> fec != ETHTOOL_FEC_OFF )
869
893
fec -> fec |= ETHTOOL_FEC_AUTO ;
870
894
@@ -917,7 +941,7 @@ static int set_pauseparam(struct net_device *dev,
917
941
918
942
if (epause -> autoneg == AUTONEG_DISABLE )
919
943
lc -> requested_fc = 0 ;
920
- else if (lc -> supported & FW_PORT_CAP_ANEG )
944
+ else if (lc -> pcaps & FW_PORT_CAP32_ANEG )
921
945
lc -> requested_fc = PAUSE_AUTONEG ;
922
946
else
923
947
return - EINVAL ;
0 commit comments