From patchwork Mon Sep 11 15:45:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13379451 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 106FA11C82; Mon, 11 Sep 2023 15:46:50 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7589121; Mon, 11 Sep 2023 08:46:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694447209; x=1725983209; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=YjRdALQo6iO1ekUDe9KTiN6+J4DKc5QGUKKvZdLZ6Fg=; b=VAr+T+so/Ib372/Lo/cbODLMrlrsOOZIWmD/6i3NY7rxEfSsSEd2NXPR CbikkgO3cVOXypVi9uwt69jsrYnlsjVzzI+F3JAclB02bl+yalcrMD2MW xjiwnA9bRaAtmsmH2BHFmw5XVoNotob0GWN7X7XjdISgcbHKshbMPuFhL LKVg5lqWg3scpX5YwLCqdMGf9zvgVbi/pSIWk9W7+Cdqa5w0Wo2uymize By+Oz7BYtSsmievYibH7OyqVDGbYwkf4iY8MUM3w0598q+3/o5JZA0U5W RY0CILn3UbB4Kg+1iOu3Too5cBTRbe1VJjq5nPt7xUy6if+c+BtZ/9d9a g==; X-IronPort-AV: E=McAfee;i="6600,9927,10830"; a="358412451" X-IronPort-AV: E=Sophos;i="6.02,244,1688454000"; d="scan'208";a="358412451" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2023 08:45:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10830"; a="990123595" X-IronPort-AV: E=Sophos;i="6.02,244,1688454000"; d="scan'208";a="990123595" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga006.fm.intel.com with ESMTP; 11 Sep 2023 08:45:36 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 39E8213F; Mon, 11 Sep 2023 18:45:35 +0300 (EEST) From: Andy Shevchenko To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andy Shevchenko , Sergey Ryazanov Subject: [PATCH net-next v1 1/2] net: core: Use the bitmap API to allocate bitmaps Date: Mon, 11 Sep 2023 18:45:33 +0300 Message-Id: <20230911154534.4174265-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Use bitmap_zalloc() and bitmap_free() instead of hand-writing them. It is less verbose and it improves the type checking and semantic. While at it, add missing header inclusion (should be bitops.h, but with the above change it becomes bitmap.h). Suggested-by: Sergey Ryazanov Signed-off-by: Andy Shevchenko Reviewed-by: Simon Horman --- net/core/dev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index ccff2b6ef958..85df22f05c38 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -69,7 +69,7 @@ */ #include -#include +#include #include #include #include @@ -1080,7 +1080,7 @@ static int __dev_alloc_name(struct net *net, const char *name, char *buf) return -EINVAL; /* Use one page as a bit array of possible slots */ - inuse = (unsigned long *) get_zeroed_page(GFP_ATOMIC); + inuse = bitmap_zalloc(max_netdevices, GFP_ATOMIC); if (!inuse) return -ENOMEM; @@ -1109,7 +1109,7 @@ static int __dev_alloc_name(struct net *net, const char *name, char *buf) } i = find_first_zero_bit(inuse, max_netdevices); - free_page((unsigned long) inuse); + bitmap_free(inuse); } snprintf(buf, IFNAMSIZ, name, i); From patchwork Mon Sep 11 15:45:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13379450 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E52D1F51E; Mon, 11 Sep 2023 15:46:09 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 371C9FB; Mon, 11 Sep 2023 08:46:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694447168; x=1725983168; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EGZf1+DVn+gyziuqfigDtm3H2lqewI5JtUnRehH1Sco=; b=AkFbVm+J18qg7N9laCG+ojqAJcic/iItPCXhCoq+5Qi0+sGGUrx9Uc/G iytz3AzMU+yjO/Qla/AFmv7sfilboc8AiCM5hZ28/S8pKOnjhIcwIrUzt QeGwCwbUF4BWe9h9AhoCyKDTcC9IPGxyFIg32T/cXR9urm6ITQL+zOMsG qY91Rq1TjAGF6fy9qar+w9Lo94pzswV12P4JJkPoj1MfAtp5/QkPPydBT C58JlHN2xGIPT/Pg+YN3KFxDxYQsdNB+Zyupva6NBxs5ANL1z2nppwojI OnKfqK5rSLtxWqQCALqoVQP7Q5ncwNER0wE/bAEMJXSXPCxISdv1pq517 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10830"; a="444539598" X-IronPort-AV: E=Sophos;i="6.02,244,1688454000"; d="scan'208";a="444539598" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2023 08:45:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10830"; a="917061944" X-IronPort-AV: E=Sophos;i="6.02,244,1688454000"; d="scan'208";a="917061944" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga005.jf.intel.com with ESMTP; 11 Sep 2023 08:45:36 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id DB1B145B; Mon, 11 Sep 2023 18:45:35 +0300 (EEST) From: Andy Shevchenko To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andy Shevchenko Subject: [PATCH net-next v1 2/2] net: core: Sort headers alphabetically Date: Mon, 11 Sep 2023 18:45:34 +0300 Message-Id: <20230911154534.4174265-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230911154534.4174265-1-andriy.shevchenko@linux.intel.com> References: <20230911154534.4174265-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org It's rather a gigantic list of heards that is very hard to follow. Sorting helps to see what's already included and what's not. It improves a maintainability in a long term. Signed-off-by: Andy Shevchenko --- net/core/dev.c | 135 +++++++++++++++++++++++++------------------------ 1 file changed, 69 insertions(+), 66 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index 85df22f05c38..d795a6c5a591 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -68,91 +68,94 @@ * - netif_rx() feedback */ -#include +#include #include +#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include -#include -#include -#include +#include #include #include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include #include #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include +#include #include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include + #include #include -#include #include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include "dev.h" #include "net-sysfs.h"