From patchwork Tue Aug 23 15:04:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacob Keller X-Patchwork-Id: 12952410 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5267C32789 for ; Tue, 23 Aug 2022 17:28:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233250AbiHWR2a (ORCPT ); Tue, 23 Aug 2022 13:28:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234249AbiHWR00 (ORCPT ); Tue, 23 Aug 2022 13:26:26 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80A52D51F0 for ; Tue, 23 Aug 2022 08:04:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661267090; x=1692803090; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HI4TtFytANHkLG0B7MZdgSsptx9Sua0xxtihFUGtMMs=; b=hfxQ2ZBt6q9SLIuYBTi0awwFIvmb1rX2yjoij0/H2CvyCKn4TZbHyt4D ZZLK/YAu3J4wtcEreuyuHflZT0MdnZPsCDu9sWExp+cdqPhYLGh1U1LoV f2sTnRdcLYHXGUgmaflrceU4A+rBpP7oy129ZIOody1UPt5C5vJaCx/Ti bTReYeNmu1KJe8jaWpK8WgoTd+egmsfICc80YniF9WRtCQwYZv77jVohx Ppr5nOf4pDkR3npUDrMZ0YJdvmKYxGtH94FVcf352liB9QEBh5J5KkAO8 vvoomDg7k+TQu75t2s24o8Nh4m/iHHldg0xYCnOoCMS7NuWHOhI4YKB+t w==; X-IronPort-AV: E=McAfee;i="6500,9779,10448"; a="273464965" X-IronPort-AV: E=Sophos;i="5.93,258,1654585200"; d="scan'208";a="273464965" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Aug 2022 08:04:49 -0700 X-IronPort-AV: E=Sophos;i="5.93,258,1654585200"; d="scan'208";a="854894265" Received: from jekeller-desk.amr.corp.intel.com (HELO jekeller-desk.jekeller.internal) ([10.166.241.7]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Aug 2022 08:04:48 -0700 From: Jacob Keller To: netdev@vger.kernel.org Cc: Jacob Keller , Michael Chan , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Derek Chickles , Satanand Burla , Felix Manlunas , Raju Rangoju , Dimitris Michailidis , Yisen Zhuang , Salil Mehta , Jesse Brandeburg , Tony Nguyen , Sunil Goutham , Geetha sowjanya , Subbaraya Sundeep , hariprasad , Taras Chornyi , Saeed Mahameed , Leon Romanovsky , Simon Horman , Shannon Nelson , Ariel Elior , Manish Chopra , Edward Cree , Martin Habets , Fei Qin , Louis Peens , Yu Xiao , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Yufeng Mo , Sixiang Chen , Yinjun Zhang , Hao Chen , Guangbin Huang , Sean Anderson , Erik Ekman , Ido Schimmel , Jie Wang , Moshe Tal , Tonghao Zhang , Marco Bonelli , "Gustavo A. R. Silva" Subject: [PATCH net-next 1/2] ethtool: pass netlink extended ACK to .set_fecparam Date: Tue, 23 Aug 2022 08:04:37 -0700 Message-Id: <20220823150438.3613327-2-jacob.e.keller@intel.com> X-Mailer: git-send-email 2.37.1.394.gc50926e1f488 In-Reply-To: <20220823150438.3613327-1-jacob.e.keller@intel.com> References: <20220823150438.3613327-1-jacob.e.keller@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add the netlink extended ACK structure pointer to the interface for .set_fecparam. This allows reporting errors to the user appropriately when using the netlink ethtool interface. Signed-off-by: Jacob Keller Cc: Michael Chan Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: Derek Chickles Cc: Satanand Burla Cc: Felix Manlunas Cc: Raju Rangoju Cc: Dimitris Michailidis Cc: Yisen Zhuang Cc: Salil Mehta Cc: Jesse Brandeburg Cc: Tony Nguyen Cc: Sunil Goutham Cc: Geetha sowjanya Cc: Subbaraya Sundeep Cc: hariprasad Cc: Taras Chornyi Cc: Saeed Mahameed Cc: Leon Romanovsky Cc: Simon Horman Cc: Shannon Nelson Cc: Ariel Elior Cc: Manish Chopra Cc: Edward Cree Cc: Martin Habets Cc: Jacob Keller Cc: Fei Qin Cc: Louis Peens Cc: Yu Xiao Cc: "Uwe Kleine-König" Cc: Yufeng Mo Cc: Sixiang Chen Cc: Yinjun Zhang Cc: Hao Chen Cc: Guangbin Huang Cc: Sean Anderson Cc: Erik Ekman Cc: Ido Schimmel Cc: Jie Wang Cc: Moshe Tal Cc: Tonghao Zhang Cc: Marco Bonelli Cc: "Gustavo A. R. Silva" Acked-by: Simon Horman --- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 3 ++- drivers/net/ethernet/cavium/liquidio/lio_ethtool.c | 3 ++- drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 3 ++- drivers/net/ethernet/fungible/funeth/funeth_ethtool.c | 3 ++- drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 3 ++- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 3 ++- drivers/net/ethernet/intel/ice/ice_ethtool.c | 4 +++- drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 3 ++- drivers/net/ethernet/marvell/prestera/prestera_ethtool.c | 3 ++- drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 3 ++- drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c | 3 ++- drivers/net/ethernet/pensando/ionic/ionic_ethtool.c | 3 ++- drivers/net/ethernet/qlogic/qede/qede_ethtool.c | 3 ++- drivers/net/ethernet/sfc/ethtool_common.c | 3 ++- drivers/net/ethernet/sfc/ethtool_common.h | 3 ++- drivers/net/ethernet/sfc/siena/ethtool_common.c | 3 ++- drivers/net/ethernet/sfc/siena/ethtool_common.h | 3 ++- drivers/net/netdevsim/ethtool.c | 3 ++- include/linux/ethtool.h | 3 ++- net/ethtool/fec.c | 2 +- net/ethtool/ioctl.c | 2 +- 21 files changed, 41 insertions(+), 21 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index 87eb5362ad70..9ad00240ee06 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -2022,7 +2022,8 @@ static u32 bnxt_ethtool_forced_fec_to_fw(struct bnxt_link_info *link_info, } static int bnxt_set_fecparam(struct net_device *dev, - struct ethtool_fecparam *fecparam) + struct ethtool_fecparam *fecparam, + struct netlink_ext_ack *extack) { struct hwrm_port_phy_cfg_input *req; struct bnxt *bp = netdev_priv(dev); diff --git a/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c b/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c index 2c10ae3f7fc1..d6ba8153c649 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c @@ -3084,7 +3084,8 @@ static int lio_get_fecparam(struct net_device *netdev, } static int lio_set_fecparam(struct net_device *netdev, - struct ethtool_fecparam *fec) + struct ethtool_fecparam *fec, + struct netlink_ext_ack *extack) { struct lio *lio = GET_LIO(netdev); struct octeon_device *oct = lio->oct_dev; diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c index 77897edd2bc0..cd7f09aa63fb 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c @@ -834,7 +834,8 @@ static int get_fecparam(struct net_device *dev, struct ethtool_fecparam *fec) return 0; } -static int set_fecparam(struct net_device *dev, struct ethtool_fecparam *fec) +static int set_fecparam(struct net_device *dev, struct ethtool_fecparam *fec, + struct netlink_ext_ack *extack) { struct port_info *pi = netdev_priv(dev); struct link_config *lc = &pi->link_cfg; diff --git a/drivers/net/ethernet/fungible/funeth/funeth_ethtool.c b/drivers/net/ethernet/fungible/funeth/funeth_ethtool.c index 31aa185f4d17..31b15506ca4c 100644 --- a/drivers/net/ethernet/fungible/funeth/funeth_ethtool.c +++ b/drivers/net/ethernet/fungible/funeth/funeth_ethtool.c @@ -1087,7 +1087,8 @@ static int fun_get_fecparam(struct net_device *netdev, } static int fun_set_fecparam(struct net_device *netdev, - struct ethtool_fecparam *fec) + struct ethtool_fecparam *fec, + struct netlink_ext_ack *extack) { struct funeth_priv *fp = netdev_priv(netdev); u64 fec_mode; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c index 4c7988e308a2..82f7d70477e6 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -1673,7 +1673,8 @@ static int hns3_get_fecparam(struct net_device *netdev, } static int hns3_set_fecparam(struct net_device *netdev, - struct ethtool_fecparam *fec) + struct ethtool_fecparam *fec, + struct netlink_ext_ack *extack) { struct hnae3_handle *handle = hns3_get_handle(netdev); struct hnae3_ae_dev *ae_dev = pci_get_drvdata(handle->pdev); diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c index 156e92c43780..35e6eb65e237 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c @@ -1582,7 +1582,8 @@ static int i40e_get_fec_param(struct net_device *netdev, } static int i40e_set_fec_param(struct net_device *netdev, - struct ethtool_fecparam *fecparam) + struct ethtool_fecparam *fecparam, + struct netlink_ext_ack *extack) { struct i40e_netdev_priv *np = netdev_priv(netdev); struct i40e_pf *pf = np->vsi->back; diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c index 60dca15635db..770101577a94 100644 --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c @@ -1012,9 +1012,11 @@ static int ice_set_fec_cfg(struct net_device *netdev, enum ice_fec_mode req_fec) * ice_set_fecparam - Set FEC link options * @netdev: network interface device structure * @fecparam: Ethtool structure to retrieve FEC parameters + * @extack: Netlink extended ACK response */ static int -ice_set_fecparam(struct net_device *netdev, struct ethtool_fecparam *fecparam) +ice_set_fecparam(struct net_device *netdev, struct ethtool_fecparam *fecparam, + struct netlink_ext_ack *extack) { struct ice_netdev_priv *np = netdev_priv(netdev); struct ice_vsi *vsi = np->vsi; diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c index 3f60a80e34c8..1bc5f661fe00 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c @@ -1024,7 +1024,8 @@ static int otx2_get_fecparam(struct net_device *netdev, } static int otx2_set_fecparam(struct net_device *netdev, - struct ethtool_fecparam *fecparam) + struct ethtool_fecparam *fecparam, + struct netlink_ext_ack *extack) { struct otx2_nic *pfvf = netdev_priv(netdev); struct mbox *mbox = &pfvf->mbox; diff --git a/drivers/net/ethernet/marvell/prestera/prestera_ethtool.c b/drivers/net/ethernet/marvell/prestera/prestera_ethtool.c index 1da7ff889417..4f19f0dfac5e 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_ethtool.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_ethtool.c @@ -705,7 +705,8 @@ static int prestera_ethtool_get_fecparam(struct net_device *dev, } static int prestera_ethtool_set_fecparam(struct net_device *dev, - struct ethtool_fecparam *fecparam) + struct ethtool_fecparam *fecparam, + struct netlink_ext_ack *extack) { struct prestera_port *port = netdev_priv(dev); struct prestera_port_mac_config cfg_mac; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index b811207fe5ed..1e2b82aff1cb 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c @@ -1668,7 +1668,8 @@ static int mlx5e_get_fecparam(struct net_device *netdev, } static int mlx5e_set_fecparam(struct net_device *netdev, - struct ethtool_fecparam *fecparam) + struct ethtool_fecparam *fecparam, + struct netlink_ext_ack *extack) { struct mlx5e_priv *priv = netdev_priv(netdev); struct mlx5_core_dev *mdev = priv->mdev; diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c index eeb1455a4e5d..4c29da87c61f 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c @@ -1015,7 +1015,8 @@ nfp_port_get_fecparam(struct net_device *netdev, static int nfp_port_set_fecparam(struct net_device *netdev, - struct ethtool_fecparam *param) + struct ethtool_fecparam *param, + struct netlink_ext_ack *extack) { struct nfp_eth_table_port *eth_port; struct nfp_port *port; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c index 01c22701482d..d9ff8899c67c 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c @@ -360,7 +360,8 @@ static int ionic_get_fecparam(struct net_device *netdev, } static int ionic_set_fecparam(struct net_device *netdev, - struct ethtool_fecparam *fec) + struct ethtool_fecparam *fec, + struct netlink_ext_ack *extack) { struct ionic_lif *lif = netdev_priv(netdev); u8 fec_type; diff --git a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c index 97a7ab0826ed..db3aab14907e 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c +++ b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c @@ -1912,7 +1912,8 @@ static int qede_get_fecparam(struct net_device *dev, } static int qede_set_fecparam(struct net_device *dev, - struct ethtool_fecparam *fecparam) + struct ethtool_fecparam *fecparam, + struct netlink_ext_ack *extack) { struct qede_dev *edev = netdev_priv(dev); struct qed_link_params params; diff --git a/drivers/net/ethernet/sfc/ethtool_common.c b/drivers/net/ethernet/sfc/ethtool_common.c index bc840ede3053..2b1b505da4fb 100644 --- a/drivers/net/ethernet/sfc/ethtool_common.c +++ b/drivers/net/ethernet/sfc/ethtool_common.c @@ -616,7 +616,8 @@ int efx_ethtool_get_fecparam(struct net_device *net_dev, } int efx_ethtool_set_fecparam(struct net_device *net_dev, - struct ethtool_fecparam *fecparam) + struct ethtool_fecparam *fecparam, + struct netlink_ext_ack *extack) { struct efx_nic *efx = efx_netdev_priv(net_dev); int rc; diff --git a/drivers/net/ethernet/sfc/ethtool_common.h b/drivers/net/ethernet/sfc/ethtool_common.h index 659491932101..4cdc322f4616 100644 --- a/drivers/net/ethernet/sfc/ethtool_common.h +++ b/drivers/net/ethernet/sfc/ethtool_common.h @@ -37,7 +37,8 @@ int efx_ethtool_set_link_ksettings(struct net_device *net_dev, int efx_ethtool_get_fecparam(struct net_device *net_dev, struct ethtool_fecparam *fecparam); int efx_ethtool_set_fecparam(struct net_device *net_dev, - struct ethtool_fecparam *fecparam); + struct ethtool_fecparam *fecparam, + struct netlink_ext_ack *extack); int efx_ethtool_get_rxnfc(struct net_device *net_dev, struct ethtool_rxnfc *info, u32 *rule_locs); int efx_ethtool_set_rxnfc(struct net_device *net_dev, diff --git a/drivers/net/ethernet/sfc/siena/ethtool_common.c b/drivers/net/ethernet/sfc/siena/ethtool_common.c index 0207d07f54e3..9f65cb1c058c 100644 --- a/drivers/net/ethernet/sfc/siena/ethtool_common.c +++ b/drivers/net/ethernet/sfc/siena/ethtool_common.c @@ -616,7 +616,8 @@ int efx_siena_ethtool_get_fecparam(struct net_device *net_dev, } int efx_siena_ethtool_set_fecparam(struct net_device *net_dev, - struct ethtool_fecparam *fecparam) + struct ethtool_fecparam *fecparam, + struct netlink_ext_ack *extack) { struct efx_nic *efx = netdev_priv(net_dev); int rc; diff --git a/drivers/net/ethernet/sfc/siena/ethtool_common.h b/drivers/net/ethernet/sfc/siena/ethtool_common.h index 04b375dc6800..7dadd95eb69f 100644 --- a/drivers/net/ethernet/sfc/siena/ethtool_common.h +++ b/drivers/net/ethernet/sfc/siena/ethtool_common.h @@ -34,7 +34,8 @@ int efx_siena_ethtool_set_link_ksettings(struct net_device *net_dev, int efx_siena_ethtool_get_fecparam(struct net_device *net_dev, struct ethtool_fecparam *fecparam); int efx_siena_ethtool_set_fecparam(struct net_device *net_dev, - struct ethtool_fecparam *fecparam); + struct ethtool_fecparam *fecparam, + struct netlink_ext_ack *extack); int efx_siena_ethtool_get_rxnfc(struct net_device *net_dev, struct ethtool_rxnfc *info, u32 *rule_locs); int efx_siena_ethtool_set_rxnfc(struct net_device *net_dev, diff --git a/drivers/net/netdevsim/ethtool.c b/drivers/net/netdevsim/ethtool.c index ffd9f84b6644..88f3738c5899 100644 --- a/drivers/net/netdevsim/ethtool.c +++ b/drivers/net/netdevsim/ethtool.c @@ -124,7 +124,8 @@ nsim_get_fecparam(struct net_device *dev, struct ethtool_fecparam *fecparam) } static int -nsim_set_fecparam(struct net_device *dev, struct ethtool_fecparam *fecparam) +nsim_set_fecparam(struct net_device *dev, struct ethtool_fecparam *fecparam, + struct netlink_ext_ack *extack) { struct netdevsim *ns = netdev_priv(dev); u32 fec; diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index 99dc7bfbcd3c..3ce1ef7b1390 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -735,7 +735,8 @@ struct ethtool_ops { int (*get_fecparam)(struct net_device *, struct ethtool_fecparam *); int (*set_fecparam)(struct net_device *, - struct ethtool_fecparam *); + struct ethtool_fecparam *, + struct netlink_ext_ack *extack); void (*get_ethtool_phy_stats)(struct net_device *, struct ethtool_stats *, u64 *); int (*get_phy_tunable)(struct net_device *, diff --git a/net/ethtool/fec.c b/net/ethtool/fec.c index 9f5a134e2e01..79931b0de177 100644 --- a/net/ethtool/fec.c +++ b/net/ethtool/fec.c @@ -295,7 +295,7 @@ int ethnl_set_fec(struct sk_buff *skb, struct genl_info *info) goto out_ops; } - ret = dev->ethtool_ops->set_fecparam(dev, &fec); + ret = dev->ethtool_ops->set_fecparam(dev, &fec, info->extack); if (ret < 0) goto out_ops; ethtool_notify(dev, ETHTOOL_MSG_FEC_NTF, NULL); diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c index 6a7308de192d..2f397d016d3a 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c @@ -2706,7 +2706,7 @@ static int ethtool_set_fecparam(struct net_device *dev, void __user *useraddr) fecparam.active_fec = 0; fecparam.reserved = 0; - return dev->ethtool_ops->set_fecparam(dev, &fecparam); + return dev->ethtool_ops->set_fecparam(dev, &fecparam, NULL); } /* The main entry point in this file. Called from net/core/dev_ioctl.c */ From patchwork Tue Aug 23 15:04:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacob Keller X-Patchwork-Id: 12952411 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F0F8C32772 for ; Tue, 23 Aug 2022 17:28:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234002AbiHWR2c (ORCPT ); Tue, 23 Aug 2022 13:28:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234376AbiHWR01 (ORCPT ); Tue, 23 Aug 2022 13:26:27 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 979F9F2D52 for ; Tue, 23 Aug 2022 08:04:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661267090; x=1692803090; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zj5GRdQaa85EBVt9ESDyvR5NoyghiRnMhimXFv/8/fI=; b=jSpmrpgjfrLz2bdVUS/vskeSgxyhofsX8rA+aapunKh7nFiXchOIDGGN vkpya9E2TuIFgrfsX8IsZdKtJgXksD1j3Y5x0Grb4lpdsFbuKwzqRiNNP wC8dt6/cmQ9lbMLRy6QA7HENzU6eQsAg2qcsbdBV2RNKSmL2XrK3bTdvS iY74N+Mv+fpKnQ1EiagNZUWDEtN7bYxGmUZNu1n8H8PUFaK7fIA+3spc1 6FhV3XoEo07/lc9V3yTODW/en8Dsir7gNTj4denKvjvHLSu7lm7dWJT/C kTsEkjU+dsQeP21UhhWq2RWQMEY1CGV+sv24akRsSaN0JhNvowbZeMLjT Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10448"; a="273464967" X-IronPort-AV: E=Sophos;i="5.93,258,1654585200"; d="scan'208";a="273464967" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Aug 2022 08:04:50 -0700 X-IronPort-AV: E=Sophos;i="5.93,258,1654585200"; d="scan'208";a="854894272" Received: from jekeller-desk.amr.corp.intel.com (HELO jekeller-desk.jekeller.internal) ([10.166.241.7]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Aug 2022 08:04:49 -0700 From: Jacob Keller To: netdev@vger.kernel.org Cc: Jacob Keller , Paul Greenwalt , Jakub Kicinski Subject: [PATCH net-next 2/2] ice: add support for Auto FEC with FEC disabled via ETHTOOL_SFECPARAM Date: Tue, 23 Aug 2022 08:04:38 -0700 Message-Id: <20220823150438.3613327-3-jacob.e.keller@intel.com> X-Mailer: git-send-email 2.37.1.394.gc50926e1f488 In-Reply-To: <20220823150438.3613327-1-jacob.e.keller@intel.com> References: <20220823150438.3613327-1-jacob.e.keller@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The default Link Establishment State Machine (LESM) behavior does not allow the use of FEC disabled if the media does not support FEC disabled. However users may want to override this behavior. To support this, accept the ETHTOOL_FEC_AUTO | ETHTOOL_FEC_OFF as a request to automatically select an appropriate FEC mode including potentially disabling FEC. This is distinct from ETHTOOL_FEC_AUTO because that will not allow the LESM to select FEC disabled. It is distinct from ETHTOOL_FEC_OFF because FEC_OFF will always disable FEC without any LESM automatic selection. This *does* mean that ice is now accepting one "bitwise OR" set for FEC configuration, which is somewhat against the recommendations made in 6dbf94b264e6 ("ethtool: clarify the ethtool FEC interface"), but I am not sure if the addition of an entirely new ETHTOOL_FEC_AUTO_DIS would make any sense here. With this change, users can opt to allow automatic FEC disable via ethtool --set-fec ethX encoding auto off Signed-off-by: Paul Greenwalt Signed-off-by: Jacob Keller Cc: Jakub Kicinski --- .../net/ethernet/intel/ice/ice_adminq_cmd.h | 1 + drivers/net/ethernet/intel/ice/ice_common.c | 54 ++++++++++++++++++- drivers/net/ethernet/intel/ice/ice_common.h | 1 + drivers/net/ethernet/intel/ice/ice_ethtool.c | 11 +++- drivers/net/ethernet/intel/ice/ice_main.c | 3 +- drivers/net/ethernet/intel/ice/ice_type.h | 9 +++- 6 files changed, 74 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h index 9d2fa67d873e..5c5ebd70483c 100644 --- a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +++ b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h @@ -1123,6 +1123,7 @@ struct ice_aqc_get_phy_caps_data { #define ICE_AQC_PHY_FEC_25G_RS_528_REQ BIT(2) #define ICE_AQC_PHY_FEC_25G_KR_REQ BIT(3) #define ICE_AQC_PHY_FEC_25G_RS_544_REQ BIT(4) +#define ICE_AQC_PHY_FEC_DIS BIT(5) #define ICE_AQC_PHY_FEC_25G_RS_CLAUSE91_EN BIT(6) #define ICE_AQC_PHY_FEC_25G_KR_CLAUSE74_EN BIT(7) #define ICE_AQC_PHY_FEC_MASK ICE_M(0xdf, 0) diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c index 2c8c3fcc3dcd..96f51b7c9898 100644 --- a/drivers/net/ethernet/intel/ice/ice_common.c +++ b/drivers/net/ethernet/intel/ice/ice_common.c @@ -3253,8 +3253,11 @@ enum ice_fc_mode ice_caps_to_fc_mode(u8 caps) */ enum ice_fec_mode ice_caps_to_fec_mode(u8 caps, u8 fec_options) { - if (caps & ICE_AQC_PHY_EN_AUTO_FEC) + if (caps & ICE_AQC_PHY_EN_AUTO_FEC) { + if (fec_options & ICE_AQC_PHY_FEC_DIS) + return ICE_FEC_DIS_AUTO; return ICE_FEC_AUTO; + } if (fec_options & (ICE_AQC_PHY_FEC_10G_KR_40G_KR4_EN | ICE_AQC_PHY_FEC_10G_KR_40G_KR4_REQ | @@ -3513,6 +3516,12 @@ ice_cfg_phy_fec(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg, /* Clear all FEC option bits. */ cfg->link_fec_opt &= ~ICE_AQC_PHY_FEC_MASK; break; + case ICE_FEC_DIS_AUTO: + /* Set No FEC and auto FEC */ + if (!ice_fw_supports_fec_dis_auto(hw)) + return -EOPNOTSUPP; + cfg->link_fec_opt |= ICE_AQC_PHY_FEC_DIS; + fallthrough; case ICE_FEC_AUTO: /* AND auto FEC bit, and all caps bits. */ cfg->caps &= ICE_AQC_PHY_CAPS_MASK; @@ -5289,6 +5298,35 @@ ice_aq_get_gpio(struct ice_hw *hw, u16 gpio_ctrl_handle, u8 pin_idx, return 0; } +/** + * ice_is_fw_min_ver + * @hw: pointer to the hardware structure + * @branch: branch version + * @maj: major version + * @min: minor version + * @patch: patch version + * + * Checks if the firmware is minimum version + */ +static bool ice_is_fw_min_ver(struct ice_hw *hw, u8 branch, u8 maj, u8 min, + u8 patch) +{ + if (hw->fw_branch == branch) { + if (hw->fw_maj_ver > maj) + return true; + if (hw->fw_maj_ver == maj) { + if (hw->fw_min_ver > min) + return true; + if (hw->fw_min_ver == min && hw->fw_patch >= patch) + return true; + } + } else if (hw->fw_branch > branch) { + return true; + } + + return false; +} + /** * ice_fw_supports_link_override * @hw: pointer to the hardware structure @@ -5510,3 +5548,17 @@ bool ice_fw_supports_report_dflt_cfg(struct ice_hw *hw) } return false; } + +/** + * ice_fw_supports_fec_dis_auto + * @hw: pointer to the hardware structure + * + * Checks if the firmware supports FEC disable in Auto FEC mode + */ +bool ice_fw_supports_fec_dis_auto(struct ice_hw *hw) +{ + return ice_is_fw_min_ver(hw, ICE_FW_FEC_DIS_AUTO_BRANCH, + ICE_FW_FEC_DIS_AUTO_MAJ, + ICE_FW_FEC_DIS_AUTO_MIN, + ICE_FW_FEC_DIS_AUTO_PATCH); +} diff --git a/drivers/net/ethernet/intel/ice/ice_common.h b/drivers/net/ethernet/intel/ice/ice_common.h index f339bdc48062..a0baf80df356 100644 --- a/drivers/net/ethernet/intel/ice/ice_common.h +++ b/drivers/net/ethernet/intel/ice/ice_common.h @@ -110,6 +110,7 @@ int ice_aq_set_phy_cfg(struct ice_hw *hw, struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg, struct ice_sq_cd *cd); bool ice_fw_supports_link_override(struct ice_hw *hw); +bool ice_fw_supports_fec_dis_auto(struct ice_hw *hw); int ice_get_link_default_override(struct ice_link_default_override_tlv *ldo, struct ice_port_info *pi); diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c index 770101577a94..a83b127a00b0 100644 --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c @@ -1020,9 +1020,17 @@ ice_set_fecparam(struct net_device *netdev, struct ethtool_fecparam *fecparam, { struct ice_netdev_priv *np = netdev_priv(netdev); struct ice_vsi *vsi = np->vsi; + struct ice_pf *pf = vsi->back; enum ice_fec_mode fec; switch (fecparam->fec) { + case ETHTOOL_FEC_AUTO | ETHTOOL_FEC_OFF: + if (!ice_fw_supports_fec_dis_auto(&pf->hw)) { + NL_SET_ERR_MSG_MOD(extack, "FEC automatic disable is not supported by current firmware\n"); + return -EOPNOTSUPP; + } + fec = ICE_FEC_DIS_AUTO; + break; case ETHTOOL_FEC_AUTO: fec = ICE_FEC_AUTO; break; @@ -1037,8 +1045,7 @@ ice_set_fecparam(struct net_device *netdev, struct ethtool_fecparam *fecparam, fec = ICE_FEC_NONE; break; default: - dev_warn(ice_pf_to_dev(vsi->back), "Unsupported FEC mode: %d\n", - fecparam->fec); + NL_SET_ERR_MSG_MOD(extack, "Requested FEC mode is not supported\n"); return -EINVAL; } diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 3dbd91d8d83e..98fc40f20abd 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -2190,7 +2190,8 @@ static int ice_configure_phy(struct ice_vsi *vsi) ice_cfg_phy_fec(pi, cfg, phy->curr_user_fec_req); /* Can't provide what was requested; use PHY capabilities */ - if (cfg->link_fec_opt != + if (phy->curr_user_fec_req != ICE_FEC_DIS_AUTO && + cfg->link_fec_opt != (cfg->link_fec_opt & pcaps->link_fec_options)) { cfg->caps |= pcaps->caps & ICE_AQC_PHY_EN_AUTO_FEC; cfg->link_fec_opt = pcaps->link_fec_options; diff --git a/drivers/net/ethernet/intel/ice/ice_type.h b/drivers/net/ethernet/intel/ice/ice_type.h index e1abfcee96dc..0b71c40e881b 100644 --- a/drivers/net/ethernet/intel/ice/ice_type.h +++ b/drivers/net/ethernet/intel/ice/ice_type.h @@ -107,7 +107,8 @@ enum ice_fec_mode { ICE_FEC_NONE = 0, ICE_FEC_RS, ICE_FEC_BASER, - ICE_FEC_AUTO + ICE_FEC_AUTO, + ICE_FEC_DIS_AUTO }; struct ice_phy_cache_mode_data { @@ -1145,4 +1146,10 @@ struct ice_aq_get_set_rss_lut_params { #define ICE_FW_API_REPORT_DFLT_CFG_MIN 7 #define ICE_FW_API_REPORT_DFLT_CFG_PATCH 3 +/* FW version for FEC disable in Auto FEC mode */ +#define ICE_FW_FEC_DIS_AUTO_BRANCH 1 +#define ICE_FW_FEC_DIS_AUTO_MAJ 7 +#define ICE_FW_FEC_DIS_AUTO_MIN 0 +#define ICE_FW_FEC_DIS_AUTO_PATCH 5 + #endif /* _ICE_TYPE_H_ */