summaryrefslogtreecommitdiffstats
path: root/net/dcb/dcbnl.c
diff options
context:
space:
mode:
authorJohn Fastabend <john.r.fastabend@intel.com>2011-06-21 07:34:31 +0000
committerDavid S. Miller <davem@davemloft.net>2011-06-21 16:06:11 -0700
commitc7797baf9f3900996ca800ab6298f95957bb4606 (patch)
tree62da7aa3eff5fc13792ce32d8405a24ec8ad1eaf /net/dcb/dcbnl.c
parentf4b5ad26bcb983c493e131ff34b2fa60100c82e5 (diff)
downloadblackbird-op-linux-c7797baf9f3900996ca800ab6298f95957bb4606.tar.gz
blackbird-op-linux-c7797baf9f3900996ca800ab6298f95957bb4606.zip
dcb: Add DCBX capabilities bitmask to the get_ieee response
Adding the capabilities bitmask to the get_ieee response allows user space to determine the current DCBX mode. Either CEE or IEEE this is useful with devices that support switching between modes where knowing the current state is relevant. Derived from work by Mark Rustad Signed-off-by: John Fastabend <john.r.fastabend@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dcb/dcbnl.c')
-rw-r--r--net/dcb/dcbnl.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index ed1bb8c65a9e..3a6d97d5280c 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -1288,6 +1288,7 @@ static int dcbnl_ieee_get(struct net_device *netdev, struct nlattr **tb,
struct nlattr *ieee, *app;
struct dcb_app_type *itr;
const struct dcbnl_rtnl_ops *ops = netdev->dcbnl_ops;
+ int dcbx;
int err;
if (!ops)
@@ -1338,6 +1339,12 @@ static int dcbnl_ieee_get(struct net_device *netdev, struct nlattr **tb,
}
}
}
+
+ if (netdev->dcbnl_ops->getdcbx)
+ dcbx = netdev->dcbnl_ops->getdcbx(netdev);
+ else
+ dcbx = -EOPNOTSUPP;
+
spin_unlock(&dcb_lock);
nla_nest_end(skb, app);
@@ -1366,6 +1373,11 @@ static int dcbnl_ieee_get(struct net_device *netdev, struct nlattr **tb,
}
nla_nest_end(skb, ieee);
+ if (dcbx >= 0) {
+ err = nla_put_u8(skb, DCB_ATTR_DCBX, dcbx);
+ if (err)
+ goto nla_put_failure;
+ }
nlmsg_end(skb, nlh);
return rtnl_unicast(skb, &init_net, pid);
OpenPOWER on IntegriCloud