aboutsummaryrefslogtreecommitdiffstats
path: root/net/dcb
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2008-11-21 00:09:23 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-21 00:09:23 -0500
commit0eb3aa9bab20217fb42244ccdcb5bf8a002f504c (patch)
treeb7d5a846b674a4f26ce4c1aa3b90f72fe9ce83d0 /net/dcb
parent33dbabc4a7f7bd72313c73a3c199f31f3900336f (diff)
DCB: Add interface to query the state of PFC feature.
Adds a netlink interface for Data Center Bridging (DCB) to get and set the enable state of the Priority Flow Control (PFC) feature. Primarily, this is a way to turn off PFC in the driver while DCB remains enabled. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dcb')
-rw-r--r--net/dcb/dcbnl.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index 5ff7e3c0c172..758419c6f59b 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -62,6 +62,7 @@ static struct nla_policy dcbnl_rtnl_policy[DCB_ATTR_MAX + 1] = {
62 [DCB_ATTR_SET_ALL] = {.type = NLA_U8}, 62 [DCB_ATTR_SET_ALL] = {.type = NLA_U8},
63 [DCB_ATTR_PERM_HWADDR] = {.type = NLA_FLAG}, 63 [DCB_ATTR_PERM_HWADDR] = {.type = NLA_FLAG},
64 [DCB_ATTR_CAP] = {.type = NLA_NESTED}, 64 [DCB_ATTR_CAP] = {.type = NLA_NESTED},
65 [DCB_ATTR_PFC_STATE] = {.type = NLA_U8},
65}; 66};
66 67
67/* DCB priority flow control to User Priority nested attributes */ 68/* DCB priority flow control to User Priority nested attributes */
@@ -471,6 +472,40 @@ err:
471 return ret; 472 return ret;
472} 473}
473 474
475static int dcbnl_getpfcstate(struct net_device *netdev, struct nlattr **tb,
476 u32 pid, u32 seq, u16 flags)
477{
478 int ret = -EINVAL;
479
480 if (!netdev->dcbnl_ops->getpfcstate)
481 return ret;
482
483 ret = dcbnl_reply(netdev->dcbnl_ops->getpfcstate(netdev), RTM_GETDCB,
484 DCB_CMD_PFC_GSTATE, DCB_ATTR_PFC_STATE,
485 pid, seq, flags);
486
487 return ret;
488}
489
490static int dcbnl_setpfcstate(struct net_device *netdev, struct nlattr **tb,
491 u32 pid, u32 seq, u16 flags)
492{
493 int ret = -EINVAL;
494 u8 value;
495
496 if (!tb[DCB_ATTR_PFC_STATE] || !netdev->dcbnl_ops->setpfcstate)
497 return ret;
498
499 value = nla_get_u8(tb[DCB_ATTR_PFC_STATE]);
500
501 netdev->dcbnl_ops->setpfcstate(netdev, value);
502
503 ret = dcbnl_reply(0, RTM_SETDCB, DCB_CMD_PFC_SSTATE, DCB_ATTR_PFC_STATE,
504 pid, seq, flags);
505
506 return ret;
507}
508
474static int __dcbnl_pg_getcfg(struct net_device *netdev, struct nlattr **tb, 509static int __dcbnl_pg_getcfg(struct net_device *netdev, struct nlattr **tb,
475 u32 pid, u32 seq, u16 flags, int dir) 510 u32 pid, u32 seq, u16 flags, int dir)
476{ 511{
@@ -889,6 +924,14 @@ static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
889 ret = dcbnl_setnumtcs(netdev, tb, pid, nlh->nlmsg_seq, 924 ret = dcbnl_setnumtcs(netdev, tb, pid, nlh->nlmsg_seq,
890 nlh->nlmsg_flags); 925 nlh->nlmsg_flags);
891 goto out; 926 goto out;
927 case DCB_CMD_PFC_GSTATE:
928 ret = dcbnl_getpfcstate(netdev, tb, pid, nlh->nlmsg_seq,
929 nlh->nlmsg_flags);
930 goto out;
931 case DCB_CMD_PFC_SSTATE:
932 ret = dcbnl_setpfcstate(netdev, tb, pid, nlh->nlmsg_seq,
933 nlh->nlmsg_flags);
934 goto out;
892 default: 935 default:
893 goto errout; 936 goto errout;
894 } 937 }