Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2396999ioo; Sat, 28 May 2022 12:19:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8t8TxYNHDX8QUA/3qfcTwo3YxvePUaTIn93WdCZv8aUjCIfup6OY0wcN2rGld0ihGmIVM X-Received: by 2002:a17:902:6b44:b0:154:4bee:c434 with SMTP id g4-20020a1709026b4400b001544beec434mr48743909plt.43.1653765582814; Sat, 28 May 2022 12:19:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653765582; cv=none; d=google.com; s=arc-20160816; b=Mc6gE0vxrsgfM19tSyu00HOcs0WqzpPdyNswImUaEPsT5dIqeRAyjGKR7hiLflGztQ f4XTpFVmakh2PmzP0TgqHpBj7IC46MtS67oezZpSnJxHxnEK9yR2yHxWFiW/qkUitz7X gN27pE3AI6jrgppVVa6rzMVuQDB83TybTYfLtYxZG18RjtNWSEyqjEv2ArQGakYY01Wi YQiZC0E67ck0TJpxjep0bNEDtfjt6FY0erWKmEcfchtKYi6WvPa8KMnwj7IwAf8WHdRH dbmeR/VDLSQ5bTgQkCwLuu+YbZunMljNH5l6iCyioY7qnXAGxD0JZRqPFoG7QLRJ4C9e b6lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=O7d6Y3IC0dS5ItrPuGagxr6IPtktSxsuH14jxTuCcyY=; b=MlA2q2i9D8Qt+hcR78yrXfSLFsWjAoHEZfW0v+w+bFuCctVLBBo1G8Af8Nbl9dvmSE sHc0Luev4i7BDUhM8BWdJMMg/8fcXx1GrNf1OidHPvXgGYfx5MUs2G+P4LMHSCImlD7J olfSt4RqeNnxJid69IfL9+9FR+k4vS/fvw8Lqs1923PsRx8FBVkYi+1v4zqNOU4sk0Ok xXPgEa8814JT3+eIp59FshCKFbZhvMWKgitStKk1u82r5Sk7PU0oI09kElyAkBddVGi3 aIfDwGqfYrRCM8NjDJHdP9Wxo/DZnh3KTBchcmXdFR/Qn4RgvlvxqyMOE8y4NuCxufHx Q+jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UJrJp2gL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id p19-20020a170902a41300b0015a91674899si9068816plq.279.2022.05.28.12.19.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 12:19:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UJrJp2gL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 92C673614D; Sat, 28 May 2022 11:52:05 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352833AbiE0RJA (ORCPT + 99 others); Fri, 27 May 2022 13:09:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238663AbiE0RI5 (ORCPT ); Fri, 27 May 2022 13:08:57 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A1E613F937; Fri, 27 May 2022 10:08:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653671337; x=1685207337; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=b3q39SUBMABRtjA5ofr43J/nm2AXC7Vx1cy/yv6Brqo=; b=UJrJp2gLfJNtqZsdcpdndTsaJBQKGBWQLmNM7bgDl9j/5L12vivzzx2R NiPfRdIP3PZadTsCeMOWlN88V8SqBS2qxzdgLIqdFQRzNK1LFKksiEDnp X/pSY6cwq5IYEdAYlYVIRv607o39qEROx4yC83rq3mUjrbjx4D2m+9ctH KJlHH9+BR8jMhhmtEUa7CTv9mAEfRmobbZOd1A08TaPYKN6JE+pm7C+od zG+SfGGYf2GqQ0rKztx6hBT+q6ykl8k+mGZ8D1cf2OC5s7hWrAoGcrvub 3Doe/oqKx+um7BzYDr36Qb4BkdQcDS0Akk2J6JkefMmTBnCMjvau7xh5/ A==; X-IronPort-AV: E=McAfee;i="6400,9594,10360"; a="254406396" X-IronPort-AV: E=Sophos;i="5.91,256,1647327600"; d="scan'208";a="254406396" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2022 10:08:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,256,1647327600"; d="scan'208";a="665547883" Received: from boxer.igk.intel.com (HELO boxer) ([10.102.20.173]) by FMSMGA003.fm.intel.com with ESMTP; 27 May 2022 10:08:53 -0700 Date: Fri, 27 May 2022 19:08:53 +0200 From: Maciej Fijalkowski To: keliu Cc: bjorn@kernel.org, magnus.karlsson@intel.com, jonathan.lemon@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: xdp: Directly use ida_alloc()/free() Message-ID: References: <20220527064609.2358482-1-liuke94@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220527064609.2358482-1-liuke94@huawei.com> X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 27, 2022 at 06:46:09AM +0000, keliu wrote: > Use ida_alloc()/ida_free() instead of deprecated > ida_simple_get()/ida_simple_remove() . > > Signed-off-by: keliu Reviewed-by: Maciej Fijalkowski For future AF_XDP related patches please specify the bpf-next tree in the patch subject (or bpf if it's a fix). Thanks! > --- > net/xdp/xdp_umem.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c > index f01ef6bda390..869b9b9b9fad 100644 > --- a/net/xdp/xdp_umem.c > +++ b/net/xdp/xdp_umem.c > @@ -57,7 +57,7 @@ static int xdp_umem_addr_map(struct xdp_umem *umem, struct page **pages, > static void xdp_umem_release(struct xdp_umem *umem) > { > umem->zc = false; > - ida_simple_remove(&umem_ida, umem->id); > + ida_free(&umem_ida, umem->id); > > xdp_umem_addr_unmap(umem); > xdp_umem_unpin_pages(umem); > @@ -242,7 +242,7 @@ struct xdp_umem *xdp_umem_create(struct xdp_umem_reg *mr) > if (!umem) > return ERR_PTR(-ENOMEM); > > - err = ida_simple_get(&umem_ida, 0, 0, GFP_KERNEL); > + err = ida_alloc(&umem_ida, GFP_KERNEL); > if (err < 0) { > kfree(umem); > return ERR_PTR(err); > @@ -251,7 +251,7 @@ struct xdp_umem *xdp_umem_create(struct xdp_umem_reg *mr) > > err = xdp_umem_reg(umem, mr); > if (err) { > - ida_simple_remove(&umem_ida, umem->id); > + ida_free(&umem_ida, umem->id); > kfree(umem); > return ERR_PTR(err); > } > -- > 2.25.1 >