From patchwork Wed Jan 16 23:06:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 1026265 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="ldgJ+qIZ"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43g2sC6knWz9sBQ for ; Thu, 17 Jan 2019 10:06:55 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388069AbfAPXGz (ORCPT ); Wed, 16 Jan 2019 18:06:55 -0500 Received: from mail-eopbgr00050.outbound.protection.outlook.com ([40.107.0.50]:53954 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731049AbfAPXGy (ORCPT ); Wed, 16 Jan 2019 18:06:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0ZrX+V74WFOXK0zfb38hqi2FjHZ9WFXwuQ+8CHZcdrk=; b=ldgJ+qIZHTtsalfxDAcgSt1bvzUaK7Uo3CrQTFnX61PuS7sdm2zW4f/wdF17IUPikRXtVlLuzQQj4RN/iqKnYH1Q8BvasjQYhV88N9PipMe3fS5GmOMIXrQEQZ3CbTPiX7fHxhLbPydSfXfTK0AVXQtQ/EKT6CV1yBBw7Pod8wY= Received: from DB3PR0502MB3946.eurprd05.prod.outlook.com (52.134.71.23) by DB3PR0502MB4058.eurprd05.prod.outlook.com (52.134.68.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1537.26; Wed, 16 Jan 2019 23:06:41 +0000 Received: from DB3PR0502MB3946.eurprd05.prod.outlook.com ([fe80::14e8:d98f:3ec2:3981]) by DB3PR0502MB3946.eurprd05.prod.outlook.com ([fe80::14e8:d98f:3ec2:3981%2]) with mapi id 15.20.1516.019; Wed, 16 Jan 2019 23:06:41 +0000 From: Petr Machata To: "netdev@vger.kernel.org" CC: "ivecera@redhat.com" , Jiri Pirko , Ido Schimmel , "davem@davemloft.net" Subject: [PATCH net-next 06/13] vxlan: changelink: Postpone vxlan_config_apply() Thread-Topic: [PATCH net-next 06/13] vxlan: changelink: Postpone vxlan_config_apply() Thread-Index: AQHUrfAkXxKoW3XKmUygGQaTT8LW/w== Date: Wed, 16 Jan 2019 23:06:41 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM5P190CA0035.EURP190.PROD.OUTLOOK.COM (2603:10a6:206:14::48) To DB3PR0502MB3946.eurprd05.prod.outlook.com (2603:10a6:8:e::23) authentication-results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [78.45.160.211] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB3PR0502MB4058; 6:K10m6KEz/a00h+u64pcdmLcGKXeJs/ZhLgdlHPBS+zK6TUT0gsczNORu3r+q5S8sbpgp61s35qGkHSSbL8oVep0cuVwpchrhdbcDLhad1pkxuAAbLuqh60sWmbhShbTkmaET/odDM/G5Fr2AaALIr/phTZp8qR+yiyJhMMmzk0NW3WXaA0GtT5jGZegVBCTQQ7VrBVaBo3ChRwTXzFgPs3MkCzTchFPeRkaamH4EankUbud9H+I5f2CTYmn1+XIGRNX3+IFaFy77AbsxXLrdOrAYYisrv6Mll8GTiAgoBBDdD5bmQEc6TyIlgUNLCap1Beua4sjuUPP/DCG4WZmuVC6ccczoqX9xfc2XHRJSoXoeZozM8XEqhbwfmfz8DULu3UG9cndQlTfMOdhNwMRmVtiai9qd4jdUDfh6QdFC2h4to4Uw9dXlZDufjQi9KDixYjZ1QYXcstB13tFqW+YXCw==; 5:PrTCgixYNNDEBTXjl+tMad+xmeVDP77TWNNK9sAiZnnj4g5bXCw0fyeKSoWRSq1EDHqO58GOW74W6dcpmeZD9obWaeFh/wHEV+hB+eGnDF+X3ERzOXzwG8wg1HeTM6T6oJi7NA6dfF11xr5B2j9MFUwU8OPIyzmC5KfOFyJ1rlET1vbY3V9F7H1iWq8G274f3n0WnQXlrY1JSyvc1yInFA==; 7:WOYMOZGftomeVSOn6fziHyLwgirUhQNDVtaf+yWElEmClF2at9uXA+5TTEf8HS8ptNbtEsOzuauOqn4n6w7RmRnp/6X9+pUz7WLgM/RmsKudkW7JbDCjSZ7NHNL0wZG+XEkBY+6eWGv7S7iP0NyY3g== x-ms-office365-filtering-correlation-id: 96a5a48a-b9a2-4c5a-4e57-08d67c0746e1 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB3PR0502MB4058; x-ms-traffictypediagnostic: DB3PR0502MB4058: x-microsoft-antispam-prvs: x-forefront-prvs: 091949432C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(136003)(366004)(396003)(376002)(346002)(189003)(199004)(71200400001)(106356001)(71190400001)(105586002)(118296001)(81166006)(2351001)(1730700003)(7736002)(14444005)(256004)(5660300001)(6436002)(8936002)(305945005)(6916009)(478600001)(14454004)(5640700003)(81156014)(8676002)(53936002)(68736007)(36756003)(6512007)(99286004)(186003)(52116002)(6506007)(6116002)(3846002)(486006)(76176011)(66066001)(2906002)(6486002)(25786009)(26005)(54906003)(446003)(316002)(476003)(2616005)(11346002)(386003)(97736004)(4326008)(2501003)(86362001)(102836004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB4058; H:DB3PR0502MB3946.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: yHNmc+f/JoIV34PKnoXvE5c7jTslCTWWno+dC6xhuewqw85g5jLo3uhBL6H4/Q9EyeC1I4qjew2Wqnjf51A88FD34RqPmim/AWmT680vmBle8wljauYEC/lDMapb+kkNuTMZNQmr9sxcuY4koBruz/BwzalpSoEpbm6LUPs2OaH+f7jc3sO/45Oo6WJp0wlwRgYRXEA0rsNWQm+fDTFe7ihxXNk99PXRutqi5TE+a+ZzSNNo9XvVt3IWM50mziGCfL1F68uBw5Urq4Ybyf7RX8FC+6FN8AZE055cVPl6SJGURqZN7lqA/p/ZSn21HohrfcU1eh8ItzIFTkVXRrBZLkpGbA4ILR6iMjOC/1DYHQsB8Vn2ywiCFyI3EsEXf/Yi+jRP7kGNtyCRvjB9xWTsLrM3W+PycNU5pFrA2JnhrTo= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 96a5a48a-b9a2-4c5a-4e57-08d67c0746e1 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Jan 2019 23:06:41.1797 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB4058 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When an FDB entry is vetoed, it is necessary to unroll the changes that have already been done. To avoid having to unroll vxlan_config_apply(), postpone the call after the point where the vetoing takes place. Since the call can't fail, it doesn't necessitate any cleanups in the preceding FDB update logic. Correspondingly, move down the mod_timer() call as well. References to *dst need to be replaced with references to conf. Additionally, old_dst and old_age_interval are not necessary anymore, and therefore drop them. Signed-off-by: Petr Machata --- drivers/net/vxlan.c | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index f2f419c60dfe..51e10f47d4f1 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -3792,9 +3792,7 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[], { struct vxlan_dev *vxlan = netdev_priv(dev); struct vxlan_rdst *dst = &vxlan->default_dst; - unsigned long old_age_interval; struct net_device *lowerdev; - struct vxlan_rdst old_dst; struct vxlan_config conf; int err; @@ -3803,40 +3801,31 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[], if (err) return err; - old_age_interval = vxlan->cfg.age_interval; - memcpy(&old_dst, dst, sizeof(struct vxlan_rdst)); - err = vxlan_config_validate(vxlan->net, &conf, &lowerdev, vxlan, extack); if (err) return err; - vxlan_config_apply(dev, &conf, lowerdev, vxlan->net, true); - - if (old_age_interval != 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)) { + if (!vxlan_addr_equal(&conf.remote_ip, &dst->remote_ip)) { spin_lock_bh(&vxlan->hash_lock); - if (!vxlan_addr_any(&old_dst.remote_ip)) + if (!vxlan_addr_any(&dst->remote_ip)) __vxlan_fdb_delete(vxlan, all_zeros_mac, - old_dst.remote_ip, + dst->remote_ip, vxlan->cfg.dst_port, - old_dst.remote_vni, - old_dst.remote_vni, - old_dst.remote_ifindex, + dst->remote_vni, + dst->remote_vni, + dst->remote_ifindex, true); - if (!vxlan_addr_any(&dst->remote_ip)) { + if (!vxlan_addr_any(&conf.remote_ip)) { err = vxlan_fdb_update(vxlan, all_zeros_mac, - &dst->remote_ip, + &conf.remote_ip, NUD_REACHABLE | NUD_PERMANENT, NLM_F_APPEND | NLM_F_CREATE, vxlan->cfg.dst_port, - dst->remote_vni, - dst->remote_vni, - dst->remote_ifindex, + conf.vni, conf.vni, + conf.remote_ifindex, NTF_SELF, true); if (err) { spin_unlock_bh(&vxlan->hash_lock); @@ -3846,6 +3835,10 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[], spin_unlock_bh(&vxlan->hash_lock); } + if (conf.age_interval != vxlan->cfg.age_interval) + mod_timer(&vxlan->age_timer, jiffies); + + vxlan_config_apply(dev, &conf, lowerdev, vxlan->net, true); return 0; }