Re: [PATCH v2] mac80211: mesh: Add support for HW RC implementation

From: Johannes Berg
Date: Thu Jun 23 2016 - 15:26:42 EST



> +void sta_get_expected_throughput(struct sta_info *sta, u32 *thr)
> +{
> + struct ieee80211_sub_if_data *sdata = sta->sdata;
> + struct ieee80211_local *local = sdata->local;
> + struct rate_control_ref *ref = NULL;
> +
> + if (test_sta_flag(sta, WLAN_STA_RATE_CONTROL))
> + ref = local->rate_ctrl;
> +
> + /* check if the driver has a SW RC implementation */
> + if (ref && ref->ops->get_expected_throughput)
> + *thr = ref->ops->get_expected_throughput(sta-
> >rate_ctrl_priv);
> + else
> + *thr = drv_get_expected_throughput(local, &sta-
> >sta);
> +}

I don't really see a reason for the function to take a u32 *thr, rather
than return u32? Would be clearer, IMHO, to just return the value.

Then in the user, it seems that you shouldn't use "rate" as the
variable that gets this result?

johannes