aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMark Rustad <mark.d.rustad@intel.com>2014-03-03 22:02:23 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2014-03-21 04:59:48 -0400
commit06380db6fc08713682bf210c0ee3ef19b457bc14 (patch)
tree8b02e91cff58c3ee2ec47a0fac80f56b7eebdd63 /drivers
parent19458bd425c0ee21bb35958c60d3682f9c42f274 (diff)
ixgbevf: Use static inlines instead of macros
Kernel coding standard prefers static inline functions instead of macros, so use them for register accessors. This is to prepare for adding LER, Live Error Recovery, checks to those accessors. 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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/ixgbevf.h5
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c4
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/regs.h12
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/vf.h28
4 files changed, 35 insertions, 14 deletions
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
index 08fb88aba67b..d4b1f50fb2ad 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
@@ -315,6 +315,11 @@ static inline u16 ixgbevf_desc_unused(struct ixgbevf_ring *ring)
315 return ((ntc > ntu) ? 0 : ring->count) + ntc - ntu - 1; 315 return ((ntc > ntu) ? 0 : ring->count) + ntc - ntu - 1;
316} 316}
317 317
318static inline void ixgbevf_write_tail(struct ixgbevf_ring *ring, u32 value)
319{
320 writel(value, ring->tail);
321}
322
318#define IXGBEVF_RX_DESC(R, i) \ 323#define IXGBEVF_RX_DESC(R, i) \
319 (&(((union ixgbe_adv_rx_desc *)((R)->desc))[i])) 324 (&(((union ixgbe_adv_rx_desc *)((R)->desc))[i]))
320#define IXGBEVF_TX_DESC(R, i) \ 325#define IXGBEVF_TX_DESC(R, i) \
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index 592d8a6baabc..74df8bf8619d 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -111,7 +111,7 @@ static inline void ixgbevf_release_rx_desc(struct ixgbevf_ring *rx_ring,
111 * such as IA-64). 111 * such as IA-64).
112 */ 112 */
113 wmb(); 113 wmb();
114 writel(val, rx_ring->tail); 114 ixgbevf_write_tail(rx_ring, val);
115} 115}
116 116
117/** 117/**
@@ -3060,7 +3060,7 @@ static void ixgbevf_tx_map(struct ixgbevf_ring *tx_ring,
3060 tx_ring->next_to_use = i; 3060 tx_ring->next_to_use = i;
3061 3061
3062 /* notify HW of packet */ 3062 /* notify HW of packet */
3063 writel(i, tx_ring->tail); 3063 ixgbevf_write_tail(tx_ring, i);
3064 3064
3065 return; 3065 return;
3066dma_error: 3066dma_error:
diff --git a/drivers/net/ethernet/intel/ixgbevf/regs.h b/drivers/net/ethernet/intel/ixgbevf/regs.h
index debd8c0e1f28..09dd8f698bea 100644
--- a/drivers/net/ethernet/intel/ixgbevf/regs.h
+++ b/drivers/net/ethernet/intel/ixgbevf/regs.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 82599 Virtual Function driver 3 Intel 82599 Virtual Function driver
4 Copyright(c) 1999 - 2012 Intel Corporation. 4 Copyright(c) 1999 - 2014 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -70,16 +70,6 @@
70#define IXGBE_VFGOTC_MSB 0x02024 70#define IXGBE_VFGOTC_MSB 0x02024
71#define IXGBE_VFMPRC 0x01034 71#define IXGBE_VFMPRC 0x01034
72 72
73#define IXGBE_WRITE_REG(a, reg, value) writel((value), ((a)->hw_addr + (reg)))
74
75#define IXGBE_READ_REG(a, reg) readl((a)->hw_addr + (reg))
76
77#define IXGBE_WRITE_REG_ARRAY(a, reg, offset, value) ( \
78 writel((value), ((a)->hw_addr + (reg) + ((offset) << 2))))
79
80#define IXGBE_READ_REG_ARRAY(a, reg, offset) ( \
81 readl((a)->hw_addr + (reg) + ((offset) << 2)))
82
83#define IXGBE_WRITE_FLUSH(a) (IXGBE_READ_REG(a, IXGBE_VFSTATUS)) 73#define IXGBE_WRITE_FLUSH(a) (IXGBE_READ_REG(a, IXGBE_VFSTATUS))
84 74
85#endif /* _IXGBEVF_REGS_H_ */ 75#endif /* _IXGBEVF_REGS_H_ */
diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.h b/drivers/net/ethernet/intel/ixgbevf/vf.h
index 7b1f502d1716..8ebed729c70f 100644
--- a/drivers/net/ethernet/intel/ixgbevf/vf.h
+++ b/drivers/net/ethernet/intel/ixgbevf/vf.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel 82599 Virtual Function driver 3 Intel 82599 Virtual Function driver
4 Copyright(c) 1999 - 2012 Intel Corporation. 4 Copyright(c) 1999 - 2014 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -172,6 +172,32 @@ struct ixgbevf_info {
172 const struct ixgbe_mac_operations *mac_ops; 172 const struct ixgbe_mac_operations *mac_ops;
173}; 173};
174 174
175static inline void ixgbe_write_reg(struct ixgbe_hw *hw, u32 reg, u32 value)
176{
177 writel(value, hw->hw_addr + reg);
178}
179#define IXGBE_WRITE_REG(h, r, v) ixgbe_write_reg(h, r, v)
180
181static inline u32 ixgbe_read_reg(struct ixgbe_hw *hw, u32 reg)
182{
183 return readl(hw->hw_addr + reg);
184}
185#define IXGBE_READ_REG(h, r) ixgbe_read_reg(h, r)
186
187static inline void ixgbe_write_reg_array(struct ixgbe_hw *hw, u32 reg,
188 u32 offset, u32 value)
189{
190 ixgbe_write_reg(hw, reg + (offset << 2), value);
191}
192#define IXGBE_WRITE_REG_ARRAY(h, r, o, v) ixgbe_write_reg_array(h, r, o, v)
193
194static inline u32 ixgbe_read_reg_array(struct ixgbe_hw *hw, u32 reg,
195 u32 offset)
196{
197 return ixgbe_read_reg(hw, reg + (offset << 2));
198}
199#define IXGBE_READ_REG_ARRAY(h, r, o) ixgbe_read_reg_array(h, r, o)
200
175void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size); 201void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size);
176int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api); 202int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api);
177int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs, 203int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,