Skip to content

Commit b12babd

Browse files
mdrustaddavem330
authored andcommitted
ixgbe: Check for adapter removal on register writes
Prevent writes to an adapter that has been detected as removed by a previous failing read. This also fixes some include file ordering confusion that this patch revealed. Signed-off-by: Mark Rustad <[email protected]> Tested-by: Phil Schmitt <[email protected]> Signed-off-by: Aaron Brown <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2a1a091 commit b12babd

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

drivers/net/ethernet/intel/ixgbe/ixgbe_common.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@ void ixgbe_check_remove(struct ixgbe_hw *hw, u32 reg);
135135

136136
static inline void ixgbe_write_reg(struct ixgbe_hw *hw, u32 reg, u32 value)
137137
{
138-
writel(value, hw->hw_addr + reg);
138+
u8 __iomem *reg_addr = ACCESS_ONCE(hw->hw_addr);
139+
140+
if (ixgbe_removed(reg_addr))
141+
return;
142+
writel(value, reg_addr + reg);
139143
}
140144
#define IXGBE_WRITE_REG(a, reg, value) ixgbe_write_reg((a), (reg), (value))
141145

@@ -150,7 +154,11 @@ static inline void writeq(u64 val, void __iomem *addr)
150154

151155
static inline void ixgbe_write_reg64(struct ixgbe_hw *hw, u32 reg, u64 value)
152156
{
153-
writeq(value, hw->hw_addr + reg);
157+
u8 __iomem *reg_addr = ACCESS_ONCE(hw->hw_addr);
158+
159+
if (ixgbe_removed(reg_addr))
160+
return;
161+
writeq(value, reg_addr + reg);
154162
}
155163
#define IXGBE_WRITE_REG64(a, reg, value) ixgbe_write_reg64((a), (reg), (value))
156164

drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727

2828
#include <linux/pci.h>
2929
#include <linux/delay.h>
30-
#include "ixgbe_type.h"
31-
#include "ixgbe_common.h"
30+
#include "ixgbe.h"
3231
#include "ixgbe_mbx.h"
3332

3433
/**

drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include <linux/delay.h>
3030
#include <linux/sched.h>
3131

32-
#include "ixgbe_common.h"
32+
#include "ixgbe.h"
3333
#include "ixgbe_phy.h"
3434

3535
static void ixgbe_i2c_start(struct ixgbe_hw *hw);

0 commit comments

Comments
 (0)