Received: by 2002:ab2:6991:0:b0:1f2:fff1:ace7 with SMTP id v17csp145524lqo; Wed, 27 Mar 2024 09:05:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU8N1pTlKbrbxjIJD5ddJATYl7c410L1T+FarFJquNSHiA4wBv9RgSFIjCw6b6Nn4nPJrXp+F2hak/LXqPev0Yo+lWieHtrXWiH+P2b8Q== X-Google-Smtp-Source: AGHT+IEfXDHE2lZmt8/hJDPMFw+veGgfi3OXia8HJSYtRVlr9oFcCe4vSUKze+RPwI5DHHtgUAym X-Received: by 2002:a17:902:c408:b0:1e0:1f1d:bd3c with SMTP id k8-20020a170902c40800b001e01f1dbd3cmr109983plk.46.1711555529886; Wed, 27 Mar 2024 09:05:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711555529; cv=pass; d=google.com; s=arc-20160816; b=sqTNFbR62PT0tEuN4FNhP0VPj6HyyDdzQ1J+UxwZKcRkANAqLw7M1SiVFu10jHORrj jy1AvoFzxUlcMCrRoQaqyWFOGZ+rMb4regB5s+gIaNNVOUX6D8WOU49jXWuNOwNZkhuQ dOsu1scwaqgArquheg8Yv8ep+Vj3EAnY03DwFe1cqd2EQBRhSsrkqQYiDP0VfQhp6+Ww 4BamBamy49ViKbNwFgteQI9XTIQWAunVRFBEzqjJ+0LH+eLQ9vaTdu3iHTpqKKiwmLJi /hJ7/1NDKid5Xx//Hp3/6ib4tbk26W3cVGKC1DkWY3IY0hsGTEm3ErR+jlkA4s5Y1ifX qAqQ== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=TaWdVeqTP7T3fI/dtr926X8Z1QQ65ofzmdGiBY69Sc8=; fh=HAee6bbtLy7HrGEmtDeJDowZ4nqmgipu4nyq312/+7o=; b=dIfZNhrWS+qR5HixCQtj7s6ztZMBiF4jNNOcEUmQ5Ytmf6MJnTApee8LcYm4L+72Zs Qyfwz2CTMMe6AGZBLXIuNekePEhyXCuuunxjvGpL7bf4F7K7uWqE1JY+dhMmkmY6CmuZ IsuLYYfQOWzW9RANRewrZDdr5EwPiMg8lO7pzZw5/LzQoboptkY/24MQ+Mdk4sKB278z JqDwBT+vU8nJKcrr+sgCrVs+osnPUHqfTmLfhSvnvAaDXXXevZeTlLK+11vpQ990dGwB ogiz0t3ztDv0VwqWjIZ8UMuZAdEQTJGUyOaJg9tt5Llf2XmVlRWKjGBXZOj4SC5Nbnxf e2zw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="hzJ1AF/U"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-121521-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-121521-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id p2-20020a170902e74200b001e0b883e2e8si7168289plf.86.2024.03.27.09.05.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 09:05:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-121521-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="hzJ1AF/U"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-121521-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-121521-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 CFC3AB3B19B for ; Wed, 27 Mar 2024 15:34:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3BB38148848; Wed, 27 Mar 2024 15:25:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="hzJ1AF/U" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.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 D8BEE59B71; Wed, 27 Mar 2024 15:25:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711553111; cv=none; b=oFzJMW1iEc85Q1kW29yneCPQa+DI22W0or7wyr0xZwBhcgDAHXn9yDEiWfz/KF5HBIoVZpaA96jYpfvaF5av8BGp5MhSfOjqKBjaLE1aRQkMc60eh8TD5+csTD3e4wNJEkd6evXLWjGborDqngMQbptVC29nMlRr6aiEl75uBKY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711553111; c=relaxed/simple; bh=7aqDMG3jXWM6P9Y6VUwEci4LhL45xGo7CgLld4wLHOc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kxtWafzIA9rOIzFrhmLByS+ouPPAkgViRuDYnbEx4kgvzBgc092pF97IdYDEeBYmpv+pyncaHQzlw60Qi6V94FOg+AdSsAMrcl8zuWd5RtBKtj7XK3IYBT5bY9mI3XFn8drNGsgTa5JD+12F4Zdv6iDN4u59PkZZkhwZwJrXDVw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=hzJ1AF/U; arc=none smtp.client-ip=198.175.65.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711553110; x=1743089110; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7aqDMG3jXWM6P9Y6VUwEci4LhL45xGo7CgLld4wLHOc=; b=hzJ1AF/U9qnizza8DO/smL/UeCBJLQ4EQs9qz3mRGQCF+v0lFmynweIv o3ISX/9eF7am6jb7N/euw2Efoy4JqWizcAhHQMyHd9Nz+YElZ2GZPaEdS zPMjMZR0SUZr/WMRVjj2NDQvFcuJo4bglECWZM0/x7TbPSLKhiSwIsPse oDSkhYyI7MSZ1KikOJstpkC/dZ2TNP9nFKW5z8Xiu5fuY70JtyiXV2mkG gemGQ73IzeN7HM/wl+IgmGA1K0hmqWoPZsNzgcG+vMKO9e3wpanxC9yZH Zx8v4qVpPliizmhAFh+Vie8BwX7IFGFuM6Ri72woX6gPPLoT8y1ew10ei A==; X-CSE-ConnectionGUID: ZNzS/yUeQg+mGa7AjKDOpQ== X-CSE-MsgGUID: D7bWW5myT5STH262TF4Ueg== X-IronPort-AV: E=McAfee;i="6600,9927,11026"; a="6518206" X-IronPort-AV: E=Sophos;i="6.07,159,1708416000"; d="scan'208";a="6518206" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2024 08:25:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,159,1708416000"; d="scan'208";a="16414270" Received: from newjersey.igk.intel.com ([10.102.20.203]) by fmviesa008.fm.intel.com with ESMTP; 27 Mar 2024 08:25:07 -0700 From: Alexander Lobakin To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Alexander Lobakin , Yury Norov , Alexander Potapenko , nex.sw.ncis.osdt.itp.upstreaming@intel.com, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v6 11/21] tools: move alignment-related macros to new Date: Wed, 27 Mar 2024 16:23:48 +0100 Message-ID: <20240327152358.2368467-12-aleksander.lobakin@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240327152358.2368467-1-aleksander.lobakin@intel.com> References: <20240327152358.2368467-1-aleksander.lobakin@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Currently, tools have *ALIGN*() macros scattered across the unrelated headers, as there are only 3 of them and they were added separately each time on an as-needed basis. Anyway, let's make it more consistent with the kernel headers and allow using those macros outside of the mentioned headers. Create inside the tools/ folder and include it where needed. Signed-off-by: Yury Norov Signed-off-by: Alexander Lobakin --- tools/include/linux/align.h | 12 ++++++++++++ tools/include/linux/bitmap.h | 2 +- tools/include/linux/mm.h | 5 +---- 3 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 tools/include/linux/align.h diff --git a/tools/include/linux/align.h b/tools/include/linux/align.h new file mode 100644 index 000000000000..14e34ace80dd --- /dev/null +++ b/tools/include/linux/align.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef _TOOLS_LINUX_ALIGN_H +#define _TOOLS_LINUX_ALIGN_H + +#include + +#define ALIGN(x, a) __ALIGN_KERNEL((x), (a)) +#define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a)) +#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) + +#endif /* _TOOLS_LINUX_ALIGN_H */ diff --git a/tools/include/linux/bitmap.h b/tools/include/linux/bitmap.h index f3566ea0f932..8c6852dba04f 100644 --- a/tools/include/linux/bitmap.h +++ b/tools/include/linux/bitmap.h @@ -3,6 +3,7 @@ #define _TOOLS_LINUX_BITMAP_H #include +#include #include #include #include @@ -126,7 +127,6 @@ static inline bool bitmap_and(unsigned long *dst, const unsigned long *src1, #define BITMAP_MEM_ALIGNMENT (8 * sizeof(unsigned long)) #endif #define BITMAP_MEM_MASK (BITMAP_MEM_ALIGNMENT - 1) -#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) static inline bool bitmap_equal(const unsigned long *src1, const unsigned long *src2, unsigned int nbits) diff --git a/tools/include/linux/mm.h b/tools/include/linux/mm.h index f3c82ab5b14c..7a6b98f4e579 100644 --- a/tools/include/linux/mm.h +++ b/tools/include/linux/mm.h @@ -2,8 +2,8 @@ #ifndef _TOOLS_LINUX_MM_H #define _TOOLS_LINUX_MM_H +#include #include -#include #define PAGE_SHIFT 12 #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) @@ -11,9 +11,6 @@ #define PHYS_ADDR_MAX (~(phys_addr_t)0) -#define ALIGN(x, a) __ALIGN_KERNEL((x), (a)) -#define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a)) - #define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE) #define __va(x) ((void *)((unsigned long)(x))) -- 2.44.0