From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ido Schimmel Subject: [PATCH net-next 06/16] vxlan: Allow changing ageing time Date: Wed, 21 Nov 2018 08:02:40 +0000 Message-ID: <20181121080141.16676-7-idosch@mellanox.com> References: <20181121080141.16676-1-idosch@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Cc: "davem@davemloft.net" , Jiri Pirko , Petr Machata , "roopa@cumulusnetworks.com" , "nikolay@cumulusnetworks.com" , "stephen@networkplumber.org" , "ivecera@redhat.com" , mlxsw , Ido Schimmel To: "netdev@vger.kernel.org" , "bridge@lists.linux-foundation.org" Return-path: Received: from mail-eopbgr20058.outbound.protection.outlook.com ([40.107.2.58]:26007 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728490AbeKUSgX (ORCPT ); Wed, 21 Nov 2018 13:36:23 -0500 In-Reply-To: <20181121080141.16676-1-idosch@mellanox.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: In a similar fashion to the bridge device, allow changing the ageing time of the VxLAN device by scheduling its timer to fire if the ageing time changed. One use case is selftests where learning / ageing of VxLAN FDB entries is tested. The default ageing time is 5 minutes, which is too long for a simple selftest. Signed-off-by: Ido Schimmel Reviewed-by: Petr Machata --- drivers/net/vxlan.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 03ba1b56ba6d..911066299a83 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -3458,11 +3458,8 @@ static int vxlan_nl2conf(struct nlattr *tb[], struct= nlattr *data[], conf->flags |=3D VXLAN_F_LEARN; } =20 - if (data[IFLA_VXLAN_AGEING]) { - if (changelink) - return -EOPNOTSUPP; + if (data[IFLA_VXLAN_AGEING]) conf->age_interval =3D nla_get_u32(data[IFLA_VXLAN_AGEING]); - } =20 if (data[IFLA_VXLAN_PROXY]) { if (changelink) @@ -3607,6 +3604,7 @@ static int vxlan_changelink(struct net_device *dev, s= truct nlattr *tb[], { struct vxlan_dev *vxlan =3D netdev_priv(dev); struct vxlan_rdst *dst =3D &vxlan->default_dst; + unsigned long old_age_interval; struct vxlan_rdst old_dst; struct vxlan_config conf; struct vxlan_fdb *f =3D NULL; @@ -3617,12 +3615,16 @@ static int vxlan_changelink(struct net_device *dev,= struct nlattr *tb[], if (err) return err; =20 + old_age_interval =3D vxlan->cfg.age_interval; memcpy(&old_dst, dst, sizeof(struct vxlan_rdst)); =20 err =3D vxlan_dev_configure(vxlan->net, dev, &conf, true, extack); if (err) return err; =20 + if (old_age_interval !=3D vxlan->cfg.age_interval) + mod_timer(&vxlan->age_timer, jiffies); + /* handle default dst entry */ if (!vxlan_addr_equal(&dst->remote_ip, &old_dst.remote_ip)) { spin_lock_bh(&vxlan->hash_lock); --=20 2.19.1