From patchwork Fri Jun 17 21:16:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Fastabend X-Patchwork-Id: 100864 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 62FECB6FD3 for ; Sat, 18 Jun 2011 07:23:03 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757492Ab1FQVWz (ORCPT ); Fri, 17 Jun 2011 17:22:55 -0400 Received: from mga11.intel.com ([192.55.52.93]:16974 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755629Ab1FQVWx (ORCPT ); Fri, 17 Jun 2011 17:22:53 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 17 Jun 2011 14:22:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.65,383,1304319600"; d="scan'208";a="19622819" Received: from unknown (HELO [127.0.0.1]) ([10.23.22.68]) by fmsmga001.fm.intel.com with ESMTP; 17 Jun 2011 14:22:45 -0700 From: John Fastabend Subject: [PATCH 1/7] dcb: Add DCBX capabilities bitmask to the get_ieee response To: davem@davemloft.net Cc: netdev@vger.kernel.org, shmulikr@broadcom.com Date: Fri, 17 Jun 2011 14:16:13 -0700 Message-ID: <20110617211613.26578.63959.stgit@jf-dev1-dcblab> In-Reply-To: <20110617211027.26578.11317.stgit@jf-dev1-dcblab> References: <20110617211027.26578.11317.stgit@jf-dev1-dcblab> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- net/dcb/dcbnl.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);