Message ID | 20240118134332.470907-3-jedrzej.jagielski@intel.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [iwl-next,v3,1/3] ixgbe: Convert ret val type from s32 to int | expand |
Dear Jedrzej, Thank you for your patch. Two nits regarding the commit message. For the summary: *Clean up* after type conver*s*ion. Am 18.01.24 um 14:43 schrieb Jedrzej Jagielski:> Clean up code where touched during type convertion by the patch 1. Clean up the code, touched during … 2. conver*s*ion > 8035560dbfaf. Rearrange to fix reverse Christmas tree. Is re-arranging the only thing done by the patch? Maybe that should be the commit message summary/title then. Kind regards, Paul > Suggested-by: Tony Nguyen <anthony.l.nguyen@intel.com> > Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com> > --- > .../net/ethernet/intel/ixgbe/ixgbe_82598.c | 14 ++-- > .../net/ethernet/intel/ixgbe/ixgbe_82599.c | 40 +++++------ > .../net/ethernet/intel/ixgbe/ixgbe_common.c | 66 +++++++++---------- > .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 2 +- > drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 54 +++++++-------- > drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c | 12 ++-- > drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 50 +++++++------- > 7 files changed, 119 insertions(+), 119 deletions(-) […]
On 1/18/24 14:43, Jedrzej Jagielski wrote: > Clean up code where touched during type convertion by the patch > 8035560dbfaf. Rearrange to fix reverse Christmas tree I don't see this SHA in my copy, please fix it. > > Suggested-by: Tony Nguyen <anthony.l.nguyen@intel.com> > Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com> > --- > .../net/ethernet/intel/ixgbe/ixgbe_82598.c | 14 ++-- > .../net/ethernet/intel/ixgbe/ixgbe_82599.c | 40 +++++------ > .../net/ethernet/intel/ixgbe/ixgbe_common.c | 66 +++++++++---------- > .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 2 +- > drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 54 +++++++-------- > drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c | 12 ++-- > drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 50 +++++++------- > 7 files changed, 119 insertions(+), 119 deletions(-) > code changes are fine, Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
On Thu, Jan 18, 2024 at 02:43:32PM +0100, Jedrzej Jagielski wrote: > Clean up code where touched during type convertion by the patch > 8035560dbfaf. Rearrange to fix reverse Christmas tree. > > Suggested-by: Tony Nguyen <anthony.l.nguyen@intel.com> > Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com> ... > @@ -771,12 +771,12 @@ static int ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw, > ixgbe_link_speed speed, > bool autoneg_wait_to_complete) > { > - bool autoneg = false; > - int status; > - u32 pma_pmd_1g, link_mode, links_reg, i; > - u32 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2); > u32 pma_pmd_10g_serial = autoc2 & IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_MASK; > ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN; > + u32 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2); > + u32 pma_pmd_1g, link_mode, links_reg, i; > + bool autoneg = false; > + int status; Hi Jedrzej, In the new arrangement above autoc2 is used before it is declared. Perhaps this could be: ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN; u32 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2); u32 pma_pmd_1g, link_mode, links_reg, i; u32 pma_pmd_10g_serial; bool autoneg = false; int status; ... pma_pmd_10g_serial = autoc2 & IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_MASK; > > /* holds the value of AUTOC register at this current point in time */ > u32 current_autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); ...
Hi Jedrzej, kernel test robot noticed the following build warnings: [auto build test WARNING on tnguy-next-queue/dev-queue] url: https://github.com/intel-lab-lkp/linux/commits/Jedrzej-Jagielski/ixgbe-Fix-smatch-warnings-after-type-convertion/20240119-015659 base: https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git dev-queue patch link: https://lore.kernel.org/r/20240118134332.470907-3-jedrzej.jagielski%40intel.com patch subject: [PATCH iwl-next v3 3/3] ixgbe: Cleanup after type convertion config: sparc-allyesconfig (https://download.01.org/0day-ci/archive/20240120/202401201343.wjSFEBK2-lkp@intel.com/config) compiler: sparc64-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240120/202401201343.wjSFEBK2-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202401201343.wjSFEBK2-lkp@intel.com/ All warnings (new ones prefixed by >>): drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c: In function 'ixgbe_setup_mac_link_82599': drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c:774:34: error: 'autoc2' undeclared (first use in this function) 774 | u32 pma_pmd_10g_serial = autoc2 & IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_MASK; | ^~~~~~ drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c:774:34: note: each undeclared identifier is reported only once for each function it appears in >> drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c:776:13: warning: unused variable 'autoc2' [-Wunused-variable] 776 | u32 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2); | ^~~~~~ vim +/autoc2 +776 drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c 761 762 /** 763 * ixgbe_setup_mac_link_82599 - Set MAC link speed 764 * @hw: pointer to hardware structure 765 * @speed: new link speed 766 * @autoneg_wait_to_complete: true when waiting for completion is needed 767 * 768 * Set the link speed in the AUTOC register and restarts link. 769 **/ 770 static int ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw, 771 ixgbe_link_speed speed, 772 bool autoneg_wait_to_complete) 773 { 774 u32 pma_pmd_10g_serial = autoc2 & IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_MASK; 775 ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN; > 776 u32 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2); 777 u32 pma_pmd_1g, link_mode, links_reg, i; 778 bool autoneg = false; 779 int status; 780 781 /* holds the value of AUTOC register at this current point in time */ 782 u32 current_autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); 783 /* holds the cached value of AUTOC register */ 784 u32 orig_autoc = 0; 785 /* temporary variable used for comparison purposes */ 786 u32 autoc = current_autoc; 787 788 /* Check to see if speed passed in is supported. */ 789 status = hw->mac.ops.get_link_capabilities(hw, &link_capabilities, 790 &autoneg); 791 if (status) 792 return status; 793 794 speed &= link_capabilities; 795 796 if (speed == IXGBE_LINK_SPEED_UNKNOWN) 797 return -EINVAL; 798 799 /* Use stored value (EEPROM defaults) of AUTOC to find KR/KX4 support*/ 800 if (hw->mac.orig_link_settings_stored) 801 orig_autoc = hw->mac.orig_autoc; 802 else 803 orig_autoc = autoc; 804 805 link_mode = autoc & IXGBE_AUTOC_LMS_MASK; 806 pma_pmd_1g = autoc & IXGBE_AUTOC_1G_PMA_PMD_MASK; 807 808 if (link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR || 809 link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN || 810 link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) { 811 /* Set KX4/KX/KR support according to speed requested */ 812 autoc &= ~(IXGBE_AUTOC_KX4_KX_SUPP_MASK | IXGBE_AUTOC_KR_SUPP); 813 if (speed & IXGBE_LINK_SPEED_10GB_FULL) { 814 if (orig_autoc & IXGBE_AUTOC_KX4_SUPP) 815 autoc |= IXGBE_AUTOC_KX4_SUPP; 816 if ((orig_autoc & IXGBE_AUTOC_KR_SUPP) && 817 (hw->phy.smart_speed_active == false)) 818 autoc |= IXGBE_AUTOC_KR_SUPP; 819 } 820 if (speed & IXGBE_LINK_SPEED_1GB_FULL) 821 autoc |= IXGBE_AUTOC_KX_SUPP; 822 } else if ((pma_pmd_1g == IXGBE_AUTOC_1G_SFI) && 823 (link_mode == IXGBE_AUTOC_LMS_1G_LINK_NO_AN || 824 link_mode == IXGBE_AUTOC_LMS_1G_AN)) { 825 /* Switch from 1G SFI to 10G SFI if requested */ 826 if ((speed == IXGBE_LINK_SPEED_10GB_FULL) && 827 (pma_pmd_10g_serial == IXGBE_AUTOC2_10G_SFI)) { 828 autoc &= ~IXGBE_AUTOC_LMS_MASK; 829 autoc |= IXGBE_AUTOC_LMS_10G_SERIAL; 830 } 831 } else if ((pma_pmd_10g_serial == IXGBE_AUTOC2_10G_SFI) && 832 (link_mode == IXGBE_AUTOC_LMS_10G_SERIAL)) { 833 /* Switch from 10G SFI to 1G SFI if requested */ 834 if ((speed == IXGBE_LINK_SPEED_1GB_FULL) && 835 (pma_pmd_1g == IXGBE_AUTOC_1G_SFI)) { 836 autoc &= ~IXGBE_AUTOC_LMS_MASK; 837 if (autoneg) 838 autoc |= IXGBE_AUTOC_LMS_1G_AN; 839 else 840 autoc |= IXGBE_AUTOC_LMS_1G_LINK_NO_AN; 841 } 842 } 843 844 if (autoc != current_autoc) { 845 /* Restart link */ 846 status = hw->mac.ops.prot_autoc_write(hw, autoc, false); 847 if (status) 848 return status; 849 850 /* Only poll for autoneg to complete if specified to do so */ 851 if (autoneg_wait_to_complete) { 852 if (link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR || 853 link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN || 854 link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) { 855 links_reg = 0; /*Just in case Autoneg time=0*/ 856 for (i = 0; i < IXGBE_AUTO_NEG_TIME; i++) { 857 links_reg = 858 IXGBE_READ_REG(hw, IXGBE_LINKS); 859 if (links_reg & IXGBE_LINKS_KX_AN_COMP) 860 break; 861 msleep(100); 862 } 863 if (!(links_reg & IXGBE_LINKS_KX_AN_COMP)) { 864 status = -EIO; 865 hw_dbg(hw, "Autoneg did not complete.\n"); 866 } 867 } 868 } 869 870 /* Add delay to filter out noises during initial link setup */ 871 msleep(50); 872 } 873 874 return status; 875 } 876
Hi Jedrzej,
kernel test robot noticed the following build errors:
[auto build test ERROR on tnguy-next-queue/dev-queue]
url: https://github.com/intel-lab-lkp/linux/commits/Jedrzej-Jagielski/ixgbe-Fix-smatch-warnings-after-type-convertion/20240119-015659
base: https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git dev-queue
patch link: https://lore.kernel.org/r/20240118134332.470907-3-jedrzej.jagielski%40intel.com
patch subject: [PATCH iwl-next v3 3/3] ixgbe: Cleanup after type convertion
config: x86_64-rhel-8.3-rust (https://download.01.org/0day-ci/archive/20240120/202401201602.Mg8UEw6K-lkp@intel.com/config)
compiler: ClangBuiltLinux clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240120/202401201602.Mg8UEw6K-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401201602.Mg8UEw6K-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c:774:27: error: use of undeclared identifier 'autoc2'
774 | u32 pma_pmd_10g_serial = autoc2 & IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_MASK;
| ^
1 error generated.
vim +/autoc2 +774 drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
cd7e1f0b056c07 drivers/net/ixgbe/ixgbe_82599.c Don Skidmore 2009-10-08 761
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 762 /**
8620a103b5e38d drivers/net/ixgbe/ixgbe_82599.c Mallikarjuna R Chilakala 2009-09-01 763 * ixgbe_setup_mac_link_82599 - Set MAC link speed
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 764 * @hw: pointer to hardware structure
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 765 * @speed: new link speed
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 766 * @autoneg_wait_to_complete: true when waiting for completion is needed
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 767 *
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 768 * Set the link speed in the AUTOC register and restarts link.
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 769 **/
7e23e4751a3586 drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Jedrzej Jagielski 2024-01-18 770 static int ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
fd0326f2cf9e5d drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Josh Hay 2012-12-15 771 ixgbe_link_speed speed,
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 772 bool autoneg_wait_to_complete)
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 773 {
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 @774 u32 pma_pmd_10g_serial = autoc2 & IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_MASK;
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 775 ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN;
36f3bb88d9a5de drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Jedrzej Jagielski 2024-01-18 776 u32 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2);
36f3bb88d9a5de drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Jedrzej Jagielski 2024-01-18 777 u32 pma_pmd_1g, link_mode, links_reg, i;
36f3bb88d9a5de drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Jedrzej Jagielski 2024-01-18 778 bool autoneg = false;
36f3bb88d9a5de drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Jedrzej Jagielski 2024-01-18 779 int status;
ee98b577e7711d drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Jacob Keller 2014-02-22 780
ee98b577e7711d drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Jacob Keller 2014-02-22 781 /* holds the value of AUTOC register at this current point in time */
ee98b577e7711d drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Jacob Keller 2014-02-22 782 u32 current_autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
ee98b577e7711d drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Jacob Keller 2014-02-22 783 /* holds the cached value of AUTOC register */
ee98b577e7711d drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Jacob Keller 2014-02-22 784 u32 orig_autoc = 0;
ee98b577e7711d drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Jacob Keller 2014-02-22 785 /* temporary variable used for comparison purposes */
ee98b577e7711d drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Jacob Keller 2014-02-22 786 u32 autoc = current_autoc;
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 787
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 788 /* Check to see if speed passed in is supported. */
9cdcf098800d95 drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Don Skidmore 2012-02-17 789 status = hw->mac.ops.get_link_capabilities(hw, &link_capabilities,
9cdcf098800d95 drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Don Skidmore 2012-02-17 790 &autoneg);
e90dd264566405 drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Mark Rustad 2014-07-22 791 if (status)
e90dd264566405 drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Mark Rustad 2014-07-22 792 return status;
0b0c2b31bdf8d6 drivers/net/ixgbe/ixgbe_82599.c Emil Tantilov 2011-02-26 793
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 794 speed &= link_capabilities;
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 795
e90dd264566405 drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Mark Rustad 2014-07-22 796 if (speed == IXGBE_LINK_SPEED_UNKNOWN)
5795f533f30a80 drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Jedrzej Jagielski 2023-12-18 797 return -EINVAL;
50ac58ba1d707d drivers/net/ixgbe/ixgbe_82599.c Peter P Waskiewicz Jr 2009-06-04 798
1eb99d5ac44e2a drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-04-09 799 /* Use stored value (EEPROM defaults) of AUTOC to find KR/KX4 support*/
1eb99d5ac44e2a drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-04-09 800 if (hw->mac.orig_link_settings_stored)
ee98b577e7711d drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Jacob Keller 2014-02-22 801 orig_autoc = hw->mac.orig_autoc;
1eb99d5ac44e2a drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-04-09 802 else
1eb99d5ac44e2a drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-04-09 803 orig_autoc = autoc;
ee98b577e7711d drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Jacob Keller 2014-02-22 804
5e82f2f07645ef drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Emil Tantilov 2013-04-12 805 link_mode = autoc & IXGBE_AUTOC_LMS_MASK;
5e82f2f07645ef drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Emil Tantilov 2013-04-12 806 pma_pmd_1g = autoc & IXGBE_AUTOC_1G_PMA_PMD_MASK;
1eb99d5ac44e2a drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-04-09 807
50ac58ba1d707d drivers/net/ixgbe/ixgbe_82599.c Peter P Waskiewicz Jr 2009-06-04 808 if (link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR ||
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 809 link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN ||
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 810 link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) {
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 811 /* Set KX4/KX/KR support according to speed requested */
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 812 autoc &= ~(IXGBE_AUTOC_KX4_KX_SUPP_MASK | IXGBE_AUTOC_KR_SUPP);
55461ddbcb0b36 drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Emil Tantilov 2012-08-10 813 if (speed & IXGBE_LINK_SPEED_10GB_FULL) {
1eb99d5ac44e2a drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-04-09 814 if (orig_autoc & IXGBE_AUTOC_KX4_SUPP)
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 815 autoc |= IXGBE_AUTOC_KX4_SUPP;
cd7e1f0b056c07 drivers/net/ixgbe/ixgbe_82599.c Don Skidmore 2009-10-08 816 if ((orig_autoc & IXGBE_AUTOC_KR_SUPP) &&
cd7e1f0b056c07 drivers/net/ixgbe/ixgbe_82599.c Don Skidmore 2009-10-08 817 (hw->phy.smart_speed_active == false))
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 818 autoc |= IXGBE_AUTOC_KR_SUPP;
55461ddbcb0b36 drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Emil Tantilov 2012-08-10 819 }
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 820 if (speed & IXGBE_LINK_SPEED_1GB_FULL)
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 821 autoc |= IXGBE_AUTOC_KX_SUPP;
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 822 } else if ((pma_pmd_1g == IXGBE_AUTOC_1G_SFI) &&
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 823 (link_mode == IXGBE_AUTOC_LMS_1G_LINK_NO_AN ||
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 824 link_mode == IXGBE_AUTOC_LMS_1G_AN)) {
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 825 /* Switch from 1G SFI to 10G SFI if requested */
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 826 if ((speed == IXGBE_LINK_SPEED_10GB_FULL) &&
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 827 (pma_pmd_10g_serial == IXGBE_AUTOC2_10G_SFI)) {
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 828 autoc &= ~IXGBE_AUTOC_LMS_MASK;
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 829 autoc |= IXGBE_AUTOC_LMS_10G_SERIAL;
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 830 }
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 831 } else if ((pma_pmd_10g_serial == IXGBE_AUTOC2_10G_SFI) &&
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 832 (link_mode == IXGBE_AUTOC_LMS_10G_SERIAL)) {
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 833 /* Switch from 10G SFI to 1G SFI if requested */
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 834 if ((speed == IXGBE_LINK_SPEED_1GB_FULL) &&
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 835 (pma_pmd_1g == IXGBE_AUTOC_1G_SFI)) {
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 836 autoc &= ~IXGBE_AUTOC_LMS_MASK;
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 837 if (autoneg)
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 838 autoc |= IXGBE_AUTOC_LMS_1G_AN;
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 839 else
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 840 autoc |= IXGBE_AUTOC_LMS_1G_LINK_NO_AN;
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 841 }
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 842 }
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 843
ee98b577e7711d drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Jacob Keller 2014-02-22 844 if (autoc != current_autoc) {
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 845 /* Restart link */
429d6a3be9b656 drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Don Skidmore 2014-02-27 846 status = hw->mac.ops.prot_autoc_write(hw, autoc, false);
f8cf7a00d82b6c drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Don Skidmore 2014-03-19 847 if (status)
e90dd264566405 drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Mark Rustad 2014-07-22 848 return status;
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 849
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 850 /* Only poll for autoneg to complete if specified to do so */
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 851 if (autoneg_wait_to_complete) {
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 852 if (link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR ||
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 853 link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN ||
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 854 link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) {
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 855 links_reg = 0; /*Just in case Autoneg time=0*/
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 856 for (i = 0; i < IXGBE_AUTO_NEG_TIME; i++) {
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 857 links_reg =
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 858 IXGBE_READ_REG(hw, IXGBE_LINKS);
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 859 if (links_reg & IXGBE_LINKS_KX_AN_COMP)
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 860 break;
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 861 msleep(100);
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 862 }
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 863 if (!(links_reg & IXGBE_LINKS_KX_AN_COMP)) {
5795f533f30a80 drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Jedrzej Jagielski 2023-12-18 864 status = -EIO;
305f8cec7be51e drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c Jacob Keller 2014-02-22 865 hw_dbg(hw, "Autoneg did not complete.\n");
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 866 }
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 867 }
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 868 }
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 869
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 870 /* Add delay to filter out noises during initial link setup */
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 871 msleep(50);
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 872 }
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 873
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 874 return status;
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 875 }
11afc1b1fd802c drivers/net/ixgbe/ixgbe_82599.c PJ Waskiewicz 2009-02-27 876
From: Kitszel, Przemyslaw <przemyslaw.kitszel@intel.com> Sent: Thursday, January 18, 2024 3:34 PM >On 1/18/24 14:43, Jedrzej Jagielski wrote: >> Clean up code where touched during type convertion by the patch >> 8035560dbfaf. Rearrange to fix reverse Christmas tree >I don't see this SHA in my copy, please fix it. I see this as the SHA of the patch 1/3 'ixgbe: Convert ret val type from s32 to int' What is the SHA of this patch in your copy then? > >> >> Suggested-by: Tony Nguyen <anthony.l.nguyen@intel.com> >> Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com> >> --- >> .../net/ethernet/intel/ixgbe/ixgbe_82598.c | 14 ++-- >> .../net/ethernet/intel/ixgbe/ixgbe_82599.c | 40 +++++------ >> .../net/ethernet/intel/ixgbe/ixgbe_common.c | 66 +++++++++---------- >> .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 2 +- >> drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 54 +++++++-------- >> drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c | 12 ++-- >> drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 50 +++++++------- >> 7 files changed, 119 insertions(+), 119 deletions(-) >> > >code changes are fine, >Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c index 4e3fec1e47aa..76314ae58038 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c @@ -97,8 +97,8 @@ static int ixgbe_init_phy_ops_82598(struct ixgbe_hw *hw) { struct ixgbe_mac_info *mac = &hw->mac; struct ixgbe_phy_info *phy = &hw->phy; - int ret_val; u16 list_offset, data_offset; + int ret_val; /* Identify the PHY */ phy->ops.identify(hw); @@ -414,10 +414,10 @@ static int ixgbe_fc_enable_82598(struct ixgbe_hw *hw) static int ixgbe_start_mac_link_82598(struct ixgbe_hw *hw, bool autoneg_wait_to_complete) { + int status = 0; u32 autoc_reg; u32 links_reg; u32 i; - int status = 0; /* Restart link */ autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); @@ -649,13 +649,13 @@ static int ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw, **/ static int ixgbe_reset_hw_82598(struct ixgbe_hw *hw) { - int status; int phy_status = 0; - u32 ctrl; + u8 analog_val; u32 gheccr; - u32 i; + int status; u32 autoc; - u8 analog_val; + u32 ctrl; + u32 i; /* Call adapter stop to disable tx/rx and clear interrupts */ status = hw->mac.ops.stop_adapter(hw); @@ -951,10 +951,10 @@ static int ixgbe_write_analog_reg8_82598(struct ixgbe_hw *hw, u32 reg, u8 val) static int ixgbe_read_i2c_phy_82598(struct ixgbe_hw *hw, u8 dev_addr, u8 byte_offset, u8 *eeprom_data) { - int status = 0; u16 sfp_addr = 0; u16 sfp_data = 0; u16 sfp_stat = 0; + int status = 0; u16 gssr; u32 i; diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c index f35378692ae9..f7cd2d3e30be 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c @@ -100,8 +100,8 @@ static void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw) static int ixgbe_setup_sfp_modules_82599(struct ixgbe_hw *hw) { - int ret_val; u16 list_offset, data_offset, data_value; + int ret_val; if (hw->phy.sfp_type != ixgbe_sfp_type_unknown) { ixgbe_init_mac_link_ops_82599(hw); @@ -503,11 +503,11 @@ static void ixgbe_stop_mac_link_on_d3_82599(struct ixgbe_hw *hw) static int ixgbe_start_mac_link_82599(struct ixgbe_hw *hw, bool autoneg_wait_to_complete) { + bool got_lock = false; + int status = 0; u32 autoc_reg; u32 links_reg; u32 i; - int status = 0; - bool got_lock = false; if (ixgbe_verify_lesm_fw_enabled_82599(hw)) { status = hw->mac.ops.acquire_swfw_sync(hw, @@ -661,11 +661,11 @@ static int ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw, ixgbe_link_speed speed, bool autoneg_wait_to_complete) { - int status = 0; ixgbe_link_speed link_speed = IXGBE_LINK_SPEED_UNKNOWN; - s32 i, j; - bool link_up = false; u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); + bool link_up = false; + int status = 0; + s32 i, j; /* Set autoneg_advertised value based on input link speed */ hw->phy.autoneg_advertised = 0; @@ -771,12 +771,12 @@ static int ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw, ixgbe_link_speed speed, bool autoneg_wait_to_complete) { - bool autoneg = false; - int status; - u32 pma_pmd_1g, link_mode, links_reg, i; - u32 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2); u32 pma_pmd_10g_serial = autoc2 & IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_MASK; ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN; + u32 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2); + u32 pma_pmd_1g, link_mode, links_reg, i; + bool autoneg = false; + int status; /* holds the value of AUTOC register at this current point in time */ u32 current_autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); @@ -908,10 +908,10 @@ static int ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw, static int ixgbe_reset_hw_82599(struct ixgbe_hw *hw) { ixgbe_link_speed link_speed; - int status; u32 ctrl, i, autoc, autoc2; - u32 curr_lms; bool link_up = false; + u32 curr_lms; + int status; /* Call adapter stop to disable tx/rx and clear interrupts */ status = hw->mac.ops.stop_adapter(hw); @@ -1101,10 +1101,10 @@ static int ixgbe_fdir_check_cmd_complete(struct ixgbe_hw *hw, u32 *fdircmd) **/ int ixgbe_reinit_fdir_tables_82599(struct ixgbe_hw *hw) { - int i; u32 fdirctrl = IXGBE_READ_REG(hw, IXGBE_FDIRCTRL); u32 fdircmd; int err; + int i; fdirctrl &= ~IXGBE_FDIRCTRL_INIT_DONE; @@ -1869,8 +1869,8 @@ static int ixgbe_verify_fw_version_82599(struct ixgbe_hw *hw) { u16 fw_offset, fw_ptp_cfg_offset; int status = -EACCES; - u16 offset; u16 fw_version = 0; + u16 offset; /* firmware check is only necessary for SFI devices */ if (hw->phy.media_type != ixgbe_media_type_fiber) @@ -2008,9 +2008,9 @@ static int ixgbe_read_eeprom_82599(struct ixgbe_hw *hw, **/ static int ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw) { - int ret_val; - u32 anlp1_reg = 0; u32 i, autoc_reg, autoc2_reg; + u32 anlp1_reg = 0; + int ret_val; /* Enable link if disabled in NVM */ autoc2_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC2); @@ -2064,9 +2064,9 @@ static int ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw) static int ixgbe_read_i2c_byte_82599(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr, u8 *data) { - u32 esdp; - int status; s32 timeout = 200; + int status; + u32 esdp; if (hw->phy.qsfp_shared_i2c_bus == true) { /* Acquire I2C bus ownership. */ @@ -2118,9 +2118,9 @@ static int ixgbe_read_i2c_byte_82599(struct ixgbe_hw *hw, u8 byte_offset, static int ixgbe_write_i2c_byte_82599(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr, u8 data) { - u32 esdp; - int status; s32 timeout = 200; + int status; + u32 esdp; if (hw->phy.qsfp_shared_i2c_bus == true) { /* Acquire I2C bus ownership. */ diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c index 9a1d2601a739..a18d0b275b3e 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c @@ -113,10 +113,10 @@ bool ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw) **/ int ixgbe_setup_fc_generic(struct ixgbe_hw *hw) { - int ret_val = 0; u32 reg = 0, reg_bp = 0; - u16 reg_cu = 0; bool locked = false; + int ret_val = 0; + u16 reg_cu = 0; /* * Validate the requested mode. Strict IEEE mode does not allow @@ -269,9 +269,9 @@ int ixgbe_setup_fc_generic(struct ixgbe_hw *hw) **/ int ixgbe_start_hw_generic(struct ixgbe_hw *hw) { - int ret_val; - u32 ctrl_ext; u16 device_caps; + u32 ctrl_ext; + int ret_val; /* Set the media type */ hw->phy.media_type = hw->mac.ops.get_media_type(hw); @@ -493,10 +493,10 @@ int ixgbe_read_pba_string_generic(struct ixgbe_hw *hw, u8 *pba_num, u32 pba_num_size) { int ret_val; - u16 data; u16 pba_ptr; u16 offset; u16 length; + u16 data; if (pba_num == NULL) { hw_dbg(hw, "PBA string buffer was null\n"); @@ -898,8 +898,8 @@ int ixgbe_init_eeprom_params_generic(struct ixgbe_hw *hw) int ixgbe_write_eeprom_buffer_bit_bang_generic(struct ixgbe_hw *hw, u16 offset, u16 words, u16 *data) { - int status; u16 i, count; + int status; hw->eeprom.ops.init_params(hw); @@ -945,11 +945,11 @@ int ixgbe_write_eeprom_buffer_bit_bang_generic(struct ixgbe_hw *hw, u16 offset, static int ixgbe_write_eeprom_buffer_bit_bang(struct ixgbe_hw *hw, u16 offset, u16 words, u16 *data) { + u8 write_opcode = IXGBE_EEPROM_WRITE_OPCODE_SPI; + u16 page_size; int status; u16 word; - u16 page_size; u16 i; - u8 write_opcode = IXGBE_EEPROM_WRITE_OPCODE_SPI; /* Prepare the EEPROM for writing */ status = ixgbe_acquire_eeprom(hw); @@ -1041,8 +1041,8 @@ int ixgbe_write_eeprom_generic(struct ixgbe_hw *hw, u16 offset, u16 data) int ixgbe_read_eeprom_buffer_bit_bang_generic(struct ixgbe_hw *hw, u16 offset, u16 words, u16 *data) { - int status; u16 i, count; + int status; hw->eeprom.ops.init_params(hw); @@ -1080,9 +1080,9 @@ int ixgbe_read_eeprom_buffer_bit_bang_generic(struct ixgbe_hw *hw, u16 offset, static int ixgbe_read_eeprom_buffer_bit_bang(struct ixgbe_hw *hw, u16 offset, u16 words, u16 *data) { - int status; - u16 word_in; u8 read_opcode = IXGBE_EEPROM_READ_OPCODE_SPI; + u16 word_in; + int status; u16 i; /* Prepare the EEPROM for reading */ @@ -1152,8 +1152,8 @@ int ixgbe_read_eeprom_bit_bang_generic(struct ixgbe_hw *hw, u16 offset, int ixgbe_read_eerd_buffer_generic(struct ixgbe_hw *hw, u16 offset, u16 words, u16 *data) { - u32 eerd; int status; + u32 eerd; u32 i; hw->eeprom.ops.init_params(hw); @@ -1246,8 +1246,8 @@ int ixgbe_read_eerd_generic(struct ixgbe_hw *hw, u16 offset, u16 *data) int ixgbe_write_eewr_buffer_generic(struct ixgbe_hw *hw, u16 offset, u16 words, u16 *data) { - u32 eewr; int status; + u32 eewr; u16 i; hw->eeprom.ops.init_params(hw); @@ -1742,9 +1742,9 @@ int ixgbe_calc_eeprom_checksum_generic(struct ixgbe_hw *hw) int ixgbe_validate_eeprom_checksum_generic(struct ixgbe_hw *hw, u16 *checksum_val) { - int status; - u16 checksum; u16 read_checksum = 0; + u16 checksum; + int status; /* * Read the first word from the EEPROM. If this times out or fails, do @@ -1788,8 +1788,8 @@ int ixgbe_validate_eeprom_checksum_generic(struct ixgbe_hw *hw, **/ int ixgbe_update_eeprom_checksum_generic(struct ixgbe_hw *hw) { - int status; u16 checksum; + int status; /* * Read the first word from the EEPROM. If this times out or fails, do @@ -2736,10 +2736,10 @@ int ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval) **/ int ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index) { - ixgbe_link_speed speed = 0; - bool link_up = false; u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); + ixgbe_link_speed speed = 0; + bool link_up = false; bool locked = false; int ret_val; @@ -2784,9 +2784,9 @@ int ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index) **/ int ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index) { - u32 autoc_reg = 0; u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); bool locked = false; + u32 autoc_reg = 0; int ret_val; if (index > 3) @@ -2852,8 +2852,8 @@ static int ixgbe_get_san_mac_addr_offset(struct ixgbe_hw *hw, int ixgbe_get_san_mac_addr_generic(struct ixgbe_hw *hw, u8 *san_mac_addr) { u16 san_mac_data, san_mac_offset; - u8 i; int ret_val; + u8 i; /* * First read the EEPROM pointer to see if the MAC addresses are @@ -3682,8 +3682,8 @@ int ixgbe_host_interface_command(struct ixgbe_hw *hw, void *buffer, { u32 hdr_size = sizeof(struct ixgbe_hic_hdr); struct ixgbe_hic_hdr *hdr = buffer; - u32 *u32arr = buffer; u16 buf_len, dword_len; + u32 *u32arr = buffer; int status; u32 bi; @@ -3758,8 +3758,8 @@ int ixgbe_set_fw_drv_ver_generic(struct ixgbe_hw *hw, u8 maj, u8 min, __always_unused const char *driver_ver) { struct ixgbe_hic_drv_info fw_cmd; - int i; int ret_val; + int i; fw_cmd.hdr.cmd = FW_CEM_CMD_DRIVER_INFO; fw_cmd.hdr.buf_len = FW_CEM_CMD_DRIVER_INFO_LEN; @@ -3905,11 +3905,11 @@ static int ixgbe_get_ets_data(struct ixgbe_hw *hw, u16 *ets_cfg, **/ int ixgbe_get_thermal_sensor_data_generic(struct ixgbe_hw *hw) { - int status; u16 ets_offset; - u16 ets_cfg; u16 ets_sensor; u8 num_sensors; + u16 ets_cfg; + int status; u8 i; struct ixgbe_thermal_sensor_data *data = &hw->mac.thermal_sensor_data; @@ -3961,15 +3961,15 @@ int ixgbe_get_thermal_sensor_data_generic(struct ixgbe_hw *hw) **/ int ixgbe_init_thermal_sensor_thresh_generic(struct ixgbe_hw *hw) { - int status; - u16 ets_offset; - u16 ets_cfg; - u16 ets_sensor; + struct ixgbe_thermal_sensor_data *data = &hw->mac.thermal_sensor_data; u8 low_thresh_delta; u8 num_sensors; u8 therm_limit; + u16 ets_sensor; + u16 ets_offset; + u16 ets_cfg; + int status; u8 i; - struct ixgbe_thermal_sensor_data *data = &hw->mac.thermal_sensor_data; memset(data, 0, sizeof(struct ixgbe_thermal_sensor_data)); @@ -4196,12 +4196,12 @@ int ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw, ixgbe_link_speed speed, bool autoneg_wait_to_complete) { - ixgbe_link_speed link_speed = IXGBE_LINK_SPEED_UNKNOWN; ixgbe_link_speed highest_link_speed = IXGBE_LINK_SPEED_UNKNOWN; - int status = 0; + ixgbe_link_speed link_speed = IXGBE_LINK_SPEED_UNKNOWN; + bool autoneg, link_up = false; u32 speedcnt = 0; + int status = 0; u32 i = 0; - bool autoneg, link_up = false; /* Mask off requested but non-supported speeds */ status = hw->mac.ops.get_link_capabilities(hw, &link_speed, &autoneg); @@ -4340,8 +4340,8 @@ int ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw, void ixgbe_set_soft_rate_select_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed) { - int status; u8 rs, eeprom_data; + int status; switch (speed) { case IXGBE_LINK_SPEED_10GB_FULL: diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c index dba2be48805a..98e3f0479fac 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c @@ -3326,9 +3326,9 @@ static int ixgbe_get_module_info(struct net_device *dev, { struct ixgbe_adapter *adapter = netdev_priv(dev); struct ixgbe_hw *hw = &adapter->hw; - int status; u8 sff8472_rev, addr_mode; bool page_swap = false; + int status; if (hw->phy.type == ixgbe_phy_fw) return -ENXIO; diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c index e9c34061905a..2387657b4e77 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c @@ -334,9 +334,9 @@ bool ixgbe_check_reset_blocked(struct ixgbe_hw *hw) **/ static int ixgbe_get_phy_id(struct ixgbe_hw *hw) { - int status; u16 phy_id_high = 0; u16 phy_id_low = 0; + int status; status = hw->phy.ops.read_reg(hw, MDIO_DEVID1, MDIO_MMD_PMAPMD, &phy_id_high); @@ -549,8 +549,8 @@ int ixgbe_read_phy_reg_mdi(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type, int ixgbe_read_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type, u16 *phy_data) { - int status; u32 gssr = hw->phy.phy_semaphore_mask; + int status; if (hw->mac.ops.acquire_swfw_sync(hw, gssr) == 0) { status = ixgbe_read_phy_reg_mdi(hw, reg_addr, device_type, @@ -647,8 +647,8 @@ int ixgbe_write_phy_reg_mdi(struct ixgbe_hw *hw, u32 reg_addr, int ixgbe_write_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type, u16 phy_data) { - int status; u32 gssr = hw->phy.phy_semaphore_mask; + int status; if (hw->mac.ops.acquire_swfw_sync(hw, gssr) == 0) { status = ixgbe_write_phy_reg_mdi(hw, reg_addr, device_type, @@ -1097,10 +1097,10 @@ int ixgbe_mii_bus_init(struct ixgbe_hw *hw) **/ int ixgbe_setup_phy_link_generic(struct ixgbe_hw *hw) { - int status = 0; u16 autoneg_reg = IXGBE_MII_AUTONEG_REG; - bool autoneg = false; ixgbe_link_speed speed; + bool autoneg = false; + int status = 0; ixgbe_get_copper_link_capabilities_generic(hw, &speed, &autoneg); @@ -1279,12 +1279,12 @@ int ixgbe_get_copper_link_capabilities_generic(struct ixgbe_hw *hw, int ixgbe_check_phy_link_tnx(struct ixgbe_hw *hw, ixgbe_link_speed *speed, bool *link_up) { - int status; - u32 time_out; u32 max_time_out = 10; - u16 phy_link = 0; u16 phy_speed = 0; + u16 phy_link = 0; u16 phy_data = 0; + u32 time_out; + int status; /* Initialize speed and link to default case */ *link_up = false; @@ -1402,8 +1402,8 @@ int ixgbe_setup_phy_link_tnx(struct ixgbe_hw *hw) int ixgbe_reset_phy_nl(struct ixgbe_hw *hw) { u16 phy_offset, control, eword, edata, block_crc; - bool end_data = false; u16 list_offset, data_offset; + bool end_data = false; u16 phy_data = 0; int ret_val; u32 i; @@ -1529,17 +1529,17 @@ int ixgbe_identify_module_generic(struct ixgbe_hw *hw) **/ int ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw) { + enum ixgbe_sfp_type stored_sfp_type = hw->phy.sfp_type; struct ixgbe_adapter *adapter = hw->back; - int status; + u8 oui_bytes[3] = {0, 0, 0}; + u8 comp_codes_10g = 0; + u8 comp_codes_1g = 0; + u16 enforce_sfp = 0; u32 vendor_oui = 0; - enum ixgbe_sfp_type stored_sfp_type = hw->phy.sfp_type; u8 identifier = 0; - u8 comp_codes_1g = 0; - u8 comp_codes_10g = 0; - u8 oui_bytes[3] = {0, 0, 0}; u8 cable_tech = 0; u8 cable_spec = 0; - u16 enforce_sfp = 0; + int status; if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_fiber) { hw->phy.sfp_type = ixgbe_sfp_type_not_present; @@ -2134,11 +2134,11 @@ static bool ixgbe_is_sfp_probe(struct ixgbe_hw *hw, u8 offset, u8 addr) static int ixgbe_read_i2c_byte_generic_int(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr, u8 *data, bool lock) { - int status; - u32 max_retry = 10; - u32 retry = 0; u32 swfw_mask = hw->phy.phy_semaphore_mask; + u32 max_retry = 10; bool nack = true; + u32 retry = 0; + int status; if (hw->mac.type >= ixgbe_mac_X550) max_retry = 3; @@ -2259,10 +2259,10 @@ int ixgbe_read_i2c_byte_generic_unlocked(struct ixgbe_hw *hw, u8 byte_offset, static int ixgbe_write_i2c_byte_generic_int(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr, u8 data, bool lock) { - int status; + u32 swfw_mask = hw->phy.phy_semaphore_mask; u32 max_retry = 1; u32 retry = 0; - u32 swfw_mask = hw->phy.phy_semaphore_mask; + int status; if (lock && hw->mac.ops.acquire_swfw_sync(hw, swfw_mask)) return -EBUSY; @@ -2424,8 +2424,8 @@ static void ixgbe_i2c_stop(struct ixgbe_hw *hw) **/ static int ixgbe_clock_in_i2c_byte(struct ixgbe_hw *hw, u8 *data) { - int i; bool bit = false; + int i; *data = 0; for (i = 7; i >= 0; i--) { @@ -2445,10 +2445,10 @@ static int ixgbe_clock_in_i2c_byte(struct ixgbe_hw *hw, u8 *data) **/ static int ixgbe_clock_out_i2c_byte(struct ixgbe_hw *hw, u8 data) { + bool bit = false; int status; - int i; u32 i2cctl; - bool bit = false; + int i; for (i = 7; i >= 0; i--) { bit = (data >> i) & 0x1; @@ -2476,12 +2476,12 @@ static int ixgbe_clock_out_i2c_byte(struct ixgbe_hw *hw, u8 data) **/ static int ixgbe_get_i2c_ack(struct ixgbe_hw *hw) { - u32 data_oe_bit = IXGBE_I2C_DATA_OE_N_EN(hw); - int status = 0; - u32 i = 0; u32 i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL(hw)); + u32 data_oe_bit = IXGBE_I2C_DATA_OE_N_EN(hw); u32 timeout = 10; bool ack = true; + int status = 0; + u32 i = 0; if (data_oe_bit) { i2cctl |= IXGBE_I2C_DATA_OUT(hw); @@ -2561,8 +2561,8 @@ static int ixgbe_clock_in_i2c_bit(struct ixgbe_hw *hw, bool *data) **/ static int ixgbe_clock_out_i2c_bit(struct ixgbe_hw *hw, bool data) { - int status; u32 i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL(hw)); + int status; status = ixgbe_set_i2c_data(hw, &i2cctl, data); if (status == 0) { diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c index 39357af77c64..f1ffa398f6df 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c @@ -68,9 +68,9 @@ int ixgbe_setup_mac_link_X540(struct ixgbe_hw *hw, ixgbe_link_speed speed, **/ int ixgbe_reset_hw_X540(struct ixgbe_hw *hw) { - int status; - u32 ctrl, i; u32 swfw_mask = hw->phy.phy_semaphore_mask; + u32 ctrl, i; + int status; /* Call adapter stop to disable tx/rx and clear interrupts */ status = hw->mac.ops.stop_adapter(hw); @@ -382,9 +382,9 @@ static int ixgbe_calc_eeprom_checksum_X540(struct ixgbe_hw *hw) static int ixgbe_validate_eeprom_checksum_X540(struct ixgbe_hw *hw, u16 *checksum_val) { - int status; - u16 checksum; u16 read_checksum = 0; + u16 checksum; + int status; /* Read the first word from the EEPROM. If this times out or fails, do * not continue or we could be in for a very long wait while every @@ -441,8 +441,8 @@ static int ixgbe_validate_eeprom_checksum_X540(struct ixgbe_hw *hw, **/ static int ixgbe_update_eeprom_checksum_X540(struct ixgbe_hw *hw) { - int status; u16 checksum; + int status; /* Read the first word from the EEPROM. If this times out or fails, do * not continue or we could be in for a very long wait while every @@ -486,8 +486,8 @@ static int ixgbe_update_eeprom_checksum_X540(struct ixgbe_hw *hw) **/ static int ixgbe_update_flash_X540(struct ixgbe_hw *hw) { - u32 flup; int status; + u32 flup; status = ixgbe_poll_flash_update_done_X540(hw); if (status == -EIO) { diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c index 56bc1ba184b5..bee1d2f554d3 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c @@ -926,10 +926,10 @@ static int ixgbe_checksum_ptr_x550(struct ixgbe_hw *hw, u16 ptr, u16 size, u16 *csum, u16 *buffer, u32 buffer_size) { - u16 buf[256]; - int status; u16 length, bufsz, i, start; u16 *local_buffer; + u16 buf[256]; + int status; bufsz = ARRAY_SIZE(buf); @@ -994,10 +994,10 @@ static int ixgbe_calc_checksum_X550(struct ixgbe_hw *hw, u16 *buffer, u32 buffer_size) { u16 eeprom_ptrs[IXGBE_EEPROM_LAST_WORD + 1]; + u16 pointer, i, size; u16 *local_buffer; - int status; u16 checksum = 0; - u16 pointer, i, size; + int status; hw->eeprom.ops.init_params(hw); @@ -1120,9 +1120,9 @@ static int ixgbe_read_ee_hostif_X550(struct ixgbe_hw *hw, u16 offset, u16 *data) static int ixgbe_validate_eeprom_checksum_X550(struct ixgbe_hw *hw, u16 *checksum_val) { - int status; - u16 checksum; u16 read_checksum = 0; + u16 checksum; + int status; /* Read the first word from the EEPROM. If this times out or fails, do * not continue or we could be in for a very long wait while every @@ -1170,8 +1170,8 @@ static int ixgbe_validate_eeprom_checksum_X550(struct ixgbe_hw *hw, static int ixgbe_write_ee_hostif_data_X550(struct ixgbe_hw *hw, u16 offset, u16 data) { - int status; struct ixgbe_hic_write_shadow_ram buffer; + int status; buffer.hdr.req.cmd = FW_WRITE_SHADOW_RAM_CMD; buffer.hdr.req.buf_lenh = 0; @@ -1217,8 +1217,8 @@ static int ixgbe_write_ee_hostif_X550(struct ixgbe_hw *hw, u16 offset, u16 data) **/ static int ixgbe_update_flash_X550(struct ixgbe_hw *hw) { - int status = 0; union ixgbe_hic_hdr2 buffer; + int status = 0; buffer.req.cmd = FW_SHADOW_RAM_DUMP_CMD; buffer.req.buf_lenh = 0; @@ -1268,9 +1268,9 @@ static bool ixgbe_fw_recovery_mode_X550(struct ixgbe_hw *hw) **/ static void ixgbe_disable_rx_x550(struct ixgbe_hw *hw) { + struct ixgbe_hic_disable_rxen fw_cmd; u32 rxctrl, pfdtxgswc; int status; - struct ixgbe_hic_disable_rxen fw_cmd; rxctrl = IXGBE_READ_REG(hw, IXGBE_RXCTRL); if (rxctrl & IXGBE_RXCTRL_RXEN) { @@ -1312,8 +1312,8 @@ static void ixgbe_disable_rx_x550(struct ixgbe_hw *hw) **/ static int ixgbe_update_eeprom_checksum_X550(struct ixgbe_hw *hw) { - int status; u16 checksum = 0; + int status; /* Read the first word from the EEPROM. If this times out or fails, do * not continue or we could be in for a very long wait while every @@ -1431,8 +1431,8 @@ static int ixgbe_write_iosf_sb_reg_x550(struct ixgbe_hw *hw, u32 reg_addr, **/ static int ixgbe_setup_ixfi_x550em_x(struct ixgbe_hw *hw) { - int status; u32 reg_val; + int status; /* Disable training protocol FSM. */ status = ixgbe_read_iosf_sb_reg_x550(hw, @@ -1503,8 +1503,8 @@ static int ixgbe_setup_ixfi_x550em_x(struct ixgbe_hw *hw) **/ static int ixgbe_restart_an_internal_phy_x550em(struct ixgbe_hw *hw) { - int status; u32 link_ctrl; + int status; /* Restart auto-negotiation. */ status = hw->mac.ops.read_iosf_sb_reg(hw, @@ -1553,8 +1553,8 @@ static int ixgbe_restart_an_internal_phy_x550em(struct ixgbe_hw *hw) static int ixgbe_setup_ixfi_x550em(struct ixgbe_hw *hw, ixgbe_link_speed *speed) { struct ixgbe_mac_info *mac = &hw->mac; - int status; u32 reg_val; + int status; /* iXFI is only supported with X552 */ if (mac->type != ixgbe_mac_X550EM_x) @@ -1649,9 +1649,9 @@ ixgbe_setup_mac_link_sfp_x550em(struct ixgbe_hw *hw, ixgbe_link_speed speed, __always_unused bool autoneg_wait_to_complete) { - int status; - u16 reg_slice, reg_val; bool setup_linear = false; + u16 reg_slice, reg_val; + int status; /* Check if SFP module is supported and linear */ status = ixgbe_supported_sfp_modules_X550em(hw, &setup_linear); @@ -1693,8 +1693,8 @@ ixgbe_setup_mac_link_sfp_x550em(struct ixgbe_hw *hw, static int ixgbe_setup_sfi_x550a(struct ixgbe_hw *hw, ixgbe_link_speed *speed) { struct ixgbe_mac_info *mac = &hw->mac; - int status; u32 reg_val; + int status; /* Disable all AN and force speed to 10G Serial. */ status = mac->ops.read_iosf_sb_reg(hw, @@ -1921,8 +1921,8 @@ static int ixgbe_setup_mac_link_t_X550em(struct ixgbe_hw *hw, ixgbe_link_speed speed, bool autoneg_wait) { - int status; ixgbe_link_speed force_speed; + int status; /* Setup internal/external PHY link speed to iXFI (10G), unless * only 1G is auto advertised then setup KX link. @@ -2277,8 +2277,8 @@ static void ixgbe_init_mac_link_ops_X550em(struct ixgbe_hw *hw) */ static int ixgbe_setup_sfp_modules_X550em(struct ixgbe_hw *hw) { - int status; bool linear; + int status; /* Check if SFP module is supported */ status = ixgbe_supported_sfp_modules_X550em(hw, &linear); @@ -2581,8 +2581,8 @@ static int ixgbe_handle_lasi_ext_t_x550em(struct ixgbe_hw *hw, static int ixgbe_setup_kr_speed_x550em(struct ixgbe_hw *hw, ixgbe_link_speed speed) { - int status; u32 reg_val; + int status; status = hw->mac.ops.read_iosf_sb_reg(hw, IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), @@ -2868,9 +2868,9 @@ static int ixgbe_set_fw_drv_ver_x550(struct ixgbe_hw *hw, u8 maj, u8 min, static int ixgbe_get_lcd_t_x550em(struct ixgbe_hw *hw, ixgbe_link_speed *lcd_speed) { + u16 word = hw->eeprom.ctrl_word_3; u16 an_lp_status; int status; - u16 word = hw->eeprom.ctrl_word_3; *lcd_speed = IXGBE_LINK_SPEED_UNKNOWN; @@ -3075,10 +3075,10 @@ static void ixgbe_fc_autoneg_fiber_x550em_a(struct ixgbe_hw *hw) static int ixgbe_enter_lplu_t_x550em(struct ixgbe_hw *hw) { u16 an_10g_cntl_reg, autoneg_reg, speed; - int status; ixgbe_link_speed lcd_speed; u32 save_autoneg; bool link_up; + int status; /* If blocked by MNG FW, then don't restart AN */ if (ixgbe_check_reset_blocked(hw)) @@ -3442,12 +3442,12 @@ static void ixgbe_set_mdio_speed(struct ixgbe_hw *hw) **/ static int ixgbe_reset_hw_X550em(struct ixgbe_hw *hw) { + u32 swfw_mask = hw->phy.phy_semaphore_mask; ixgbe_link_speed link_speed; - int status; + bool link_up = false; u32 ctrl = 0; + int status; u32 i; - bool link_up = false; - u32 swfw_mask = hw->phy.phy_semaphore_mask; /* Call adapter stop to disable Tx/Rx and clear interrupts */ status = hw->mac.ops.stop_adapter(hw); @@ -3610,8 +3610,8 @@ static void ixgbe_set_source_address_pruning_X550(struct ixgbe_hw *hw, **/ static int ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw) { - int status = 0; u32 an_cntl = 0; + int status = 0; /* Validate the requested mode */ if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) {
Clean up code where touched during type convertion by the patch 8035560dbfaf. Rearrange to fix reverse Christmas tree. Suggested-by: Tony Nguyen <anthony.l.nguyen@intel.com> Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com> --- .../net/ethernet/intel/ixgbe/ixgbe_82598.c | 14 ++-- .../net/ethernet/intel/ixgbe/ixgbe_82599.c | 40 +++++------ .../net/ethernet/intel/ixgbe/ixgbe_common.c | 66 +++++++++---------- .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 54 +++++++-------- drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c | 12 ++-- drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 50 +++++++------- 7 files changed, 119 insertions(+), 119 deletions(-)