public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Ben Greear <greearb@candelatech.com>
To: Rameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com>,
	linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: Maybe problem with ieee80211_tear_down_links return value.
Date: Sat, 28 Feb 2026 04:58:07 -0800	[thread overview]
Message-ID: <3e65da3c-af75-4ced-9580-4ad89d7d5493@candelatech.com> (raw)
In-Reply-To: <0e276fba-7a1a-4d2f-a3da-1f3ad53a8a56@oss.qualcomm.com>

On 2/27/26 22:45, Rameshkumar Sundaram wrote:
> 
> 
> On 2/28/2026 6:28 AM, Ben Greear wrote:
>> While checking on some other problems, I ended up adding logging to the code path
>> below from net/mac80211/link.c.  This path is hit very often on my system, and if I understand
>> the code correctly, it should only hit in error cases where MLO links have duplicated
>> MAC addresses.
>>
>>      ret = ieee80211_check_dup_link_addrs(sdata);
>>      if (!ret) {
>>          /* for keys we will not be able to undo this */
>>          ieee80211_tear_down_links(sdata, to_free, rem);
>>
>> The ieee80211_check_dup_link_addrs method appears to return 0 when there are no duplicates,
>> and -EALREADY when there are duplicates.  So maybe the check above should be reversed to be:
>>
>> if (ret) {
>> ??
>>
> 
> 
> The ieee80211_check_dup_link_addrs() helper returns 0 when no duplicates are found and -EALREADY on duplicates, as you described.
> 
> However, in the caller the pattern:
> 
>          if (!ret) {
>                  /* for keys we will not be able to undo this */
>                  ieee80211_tear_down_links(sdata, to_free, rem);
> 
>                  ieee80211_set_vif_links_bitmaps(sdata, new_links, dormant_links);
> 
>                  /* tell the driver */
>                  if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN)
>                          ret = drv_change_vif_links(sdata->local, sdata,
>                                                     old_links & old_active,
>                                                     new_links & sdata->vif.active_links,
>                                                     old);
>                  if (!new_links)
>                          ieee80211_debugfs_recreate_netdev(sdata, false);
> 
>                  if (sdata->vif.type == NL80211_IFTYPE_AP)
>                          ieee80211_update_apvlan_links(sdata);
>          }
> 
> treats ret == 0 as the success/commit path (i.e., only proceed with tearing down removed links, updating link bitmaps, and notifying the driver after validating 
> the new link configuration)
> 
> 
> So I don’t think the condition should be reversed. If it were changed to if (ret), we’d end up committing the update only when duplicates are detected 
> (-EALREADY), which seems backwards given the current flow (and the later rollback handling when ret is non-zero).

Hello Ramesh,

Thanks for the response.  Yes, I was confused...I thought that branch of code was the error case,
but it is actually expected case.

I'm seeing some rare debugfs corruption/crash in that code branch and started thinking it was
error handling.

Thanks,
Ben


--Ben

> 
> -- 
> Ramesh
> 
> 

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


      reply	other threads:[~2026-02-28 12:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-28  0:58 Maybe problem with ieee80211_tear_down_links return value Ben Greear
2026-02-28  6:45 ` Rameshkumar Sundaram
2026-02-28 12:58   ` Ben Greear [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3e65da3c-af75-4ced-9580-4ad89d7d5493@candelatech.com \
    --to=greearb@candelatech.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=rameshkumar.sundaram@oss.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox