diff options
Diffstat (limited to 'drivers/infiniband/ulp/ipoib/ipoib_ethtool.c')
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_ethtool.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c b/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c index 10279b79c44d..66af5c1a76e5 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c | |||
@@ -86,11 +86,57 @@ static int ipoib_set_coalesce(struct net_device *dev, | |||
86 | return 0; | 86 | return 0; |
87 | } | 87 | } |
88 | 88 | ||
89 | static const char ipoib_stats_keys[][ETH_GSTRING_LEN] = { | ||
90 | "LRO aggregated", "LRO flushed", | ||
91 | "LRO avg aggr", "LRO no desc" | ||
92 | }; | ||
93 | |||
94 | static void ipoib_get_strings(struct net_device *netdev, u32 stringset, u8 *data) | ||
95 | { | ||
96 | switch (stringset) { | ||
97 | case ETH_SS_STATS: | ||
98 | memcpy(data, *ipoib_stats_keys, sizeof(ipoib_stats_keys)); | ||
99 | break; | ||
100 | } | ||
101 | } | ||
102 | |||
103 | static int ipoib_get_sset_count(struct net_device *dev, int sset) | ||
104 | { | ||
105 | switch (sset) { | ||
106 | case ETH_SS_STATS: | ||
107 | return ARRAY_SIZE(ipoib_stats_keys); | ||
108 | default: | ||
109 | return -EOPNOTSUPP; | ||
110 | } | ||
111 | } | ||
112 | |||
113 | static void ipoib_get_ethtool_stats(struct net_device *dev, | ||
114 | struct ethtool_stats *stats, uint64_t *data) | ||
115 | { | ||
116 | struct ipoib_dev_priv *priv = netdev_priv(dev); | ||
117 | int index = 0; | ||
118 | |||
119 | /* Get LRO statistics */ | ||
120 | data[index++] = priv->lro.lro_mgr.stats.aggregated; | ||
121 | data[index++] = priv->lro.lro_mgr.stats.flushed; | ||
122 | if (priv->lro.lro_mgr.stats.flushed) | ||
123 | data[index++] = priv->lro.lro_mgr.stats.aggregated / | ||
124 | priv->lro.lro_mgr.stats.flushed; | ||
125 | else | ||
126 | data[index++] = 0; | ||
127 | data[index++] = priv->lro.lro_mgr.stats.no_desc; | ||
128 | } | ||
129 | |||
89 | static const struct ethtool_ops ipoib_ethtool_ops = { | 130 | static const struct ethtool_ops ipoib_ethtool_ops = { |
90 | .get_drvinfo = ipoib_get_drvinfo, | 131 | .get_drvinfo = ipoib_get_drvinfo, |
91 | .get_tso = ethtool_op_get_tso, | 132 | .get_tso = ethtool_op_get_tso, |
92 | .get_coalesce = ipoib_get_coalesce, | 133 | .get_coalesce = ipoib_get_coalesce, |
93 | .set_coalesce = ipoib_set_coalesce, | 134 | .set_coalesce = ipoib_set_coalesce, |
135 | .get_flags = ethtool_op_get_flags, | ||
136 | .set_flags = ethtool_op_set_flags, | ||
137 | .get_strings = ipoib_get_strings, | ||
138 | .get_sset_count = ipoib_get_sset_count, | ||
139 | .get_ethtool_stats = ipoib_get_ethtool_stats, | ||
94 | }; | 140 | }; |
95 | 141 | ||
96 | void ipoib_set_ethtool_ops(struct net_device *dev) | 142 | void ipoib_set_ethtool_ops(struct net_device *dev) |