Module Name: src Committed By: msaitoh Date: Wed Jul 24 06:07:58 UTC 2019
Modified Files: src/sys/dev/pci/ixgbe: ixgbe.c ixgbe_type.h Log Message: Fix some problems found by KUBSan: - Set TQSM and RQSM (TX/RX queue statistics mapping) correctly. - Set IVAR (Interrupt Vector Allocation Register) correctly in ixgbe_set_ivar(). - Define IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART correctly. This macro is used in ixgbe_restart_an_internal_phy_x550em(). - Define IXGBE_KRM_TX_COEFF_CTRL_1_OVRRD_EN correctly. This macro is used in ixgbe_setup_ixfi_x550em_x(). - Define IXGBE_SB_IOSF_CTRL_BUSY correctly. This macro is used in ixgbe_iosf_wait() (X550EM only). To generate a diff of this commit: cvs rdiff -u -r1.193 -r1.194 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.40 -r1.41 src/sys/dev/pci/ixgbe/ixgbe_type.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/ixgbe/ixgbe.c diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.193 src/sys/dev/pci/ixgbe/ixgbe.c:1.194 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.193 Wed Jul 17 03:26:24 2019 +++ src/sys/dev/pci/ixgbe/ixgbe.c Wed Jul 24 06:07:57 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.c,v 1.193 2019/07/17 03:26:24 msaitoh Exp $ */ +/* $NetBSD: ixgbe.c,v 1.194 2019/07/24 06:07:57 msaitoh Exp $ */ /****************************************************************************** @@ -609,7 +609,7 @@ ixgbe_initialize_receive_units(struct ad /* Set RQSMR (Receive Queue Statistic Mapping) register */ reg = IXGBE_READ_REG(hw, IXGBE_RQSMR(regnum)); - reg &= ~(0x000000ff << (regshift * 8)); + reg &= ~(0x000000ffUL << (regshift * 8)); reg |= i << (regshift * 8); IXGBE_WRITE_REG(hw, IXGBE_RQSMR(regnum), reg); @@ -698,7 +698,7 @@ ixgbe_initialize_transmit_units(struct a else tqsmreg = IXGBE_TQSM(regnum); reg = IXGBE_READ_REG(hw, tqsmreg); - reg &= ~(0x000000ff << (regshift * 8)); + reg &= ~(0x000000ffUL << (regshift * 8)); reg |= i << (regshift * 8); IXGBE_WRITE_REG(hw, tqsmreg, reg); @@ -4200,14 +4200,14 @@ ixgbe_set_ivar(struct adapter *adapter, if (type == -1) { /* MISC IVAR */ index = (entry & 1) * 8; ivar = IXGBE_READ_REG(hw, IXGBE_IVAR_MISC); - ivar &= ~(0xFF << index); - ivar |= (vector << index); + ivar &= ~(0xffUL << index); + ivar |= ((u32)vector << index); IXGBE_WRITE_REG(hw, IXGBE_IVAR_MISC, ivar); } else { /* RX/TX IVARS */ index = (16 * (entry & 1)) + (8 * type); ivar = IXGBE_READ_REG(hw, IXGBE_IVAR(entry >> 1)); - ivar &= ~(0xFF << index); - ivar |= (vector << index); + ivar &= ~(0xffUL << index); + ivar |= ((u32)vector << index); IXGBE_WRITE_REG(hw, IXGBE_IVAR(entry >> 1), ivar); } break; Index: src/sys/dev/pci/ixgbe/ixgbe_type.h diff -u src/sys/dev/pci/ixgbe/ixgbe_type.h:1.40 src/sys/dev/pci/ixgbe/ixgbe_type.h:1.41 --- src/sys/dev/pci/ixgbe/ixgbe_type.h:1.40 Tue Jul 2 08:32:18 2019 +++ src/sys/dev/pci/ixgbe/ixgbe_type.h Wed Jul 24 06:07:58 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_type.h,v 1.40 2019/07/02 08:32:18 msaitoh Exp $ */ +/* $NetBSD: ixgbe_type.h,v 1.41 2019/07/24 06:07:58 msaitoh Exp $ */ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause @@ -4457,7 +4457,7 @@ struct ixgbe_bypass_eeprom { #define IXGBE_KRM_LINK_CTRL_1_TETH_EEE_CAP_KR (1 << 26) #define IXGBE_KRM_LINK_S1_MAC_AN_COMPLETE (1 << 28) #define IXGBE_KRM_LINK_CTRL_1_TETH_AN_ENABLE (1 << 29) -#define IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART (1 << 31) +#define IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART (1UL << 31) #define IXGBE_KRM_AN_CNTL_1_SYM_PAUSE (1 << 28) #define IXGBE_KRM_AN_CNTL_1_ASM_PAUSE (1 << 29) @@ -4487,7 +4487,7 @@ struct ixgbe_bypass_eeprom { #define IXGBE_KRM_TX_COEFF_CTRL_1_CMINUS1_OVRRD_EN (1 << 1) #define IXGBE_KRM_TX_COEFF_CTRL_1_CPLUS1_OVRRD_EN (1 << 2) #define IXGBE_KRM_TX_COEFF_CTRL_1_CZERO_EN (1 << 3) -#define IXGBE_KRM_TX_COEFF_CTRL_1_OVRRD_EN (1 << 31) +#define IXGBE_KRM_TX_COEFF_CTRL_1_OVRRD_EN (1UL << 31) #define IXGBE_SB_IOSF_INDIRECT_CTRL 0x00011144 #define IXGBE_SB_IOSF_INDIRECT_DATA 0x00011148 @@ -4503,7 +4503,7 @@ struct ixgbe_bypass_eeprom { #define IXGBE_SB_IOSF_CTRL_TARGET_SELECT_SHIFT 28 #define IXGBE_SB_IOSF_CTRL_TARGET_SELECT_MASK 0x7 #define IXGBE_SB_IOSF_CTRL_BUSY_SHIFT 31 -#define IXGBE_SB_IOSF_CTRL_BUSY (1 << IXGBE_SB_IOSF_CTRL_BUSY_SHIFT) +#define IXGBE_SB_IOSF_CTRL_BUSY (1UL << IXGBE_SB_IOSF_CTRL_BUSY_SHIFT) #define IXGBE_SB_IOSF_TARGET_KR_PHY 0 #define IXGBE_NW_MNG_IF_SEL 0x00011178