* [PATCH next 2/3] ipvlan: mode is u16
@ 2016-02-02 19:20 Mahesh Bandewar
2016-02-07 19:19 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Mahesh Bandewar @ 2016-02-02 19:20 UTC (permalink / raw)
To: David Miller; +Cc: Mahesh Bandewar, Eric Dumazet, netdev
From: Mahesh Bandewar <maheshb@google.com>
The mode argument was erronusly defined as u32 but it has always
been u16.
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
drivers/net/ipvlan/ipvlan.h | 1 -
drivers/net/ipvlan/ipvlan_main.c | 9 ++++++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ipvlan/ipvlan.h b/drivers/net/ipvlan/ipvlan.h
index 9542b7bac61a..817cab1a7959 100644
--- a/drivers/net/ipvlan/ipvlan.h
+++ b/drivers/net/ipvlan/ipvlan.h
@@ -115,7 +115,6 @@ static inline struct ipvl_port *ipvlan_port_get_rtnl(const struct net_device *d)
}
void ipvlan_adjust_mtu(struct ipvl_dev *ipvlan, struct net_device *dev);
-void ipvlan_set_port_mode(struct ipvl_port *port, u32 nval);
void ipvlan_init_secret(void);
unsigned int ipvlan_mac_hash(const unsigned char *addr);
rx_handler_result_t ipvlan_handle_frame(struct sk_buff **pskb);
diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
index f94392d07126..54c542526262 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)
ipvlan->dev->mtu = dev->mtu - ipvlan->mtu_adj;
}
-void ipvlan_set_port_mode(struct ipvl_port *port, u32 nval)
+static void ipvlan_set_port_mode(struct ipvl_port *port, u16 nval)
{
struct ipvl_dev *ipvlan;
@@ -442,6 +442,7 @@ static int ipvlan_link_new(struct net *src_net, struct net_device *dev,
struct ipvl_port *port;
struct net_device *phy_dev;
int err;
+ u16 mode = IPVLAN_MODE_L3;
if (!tb[IFLA_LINK])
return -EINVAL;
@@ -460,10 +461,10 @@ static int ipvlan_link_new(struct net *src_net, struct net_device *dev,
return err;
}
- port = ipvlan_port_get_rtnl(phy_dev);
if (data && data[IFLA_IPVLAN_MODE])
- port->mode = nla_get_u16(data[IFLA_IPVLAN_MODE]);
+ mode = nla_get_u16(data[IFLA_IPVLAN_MODE]);
+ port = ipvlan_port_get_rtnl(phy_dev);
ipvlan->phy_dev = phy_dev;
ipvlan->dev = dev;
ipvlan->port = port;
@@ -488,6 +489,8 @@ static int ipvlan_link_new(struct net *src_net, struct net_device *dev,
goto ipvlan_destroy_port;
list_add_tail_rcu(&ipvlan->pnode, &port->ipvlans);
+ ipvlan_set_port_mode(port, mode);
+
netif_stacked_transfer_operstate(phy_dev, dev);
return 0;
--
2.7.0.rc3.207.g0ac5344
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH next 2/3] ipvlan: mode is u16
2016-02-02 19:20 [PATCH next 2/3] ipvlan: mode is u16 Mahesh Bandewar
@ 2016-02-07 19:19 ` David Miller
2016-02-08 22:14 ` Mahesh Bandewar
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2016-02-07 19:19 UTC (permalink / raw)
To: mahesh; +Cc: maheshb, edumazet, netdev
From: Mahesh Bandewar <mahesh@bandewar.net>
Date: Tue, 2 Feb 2016 11:20:30 -0800
> From: Mahesh Bandewar <maheshb@google.com>
>
> The mode argument was erronusly defined as u32 but it has always
> been u16.
>
> Signed-off-by: Mahesh Bandewar <maheshb@google.com>
This patch is changing more than this.
Specifically it is invoking ipvlan_set_port_mode() instead of assigning
port->mode directly in ipvlan_link_new().
That minimally needs to be documented in the commit log message.
But I also wonder if for some reason in this conect the direct
assignment happens to be fine. That's pretty much why you should
explain things.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH next 2/3] ipvlan: mode is u16
2016-02-07 19:19 ` David Miller
@ 2016-02-08 22:14 ` Mahesh Bandewar
0 siblings, 0 replies; 3+ messages in thread
From: Mahesh Bandewar @ 2016-02-08 22:14 UTC (permalink / raw)
To: David Miller; +Cc: mahesh, Eric Dumazet, linux-netdev
On Sun, Feb 7, 2016 at 11:19 AM, David Miller <davem@davemloft.net> wrote:
> From: Mahesh Bandewar <mahesh@bandewar.net>
> Date: Tue, 2 Feb 2016 11:20:30 -0800
>
>> From: Mahesh Bandewar <maheshb@google.com>
>>
>> The mode argument was erronusly defined as u32 but it has always
>> been u16.
>>
>> Signed-off-by: Mahesh Bandewar <maheshb@google.com>
>
> This patch is changing more than this.
>
> Specifically it is invoking ipvlan_set_port_mode() instead of assigning
> port->mode directly in ipvlan_link_new().
>
> That minimally needs to be documented in the commit log message.
>
> But I also wonder if for some reason in this conect the direct
> assignment happens to be fine. That's pretty much why you should
> explain things.
Directly assigning does serve the same purpose, however when there is
a helper to do just that (and other things in future) it would help
keep all related things at one place avoiding errors in future. Since
it's a minor improvement I did not mention that into the commit log.
I'll update the commit log and resend.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-02-08 22:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-02 19:20 [PATCH next 2/3] ipvlan: mode is u16 Mahesh Bandewar
2016-02-07 19:19 ` David Miller
2016-02-08 22:14 ` Mahesh Bandewar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).