get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1137037,
    "url": "http://patchwork.ozlabs.org/api/patches/1137037/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20190725085541.55104-1-anthony.l.nguyen@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": "<20190725085541.55104-1-anthony.l.nguyen@intel.com>",
    "list_archive_url": null,
    "date": "2019-07-25T08:55:27",
    "name": "[S23,v4,01/15] ice: Implement ethtool ops for channels",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "421a8419f3c796f9b847801d496700b3dd643938",
    "submitter": {
        "id": 68875,
        "url": "http://patchwork.ozlabs.org/api/people/68875/?format=api",
        "name": "Tony Nguyen",
        "email": "anthony.l.nguyen@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/20190725085541.55104-1-anthony.l.nguyen@intel.com/mbox/",
    "series": [
        {
            "id": 121506,
            "url": "http://patchwork.ozlabs.org/api/series/121506/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=121506",
            "date": "2019-07-25T08:55:36",
            "name": "[S23,v4,01/15] ice: Implement ethtool ops for channels",
            "version": 4,
            "mbox": "http://patchwork.ozlabs.org/series/121506/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1137037/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1137037/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.138; helo=whitealder.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 whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\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 45vfG8143Jz9s8m\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 26 Jul 2019 03:24:15 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 98537866B1;\n\tThu, 25 Jul 2019 17:24:14 +0000 (UTC)",
            "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id oqz3AadVLaBM; Thu, 25 Jul 2019 17:24:07 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 4C16A869E1;\n\tThu, 25 Jul 2019 17:24:05 +0000 (UTC)",
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id 304811BF9BF\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 25 Jul 2019 17:24:01 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 2BE7E22253\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 25 Jul 2019 17:24:01 +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 JFRpdZrdd5Jd for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 25 Jul 2019 17:23:58 +0000 (UTC)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby silver.osuosl.org (Postfix) with ESMTPS id 266742262B\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 25 Jul 2019 17:23:58 +0000 (UTC)",
            "from orsmga007.jf.intel.com ([10.7.209.58])\n\tby orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t25 Jul 2019 10:23:56 -0700",
            "from unknown (HELO localhost.jf.intel.com) ([10.166.244.174])\n\tby orsmga007.jf.intel.com with ESMTP; 25 Jul 2019 10:23:56 -0700"
        ],
        "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.64,307,1559545200\"; d=\"scan'208\";a=\"160973702\"",
        "From": "Tony Nguyen <anthony.l.nguyen@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Thu, 25 Jul 2019 01:55:27 -0700",
        "Message-Id": "<20190725085541.55104-1-anthony.l.nguyen@intel.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [PATCH S23 v4 01/15] ice: Implement ethtool ops\n\tfor channels",
        "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>",
        "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: Henry Tieman <henry.w.tieman@intel.com>\n\nAdd code to query and set the number of queues on the primary\nVSI for a PF. This is accessed from the 'ethtool -l' and 'ethtool -L'\ncommands, respectively.\n\nSigned-off-by: Henry Tieman <henry.w.tieman@intel.com>\nSigned-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice.h         |  4 +\n drivers/net/ethernet/intel/ice/ice_dcb_lib.c |  9 +-\n drivers/net/ethernet/intel/ice/ice_dcb_lib.h |  2 +\n drivers/net/ethernet/intel/ice/ice_ethtool.c | 85 ++++++++++++++++++\n drivers/net/ethernet/intel/ice/ice_lib.c     | 52 ++++++++---\n drivers/net/ethernet/intel/ice/ice_lib.h     |  2 +-\n drivers/net/ethernet/intel/ice/ice_main.c    | 91 +++++++++++++++++++-\n 7 files changed, 230 insertions(+), 15 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h\nindex 794d97460fc7..07950ac4869f 100644\n--- a/drivers/net/ethernet/intel/ice/ice.h\n+++ b/drivers/net/ethernet/intel/ice/ice.h\n@@ -298,6 +298,8 @@ struct ice_vsi {\n \tu16 num_txq;\t\t\t /* Used Tx queues */\n \tu16 alloc_rxq;\t\t\t /* Allocated Rx queues */\n \tu16 num_rxq;\t\t\t /* Used Rx queues */\n+\tu16 req_txq;\t\t\t /* User requested Tx queues */\n+\tu16 req_rxq;\t\t\t /* User requested Rx queues */\n \tu16 num_rx_desc;\n \tu16 num_tx_desc;\n \tstruct ice_tc_cfg tc_cfg;\n@@ -455,6 +457,7 @@ ice_find_vsi_by_type(struct ice_pf *pf, enum ice_vsi_type type)\n int ice_vsi_setup_tx_rings(struct ice_vsi *vsi);\n int ice_vsi_setup_rx_rings(struct ice_vsi *vsi);\n void ice_set_ethtool_ops(struct net_device *netdev);\n+int ice_vsi_recfg_qs(struct ice_vsi *vsi, int new_rx, int new_tx);\n int ice_up(struct ice_vsi *vsi);\n int ice_down(struct ice_vsi *vsi);\n int ice_vsi_cfg(struct ice_vsi *vsi);\n@@ -462,6 +465,7 @@ struct ice_vsi *ice_lb_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi);\n int ice_set_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size);\n int ice_get_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size);\n void ice_fill_rss_lut(u8 *lut, u16 rss_table_size, u16 rss_size);\n+int ice_schedule_reset(struct ice_pf *pf, enum ice_reset_req reset);\n void ice_print_link_msg(struct ice_vsi *vsi, bool isup);\n #ifdef CONFIG_DCB\n int ice_pf_ena_all_vsi(struct ice_pf *pf, bool locked);\ndiff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c\nindex fe88b127ca42..f80628a13f2a 100644\n--- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c\n+++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c\n@@ -85,11 +85,16 @@ void ice_vsi_cfg_dcb_rings(struct ice_vsi *vsi)\n \t\t\tbreak;\n \n \t\tqoffset = vsi->tc_cfg.tc_info[n].qoffset;\n+\n \t\tqcount = vsi->tc_cfg.tc_info[n].qcount_tx;\n \t\tfor (i = qoffset; i < (qoffset + qcount); i++) {\n \t\t\ttx_ring = vsi->tx_rings[i];\n-\t\t\trx_ring = vsi->rx_rings[i];\n \t\t\ttx_ring->dcb_tc = n;\n+\t\t}\n+\n+\t\tqcount = vsi->tc_cfg.tc_info[n].qcount_rx;\n+\t\tfor (i = qoffset; i < (qoffset + qcount); i++) {\n+\t\t\trx_ring = vsi->rx_rings[i];\n \t\t\trx_ring->dcb_tc = n;\n \t\t}\n \t}\n@@ -103,7 +108,7 @@ void ice_vsi_cfg_dcb_rings(struct ice_vsi *vsi)\n  * calling this function. Reconfiguring DCB based on\n  * local_dcbx_cfg.\n  */\n-static void ice_pf_dcb_recfg(struct ice_pf *pf)\n+void ice_pf_dcb_recfg(struct ice_pf *pf)\n {\n \tstruct ice_dcbx_cfg *dcbcfg = &pf->hw.port_info->local_dcbx_cfg;\n \tu8 tc_map = 0;\ndiff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.h b/drivers/net/ethernet/intel/ice/ice_dcb_lib.h\nindex 819081053ff5..be2ab6f20b21 100644\n--- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.h\n+++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.h\n@@ -13,6 +13,7 @@\n void ice_dcb_rebuild(struct ice_pf *pf);\n u8 ice_dcb_get_ena_tc(struct ice_dcbx_cfg *dcbcfg);\n u8 ice_dcb_get_num_tc(struct ice_dcbx_cfg *dcbcfg);\n+void ice_pf_dcb_recfg(struct ice_pf *pf);\n void ice_vsi_cfg_dcb_rings(struct ice_vsi *vsi);\n int ice_init_pf_dcb(struct ice_pf *pf, bool locked);\n void ice_update_dcb_stats(struct ice_pf *pf);\n@@ -55,6 +56,7 @@ ice_tx_prepare_vlan_flags_dcb(struct ice_ring __always_unused *tx_ring,\n }\n \n #define ice_update_dcb_stats(pf) do {} while (0)\n+#define ice_pf_dcb_recfg(pf) do {} while (0)\n #define ice_vsi_cfg_dcb_rings(vsi) do {} while (0)\n #define ice_dcb_process_lldp_set_mib_change(pf, event) do {} while (0)\n #define ice_set_cgd_num(tlan_ctx, ring) do {} while (0)\ndiff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c\nindex d3ba535bd65a..1fe048cfb737 100644\n--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c\n+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c\n@@ -3083,6 +3083,89 @@ ice_set_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key,\n \treturn 0;\n }\n \n+/**\n+ * ice_get_max_txq - return the maximum number of Tx queues for in a PF\n+ * @pf: PF structure\n+ */\n+static int ice_get_max_txq(struct ice_pf *pf)\n+{\n+\treturn min_t(int, num_online_cpus(),\n+\t\t     pf->hw.func_caps.common_cap.num_txq);\n+}\n+\n+/**\n+ * ice_get_max_rxq - return the maximum number of Rx queues for in a PF\n+ * @pf: PF structure\n+ */\n+static int ice_get_max_rxq(struct ice_pf *pf)\n+{\n+\treturn min_t(int, num_online_cpus(),\n+\t\t     pf->hw.func_caps.common_cap.num_rxq);\n+}\n+\n+/**\n+ * ice_get_channels - get the current and max supported channels\n+ * @dev: network interface device structure\n+ * @ch: ethtool channel data structure\n+ */\n+static void\n+ice_get_channels(struct net_device *dev, struct ethtool_channels *ch)\n+{\n+\tstruct ice_netdev_priv *np = netdev_priv(dev);\n+\tstruct ice_vsi *vsi = np->vsi;\n+\tstruct ice_pf *pf = vsi->back;\n+\n+\t/* check to see if VSI is active */\n+\tif (test_bit(__ICE_DOWN, vsi->state))\n+\t\treturn;\n+\n+\t/* report maximum channels */\n+\tch->max_rx = ice_get_max_rxq(pf);\n+\tch->max_tx = ice_get_max_txq(pf);\n+\n+\t/* report current channels */\n+\tch->rx_count = vsi->num_rxq;\n+\tch->tx_count = vsi->num_txq;\n+}\n+\n+/**\n+ * ice_set_channels - set the number channels\n+ * @dev: network interface device structure\n+ * @ch: ethtool channel data structure\n+ */\n+static int ice_set_channels(struct net_device *dev, struct ethtool_channels *ch)\n+{\n+\tstruct ice_netdev_priv *np = netdev_priv(dev);\n+\tstruct ice_vsi *vsi = np->vsi;\n+\tstruct ice_pf *pf = vsi->back;\n+\tint new_rx = 0, new_tx = 0;\n+\n+\t/* do not support changing other_count */\n+\tif (ch->other_count)\n+\t\treturn -EINVAL;\n+\n+\t/* verify request for a valid number of channels */\n+\tif (ch->rx_count > ice_get_max_rxq(pf) ||\n+\t    ch->tx_count > ice_get_max_txq(pf))\n+\t\treturn -EINVAL;\n+\n+\t/* Use new Rx value only if changed */\n+\tif (ch->rx_count != vsi->num_rxq)\n+\t\tnew_rx = ch->rx_count;\n+\n+\t/* Use new Tx value only if changed */\n+\tif (ch->tx_count != vsi->num_txq)\n+\t\tnew_tx = ch->tx_count;\n+\n+\t/* verify that we have a valid request */\n+\tif (!new_rx && !new_tx)\n+\t\treturn -EINVAL;\n+\n+\tice_vsi_recfg_qs(vsi, new_rx, new_tx);\n+\n+\treturn 0;\n+}\n+\n enum ice_container_type {\n \tICE_RX_CONTAINER,\n \tICE_TX_CONTAINER,\n@@ -3429,6 +3512,8 @@ static const struct ethtool_ops ice_ethtool_ops = {\n \t.get_rxfh_indir_size\t= ice_get_rxfh_indir_size,\n \t.get_rxfh\t\t= ice_get_rxfh,\n \t.set_rxfh\t\t= ice_set_rxfh,\n+\t.get_channels\t\t= ice_get_channels,\n+\t.set_channels\t\t= ice_set_channels,\n \t.get_ts_info\t\t= ethtool_op_get_ts_info,\n \t.get_per_queue_coalesce = ice_get_per_q_coalesce,\n \t.set_per_queue_coalesce = ice_set_per_q_coalesce,\ndiff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c\nindex 6e34c40e7840..a62496a74a69 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.c\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.c\n@@ -313,6 +313,14 @@ static void ice_vsi_set_num_qs(struct ice_vsi *vsi, u16 vf_id)\n \tcase ICE_VSI_PF:\n \t\tvsi->alloc_txq = pf->num_lan_tx;\n \t\tvsi->alloc_rxq = pf->num_lan_rx;\n+\t\tif (vsi->req_txq) {\n+\t\t\tvsi->alloc_txq = vsi->req_txq;\n+\t\t\tvsi->num_txq = vsi->req_txq;\n+\t\t}\n+\t\tif (vsi->req_rxq) {\n+\t\t\tvsi->alloc_rxq = vsi->req_rxq;\n+\t\t\tvsi->num_rxq = vsi->req_rxq;\n+\t\t}\n \t\tvsi->num_q_vectors = max_t(int, pf->num_lan_rx, pf->num_lan_tx);\n \t\tbreak;\n \tcase ICE_VSI_VF:\n@@ -855,7 +863,9 @@ static void ice_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt)\n \t\t\telse\n \t\t\t\tmax_rss = ICE_MAX_SMALL_RSS_QS;\n \t\t\tqcount_rx = min_t(int, rx_numq_tc, max_rss);\n-\t\t\tqcount_rx = min_t(int, qcount_rx, vsi->rss_size);\n+\t\t\tif (!vsi->req_rxq)\n+\t\t\t\tqcount_rx = min_t(int, qcount_rx,\n+\t\t\t\t\t\t  vsi->rss_size);\n \t\t}\n \t}\n \n@@ -959,11 +969,12 @@ static void ice_set_rss_vsi_ctx(struct ice_vsi_ctx *ctxt, struct ice_vsi *vsi)\n /**\n  * ice_vsi_init - Create and initialize a VSI\n  * @vsi: the VSI being configured\n+ * @init_vsi: is this call creating a VSI\n  *\n  * This initializes a VSI context depending on the VSI type to be added and\n  * passes it down to the add_vsi aq command to create a new VSI.\n  */\n-static int ice_vsi_init(struct ice_vsi *vsi)\n+static int ice_vsi_init(struct ice_vsi *vsi, bool init_vsi)\n {\n \tstruct ice_pf *pf = vsi->back;\n \tstruct ice_hw *hw = &pf->hw;\n@@ -1010,11 +1021,20 @@ static int ice_vsi_init(struct ice_vsi *vsi)\n \t\t\tICE_AQ_VSI_SEC_FLAG_ENA_MAC_ANTI_SPOOF;\n \t}\n \n-\tret = ice_add_vsi(hw, vsi->idx, ctxt, NULL);\n-\tif (ret) {\n-\t\tdev_err(&pf->pdev->dev,\n-\t\t\t\"Add VSI failed, err %d\\n\", ret);\n-\t\treturn -EIO;\n+\tif (init_vsi) {\n+\t\tret = ice_add_vsi(hw, vsi->idx, ctxt, NULL);\n+\t\tif (ret) {\n+\t\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\t\"Add VSI failed, err %d\\n\", ret);\n+\t\t\treturn -EIO;\n+\t\t}\n+\t} else {\n+\t\tret = ice_update_vsi(hw, vsi->idx, ctxt, NULL);\n+\t\tif (ret) {\n+\t\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\t\"Update VSI failed, err %d\\n\", ret);\n+\t\t\treturn -EIO;\n+\t\t}\n \t}\n \n \t/* keep context for update VSI operations */\n@@ -2435,7 +2455,7 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi,\n \tice_vsi_set_tc_cfg(vsi);\n \n \t/* create the VSI */\n-\tret = ice_vsi_init(vsi);\n+\tret = ice_vsi_init(vsi, true);\n \tif (ret)\n \t\tgoto unroll_get_qs;\n \n@@ -2911,10 +2931,11 @@ int ice_vsi_release(struct ice_vsi *vsi)\n /**\n  * ice_vsi_rebuild - Rebuild VSI after reset\n  * @vsi: VSI to be rebuild\n+ * @init_vsi: is this an initialization or a reconfigure of the VSI\n  *\n  * Returns 0 on success and negative value on failure\n  */\n-int ice_vsi_rebuild(struct ice_vsi *vsi)\n+int ice_vsi_rebuild(struct ice_vsi *vsi, bool init_vsi)\n {\n \tu16 max_txqs[ICE_MAX_TRAFFIC_CLASS] = { 0 };\n \tstruct ice_vf *vf = NULL;\n@@ -2947,14 +2968,18 @@ int ice_vsi_rebuild(struct ice_vsi *vsi)\n \tice_vsi_clear_rings(vsi);\n \tice_vsi_free_arrays(vsi);\n \tice_dev_onetime_setup(&pf->hw);\n+\tif (vsi->req_txq || vsi->req_rxq)\n+\t\tice_vsi_put_qs(vsi);\n \tif (vsi->type == ICE_VSI_VF)\n \t\tice_vsi_set_num_qs(vsi, vf->vf_id);\n \telse\n \t\tice_vsi_set_num_qs(vsi, ICE_INVAL_VFID);\n+\tif (vsi->req_txq || vsi->req_rxq)\n+\t\tice_vsi_get_qs(vsi);\n \tice_vsi_set_tc_cfg(vsi);\n \n \t/* Initialize VSI struct elements and create VSI in FW */\n-\tret = ice_vsi_init(vsi);\n+\tret = ice_vsi_init(vsi, init_vsi);\n \tif (ret < 0)\n \t\tgoto err_vsi;\n \n@@ -3018,7 +3043,12 @@ int ice_vsi_rebuild(struct ice_vsi *vsi)\n \t\tdev_err(&pf->pdev->dev,\n \t\t\t\"VSI %d failed lan queue config, error %d\\n\",\n \t\t\tvsi->vsi_num, status);\n-\t\tgoto err_vectors;\n+\t\tif (init_vsi) {\n+\t\t\tret = -EIO;\n+\t\t\tgoto err_vectors;\n+\t\t} else {\n+\t\t\treturn ice_schedule_reset(pf, ICE_RESET_PFR);\n+\t\t}\n \t}\n \treturn 0;\n \ndiff --git a/drivers/net/ethernet/intel/ice/ice_lib.h b/drivers/net/ethernet/intel/ice/ice_lib.h\nindex 6e43ef03bfc3..7409a69f631d 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.h\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.h\n@@ -70,7 +70,7 @@ int ice_free_res(struct ice_res_tracker *res, u16 index, u16 id);\n int\n ice_get_res(struct ice_pf *pf, struct ice_res_tracker *res, u16 needed, u16 id);\n \n-int ice_vsi_rebuild(struct ice_vsi *vsi);\n+int ice_vsi_rebuild(struct ice_vsi *vsi, bool init_vsi);\n \n bool ice_is_reset_in_progress(unsigned long *state);\n \ndiff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c\nindex 32b0730792ca..eb3ee6ca9ecc 100644\n--- a/drivers/net/ethernet/intel/ice/ice_main.c\n+++ b/drivers/net/ethernet/intel/ice/ice_main.c\n@@ -1513,6 +1513,42 @@ static void ice_set_ctrlq_len(struct ice_hw *hw)\n \thw->mailboxq.sq_buf_size = ICE_MBXQ_MAX_BUF_LEN;\n }\n \n+/**\n+ * ice_schedule_reset - schedule a reset\n+ * @pf: board private structure\n+ * @reset: reset being requested\n+ */\n+int ice_schedule_reset(struct ice_pf *pf, enum ice_reset_req reset)\n+{\n+\t/* bail out if earlier reset has failed */\n+\tif (test_bit(__ICE_RESET_FAILED, pf->state)) {\n+\t\tdev_dbg(&pf->pdev->dev, \"earlier reset has failed\\n\");\n+\t\treturn -EIO;\n+\t}\n+\t/* bail if reset/recovery already in progress */\n+\tif (ice_is_reset_in_progress(pf->state)) {\n+\t\tdev_dbg(&pf->pdev->dev, \"Reset already in progress\\n\");\n+\t\treturn -EBUSY;\n+\t}\n+\n+\tswitch (reset) {\n+\tcase ICE_RESET_PFR:\n+\t\tset_bit(__ICE_PFR_REQ, pf->state);\n+\t\tbreak;\n+\tcase ICE_RESET_CORER:\n+\t\tset_bit(__ICE_CORER_REQ, pf->state);\n+\t\tbreak;\n+\tcase ICE_RESET_GLOBR:\n+\t\tset_bit(__ICE_GLOBR_REQ, pf->state);\n+\t\tbreak;\n+\tdefault:\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tice_service_task_schedule(pf);\n+\treturn 0;\n+}\n+\n /**\n  * ice_irq_affinity_notify - Callback for affinity changes\n  * @notify: context as to what irq was changed\n@@ -3745,7 +3781,7 @@ static int ice_vsi_rebuild_all(struct ice_pf *pf)\n \t\tif (!pf->vsi[i])\n \t\t\tcontinue;\n \n-\t\terr = ice_vsi_rebuild(pf->vsi[i]);\n+\t\terr = ice_vsi_rebuild(pf->vsi[i], true);\n \t\tif (err) {\n \t\t\tdev_err(&pf->pdev->dev,\n \t\t\t\t\"VSI at index %d rebuild failed\\n\",\n@@ -3907,6 +3943,59 @@ static void ice_rebuild(struct ice_pf *pf)\n \tdev_err(dev, \"Rebuild failed, unload and reload driver\\n\");\n }\n \n+/**\n+ * ice_vsi_recfg_qs - Change the number of queues on a VSI\n+ * @vsi: VSI being changed\n+ * @new_rx: new number of Rx queues\n+ * @new_tx: new number of Tx queues\n+ *\n+ * Only change the number of queues if new_tx, or new_rx is non-0.\n+ *\n+ * Returns 0 on success.\n+ */\n+int ice_vsi_recfg_qs(struct ice_vsi *vsi, int new_rx, int new_tx)\n+{\n+\tstruct ice_pf *pf = vsi->back;\n+\tint err = 0, timeout = 50;\n+\n+\tif (!new_rx && !new_tx)\n+\t\treturn -EINVAL;\n+\n+\twhile (test_and_set_bit(__ICE_CFG_BUSY, pf->state)) {\n+\t\ttimeout--;\n+\t\tif (!timeout)\n+\t\t\treturn -EBUSY;\n+\t\tusleep_range(1000, 2000);\n+\t}\n+\n+\t/* set for the next time the netdev is started */\n+\tif (!netif_running(vsi->netdev)) {\n+\t\tif (new_tx)\n+\t\t\tvsi->req_txq = new_tx;\n+\t\tif (new_rx)\n+\t\t\tvsi->req_rxq = new_rx;\n+\n+\t\tdev_dbg(&pf->pdev->dev, \"Link is down, queue count change happens when link is brought up\\n\");\n+\t\tgoto done;\n+\t}\n+\n+\tice_vsi_close(vsi);\n+\n+\tif (new_tx)\n+\t\tvsi->req_txq = new_tx;\n+\n+\tif (new_rx)\n+\t\tvsi->req_rxq = new_rx;\n+\n+\tice_vsi_rebuild(vsi, false);\n+\tice_pf_dcb_recfg(pf);\n+\n+\tice_vsi_open(vsi);\n+done:\n+\tclear_bit(__ICE_CFG_BUSY, pf->state);\n+\treturn err;\n+}\n+\n /**\n  * ice_change_mtu - NDO callback to change the MTU\n  * @netdev: network interface device structure\n",
    "prefixes": [
        "S23",
        "v4",
        "01/15"
    ]
}