From patchwork Fri Jun 28 15:34:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Narendra K X-Patchwork-Id: 255435 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 4DF192C00A6 for ; Sat, 29 Jun 2013 01:36:10 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751773Ab3F1PgG (ORCPT ); Fri, 28 Jun 2013 11:36:06 -0400 Received: from ausxippc101.us.dell.com ([143.166.85.207]:1335 "EHLO ausxippc101.us.dell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750818Ab3F1PgF convert rfc822-to-8bit (ORCPT ); Fri, 28 Jun 2013 11:36:05 -0400 X-LoopCount0: from 10.175.216.249 X-IronPort-AV: E=Sophos;i="4.87,958,1363150800"; d="scan'208";a="177552032" From: To: CC: , Date: Fri, 28 Jun 2013 21:04:43 +0530 Subject: [RFC PATCH net-next] net: Include phys_port identifier in the RTM_NEWLINK message Thread-Topic: [RFC PATCH net-next] net: Include phys_port identifier in the RTM_NEWLINK message Thread-Index: Ac50FQrOm6oLmdPATz+zhUl3/P4AEw== Message-ID: <20130628153424.GA4340@fedora-17-guest.blr.amer.dell.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Mutt/1.5.21 (2010-09-15) acceptlanguage: en-US MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch adds a new netlink attribute 'IFLA_PHYS_PORT' to identify the 'phys_port' identifier and includes the 'phys_port' identifier in the RTM_NEWLINK message. Signed-off-by: Narendra K Reviewed-by: Ben Hutchings --- include/uapi/linux/if_link.h | 1 + net/core/rtnetlink.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h index 03f6170..6dc4476 100644 --- a/include/uapi/linux/if_link.h +++ b/include/uapi/linux/if_link.h @@ -143,6 +143,7 @@ enum { IFLA_NUM_TX_QUEUES, IFLA_NUM_RX_QUEUES, IFLA_CARRIER, + IFLA_PHYS_PORT, __IFLA_MAX }; diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 9007533..ade66a3 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -751,6 +751,7 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev, + nla_total_size(sizeof(struct rtnl_link_stats64)) + nla_total_size(MAX_ADDR_LEN) /* IFLA_ADDRESS */ + nla_total_size(MAX_ADDR_LEN) /* IFLA_BROADCAST */ + + nla_total_size(MAX_ADDR_LEN) /* IFLA_PHYS_PORT */ + nla_total_size(4) /* IFLA_TXQLEN */ + nla_total_size(4) /* IFLA_WEIGHT */ + nla_total_size(4) /* IFLA_MTU */ @@ -913,6 +914,12 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev, goto nla_put_failure; } + if (dev->phys_port.port_id_len) { + if (nla_put(skb, IFLA_PHYS_PORT, dev->phys_port.port_id_len, + dev->phys_port.port_id)) + goto nla_put_failure; + } + attr = nla_reserve(skb, IFLA_STATS, sizeof(struct rtnl_link_stats)); if (attr == NULL)