aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/igb/igb_main.c
diff options
context:
space:
mode:
authorJacob Keller <jacob.e.keller@intel.com>2016-04-13 19:08:28 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2016-05-13 17:39:47 -0400
commita51d8c217b15b97fede844dd6860f7b3c6ffcfef (patch)
tree0153da876d8119a5df6dd02f585ab1ad731ea5ba /drivers/net/ethernet/intel/igb/igb_main.c
parent847042a6a51e6dbb789c259750609b78aa3f27a3 (diff)
igb: use BIT() macro or unsigned prefix
For bitshifts, we should make use of the BIT macro when possible, and ensure that other bitshifts are marked as unsigned. This helps prevent signed bitshift errors, and ensures similar style. Make use of GENMASK and the unsigned postfix where BIT() isn't appropriate. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/igb/igb_main.c')
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 7460bdbe2e49..0191c5f9103a 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -836,7 +836,7 @@ static void igb_assign_vector(struct igb_q_vector *q_vector, int msix_vector)
836 igb_write_ivar(hw, msix_vector, 836 igb_write_ivar(hw, msix_vector,
837 tx_queue & 0x7, 837 tx_queue & 0x7,
838 ((tx_queue & 0x8) << 1) + 8); 838 ((tx_queue & 0x8) << 1) + 8);
839 q_vector->eims_value = 1 << msix_vector; 839 q_vector->eims_value = BIT(msix_vector);
840 break; 840 break;
841 case e1000_82580: 841 case e1000_82580:
842 case e1000_i350: 842 case e1000_i350:
@@ -857,7 +857,7 @@ static void igb_assign_vector(struct igb_q_vector *q_vector, int msix_vector)
857 igb_write_ivar(hw, msix_vector, 857 igb_write_ivar(hw, msix_vector,
858 tx_queue >> 1, 858 tx_queue >> 1,
859 ((tx_queue & 0x1) << 4) + 8); 859 ((tx_queue & 0x1) << 4) + 8);
860 q_vector->eims_value = 1 << msix_vector; 860 q_vector->eims_value = BIT(msix_vector);
861 break; 861 break;
862 default: 862 default:
863 BUG(); 863 BUG();
@@ -919,7 +919,7 @@ static void igb_configure_msix(struct igb_adapter *adapter)
919 E1000_GPIE_NSICR); 919 E1000_GPIE_NSICR);
920 920
921 /* enable msix_other interrupt */ 921 /* enable msix_other interrupt */
922 adapter->eims_other = 1 << vector; 922 adapter->eims_other = BIT(vector);
923 tmp = (vector++ | E1000_IVAR_VALID) << 8; 923 tmp = (vector++ | E1000_IVAR_VALID) << 8;
924 924
925 wr32(E1000_IVAR_MISC, tmp); 925 wr32(E1000_IVAR_MISC, tmp);
@@ -4064,7 +4064,7 @@ static int igb_vlan_promisc_enable(struct igb_adapter *adapter)
4064 for (i = E1000_VLVF_ARRAY_SIZE; --i;) { 4064 for (i = E1000_VLVF_ARRAY_SIZE; --i;) {
4065 u32 vlvf = rd32(E1000_VLVF(i)); 4065 u32 vlvf = rd32(E1000_VLVF(i));
4066 4066
4067 vlvf |= 1 << pf_id; 4067 vlvf |= BIT(pf_id);
4068 wr32(E1000_VLVF(i), vlvf); 4068 wr32(E1000_VLVF(i), vlvf);
4069 } 4069 }
4070 4070
@@ -4091,7 +4091,7 @@ static void igb_scrub_vfta(struct igb_adapter *adapter, u32 vfta_offset)
4091 /* guarantee that we don't scrub out management VLAN */ 4091 /* guarantee that we don't scrub out management VLAN */
4092 vid = adapter->mng_vlan_id; 4092 vid = adapter->mng_vlan_id;
4093 if (vid >= vid_start && vid < vid_end) 4093 if (vid >= vid_start && vid < vid_end)
4094 vfta[(vid - vid_start) / 32] |= 1 << (vid % 32); 4094 vfta[(vid - vid_start) / 32] |= BIT(vid % 32);
4095 4095
4096 if (!adapter->vfs_allocated_count) 4096 if (!adapter->vfs_allocated_count)
4097 goto set_vfta; 4097 goto set_vfta;
@@ -4110,7 +4110,7 @@ static void igb_scrub_vfta(struct igb_adapter *adapter, u32 vfta_offset)
4110 4110
4111 if (vlvf & E1000_VLVF_VLANID_ENABLE) { 4111 if (vlvf & E1000_VLVF_VLANID_ENABLE) {
4112 /* record VLAN ID in VFTA */ 4112 /* record VLAN ID in VFTA */
4113 vfta[(vid - vid_start) / 32] |= 1 << (vid % 32); 4113 vfta[(vid - vid_start) / 32] |= BIT(vid % 32);
4114 4114
4115 /* if PF is part of this then continue */ 4115 /* if PF is part of this then continue */
4116 if (test_bit(vid, adapter->active_vlans)) 4116 if (test_bit(vid, adapter->active_vlans))
@@ -4118,7 +4118,7 @@ static void igb_scrub_vfta(struct igb_adapter *adapter, u32 vfta_offset)
4118 } 4118 }
4119 4119
4120 /* remove PF from the pool */ 4120 /* remove PF from the pool */
4121 bits = ~(1 << pf_id); 4121 bits = ~BIT(pf_id);
4122 bits &= rd32(E1000_VLVF(i)); 4122 bits &= rd32(E1000_VLVF(i));
4123 wr32(E1000_VLVF(i), bits); 4123 wr32(E1000_VLVF(i), bits);
4124 } 4124 }
@@ -4276,13 +4276,13 @@ static void igb_spoof_check(struct igb_adapter *adapter)
4276 return; 4276 return;
4277 4277
4278 for (j = 0; j < adapter->vfs_allocated_count; j++) { 4278 for (j = 0; j < adapter->vfs_allocated_count; j++) {
4279 if (adapter->wvbr & (1 << j) || 4279 if (adapter->wvbr & BIT(j) ||
4280 adapter->wvbr & (1 << (j + IGB_STAGGERED_QUEUE_OFFSET))) { 4280 adapter->wvbr & BIT(j + IGB_STAGGERED_QUEUE_OFFSET)) {
4281 dev_warn(&adapter->pdev->dev, 4281 dev_warn(&adapter->pdev->dev,
4282 "Spoof event(s) detected on VF %d\n", j); 4282 "Spoof event(s) detected on VF %d\n", j);
4283 adapter->wvbr &= 4283 adapter->wvbr &=
4284 ~((1 << j) | 4284 ~(BIT(j) |
4285 (1 << (j + IGB_STAGGERED_QUEUE_OFFSET))); 4285 BIT(j + IGB_STAGGERED_QUEUE_OFFSET));
4286 } 4286 }
4287 } 4287 }
4288} 4288}
@@ -5963,11 +5963,11 @@ static void igb_clear_vf_vfta(struct igb_adapter *adapter, u32 vf)
5963 5963
5964 /* create mask for VF and other pools */ 5964 /* create mask for VF and other pools */
5965 pool_mask = E1000_VLVF_POOLSEL_MASK; 5965 pool_mask = E1000_VLVF_POOLSEL_MASK;
5966 vlvf_mask = 1 << (E1000_VLVF_POOLSEL_SHIFT + vf); 5966 vlvf_mask = BIT(E1000_VLVF_POOLSEL_SHIFT + vf);
5967 5967
5968 /* drop PF from pool bits */ 5968 /* drop PF from pool bits */
5969 pool_mask &= ~(1 << (E1000_VLVF_POOLSEL_SHIFT + 5969 pool_mask &= ~BIT(E1000_VLVF_POOLSEL_SHIFT +
5970 adapter->vfs_allocated_count)); 5970 adapter->vfs_allocated_count);
5971 5971
5972 /* Find the vlan filter for this id */ 5972 /* Find the vlan filter for this id */
5973 for (i = E1000_VLVF_ARRAY_SIZE; i--;) { 5973 for (i = E1000_VLVF_ARRAY_SIZE; i--;) {
@@ -5990,7 +5990,7 @@ static void igb_clear_vf_vfta(struct igb_adapter *adapter, u32 vf)
5990 goto update_vlvf; 5990 goto update_vlvf;
5991 5991
5992 vid = vlvf & E1000_VLVF_VLANID_MASK; 5992 vid = vlvf & E1000_VLVF_VLANID_MASK;
5993 vfta_mask = 1 << (vid % 32); 5993 vfta_mask = BIT(vid % 32);
5994 5994
5995 /* clear bit from VFTA */ 5995 /* clear bit from VFTA */
5996 vfta = adapter->shadow_vfta[vid / 32]; 5996 vfta = adapter->shadow_vfta[vid / 32];
@@ -6041,13 +6041,13 @@ void igb_update_pf_vlvf(struct igb_adapter *adapter, u32 vid)
6041 * entry other than the PF. 6041 * entry other than the PF.
6042 */ 6042 */
6043 pf_id = adapter->vfs_allocated_count + E1000_VLVF_POOLSEL_SHIFT; 6043 pf_id = adapter->vfs_allocated_count + E1000_VLVF_POOLSEL_SHIFT;
6044 bits = ~(1 << pf_id) & E1000_VLVF_POOLSEL_MASK; 6044 bits = ~BIT(pf_id) & E1000_VLVF_POOLSEL_MASK;
6045 bits &= rd32(E1000_VLVF(idx)); 6045 bits &= rd32(E1000_VLVF(idx));
6046 6046
6047 /* Disable the filter so this falls into the default pool. */ 6047 /* Disable the filter so this falls into the default pool. */
6048 if (!bits) { 6048 if (!bits) {
6049 if (adapter->flags & IGB_FLAG_VLAN_PROMISC) 6049 if (adapter->flags & IGB_FLAG_VLAN_PROMISC)
6050 wr32(E1000_VLVF(idx), 1 << pf_id); 6050 wr32(E1000_VLVF(idx), BIT(pf_id));
6051 else 6051 else
6052 wr32(E1000_VLVF(idx), 0); 6052 wr32(E1000_VLVF(idx), 0);
6053 } 6053 }
@@ -6231,9 +6231,9 @@ static void igb_vf_reset_msg(struct igb_adapter *adapter, u32 vf)
6231 6231
6232 /* enable transmit and receive for vf */ 6232 /* enable transmit and receive for vf */
6233 reg = rd32(E1000_VFTE); 6233 reg = rd32(E1000_VFTE);
6234 wr32(E1000_VFTE, reg | (1 << vf)); 6234 wr32(E1000_VFTE, reg | BIT(vf));
6235 reg = rd32(E1000_VFRE); 6235 reg = rd32(E1000_VFRE);
6236 wr32(E1000_VFRE, reg | (1 << vf)); 6236 wr32(E1000_VFRE, reg | BIT(vf));
6237 6237
6238 adapter->vf_data[vf].flags |= IGB_VF_FLAG_CTS; 6238 adapter->vf_data[vf].flags |= IGB_VF_FLAG_CTS;
6239 6239
@@ -7927,7 +7927,7 @@ static void igb_set_vf_rate_limit(struct e1000_hw *hw, int vf, int tx_rate,
7927 /* Calculate the rate factor values to set */ 7927 /* Calculate the rate factor values to set */
7928 rf_int = link_speed / tx_rate; 7928 rf_int = link_speed / tx_rate;
7929 rf_dec = (link_speed - (rf_int * tx_rate)); 7929 rf_dec = (link_speed - (rf_int * tx_rate));
7930 rf_dec = (rf_dec * (1 << E1000_RTTBCNRC_RF_INT_SHIFT)) / 7930 rf_dec = (rf_dec * BIT(E1000_RTTBCNRC_RF_INT_SHIFT)) /
7931 tx_rate; 7931 tx_rate;
7932 7932
7933 bcnrc_val = E1000_RTTBCNRC_RS_ENA; 7933 bcnrc_val = E1000_RTTBCNRC_RS_ENA;
@@ -8017,11 +8017,11 @@ static int igb_ndo_set_vf_spoofchk(struct net_device *netdev, int vf,
8017 reg_offset = (hw->mac.type == e1000_82576) ? E1000_DTXSWC : E1000_TXSWC; 8017 reg_offset = (hw->mac.type == e1000_82576) ? E1000_DTXSWC : E1000_TXSWC;
8018 reg_val = rd32(reg_offset); 8018 reg_val = rd32(reg_offset);
8019 if (setting) 8019 if (setting)
8020 reg_val |= ((1 << vf) | 8020 reg_val |= (BIT(vf) |
8021 (1 << (vf + E1000_DTXSWC_VLAN_SPOOF_SHIFT))); 8021 BIT(vf + E1000_DTXSWC_VLAN_SPOOF_SHIFT));
8022 else 8022 else
8023 reg_val &= ~((1 << vf) | 8023 reg_val &= ~(BIT(vf) |
8024 (1 << (vf + E1000_DTXSWC_VLAN_SPOOF_SHIFT))); 8024 BIT(vf + E1000_DTXSWC_VLAN_SPOOF_SHIFT));
8025 wr32(reg_offset, reg_val); 8025 wr32(reg_offset, reg_val);
8026 8026
8027 adapter->vf_data[vf].spoofchk_enabled = setting; 8027 adapter->vf_data[vf].spoofchk_enabled = setting;