Search code examples
linux-kernelandroid-wifi

Android (Linux) Kernel 'HZ' variable


I'm currently looking into kernel source code of WiFI (net/mac80211) (of Samsung's Galaxy S3---GT-I9300---kernel)

And I've seen the code like below:

/*
 * Scanning implementation
 *
 * Copyright 2003, Jouni Malinen <jkmaline@cc.hut.fi>
 * Copyright 2004, Instant802 Networks, Inc.
 * Copyright 2005, Devicescape Software, Inc.
 * Copyright 2006-2007  Jiri Benc <jbenc@suse.cz>
 * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#include <linux/if_arp.h>
#include <linux/rtnetlink.h>
#include <linux/pm_qos_params.h>
#include <net/sch_generic.h>
#include <linux/slab.h>
#include <net/mac80211.h>

#include "ieee80211_i.h"
#include "driver-ops.h"
#include "mesh.h"

#define IEEE80211_PROBE_DELAY (HZ / 33)
#define IEEE80211_CHANNEL_TIME (HZ / 33)
#define IEEE80211_PASSIVE_CHANNEL_TIME (HZ / 8)

At the bottom of the code, it defines PROBE_DELAY, CHANNEL_TIME, PASSIVE_CHANNEL_TIME with respect to variable 'HZ'

Therefore, I typed grep -r "HZ" ./ >> ~/grep_result to find where the HZ is defined.

But , as a result, there's no definition, declaration of HZ.

Where can I find exact value of HZ ?

And if I find HZ value, what is the unit measure?


Solution

  • HZ is typically defined to be CONFIG_HZ. CONFIG_HZ is defined during the make config process

    The generic definition is in

    include/asm-generic/param.h;

    The architecture specific definitions are in

    arch//include/asm/param.h

    which tends to simply define it to be CONFIG_HZ as well; note that you may find some hard-coded definitions of HZ in

    arch//include/asm/uapi/param.h

    These definitions of HZ are NOT used by the kernel they are user-space API interface values;

    Hope this helps.