From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934041AbcLUOj3 (ORCPT ); Wed, 21 Dec 2016 09:39:29 -0500 Received: from nbfkord-smmo02.seg.att.com ([209.65.160.78]:37725 "EHLO nbfkord-smmo02.seg.att.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759548AbcLUOjL (ORCPT ); Wed, 21 Dec 2016 09:39:11 -0500 X-MXL-Hash: 585a940f2d93e22e-de4fa9a170d0c26926602db19c12143de8305d82 X-MXL-Hash: 585a93fc07b25057-682b33a70087524f3dd7bbbdd6654ecec78edf88 Subject: Re: [PATCH 2/2] net: sfc: falcon: use new api ethtool_{get|set}_link_ksettings To: Philippe Reynes , , , , References: <1482272667-1206-1-git-send-email-tremyfr@gmail.com> <1482272667-1206-2-git-send-email-tremyfr@gmail.com> CC: , From: Bert Kenward Message-ID: Date: Wed, 21 Dec 2016 14:38:38 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <1482272667-1206-2-git-send-email-tremyfr@gmail.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.17.20.82] X-ClientProxiedBy: ocex03.SolarFlarecom.com (10.20.40.36) To ukex01.SolarFlarecom.com (10.17.10.4) X-TM-AS-Product-Ver: SMEX-11.0.0.1191-8.000.1202-22774.003 X-TM-AS-Result: No--12.712400-0.000000-31 X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-AnalysisOut: [v=2.1 cv=ALPOwa1d c=1 sm=1 tr=0 a=8P+NB+fYZDP74ap4g4d9Kw==] X-AnalysisOut: [:17 a=OjXlt12Agc0A:10 a=N659UExz7-8A:10 a=n5n_aSjo0skA:10 ] X-AnalysisOut: [a=pGLkceISAAAA:8 a=McRyc9pmGO4BFWeYZZkA:9 a=on3txRPA8rkXcM] X-AnalysisOut: [-U:21 a=v5eZ9F0xnu40hLyu:21 a=pILNOxqGKmIA:10 a=6kGIvZw6iX] X-AnalysisOut: [1k4Y-7sg4_:22] X-Spam: [F=0.2000000000; CM=0.500; S=0.200(2015072901)] X-MAIL-FROM: X-SOURCE-IP: [193.34.186.16] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/12/16 22:24, Philippe Reynes wrote: > The ethtool api {get|set}_settings is deprecated. > We move this driver to new api {get|set}_link_ksettings. > > Signed-off-by: Philippe Reynes > --- > drivers/net/ethernet/sfc/falcon/efx.c | 2 +- > drivers/net/ethernet/sfc/falcon/ethtool.c | 35 ++++++++++++------- > drivers/net/ethernet/sfc/falcon/mdio_10g.c | 44 +++++++++++++++--------- > drivers/net/ethernet/sfc/falcon/mdio_10g.h | 3 +- > drivers/net/ethernet/sfc/falcon/net_driver.h | 12 +++--- > drivers/net/ethernet/sfc/falcon/qt202x_phy.c | 9 +++-- > drivers/net/ethernet/sfc/falcon/tenxpress.c | 22 ++++++------ > drivers/net/ethernet/sfc/falcon/txc43128_phy.c | 9 +++-- > 8 files changed, 80 insertions(+), 56 deletions(-) > > diff --git a/drivers/net/ethernet/sfc/falcon/efx.c b/drivers/net/ethernet/sfc/falcon/efx.c > index 5c5cb3c..438ef9e 100644 > --- a/drivers/net/ethernet/sfc/falcon/efx.c > +++ b/drivers/net/ethernet/sfc/falcon/efx.c > @@ -986,7 +986,7 @@ void ef4_mac_reconfigure(struct ef4_nic *efx) > > /* Push loopback/power/transmit disable settings to the PHY, and reconfigure > * the MAC appropriately. All other PHY configuration changes are pushed > - * through phy_op->set_settings(), and pushed asynchronously to the MAC > + * through phy_op->set_link_ksettings(), and pushed asynchronously to the MAC > * through ef4_monitor(). > * > * Callers must hold the mac_lock > diff --git a/drivers/net/ethernet/sfc/falcon/ethtool.c b/drivers/net/ethernet/sfc/falcon/ethtool.c > index 8e1929b..659ece7 100644 > --- a/drivers/net/ethernet/sfc/falcon/ethtool.c > +++ b/drivers/net/ethernet/sfc/falcon/ethtool.c > @@ -115,44 +115,53 @@ static int ef4_ethtool_phys_id(struct net_device *net_dev, > } > > /* This must be called with rtnl_lock held. */ > -static int ef4_ethtool_get_settings(struct net_device *net_dev, > - struct ethtool_cmd *ecmd) > +static int > +ef4_ethtool_get_link_ksettings(struct net_device *net_dev, > + struct ethtool_link_ksettings *cmd) > { > struct ef4_nic *efx = netdev_priv(net_dev); > struct ef4_link_state *link_state = &efx->link_state; > + u32 supported; > + > + ethtool_convert_link_mode_to_legacy_u32(&supported, > + cmd->link_modes.supported); > > mutex_lock(&efx->mac_lock); > - efx->phy_op->get_settings(efx, ecmd); > + efx->phy_op->get_link_ksettings(efx, cmd); > mutex_unlock(&efx->mac_lock); > > /* Both MACs support pause frames (bidirectional and respond-only) */ > - ecmd->supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause; > + supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause; > > if (LOOPBACK_INTERNAL(efx)) { > - ethtool_cmd_speed_set(ecmd, link_state->speed); > - ecmd->duplex = link_state->fd ? DUPLEX_FULL : DUPLEX_HALF; > + cmd->base.speed = link_state->speed; > + cmd->base.duplex = link_state->fd ? DUPLEX_FULL : DUPLEX_HALF; > } > > + ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported, > + supported); > + > return 0; > } This translates cmd->link_modes.supported in to the legacy supported bitmap before we've actually read the values from the phy. Given we're only using the legacy bitmap so we can add the pause frame settings, I suggest something like: ef4_ethtool_get_link_ksettings(struct net_device *net_dev, struct ethtool_link_ksettings *cmd) { struct ef4_nic *efx = netdev_priv(net_dev); struct ef4_link_state *link_state = &efx->link_state; mutex_lock(&efx->mac_lock); efx->phy_op->get_link_ksettings(efx, cmd); mutex_unlock(&efx->mac_lock); /* Both MACs support pause frames (bidirectional and respond-only) */ ethtool_link_ksettings_add_link_mode(cmd, supported, Pause); ethtool_link_ksettings_add_link_mode(cmd, supported, Asym_Pause); if (LOOPBACK_INTERNAL(efx)) { cmd->base.speed = link_state->speed; cmd->base.duplex = link_state->fd ? DUPLEX_FULL : DUPLEX_HALF; } return 0; } Thanks, Bert.