Skip to content

Commit

Permalink
dcb: Add DCBX capabilities bitmask to the get_ieee response
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
John Fastabend authored and davem330 committed Jun 21, 2011
1 parent f4b5ad2 commit c7797ba
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions net/dcb/dcbnl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit c7797ba

Please sign in to comment.