From patchwork Wed May 7 15:53:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Merello X-Patchwork-Id: 4130151 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 E22D0BFF02 for ; Wed, 7 May 2014 15:53:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 27BB020222 for ; Wed, 7 May 2014 15:53:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2E05B2024D for ; Wed, 7 May 2014 15:53:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934054AbaEGPx0 (ORCPT ); Wed, 7 May 2014 11:53:26 -0400 Received: from mail-ee0-f54.google.com ([74.125.83.54]:41984 "EHLO mail-ee0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933936AbaEGPxX (ORCPT ); Wed, 7 May 2014 11:53:23 -0400 Received: by mail-ee0-f54.google.com with SMTP id b57so885933eek.41 for ; Wed, 07 May 2014 08:53:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=vsBXab1oA1AsNvXBnMwMUgYM6FYHf+nNqY86FLD+7HI=; b=v91vsNsRM4YR40Rlkr/AwqLI4C2Z6MMAX308ACy+pmJU+oeMJ1zILCDNQmEKeZOS6F nZ2bTKhdUfiucnT6zcNU6nFtKWRTOGTYjj7vPm9i4SGJhOYbNt9JwmBJinw5t96tA+Ba ZBHnZTF4KUx0MGUVMnSYiMAuZvKdu50ShrboLkpEhvv2PKqJYfuYX6pV+2q6kj4ajswz Vvt+jXZ2PtaPeCst0ydTbEfJlQmHu3zVgBk+l6X7cLB2cmZFqd7/nO1lTypMDbyizfNu Y0ENa43BMM3PRfPJRJE+PWkUNKS54ci1bqFP+Gu6Qjp73YAsm4edYETnLqZgYqQqtiRb UsVA== X-Received: by 10.15.31.70 with SMTP id x46mr46796913eeu.26.1399478001754; Wed, 07 May 2014 08:53:21 -0700 (PDT) Received: from localhost.localdomain (host84-126-dynamic.54-82-r.retail.telecomitalia.it. [82.54.126.84]) by mx.google.com with ESMTPSA id y51sm47215491eeu.0.2014.05.07.08.53.20 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 07 May 2014 08:53:21 -0700 (PDT) From: Andrea Merello To: linville@tuxdriver.com Cc: linux-wireless@vger.kernel.org, Larry.Finger@lwfinger.net, bernhard@schiffner-limbach.de, dan.carpenter@oracle.com, Andrea Merello Subject: [PATCH 3/4] rtl8180: make CTS-to-self protection work Date: Wed, 7 May 2014 17:53:17 +0200 Message-Id: <1399477997-26455-1-git-send-email-andrea.merello@gmail.com> X-Mailer: git-send-email 1.8.3.2 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 CTS protection was not working properly because the HW still need RTS flag to be asserted, and it need also RTS rate field to be set with CTS-to-self rate and RTS duration field to be filled with CTS-to-self duration. This patch makes the driver to do this. Signed-off-by: Andrea Merello --- drivers/net/wireless/rtl818x/rtl8180/dev.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/rtl818x/rtl8180/dev.c b/drivers/net/wireless/rtl818x/rtl8180/dev.c index 8d07df2..2c1c02b 100644 --- a/drivers/net/wireless/rtl818x/rtl8180/dev.c +++ b/drivers/net/wireless/rtl818x/rtl8180/dev.c @@ -463,18 +463,23 @@ static void rtl8180_tx(struct ieee80211_hw *dev, RTL818X_TX_DESC_FLAG_NO_ENC; rc_flags = info->control.rates[0].flags; + + /* HW will perform RTS-CTS when only RTS flags is set. + * HW will perform CTS-to-self when both RTS and CTS flags are set. + * RTS rate and RTS duration will be used also for CTS-to-self. + */ if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS) { tx_flags |= RTL818X_TX_DESC_FLAG_RTS; tx_flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; + rts_duration = ieee80211_rts_duration(dev, priv->vif, + skb->len, info); } else if (rc_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { - tx_flags |= RTL818X_TX_DESC_FLAG_CTS; + tx_flags |= RTL818X_TX_DESC_FLAG_RTS | RTL818X_TX_DESC_FLAG_CTS; tx_flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; + rts_duration = ieee80211_ctstoself_duration(dev, priv->vif, + skb->len, info); } - if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS) - rts_duration = ieee80211_rts_duration(dev, priv->vif, skb->len, - info); - if (priv->chip_family == RTL818X_CHIP_FAMILY_RTL8180) { unsigned int remainder;