From patchwork Fri Jan 5 09:27:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 185319 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp6115841dyb; Fri, 5 Jan 2024 01:36:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IENdo0Ut1qjfizi0QgQBrNwX0myxstjWhwNNT5oo5LZVOXfBo2WBUb0K10+Vw6S2DqecoSy X-Received: by 2002:a05:6358:99a8:b0:175:4915:5388 with SMTP id j40-20020a05635899a800b0017549155388mr1986110rwb.10.1704447404986; Fri, 05 Jan 2024 01:36:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704447404; cv=none; d=google.com; s=arc-20160816; b=lFlCt66Z6howU8Int0cIvPHBKKJqBGro0AeTxQQdu6zCKPHl3BzDzHfC7ytU3v/Bj6 2+J8Phio138VCYEuNJj5eA6vx4HgD+/uIxjOLXdYKOBGL7oylgyyC4aqenEKZENsoX2p +utGWhpkeZ3NaMXvvEwQ92OWNAyk0pMG6NUe+6ap6uETVWebxPGSrRk4b1DIE+xG5Iik 6nlHNWjkPa35mrpCoZcTu1naCz23yJ7EXJLI5+9CXdp6Va7BLfSazUUYHNUDjJua9/5y VM6KPJdBv9V05ATRF/yMInsUa4D/BnyFw1gTRjWWzZumPHVXGpkVGhX5RgDXWdC4fk3H MKxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=UNWAgG72CqrXdtBAJ+FNWG2kto2YDA/1pTgcQwka+VI=; fh=YSolgoSzsYPgPUg9lCWzHsn6whBmzo6aMpaqCeqBTLc=; b=G9b/5u9qwBbMpg+7ZzLkP41mr21UDSDH9MgOubwm8xR1FRJkMCB2QOHWqQIPzu4l9v 3p0z3gMOZgoS6d/2v6tJtPAZnnIS/fEAQpioBQP+HuVd8QcGHwcoepmx2/MLt5j6LS2n 0we0yB8KNO1VBrqQzJk4wSzGbPRy+f1B1pj0LzHRVrUJpICMNT6Y8IJ+y8VkjcDAkBRd T5ls+ZS6gq/Ayu0GN6/CGNYy9PdK5J5wSii9HQXZyBXi04bY2gZIq/fhPOjWchsFeE+c b3v8aATfNWfx8UwU0AgSKe56HWwiGoduheJ8s/xnnk0gE3PVpmeyO6MU9uN08kGyk8jN wRlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=lKkhwhSr; spf=pass (google.com: domain of linux-kernel+bounces-17664-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17664-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id i186-20020a6387c3000000b005ce0166ee12si981650pge.661.2024.01.05.01.36.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 01:36:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17664-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=lKkhwhSr; spf=pass (google.com: domain of linux-kernel+bounces-17664-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17664-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4A945B2486C for ; Fri, 5 Jan 2024 09:35:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0537725116; Fri, 5 Jan 2024 09:35:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="lKkhwhSr" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.smtpout.orange.fr (smtp-25.smtpout.orange.fr [80.12.242.25]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 18E3224B42 for ; Fri, 5 Jan 2024 09:35:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Received: from pop-os.home ([92.140.202.140]) by smtp.orange.fr with ESMTPA id LgU0rtez5ELO0LgU7rh96e; Fri, 05 Jan 2024 10:27:24 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1704446844; bh=UNWAgG72CqrXdtBAJ+FNWG2kto2YDA/1pTgcQwka+VI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=lKkhwhSrDn69hiAMrqfNEGcDBu+hjcHBHvmLgWlD3XhybkD2TMKxjZOhx8vwjYLZO KDJsTMbzRhDehOQqn39m8kwvPbqjK4bAhGGNANlnYVWHtkDRx9hu4GPhZeDHKF1xw/ crY25q3MEt/XE5hn+HAVlT3reY4kPHVdl728AWoOKhFJm57SM+32cYJE7OUL5fIGmj aJlbDtv5Q43A5M2o8E86BjYRi6mz2hfZsdlDsScOFwUqWvqzTaes8O0gx6kRsRVDvt j7cV16p93jr4MN4/S0dEDaI/2RWOX7t+0sBoTtLCkJiuYAEXnIylA5NUn0EqPsx4de D40rup6OL6oyQ== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 05 Jan 2024 10:27:24 +0100 X-ME-IP: 92.140.202.140 From: Christophe JAILLET To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: alexis.lothore@bootlin.com, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , netdev@vger.kernel.org Subject: [PATCH 2/2 net-next] ipvlan: Remove usage of the deprecated ida_simple_xx() API Date: Fri, 5 Jan 2024 10:27:09 +0100 Message-Id: <216fe71e690580aede0d3def17b767d9559edd3a.1704446747.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 In-Reply-To: <5adda8a3ce7af63bc980ba6b4b3fbfd6344e336b.1704446747.git.christophe.jaillet@wanadoo.fr> References: <5adda8a3ce7af63bc980ba6b4b3fbfd6344e336b.1704446747.git.christophe.jaillet@wanadoo.fr> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787242641759186271 X-GMAIL-MSGID: 1787242641759186271 ida_alloc() and ida_free() should be preferred to the deprecated ida_simple_get() and ida_simple_remove(). This is less verbose. Note that the upper bound of ida_alloc_range() is inclusive while the one of ida_simple_get() was exclusive. So calls have been updated accordingly. Signed-off-by: Christophe JAILLET Reviewed-by: Simon Horman --- drivers/net/ipvlan/ipvlan_main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c index e080e4fc41e4..df7c43a109e1 100644 --- a/drivers/net/ipvlan/ipvlan_main.c +++ b/drivers/net/ipvlan/ipvlan_main.c @@ -605,11 +605,11 @@ int ipvlan_link_new(struct net *src_net, struct net_device *dev, * Assign IDs between 0x1 and 0xFFFE (used by the master) to each * slave link [see addrconf_ifid_eui48()]. */ - err = ida_simple_get(&port->ida, port->dev_id_start, 0xFFFE, - GFP_KERNEL); + err = ida_alloc_range(&port->ida, port->dev_id_start, 0xFFFD, + GFP_KERNEL); if (err < 0) - err = ida_simple_get(&port->ida, 0x1, port->dev_id_start, - GFP_KERNEL); + err = ida_alloc_range(&port->ida, 0x1, port->dev_id_start - 1, + GFP_KERNEL); if (err < 0) goto unregister_netdev; dev->dev_id = err; @@ -641,7 +641,7 @@ int ipvlan_link_new(struct net *src_net, struct net_device *dev, unlink_netdev: netdev_upper_dev_unlink(phy_dev, dev); remove_ida: - ida_simple_remove(&port->ida, dev->dev_id); + ida_free(&port->ida, dev->dev_id); unregister_netdev: unregister_netdevice(dev); return err; @@ -661,7 +661,7 @@ void ipvlan_link_delete(struct net_device *dev, struct list_head *head) } spin_unlock_bh(&ipvlan->addrs_lock); - ida_simple_remove(&ipvlan->port->ida, dev->dev_id); + ida_free(&ipvlan->port->ida, dev->dev_id); list_del_rcu(&ipvlan->pnode); unregister_netdevice_queue(dev, head); netdev_upper_dev_unlink(ipvlan->phy_dev, dev);