From patchwork Fri Jun 7 13:36:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kici?ski X-Patchwork-Id: 2687001 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 0572CDFB78 for ; Fri, 7 Jun 2013 13:36:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753367Ab3FGNgZ (ORCPT ); Fri, 7 Jun 2013 09:36:25 -0400 Received: from mx3.wp.pl ([212.77.101.7]:39787 "EHLO mx3.wp.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752755Ab3FGNgW (ORCPT ); Fri, 7 Jun 2013 09:36:22 -0400 Received: (wp-smtpd smtp.wp.pl 12926 invoked from network); 7 Jun 2013 15:36:20 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wp.pl; s=1024a; t=1370612180; bh=o57jPr+gvd6uOUEbzV3yYwUTHIaWn6JiIv70m+ECp68=; h=From:To:Cc:Subject; b=YM263abvMUic3HHoHSkmOCBtYB3mh96V5FT+qg2wswK3pfYccPhT50hBgkhKyIn/K bMxT2NZLcU+JdHfrxlIiYjxdc8drDYCKpnuUL+cQWrkmyuC+o2s6u8L/1CJsKXAQpL XEh+jhxAjscQctYGU5XN9SeIDciQ2ABX1vgYqa1A= Received: from 89-71-197-70.dynamic.chello.pl (HELO localhost.localdomain) (moorray3@[89.71.197.70]) (envelope-sender ) by smtp.wp.pl (WP-SMTPD) with SMTP for ; 7 Jun 2013 15:36:20 +0200 From: Jakub Kicinski To: linux-wireless@vger.kernel.org Cc: Helmut Schaa , Felix Fietkau , Johannes Berg , nietrywialneprzejscie@gmail.com Subject: [RFC 2/5] mac80211: return new mac address as soon as possible Date: Fri, 7 Jun 2013 15:36:16 +0200 Message-Id: <1370612179-24385-3-git-send-email-moorray3@wp.pl> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1370612179-24385-1-git-send-email-moorray3@wp.pl> References: <1370612179-24385-1-git-send-email-moorray3@wp.pl> X-WP-AV: skaner antywirusowy poczty Wirtualnej Polski S. A. X-WP-SPAM: NO 0000000 [8UKs] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jakub Kicinski Once one of wiphy->addresses is found to be unused we can return from __ieee80211_assign_perm_addr and use it. The same for masked addresses. Signed-off-by: Jakub Kicinski --- net/mac80211/iface.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index dbee397..38898b3 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -1449,7 +1449,7 @@ static void __ieee80211_assign_perm_addr(struct ieee80211_local *local, if (!used) { memcpy(perm_addr, local->hw.wiphy->addresses[i].addr, ETH_ALEN); - break; + return; } } @@ -1507,10 +1507,12 @@ static void __ieee80211_assign_perm_addr(struct ieee80211_local *local, if (!used) { memcpy(perm_addr, tmp_addr, ETH_ALEN); - break; + return; } addr = (start & ~mask) | (val & mask); } while (addr != start); + + pr_debug("no free address found - using default\n"); } static void ieee80211_assign_perm_addr(struct ieee80211_local *local,