All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@codeaurora.org>
To: Luca Coelho <luca@coelho.fi>
Cc: linux-wireless@vger.kernel.org,
	Sara Sharon <sara.sharon@intel.com>,
	Luca Coelho <luciano.coelho@intel.com>
Subject: Re: [PATCH 17/17] iwlwifi: mvm: add an option to dereference vif by id
Date: Mon, 28 Jan 2019 11:00:19 +0200	[thread overview]
Message-ID: <87pnsh17j0.fsf@codeaurora.org> (raw)
In-Reply-To: <20190125201305.5616-18-luca@coelho.fi> (Luca Coelho's message of "Fri, 25 Jan 2019 22:13:05 +0200")

Luca Coelho <luca@coelho.fi> writes:

> From: Sara Sharon <sara.sharon@intel.com>
>
> Currently whenever we get firmware notification with mac id,
> we iterate over all the interfaces to find the ID. This is a
> bit cumbersome. Instead, adding an array of RCU pointers, like
> we have for station IDs. This is not expensive space wise
> since we have only up to 4 active MACs, and not complicated
> code wise, since we have a clear point to init and de-init it.
>
> Signed-off-by: Sara Sharon <sara.sharon@intel.com>
> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

[...]

> +static inline struct ieee80211_vif *
> +iwl_mvm_rcu_dereference_vif_id(struct iwl_mvm *mvm, u8 vif_id, bool rcu)
> +{
> +	if (WARN_ON(vif_id >= ARRAY_SIZE(mvm->vif_id_to_mac)))
> +		return NULL;
> +
> +	if (rcu)
> +		return rcu_dereference(mvm->vif_id_to_mac[vif_id]);
> +
> +	return rcu_dereference_protected(mvm->vif_id_to_mac[vif_id],
> +					 lockdep_is_held(&mvm->mutex));
> +}

No need to change anything, but IMHO foo(bar) and foo_protected(bar) is
a lot easier to read than foo(bar, true) and foo(bar, false).

-- 
Kalle Valo

  reply	other threads:[~2019-01-28  9:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-25 20:12 [PATCH 00/17] iwlwifi: updates intended for v5.1 2019-01-25 Luca Coelho
2019-01-25 20:12 ` [PATCH 01/17] iwlwifi: pcie: fix the use of a wrong define Luca Coelho
2019-01-25 20:12 ` [PATCH 02/17] iwlwifi: iwlmvm: ignore HE PPDU type regarding EOF Luca Coelho
2019-01-25 20:12 ` [PATCH 03/17] iwlwifi: iwlmvm: in monitor NDP notif take the NSS from rx_vec Luca Coelho
2019-01-25 20:12 ` [PATCH 04/17] iwlwifi: pcie: add prints to track virtual ID Luca Coelho
2019-01-25 20:12 ` [PATCH 05/17] iwlwifi: mvm: fix %16 to %016 print format Luca Coelho
2019-01-25 20:12 ` [PATCH 06/17] iwlwifi: mvm: read IWL_RX_MPDU_PHY_SHORT_PREAMBLE only for CCK Luca Coelho
2019-01-25 20:12 ` [PATCH 07/17] iwlwifi: pcie: align licensing to dual GPL/BSD Luca Coelho
2019-01-25 20:12 ` [PATCH 08/17] iwlwifi: mvm: clean up LDBG config command usage Luca Coelho
2019-01-25 20:12 ` [PATCH 09/17] iwlwifi: mvm: save and export regdb blob from the NVM Luca Coelho
2019-01-25 20:12 ` [PATCH 10/17] iwlwifi: make iwl_fw_dbg_start_stop_hcmd() inline Luca Coelho
2019-01-25 20:12 ` [PATCH 11/17] iwlwifi: move iwl_enable_{rx,tx}_ampdu to iwl-modparams.h Luca Coelho
2024-08-10 22:57   ` Barnabás Pőcze
2019-01-25 20:13 ` [PATCH 12/17] iwlwifi: mvm: pre-initialize alive_data in wait_alive() Luca Coelho
2019-01-25 20:13 ` [PATCH 13/17] iwlwifi: calculate pointers from out_cmd instead of out_cmd->hdr Luca Coelho
2019-01-25 20:13 ` [PATCH 14/17] iwlwifi: make sure cur_fw_img is valid before accessing img Luca Coelho
2019-01-25 20:13 ` [PATCH 15/17] iwlwifi: mvm: remove sta key on wep ap Luca Coelho
2019-01-25 20:13 ` [PATCH 16/17] iwlwifi: monitor dumping flow cleanup Luca Coelho
2019-01-25 20:13 ` [PATCH 17/17] iwlwifi: mvm: add an option to dereference vif by id Luca Coelho
2019-01-28  9:00   ` Kalle Valo [this message]
2019-01-28  9:04     ` Luca Coelho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pnsh17j0.fsf@codeaurora.org \
    --to=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=luca@coelho.fi \
    --cc=luciano.coelho@intel.com \
    --cc=sara.sharon@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.