diff options
author | Pravin B Shelar <pshelar@nicira.com> | 2012-03-09 12:57:48 -0800 |
---|---|---|
committer | Pravin B Shelar <pshelar@nicira.com> | 2012-03-09 12:57:48 -0800 |
commit | 90a6637d5e7f5f83e3370e05b3716a24fc093fc7 (patch) | |
tree | ef71dcb20ea2138590652ae5045645a989ca4d70 /lib/rtnetlink-link.c | |
parent | 4f925bd39b21c9d189af2cbfce8cc6287419d538 (diff) |
netdev-linux: Cache error code from mtu ioctl.
netdev linux devices uses mtu ioctl to get and set MTU for a device.
By caching error code from ioctl we can reduce number of ioctl calls
for device which is unregistered from system.
netdev notification is used to update mtu which saves get-mtu-ioctl.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Diffstat (limited to 'lib/rtnetlink-link.c')
-rw-r--r-- | lib/rtnetlink-link.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/rtnetlink-link.c b/lib/rtnetlink-link.c index 60b71be8..d14f0e3c 100644 --- a/lib/rtnetlink-link.c +++ b/lib/rtnetlink-link.c @@ -45,6 +45,7 @@ rtnetlink_link_parse(struct ofpbuf *buf, static const struct nl_policy policy[] = { [IFLA_IFNAME] = { .type = NL_A_STRING, .optional = false }, [IFLA_MASTER] = { .type = NL_A_U32, .optional = true }, + [IFLA_MTU] = { .type = NL_A_U32, .optional = true }, }; static struct nlattr *attrs[ARRAY_SIZE(policy)]; @@ -67,6 +68,10 @@ rtnetlink_link_parse(struct ofpbuf *buf, change->master_ifindex = (attrs[IFLA_MASTER] ? nl_attr_get_u32(attrs[IFLA_MASTER]) : 0); + change->mtu = (attrs[IFLA_MTU] + ? nl_attr_get_u32(attrs[IFLA_MTU]) + : 0); + } return parsed; |