4 * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of version 2 of the GNU General Public License as
8 * published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 * The full GNU General Public License is included in this distribution
19 * in the file called LICENSE.GPL.
21 * Contact Information:
25 #include <linux/device.h>
26 #include <linux/netdevice.h>
27 #include <linux/ethtool.h>
31 kni_check_if_running(struct net_device *dev)
33 struct kni_dev *priv = netdev_priv(dev);
41 kni_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
43 struct kni_dev *priv = netdev_priv(dev);
44 priv->lad_dev->ethtool_ops->get_drvinfo(priv->lad_dev, info);
48 kni_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
50 struct kni_dev *priv = netdev_priv(dev);
51 return priv->lad_dev->ethtool_ops->get_settings(priv->lad_dev, ecmd);
55 kni_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
57 struct kni_dev *priv = netdev_priv(dev);
58 return priv->lad_dev->ethtool_ops->set_settings(priv->lad_dev, ecmd);
62 kni_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
64 struct kni_dev *priv = netdev_priv(dev);
65 priv->lad_dev->ethtool_ops->get_wol(priv->lad_dev, wol);
69 kni_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
71 struct kni_dev *priv = netdev_priv(dev);
72 return priv->lad_dev->ethtool_ops->set_wol(priv->lad_dev, wol);
76 kni_nway_reset(struct net_device *dev)
78 struct kni_dev *priv = netdev_priv(dev);
79 return priv->lad_dev->ethtool_ops->nway_reset(priv->lad_dev);
83 kni_get_eeprom_len(struct net_device *dev)
85 struct kni_dev *priv = netdev_priv(dev);
86 return priv->lad_dev->ethtool_ops->get_eeprom_len(priv->lad_dev);
90 kni_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
93 struct kni_dev *priv = netdev_priv(dev);
94 return priv->lad_dev->ethtool_ops->get_eeprom(priv->lad_dev, eeprom,
99 kni_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
102 struct kni_dev *priv = netdev_priv(dev);
103 return priv->lad_dev->ethtool_ops->set_eeprom(priv->lad_dev, eeprom,
108 kni_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ring)
110 struct kni_dev *priv = netdev_priv(dev);
111 priv->lad_dev->ethtool_ops->get_ringparam(priv->lad_dev, ring);
115 kni_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ring)
117 struct kni_dev *priv = netdev_priv(dev);
118 return priv->lad_dev->ethtool_ops->set_ringparam(priv->lad_dev, ring);
122 kni_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause)
124 struct kni_dev *priv = netdev_priv(dev);
125 priv->lad_dev->ethtool_ops->get_pauseparam(priv->lad_dev, pause);
129 kni_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause)
131 struct kni_dev *priv = netdev_priv(dev);
132 return priv->lad_dev->ethtool_ops->set_pauseparam(priv->lad_dev,
137 kni_get_msglevel(struct net_device *dev)
139 struct kni_dev *priv = netdev_priv(dev);
140 return priv->lad_dev->ethtool_ops->get_msglevel(priv->lad_dev);
144 kni_set_msglevel(struct net_device *dev, u32 data)
146 struct kni_dev *priv = netdev_priv(dev);
147 priv->lad_dev->ethtool_ops->set_msglevel(priv->lad_dev, data);
151 kni_get_regs_len(struct net_device *dev)
153 struct kni_dev *priv = netdev_priv(dev);
154 return priv->lad_dev->ethtool_ops->get_regs_len(priv->lad_dev);
158 kni_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
160 struct kni_dev *priv = netdev_priv(dev);
161 priv->lad_dev->ethtool_ops->get_regs(priv->lad_dev, regs, p);
165 kni_get_strings(struct net_device *dev, u32 stringset, u8 *data)
167 struct kni_dev *priv = netdev_priv(dev);
168 priv->lad_dev->ethtool_ops->get_strings(priv->lad_dev, stringset,
173 kni_get_sset_count(struct net_device *dev, int sset)
175 struct kni_dev *priv = netdev_priv(dev);
176 return priv->lad_dev->ethtool_ops->get_sset_count(priv->lad_dev, sset);
180 kni_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *stats,
183 struct kni_dev *priv = netdev_priv(dev);
184 priv->lad_dev->ethtool_ops->get_ethtool_stats(priv->lad_dev, stats,
188 struct ethtool_ops kni_ethtool_ops = {
189 .begin = kni_check_if_running,
190 .get_drvinfo = kni_get_drvinfo,
191 .get_settings = kni_get_settings,
192 .set_settings = kni_set_settings,
193 .get_regs_len = kni_get_regs_len,
194 .get_regs = kni_get_regs,
195 .get_wol = kni_get_wol,
196 .set_wol = kni_set_wol,
197 .nway_reset = kni_nway_reset,
198 .get_link = ethtool_op_get_link,
199 .get_eeprom_len = kni_get_eeprom_len,
200 .get_eeprom = kni_get_eeprom,
201 .set_eeprom = kni_set_eeprom,
202 .get_ringparam = kni_get_ringparam,
203 .set_ringparam = kni_set_ringparam,
204 .get_pauseparam = kni_get_pauseparam,
205 .set_pauseparam = kni_set_pauseparam,
206 .get_msglevel = kni_get_msglevel,
207 .set_msglevel = kni_set_msglevel,
208 .get_strings = kni_get_strings,
209 .get_sset_count = kni_get_sset_count,
210 .get_ethtool_stats = kni_get_ethtool_stats,
214 kni_set_ethtool_ops(struct net_device *netdev)
216 SET_ETHTOOL_OPS(netdev, &kni_ethtool_ops);