@@ -503,45 +503,59 @@ static void efx_mcdi_phy_remove(struct efx_nic *efx)
503
503
kfree (phy_data );
504
504
}
505
505
506
- static void efx_mcdi_phy_get_settings (struct efx_nic * efx , struct ethtool_cmd * ecmd )
506
+ static void efx_mcdi_phy_get_link_ksettings (struct efx_nic * efx ,
507
+ struct ethtool_link_ksettings * cmd )
507
508
{
508
509
struct efx_mcdi_phy_data * phy_cfg = efx -> phy_data ;
509
510
MCDI_DECLARE_BUF (outbuf , MC_CMD_GET_LINK_OUT_LEN );
510
511
int rc ;
511
-
512
- ecmd -> supported =
513
- mcdi_to_ethtool_cap (phy_cfg -> media , phy_cfg -> supported_cap );
514
- ecmd -> advertising = efx -> link_advertising ;
515
- ethtool_cmd_speed_set (ecmd , efx -> link_state .speed );
516
- ecmd -> duplex = efx -> link_state .fd ;
517
- ecmd -> port = mcdi_to_ethtool_media (phy_cfg -> media );
518
- ecmd -> phy_address = phy_cfg -> port ;
519
- ecmd -> transceiver = XCVR_INTERNAL ;
520
- ecmd -> autoneg = !!(efx -> link_advertising & ADVERTISED_Autoneg );
521
- ecmd -> mdio_support = (efx -> mdio .mode_support &
512
+ u32 supported , advertising , lp_advertising ;
513
+
514
+ supported = mcdi_to_ethtool_cap (phy_cfg -> media , phy_cfg -> supported_cap );
515
+ advertising = efx -> link_advertising ;
516
+ cmd -> base .speed = efx -> link_state .speed ;
517
+ cmd -> base .duplex = efx -> link_state .fd ;
518
+ cmd -> base .port = mcdi_to_ethtool_media (phy_cfg -> media );
519
+ cmd -> base .phy_address = phy_cfg -> port ;
520
+ cmd -> base .autoneg = !!(efx -> link_advertising & ADVERTISED_Autoneg );
521
+ cmd -> base .mdio_support = (efx -> mdio .mode_support &
522
522
(MDIO_SUPPORTS_C45 | MDIO_SUPPORTS_C22 ));
523
523
524
+ ethtool_convert_legacy_u32_to_link_mode (cmd -> link_modes .supported ,
525
+ supported );
526
+ ethtool_convert_legacy_u32_to_link_mode (cmd -> link_modes .advertising ,
527
+ advertising );
528
+
524
529
BUILD_BUG_ON (MC_CMD_GET_LINK_IN_LEN != 0 );
525
530
rc = efx_mcdi_rpc (efx , MC_CMD_GET_LINK , NULL , 0 ,
526
531
outbuf , sizeof (outbuf ), NULL );
527
532
if (rc )
528
533
return ;
529
- ecmd -> lp_advertising =
534
+ lp_advertising =
530
535
mcdi_to_ethtool_cap (phy_cfg -> media ,
531
536
MCDI_DWORD (outbuf , GET_LINK_OUT_LP_CAP ));
537
+
538
+ ethtool_convert_legacy_u32_to_link_mode (cmd -> link_modes .lp_advertising ,
539
+ lp_advertising );
532
540
}
533
541
534
- static int efx_mcdi_phy_set_settings (struct efx_nic * efx , struct ethtool_cmd * ecmd )
542
+ static int
543
+ efx_mcdi_phy_set_link_ksettings (struct efx_nic * efx ,
544
+ const struct ethtool_link_ksettings * cmd )
535
545
{
536
546
struct efx_mcdi_phy_data * phy_cfg = efx -> phy_data ;
537
547
u32 caps ;
538
548
int rc ;
549
+ u32 advertising ;
550
+
551
+ ethtool_convert_link_mode_to_legacy_u32 (& advertising ,
552
+ cmd -> link_modes .advertising );
539
553
540
- if (ecmd -> autoneg ) {
541
- caps = (ethtool_to_mcdi_cap (ecmd -> advertising ) |
554
+ if (cmd -> base . autoneg ) {
555
+ caps = (ethtool_to_mcdi_cap (advertising ) |
542
556
1 << MC_CMD_PHY_CAP_AN_LBN );
543
- } else if (ecmd -> duplex ) {
544
- switch (ethtool_cmd_speed ( ecmd ) ) {
557
+ } else if (cmd -> base . duplex ) {
558
+ switch (cmd -> base . speed ) {
545
559
case 10 : caps = 1 << MC_CMD_PHY_CAP_10FDX_LBN ; break ;
546
560
case 100 : caps = 1 << MC_CMD_PHY_CAP_100FDX_LBN ; break ;
547
561
case 1000 : caps = 1 << MC_CMD_PHY_CAP_1000FDX_LBN ; break ;
@@ -550,7 +564,7 @@ static int efx_mcdi_phy_set_settings(struct efx_nic *efx, struct ethtool_cmd *ec
550
564
default : return - EINVAL ;
551
565
}
552
566
} else {
553
- switch (ethtool_cmd_speed ( ecmd ) ) {
567
+ switch (cmd -> base . speed ) {
554
568
case 10 : caps = 1 << MC_CMD_PHY_CAP_10HDX_LBN ; break ;
555
569
case 100 : caps = 1 << MC_CMD_PHY_CAP_100HDX_LBN ; break ;
556
570
case 1000 : caps = 1 << MC_CMD_PHY_CAP_1000HDX_LBN ; break ;
@@ -563,9 +577,9 @@ static int efx_mcdi_phy_set_settings(struct efx_nic *efx, struct ethtool_cmd *ec
563
577
if (rc )
564
578
return rc ;
565
579
566
- if (ecmd -> autoneg ) {
580
+ if (cmd -> base . autoneg ) {
567
581
efx_link_set_advertising (
568
- efx , ecmd -> advertising | ADVERTISED_Autoneg );
582
+ efx , advertising | ADVERTISED_Autoneg );
569
583
phy_cfg -> forced_cap = 0 ;
570
584
} else {
571
585
efx_link_set_advertising (efx , 0 );
@@ -812,8 +826,8 @@ static const struct efx_phy_operations efx_mcdi_phy_ops = {
812
826
.poll = efx_mcdi_phy_poll ,
813
827
.fini = efx_port_dummy_op_void ,
814
828
.remove = efx_mcdi_phy_remove ,
815
- .get_settings = efx_mcdi_phy_get_settings ,
816
- .set_settings = efx_mcdi_phy_set_settings ,
829
+ .get_link_ksettings = efx_mcdi_phy_get_link_ksettings ,
830
+ .set_link_ksettings = efx_mcdi_phy_set_link_ksettings ,
817
831
.test_alive = efx_mcdi_phy_test_alive ,
818
832
.run_tests = efx_mcdi_phy_run_tests ,
819
833
.test_name = efx_mcdi_phy_test_name ,
0 commit comments