Hi Johannes,
On 10/7/19 4:16 PM, Johannes Berg wrote:
Hi,
If you do care about this being more granular then you should check
*which* interface is scanning, and then you can still switch the
MAC
address for *other* interfaces - but I'd still argue it should be
independent of interface type.
So yes these can scan, but this should be covered by the
netif_carrier_ok check which is done first.
Not sure what you mean by that.
You could have two interfaces, one which is scanning right now, right?
And then theoretically you don't care about the other one - it *should*
be OK to remove/re-add (with new MAC address) the one that *isn't*
scanning, right?
Actually, I don't think you can? Unless I'm missing something? All the
scan state is stored on struct ieee80211_local, so if that struct is
allocated per phy as you point out below, then what you suggest is
currently not possible?
But we don't have that granularity here for anything - you're just
checking "sdata->local->something", and by going from sdata to local
you've now checked the whole NIC, not just a single interface on that
NIC.
Right. But that seems to be a limitation of mac80211 actually. We
can't run two scans concurrently on different interfaces. This is
rather unintuitive given that scan requests require an ifindex/wdev.
Can this be changed / fixed in mac80211 actually? I would expect that
if a card supports p2p and station simultaneously, then it can scan / go
offchannel on two interfaces simultaneously? Or not? What can iwlwifi
do for example?
Which is fine, no complaint from me, just in that case you end up
failing when really there isn't much need to fail. In fact, in a case
like this, actually clearing IFF_UP, changing address and setting IFF_UP
would work, concurrently with another interface scanning.
We can just remove the
switch entirely, but the roc_list/scanning check only matters for
station/p2p_client so checking for the other interface types is kinda
pointless and redundant.
But it's also completely confusing to do it this way because you go from
"sdata" to "local", and at that point the data that you're working on is
no longer specific to that one interface, it's actually for the whole
NIC.
I agree its confusing, but that seems to be how mac80211 works?
Basically what I'm saying is this: it's confusing and makes no sense to
do something like
if (this_is_a_certain_netdev_type)
check_some_global_data();
Also I am not sure what you mean by *which* interface. This function is
called on a single interface, so checking what other interfaces are
doing seems strange...
My point exactly - but that's what you're doing here in the code. Now I
think perhaps without even realizing?
Given the above, I'm not sure I see anything wrong? The switch/case can
probably be gotten rid of, but it actually makes things clear that only
station/p2p_device and adhoc are handled specially.
Regards,
-Denis