Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/565098/?format=api
{ "id": 565098, "url": "http://patchwork.ozlabs.org/api/patches/565098/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1452297506-1115-1-git-send-email-deepthi.kavalur@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": "<1452297506-1115-1-git-send-email-deepthi.kavalur@intel.com>", "list_archive_url": null, "date": "2016-01-08T23:58:26", "name": "[v2,next,S23,9/13] i40e: Make some changes in the nvm read code", "commit_ref": null, "pull_url": null, "state": "deferred", "archived": false, "hash": "7a339746bd6385495827b87a417fcac40cf572c8", "submitter": { "id": 67654, "url": "http://patchwork.ozlabs.org/api/people/67654/?format=api", "name": "Deepthi Kavalur", "email": "deepthi.kavalur@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/1452297506-1115-1-git-send-email-deepthi.kavalur@intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/565098/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/565098/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 silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ozlabs.org (Postfix) with ESMTP id 43A621402B4\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 9 Jan 2016 10:58:30 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 3D94C32E4A;\n\tFri, 8 Jan 2016 23:58:29 +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 9WwSPOkJ-oGH; Fri, 8 Jan 2016 23:58:27 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id A8E2432D36;\n\tFri, 8 Jan 2016 23:58:27 +0000 (UTC)", "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 279541C0B6D\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 8 Jan 2016 23:58:27 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 1D36393219\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 8 Jan 2016 23:58:27 +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 xBPiK1vEQay4 for <intel-wired-lan@lists.osuosl.org>;\n\tFri, 8 Jan 2016 23:58:26 +0000 (UTC)", "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 5AF0F93210\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 8 Jan 2016 23:58:26 +0000 (UTC)", "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby orsmga101.jf.intel.com with ESMTP; 08 Jan 2016 15:58:26 -0800", "from dkavalur-mobl.amr.corp.intel.com (HELO\n\tlocalhost.localdomain.localdomain) ([134.134.176.184])\n\tby FMSMGA003.fm.intel.com with ESMTP; 08 Jan 2016 15:58:25 -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-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.20,541,1444719600\"; d=\"scan'208\";a=\"630458801\"", "From": "Deepthi Kavalur <deepthi.kavalur@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Fri, 8 Jan 2016 15:58:26 -0800", "Message-Id": "<1452297506-1115-1-git-send-email-deepthi.kavalur@intel.com>", "X-Mailer": "git-send-email 2.1.0", "Subject": "[Intel-wired-lan] [v2 next PATCH S23 9/13] i40e: Make some changes\n\tin the nvm read code", "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: Anjali Singhai Jain <anjali.singhai@intel.com>\n\nIn X722, NVM reads can't be done through SRCTL registers.\nAnd require AQ calls, which require grabbing the NVM lock.\nUnfortunately some paths need the lock to be acquired once\nand do a whole bunch of stuff and then release it.\nThis patch creates an unsafe version of the read calls, so\nthat it can be called from the paths that need the bulk access.\n\nSigned-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>\nAcked-by: Shannon Nelson <shannon.nelson@intel.com>\nChange-ID: Ia9076e9100c5cf61206a856bd279059d3a052024\n---\n drivers/net/ethernet/intel/i40e/i40e_nvm.c | 76 +++++++++++++++++++++++++-----\n 1 file changed, 65 insertions(+), 11 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_nvm.c b/drivers/net/ethernet/intel/i40e/i40e_nvm.c\nindex 6100cdd..cdc17c5 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_nvm.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_nvm.c\n@@ -280,7 +280,28 @@ static i40e_status i40e_read_nvm_word_aq(struct i40e_hw *hw, u16 offset,\n }\n \n /**\n- * i40e_read_nvm_word - Reads Shadow RAM\n+ * __i40e_read_nvm_word - Reads nvm word, assumes caller does the locking\n+ * @hw: pointer to the HW structure\n+ * @offset: offset of the Shadow RAM word to read (0x000000 - 0x001FFF)\n+ * @data: word read from the Shadow RAM\n+ *\n+ * Reads one 16 bit word from the Shadow RAM using the GLNVM_SRCTL register.\n+ **/\n+static i40e_status __i40e_read_nvm_word(struct i40e_hw *hw,\n+\t\t\t\t\tu16 offset,\n+\t\t\t\t\tu16 *data)\n+{\n+\ti40e_status ret_code = 0;\n+\n+\tif (hw->flags & I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE)\n+\t\tret_code = i40e_read_nvm_word_aq(hw, offset, data);\n+\telse\n+\t\tret_code = i40e_read_nvm_word_srctl(hw, offset, data);\n+\treturn ret_code;\n+}\n+\n+/**\n+ * i40e_read_nvm_word - Reads nvm word and acquire lock if necessary\n * @hw: pointer to the HW structure\n * @offset: offset of the Shadow RAM word to read (0x000000 - 0x001FFF)\n * @data: word read from the Shadow RAM\n@@ -393,7 +414,31 @@ read_nvm_buffer_aq_exit:\n }\n \n /**\n- * i40e_read_nvm_buffer - Reads Shadow RAM buffer\n+ * __i40e_read_nvm_buffer - Reads nvm buffer, caller must acquire lock\n+ * @hw: pointer to the HW structure\n+ * @offset: offset of the Shadow RAM word to read (0x000000 - 0x001FFF).\n+ * @words: (in) number of words to read; (out) number of words actually read\n+ * @data: words read from the Shadow RAM\n+ *\n+ * Reads 16 bit words (data buffer) from the SR using the i40e_read_nvm_srrd()\n+ * method. The buffer read is preceded by the NVM ownership take\n+ * and followed by the release.\n+ **/\n+static i40e_status __i40e_read_nvm_buffer(struct i40e_hw *hw,\n+\t\t\t\t\t u16 offset,\n+\t\t\t\t\t u16 *words, u16 *data)\n+{\n+\ti40e_status ret_code = 0;\n+\n+\tif (hw->flags & I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE)\n+\t\tret_code = i40e_read_nvm_buffer_aq(hw, offset, words, data);\n+\telse\n+\t\tret_code = i40e_read_nvm_buffer_srctl(hw, offset, words, data);\n+\treturn ret_code;\n+}\n+\n+/**\n+ * i40e_read_nvm_buffer - Reads Shadow RAM buffer and acuire lock if necessary\n * @hw: pointer to the HW structure\n * @offset: offset of the Shadow RAM word to read (0x000000 - 0x001FFF).\n * @words: (in) number of words to read; (out) number of words actually read\n@@ -499,15 +544,17 @@ static i40e_status i40e_calc_nvm_checksum(struct i40e_hw *hw,\n \tdata = (u16 *)vmem.va;\n \n \t/* read pointer to VPD area */\n-\tret_code = i40e_read_nvm_word(hw, I40E_SR_VPD_PTR, &vpd_module);\n+\tret_code = __i40e_read_nvm_word(hw, I40E_SR_VPD_PTR,\n+\t\t\t\t\t&vpd_module);\n \tif (ret_code) {\n \t\tret_code = I40E_ERR_NVM_CHECKSUM;\n \t\tgoto i40e_calc_nvm_checksum_exit;\n \t}\n \n \t/* read pointer to PCIe Alt Auto-load module */\n-\tret_code = i40e_read_nvm_word(hw, I40E_SR_PCIE_ALT_AUTO_LOAD_PTR,\n-\t\t\t\t &pcie_alt_module);\n+\tret_code = __i40e_read_nvm_word(hw,\n+\t\t\t\t\tI40E_SR_PCIE_ALT_AUTO_LOAD_PTR,\n+\t\t\t\t\t&pcie_alt_module);\n \tif (ret_code) {\n \t\tret_code = I40E_ERR_NVM_CHECKSUM;\n \t\tgoto i40e_calc_nvm_checksum_exit;\n@@ -521,7 +568,7 @@ static i40e_status i40e_calc_nvm_checksum(struct i40e_hw *hw,\n \t\tif ((i % I40E_SR_SECTOR_SIZE_IN_WORDS) == 0) {\n \t\t\tu16 words = I40E_SR_SECTOR_SIZE_IN_WORDS;\n \n-\t\t\tret_code = i40e_read_nvm_buffer(hw, i, &words, data);\n+\t\t\tret_code = __i40e_read_nvm_buffer(hw, i, &words, data);\n \t\t\tif (ret_code) {\n \t\t\t\tret_code = I40E_ERR_NVM_CHECKSUM;\n \t\t\t\tgoto i40e_calc_nvm_checksum_exit;\n@@ -593,13 +640,18 @@ i40e_status i40e_validate_nvm_checksum(struct i40e_hw *hw,\n \tu16 checksum_sr = 0;\n \tu16 checksum_local = 0;\n \n-\tret_code = i40e_calc_nvm_checksum(hw, &checksum_local);\n-\tif (ret_code)\n+\tif (hw->flags & I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE)\n+\t\tret_code = i40e_acquire_nvm(hw, I40E_RESOURCE_READ);\n+\tif (!ret_code) {\n+\t\tret_code = i40e_calc_nvm_checksum(hw, &checksum_local);\n+\t\tif (hw->flags & I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE)\n+\t\t\ti40e_release_nvm(hw);\n+\t\tif (ret_code)\n+\t\t\tgoto i40e_validate_nvm_checksum_exit;\n+\t} else {\n \t\tgoto i40e_validate_nvm_checksum_exit;\n+\t}\n \n-\t/* Do not use i40e_read_nvm_word() because we do not want to take\n-\t * the synchronization semaphores twice here.\n-\t */\n \ti40e_read_nvm_word(hw, I40E_SR_SW_CHECKSUM_WORD, &checksum_sr);\n \n \t/* Verify read checksum from EEPROM is the same as\n@@ -958,6 +1010,7 @@ retry:\n \t\tbreak;\n \n \tcase I40E_NVMUPD_CSUM_CON:\n+\t\t/* Assumes the caller has acquired the nvm */\n \t\tstatus = i40e_update_nvm_checksum(hw);\n \t\tif (status) {\n \t\t\t*perrno = hw->aq.asq_last_status ?\n@@ -971,6 +1024,7 @@ retry:\n \t\tbreak;\n \n \tcase I40E_NVMUPD_CSUM_LCB:\n+\t\t/* Assumes the caller has acquired the nvm */\n \t\tstatus = i40e_update_nvm_checksum(hw);\n \t\tif (status) {\n \t\t\t*perrno = hw->aq.asq_last_status ?\n", "prefixes": [ "v2", "next", "S23", "9/13" ] }