From patchwork Tue Dec 23 07:47:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Kondratiev X-Patchwork-Id: 5530971 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3E2F6BEEA8 for ; Tue, 23 Dec 2014 07:48:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 201992018E for ; Tue, 23 Dec 2014 07:48:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 316A820121 for ; Tue, 23 Dec 2014 07:48:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754989AbaLWHsO (ORCPT ); Tue, 23 Dec 2014 02:48:14 -0500 Received: from wolverine02.qualcomm.com ([199.106.114.251]:17835 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754871AbaLWHsA (ORCPT ); Tue, 23 Dec 2014 02:48:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1419320880; x=1450856880; h=from:cc:to:subject:date:message-id:in-reply-to: references; bh=8kCFgMwrSQHWlxbWFZv6AtomvYPrEd/C+HMwSb5U2I8=; b=gNlSuXSnHOZbHRAsQqJxFVGJVnmuhSGOEE07HYeS95J91G4D9SUXqSla 4hj1ehtaiJx3oFTNeDLiHnWz94adZWMQorcRCNZyaF5/LvjoYXXvKnKjs uCTtqQQMQCnSrrDVe5wcqB7h7zmVTgBv0AiYx8hPlCa3LtOzu9rsEsS4A Y=; X-IronPort-AV: E=McAfee;i="5600,1067,7660"; a="186726467" Received: from ironmsg03-r.qualcomm.com ([172.30.46.17]) by wolverine02.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 22 Dec 2014 23:48:00 -0800 From: Vladimir Kondratiev Cc: Vladimir Kondratiev , linux-wireless@vger.kernel.org, wil6210@qca.qualcomm.com X-IronPort-AV: E=Sophos;i="5.07,630,1413270000"; d="scan'208";a="817199383" Received: from lx-wigig-72.mea.qualcomm.com ([10.18.164.37]) by Ironmsg03-R.qualcomm.com with ESMTP; 22 Dec 2014 23:47:59 -0800 To: Kalle Valo Subject: [PATCH 05/22] wil6210: fix disconnect 1 STA in AP Date: Tue, 23 Dec 2014 09:47:07 +0200 Message-Id: <1419320844-23989-6-git-send-email-qca_vkondrat@qca.qualcomm.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1419320844-23989-1-git-send-email-qca_vkondrat@qca.qualcomm.com> References: <1419320844-23989-1-git-send-email-qca_vkondrat@qca.qualcomm.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When disconnecting single STA in AP, it might be that STA in question is already disconnected. In this case, need to do nothing. Previously, it was mis-interpreted as "disconnect all" Signed-off-by: Vladimir Kondratiev --- drivers/net/wireless/ath/wil6210/main.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c index 42e1192..18a2eb5 100644 --- a/drivers/net/wireless/ath/wil6210/main.c +++ b/drivers/net/wireless/ath/wil6210/main.c @@ -188,18 +188,29 @@ static void _wil6210_disconnect(struct wil6210_priv *wil, const u8 *bssid, struct wireless_dev *wdev = wil->wdev; might_sleep(); - if (bssid) { + wil_dbg_misc(wil, "%s(bssid=%pM, reason=%d, ev%s)\n", __func__, bssid, + reason_code, from_event ? "+" : "-"); + + /* Cases are: + * - disconnect single STA, still connected + * - disconnect single STA, already disconnected + * - disconnect all + * + * For "disconnect all", there are 2 options: + * - bssid == NULL + * - bssid is our MAC address + */ + if (bssid && memcmp(ndev->dev_addr, bssid, ETH_ALEN)) { cid = wil_find_cid(wil, bssid); - wil_dbg_misc(wil, "%s(%pM, CID %d)\n", __func__, bssid, cid); - } else { - wil_dbg_misc(wil, "%s(all)\n", __func__); - } - - if (cid >= 0) /* disconnect 1 peer */ - wil_disconnect_cid(wil, cid, reason_code, from_event); - else /* disconnect all */ + wil_dbg_misc(wil, "Disconnect %pM, CID=%d, reason=%d\n", + bssid, cid, reason_code); + if (cid >= 0) /* disconnect 1 peer */ + wil_disconnect_cid(wil, cid, reason_code, from_event); + } else { /* all */ + wil_dbg_misc(wil, "Disconnect all\n"); for (cid = 0; cid < WIL6210_MAX_CID; cid++) wil_disconnect_cid(wil, cid, reason_code, from_event); + } /* link state */ switch (wdev->iftype) {