Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp1456589rdb; Fri, 19 Jan 2024 23:02:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IGIWwP07AVGmKQhk+ntP3xpbGm+wOCqINMKNlwHW0APjDvISMmTbcGnspYwGlicJuleG6AV X-Received: by 2002:a17:907:c81a:b0:a2e:c311:c6fe with SMTP id ub26-20020a170907c81a00b00a2ec311c6femr1114792ejc.10.1705734161948; Fri, 19 Jan 2024 23:02:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705734161; cv=pass; d=google.com; s=arc-20160816; b=TMZlGQhMJR3PFdEMgCugQvZVNwdrhYEWMPxI/9DeiQLIpebapCVKBTsfVzep7BLjRY rL/LRHXFd5zKEX8B4fri/kWGBTNt3WunnJR96FPKVmII1s11aom3xg7E/n98syclJBN0 o5717GKTKS6H4QdHFK8GkBGFwTYZpkxlWvD6fzLT6x8X2/HliMiITOXS4+Hi5UZ9ONa9 Z+z4G3MViUZz0+yuG/dqRy5Le+6dWtCuTF1vyuhkafeI7OuBRVNflP+moT7VfFyC0FD5 dwfgjdGXRtoeX6f2U1C6bkotV1iHPKAE3utjKHBWDSqWkvGcTqFxeI7kh/GjwH4lCuOl Xdpw== ARC-Message-Signature: i=2; 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:message-id:date:subject:cc:to :from:dkim-signature; bh=18XLp0+EYYrAsuDVOy2pHg/nOe1su8/7QeJJlWWEvhU=; fh=+oBOR4isfNVC5RsY1n9IdfBYYf3l4zdr7B4tCYWE5t0=; b=qgJ9Mu8MJuiWaG7MOZ3Amyl10pXKDKnYA0JEY2s3lK4n0jjrKI3zVPizi6A+H/mh9b WHU3qGAXrjkNYdmeRavzhIyiOGc4rWfHz74Til21lumDqwtzZWDEIoPRMI7/LXXcqU7O 5igUu6Ar5S1VTrtQ3nKa24TpEw0xTSeoj1R5TC7QgU0yyhezyK29fLdSQEWoqduQLfEi wvVZmUksFW+IcMDr2RUHfE9p67Dkf37Z/t7+CknfPdPD7JOd0P+yPx7GSOIBXlSzfwzs jw1mq/LVXWMmPbNhbgcoCej3Z7AFqU1rLwhYp3Un5OBSehayELPLTt5vWvXCsiR5BlvL tq0Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=YiMuukR6; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-31727-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31727-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id fx26-20020a170906b75a00b00a2b98028584si8794712ejb.959.2024.01.19.23.02.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 23:02:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-31727-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=YiMuukR6; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-31727-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31727-linux.lists.archive=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 63F0B1F22C38 for ; Sat, 20 Jan 2024 07:02:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 99C1E3C10; Sat, 20 Jan 2024 07:02:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="YiMuukR6" Received: from smtp.smtpout.orange.fr (smtp-13.smtpout.orange.fr [80.12.242.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BF931FD6 for ; Sat, 20 Jan 2024 07:02:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705734147; cv=none; b=kozBreftmK9l+03TBlyJLgdHOS/dyfi4jzERzAThN9IBUzCOLmzaNELhoYbbiTZ+Hklks8OM72yenb3YoD3olN5nCdBO+vuSD5mC0AC6CS47tfoBDV7x6RSxP8tpFrvCGwGaQ5z/SkKetF+yydOcgRN+++DNJI+7ZJWkef2pzvI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705734147; c=relaxed/simple; bh=+raE6lOGseWsvkEpBBecN/MtD9iAHPDNgahekW3q5GU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=TtXx2OxAAawQjmVwPi6L8axoroMdJkangVuDDQ2txlrZCUFI9/bXZTVFF4PE2c4XaiGAoQZz35bzRgyYEJYk4jMOlQfs0fCBW9Fs5ReeQVxHrGC4UEnRgZp5BVYUFabmUYMLq8FZRpgmvN33Z6ZU8Dy4pSwqAFn4EwqGXHShPC0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=YiMuukR6; arc=none smtp.client-ip=80.12.242.13 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 fedora.home ([92.140.202.140]) by smtp.orange.fr with ESMTPA id R5N0rXUqwgeksR5N0rlBX4; Sat, 20 Jan 2024 08:02:24 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1705734144; bh=18XLp0+EYYrAsuDVOy2pHg/nOe1su8/7QeJJlWWEvhU=; h=From:To:Cc:Subject:Date; b=YiMuukR6dGihg1Gp7l16Aam7/wZ7d2LC+OC01I779DK7RYfMMrugmalINYjN/lSWH hNYAqPISCeG8kZRyNAJW46GlAf0LOHCXOmvuITWTFRyC4qwHl+EI1PCyqYDWhDB0RE WMX99n5JDI8qDZgYxYPWIzP9SpphFKt3Dlnf6afAmm9i1ltQoWjgaE+SjhjB8cQVnu 3h/rlrqEXkffCK3f3RWo4t34Ytk/qh07RQeDh6BOPaA43AYWKtlYvCFSkhxTcYCvEP QnBqFncfz+7iJ/RJ4NlLj9tEDNCyNdOYHE1ejbCOEOthmSwSzUahUVZc1axPngRjbh 2+8MFBNdLsdWQ== X-ME-Helo: fedora.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 20 Jan 2024 08:02:24 +0100 X-ME-IP: 92.140.202.140 From: Christophe JAILLET To: Alexei Starovoitov , Daniel Borkmann , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer , John Fastabend , Eric Dumazet , Paolo Abeni Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , netdev@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH net-next] xdp: Remove usage of the deprecated ida_simple_xx() API Date: Sat, 20 Jan 2024 08:02:20 +0100 Message-ID: <8e889d18a6c881b09db4650d4b30a62d76f4fe77.1705734073.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ida_alloc() and ida_free() should be preferred to the deprecated ida_simple_get() and ida_simple_remove(). Note that the upper limit of ida_simple_get() is exclusive, but the one of ida_alloc_range() is inclusive. So a -1 has been added when needed. Signed-off-by: Christophe JAILLET --- net/core/xdp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/core/xdp.c b/net/core/xdp.c index 4869c1c2d8f3..27b585f3fa81 100644 --- a/net/core/xdp.c +++ b/net/core/xdp.c @@ -75,7 +75,7 @@ static void __xdp_mem_allocator_rcu_free(struct rcu_head *rcu) xa = container_of(rcu, struct xdp_mem_allocator, rcu); /* Allow this ID to be reused */ - ida_simple_remove(&mem_id_pool, xa->mem.id); + ida_free(&mem_id_pool, xa->mem.id); kfree(xa); } @@ -242,7 +242,7 @@ static int __mem_id_cyclic_get(gfp_t gfp) int id; again: - id = ida_simple_get(&mem_id_pool, mem_id_next, MEM_ID_MAX, gfp); + id = ida_alloc_range(&mem_id_pool, mem_id_next, MEM_ID_MAX - 1, gfp); if (id < 0) { if (id == -ENOSPC) { /* Cyclic allocator, reset next id */ @@ -317,7 +317,7 @@ static struct xdp_mem_allocator *__xdp_reg_mem_model(struct xdp_mem_info *mem, /* Insert allocator into ID lookup table */ ptr = rhashtable_insert_slow(mem_id_ht, &id, &xdp_alloc->node); if (IS_ERR(ptr)) { - ida_simple_remove(&mem_id_pool, mem->id); + ida_free(&mem_id_pool, mem->id); mem->id = 0; errno = PTR_ERR(ptr); goto err; -- 2.43.0