Skip to contentSkip to conversation

Roaming with libertas and wpa_supplicant not working

DISCUSSION Troels Nilsson 3 participants 8 messages Nov 18, 2013 – Nov 26, 2013 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hi,

We are having a problem with a custom device which uses the libertas wifi driver (on kernel 3.4.24) together with wpa_supplicant (0.7.3). More specifically, whenever wpa_supplicant attempts to roam to a different access point it gets a EALREADY error.

I have tracked down the problem to this check in sme.c:

        if (wdev->sme_state != CFG80211_SME_IDLE)
                return -EALREADY;

When we get to this check the sme_state is CFG80211_SME_CONNECTED, so nothing gets done. Changing this check to only fail if sme_state is CFG80211_SME_CONNECTING fixes the issue, but I guess this check is there for a reason?

In any case I don't know enough about the wireless system to say if this is a problem in the libertas driver or cfg80211 or maybe the way wpa_supplicant is using the API. Any comments/help would be greatly appreciated :)

#1 lore raw
Quoted 11 lines · Troels Nilsson

Hi,

We are having a problem with a custom device which uses the libertas wifi driver (on kernel 3.4.24) together with wpa_supplicant (0.7.3). More specifically, whenever wpa_supplicant attempts to roam to a different access point it gets a EALREADY error.

I have tracked down the problem to this check in sme.c:

        if (wdev->sme_state != CFG80211_SME_IDLE)
                return -EALREADY;

This no longer exists - please try a newer kernel.

johannes

#2 lore raw
Quoted 8 lines · Johannes Berg
Quoted 7 lines · Troels Nilsson

Hi,

We are having a problem with a custom device which uses the libertas wifi driver (on kernel 3.4.24) together with wpa_supplicant (0.7.3). More specifically, whenever wpa_supplicant attempts to roam to a different access point it gets a EALREADY error.

Quoted 6 lines
Quoted 4 lines

I have tracked down the problem to this check in sme.c:

        if (wdev->sme_state != CFG80211_SME_IDLE)
                return -EALREADY;

This no longer exists - please try a newer kernel.

Yeah, though the code there hasn't changed much in cfg80211 in the "connect" case from what he's using. It seems that supplicant-controlled roaming simply won't work with "connect" devices unless a disconnect is done first? Libertas is kinda different here since it does allow userspace roaming control.

Dan

#3 lore raw
Quoted 14 lines · Dan Williams
Quoted 13 lines · Johannes Berg
Quoted 11 lines · Troels Nilsson

Hi,

We are having a problem with a custom device which uses the libertas wifi driver (on kernel 3.4.24) together with wpa_supplicant (0.7.3). More specifically, whenever wpa_supplicant attempts to roam to a different access point it gets a EALREADY error.

I have tracked down the problem to this check in sme.c:

        if (wdev->sme_state != CFG80211_SME_IDLE)
                return -EALREADY;
Quoted 7 lines
Quoted 1 line

This no longer exists - please try a newer kernel.

Yeah, though the code there hasn't changed much in cfg80211 in the "connect" case from what he's using. It seems that supplicant-controlled roaming simply won't work with "connect" devices unless a disconnect is done first? Libertas is kinda different here since it does allow userspace roaming control.

I believe the code *does* in fact allow connect() while connected right now, though arguably that's a bug and shouldn't be done. It would make some more sense to allow NL80211_CMD_ROAM to be used for something like that, but ...

johannes

#4 lore raw
Quoted 23 lines · Johannes Berg
Quoted 14 lines · Dan Williams
Quoted 13 lines · Johannes Berg
Quoted 11 lines · Troels Nilsson

Hi,

We are having a problem with a custom device which uses the libertas wifi driver (on kernel 3.4.24) together with wpa_supplicant (0.7.3). More specifically, whenever wpa_supplicant attempts to roam to a different access point it gets a EALREADY error.

I have tracked down the problem to this check in sme.c:

        if (wdev->sme_state != CFG80211_SME_IDLE)
                return -EALREADY;
Quoted 7 lines
Quoted 1 line

This no longer exists - please try a newer kernel.

Yeah, though the code there hasn't changed much in cfg80211 in the "connect" case from what he's using. It seems that supplicant-controlled roaming simply won't work with "connect" devices unless a disconnect is done first? Libertas is kinda different here since it does allow userspace roaming control.

Quoted 4 lines

I believe the code *does* in fact allow connect() while connected right now, though arguably that's a bug and shouldn't be done. It would make some more sense to allow NL80211_CMD_ROAM to be used for something like that, but ...

I think you're right in the libertas case; neither nl80211_connect() or cfg80211_connect() care about whether the device is associated or not. I was looking at cfg80211_sme_connect(), which gets run for drivers that do not implement connect() themselves, and that function *doesn't* appear to allow roaming.

So if the driver does implement connect() it can allow roaming from connect() if it wants, but if the driver does not implement connect() then the stack will not allow roaming from connect(). Seems a bit inconsistent, so what's the best-practice for drivers here? Disallow roaming from connect() and CMD_ROAM instead?

We'd have to actually implement CMD_ROAM then, I guess...

Dan

#5 lore raw
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Hi,

We are having a problem with a custom device which uses the libertas wifi driver (on kernel 3.4.24) together with wpa_supplicant (0.7.3). More specifically, whenever wpa_supplicant attempts to roam to a different access point it gets a EALREADY error.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

I have tracked down the problem to this check in sme.c:

        if (wdev->sme_state != CFG80211_SME_IDLE)
                return -EALREADY;

This no longer exists - please try a newer kernel.

Yes, I saw that it was removed/rewritten in 3.11. However, that is quite a jump in kernel versions for us at this point, so we will probably prefer to patch the 3.4 series.

Quoted 18 lines
Quoted 11 lines
Quoted 6 lines

Yeah, though the code there hasn't changed much in cfg80211 in the "connect" case from what he's using. It seems that supplicant-controlled roaming simply won't work with "connect" devices unless a disconnect is done first? Libertas is kinda different here since it does allow userspace roaming control.

I believe the code *does* in fact allow connect() while connected right now, though arguably that's a bug and shouldn't be done. It would make some more sense to allow NL80211_CMD_ROAM to be used for something like that, but ...

I think you're right in the libertas case; neither nl80211_connect() or cfg80211_connect() care about whether the device is associated or not. I was looking at cfg80211_sme_connect(), which gets run for drivers that do not implement connect() themselves, and that function *doesn't* appear to allow roaming.

Quoted 7 lines

So if the driver does implement connect() it can allow roaming from connect() if it wants, but if the driver does not implement connect() then the stack will not allow roaming from connect(). Seems a bit inconsistent, so what's the best-practice for drivers here? Disallow roaming from connect() and CMD_ROAM instead?

We'd have to actually implement CMD_ROAM then, I guess...

So I guess the conclusion is that there isn't currently a "correct" way to do roaming (until CMD_ROAM gets implemented)?

In that case we will go with patching the check to only fail with -EALREADY in the case where sme_state is CFG80211_SME_CONNECTING, since that means roaming works with libertas.

#7 lore raw
In reply to a message not in the archive
Quoted 10 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

Hi,

We are having a problem with a custom device which uses the libertas wifi
driver (on kernel 3.4.24) together with wpa_supplicant (0.7.3). More
specifically, whenever wpa_supplicant attempts to roam to a different access
point it gets a EALREADY error.

Quoted 2 lines

May I ask why you use *that* old wpa_supplicant?

Our user-space is Ubuntu 12.04 (plus some of our own bits), which uses that version. Do you think this is fixed in a newer version of wpa_supplicant?

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

I have tracked down the problem to this check in sme.c:

        if (wdev->sme_state != CFG80211_SME_IDLE)
                return -EALREADY;
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

This no longer exists - please try a newer kernel.

Yes, I saw that it was removed/rewritten in 3.11. However, that is quite a jump in kernel versions for us at this point, so we will probably prefer to patch the 3.4 series.

I would suggest using backports (formerly known as compat-wireless) in that case.

That could be a solution as well, thanks for the suggestion.

#8 lore raw
In reply to Troels Nilsson
Quoted 41 lines · Troels Nilsson
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Hi,

We are having a problem with a custom device which uses the libertas wifi driver (on kernel 3.4.24) together with wpa_supplicant (0.7.3). More specifically, whenever wpa_supplicant attempts to roam to a different access point it gets a EALREADY error.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

I have tracked down the problem to this check in sme.c:

        if (wdev->sme_state != CFG80211_SME_IDLE)
                return -EALREADY;

This no longer exists - please try a newer kernel.

Yes, I saw that it was removed/rewritten in 3.11. However, that is quite a jump in kernel versions for us at this point, so we will probably prefer to patch the 3.4 series.

Quoted 24 lines
Quoted 11 lines
Quoted 6 lines

Yeah, though the code there hasn't changed much in cfg80211 in the "connect" case from what he's using. It seems that supplicant-controlled roaming simply won't work with "connect" devices unless a disconnect is done first? Libertas is kinda different here since it does allow userspace roaming control.

I believe the code *does* in fact allow connect() while connected right now, though arguably that's a bug and shouldn't be done. It would make some more sense to allow NL80211_CMD_ROAM to be used for something like that, but ...

I think you're right in the libertas case; neither nl80211_connect() or cfg80211_connect() care about whether the device is associated or not. I was looking at cfg80211_sme_connect(), which gets run for drivers that do not implement connect() themselves, and that function *doesn't* appear to allow roaming.

So if the driver does implement connect() it can allow roaming from connect() if it wants, but if the driver does not implement connect() then the stack will not allow roaming from connect(). Seems a bit inconsistent, so what's the best-practice for drivers here? Disallow roaming from connect() and CMD_ROAM instead?

Quoted 3 lines
Quoted 1 line

We'd have to actually implement CMD_ROAM then, I guess...

So I guess the conclusion is that there isn't currently a "correct" way to do roaming (until CMD_ROAM gets implemented)?

Not quite; since libertas implements connect() itself, it would appear (on the face of things) that supplicant-directed roaming should work if you're using a recent kernel. Next steps are to (1) use a recent kernel version, and (2) do something like:

rmmod usb8xxx
rmmod libertas_sdio
rmmod libertas
modprobe libertas lbs_debug=0x20043a7
modprobe libertas_sdio
modprobe usb8xxx

and then let the supplicant try to roam again, and grab the 'dmesg' output when things fail so we can see what's going on.

Dan