Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ed2dbf4 authored by Jacob Keller's avatar Jacob Keller Committed by Jeff Kirsher
Browse files

igbvf: use BIT() macro instead of shifts



To prevent signed bitshift issues, and improve code readability, use the
BIT() macro. Also make use of GENMASK or the unsigned postfix where this
is more appropriate than BIT()

Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 12b28b41
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -113,7 +113,7 @@
#define E1000_RXDCTL_QUEUE_ENABLE	0x02000000 /* Enable specific Rx Que */
#define E1000_RXDCTL_QUEUE_ENABLE	0x02000000 /* Enable specific Rx Que */


/* Direct Cache Access (DCA) definitions */
/* Direct Cache Access (DCA) definitions */
#define E1000_DCA_TXCTRL_TX_WB_RO_EN	(1 << 11) /* Tx Desc writeback RO bit */
#define E1000_DCA_TXCTRL_TX_WB_RO_EN	BIT(11) /* Tx Desc writeback RO bit */


#define E1000_VF_INIT_TIMEOUT	200 /* Number of retries to clear RSTI */
#define E1000_VF_INIT_TIMEOUT	200 /* Number of retries to clear RSTI */


+2 −1
Original line number Original line Diff line number Diff line
@@ -154,7 +154,8 @@ static void igbvf_get_regs(struct net_device *netdev,


	memset(p, 0, IGBVF_REGS_LEN * sizeof(u32));
	memset(p, 0, IGBVF_REGS_LEN * sizeof(u32));


	regs->version = (1 << 24) | (adapter->pdev->revision << 16) |
	regs->version = (1u << 24) |
			(adapter->pdev->revision << 16) |
			adapter->pdev->device;
			adapter->pdev->device;


	regs_buff[0] = er32(CTRL);
	regs_buff[0] = er32(CTRL);
+2 −2
Original line number Original line Diff line number Diff line
@@ -287,8 +287,8 @@ struct igbvf_info {
};
};


/* hardware capability, feature, and workaround flags */
/* hardware capability, feature, and workaround flags */
#define IGBVF_FLAG_RX_CSUM_DISABLED	(1 << 0)
#define IGBVF_FLAG_RX_CSUM_DISABLED	BIT(0)
#define IGBVF_FLAG_RX_LB_VLAN_BSWAP	(1 << 1)
#define IGBVF_FLAG_RX_LB_VLAN_BSWAP	BIT(1)
#define IGBVF_RX_DESC_ADV(R, i)     \
#define IGBVF_RX_DESC_ADV(R, i)     \
	(&((((R).desc))[i].rx_desc))
	(&((((R).desc))[i].rx_desc))
#define IGBVF_TX_DESC_ADV(R, i)     \
#define IGBVF_TX_DESC_ADV(R, i)     \
+5 −5
Original line number Original line Diff line number Diff line
@@ -964,7 +964,7 @@ static void igbvf_assign_vector(struct igbvf_adapter *adapter, int rx_queue,
			ivar = ivar & 0xFFFFFF00;
			ivar = ivar & 0xFFFFFF00;
			ivar |= msix_vector | E1000_IVAR_VALID;
			ivar |= msix_vector | E1000_IVAR_VALID;
		}
		}
		adapter->rx_ring[rx_queue].eims_value = 1 << msix_vector;
		adapter->rx_ring[rx_queue].eims_value = BIT(msix_vector);
		array_ew32(IVAR0, index, ivar);
		array_ew32(IVAR0, index, ivar);
	}
	}
	if (tx_queue > IGBVF_NO_QUEUE) {
	if (tx_queue > IGBVF_NO_QUEUE) {
@@ -979,7 +979,7 @@ static void igbvf_assign_vector(struct igbvf_adapter *adapter, int rx_queue,
			ivar = ivar & 0xFFFF00FF;
			ivar = ivar & 0xFFFF00FF;
			ivar |= (msix_vector | E1000_IVAR_VALID) << 8;
			ivar |= (msix_vector | E1000_IVAR_VALID) << 8;
		}
		}
		adapter->tx_ring[tx_queue].eims_value = 1 << msix_vector;
		adapter->tx_ring[tx_queue].eims_value = BIT(msix_vector);
		array_ew32(IVAR0, index, ivar);
		array_ew32(IVAR0, index, ivar);
	}
	}
}
}
@@ -1014,8 +1014,8 @@ static void igbvf_configure_msix(struct igbvf_adapter *adapter)


	ew32(IVAR_MISC, tmp);
	ew32(IVAR_MISC, tmp);


	adapter->eims_enable_mask = (1 << (vector)) - 1;
	adapter->eims_enable_mask = GENMASK(vector - 1, 0);
	adapter->eims_other = 1 << (vector - 1);
	adapter->eims_other = BIT(vector - 1);
	e1e_flush();
	e1e_flush();
}
}


@@ -2089,7 +2089,7 @@ static int igbvf_maybe_stop_tx(struct net_device *netdev, int size)
}
}


#define IGBVF_MAX_TXD_PWR	16
#define IGBVF_MAX_TXD_PWR	16
#define IGBVF_MAX_DATA_PER_TXD	(1 << IGBVF_MAX_TXD_PWR)
#define IGBVF_MAX_DATA_PER_TXD	(1u << IGBVF_MAX_TXD_PWR)


static inline int igbvf_tx_map_adv(struct igbvf_adapter *adapter,
static inline int igbvf_tx_map_adv(struct igbvf_adapter *adapter,
				   struct igbvf_ring *tx_ring,
				   struct igbvf_ring *tx_ring,
+1 −1
Original line number Original line Diff line number Diff line
@@ -266,7 +266,7 @@ static s32 e1000_set_vfta_vf(struct e1000_hw *hw, u16 vid, bool set)
	msgbuf[1] = vid;
	msgbuf[1] = vid;
	/* Setting the 8 bit field MSG INFO to true indicates "add" */
	/* Setting the 8 bit field MSG INFO to true indicates "add" */
	if (set)
	if (set)
		msgbuf[0] |= 1 << E1000_VT_MSGINFO_SHIFT;
		msgbuf[0] |= BIT(E1000_VT_MSGINFO_SHIFT);


	mbx->ops.write_posted(hw, msgbuf, 2);
	mbx->ops.write_posted(hw, msgbuf, 2);