ixgbe: Use out-of-line function for register reads
Register reads are slow, so don't inline them. Size before: text data bss dec hex filename 226337 8280 552 235169 396a1 ixgbe.ko Size after: text data bss dec hex filename 194578 8280 552 203410 31a92 ixgbe.ko for about a 14% reduction in text size. Signed-off-by: Mark Rustad <mark.d.rustad@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
committed by
Jeff Kirsher
parent
e5776620a7
commit
f8e2472f4f
@@ -141,8 +141,6 @@ static inline bool ixgbe_removed(void __iomem *addr)
|
|||||||
return unlikely(!addr);
|
return unlikely(!addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ixgbe_check_remove(struct ixgbe_hw *hw, u32 reg);
|
|
||||||
|
|
||||||
static inline void ixgbe_write_reg(struct ixgbe_hw *hw, u32 reg, u32 value)
|
static inline void ixgbe_write_reg(struct ixgbe_hw *hw, u32 reg, u32 value)
|
||||||
{
|
{
|
||||||
u8 __iomem *reg_addr = ACCESS_ONCE(hw->hw_addr);
|
u8 __iomem *reg_addr = ACCESS_ONCE(hw->hw_addr);
|
||||||
@@ -172,18 +170,7 @@ static inline void ixgbe_write_reg64(struct ixgbe_hw *hw, u32 reg, u64 value)
|
|||||||
}
|
}
|
||||||
#define IXGBE_WRITE_REG64(a, reg, value) ixgbe_write_reg64((a), (reg), (value))
|
#define IXGBE_WRITE_REG64(a, reg, value) ixgbe_write_reg64((a), (reg), (value))
|
||||||
|
|
||||||
static inline u32 ixgbe_read_reg(struct ixgbe_hw *hw, u32 reg)
|
u32 ixgbe_read_reg(struct ixgbe_hw *hw, u32 reg);
|
||||||
{
|
|
||||||
u8 __iomem *reg_addr = ACCESS_ONCE(hw->hw_addr);
|
|
||||||
u32 value;
|
|
||||||
|
|
||||||
if (ixgbe_removed(reg_addr))
|
|
||||||
return IXGBE_FAILED_READ_REG;
|
|
||||||
value = readl(reg_addr + reg);
|
|
||||||
if (unlikely(value == IXGBE_FAILED_READ_REG))
|
|
||||||
ixgbe_check_remove(hw, reg);
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
#define IXGBE_READ_REG(a, reg) ixgbe_read_reg((a), (reg))
|
#define IXGBE_READ_REG(a, reg) ixgbe_read_reg((a), (reg))
|
||||||
|
|
||||||
#define IXGBE_WRITE_REG_ARRAY(a, reg, offset, value) \
|
#define IXGBE_WRITE_REG_ARRAY(a, reg, offset, value) \
|
||||||
|
@@ -301,7 +301,7 @@ static void ixgbe_remove_adapter(struct ixgbe_hw *hw)
|
|||||||
ixgbe_service_event_schedule(adapter);
|
ixgbe_service_event_schedule(adapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ixgbe_check_remove(struct ixgbe_hw *hw, u32 reg)
|
static void ixgbe_check_remove(struct ixgbe_hw *hw, u32 reg)
|
||||||
{
|
{
|
||||||
u32 value;
|
u32 value;
|
||||||
|
|
||||||
@@ -320,6 +320,32 @@ void ixgbe_check_remove(struct ixgbe_hw *hw, u32 reg)
|
|||||||
ixgbe_remove_adapter(hw);
|
ixgbe_remove_adapter(hw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ixgbe_read_reg - Read from device register
|
||||||
|
* @hw: hw specific details
|
||||||
|
* @reg: offset of register to read
|
||||||
|
*
|
||||||
|
* Returns : value read or IXGBE_FAILED_READ_REG if removed
|
||||||
|
*
|
||||||
|
* This function is used to read device registers. It checks for device
|
||||||
|
* removal by confirming any read that returns all ones by checking the
|
||||||
|
* status register value for all ones. This function avoids reading from
|
||||||
|
* the hardware if a removal was previously detected in which case it
|
||||||
|
* returns IXGBE_FAILED_READ_REG (all ones).
|
||||||
|
*/
|
||||||
|
u32 ixgbe_read_reg(struct ixgbe_hw *hw, u32 reg)
|
||||||
|
{
|
||||||
|
u8 __iomem *reg_addr = ACCESS_ONCE(hw->hw_addr);
|
||||||
|
u32 value;
|
||||||
|
|
||||||
|
if (ixgbe_removed(reg_addr))
|
||||||
|
return IXGBE_FAILED_READ_REG;
|
||||||
|
value = readl(reg_addr + reg);
|
||||||
|
if (unlikely(value == IXGBE_FAILED_READ_REG))
|
||||||
|
ixgbe_check_remove(hw, reg);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
static bool ixgbe_check_cfg_remove(struct ixgbe_hw *hw, struct pci_dev *pdev)
|
static bool ixgbe_check_cfg_remove(struct ixgbe_hw *hw, struct pci_dev *pdev)
|
||||||
{
|
{
|
||||||
u16 value;
|
u16 value;
|
||||||
|
Reference in New Issue
Block a user