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: 5667191 Return-Path: X-Original-To: patchwork-ath10k@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 4C62CC058D for ; Tue, 20 Jan 2015 10:25:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 46C7420389 for ; Tue, 20 Jan 2015 10:25:21 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 68E592034F for ; Tue, 20 Jan 2015 10:25:20 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YDVzj-00069R-E9; Tue, 20 Jan 2015 10:25:11 +0000 Received: from mail-wi0-x22a.google.com ([2a00:1450:400c:c05::22a]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YDVzg-0004wf-EC for ath10k@lists.infradead.org; Tue, 20 Jan 2015 10:25:09 +0000 Received: by mail-wi0-f170.google.com with SMTP id em10so3682434wid.1 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=jQ6PzeVxFthOXUZRCYgHu+FFB05XL/HoLVpTu/37VKDk4La07bHRYw/kMvmMxkoM97 RQiuXake1xSseLRHJeXZ66UfNU1/sHHsDdTgbEbK7yaXdFwEpfpvwpbymzK/SwDDkfUS RSoah1+8nNtq1zeHZ/I0uGr+ek6xxbF2IRfaz4qEnJJYZQhxKAVxJP4UZbu/3fl5NTAR 6J8SITRMjWp/b02wZuWAkCEg+rs5MkPFqRB/qEnNsTJoLoO0F/Zzke69QxPeL2EZSCuR bO5zStQwCEjH6S//MMwU4rljx95Gf0m9NiaDDmUXRZ5TGDrbr+qojd/RhkH1OiJezxzF GD3g== X-Gm-Message-State: ALoCoQm7+dVvCZAjwmQTlYkR4fSLlood7ya/qF7plYwbehzPiCa+ZTyoMP/ofytRRs/RUTFH3RkmTVXioB3wqAPSgCJWGuc8XF7K8fG7b8hqAaYCjseHNYJ+/78e0GAZoIbs8+LA5hH8mUPp9a/56APNUfhAgI9c/Y8NyA/6oSPSX2olu9lkcrE= 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150120_022508_657223_EDCC6B66 X-CRM114-Status: GOOD ( 11.35 ) X-Spam-Score: -0.8 (/) Cc: Janusz Dziedzic , linux-wireless@vger.kernel.org, Michal Kazior X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, 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 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;