dt-bindings: mtd: ingenic: Use standard ecc-engine property
[linux/fpc-iii.git] / drivers / net / ethernet / qlogic / qede / qede_dcbnl.c
blob6e7747b9b95ed337df7f61410d001ff292faddca
1 /* QLogic qede NIC Driver
2 * Copyright (c) 2015 QLogic Corporation
4 * This software is available under the terms of the GNU General Public License
5 * (GPL) Version 2, available from the file COPYING in the main directory of
6 * this source tree.
7 */
9 #include <linux/types.h>
10 #include <linux/netdevice.h>
11 #include <linux/rtnetlink.h>
12 #include <net/dcbnl.h>
13 #include "qede.h"
15 static u8 qede_dcbnl_getstate(struct net_device *netdev)
17 struct qede_dev *edev = netdev_priv(netdev);
19 return edev->ops->dcb->getstate(edev->cdev);
22 static u8 qede_dcbnl_setstate(struct net_device *netdev, u8 state)
24 struct qede_dev *edev = netdev_priv(netdev);
26 return edev->ops->dcb->setstate(edev->cdev, state);
29 static void qede_dcbnl_getpermhwaddr(struct net_device *netdev,
30 u8 *perm_addr)
32 memcpy(perm_addr, netdev->dev_addr, netdev->addr_len);
35 static void qede_dcbnl_getpgtccfgtx(struct net_device *netdev, int prio,
36 u8 *prio_type, u8 *pgid, u8 *bw_pct,
37 u8 *up_map)
39 struct qede_dev *edev = netdev_priv(netdev);
41 edev->ops->dcb->getpgtccfgtx(edev->cdev, prio, prio_type,
42 pgid, bw_pct, up_map);
45 static void qede_dcbnl_getpgbwgcfgtx(struct net_device *netdev,
46 int pgid, u8 *bw_pct)
48 struct qede_dev *edev = netdev_priv(netdev);
50 edev->ops->dcb->getpgbwgcfgtx(edev->cdev, pgid, bw_pct);
53 static void qede_dcbnl_getpgtccfgrx(struct net_device *netdev, int prio,
54 u8 *prio_type, u8 *pgid, u8 *bw_pct,
55 u8 *up_map)
57 struct qede_dev *edev = netdev_priv(netdev);
59 edev->ops->dcb->getpgtccfgrx(edev->cdev, prio, prio_type, pgid, bw_pct,
60 up_map);
63 static void qede_dcbnl_getpgbwgcfgrx(struct net_device *netdev,
64 int pgid, u8 *bw_pct)
66 struct qede_dev *edev = netdev_priv(netdev);
68 edev->ops->dcb->getpgbwgcfgrx(edev->cdev, pgid, bw_pct);
71 static void qede_dcbnl_getpfccfg(struct net_device *netdev, int prio,
72 u8 *setting)
74 struct qede_dev *edev = netdev_priv(netdev);
76 edev->ops->dcb->getpfccfg(edev->cdev, prio, setting);
79 static void qede_dcbnl_setpfccfg(struct net_device *netdev, int prio,
80 u8 setting)
82 struct qede_dev *edev = netdev_priv(netdev);
84 edev->ops->dcb->setpfccfg(edev->cdev, prio, setting);
87 static u8 qede_dcbnl_getcap(struct net_device *netdev, int capid, u8 *cap)
89 struct qede_dev *edev = netdev_priv(netdev);
91 return edev->ops->dcb->getcap(edev->cdev, capid, cap);
94 static int qede_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num)
96 struct qede_dev *edev = netdev_priv(netdev);
98 return edev->ops->dcb->getnumtcs(edev->cdev, tcid, num);
101 static u8 qede_dcbnl_getpfcstate(struct net_device *netdev)
103 struct qede_dev *edev = netdev_priv(netdev);
105 return edev->ops->dcb->getpfcstate(edev->cdev);
108 static int qede_dcbnl_getapp(struct net_device *netdev, u8 idtype, u16 id)
110 struct qede_dev *edev = netdev_priv(netdev);
112 return edev->ops->dcb->getapp(edev->cdev, idtype, id);
115 static u8 qede_dcbnl_getdcbx(struct net_device *netdev)
117 struct qede_dev *edev = netdev_priv(netdev);
119 return edev->ops->dcb->getdcbx(edev->cdev);
122 static void qede_dcbnl_setpgtccfgtx(struct net_device *netdev, int prio,
123 u8 pri_type, u8 pgid, u8 bw_pct, u8 up_map)
125 struct qede_dev *edev = netdev_priv(netdev);
127 return edev->ops->dcb->setpgtccfgtx(edev->cdev, prio, pri_type, pgid,
128 bw_pct, up_map);
131 static void qede_dcbnl_setpgtccfgrx(struct net_device *netdev, int prio,
132 u8 pri_type, u8 pgid, u8 bw_pct, u8 up_map)
134 struct qede_dev *edev = netdev_priv(netdev);
136 return edev->ops->dcb->setpgtccfgrx(edev->cdev, prio, pri_type, pgid,
137 bw_pct, up_map);
140 static void qede_dcbnl_setpgbwgcfgtx(struct net_device *netdev, int pgid,
141 u8 bw_pct)
143 struct qede_dev *edev = netdev_priv(netdev);
145 return edev->ops->dcb->setpgbwgcfgtx(edev->cdev, pgid, bw_pct);
148 static void qede_dcbnl_setpgbwgcfgrx(struct net_device *netdev, int pgid,
149 u8 bw_pct)
151 struct qede_dev *edev = netdev_priv(netdev);
153 return edev->ops->dcb->setpgbwgcfgrx(edev->cdev, pgid, bw_pct);
156 static u8 qede_dcbnl_setall(struct net_device *netdev)
158 struct qede_dev *edev = netdev_priv(netdev);
160 return edev->ops->dcb->setall(edev->cdev);
163 static int qede_dcbnl_setnumtcs(struct net_device *netdev, int tcid, u8 num)
165 struct qede_dev *edev = netdev_priv(netdev);
167 return edev->ops->dcb->setnumtcs(edev->cdev, tcid, num);
170 static void qede_dcbnl_setpfcstate(struct net_device *netdev, u8 state)
172 struct qede_dev *edev = netdev_priv(netdev);
174 return edev->ops->dcb->setpfcstate(edev->cdev, state);
177 static int qede_dcbnl_setapp(struct net_device *netdev, u8 idtype, u16 idval,
178 u8 up)
180 struct qede_dev *edev = netdev_priv(netdev);
182 return edev->ops->dcb->setapp(edev->cdev, idtype, idval, up);
185 static u8 qede_dcbnl_setdcbx(struct net_device *netdev, u8 state)
187 struct qede_dev *edev = netdev_priv(netdev);
189 return edev->ops->dcb->setdcbx(edev->cdev, state);
192 static u8 qede_dcbnl_getfeatcfg(struct net_device *netdev, int featid,
193 u8 *flags)
195 struct qede_dev *edev = netdev_priv(netdev);
197 return edev->ops->dcb->getfeatcfg(edev->cdev, featid, flags);
200 static u8 qede_dcbnl_setfeatcfg(struct net_device *netdev, int featid, u8 flags)
202 struct qede_dev *edev = netdev_priv(netdev);
204 return edev->ops->dcb->setfeatcfg(edev->cdev, featid, flags);
207 static int qede_dcbnl_peer_getappinfo(struct net_device *netdev,
208 struct dcb_peer_app_info *info,
209 u16 *count)
211 struct qede_dev *edev = netdev_priv(netdev);
213 return edev->ops->dcb->peer_getappinfo(edev->cdev, info, count);
216 static int qede_dcbnl_peer_getapptable(struct net_device *netdev,
217 struct dcb_app *app)
219 struct qede_dev *edev = netdev_priv(netdev);
221 return edev->ops->dcb->peer_getapptable(edev->cdev, app);
224 static int qede_dcbnl_cee_peer_getpfc(struct net_device *netdev,
225 struct cee_pfc *pfc)
227 struct qede_dev *edev = netdev_priv(netdev);
229 return edev->ops->dcb->cee_peer_getpfc(edev->cdev, pfc);
232 static int qede_dcbnl_cee_peer_getpg(struct net_device *netdev,
233 struct cee_pg *pg)
235 struct qede_dev *edev = netdev_priv(netdev);
237 return edev->ops->dcb->cee_peer_getpg(edev->cdev, pg);
240 static int qede_dcbnl_ieee_getpfc(struct net_device *netdev,
241 struct ieee_pfc *pfc)
243 struct qede_dev *edev = netdev_priv(netdev);
245 return edev->ops->dcb->ieee_getpfc(edev->cdev, pfc);
248 static int qede_dcbnl_ieee_setpfc(struct net_device *netdev,
249 struct ieee_pfc *pfc)
251 struct qede_dev *edev = netdev_priv(netdev);
253 return edev->ops->dcb->ieee_setpfc(edev->cdev, pfc);
256 static int qede_dcbnl_ieee_getets(struct net_device *netdev,
257 struct ieee_ets *ets)
259 struct qede_dev *edev = netdev_priv(netdev);
261 return edev->ops->dcb->ieee_getets(edev->cdev, ets);
264 static int qede_dcbnl_ieee_setets(struct net_device *netdev,
265 struct ieee_ets *ets)
267 struct qede_dev *edev = netdev_priv(netdev);
269 return edev->ops->dcb->ieee_setets(edev->cdev, ets);
272 static int qede_dcbnl_ieee_getapp(struct net_device *netdev,
273 struct dcb_app *app)
275 struct qede_dev *edev = netdev_priv(netdev);
277 return edev->ops->dcb->ieee_getapp(edev->cdev, app);
280 static int qede_dcbnl_ieee_setapp(struct net_device *netdev,
281 struct dcb_app *app)
283 struct qede_dev *edev = netdev_priv(netdev);
284 int err;
286 err = dcb_ieee_setapp(netdev, app);
287 if (err)
288 return err;
290 return edev->ops->dcb->ieee_setapp(edev->cdev, app);
293 static int qede_dcbnl_ieee_peer_getpfc(struct net_device *netdev,
294 struct ieee_pfc *pfc)
296 struct qede_dev *edev = netdev_priv(netdev);
298 return edev->ops->dcb->ieee_peer_getpfc(edev->cdev, pfc);
301 static int qede_dcbnl_ieee_peer_getets(struct net_device *netdev,
302 struct ieee_ets *ets)
304 struct qede_dev *edev = netdev_priv(netdev);
306 return edev->ops->dcb->ieee_peer_getets(edev->cdev, ets);
309 static const struct dcbnl_rtnl_ops qede_dcbnl_ops = {
310 .ieee_getpfc = qede_dcbnl_ieee_getpfc,
311 .ieee_setpfc = qede_dcbnl_ieee_setpfc,
312 .ieee_getets = qede_dcbnl_ieee_getets,
313 .ieee_setets = qede_dcbnl_ieee_setets,
314 .ieee_getapp = qede_dcbnl_ieee_getapp,
315 .ieee_setapp = qede_dcbnl_ieee_setapp,
316 .ieee_peer_getpfc = qede_dcbnl_ieee_peer_getpfc,
317 .ieee_peer_getets = qede_dcbnl_ieee_peer_getets,
318 .getstate = qede_dcbnl_getstate,
319 .setstate = qede_dcbnl_setstate,
320 .getpermhwaddr = qede_dcbnl_getpermhwaddr,
321 .getpgtccfgtx = qede_dcbnl_getpgtccfgtx,
322 .getpgbwgcfgtx = qede_dcbnl_getpgbwgcfgtx,
323 .getpgtccfgrx = qede_dcbnl_getpgtccfgrx,
324 .getpgbwgcfgrx = qede_dcbnl_getpgbwgcfgrx,
325 .getpfccfg = qede_dcbnl_getpfccfg,
326 .setpfccfg = qede_dcbnl_setpfccfg,
327 .getcap = qede_dcbnl_getcap,
328 .getnumtcs = qede_dcbnl_getnumtcs,
329 .getpfcstate = qede_dcbnl_getpfcstate,
330 .getapp = qede_dcbnl_getapp,
331 .getdcbx = qede_dcbnl_getdcbx,
332 .setpgtccfgtx = qede_dcbnl_setpgtccfgtx,
333 .setpgtccfgrx = qede_dcbnl_setpgtccfgrx,
334 .setpgbwgcfgtx = qede_dcbnl_setpgbwgcfgtx,
335 .setpgbwgcfgrx = qede_dcbnl_setpgbwgcfgrx,
336 .setall = qede_dcbnl_setall,
337 .setnumtcs = qede_dcbnl_setnumtcs,
338 .setpfcstate = qede_dcbnl_setpfcstate,
339 .setapp = qede_dcbnl_setapp,
340 .setdcbx = qede_dcbnl_setdcbx,
341 .setfeatcfg = qede_dcbnl_setfeatcfg,
342 .getfeatcfg = qede_dcbnl_getfeatcfg,
343 .peer_getappinfo = qede_dcbnl_peer_getappinfo,
344 .peer_getapptable = qede_dcbnl_peer_getapptable,
345 .cee_peer_getpfc = qede_dcbnl_cee_peer_getpfc,
346 .cee_peer_getpg = qede_dcbnl_cee_peer_getpg,
349 void qede_set_dcbnl_ops(struct net_device *dev)
351 dev->dcbnl_ops = &qede_dcbnl_ops;