Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 28b8acae authored by Ahmad Masri's avatar Ahmad Masri
Browse files

wil6210: use wigig.ini as a configuration file



Adding a configuration file wigig.ini to enable uniform cross platform
configuration. Wil6210 maintains configuration table, with default
configuration values that can be overwritten with values from
wigig.ini file.
Wil6210 will read the wigig.ini file and parse it. It will check all
parameters defined in wil6210 configuration table, in case they appear
in the ini file, it will override it with the new value.

The format of the ini file is as follows:
1- Comment line as below
# param1 is used to configure... default value 0.
2- Configuration line as below
param1=value1

The ini parser will check validity of the parameters and will check
if its values are in the [min,max] range, and if the value exceeds one
of these values the parser will override with the [min,max] limit.

Some of these parameters need a unique handler function that knows
the parameter functionality, its input format and its number of input
values and how to store it.
The handler function reads, parses and stores the values related to
the new parameter into the driver structures. If needed the driver sends
the relevant FW command when the interface comes up.

Change-Id: If98c4ef780a4653d1dbc9dc9f8dae9b52a98527d
Signed-off-by: default avatarAhmad Masri <amasri@codeaurora.org>
parent b482dc81
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ wil6210-y += wil_crash_dump.o
wil6210-y += p2p.o
wil6210-y += ftm.o
wil6210-$(CONFIG_WIL6210_IPA) += ipa.o
wil6210-y += config.o

# for tracing framework to find trace.h
CFLAGS_trace.o := -I$(src)
+8 −7
Original line number Diff line number Diff line
@@ -28,13 +28,14 @@ static struct wiphy_wowlan_support wil_wowlan_support = {
};
#endif

static bool country_specific_board_file;
bool country_specific_board_file;
module_param(country_specific_board_file, bool, 0444);
MODULE_PARM_DESC(country_specific_board_file, " switch board file upon regulatory domain change (Default: false)");

static bool ignore_reg_hints = true;
bool ignore_reg_hints = true;
module_param(ignore_reg_hints, bool, 0444);
MODULE_PARM_DESC(ignore_reg_hints, " Ignore OTA regulatory hints (Default: true)");
MODULE_PARM_DESC(ignore_reg_hints,
		 " Ignore OTA regulatory hints (Default: true)");

#define CHAN60G(_channel, _flags) {				\
	.band			= NL80211_BAND_60GHZ,		\
@@ -2830,8 +2831,10 @@ static const struct cfg80211_ops wil_cfg80211_ops = {
	.update_ft_ies = wil_cfg80211_update_ft_ies,
};

static void wil_wiphy_init(struct wiphy *wiphy)
void wil_wiphy_init(struct wil6210_priv *wil)
{
	struct wiphy *wiphy = wil_to_wiphy(wil);

	wiphy->max_scan_ssids = 1;
	wiphy->max_scan_ie_len = WMI_MAX_IE_LEN;
	wiphy->max_remain_on_channel_duration = WIL_MAX_ROC_DURATION_MS;
@@ -2970,13 +2973,11 @@ struct wil6210_priv *wil_cfg80211_init(struct device *dev)
		return ERR_PTR(-ENOMEM);

	set_wiphy_dev(wiphy, dev);
	wil_wiphy_init(wiphy);

	wil = wiphy_to_wil(wiphy);
	wil->wiphy = wiphy;

	/* default monitor channel */
	ch = wiphy->bands[NL80211_BAND_60GHZ]->channels;
	ch = wil_band_60ghz.channels;
	cfg80211_chandef_create(&wil->monitor_chandef, ch, NL80211_CHAN_NO_HT);

	return wil;
+737 −0

File added.

Preview size limit exceeded, changes collapsed.

+72 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: ISC */
/* Copyright (c) 2019, The Linux Foundation. All rights reserved. */

#ifndef __WIL_CONFIG_H__
#define __WIL_CONFIG_H__

#define WIL_CONFIG_VAR_OFFSET(_struct, _var) (offsetof(_struct, _var))
#define WIL_CONFIG_VAR_SIZE(_struct, _var) (FIELD_SIZEOF(_struct, _var))

enum wil_ini_param_type {
	wil_ini_param_type_unsigned,
	wil_ini_param_type_signed,
	wil_ini_param_type_string,
	wil_ini_param_type_macaddr,
};

#define WIL_CONFIG_INI_PARAM(_name, _type, _ref, _offset, _size, _min, _max)\
	{						\
		(_name),				\
		(_type),				\
		(_ref),					\
		(_offset),				\
		(_size),				\
		(_min),					\
		(_max),					\
		(NULL),					\
	}

#define WIL_CONFIG_INI_STRING_PARAM(_name, _ref, _offset, _size)\
	{						\
		(_name),				\
		(wil_ini_param_type_string),		\
		(_ref),					\
		(_offset),				\
		(_size),				\
		(0),					\
		(0),					\
		(NULL),					\
	}

#define WIL_CONFIG_INI_PARAM_WITH_HANDLER(_name, _handler)\
	{						\
		(_name),				\
		(wil_ini_param_type_string),		\
		(NULL),					\
		(0),					\
		(0),					\
		(0),					\
		(0),					\
		(_handler),				\
	}

/* forward declaration */
struct wil6210_priv;

struct wil_config_entry {
	char *name; /* variable name as expected in wigig.ini file */
	enum wil_ini_param_type type; /* variable type */
	void *var_ref; /* reference to global variable */
	u16 var_offset; /* offset to field inside wil6210_priv structure */
	u32 var_size;  /* size (in bytes) of the field */
	unsigned long min_val; /* minimum value, for range checking */
	unsigned long max_val; /* maximum value, for range checking */
	/* handler function for complex parameters */
	int (*handler)(struct wil6210_priv *wil, const char *buf,
		       size_t count);
};

/* read and parse ini file */
int wil_parse_config_ini(struct wil6210_priv *wil);

#endif /* __WIL_CONFIG_H__ */
+25 −9

File changed.

Preview size limit exceeded, changes collapsed.

Loading