@@ -723,24 +723,81 @@ static void ptys2ethtool_adver_link(unsigned long *advertising_modes,
723
723
__ETHTOOL_LINK_MODE_MASK_NBITS );
724
724
}
725
725
726
- static void ptys2ethtool_supported_port (struct ethtool_link_ksettings * link_ksettings ,
727
- u32 eth_proto_cap )
726
+ static void ptys2ethtool_supported_advertised_port (struct ethtool_link_ksettings * link_ksettings ,
727
+ u32 eth_proto_cap ,
728
+ u8 connector_type )
728
729
{
729
- if (eth_proto_cap & (MLX5E_PROT_MASK (MLX5E_10GBASE_CR )
730
- | MLX5E_PROT_MASK (MLX5E_10GBASE_SR )
731
- | MLX5E_PROT_MASK (MLX5E_40GBASE_CR4 )
732
- | MLX5E_PROT_MASK (MLX5E_40GBASE_SR4 )
733
- | MLX5E_PROT_MASK (MLX5E_100GBASE_SR4 )
734
- | MLX5E_PROT_MASK (MLX5E_1000BASE_CX_SGMII ))) {
735
- ethtool_link_ksettings_add_link_mode (link_ksettings , supported , FIBRE );
730
+ if (!connector_type || connector_type >= MLX5E_CONNECTOR_TYPE_NUMBER ) {
731
+ if (eth_proto_cap & (MLX5E_PROT_MASK (MLX5E_10GBASE_CR )
732
+ | MLX5E_PROT_MASK (MLX5E_10GBASE_SR )
733
+ | MLX5E_PROT_MASK (MLX5E_40GBASE_CR4 )
734
+ | MLX5E_PROT_MASK (MLX5E_40GBASE_SR4 )
735
+ | MLX5E_PROT_MASK (MLX5E_100GBASE_SR4 )
736
+ | MLX5E_PROT_MASK (MLX5E_1000BASE_CX_SGMII ))) {
737
+ ethtool_link_ksettings_add_link_mode (link_ksettings ,
738
+ supported ,
739
+ FIBRE );
740
+ ethtool_link_ksettings_add_link_mode (link_ksettings ,
741
+ advertising ,
742
+ FIBRE );
743
+ }
744
+
745
+ if (eth_proto_cap & (MLX5E_PROT_MASK (MLX5E_100GBASE_KR4 )
746
+ | MLX5E_PROT_MASK (MLX5E_40GBASE_KR4 )
747
+ | MLX5E_PROT_MASK (MLX5E_10GBASE_KR )
748
+ | MLX5E_PROT_MASK (MLX5E_10GBASE_KX4 )
749
+ | MLX5E_PROT_MASK (MLX5E_1000BASE_KX ))) {
750
+ ethtool_link_ksettings_add_link_mode (link_ksettings ,
751
+ supported ,
752
+ Backplane );
753
+ ethtool_link_ksettings_add_link_mode (link_ksettings ,
754
+ advertising ,
755
+ Backplane );
756
+ }
757
+ return ;
736
758
}
737
759
738
- if (eth_proto_cap & (MLX5E_PROT_MASK (MLX5E_100GBASE_KR4 )
739
- | MLX5E_PROT_MASK (MLX5E_40GBASE_KR4 )
740
- | MLX5E_PROT_MASK (MLX5E_10GBASE_KR )
741
- | MLX5E_PROT_MASK (MLX5E_10GBASE_KX4 )
742
- | MLX5E_PROT_MASK (MLX5E_1000BASE_KX ))) {
743
- ethtool_link_ksettings_add_link_mode (link_ksettings , supported , Backplane );
760
+ switch (connector_type ) {
761
+ case MLX5E_PORT_TP :
762
+ ethtool_link_ksettings_add_link_mode (link_ksettings ,
763
+ supported , TP );
764
+ ethtool_link_ksettings_add_link_mode (link_ksettings ,
765
+ advertising , TP );
766
+ break ;
767
+ case MLX5E_PORT_AUI :
768
+ ethtool_link_ksettings_add_link_mode (link_ksettings ,
769
+ supported , AUI );
770
+ ethtool_link_ksettings_add_link_mode (link_ksettings ,
771
+ advertising , AUI );
772
+ break ;
773
+ case MLX5E_PORT_BNC :
774
+ ethtool_link_ksettings_add_link_mode (link_ksettings ,
775
+ supported , BNC );
776
+ ethtool_link_ksettings_add_link_mode (link_ksettings ,
777
+ advertising , BNC );
778
+ break ;
779
+ case MLX5E_PORT_MII :
780
+ ethtool_link_ksettings_add_link_mode (link_ksettings ,
781
+ supported , MII );
782
+ ethtool_link_ksettings_add_link_mode (link_ksettings ,
783
+ advertising , MII );
784
+ break ;
785
+ case MLX5E_PORT_FIBRE :
786
+ ethtool_link_ksettings_add_link_mode (link_ksettings ,
787
+ supported , FIBRE );
788
+ ethtool_link_ksettings_add_link_mode (link_ksettings ,
789
+ advertising , FIBRE );
790
+ break ;
791
+ case MLX5E_PORT_DA :
792
+ ethtool_link_ksettings_add_link_mode (link_ksettings ,
793
+ supported , Backplane );
794
+ ethtool_link_ksettings_add_link_mode (link_ksettings ,
795
+ advertising , Backplane );
796
+ break ;
797
+ case MLX5E_PORT_NONE :
798
+ case MLX5E_PORT_OTHER :
799
+ default :
800
+ break ;
744
801
}
745
802
}
746
803
@@ -791,7 +848,6 @@ static void get_supported(u32 eth_proto_cap,
791
848
{
792
849
unsigned long * supported = link_ksettings -> link_modes .supported ;
793
850
794
- ptys2ethtool_supported_port (link_ksettings , eth_proto_cap );
795
851
ptys2ethtool_supported_link (supported , eth_proto_cap );
796
852
ethtool_link_ksettings_add_link_mode (link_ksettings , supported , Pause );
797
853
}
@@ -809,8 +865,23 @@ static void get_advertising(u32 eth_proto_cap, u8 tx_pause,
809
865
ethtool_link_ksettings_add_link_mode (link_ksettings , advertising , Asym_Pause );
810
866
}
811
867
812
- static u8 get_connector_port (u32 eth_proto )
868
+ static int ptys2connector_type [MLX5E_CONNECTOR_TYPE_NUMBER ] = {
869
+ [MLX5E_PORT_UNKNOWN ] = PORT_OTHER ,
870
+ [MLX5E_PORT_NONE ] = PORT_NONE ,
871
+ [MLX5E_PORT_TP ] = PORT_TP ,
872
+ [MLX5E_PORT_AUI ] = PORT_AUI ,
873
+ [MLX5E_PORT_BNC ] = PORT_BNC ,
874
+ [MLX5E_PORT_MII ] = PORT_MII ,
875
+ [MLX5E_PORT_FIBRE ] = PORT_FIBRE ,
876
+ [MLX5E_PORT_DA ] = PORT_DA ,
877
+ [MLX5E_PORT_OTHER ] = PORT_OTHER ,
878
+ };
879
+
880
+ static u8 get_connector_port (u32 eth_proto , u8 connector_type )
813
881
{
882
+ if (connector_type && connector_type < MLX5E_CONNECTOR_TYPE_NUMBER )
883
+ return ptys2connector_type [connector_type ];
884
+
814
885
if (eth_proto & (MLX5E_PROT_MASK (MLX5E_10GBASE_SR )
815
886
| MLX5E_PROT_MASK (MLX5E_40GBASE_SR4 )
816
887
| MLX5E_PROT_MASK (MLX5E_100GBASE_SR4 )
@@ -856,6 +927,7 @@ static int mlx5e_get_link_ksettings(struct net_device *netdev,
856
927
u32 eth_proto_oper ;
857
928
u8 an_disable_admin ;
858
929
u8 an_status ;
930
+ u8 connector_type ;
859
931
int err ;
860
932
861
933
err = mlx5_query_port_ptys (mdev , out , sizeof (out ), MLX5_PTYS_EN , 1 );
@@ -871,6 +943,7 @@ static int mlx5e_get_link_ksettings(struct net_device *netdev,
871
943
eth_proto_lp = MLX5_GET (ptys_reg , out , eth_proto_lp_advertise );
872
944
an_disable_admin = MLX5_GET (ptys_reg , out , an_disable_admin );
873
945
an_status = MLX5_GET (ptys_reg , out , an_status );
946
+ connector_type = MLX5_GET (ptys_reg , out , connector_type );
874
947
875
948
mlx5_query_port_pause (mdev , & rx_pause , & tx_pause );
876
949
@@ -883,7 +956,10 @@ static int mlx5e_get_link_ksettings(struct net_device *netdev,
883
956
884
957
eth_proto_oper = eth_proto_oper ? eth_proto_oper : eth_proto_cap ;
885
958
886
- link_ksettings -> base .port = get_connector_port (eth_proto_oper );
959
+ link_ksettings -> base .port = get_connector_port (eth_proto_oper ,
960
+ connector_type );
961
+ ptys2ethtool_supported_advertised_port (link_ksettings , eth_proto_admin ,
962
+ connector_type );
887
963
get_lp_advertising (eth_proto_lp , link_ksettings );
888
964
889
965
if (an_status == MLX5_AN_COMPLETE )
0 commit comments