aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ipvlan/ipvlan_main.c
diff options
context:
space:
mode:
authorMahesh Bandewar <maheshb@google.com>2016-02-20 22:31:36 -0500
committerDavid S. Miller <davem@davemloft.net>2016-02-21 22:43:24 -0500
commite93fbc5a15ff25d4f9fd92a13c33cd37d99a2340 (patch)
tree2d73462f4aad15e2f939d4f97c3be43099c91125 /drivers/net/ipvlan/ipvlan_main.c
parentc3aaa06d5a63609641b7ad62ee0956f3de86c1cd (diff)
ipvlan: mode is u16
The mode argument was erronusly defined as u32 but it has always been u16. Also use ipvlan_set_mode() helper to set the mode instead of assigning directly. This should avoid future erronus assignments / updates. Signed-off-by: Mahesh Bandewar <maheshb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ipvlan/ipvlan_main.c')
-rw-r--r--drivers/net/ipvlan/ipvlan_main.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
index 7a3b41468a55..5bcb852c5500 100644
--- a/drivers/net/ipvlan/ipvlan_main.c
+++ b/drivers/net/ipvlan/ipvlan_main.c
@@ -14,7 +14,7 @@ void ipvlan_adjust_mtu(struct ipvl_dev *ipvlan, struct net_device *dev)
14 ipvlan->dev->mtu = dev->mtu - ipvlan->mtu_adj; 14 ipvlan->dev->mtu = dev->mtu - ipvlan->mtu_adj;
15} 15}
16 16
17void ipvlan_set_port_mode(struct ipvl_port *port, u32 nval) 17static void ipvlan_set_port_mode(struct ipvl_port *port, u16 nval)
18{ 18{
19 struct ipvl_dev *ipvlan; 19 struct ipvl_dev *ipvlan;
20 20
@@ -442,6 +442,7 @@ static int ipvlan_link_new(struct net *src_net, struct net_device *dev,
442 struct ipvl_port *port; 442 struct ipvl_port *port;
443 struct net_device *phy_dev; 443 struct net_device *phy_dev;
444 int err; 444 int err;
445 u16 mode = IPVLAN_MODE_L3;
445 446
446 if (!tb[IFLA_LINK]) 447 if (!tb[IFLA_LINK])
447 return -EINVAL; 448 return -EINVAL;
@@ -460,10 +461,10 @@ static int ipvlan_link_new(struct net *src_net, struct net_device *dev,
460 return err; 461 return err;
461 } 462 }
462 463
463 port = ipvlan_port_get_rtnl(phy_dev);
464 if (data && data[IFLA_IPVLAN_MODE]) 464 if (data && data[IFLA_IPVLAN_MODE])
465 port->mode = nla_get_u16(data[IFLA_IPVLAN_MODE]); 465 mode = nla_get_u16(data[IFLA_IPVLAN_MODE]);
466 466
467 port = ipvlan_port_get_rtnl(phy_dev);
467 ipvlan->phy_dev = phy_dev; 468 ipvlan->phy_dev = phy_dev;
468 ipvlan->dev = dev; 469 ipvlan->dev = dev;
469 ipvlan->port = port; 470 ipvlan->port = port;
@@ -489,6 +490,8 @@ static int ipvlan_link_new(struct net *src_net, struct net_device *dev,
489 goto ipvlan_destroy_port; 490 goto ipvlan_destroy_port;
490 491
491 list_add_tail_rcu(&ipvlan->pnode, &port->ipvlans); 492 list_add_tail_rcu(&ipvlan->pnode, &port->ipvlans);
493 ipvlan_set_port_mode(port, mode);
494
492 netif_stacked_transfer_operstate(phy_dev, dev); 495 netif_stacked_transfer_operstate(phy_dev, dev);
493 return 0; 496 return 0;
494 497