From patchwork Tue Jan 20 10:24:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 5667181 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2A608C058D for ; Tue, 20 Jan 2015 10:24:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 046CA20396 for ; Tue, 20 Jan 2015 10:24:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3FE0D20389 for ; Tue, 20 Jan 2015 10:24:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752510AbbATKYt (ORCPT ); Tue, 20 Jan 2015 05:24:49 -0500 Received: from mail-wi0-f169.google.com ([209.85.212.169]:52651 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752507AbbATKYr (ORCPT ); Tue, 20 Jan 2015 05:24:47 -0500 Received: by mail-wi0-f169.google.com with SMTP id bs8so22295783wib.0 for ; Tue, 20 Jan 2015 02:24:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jzsxBz8JizQJyzIIUXcQsD7cAbwCKc1nKDwkC0+hero=; b=AaxDyiBUawjx/EP+vnJDcBFM7/2BKkv2dIrvEHt0gb7rDmNZCrW1nm+VQ+Qblb+4iB RvQno83oJk16+UIg0UrIo2jKK/4B+FoL267SjVykluBDAyqqr8M4MzNtZZBfzGyHv09D 2XFERWpRIJHtrFjmTSamIHEAO6RBpDRWhvt+w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jzsxBz8JizQJyzIIUXcQsD7cAbwCKc1nKDwkC0+hero=; b=JhQ1lnT/N5uguBHBnOinJMk5lXHWtJjwiRJAQholvMAK2/vdmk8z9ZUEMfz/CdAlNY BK2GvO11nOrK75GnrMKQCei/R8PPpcIKVJW5zF49d1jKim9Rfaa2ZZi1arptuSARTjhv gx9gnLDtZQlbMFtii5gpilm25fFgg954zEj4Trkum3KnrvFAtX7piwjy9QYmQpGpDTWx V0K5ceDtygmT7eeUQyyWx3gafqTJYCEyCEyZZvrAL3HA7AQ6pHeN4MmR+CyhZikrhLhP j+B0ObX2i28YJ71Zb+Z2Zz0fU2x44feJn/YWSCIjJtgprvqKgTF4v1O50u9Slt0WhuXq HBdw== X-Gm-Message-State: ALoCoQllgahUtKbYtJdbI7ZGRBlWq0FVGdXIXyhJZMTRAyvEX1/hhpF7GRPPNTkREF2zveKlCKZBmjW3+Zn6YWF5kZA+toh3u/3WjDEpTIU8sdVgkTxgsspJpROec1ho1bWdUFiuSqgm X-Received: by 10.180.76.228 with SMTP id n4mr45053264wiw.45.1421749485082; Tue, 20 Jan 2015 02:24:45 -0800 (PST) Received: from bob.homerouter.cpe (apn-46-76-65-212.dynamic.gprs.plus.pl. [46.76.65.212]) by mx.google.com with ESMTPSA id dv9sm2419490wib.14.2015.01.20.02.24.43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Jan 2015 02:24:44 -0800 (PST) From: Michal Kazior To: ath10k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Michal Kazior , Janusz Dziedzic Subject: [PATCH 2/2] ath10k: disable sta keepalive Date: Tue, 20 Jan 2015 11:24:00 +0100 Message-Id: <1421749440-10457-2-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1421749440-10457-1-git-send-email-michal.kazior@tieto.com> References: <1421749440-10457-1-git-send-email-michal.kazior@tieto.com> X-DomainID: tieto.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=ham 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 Firmware revisions providing sta keepalive service have it enabled by default. mac80211 already does idle connection polling so it makes no sense to duplicate this in ath10k. mac80211 wouldn't even know of the offloaded keepalive NullFunc frames. This prevents sending out some extraneous frames on the air. Signed-off-by: Janusz Dziedzic Signed-off-by: Michal Kazior --- drivers/net/wireless/ath/ath10k/mac.c | 42 +++++++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath10k/wmi.h | 5 +++++ 2 files changed, 47 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 9524bc5..3511f60 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -1289,6 +1289,38 @@ static int ath10k_mac_vif_setup_ps(struct ath10k_vif *arvif) return 0; } +static int ath10k_mac_vif_disable_keepalive(struct ath10k_vif *arvif) +{ + struct ath10k *ar = arvif->ar; + struct wmi_sta_keepalive_arg arg = {}; + int ret; + + lockdep_assert_held(&arvif->ar->conf_mutex); + + if (arvif->vdev_type != WMI_VDEV_TYPE_STA) + return 0; + + if (!test_bit(WMI_SERVICE_STA_KEEP_ALIVE, ar->wmi.svc_map)) + return 0; + + /* Some firmware revisions have a bug and ignore the `enabled` field. + * Instead use the interval to disable the keepalive. + */ + arg.vdev_id = arvif->vdev_id; + arg.enabled = 1; + arg.method = WMI_STA_KEEPALIVE_METHOD_NULL_FRAME; + arg.interval = WMI_STA_KEEPALIVE_INTERVAL_DISABLE; + + ret = ath10k_wmi_sta_keepalive(ar, &arg); + if (ret) { + ath10k_warn(ar, "failed to submit keepalive on vdev %i: %d\n", + arvif->vdev_id, ret); + return ret; + } + + return 0; +} + /**********************/ /* Station management */ /**********************/ @@ -3182,6 +3214,16 @@ static int ath10k_add_interface(struct ieee80211_hw *hw, ar->free_vdev_map &= ~(1LL << arvif->vdev_id); list_add(&arvif->list, &ar->arvifs); + /* It makes no sense to have firmware do keepalives. mac80211 already + * takes care of this with idle connection polling. + */ + ret = ath10k_mac_vif_disable_keepalive(arvif); + if (ret) { + ath10k_warn(ar, "failed to disable keepalive on vdev %i: %d\n", + arvif->vdev_id, ret); + goto err_vdev_delete; + } + vdev_param = ar->wmi.vdev_param->def_keyid; ret = ath10k_wmi_vdev_set_param(ar, 0, vdev_param, arvif->def_wep_key_idx); diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h index 99f091d..5da61e8 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.h +++ b/drivers/net/wireless/ath/ath10k/wmi.h @@ -4581,6 +4581,11 @@ enum wmi_sta_keepalive_method { WMI_STA_KEEPALIVE_METHOD_UNSOLICITATED_ARP_RESPONSE = 2, }; +#define WMI_STA_KEEPALIVE_INTERVAL_DISABLE 0 + +/* Firmware crashes if keepalive interval exceeds this limit */ +#define WMI_STA_KEEPALIVE_INTERVAL_MAX_SECONDS 0xffff + /* note: ip4 addresses are in network byte order, i.e. big endian */ struct wmi_sta_keepalive_arp_resp { __be32 src_ip4_addr;