get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1192302,
    "url": "http://patchwork.ozlabs.org/api/patches/1192302/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20191108142331.10221-13-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": "<20191108142331.10221-13-anthony.l.nguyen@intel.com>",
    "list_archive_url": null,
    "date": "2019-11-08T14:23:29",
    "name": "[S33,13/15] ice: Implement ethtool ops for channels",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "93ec1e726ec0ec2b9b099a8354129b22480af922",
    "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/20191108142331.10221-13-anthony.l.nguyen@intel.com/mbox/",
    "series": [
        {
            "id": 141798,
            "url": "http://patchwork.ozlabs.org/api/series/141798/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=141798",
            "date": "2019-11-08T14:23:30",
            "name": "[S33,01/15] ice: Store number of functions for the device",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/141798/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1192302/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1192302/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; spf=pass (sender SPF authorized)\n\tsmtp.mailfrom=osuosl.org (client-ip=140.211.166.136;\n\thelo=silver.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 silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\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 478wZQ61l9z9sP4\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat,  9 Nov 2019 09:54:38 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 69B4C246FD;\n\tFri,  8 Nov 2019 22:54:37 +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 6ax9eayvEoMe; Fri,  8 Nov 2019 22:54:29 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id ECB7724981;\n\tFri,  8 Nov 2019 22:54:28 +0000 (UTC)",
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id 64A4C1BF5DB\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri,  8 Nov 2019 22:54:25 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 61BB824981\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri,  8 Nov 2019 22:54:25 +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 AHW-Fo2tKTY7 for <intel-wired-lan@lists.osuosl.org>;\n\tFri,  8 Nov 2019 22:54:20 +0000 (UTC)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby silver.osuosl.org (Postfix) with ESMTPS id 3C361245E3\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri,  8 Nov 2019 22:54:18 +0000 (UTC)",
            "from fmsmga008.fm.intel.com ([10.253.24.58])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t08 Nov 2019 14:54:17 -0800",
            "from unknown (HELO localhost.jf.intel.com) ([10.166.244.174])\n\tby fmsmga008.fm.intel.com with ESMTP; 08 Nov 2019 14:54:17 -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.68,283,1569308400\"; d=\"scan'208\";a=\"201478839\"",
        "From": "Tony Nguyen <anthony.l.nguyen@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Fri,  8 Nov 2019 06:23:29 -0800",
        "Message-Id": "<20191108142331.10221-13-anthony.l.nguyen@intel.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20191108142331.10221-1-anthony.l.nguyen@intel.com>",
        "References": "<20191108142331.10221-1-anthony.l.nguyen@intel.com>",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [PATCH S33 13/15] ice: Implement ethtool ops for\n\tchannels",
        "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 channels on the primary VSI for a\nPF. This is accessed from the 'ethtool -l' and 'ethtool -L' commands,\nrespectively.  Though the ice driver supports asymmetric queues report an\nIRQ vector that has both Rx and Tx queues attached and is counted as a\n'combined' channel.\n\nSigned-off-by: Henry Tieman <henry.w.tieman@intel.com>\nCo-developed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>\nSigned-off-by: Maciej Fijalkowski <maciej.fijalkowski@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 |   4 +-\n drivers/net/ethernet/intel/ice/ice_dcb_lib.h |   2 +\n drivers/net/ethernet/intel/ice/ice_ethtool.c | 194 +++++++++++++++++++\n drivers/net/ethernet/intel/ice/ice_lib.c     |  70 +++++--\n drivers/net/ethernet/intel/ice/ice_lib.h     |   2 +-\n drivers/net/ethernet/intel/ice/ice_main.c    |  87 ++++++++-\n 7 files changed, 344 insertions(+), 19 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h\nindex cb7259c27353..f972dce8aebb 100644\n--- a/drivers/net/ethernet/intel/ice/ice.h\n+++ b/drivers/net/ethernet/intel/ice/ice.h\n@@ -285,6 +285,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@@ -491,6 +493,7 @@ void ice_set_ethtool_ops(struct net_device *netdev);\n void ice_set_ethtool_safe_mode_ops(struct net_device *netdev);\n u16 ice_get_avail_txq_count(struct ice_pf *pf);\n u16 ice_get_avail_rxq_count(struct ice_pf *pf);\n+int ice_vsi_recfg_qs(struct ice_vsi *vsi, int new_rx, int new_tx);\n void ice_update_vsi_stats(struct ice_vsi *vsi);\n void ice_update_pf_stats(struct ice_pf *pf);\n int ice_up(struct ice_vsi *vsi);\n@@ -505,6 +508,7 @@ ice_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames,\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 int ice_open(struct net_device *netdev);\n int ice_stop(struct net_device *netdev);\ndiff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c\nindex 20b63443237c..d3d3ec29def9 100644\n--- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c\n+++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c\n@@ -4,8 +4,6 @@\n #include \"ice_dcb_lib.h\"\n #include \"ice_dcb_nl.h\"\n \n-static void ice_pf_dcb_recfg(struct ice_pf *pf);\n-\n /**\n  * ice_vsi_cfg_netdev_tc - Setup the netdev TC configuration\n  * @vsi: the VSI being configured\n@@ -535,7 +533,7 @@ static int ice_dcb_noncontig_cfg(struct ice_pf *pf)\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 c81d7f69d5c4..f15e5776f287 100644\n--- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.h\n+++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.h\n@@ -20,6 +20,7 @@ u8 ice_dcb_get_num_tc(struct ice_dcbx_cfg *dcbcfg);\n u8 ice_dcb_get_tc(struct ice_vsi *vsi, int queue_index);\n int\n ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked);\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@@ -78,6 +79,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 5b229f3703b5..f39071210526 100644\n--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c\n+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c\n@@ -3142,6 +3142,197 @@ 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_combined_cnt - return the current number of combined channels\n+ * @vsi: PF VSI pointer\n+ *\n+ * Go through all queue vectors and count ones that have both Rx and Tx ring\n+ * attached\n+ */\n+static u32 ice_get_combined_cnt(struct ice_vsi *vsi)\n+{\n+\tu32 combined = 0;\n+\tint q_idx;\n+\n+\tice_for_each_q_vector(vsi, q_idx) {\n+\t\tstruct ice_q_vector *q_vector = vsi->q_vectors[q_idx];\n+\n+\t\tif (q_vector->rx.ring && q_vector->tx.ring)\n+\t\t\tcombined++;\n+\t}\n+\n+\treturn combined;\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+\tch->max_combined = min_t(int, ch->max_rx, ch->max_tx);\n+\n+\t/* report current channels */\n+\tch->combined_count = ice_get_combined_cnt(vsi);\n+\tch->rx_count = vsi->num_rxq - ch->combined_count;\n+\tch->tx_count = vsi->num_txq - ch->combined_count;\n+}\n+\n+/**\n+ * ice_vsi_set_dflt_rss_lut - set default RSS LUT with requested RSS size\n+ * @vsi: VSI to reconfigure RSS LUT on\n+ * @req_rss_size: requested range of queue numbers for hashing\n+ *\n+ * Set the VSI's RSS parameters, configure the RSS LUT based on these, and then\n+ * clear the previous vsi->rss_lut_user because it is assumed to be invalid at\n+ * this point.\n+ */\n+static int ice_vsi_set_dflt_rss_lut(struct ice_vsi *vsi, int req_rss_size)\n+{\n+\tstruct ice_pf *pf = vsi->back;\n+\tenum ice_status status;\n+\tstruct device *dev;\n+\tstruct ice_hw *hw;\n+\tint err = 0;\n+\tu8 *lut;\n+\n+\tdev = ice_pf_to_dev(pf);\n+\thw = &pf->hw;\n+\n+\tif (!req_rss_size)\n+\t\treturn -EINVAL;\n+\n+\tlut = kzalloc(vsi->rss_table_size, GFP_KERNEL);\n+\tif (!lut)\n+\t\treturn -ENOMEM;\n+\n+\t/* set RSS LUT parameters */\n+\tif (!test_bit(ICE_FLAG_RSS_ENA, pf->flags)) {\n+\t\tvsi->rss_size = 1;\n+\t} else {\n+\t\tstruct ice_hw_common_caps *caps = &hw->func_caps.common_cap;\n+\n+\t\tvsi->rss_size = min_t(int, req_rss_size,\n+\t\t\t\t      BIT(caps->rss_table_entry_width));\n+\t}\n+\n+\t/* create/set RSS LUT */\n+\tice_fill_rss_lut(lut, vsi->rss_table_size, vsi->rss_size);\n+\tstatus = ice_aq_set_rss_lut(hw, vsi->idx, vsi->rss_lut_type, lut,\n+\t\t\t\t    vsi->rss_table_size);\n+\tif (status) {\n+\t\tdev_err(dev, \"Cannot set RSS lut, err %d aq_err %d\\n\",\n+\t\t\tstatus, hw->adminq.rq_last_status);\n+\t\terr = -EIO;\n+\t}\n+\n+\t/* get rid of invalid user configuration */\n+\tif (vsi->rss_lut_user) {\n+\t\tnetdev_info(vsi->netdev, \"Rx queue count changed, clearing user modified RSS LUT, re-run ethtool [-x|-X] to [check|set] settings if needed\\n\");\n+\t\tdevm_kfree(dev, vsi->rss_lut_user);\n+\t\tvsi->rss_lut_user = NULL;\n+\t}\n+\n+\tkfree(lut);\n+\treturn err;\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+\tu32 curr_combined;\n+\n+\t/* do not support changing channels in Safe Mode */\n+\tif (ice_is_safe_mode(pf)) {\n+\t\tnetdev_err(dev, \"Changing channel in Safe Mode is not supported\\n\");\n+\t\treturn -EOPNOTSUPP;\n+\t}\n+\t/* do not support changing other_count */\n+\tif (ch->other_count)\n+\t\treturn -EINVAL;\n+\n+\tcurr_combined = ice_get_combined_cnt(vsi);\n+\n+\t/* these checks are for cases where user didn't specify a particular\n+\t * value on cmd line but we get non-zero value anyway via\n+\t * get_channels(); look at ethtool.c in ethtool repository (the user\n+\t * space part), particularly, do_schannels() routine\n+\t */\n+\tif (ch->rx_count == vsi->num_rxq - curr_combined)\n+\t\tch->rx_count = 0;\n+\tif (ch->tx_count == vsi->num_txq - curr_combined)\n+\t\tch->tx_count = 0;\n+\tif (ch->combined_count == curr_combined)\n+\t\tch->combined_count = 0;\n+\n+\tif (!(ch->combined_count || (ch->rx_count && ch->tx_count))) {\n+\t\tnetdev_err(dev, \"Please specify at least 1 Rx and 1 Tx channel\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tnew_rx = ch->combined_count + ch->rx_count;\n+\tnew_tx = ch->combined_count + ch->tx_count;\n+\n+\tif (new_rx > ice_get_max_rxq(pf)) {\n+\t\tnetdev_err(dev, \"Maximum allowed Rx channels is %d\\n\",\n+\t\t\t   ice_get_max_rxq(pf));\n+\t\treturn -EINVAL;\n+\t}\n+\tif (new_tx > ice_get_max_txq(pf)) {\n+\t\tnetdev_err(dev, \"Maximum allowed Tx channels is %d\\n\",\n+\t\t\t   ice_get_max_txq(pf));\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tice_vsi_recfg_qs(vsi, new_rx, new_tx);\n+\n+\tif (new_rx)\n+\t\treturn ice_vsi_set_dflt_rss_lut(vsi, new_rx);\n+\n+\treturn 0;\n+}\n+\n enum ice_container_type {\n \tICE_RX_CONTAINER,\n \tICE_TX_CONTAINER,\n@@ -3631,6 +3822,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,\n@@ -3656,6 +3849,7 @@ static const struct ethtool_ops ice_ethtool_safe_mode_ops = {\n \t.get_ringparam\t\t= ice_get_ringparam,\n \t.set_ringparam\t\t= ice_set_ringparam,\n \t.nway_reset\t\t= ice_nway_reset,\n+\t.get_channels\t\t= ice_get_channels,\n };\n \n /**\ndiff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c\nindex b546c69a4bbc..e7449248fab4 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.c\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.c\n@@ -142,15 +142,24 @@ static void ice_vsi_set_num_qs(struct ice_vsi *vsi, u16 vf_id)\n \tcase ICE_VSI_PF:\n \t\tvsi->alloc_txq = min_t(int, ice_get_avail_txq_count(pf),\n \t\t\t\t       num_online_cpus());\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 \n \t\tpf->num_lan_tx = vsi->alloc_txq;\n \n \t\t/* only 1 Rx queue unless RSS is enabled */\n-\t\tif (!test_bit(ICE_FLAG_RSS_ENA, pf->flags))\n+\t\tif (!test_bit(ICE_FLAG_RSS_ENA, pf->flags)) {\n \t\t\tvsi->alloc_rxq = 1;\n-\t\telse\n+\t\t} else {\n \t\t\tvsi->alloc_rxq = min_t(int, ice_get_avail_rxq_count(pf),\n \t\t\t\t\t       num_online_cpus());\n+\t\t\tif (vsi->req_rxq) {\n+\t\t\t\tvsi->alloc_rxq = vsi->req_rxq;\n+\t\t\t\tvsi->num_rxq = vsi->req_rxq;\n+\t\t\t}\n+\t\t}\n \n \t\tpf->num_lan_rx = vsi->alloc_rxq;\n \n@@ -639,7 +648,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@@ -746,17 +757,20 @@ 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 \tstruct ice_vsi_ctx *ctxt;\n+\tstruct device *dev;\n \tint ret = 0;\n \n+\tdev = ice_pf_to_dev(pf);\n \tctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);\n \tif (!ctxt)\n \t\treturn -ENOMEM;\n@@ -784,11 +798,24 @@ static int ice_vsi_init(struct ice_vsi *vsi)\n \t\tctxt->info.sw_flags |= ICE_AQ_VSI_SW_FLAG_ALLOW_LB;\n \n \t/* Set LUT type and HASH type if RSS is enabled */\n-\tif (test_bit(ICE_FLAG_RSS_ENA, pf->flags))\n+\tif (test_bit(ICE_FLAG_RSS_ENA, pf->flags)) {\n \t\tice_set_rss_vsi_ctx(ctxt, vsi);\n+\t\t/* if updating VSI context, make sure to set valid_section:\n+\t\t * to indicate which section of VSI context being updated\n+\t\t */\n+\t\tif (!init_vsi)\n+\t\t\tctxt->info.valid_sections |=\n+\t\t\t\tcpu_to_le16(ICE_AQ_VSI_PROP_Q_OPT_VALID);\n+\t}\n \n \tctxt->info.sw_id = vsi->port_info->sw_id;\n \tice_vsi_setup_q_map(vsi, ctxt);\n+\tif (!init_vsi) /* means VSI being updated */\n+\t\t/* must to indicate which section of VSI context are\n+\t\t * being modified\n+\t\t */\n+\t\tctxt->info.valid_sections |=\n+\t\t\tcpu_to_le16(ICE_AQ_VSI_PROP_RXQ_MAP_VALID);\n \n \t/* Enable MAC Antispoof with new VSI being initialized or updated */\n \tif (vsi->type == ICE_VSI_VF && pf->vf[vsi->vf_id].spoofchk) {\n@@ -805,11 +832,20 @@ static int ice_vsi_init(struct ice_vsi *vsi)\n \t\t\tcpu_to_le16(ICE_AQ_VSI_PROP_SECURITY_VALID);\n \t}\n \n-\tret = ice_add_vsi(hw, vsi->idx, ctxt, NULL);\n-\tif (ret) {\n-\t\tdev_err(ice_pf_to_dev(pf), \"Add VSI failed, err %d\\n\", ret);\n-\t\tret = -EIO;\n-\t\tgoto out;\n+\tif (init_vsi) {\n+\t\tret = ice_add_vsi(hw, vsi->idx, ctxt, NULL);\n+\t\tif (ret) {\n+\t\t\tdev_err(dev, \"Add VSI failed, err %d\\n\", ret);\n+\t\t\tret = -EIO;\n+\t\t\tgoto out;\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(dev, \"Update VSI failed, err %d\\n\", ret);\n+\t\t\tret = -EIO;\n+\t\t\tgoto out;\n+\t\t}\n \t}\n \n \t/* keep context for update VSI operations */\n@@ -1835,7 +1871,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@@ -2368,10 +2404,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@@ -2423,7 +2460,7 @@ int ice_vsi_rebuild(struct ice_vsi *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@@ -2491,7 +2528,12 @@ int ice_vsi_rebuild(struct ice_vsi *vsi)\n \t\tdev_err(ice_pf_to_dev(pf),\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 e86aa60c0254..6e31e30aba39 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.h\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.h\n@@ -73,7 +73,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 d282eb05c2e0..69bff085acf7 100644\n--- a/drivers/net/ethernet/intel/ice/ice_main.c\n+++ b/drivers/net/ethernet/intel/ice/ice_main.c\n@@ -44,6 +44,7 @@ MODULE_PARM_DESC(debug, \"netif level (0=none,...,16=all)\");\n static struct workqueue_struct *ice_wq;\n static const struct net_device_ops ice_netdev_safe_mode_ops;\n static const struct net_device_ops ice_netdev_ops;\n+static int ice_vsi_open(struct ice_vsi *vsi);\n \n static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type);\n \n@@ -1524,6 +1525,44 @@ 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+\tstruct device *dev = ice_pf_to_dev(pf);\n+\n+\t/* bail out if earlier reset has failed */\n+\tif (test_bit(__ICE_RESET_FAILED, pf->state)) {\n+\t\tdev_dbg(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(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@@ -2808,6 +2847,52 @@ static int ice_init_interrupt_scheme(struct ice_pf *pf)\n \treturn 0;\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+\tif (new_tx)\n+\t\tvsi->req_txq = new_tx;\n+\tif (new_rx)\n+\t\tvsi->req_rxq = new_rx;\n+\n+\t/* set for the next time the netdev is started */\n+\tif (!netif_running(vsi->netdev)) {\n+\t\tice_vsi_rebuild(vsi, false);\n+\t\tdev_dbg(ice_pf_to_dev(pf), \"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+\tice_vsi_rebuild(vsi, false);\n+\tice_pf_dcb_recfg(pf);\n+\tice_vsi_open(vsi);\n+done:\n+\tclear_bit(__ICE_CFG_BUSY, pf->state);\n+\treturn err;\n+}\n+\n /**\n  * ice_log_pkg_init - log result of DDP package load\n  * @hw: pointer to hardware info\n@@ -4482,7 +4567,7 @@ static int ice_vsi_rebuild_by_type(struct ice_pf *pf, enum ice_vsi_type type)\n \t\t\tcontinue;\n \n \t\t/* rebuild the VSI */\n-\t\terr = ice_vsi_rebuild(vsi);\n+\t\terr = ice_vsi_rebuild(vsi, true);\n \t\tif (err) {\n \t\t\tdev_err(dev,\n \t\t\t\t\"rebuild VSI failed, err %d, VSI index %d, type %s\\n\",\n",
    "prefixes": [
        "S33",
        "13/15"
    ]
}