Message ID | cover.a7730420cfba0f204a60e4c30e6b0e07b441ff6b.1718881762.git-series.nbd@nbd.name |
---|---|
Headers | show |
Series | cfg80211/mac80211: support defining multiple radios per wiphy | expand |
On Thu, 2024-06-20 at 13:11 +0200, Felix Fietkau wrote: > > +static int nl80211_put_ifcomb_data(struct sk_buff *msg, bool large, int idx, > + const struct ieee80211_iface_combination *c) > { > - struct nlattr *nl_combis; > - int i, j; > + struct nlattr *nl_combi, *nl_limits; > + int i; > > - nl_combis = nla_nest_start_noflag(msg, > - NL80211_ATTR_INTERFACE_COMBINATIONS); > - if (!nl_combis) > + nl_combi = nla_nest_start_noflag(msg, idx); > + if (!nl_combi) > goto nla_put_failure; Not sure why the diff looks so much different here between my git and yours, but anyway ... Even if it's ugly here, I do think you should add an argument to the function ..., u16 nested pass 0 for the existing user, and NLA_F_NESTED for the later new users, and use nla_nest_start_noflag(msg, idx | nested); etc. for all the nla_nest_start_noflag() calls in this function. I really don't want to propagate the _noflag() API further. (The above was the simplest I could come up with, maybe you can find a better solution, but callikng nla_nest_start() conditionally seemed worse) johannes
On Thu, 2024-06-20 at 13:11 +0200, Felix Fietkau wrote: > > +static inline u32 > +rdev_get_radio_mask(struct cfg80211_registered_device *rdev, > + struct net_device *dev) > +{ > + struct wiphy *wiphy = &rdev->wiphy; > + u32 ret; > + > + if (!rdev->ops->get_radio_mask) > + return 0; > + > + trace_rdev_get_radio_mask(wiphy, dev); > + ret = rdev->ops->get_radio_mask(wiphy, dev); > + trace_rdev_return_int(wiphy, ret); I'd tend to prefer tracing even if it's not implemented, so we see what's going on? Though personally I guess in this case I don't even care much since mac80211 will unconditionally implement it ... > @@ -2366,14 +2374,19 @@ int cfg80211_iter_combinations(struct wiphy *wiphy, > void *data), > void *data) > { > + const struct wiphy_radio *radio = NULL; > + const struct ieee80211_iface_combination *c, *cs; > const struct ieee80211_regdomain *regdom; > enum nl80211_dfs_regions region = 0; > - int i, j, iftype; > + int i, j, n, iftype; > int num_interfaces = 0; > u32 used_iftypes = 0; > u32 beacon_int_gcd; > bool beacon_int_different; > > + if (params->radio_idx >= 0) > + radio = &wiphy->radio[params->radio_idx]; Maybe we should have a sanity bounds check? Or even really just __counted_by() annotations in struct wiphy_radio, so we can run with UBSAN in testing (which would be a comment for patch 2, but I'm not going to send it there again ;-) ). johannes