提交 c7b8d978 编写于 作者: M Mitch Williams 提交者: Jeff Kirsher

i40evf: Use macro param for ethtool stats

Use a macro parameter for ethtool stats instead of just assuming
that a valid netdev variable exists. Suggested by Ben Hutchings.

CC: Ben Hutchings <ben@decadent.org.uk>
Change-ID: I66681698573c1549f95fdea310149d8a7e96a60f
Signed-off-by: NMitch Williams <mitch.a.williams@intel.com>
Tested-by: NSibai Li <sibai.li@intel.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
上级 1c112a64
...@@ -59,10 +59,12 @@ static const struct i40evf_stats i40evf_gstrings_stats[] = { ...@@ -59,10 +59,12 @@ static const struct i40evf_stats i40evf_gstrings_stats[] = {
}; };
#define I40EVF_GLOBAL_STATS_LEN ARRAY_SIZE(i40evf_gstrings_stats) #define I40EVF_GLOBAL_STATS_LEN ARRAY_SIZE(i40evf_gstrings_stats)
#define I40EVF_QUEUE_STATS_LEN \ #define I40EVF_QUEUE_STATS_LEN(_dev) \
(((struct i40evf_adapter *) \ (((struct i40evf_adapter *) \
netdev_priv(netdev))->vsi_res->num_queue_pairs * 4) netdev_priv(_dev))->vsi_res->num_queue_pairs \
#define I40EVF_STATS_LEN (I40EVF_GLOBAL_STATS_LEN + I40EVF_QUEUE_STATS_LEN) * 2 * (sizeof(struct i40e_queue_stats) / sizeof(u64)))
#define I40EVF_STATS_LEN(_dev) \
(I40EVF_GLOBAL_STATS_LEN + I40EVF_QUEUE_STATS_LEN(_dev))
/** /**
* i40evf_get_settings - Get Link Speed and Duplex settings * i40evf_get_settings - Get Link Speed and Duplex settings
...@@ -97,9 +99,9 @@ static int i40evf_get_settings(struct net_device *netdev, ...@@ -97,9 +99,9 @@ static int i40evf_get_settings(struct net_device *netdev,
static int i40evf_get_sset_count(struct net_device *netdev, int sset) static int i40evf_get_sset_count(struct net_device *netdev, int sset)
{ {
if (sset == ETH_SS_STATS) if (sset == ETH_SS_STATS)
return I40EVF_STATS_LEN; return I40EVF_STATS_LEN(netdev);
else else
return -ENOTSUPP; return -EINVAL;
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册