netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next PATCH v2 1/7] dcb: Add DCBX capabilities bitmask to the get_ieee response
@ 2011-06-21 17:34 John Fastabend
  2011-06-21 17:34 ` [net-next PATCH v2 2/7] net: dcbnl, add multicast group for DCB John Fastabend
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: John Fastabend @ 2011-06-21 17:34 UTC (permalink / raw)
  To: davem; +Cc: netdev, shmulikr

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>
---

 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 ed1bb8c..3a6d97d 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);


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-06-21 17:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-21 17:34 [net-next PATCH v2 1/7] dcb: Add DCBX capabilities bitmask to the get_ieee response John Fastabend
2011-06-21 17:34 ` [net-next PATCH v2 2/7] net: dcbnl, add multicast group for DCB John Fastabend
2011-06-21 17:34 ` [net-next PATCH v2 3/7] dcb: Add ieee_dcb_setapp() to be used for IEEE 802.1Qaz APP data John Fastabend
2011-06-21 17:34 ` [net-next PATCH v2 4/7] dcb: Add ieee_dcb_delapp() and dcb op to delete app entry John Fastabend
2011-06-21 17:34 ` [net-next PATCH v2 5/7] dcb: Add dcb_ieee_getapp_mask() for drivers to query APP settings John Fastabend
2011-06-21 17:34 ` [net-next PATCH v2 6/7] dcb: fix return type on dcb_setapp() John Fastabend
2011-06-21 17:35 ` [net-next PATCH v2 7/7] dcb: Add missing error check in dcb_ieee_set() John Fastabend

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).