get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/1016404/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1016404,
    "url": "http://patchwork.ozlabs.org/api/patches/1016404/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20181219144542.85924-2-alice.michael@intel.com/",
    "project": {
        "id": 46,
        "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api",
        "name": "Intel Wired Ethernet development",
        "link_name": "intel-wired-lan",
        "list_id": "intel-wired-lan.osuosl.org",
        "list_email": "intel-wired-lan@osuosl.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20181219144542.85924-2-alice.michael@intel.com>",
    "list_archive_url": null,
    "date": "2018-12-19T14:45:38",
    "name": "[next,S1,2/6] i40e: Add support FEC configuration for Fortville 25G",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "73526fc13819a82d13590466d4d5dad2c43593b0",
    "submitter": {
        "id": 71123,
        "url": "http://patchwork.ozlabs.org/api/people/71123/?format=api",
        "name": "Michael, Alice",
        "email": "alice.michael@intel.com"
    },
    "delegate": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/users/68/?format=api",
        "username": "jtkirshe",
        "first_name": "Jeff",
        "last_name": "Kirsher",
        "email": "jeffrey.t.kirsher@intel.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20181219144542.85924-2-alice.michael@intel.com/mbox/",
    "series": [
        {
            "id": 82959,
            "url": "http://patchwork.ozlabs.org/api/series/82959/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=82959",
            "date": "2018-12-19T14:45:37",
            "name": "[next,S1,1/6] i40e: Limiting RSS queues to CPUs.",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/82959/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1016404/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1016404/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@osuosl.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=osuosl.org\n\t(client-ip=140.211.166.137; helo=fraxinus.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=intel.com"
        ],
        "Received": [
            "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 43Kr1C5zfRz9sCh\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 20 Dec 2018 09:59:11 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 7211F860FE;\n\tWed, 19 Dec 2018 22:59:10 +0000 (UTC)",
            "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id 474IIIno3RF8; Wed, 19 Dec 2018 22:59:07 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 281BB86108;\n\tWed, 19 Dec 2018 22:59:07 +0000 (UTC)",
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id 5D1421BF311\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 19 Dec 2018 22:59:05 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 58DDC221F8\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 19 Dec 2018 22:59:05 +0000 (UTC)",
            "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id qeDGGRxzCafh for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 19 Dec 2018 22:59:03 +0000 (UTC)",
            "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n\tby silver.osuosl.org (Postfix) with ESMTPS id E6DDE22803\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 19 Dec 2018 22:59:02 +0000 (UTC)",
            "from fmsmga008.fm.intel.com ([10.253.24.58])\n\tby fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t19 Dec 2018 14:59:02 -0800",
            "from alicemic-2.jf.intel.com ([10.166.16.121])\n\tby fmsmga008.fm.intel.com with ESMTP; 19 Dec 2018 14:59:02 -0800"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.56,374,1539673200\"; d=\"scan'208\";a=\"110769128\"",
        "From": "Alice Michael <alice.michael@intel.com>",
        "To": "alice.michael@intel.com,\n\tintel-wired-lan@lists.osuosl.org",
        "Date": "Wed, 19 Dec 2018 06:45:38 -0800",
        "Message-Id": "<20181219144542.85924-2-alice.michael@intel.com>",
        "X-Mailer": "git-send-email 2.19.2",
        "In-Reply-To": "<20181219144542.85924-1-alice.michael@intel.com>",
        "References": "<20181219144542.85924-1-alice.michael@intel.com>",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [next PATCH S1 2/6] i40e: Add support FEC\n\tconfiguration for Fortville 25G",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>",
        "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>",
        "Cc": "Damian Dybek <damian.dybek@intel.com>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "From: Damian Dybek <damian.dybek@intel.com>\n\nThis patch adds support for setting/getting FEC configuration\nusing ethtool options:\n       set/show-priv-flags rs-fec/base-r-fec\n       set/show-fec off/rs/baser/auto for kernels version >= 4.14\n\nSigned-off-by: Damian Dybek <damian.dybek@intel.com>\n---\n drivers/net/ethernet/intel/i40e/i40e.h        |   4 +\n .../net/ethernet/intel/i40e/i40e_ethtool.c    | 228 +++++++++++++++++-\n drivers/net/ethernet/intel/i40e/i40e_main.c   |  26 ++\n 3 files changed, 256 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h\nindex 45bbd2d4910b..107edcf2cf19 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e.h\n@@ -545,6 +545,8 @@ struct i40e_pf {\n #define I40E_FLAG_FD_SB_INACTIVE\t\tBIT(22)\n #define I40E_FLAG_FD_SB_TO_CLOUD_FILTER\t\tBIT(23)\n #define I40E_FLAG_DISABLE_FW_LLDP\t\tBIT(24)\n+#define I40E_FLAG_RS_FEC\t\t\tBIT(25)\n+#define I40E_FLAG_BASE_R_FEC\t\t\tBIT(26)\n \n \tstruct i40e_client_instance *cinst;\n \tbool stat_offsets_loaded;\n@@ -1114,6 +1116,8 @@ i40e_status i40e_set_partition_bw_setting(struct i40e_pf *pf);\n i40e_status i40e_commit_partition_bw_setting(struct i40e_pf *pf);\n void i40e_print_link_message(struct i40e_vsi *vsi, bool isup);\n \n+void i40e_set_fec_in_flags(u8 fec_cfg, u32 *flags);\n+\n static inline bool i40e_enabled_xdp_vsi(struct i40e_vsi *vsi)\n {\n \treturn !!vsi->xdp_prog;\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\nindex 399537bafce8..1592b8244661 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\n@@ -438,6 +438,8 @@ static const struct i40e_priv_flags i40e_gstrings_priv_flags[] = {\n \tI40E_PRIV_FLAG(\"disable-source-pruning\",\n \t\t       I40E_FLAG_SOURCE_PRUNING_DISABLED, 0),\n \tI40E_PRIV_FLAG(\"disable-fw-lldp\", I40E_FLAG_DISABLE_FW_LLDP, 0),\n+\tI40E_PRIV_FLAG(\"rs-fec\", I40E_FLAG_RS_FEC, 0),\n+\tI40E_PRIV_FLAG(\"base-r-fec\", I40E_FLAG_BASE_R_FEC, 0),\n };\n \n #define I40E_PRIV_FLAGS_STR_LEN ARRAY_SIZE(i40e_gstrings_priv_flags)\n@@ -606,6 +608,24 @@ static void i40e_phy_type_to_ethtool(struct i40e_pf *pf,\n \t\t\tethtool_link_ksettings_add_link_mode(ks, advertising,\n \t\t\t\t\t\t\t     25000baseCR_Full);\n \t}\n+\tif (phy_types & I40E_CAP_PHY_TYPE_25GBASE_KR ||\n+\t    phy_types & I40E_CAP_PHY_TYPE_25GBASE_CR ||\n+\t    phy_types & I40E_CAP_PHY_TYPE_25GBASE_SR ||\n+\t    phy_types & I40E_CAP_PHY_TYPE_25GBASE_LR ||\n+\t    phy_types & I40E_CAP_PHY_TYPE_25GBASE_AOC ||\n+\t    phy_types & I40E_CAP_PHY_TYPE_25GBASE_ACC) {\n+\t\tethtool_link_ksettings_add_link_mode(ks, supported, FEC_NONE);\n+\t\tethtool_link_ksettings_add_link_mode(ks, supported, FEC_RS);\n+\t\tethtool_link_ksettings_add_link_mode(ks, supported, FEC_BASER);\n+\t\tif (hw_link_info->requested_speeds & I40E_LINK_SPEED_25GB) {\n+\t\t\tethtool_link_ksettings_add_link_mode(ks, advertising,\n+\t\t\t\t\t\t\t     FEC_NONE);\n+\t\t\tethtool_link_ksettings_add_link_mode(ks, advertising,\n+\t\t\t\t\t\t\t     FEC_RS);\n+\t\t\tethtool_link_ksettings_add_link_mode(ks, advertising,\n+\t\t\t\t\t\t\t     FEC_BASER);\n+\t\t}\n+\t}\n \t/* need to add new 10G PHY types */\n \tif (phy_types & I40E_CAP_PHY_TYPE_10GBASE_CR1 ||\n \t    phy_types & I40E_CAP_PHY_TYPE_10GBASE_CR1_CU) {\n@@ -721,6 +741,13 @@ static void i40e_get_settings_link_up(struct i40e_hw *hw,\n \t\t\t\t\t\t     25000baseSR_Full);\n \t\tethtool_link_ksettings_add_link_mode(ks, advertising,\n \t\t\t\t\t\t     25000baseSR_Full);\n+\t\tethtool_link_ksettings_add_link_mode(ks, supported, FEC_NONE);\n+\t\tethtool_link_ksettings_add_link_mode(ks, supported, FEC_RS);\n+\t\tethtool_link_ksettings_add_link_mode(ks, supported, FEC_BASER);\n+\t\tethtool_link_ksettings_add_link_mode(ks, advertising, FEC_NONE);\n+\t\tethtool_link_ksettings_add_link_mode(ks, advertising, FEC_RS);\n+\t\tethtool_link_ksettings_add_link_mode(ks, advertising,\n+\t\t\t\t\t\t     FEC_BASER);\n \t\tethtool_link_ksettings_add_link_mode(ks, supported,\n \t\t\t\t\t\t     10000baseSR_Full);\n \t\tethtool_link_ksettings_add_link_mode(ks, advertising,\n@@ -825,6 +852,9 @@ static void i40e_get_settings_link_up(struct i40e_hw *hw,\n \t\t\t\t\t\t     40000baseKR4_Full);\n \t\tethtool_link_ksettings_add_link_mode(ks, supported,\n \t\t\t\t\t\t     25000baseKR_Full);\n+\t\tethtool_link_ksettings_add_link_mode(ks, supported, FEC_NONE);\n+\t\tethtool_link_ksettings_add_link_mode(ks, supported, FEC_RS);\n+\t\tethtool_link_ksettings_add_link_mode(ks, supported, FEC_BASER);\n \t\tethtool_link_ksettings_add_link_mode(ks, supported,\n \t\t\t\t\t\t     20000baseKR2_Full);\n \t\tethtool_link_ksettings_add_link_mode(ks, supported,\n@@ -838,6 +868,10 @@ static void i40e_get_settings_link_up(struct i40e_hw *hw,\n \t\t\t\t\t\t     40000baseKR4_Full);\n \t\tethtool_link_ksettings_add_link_mode(ks, advertising,\n \t\t\t\t\t\t     25000baseKR_Full);\n+\t\tethtool_link_ksettings_add_link_mode(ks, advertising, FEC_NONE);\n+\t\tethtool_link_ksettings_add_link_mode(ks, advertising, FEC_RS);\n+\t\tethtool_link_ksettings_add_link_mode(ks, advertising,\n+\t\t\t\t\t\t     FEC_BASER);\n \t\tethtool_link_ksettings_add_link_mode(ks, advertising,\n \t\t\t\t\t\t     20000baseKR2_Full);\n \t\tethtool_link_ksettings_add_link_mode(ks, advertising,\n@@ -855,6 +889,13 @@ static void i40e_get_settings_link_up(struct i40e_hw *hw,\n \t\t\t\t\t\t     25000baseCR_Full);\n \t\tethtool_link_ksettings_add_link_mode(ks, advertising,\n \t\t\t\t\t\t     25000baseCR_Full);\n+\t\tethtool_link_ksettings_add_link_mode(ks, supported, FEC_NONE);\n+\t\tethtool_link_ksettings_add_link_mode(ks, supported, FEC_RS);\n+\t\tethtool_link_ksettings_add_link_mode(ks, supported, FEC_BASER);\n+\t\tethtool_link_ksettings_add_link_mode(ks, advertising, FEC_NONE);\n+\t\tethtool_link_ksettings_add_link_mode(ks, advertising, FEC_RS);\n+\t\tethtool_link_ksettings_add_link_mode(ks, advertising,\n+\t\t\t\t\t\t     FEC_BASER);\n \t\tbreak;\n \tcase I40E_PHY_TYPE_25GBASE_AOC:\n \tcase I40E_PHY_TYPE_25GBASE_ACC:\n@@ -862,9 +903,15 @@ static void i40e_get_settings_link_up(struct i40e_hw *hw,\n \t\tethtool_link_ksettings_add_link_mode(ks, advertising, Autoneg);\n \t\tethtool_link_ksettings_add_link_mode(ks, supported,\n \t\t\t\t\t\t     25000baseCR_Full);\n-\n \t\tethtool_link_ksettings_add_link_mode(ks, advertising,\n \t\t\t\t\t\t     25000baseCR_Full);\n+\t\tethtool_link_ksettings_add_link_mode(ks, supported, FEC_NONE);\n+\t\tethtool_link_ksettings_add_link_mode(ks, supported, FEC_RS);\n+\t\tethtool_link_ksettings_add_link_mode(ks, supported, FEC_BASER);\n+\t\tethtool_link_ksettings_add_link_mode(ks, advertising, FEC_NONE);\n+\t\tethtool_link_ksettings_add_link_mode(ks, advertising, FEC_RS);\n+\t\tethtool_link_ksettings_add_link_mode(ks, advertising,\n+\t\t\t\t\t\t     FEC_BASER);\n \t\tethtool_link_ksettings_add_link_mode(ks, supported,\n \t\t\t\t\t\t     10000baseCR_Full);\n \t\tethtool_link_ksettings_add_link_mode(ks, advertising,\n@@ -1261,6 +1308,154 @@ static int i40e_set_link_ksettings(struct net_device *netdev,\n \treturn err;\n }\n \n+static int i40e_set_fec_cfg(struct net_device *netdev, u8 fec_cfg)\n+{\n+\tstruct i40e_netdev_priv *np = netdev_priv(netdev);\n+\tstruct i40e_aq_get_phy_abilities_resp abilities;\n+\tstruct i40e_pf *pf = np->vsi->back;\n+\tstruct i40e_hw *hw = &pf->hw;\n+\ti40e_status status = 0;\n+\tu32 flags = 0;\n+\tint err = 0;\n+\n+\tflags = READ_ONCE(pf->flags);\n+\ti40e_set_fec_in_flags(fec_cfg, &flags);\n+\n+\t/* Get the current phy config */\n+\tmemset(&abilities, 0, sizeof(abilities));\n+\tstatus = i40e_aq_get_phy_capabilities(hw, false, false, &abilities,\n+\t\t\t\t\t      NULL);\n+\tif (status) {\n+\t\terr = -EAGAIN;\n+\t\tgoto done;\n+\t}\n+\n+\tif (abilities.fec_cfg_curr_mod_ext_info != fec_cfg) {\n+\t\tstruct i40e_aq_set_phy_config config;\n+\n+\t\tmemset(&config, 0, sizeof(config));\n+\t\tconfig.phy_type = abilities.phy_type;\n+\t\tconfig.abilities = abilities.abilities;\n+\t\tconfig.phy_type_ext = abilities.phy_type_ext;\n+\t\tconfig.link_speed = abilities.link_speed;\n+\t\tconfig.eee_capability = abilities.eee_capability;\n+\t\tconfig.eeer = abilities.eeer_val;\n+\t\tconfig.low_power_ctrl = abilities.d3_lpan;\n+\t\tconfig.fec_config = fec_cfg & I40E_AQ_PHY_FEC_CONFIG_MASK;\n+\t\tstatus = i40e_aq_set_phy_config(hw, &config, NULL);\n+\t\tif (status) {\n+\t\t\tnetdev_info(netdev,\n+\t\t\t\t    \"Set phy config failed, err %s aq_err %s\\n\",\n+\t\t\t\t    i40e_stat_str(hw, status),\n+\t\t\t\t    i40e_aq_str(hw, hw->aq.asq_last_status));\n+\t\t\terr = -EAGAIN;\n+\t\t\tgoto done;\n+\t\t}\n+\t\tpf->flags = flags;\n+\t\tstatus = i40e_update_link_info(hw);\n+\t\tif (status)\n+\t\t\t/* debug level message only due to relation to the link\n+\t\t\t * itself rather than to the FEC settings\n+\t\t\t * (e.g. no physical connection etc.)\n+\t\t\t */\n+\t\t\tnetdev_dbg(netdev,\n+\t\t\t\t   \"Updating link info failed with err %s aq_err %s\\n\",\n+\t\t\t\t   i40e_stat_str(hw, status),\n+\t\t\t\t   i40e_aq_str(hw, hw->aq.asq_last_status));\n+\t}\n+\n+done:\n+\treturn err;\n+}\n+\n+static int i40e_get_fec_param(struct net_device *netdev,\n+\t\t\t      struct ethtool_fecparam *fecparam)\n+{\n+\tstruct i40e_netdev_priv *np = netdev_priv(netdev);\n+\tstruct i40e_aq_get_phy_abilities_resp abilities;\n+\tstruct i40e_pf *pf = np->vsi->back;\n+\tstruct i40e_hw *hw = &pf->hw;\n+\ti40e_status status = 0;\n+\tint err = 0;\n+\n+\t/* Get the current phy config */\n+\tmemset(&abilities, 0, sizeof(abilities));\n+\tstatus = i40e_aq_get_phy_capabilities(hw, false, false, &abilities,\n+\t\t\t\t\t      NULL);\n+\tif (status) {\n+\t\terr = -EAGAIN;\n+\t\tgoto done;\n+\t}\n+\n+\tfecparam->fec = 0;\n+\tif (abilities.fec_cfg_curr_mod_ext_info & I40E_AQ_SET_FEC_AUTO)\n+\t\tfecparam->fec |= ETHTOOL_FEC_AUTO;\n+\tif ((abilities.fec_cfg_curr_mod_ext_info &\n+\t     I40E_AQ_SET_FEC_REQUEST_RS) ||\n+\t    (abilities.fec_cfg_curr_mod_ext_info &\n+\t     I40E_AQ_SET_FEC_ABILITY_RS))\n+\t\tfecparam->fec |= ETHTOOL_FEC_RS;\n+\tif ((abilities.fec_cfg_curr_mod_ext_info &\n+\t     I40E_AQ_SET_FEC_REQUEST_KR) ||\n+\t    (abilities.fec_cfg_curr_mod_ext_info & I40E_AQ_SET_FEC_ABILITY_KR))\n+\t\tfecparam->fec |= ETHTOOL_FEC_BASER;\n+\tif (abilities.fec_cfg_curr_mod_ext_info == 0)\n+\t\tfecparam->fec |= ETHTOOL_FEC_OFF;\n+\n+\tif (hw->phy.link_info.fec_info & I40E_AQ_CONFIG_FEC_KR_ENA)\n+\t\tfecparam->active_fec = ETHTOOL_FEC_BASER;\n+\telse if (hw->phy.link_info.fec_info & I40E_AQ_CONFIG_FEC_RS_ENA)\n+\t\tfecparam->active_fec = ETHTOOL_FEC_RS;\n+\telse\n+\t\tfecparam->active_fec = ETHTOOL_FEC_OFF;\n+done:\n+\treturn err;\n+}\n+\n+static int i40e_set_fec_param(struct net_device *netdev,\n+\t\t\t      struct ethtool_fecparam *fecparam)\n+{\n+\tstruct i40e_netdev_priv *np = netdev_priv(netdev);\n+\tstruct i40e_pf *pf = np->vsi->back;\n+\tstruct i40e_hw *hw = &pf->hw;\n+\tu8 fec_cfg = 0;\n+\tint err = 0;\n+\n+\tif (hw->device_id != I40E_DEV_ID_25G_SFP28 &&\n+\t    hw->device_id != I40E_DEV_ID_25G_B) {\n+\t\terr = -EPERM;\n+\t\tgoto done;\n+\t}\n+\n+\tswitch (fecparam->fec) {\n+\tcase ETHTOOL_FEC_AUTO:\n+\t\tfec_cfg = I40E_AQ_SET_FEC_AUTO;\n+\t\tbreak;\n+\tcase ETHTOOL_FEC_RS:\n+\t\tfec_cfg = (I40E_AQ_SET_FEC_REQUEST_RS |\n+\t\t\t     I40E_AQ_SET_FEC_ABILITY_RS);\n+\t\tbreak;\n+\tcase ETHTOOL_FEC_BASER:\n+\t\tfec_cfg = (I40E_AQ_SET_FEC_REQUEST_KR |\n+\t\t\t     I40E_AQ_SET_FEC_ABILITY_KR);\n+\t\tbreak;\n+\tcase ETHTOOL_FEC_OFF:\n+\tcase ETHTOOL_FEC_NONE:\n+\t\tfec_cfg = 0;\n+\t\tbreak;\n+\tdefault:\n+\t\tdev_warn(&pf->pdev->dev, \"Unsupported FEC mode: %d\",\n+\t\t\t fecparam->fec);\n+\t\terr = -EINVAL;\n+\t\tgoto done;\n+\t}\n+\n+\terr = i40e_set_fec_cfg(netdev, fec_cfg);\n+\n+done:\n+\treturn err;\n+}\n+\n static int i40e_nway_reset(struct net_device *netdev)\n {\n \t/* restart autonegotiation */\n@@ -1376,7 +1571,7 @@ static int i40e_set_pauseparam(struct net_device *netdev,\n \telse if (!pause->rx_pause && !pause->tx_pause)\n \t\thw->fc.requested_mode = I40E_FC_NONE;\n \telse\n-\t\t return -EINVAL;\n+\t\treturn -EINVAL;\n \n \t/* Tell the OS link is going down, the link will go back up when fw\n \t * says it is ready asynchronously\n@@ -4676,6 +4871,15 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)\n \t\t}\n \t}\n \n+\tif (((changed_flags & I40E_FLAG_RS_FEC) ||\n+\t     (changed_flags & I40E_FLAG_BASE_R_FEC)) &&\n+\t    pf->hw.device_id != I40E_DEV_ID_25G_SFP28 &&\n+\t    pf->hw.device_id != I40E_DEV_ID_25G_B) {\n+\t\tdev_warn(&pf->pdev->dev,\n+\t\t\t \"Device does not support changing FEC configuration\\n\");\n+\t\treturn -EOPNOTSUPP;\n+\t}\n+\n \t/* Now that we've checked to ensure that the new flags are valid, load\n \t * them into place. Since we only modify flags either (a) during\n \t * initialization or (b) while holding the RTNL lock, we don't need\n@@ -4714,6 +4918,24 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)\n \t\t}\n \t}\n \n+\tif ((changed_flags & I40E_FLAG_RS_FEC) ||\n+\t    (changed_flags & I40E_FLAG_BASE_R_FEC)) {\n+\t\tu8 fec_cfg = 0;\n+\n+\t\tif (pf->flags & I40E_FLAG_RS_FEC &&\n+\t\t    pf->flags & I40E_FLAG_BASE_R_FEC) {\n+\t\t\tfec_cfg = I40E_AQ_SET_FEC_AUTO;\n+\t\t} else if (pf->flags & I40E_FLAG_RS_FEC) {\n+\t\t\tfec_cfg = (I40E_AQ_SET_FEC_REQUEST_RS |\n+\t\t\t\t   I40E_AQ_SET_FEC_ABILITY_RS);\n+\t\t} else if (pf->flags & I40E_FLAG_BASE_R_FEC) {\n+\t\t\tfec_cfg = (I40E_AQ_SET_FEC_REQUEST_KR |\n+\t\t\t\t   I40E_AQ_SET_FEC_ABILITY_KR);\n+\t\t}\n+\t\tif (i40e_set_fec_cfg(dev, fec_cfg))\n+\t\t\tdev_warn(&pf->pdev->dev, \"Cannot change FEC config\\n\");\n+\t}\n+\n \tif ((changed_flags & pf->flags &\n \t     I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED) &&\n \t    (pf->flags & I40E_FLAG_MFP_ENABLED))\n@@ -4954,6 +5176,8 @@ static const struct ethtool_ops i40e_ethtool_ops = {\n \t.set_per_queue_coalesce\t= i40e_set_per_queue_coalesce,\n \t.get_link_ksettings\t= i40e_get_link_ksettings,\n \t.set_link_ksettings\t= i40e_set_link_ksettings,\n+\t.get_fecparam = i40e_get_fec_param,\n+\t.set_fecparam = i40e_set_fec_param,\n };\n \n void i40e_set_ethtool_ops(struct net_device *netdev)\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex b4ae4ba84aa3..c001e0279af3 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -14500,6 +14500,29 @@ static int i40e_init_recovery_mode(struct i40e_pf *pf, struct i40e_hw *hw)\n \treturn err;\n }\n \n+/**\n+ * i40e_set_fec_in_flags - helper function for setting FEC options in flags\n+ * @fec_cfg: FEC option to set in flags\n+ * @flags: ptr to flags in which we set FEC option\n+ **/\n+void i40e_set_fec_in_flags(u8 fec_cfg, u32 *flags)\n+{\n+\tif (fec_cfg & I40E_AQ_SET_FEC_AUTO)\n+\t\t*flags |= I40E_FLAG_RS_FEC | I40E_FLAG_BASE_R_FEC;\n+\tif ((fec_cfg & I40E_AQ_SET_FEC_REQUEST_RS) ||\n+\t    (fec_cfg & I40E_AQ_SET_FEC_ABILITY_RS)) {\n+\t\t*flags |= I40E_FLAG_RS_FEC;\n+\t\t*flags &= ~I40E_FLAG_BASE_R_FEC;\n+\t}\n+\tif ((fec_cfg & I40E_AQ_SET_FEC_REQUEST_KR) ||\n+\t    (fec_cfg & I40E_AQ_SET_FEC_ABILITY_KR)) {\n+\t\t*flags |= I40E_FLAG_BASE_R_FEC;\n+\t\t*flags &= ~I40E_FLAG_RS_FEC;\n+\t}\n+\tif (fec_cfg == 0)\n+\t\t*flags &= ~(I40E_FLAG_RS_FEC | I40E_FLAG_BASE_R_FEC);\n+}\n+\n /**\n  * i40e_probe - Device initialization routine\n  * @pdev: PCI device information struct\n@@ -14997,6 +15020,9 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)\n \t\t\ti40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));\n \tpf->hw.phy.link_info.requested_speeds = abilities.link_speed;\n \n+\t/* set the FEC config due to the board capabilities */\n+\ti40e_set_fec_in_flags(abilities.fec_cfg_curr_mod_ext_info, &pf->flags);\n+\n \t/* get the supported phy types from the fw */\n \terr = i40e_aq_get_phy_capabilities(hw, false, true, &abilities, NULL);\n \tif (err)\n",
    "prefixes": [
        "next",
        "S1",
        "2/6"
    ]
}