]> git.proxmox.com Git - ceph.git/blame - ceph/src/dpdk/lib/librte_eal/linuxapp/kni/kni_ethtool.c
bump version to 12.2.12-pve1
[ceph.git] / ceph / src / dpdk / lib / librte_eal / linuxapp / kni / kni_ethtool.c
CommitLineData
7c673cae
FG
1/*-
2 * GPL LICENSE SUMMARY
3 *
4 * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
5 *
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.
9 *
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.
14 *
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.
20 *
21 * Contact Information:
22 * Intel Corporation
23 */
24
25#include <linux/device.h>
26#include <linux/netdevice.h>
27#include <linux/ethtool.h>
28#include "kni_dev.h"
29
30static int
31kni_check_if_running(struct net_device *dev)
32{
33 struct kni_dev *priv = netdev_priv(dev);
34
35 if (priv->lad_dev)
36 return 0;
37 else
38 return -EOPNOTSUPP;
39}
40
41static void
42kni_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
43{
44 struct kni_dev *priv = netdev_priv(dev);
45
46 priv->lad_dev->ethtool_ops->get_drvinfo(priv->lad_dev, info);
47}
48
49static int
50kni_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
51{
52 struct kni_dev *priv = netdev_priv(dev);
53
54 return priv->lad_dev->ethtool_ops->get_settings(priv->lad_dev, ecmd);
55}
56
57static int
58kni_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
59{
60 struct kni_dev *priv = netdev_priv(dev);
61
62 return priv->lad_dev->ethtool_ops->set_settings(priv->lad_dev, ecmd);
63}
64
65static void
66kni_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
67{
68 struct kni_dev *priv = netdev_priv(dev);
69
70 priv->lad_dev->ethtool_ops->get_wol(priv->lad_dev, wol);
71}
72
73static int
74kni_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
75{
76 struct kni_dev *priv = netdev_priv(dev);
77
78 return priv->lad_dev->ethtool_ops->set_wol(priv->lad_dev, wol);
79}
80
81static int
82kni_nway_reset(struct net_device *dev)
83{
84 struct kni_dev *priv = netdev_priv(dev);
85
86 return priv->lad_dev->ethtool_ops->nway_reset(priv->lad_dev);
87}
88
89static int
90kni_get_eeprom_len(struct net_device *dev)
91{
92 struct kni_dev *priv = netdev_priv(dev);
93
94 return priv->lad_dev->ethtool_ops->get_eeprom_len(priv->lad_dev);
95}
96
97static int
98kni_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
99 u8 *bytes)
100{
101 struct kni_dev *priv = netdev_priv(dev);
102
103 return priv->lad_dev->ethtool_ops->get_eeprom(priv->lad_dev, eeprom,
104 bytes);
105}
106
107static int
108kni_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
109 u8 *bytes)
110{
111 struct kni_dev *priv = netdev_priv(dev);
112
113 return priv->lad_dev->ethtool_ops->set_eeprom(priv->lad_dev, eeprom,
114 bytes);
115}
116
117static void
118kni_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ring)
119{
120 struct kni_dev *priv = netdev_priv(dev);
121
122 priv->lad_dev->ethtool_ops->get_ringparam(priv->lad_dev, ring);
123}
124
125static int
126kni_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ring)
127{
128 struct kni_dev *priv = netdev_priv(dev);
129
130 return priv->lad_dev->ethtool_ops->set_ringparam(priv->lad_dev, ring);
131}
132
133static void
134kni_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause)
135{
136 struct kni_dev *priv = netdev_priv(dev);
137
138 priv->lad_dev->ethtool_ops->get_pauseparam(priv->lad_dev, pause);
139}
140
141static int
142kni_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause)
143{
144 struct kni_dev *priv = netdev_priv(dev);
145
146 return priv->lad_dev->ethtool_ops->set_pauseparam(priv->lad_dev,
147 pause);
148}
149
150static u32
151kni_get_msglevel(struct net_device *dev)
152{
153 struct kni_dev *priv = netdev_priv(dev);
154
155 return priv->lad_dev->ethtool_ops->get_msglevel(priv->lad_dev);
156}
157
158static void
159kni_set_msglevel(struct net_device *dev, u32 data)
160{
161 struct kni_dev *priv = netdev_priv(dev);
162
163 priv->lad_dev->ethtool_ops->set_msglevel(priv->lad_dev, data);
164}
165
166static int
167kni_get_regs_len(struct net_device *dev)
168{
169 struct kni_dev *priv = netdev_priv(dev);
170
171 return priv->lad_dev->ethtool_ops->get_regs_len(priv->lad_dev);
172}
173
174static void
175kni_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
176{
177 struct kni_dev *priv = netdev_priv(dev);
178
179 priv->lad_dev->ethtool_ops->get_regs(priv->lad_dev, regs, p);
180}
181
182static void
183kni_get_strings(struct net_device *dev, u32 stringset, u8 *data)
184{
185 struct kni_dev *priv = netdev_priv(dev);
186
187 priv->lad_dev->ethtool_ops->get_strings(priv->lad_dev, stringset,
188 data);
189}
190
191static int
192kni_get_sset_count(struct net_device *dev, int sset)
193{
194 struct kni_dev *priv = netdev_priv(dev);
195
196 return priv->lad_dev->ethtool_ops->get_sset_count(priv->lad_dev, sset);
197}
198
199static void
200kni_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *stats,
201 u64 *data)
202{
203 struct kni_dev *priv = netdev_priv(dev);
204
205 priv->lad_dev->ethtool_ops->get_ethtool_stats(priv->lad_dev, stats,
206 data);
207}
208
209struct ethtool_ops kni_ethtool_ops = {
210 .begin = kni_check_if_running,
211 .get_drvinfo = kni_get_drvinfo,
212 .get_settings = kni_get_settings,
213 .set_settings = kni_set_settings,
214 .get_regs_len = kni_get_regs_len,
215 .get_regs = kni_get_regs,
216 .get_wol = kni_get_wol,
217 .set_wol = kni_set_wol,
218 .nway_reset = kni_nway_reset,
219 .get_link = ethtool_op_get_link,
220 .get_eeprom_len = kni_get_eeprom_len,
221 .get_eeprom = kni_get_eeprom,
222 .set_eeprom = kni_set_eeprom,
223 .get_ringparam = kni_get_ringparam,
224 .set_ringparam = kni_set_ringparam,
225 .get_pauseparam = kni_get_pauseparam,
226 .set_pauseparam = kni_set_pauseparam,
227 .get_msglevel = kni_get_msglevel,
228 .set_msglevel = kni_set_msglevel,
229 .get_strings = kni_get_strings,
230 .get_sset_count = kni_get_sset_count,
231 .get_ethtool_stats = kni_get_ethtool_stats,
232};
233
234void
235kni_set_ethtool_ops(struct net_device *netdev)
236{
237 netdev->ethtool_ops = &kni_ethtool_ops;
238}