diff options
author | John Fastabend <john.r.fastabend@intel.com> | 2011-06-21 03:34:31 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-06-21 19:06:11 -0400 |
commit | c7797baf9f3900996ca800ab6298f95957bb4606 (patch) | |
tree | 62da7aa3eff5fc13792ce32d8405a24ec8ad1eaf /net/dcb/dcbnl.c | |
parent | f4b5ad26bcb983c493e131ff34b2fa60100c82e5 (diff) |
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.c | 12 |
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, | |||
1288 | struct nlattr *ieee, *app; | 1288 | struct nlattr *ieee, *app; |
1289 | struct dcb_app_type *itr; | 1289 | struct dcb_app_type *itr; |
1290 | const struct dcbnl_rtnl_ops *ops = netdev->dcbnl_ops; | 1290 | const struct dcbnl_rtnl_ops *ops = netdev->dcbnl_ops; |
1291 | int dcbx; | ||
1291 | int err; | 1292 | int err; |
1292 | 1293 | ||
1293 | if (!ops) | 1294 | if (!ops) |
@@ -1338,6 +1339,12 @@ static int dcbnl_ieee_get(struct net_device *netdev, struct nlattr **tb, | |||
1338 | } | 1339 | } |
1339 | } | 1340 | } |
1340 | } | 1341 | } |
1342 | |||
1343 | if (netdev->dcbnl_ops->getdcbx) | ||
1344 | dcbx = netdev->dcbnl_ops->getdcbx(netdev); | ||
1345 | else | ||
1346 | dcbx = -EOPNOTSUPP; | ||
1347 | |||
1341 | spin_unlock(&dcb_lock); | 1348 | spin_unlock(&dcb_lock); |
1342 | nla_nest_end(skb, app); | 1349 | nla_nest_end(skb, app); |
1343 | 1350 | ||
@@ -1366,6 +1373,11 @@ static int dcbnl_ieee_get(struct net_device *netdev, struct nlattr **tb, | |||
1366 | } | 1373 | } |
1367 | 1374 | ||
1368 | nla_nest_end(skb, ieee); | 1375 | nla_nest_end(skb, ieee); |
1376 | if (dcbx >= 0) { | ||
1377 | err = nla_put_u8(skb, DCB_ATTR_DCBX, dcbx); | ||
1378 | if (err) | ||
1379 | goto nla_put_failure; | ||
1380 | } | ||
1369 | nlmsg_end(skb, nlh); | 1381 | nlmsg_end(skb, nlh); |
1370 | 1382 | ||
1371 | return rtnl_unicast(skb, &init_net, pid); | 1383 | return rtnl_unicast(skb, &init_net, pid); |