get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 534138,
    "url": "http://patchwork.ozlabs.org/api/patches/534138/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1445471784-36024-2-git-send-email-catherine.sullivan@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": "<1445471784-36024-2-git-send-email-catherine.sullivan@intel.com>",
    "list_archive_url": null,
    "date": "2015-10-21T23:56:23",
    "name": "[next,S19,14/15] i40e: create a generic configure rss function",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "3ab7ca460af453a86ab7582d1708c4143c1326a7",
    "submitter": {
        "id": 13931,
        "url": "http://patchwork.ozlabs.org/api/people/13931/?format=api",
        "name": "Catherine Sullivan",
        "email": "catherine.sullivan@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/1445471784-36024-2-git-send-email-catherine.sullivan@intel.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/534138/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/534138/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@lists.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"
        ],
        "Received": [
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ozlabs.org (Postfix) with ESMTP id AC712141315\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 22 Oct 2015 10:57:04 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 065F987E68;\n\tWed, 21 Oct 2015 23:57:04 +0000 (UTC)",
            "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id 1Dd9ODU95ZTd; Wed, 21 Oct 2015 23:57:01 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 1940B87F29;\n\tWed, 21 Oct 2015 23:57:01 +0000 (UTC)",
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id 310F51C04C3\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 21 Oct 2015 23:57:00 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 2C54688396\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 21 Oct 2015 23:57:00 +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 Ww9fMrHPYa-B for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 21 Oct 2015 23:56:59 +0000 (UTC)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 4B5698BE16\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 21 Oct 2015 23:56:59 +0000 (UTC)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga101.fm.intel.com with ESMTP; 21 Oct 2015 16:56:59 -0700",
            "from catheri1-tigger.jf.intel.com ([134.134.176.92])\n\tby fmsmga002.fm.intel.com with ESMTP; 21 Oct 2015 16:56:59 -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-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.20,179,1444719600\"; d=\"scan'208\";a=\"832567014\"",
        "From": "Catherine Sullivan <catherine.sullivan@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Wed, 21 Oct 2015 19:56:23 -0400",
        "Message-Id": "<1445471784-36024-2-git-send-email-catherine.sullivan@intel.com>",
        "X-Mailer": "git-send-email 1.9.3",
        "In-Reply-To": "<1445471784-36024-1-git-send-email-catherine.sullivan@intel.com>",
        "References": "<1445471784-36024-1-git-send-email-catherine.sullivan@intel.com>",
        "Cc": "Helin Zhang <helin.zhang@intel.com>",
        "Subject": "[Intel-wired-lan] [next PATCH S19 14/15] i40e: create a generic\n\tconfigure rss function",
        "X-BeenThere": "intel-wired-lan@lists.osuosl.org",
        "X-Mailman-Version": "2.1.18-1",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>",
        "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>",
        "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>"
    },
    "content": "From: Helin Zhang <helin.zhang@intel.com>\n\nThis patch renames the old pf-specific function in order to clarify\nits scope. This patch also creates a more generic configure RSS\nfunction with the old name.\n\nThis patch also creates a new more generic function to get RSS\nconfiguration, using the appropriate method.\n\nSigned-off-by: Helin Zhang <helin.zhang@intel.com>\nChange-ID: Ieddca2707b708ef19f1ebccdfd03a0a0cd63d3af\n\n---\nTesting-hints: Test RSS hooks from ethtool for X[L]710 and X722.\n drivers/net/ethernet/intel/i40e/i40e.h         |  2 +\n drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 72 ++++++++++------------\n drivers/net/ethernet/intel/i40e/i40e_main.c    | 85 ++++++++++++++++++++++----\n 3 files changed, 107 insertions(+), 52 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h\nindex f6b747c..89f5323 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e.h\n@@ -670,6 +670,8 @@ extern const char i40e_driver_name[];\n extern const char i40e_driver_version_str[];\n void i40e_do_reset_safe(struct i40e_pf *pf, u32 reset_flags);\n void i40e_do_reset(struct i40e_pf *pf, u32 reset_flags);\n+int i40e_config_rss(struct i40e_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size);\n+int i40e_get_rss(struct i40e_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size);\n struct i40e_vsi *i40e_find_vsi_from_id(struct i40e_pf *pf, u16 id);\n void i40e_update_stats(struct i40e_vsi *vsi);\n void i40e_update_eth_stats(struct i40e_vsi *vsi);\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\nindex 9d66a00..0fd0801 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\n@@ -2605,10 +2605,9 @@ static int i40e_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,\n {\n \tstruct i40e_netdev_priv *np = netdev_priv(netdev);\n \tstruct i40e_vsi *vsi = np->vsi;\n-\tstruct i40e_pf *pf = vsi->back;\n-\tstruct i40e_hw *hw = &pf->hw;\n-\tu32 reg_val;\n-\tint i, j;\n+\tu8 *lut, *seed = NULL;\n+\tint ret;\n+\tu16 i;\n \n \tif (hfunc)\n \t\t*hfunc = ETH_RSS_HASH_TOP;\n@@ -2616,24 +2615,20 @@ static int i40e_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,\n \tif (!indir)\n \t\treturn 0;\n \n-\tfor (i = 0, j = 0; i <= I40E_PFQF_HLUT_MAX_INDEX; i++) {\n-\t\treg_val = rd32(hw, I40E_PFQF_HLUT(i));\n-\t\tindir[j++] = reg_val & 0xff;\n-\t\tindir[j++] = (reg_val >> 8) & 0xff;\n-\t\tindir[j++] = (reg_val >> 16) & 0xff;\n-\t\tindir[j++] = (reg_val >> 24) & 0xff;\n-\t}\n+\tseed = key;\n+\tlut = kzalloc(I40E_HLUT_ARRAY_SIZE, GFP_KERNEL);\n+\tif (!lut)\n+\t\treturn -ENOMEM;\n+\tret = i40e_get_rss(vsi, seed, lut, I40E_HLUT_ARRAY_SIZE);\n+\tif (ret)\n+\t\tgoto out;\n+\tfor (i = 0; i < I40E_HLUT_ARRAY_SIZE; i++)\n+\t\tindir[i] = (u32)(lut[i]);\n \n-\tif (key) {\n-\t\tfor (i = 0, j = 0; i <= I40E_PFQF_HKEY_MAX_INDEX; i++) {\n-\t\t\treg_val = rd32(hw, I40E_PFQF_HKEY(i));\n-\t\t\tkey[j++] = (u8)(reg_val & 0xff);\n-\t\t\tkey[j++] = (u8)((reg_val >> 8) & 0xff);\n-\t\t\tkey[j++] = (u8)((reg_val >> 16) & 0xff);\n-\t\t\tkey[j++] = (u8)((reg_val >> 24) & 0xff);\n-\t\t}\n-\t}\n-\treturn 0;\n+out:\n+\tkfree(lut);\n+\n+\treturn ret;\n }\n \n /**\n@@ -2650,10 +2645,10 @@ static int i40e_set_rxfh(struct net_device *netdev, const u32 *indir,\n {\n \tstruct i40e_netdev_priv *np = netdev_priv(netdev);\n \tstruct i40e_vsi *vsi = np->vsi;\n-\tstruct i40e_pf *pf = vsi->back;\n-\tstruct i40e_hw *hw = &pf->hw;\n-\tu32 reg_val;\n-\tint i, j;\n+\tu8 seed_def[I40E_HKEY_ARRAY_SIZE];\n+\tu8 *lut, *seed = NULL;\n+\tu16 i;\n+\tint ret;\n \n \tif (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)\n \t\treturn -EOPNOTSUPP;\n@@ -2661,24 +2656,19 @@ static int i40e_set_rxfh(struct net_device *netdev, const u32 *indir,\n \tif (!indir)\n \t\treturn 0;\n \n-\tfor (i = 0, j = 0; i <= I40E_PFQF_HLUT_MAX_INDEX; i++) {\n-\t\treg_val = indir[j++];\n-\t\treg_val |= indir[j++] << 8;\n-\t\treg_val |= indir[j++] << 16;\n-\t\treg_val |= indir[j++] << 24;\n-\t\twr32(hw, I40E_PFQF_HLUT(i), reg_val);\n-\t}\n-\n \tif (key) {\n-\t\tfor (i = 0, j = 0; i <= I40E_PFQF_HKEY_MAX_INDEX; i++) {\n-\t\t\treg_val = key[j++];\n-\t\t\treg_val |= key[j++] << 8;\n-\t\t\treg_val |= key[j++] << 16;\n-\t\t\treg_val |= key[j++] << 24;\n-\t\t\twr32(hw, I40E_PFQF_HKEY(i), reg_val);\n-\t\t}\n+\t\tmemcpy(seed_def, key, I40E_HKEY_ARRAY_SIZE);\n+\t\tseed = seed_def;\n \t}\n-\treturn 0;\n+\tlut = kzalloc(I40E_HLUT_ARRAY_SIZE, GFP_KERNEL);\n+\tif (!lut)\n+\t\treturn -ENOMEM;\n+\tfor (i = 0; i < I40E_HLUT_ARRAY_SIZE; i++)\n+\t\tlut[i] = (u8)(indir[i]);\n+\tret = i40e_config_rss(vsi, seed, lut, I40E_HLUT_ARRAY_SIZE);\n+\tkfree(lut);\n+\n+\treturn ret;\n }\n \n /**\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex be7fe65..cd6e278 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -7893,7 +7893,7 @@ static int i40e_vsi_config_rss(struct i40e_vsi *vsi)\n }\n \n /**\n- * i40e_config_rss_reg - Prepare for RSS if used\n+ * i40e_config_rss_reg - Configure RSS keys and lut by writing registers\n  * @vsi: Pointer to vsi structure\n  * @seed: RSS hash seed\n  * @lut: Lookup table\n@@ -7931,6 +7931,73 @@ static int i40e_config_rss_reg(struct i40e_vsi *vsi, const u8 *seed,\n }\n \n /**\n+ * i40e_get_rss_reg - Get the RSS keys and lut by reading registers\n+ * @vsi: Pointer to VSI structure\n+ * @seed: Buffer to store the keys\n+ * @lut: Buffer to store the lookup table entries\n+ * @lut_size: Size of buffer to store the lookup table entries\n+ *\n+ * Returns 0 on success, negative on failure\n+ */\n+static int i40e_get_rss_reg(struct i40e_vsi *vsi, u8 *seed,\n+\t\t\t    u8 *lut, u16 lut_size)\n+{\n+\tstruct i40e_pf *pf = vsi->back;\n+\tstruct i40e_hw *hw = &pf->hw;\n+\tu16 i;\n+\n+\tif (seed) {\n+\t\tu32 *seed_dw = (u32 *)seed;\n+\n+\t\tfor (i = 0; i <= I40E_PFQF_HKEY_MAX_INDEX; i++)\n+\t\t\tseed_dw[i] = rd32(hw, I40E_PFQF_HKEY(i));\n+\t}\n+\tif (lut) {\n+\t\tu32 *lut_dw = (u32 *)lut;\n+\n+\t\tif (lut_size != I40E_HLUT_ARRAY_SIZE)\n+\t\t\treturn -EINVAL;\n+\t\tfor (i = 0; i <= I40E_PFQF_HLUT_MAX_INDEX; i++)\n+\t\t\tlut_dw[i] = rd32(hw, I40E_PFQF_HLUT(i));\n+\t}\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * i40e_config_rss - Configure RSS keys and lut\n+ * @vsi: Pointer to VSI structure\n+ * @seed: RSS hash seed\n+ * @lut: Lookup table\n+ * @lut_size: Lookup table size\n+ *\n+ * Returns 0 on success, negative on failure\n+ */\n+int i40e_config_rss(struct i40e_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size)\n+{\n+\tstruct i40e_pf *pf = vsi->back;\n+\n+\tif (pf->flags & I40E_FLAG_RSS_AQ_CAPABLE)\n+\t\treturn i40e_config_rss_aq(vsi, seed, lut, lut_size);\n+\telse\n+\t\treturn i40e_config_rss_reg(vsi, seed, lut, lut_size);\n+}\n+\n+/**\n+ * i40e_get_rss - Get RSS keys and lut\n+ * @vsi: Pointer to VSI structure\n+ * @seed: Buffer to store the keys\n+ * @lut: Buffer to store the lookup table entries\n+ * lut_size: Size of buffer to store the lookup table entries\n+ *\n+ * Returns 0 on success, negative on failure\n+ */\n+int i40e_get_rss(struct i40e_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size)\n+{\n+\treturn i40e_get_rss_reg(vsi, seed, lut, lut_size);\n+}\n+\n+/**\n  * i40e_fill_rss_lut - Fill the RSS lookup table with default values\n  * @pf: Pointer to board private structure\n  * @lut: Lookup table\n@@ -7947,10 +8014,10 @@ static void i40e_fill_rss_lut(struct i40e_pf *pf, u8 *lut,\n }\n \n /**\n- * i40e_config_rss - Prepare for RSS if used\n+ * i40e_pf_config_rss - Prepare for RSS if used\n  * @pf: board private structure\n  **/\n-static int i40e_config_rss(struct i40e_pf *pf)\n+static int i40e_pf_config_rss(struct i40e_pf *pf)\n {\n \tstruct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];\n \tu8 seed[I40E_HKEY_ARRAY_SIZE];\n@@ -7960,8 +8027,6 @@ static int i40e_config_rss(struct i40e_pf *pf)\n \tu64 hena;\n \tint ret;\n \n-\tnetdev_rss_key_fill((void *)seed, I40E_HKEY_ARRAY_SIZE);\n-\n \t/* By default we enable TCP/UDP with IPv4/IPv6 ptypes */\n \thena = (u64)rd32(hw, I40E_PFQF_HENA(0)) |\n \t\t((u64)rd32(hw, I40E_PFQF_HENA(1)) << 32);\n@@ -7985,10 +8050,8 @@ static int i40e_config_rss(struct i40e_pf *pf)\n \n \ti40e_fill_rss_lut(pf, lut, vsi->rss_table_size, vsi->rss_size);\n \n-\tif (pf->flags & I40E_FLAG_RSS_AQ_CAPABLE)\n-\t\tret = i40e_config_rss_aq(vsi, seed, lut, vsi->rss_table_size);\n-\telse\n-\t\tret = i40e_config_rss_reg(vsi, seed, lut, vsi->rss_table_size);\n+\tnetdev_rss_key_fill((void *)seed, I40E_HKEY_ARRAY_SIZE);\n+\tret = i40e_config_rss(vsi, seed, lut, vsi->rss_table_size);\n \n \tkfree(lut);\n \n@@ -8020,7 +8083,7 @@ int i40e_reconfig_rss_queues(struct i40e_pf *pf, int queue_count)\n \t\tpf->rss_size = new_rss_size;\n \n \t\ti40e_reset_and_rebuild(pf, true);\n-\t\ti40e_config_rss(pf);\n+\t\ti40e_pf_config_rss(pf);\n \t}\n \tdev_info(&pf->pdev->dev, \"RSS count:  %d\\n\", pf->rss_size);\n \treturn pf->rss_size;\n@@ -10026,7 +10089,7 @@ static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit)\n \t * the hash\n \t */\n \tif ((pf->flags & I40E_FLAG_RSS_ENABLED))\n-\t\ti40e_config_rss(pf);\n+\t\ti40e_pf_config_rss(pf);\n \n \t/* fill in link information and enable LSE reporting */\n \ti40e_update_link_info(&pf->hw);\n",
    "prefixes": [
        "next",
        "S19",
        "14/15"
    ]
}