[PATCH v3] wifi: mac80211: add exported tpt_led_trig function for softmac driver

Johannes Berg johannes at sipsolutions.net
Sun Sep 24 23:38:14 PDT 2023


> +++ b/include/net/mac80211.h
> @@ -4733,6 +4733,8 @@ __ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw,
>  				   unsigned int flags,
>  				   const struct ieee80211_tpt_blink *blink_table,
>  				   unsigned int blink_table_len);
> +void __ieee80211_tpt_led_trig_trx(struct ieee80211_hw *hw,
> +				  int tx_bytes, int rx_bytes);

Hm, I think you misunderstood what I said.

I still think you need to have a well-documented function or two here,
but now you can make the exported versions of this be inlines calling
this new function.

But also this now fails the build if !CONFIG_MAC80211_LEDS, you need to
have an ifdef somewhere.

> +void __ieee80211_tpt_led_trig_trx(struct ieee80211_hw *hw,
> +				  int tx_bytes, int rx_bytes)
> +{
> +	struct ieee80211_local *local = hw_to_local(hw);
> +
> +	if (atomic_read(&local->tpt_led_active)) {
> +		local->tpt_led_trigger->tx_bytes += tx_bytes;
> +		local->tpt_led_trigger->rx_bytes += rx_bytes;
> +	}
> +}
> +EXPORT_SYMBOL(__ieee80211_tpt_led_trig_trx);

Even that won't build.

> --- a/net/mac80211/led.h
> +++ b/net/mac80211/led.h
> @@ -71,8 +71,7 @@ static inline void
>  ieee80211_tpt_led_trig_tx(struct ieee80211_local *local, int bytes)
>  {
>  #ifdef CONFIG_MAC80211_LEDS
> -	if (atomic_read(&local->tpt_led_active))
> -		local->tpt_led_trigger->tx_bytes += bytes;
> +	__ieee80211_tpt_led_trig_trx(&local->hw, bytes, 0);
>  #endif

Ah. Actually what I was thinking is that __ieee80211_tpt_led_trig_trx is
still an inline, and then the ieee80211_tpt_led_trig_trx() exported to
drivers can call this alongside these inlines - that way mac80211 still
gets the (trivial) code inlined.

johannes




More information about the Linux-mediatek mailing list