2 * Copyright (c) 2008, Intel Corporation.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 * Place - Suite 330, Boston, MA 02111-1307 USA.
17 * Author: Lucy Liu <lucy.liu@intel.com>
20 #include <linux/netdevice.h>
21 #include <linux/netlink.h>
22 #include <net/netlink.h>
23 #include <net/rtnetlink.h>
24 #include <linux/dcbnl.h>
25 #include <linux/rtnetlink.h>
29 * Data Center Bridging (DCB) is a collection of Ethernet enhancements
30 * intended to allow network traffic with differing requirements
31 * (highly reliable, no drops vs. best effort vs. low latency) to operate
32 * and co-exist on Ethernet. Current DCB features are:
34 * Enhanced Transmission Selection (aka Priority Grouping [PG]) - provides a
35 * framework for assigning bandwidth guarantees to traffic classes.
37 * Priority-based Flow Control (PFC) - provides a flow control mechanism which
38 * can work independently for each 802.1p priority.
40 * Congestion Notification - provides a mechanism for end-to-end congestion
41 * control for protocols which do not have built-in congestion management.
43 * More information about the emerging standards for these Ethernet features
44 * can be found at: http://www.ieee802.org/1/pages/dcbridges.html
46 * This file implements an rtnetlink interface to allow configuration of DCB
47 * features for capable devices.
50 MODULE_AUTHOR("Lucy Liu, <lucy.liu@intel.com>");
51 MODULE_DESCRIPTION("Data Center Bridging generic netlink interface");
52 MODULE_LICENSE("GPL");
54 /**************** DCB attribute policies *************************************/
56 /* DCB netlink attributes policy */
57 static struct nla_policy dcbnl_rtnl_policy[DCB_ATTR_MAX + 1] = {
58 [DCB_ATTR_IFNAME] = {.type = NLA_STRING, .len = IFNAMSIZ - 1},
59 [DCB_ATTR_STATE] = {.type = NLA_U8},
60 [DCB_ATTR_PFC_CFG] = {.type = NLA_NESTED},
61 [DCB_ATTR_PG_CFG] = {.type = NLA_NESTED},
62 [DCB_ATTR_SET_ALL] = {.type = NLA_U8},
63 [DCB_ATTR_PERM_HWADDR] = {.type = NLA_FLAG},
64 [DCB_ATTR_CAP] = {.type = NLA_NESTED},
67 /* DCB priority flow control to User Priority nested attributes */
68 static struct nla_policy dcbnl_pfc_up_nest[DCB_PFC_UP_ATTR_MAX + 1] = {
69 [DCB_PFC_UP_ATTR_0] = {.type = NLA_U8},
70 [DCB_PFC_UP_ATTR_1] = {.type = NLA_U8},
71 [DCB_PFC_UP_ATTR_2] = {.type = NLA_U8},
72 [DCB_PFC_UP_ATTR_3] = {.type = NLA_U8},
73 [DCB_PFC_UP_ATTR_4] = {.type = NLA_U8},
74 [DCB_PFC_UP_ATTR_5] = {.type = NLA_U8},
75 [DCB_PFC_UP_ATTR_6] = {.type = NLA_U8},
76 [DCB_PFC_UP_ATTR_7] = {.type = NLA_U8},
77 [DCB_PFC_UP_ATTR_ALL] = {.type = NLA_FLAG},
80 /* DCB priority grouping nested attributes */
81 static struct nla_policy dcbnl_pg_nest[DCB_PG_ATTR_MAX + 1] = {
82 [DCB_PG_ATTR_TC_0] = {.type = NLA_NESTED},
83 [DCB_PG_ATTR_TC_1] = {.type = NLA_NESTED},
84 [DCB_PG_ATTR_TC_2] = {.type = NLA_NESTED},
85 [DCB_PG_ATTR_TC_3] = {.type = NLA_NESTED},
86 [DCB_PG_ATTR_TC_4] = {.type = NLA_NESTED},
87 [DCB_PG_ATTR_TC_5] = {.type = NLA_NESTED},
88 [DCB_PG_ATTR_TC_6] = {.type = NLA_NESTED},
89 [DCB_PG_ATTR_TC_7] = {.type = NLA_NESTED},
90 [DCB_PG_ATTR_TC_ALL] = {.type = NLA_NESTED},
91 [DCB_PG_ATTR_BW_ID_0] = {.type = NLA_U8},
92 [DCB_PG_ATTR_BW_ID_1] = {.type = NLA_U8},
93 [DCB_PG_ATTR_BW_ID_2] = {.type = NLA_U8},
94 [DCB_PG_ATTR_BW_ID_3] = {.type = NLA_U8},
95 [DCB_PG_ATTR_BW_ID_4] = {.type = NLA_U8},
96 [DCB_PG_ATTR_BW_ID_5] = {.type = NLA_U8},
97 [DCB_PG_ATTR_BW_ID_6] = {.type = NLA_U8},
98 [DCB_PG_ATTR_BW_ID_7] = {.type = NLA_U8},
99 [DCB_PG_ATTR_BW_ID_ALL] = {.type = NLA_FLAG},
102 /* DCB traffic class nested attributes. */
103 static struct nla_policy dcbnl_tc_param_nest[DCB_TC_ATTR_PARAM_MAX + 1] = {
104 [DCB_TC_ATTR_PARAM_PGID] = {.type = NLA_U8},
105 [DCB_TC_ATTR_PARAM_UP_MAPPING] = {.type = NLA_U8},
106 [DCB_TC_ATTR_PARAM_STRICT_PRIO] = {.type = NLA_U8},
107 [DCB_TC_ATTR_PARAM_BW_PCT] = {.type = NLA_U8},
108 [DCB_TC_ATTR_PARAM_ALL] = {.type = NLA_FLAG},
111 /* DCB capabilities nested attributes. */
112 static struct nla_policy dcbnl_cap_nest[DCB_CAP_ATTR_MAX + 1] = {
113 [DCB_CAP_ATTR_ALL] = {.type = NLA_FLAG},
114 [DCB_CAP_ATTR_PG] = {.type = NLA_U8},
115 [DCB_CAP_ATTR_PFC] = {.type = NLA_U8},
116 [DCB_CAP_ATTR_UP2TC] = {.type = NLA_U8},
117 [DCB_CAP_ATTR_PG_TCS] = {.type = NLA_U8},
118 [DCB_CAP_ATTR_PFC_TCS] = {.type = NLA_U8},
119 [DCB_CAP_ATTR_GSP] = {.type = NLA_U8},
120 [DCB_CAP_ATTR_BCN] = {.type = NLA_U8},
123 /* standard netlink reply call */
124 static int dcbnl_reply(u8 value, u8 event, u8 cmd, u8 attr, u32 pid,
127 struct sk_buff *dcbnl_skb;
129 struct nlmsghdr *nlh;
132 dcbnl_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
136 nlh = NLMSG_NEW(dcbnl_skb, pid, seq, event, sizeof(*dcb), flags);
138 dcb = NLMSG_DATA(nlh);
139 dcb->dcb_family = AF_UNSPEC;
143 ret = nla_put_u8(dcbnl_skb, attr, value);
147 /* end the message, assign the nlmsg_len. */
148 nlmsg_end(dcbnl_skb, nlh);
149 ret = rtnl_unicast(dcbnl_skb, &init_net, pid);
160 static int dcbnl_getstate(struct net_device *netdev, struct nlattr **tb,
161 u32 pid, u32 seq, u16 flags)
165 /* if (!tb[DCB_ATTR_STATE] || !netdev->dcbnl_ops->getstate) */
166 if (!netdev->dcbnl_ops->getstate)
169 ret = dcbnl_reply(netdev->dcbnl_ops->getstate(netdev), RTM_GETDCB,
170 DCB_CMD_GSTATE, DCB_ATTR_STATE, pid, seq, flags);
175 static int dcbnl_getpfccfg(struct net_device *netdev, struct nlattr **tb,
176 u32 pid, u32 seq, u16 flags)
178 struct sk_buff *dcbnl_skb;
179 struct nlmsghdr *nlh;
181 struct nlattr *data[DCB_PFC_UP_ATTR_MAX + 1], *nest;
187 if (!tb[DCB_ATTR_PFC_CFG] || !netdev->dcbnl_ops->getpfccfg)
190 ret = nla_parse_nested(data, DCB_PFC_UP_ATTR_MAX,
191 tb[DCB_ATTR_PFC_CFG],
196 dcbnl_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
200 nlh = NLMSG_NEW(dcbnl_skb, pid, seq, RTM_GETDCB, sizeof(*dcb), flags);
202 dcb = NLMSG_DATA(nlh);
203 dcb->dcb_family = AF_UNSPEC;
204 dcb->cmd = DCB_CMD_PFC_GCFG;
206 nest = nla_nest_start(dcbnl_skb, DCB_ATTR_PFC_CFG);
210 if (data[DCB_PFC_UP_ATTR_ALL])
213 for (i = DCB_PFC_UP_ATTR_0; i <= DCB_PFC_UP_ATTR_7; i++) {
214 if (!getall && !data[i])
217 netdev->dcbnl_ops->getpfccfg(netdev, i - DCB_PFC_UP_ATTR_0,
219 ret = nla_put_u8(dcbnl_skb, i, value);
222 nla_nest_cancel(dcbnl_skb, nest);
226 nla_nest_end(dcbnl_skb, nest);
228 nlmsg_end(dcbnl_skb, nlh);
230 ret = rtnl_unicast(dcbnl_skb, &init_net, pid);
242 static int dcbnl_getperm_hwaddr(struct net_device *netdev, struct nlattr **tb,
243 u32 pid, u32 seq, u16 flags)
245 struct sk_buff *dcbnl_skb;
246 struct nlmsghdr *nlh;
248 u8 perm_addr[MAX_ADDR_LEN];
251 if (!netdev->dcbnl_ops->getpermhwaddr)
254 dcbnl_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
258 nlh = NLMSG_NEW(dcbnl_skb, pid, seq, RTM_GETDCB, sizeof(*dcb), flags);
260 dcb = NLMSG_DATA(nlh);
261 dcb->dcb_family = AF_UNSPEC;
262 dcb->cmd = DCB_CMD_GPERM_HWADDR;
264 netdev->dcbnl_ops->getpermhwaddr(netdev, perm_addr);
266 ret = nla_put(dcbnl_skb, DCB_ATTR_PERM_HWADDR, sizeof(perm_addr),
269 nlmsg_end(dcbnl_skb, nlh);
271 ret = rtnl_unicast(dcbnl_skb, &init_net, pid);
284 static int dcbnl_getcap(struct net_device *netdev, struct nlattr **tb,
285 u32 pid, u32 seq, u16 flags)
287 struct sk_buff *dcbnl_skb;
288 struct nlmsghdr *nlh;
290 struct nlattr *data[DCB_CAP_ATTR_MAX + 1], *nest;
296 if (!tb[DCB_ATTR_CAP] || !netdev->dcbnl_ops->getcap)
299 ret = nla_parse_nested(data, DCB_CAP_ATTR_MAX, tb[DCB_ATTR_CAP],
304 dcbnl_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
308 nlh = NLMSG_NEW(dcbnl_skb, pid, seq, RTM_GETDCB, sizeof(*dcb), flags);
310 dcb = NLMSG_DATA(nlh);
311 dcb->dcb_family = AF_UNSPEC;
312 dcb->cmd = DCB_CMD_GCAP;
314 nest = nla_nest_start(dcbnl_skb, DCB_ATTR_CAP);
318 if (data[DCB_CAP_ATTR_ALL])
321 for (i = DCB_CAP_ATTR_ALL+1; i <= DCB_CAP_ATTR_MAX; i++) {
322 if (!getall && !data[i])
325 if (!netdev->dcbnl_ops->getcap(netdev, i, &value)) {
326 ret = nla_put_u8(dcbnl_skb, i, value);
329 nla_nest_cancel(dcbnl_skb, nest);
334 nla_nest_end(dcbnl_skb, nest);
336 nlmsg_end(dcbnl_skb, nlh);
338 ret = rtnl_unicast(dcbnl_skb, &init_net, pid);
350 static int __dcbnl_pg_getcfg(struct net_device *netdev, struct nlattr **tb,
351 u32 pid, u32 seq, u16 flags, int dir)
353 struct sk_buff *dcbnl_skb;
354 struct nlmsghdr *nlh;
356 struct nlattr *pg_nest, *param_nest, *data;
357 struct nlattr *pg_tb[DCB_PG_ATTR_MAX + 1];
358 struct nlattr *param_tb[DCB_TC_ATTR_PARAM_MAX + 1];
359 u8 prio, pgid, tc_pct, up_map;
364 if (!tb[DCB_ATTR_PG_CFG] ||
365 !netdev->dcbnl_ops->getpgtccfgtx ||
366 !netdev->dcbnl_ops->getpgtccfgrx ||
367 !netdev->dcbnl_ops->getpgbwgcfgtx ||
368 !netdev->dcbnl_ops->getpgbwgcfgrx)
371 ret = nla_parse_nested(pg_tb, DCB_PG_ATTR_MAX,
372 tb[DCB_ATTR_PG_CFG], dcbnl_pg_nest);
377 dcbnl_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
381 nlh = NLMSG_NEW(dcbnl_skb, pid, seq, RTM_GETDCB, sizeof(*dcb), flags);
383 dcb = NLMSG_DATA(nlh);
384 dcb->dcb_family = AF_UNSPEC;
385 dcb->cmd = (dir) ? DCB_CMD_PGRX_GCFG : DCB_CMD_PGTX_GCFG;
387 pg_nest = nla_nest_start(dcbnl_skb, DCB_ATTR_PG_CFG);
391 if (pg_tb[DCB_PG_ATTR_TC_ALL])
394 for (i = DCB_PG_ATTR_TC_0; i <= DCB_PG_ATTR_TC_7; i++) {
395 if (!getall && !pg_tb[i])
398 if (pg_tb[DCB_PG_ATTR_TC_ALL])
399 data = pg_tb[DCB_PG_ATTR_TC_ALL];
402 ret = nla_parse_nested(param_tb, DCB_TC_ATTR_PARAM_MAX,
403 data, dcbnl_tc_param_nest);
407 param_nest = nla_nest_start(dcbnl_skb, i);
411 pgid = DCB_ATTR_VALUE_UNDEFINED;
412 prio = DCB_ATTR_VALUE_UNDEFINED;
413 tc_pct = DCB_ATTR_VALUE_UNDEFINED;
414 up_map = DCB_ATTR_VALUE_UNDEFINED;
418 netdev->dcbnl_ops->getpgtccfgrx(netdev,
419 i - DCB_PG_ATTR_TC_0, &prio,
420 &pgid, &tc_pct, &up_map);
423 netdev->dcbnl_ops->getpgtccfgtx(netdev,
424 i - DCB_PG_ATTR_TC_0, &prio,
425 &pgid, &tc_pct, &up_map);
428 if (param_tb[DCB_TC_ATTR_PARAM_PGID] ||
429 param_tb[DCB_TC_ATTR_PARAM_ALL]) {
430 ret = nla_put_u8(dcbnl_skb,
431 DCB_TC_ATTR_PARAM_PGID, pgid);
435 if (param_tb[DCB_TC_ATTR_PARAM_UP_MAPPING] ||
436 param_tb[DCB_TC_ATTR_PARAM_ALL]) {
437 ret = nla_put_u8(dcbnl_skb,
438 DCB_TC_ATTR_PARAM_UP_MAPPING, up_map);
442 if (param_tb[DCB_TC_ATTR_PARAM_STRICT_PRIO] ||
443 param_tb[DCB_TC_ATTR_PARAM_ALL]) {
444 ret = nla_put_u8(dcbnl_skb,
445 DCB_TC_ATTR_PARAM_STRICT_PRIO, prio);
449 if (param_tb[DCB_TC_ATTR_PARAM_BW_PCT] ||
450 param_tb[DCB_TC_ATTR_PARAM_ALL]) {
451 ret = nla_put_u8(dcbnl_skb, DCB_TC_ATTR_PARAM_BW_PCT,
456 nla_nest_end(dcbnl_skb, param_nest);
459 if (pg_tb[DCB_PG_ATTR_BW_ID_ALL])
464 for (i = DCB_PG_ATTR_BW_ID_0; i <= DCB_PG_ATTR_BW_ID_7; i++) {
465 if (!getall && !pg_tb[i])
468 tc_pct = DCB_ATTR_VALUE_UNDEFINED;
472 netdev->dcbnl_ops->getpgbwgcfgrx(netdev,
473 i - DCB_PG_ATTR_BW_ID_0, &tc_pct);
476 netdev->dcbnl_ops->getpgbwgcfgtx(netdev,
477 i - DCB_PG_ATTR_BW_ID_0, &tc_pct);
479 ret = nla_put_u8(dcbnl_skb, i, tc_pct);
485 nla_nest_end(dcbnl_skb, pg_nest);
487 nlmsg_end(dcbnl_skb, nlh);
489 ret = rtnl_unicast(dcbnl_skb, &init_net, pid);
496 nla_nest_cancel(dcbnl_skb, param_nest);
498 nla_nest_cancel(dcbnl_skb, pg_nest);
507 static int dcbnl_pgtx_getcfg(struct net_device *netdev, struct nlattr **tb,
508 u32 pid, u32 seq, u16 flags)
510 return __dcbnl_pg_getcfg(netdev, tb, pid, seq, flags, 0);
513 static int dcbnl_pgrx_getcfg(struct net_device *netdev, struct nlattr **tb,
514 u32 pid, u32 seq, u16 flags)
516 return __dcbnl_pg_getcfg(netdev, tb, pid, seq, flags, 1);
519 static int dcbnl_setstate(struct net_device *netdev, struct nlattr **tb,
520 u32 pid, u32 seq, u16 flags)
525 if (!tb[DCB_ATTR_STATE] || !netdev->dcbnl_ops->setstate)
528 value = nla_get_u8(tb[DCB_ATTR_STATE]);
530 netdev->dcbnl_ops->setstate(netdev, value);
532 ret = dcbnl_reply(0, RTM_SETDCB, DCB_CMD_SSTATE, DCB_ATTR_STATE,
538 static int dcbnl_setpfccfg(struct net_device *netdev, struct nlattr **tb,
539 u32 pid, u32 seq, u16 flags)
541 struct nlattr *data[DCB_PFC_UP_ATTR_MAX + 1];
546 if (!tb[DCB_ATTR_PFC_CFG] || !netdev->dcbnl_ops->setpfccfg)
549 ret = nla_parse_nested(data, DCB_PFC_UP_ATTR_MAX,
550 tb[DCB_ATTR_PFC_CFG],
555 for (i = DCB_PFC_UP_ATTR_0; i <= DCB_PFC_UP_ATTR_7; i++) {
558 value = nla_get_u8(data[i]);
559 netdev->dcbnl_ops->setpfccfg(netdev,
560 data[i]->nla_type - DCB_PFC_UP_ATTR_0, value);
563 ret = dcbnl_reply(0, RTM_SETDCB, DCB_CMD_PFC_SCFG, DCB_ATTR_PFC_CFG,
569 static int dcbnl_setall(struct net_device *netdev, struct nlattr **tb,
570 u32 pid, u32 seq, u16 flags)
574 if (!tb[DCB_ATTR_SET_ALL] || !netdev->dcbnl_ops->setall)
577 ret = dcbnl_reply(netdev->dcbnl_ops->setall(netdev), RTM_SETDCB,
578 DCB_CMD_SET_ALL, DCB_ATTR_SET_ALL, pid, seq, flags);
583 static int __dcbnl_pg_setcfg(struct net_device *netdev, struct nlattr **tb,
584 u32 pid, u32 seq, u16 flags, int dir)
586 struct nlattr *pg_tb[DCB_PG_ATTR_MAX + 1];
587 struct nlattr *param_tb[DCB_TC_ATTR_PARAM_MAX + 1];
595 if (!tb[DCB_ATTR_PG_CFG] ||
596 !netdev->dcbnl_ops->setpgtccfgtx ||
597 !netdev->dcbnl_ops->setpgtccfgrx ||
598 !netdev->dcbnl_ops->setpgbwgcfgtx ||
599 !netdev->dcbnl_ops->setpgbwgcfgrx)
602 ret = nla_parse_nested(pg_tb, DCB_PG_ATTR_MAX,
603 tb[DCB_ATTR_PG_CFG], dcbnl_pg_nest);
607 for (i = DCB_PG_ATTR_TC_0; i <= DCB_PG_ATTR_TC_7; i++) {
611 ret = nla_parse_nested(param_tb, DCB_TC_ATTR_PARAM_MAX,
612 pg_tb[i], dcbnl_tc_param_nest);
616 pgid = DCB_ATTR_VALUE_UNDEFINED;
617 prio = DCB_ATTR_VALUE_UNDEFINED;
618 tc_pct = DCB_ATTR_VALUE_UNDEFINED;
619 up_map = DCB_ATTR_VALUE_UNDEFINED;
621 if (param_tb[DCB_TC_ATTR_PARAM_STRICT_PRIO])
623 nla_get_u8(param_tb[DCB_TC_ATTR_PARAM_STRICT_PRIO]);
625 if (param_tb[DCB_TC_ATTR_PARAM_PGID])
626 pgid = nla_get_u8(param_tb[DCB_TC_ATTR_PARAM_PGID]);
628 if (param_tb[DCB_TC_ATTR_PARAM_BW_PCT])
629 tc_pct = nla_get_u8(param_tb[DCB_TC_ATTR_PARAM_BW_PCT]);
631 if (param_tb[DCB_TC_ATTR_PARAM_UP_MAPPING])
633 nla_get_u8(param_tb[DCB_TC_ATTR_PARAM_UP_MAPPING]);
635 /* dir: Tx = 0, Rx = 1 */
638 netdev->dcbnl_ops->setpgtccfgrx(netdev,
639 i - DCB_PG_ATTR_TC_0,
640 prio, pgid, tc_pct, up_map);
643 netdev->dcbnl_ops->setpgtccfgtx(netdev,
644 i - DCB_PG_ATTR_TC_0,
645 prio, pgid, tc_pct, up_map);
649 for (i = DCB_PG_ATTR_BW_ID_0; i <= DCB_PG_ATTR_BW_ID_7; i++) {
653 tc_pct = nla_get_u8(pg_tb[i]);
655 /* dir: Tx = 0, Rx = 1 */
658 netdev->dcbnl_ops->setpgbwgcfgrx(netdev,
659 i - DCB_PG_ATTR_BW_ID_0, tc_pct);
662 netdev->dcbnl_ops->setpgbwgcfgtx(netdev,
663 i - DCB_PG_ATTR_BW_ID_0, tc_pct);
667 ret = dcbnl_reply(0, RTM_SETDCB,
668 (dir ? DCB_CMD_PGRX_SCFG : DCB_CMD_PGTX_SCFG),
669 DCB_ATTR_PG_CFG, pid, seq, flags);
675 static int dcbnl_pgtx_setcfg(struct net_device *netdev, struct nlattr **tb,
676 u32 pid, u32 seq, u16 flags)
678 return __dcbnl_pg_setcfg(netdev, tb, pid, seq, flags, 0);
681 static int dcbnl_pgrx_setcfg(struct net_device *netdev, struct nlattr **tb,
682 u32 pid, u32 seq, u16 flags)
684 return __dcbnl_pg_setcfg(netdev, tb, pid, seq, flags, 1);
687 static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
689 struct net *net = sock_net(skb->sk);
690 struct net_device *netdev;
691 struct dcbmsg *dcb = (struct dcbmsg *)NLMSG_DATA(nlh);
692 struct nlattr *tb[DCB_ATTR_MAX + 1];
693 u32 pid = skb ? NETLINK_CB(skb).pid : 0;
696 if (net != &init_net)
699 ret = nlmsg_parse(nlh, sizeof(*dcb), tb, DCB_ATTR_MAX,
704 if (!tb[DCB_ATTR_IFNAME])
707 netdev = dev_get_by_name(&init_net, nla_data(tb[DCB_ATTR_IFNAME]));
711 if (!netdev->dcbnl_ops)
716 ret = dcbnl_getstate(netdev, tb, pid, nlh->nlmsg_seq,
719 case DCB_CMD_PFC_GCFG:
720 ret = dcbnl_getpfccfg(netdev, tb, pid, nlh->nlmsg_seq,
723 case DCB_CMD_GPERM_HWADDR:
724 ret = dcbnl_getperm_hwaddr(netdev, tb, pid, nlh->nlmsg_seq,
727 case DCB_CMD_PGTX_GCFG:
728 ret = dcbnl_pgtx_getcfg(netdev, tb, pid, nlh->nlmsg_seq,
731 case DCB_CMD_PGRX_GCFG:
732 ret = dcbnl_pgrx_getcfg(netdev, tb, pid, nlh->nlmsg_seq,
736 ret = dcbnl_setstate(netdev, tb, pid, nlh->nlmsg_seq,
739 case DCB_CMD_PFC_SCFG:
740 ret = dcbnl_setpfccfg(netdev, tb, pid, nlh->nlmsg_seq,
744 case DCB_CMD_SET_ALL:
745 ret = dcbnl_setall(netdev, tb, pid, nlh->nlmsg_seq,
748 case DCB_CMD_PGTX_SCFG:
749 ret = dcbnl_pgtx_setcfg(netdev, tb, pid, nlh->nlmsg_seq,
752 case DCB_CMD_PGRX_SCFG:
753 ret = dcbnl_pgrx_setcfg(netdev, tb, pid, nlh->nlmsg_seq,
757 ret = dcbnl_getcap(netdev, tb, pid, nlh->nlmsg_seq,
770 static int __init dcbnl_init(void)
772 rtnl_register(PF_UNSPEC, RTM_GETDCB, dcb_doit, NULL);
773 rtnl_register(PF_UNSPEC, RTM_SETDCB, dcb_doit, NULL);
777 module_init(dcbnl_init);
779 static void __exit dcbnl_exit(void)
781 rtnl_unregister(PF_UNSPEC, RTM_GETDCB);
782 rtnl_unregister(PF_UNSPEC, RTM_SETDCB);
784 module_exit(dcbnl_exit);