The ops pointers in fm10k_stats_get() are set up from primary
process, when secondary process calls these ops pointers,
a segment fault will happen.
Fixes:
7223d200c227 ("fm10k: add base driver")
Cc: stable@dpdk.org
Signed-off-by: Lu Qiuwen <luqiuwen@iie.ac.cn>
Acked-by: Xiao Wang <xiao.w.wang@intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
* */
void fm10k_update_hw_stats(struct fm10k_hw *hw, struct fm10k_hw_stats *stats)
{
- if (hw->mac.ops.update_hw_stats)
- hw->mac.ops.update_hw_stats(hw, stats);
+ switch (hw->mac.type) {
+ case fm10k_mac_pf:
+ return fm10k_update_hw_stats_pf(hw, stats);
+ case fm10k_mac_vf:
+ return fm10k_update_hw_stats_vf(hw, stats);
+ default:
+ break;
+ }
}
/**
* */
void fm10k_rebind_hw_stats(struct fm10k_hw *hw, struct fm10k_hw_stats *stats)
{
- if (hw->mac.ops.rebind_hw_stats)
- hw->mac.ops.rebind_hw_stats(hw, stats);
+ switch (hw->mac.type) {
+ case fm10k_mac_pf:
+ return fm10k_rebind_hw_stats_pf(hw, stats);
+ case fm10k_mac_vf:
+ return fm10k_rebind_hw_stats_vf(hw, stats);
+ default:
+ break;
+ }
}
/**
* This function collects and aggregates global and per queue hardware
* statistics.
**/
-STATIC void fm10k_update_hw_stats_pf(struct fm10k_hw *hw,
+void fm10k_update_hw_stats_pf(struct fm10k_hw *hw,
struct fm10k_hw_stats *stats)
{
u32 timeout, ur, ca, um, xec, vlan_drop, loopback_drop, nodesc_drop;
* This function resets the base for global and per queue hardware
* statistics.
**/
-STATIC void fm10k_rebind_hw_stats_pf(struct fm10k_hw *hw,
+void fm10k_rebind_hw_stats_pf(struct fm10k_hw *hw,
struct fm10k_hw_stats *stats)
{
DEBUGFUNC("fm10k_rebind_hw_stats_pf");
#endif
s32 fm10k_init_ops_pf(struct fm10k_hw *hw);
+
+void fm10k_update_hw_stats_pf(struct fm10k_hw *hw,
+ struct fm10k_hw_stats *stats);
+
+void fm10k_rebind_hw_stats_pf(struct fm10k_hw *hw,
+ struct fm10k_hw_stats *stats);
#endif /* _FM10K_PF_H */
*
* This function collects and aggregates per queue hardware statistics.
**/
-STATIC void fm10k_update_hw_stats_vf(struct fm10k_hw *hw,
+void fm10k_update_hw_stats_vf(struct fm10k_hw *hw,
struct fm10k_hw_stats *stats)
{
DEBUGFUNC("fm10k_update_hw_stats_vf");
*
* This function resets the base for queue hardware statistics.
**/
-STATIC void fm10k_rebind_hw_stats_vf(struct fm10k_hw *hw,
+void fm10k_rebind_hw_stats_vf(struct fm10k_hw *hw,
struct fm10k_hw_stats *stats)
{
DEBUGFUNC("fm10k_rebind_hw_stats_vf");
FM10K_MSG_HANDLER(FM10K_VF_MSG_ID_1588, fm10k_1588_msg_attr, func)
s32 fm10k_init_ops_vf(struct fm10k_hw *hw);
+
+void fm10k_update_hw_stats_vf(struct fm10k_hw *hw,
+ struct fm10k_hw_stats *stats);
+void fm10k_rebind_hw_stats_vf(struct fm10k_hw *hw,
+ struct fm10k_hw_stats *stats);
#endif /* _FM10K_VF_H */