* [RFC PATCH net-next] net: Include phys_port identifier in the RTM_NEWLINK message
@ 2013-06-28 15:34 Narendra_K
2013-07-01 20:14 ` Ben Hutchings
0 siblings, 1 reply; 2+ messages in thread
From: Narendra_K @ 2013-06-28 15:34 UTC (permalink / raw)
To: netdev; +Cc: bhutchings, john.r.fastabend
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 <narendra_k@dell.com>
---
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)
--
1.8.0.1
--
With regards,
Narendra K
Linux Engineering
Dell Inc.
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RFC PATCH net-next] net: Include phys_port identifier in the RTM_NEWLINK message
2013-06-28 15:34 [RFC PATCH net-next] net: Include phys_port identifier in the RTM_NEWLINK message Narendra_K
@ 2013-07-01 20:14 ` Ben Hutchings
0 siblings, 0 replies; 2+ messages in thread
From: Ben Hutchings @ 2013-07-01 20:14 UTC (permalink / raw)
To: Narendra_K; +Cc: netdev, john.r.fastabend
On Fri, 2013-06-28 at 21:04 +0530, Narendra_K@Dell.com wrote:
> 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 <narendra_k@dell.com>
Reviewed-by: Ben Hutchings <bhutchings@solarflare.com>
> ---
> 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)
> --
> 1.8.0.1
>
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-07-01 20:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-28 15:34 [RFC PATCH net-next] net: Include phys_port identifier in the RTM_NEWLINK message Narendra_K
2013-07-01 20:14 ` Ben Hutchings
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.