From patchwork Wed May 7 15:54:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Merello X-Patchwork-Id: 4130201 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 424EE9F23C for ; Wed, 7 May 2014 15:55:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 795FB20222 for ; Wed, 7 May 2014 15:55:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D7B8B20253 for ; Wed, 7 May 2014 15:55:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756643AbaEGPyx (ORCPT ); Wed, 7 May 2014 11:54:53 -0400 Received: from mail-ee0-f49.google.com ([74.125.83.49]:36274 "EHLO mail-ee0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756628AbaEGPyw (ORCPT ); Wed, 7 May 2014 11:54:52 -0400 Received: by mail-ee0-f49.google.com with SMTP id e53so888050eek.36 for ; Wed, 07 May 2014 08:54:51 -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=A9t5JQ46JnH6T+VuAqvztbRm54jQDKFl1pPE1HnQ07g=; b=ywMMVyYfRK7i/0xSt4Nq7aOq2coi+EPg63EUe2LnfXBEuk+Y8D8og7sIY6a89woa5D 1C/0QLE1B3OEfXQZEwpXsY0Uvyo72jnG6GCDQ0Jp1k/3Bzg8z85v5uhgA3qJz95urTM+ 1dcP/k8w0g7yfEaaxR7NntP/huGwsvMPEBFKlpqRW7W8emwPa+NJ2rOFM6T7872nDdfE RZuvQ2/uSd8am30jfjjIE480ploYe1lQ6LUBBZ+NrEaqbVBumykAKSUgDz4BIhQLG20C hrOy+1vJxzgQsqv4yWgO73hcc7mxxZbmeVPOmrP8aRgf7JZwMrZ6qu3yEYc+MZXYTdRV V4Ng== X-Received: by 10.15.34.197 with SMTP id e45mr4686528eev.112.1399478091346; Wed, 07 May 2014 08:54:51 -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 y7sm47218994eev.5.2014.05.07.08.54.50 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 07 May 2014 08:54:50 -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 4/4] rtl8187: make CTS-to-self protection work Date: Wed, 7 May 2014 17:54:46 +0200 Message-Id: <1399478086-26586-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 needs RTS flag to be asserted, and it need also 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/rtl8187/dev.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/rtl818x/rtl8187/dev.c b/drivers/net/wireless/rtl818x/rtl8187/dev.c index 6e4b177..629ad8c 100644 --- a/drivers/net/wireless/rtl818x/rtl8187/dev.c +++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c @@ -253,14 +253,21 @@ static void rtl8187_tx(struct ieee80211_hw *dev, flags |= ieee80211_get_tx_rate(dev, info)->hw_value << 24; if (ieee80211_has_morefrags(tx_hdr->frame_control)) flags |= RTL818X_TX_DESC_FLAG_MOREFRAG; + + /* 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 (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) { flags |= RTL818X_TX_DESC_FLAG_RTS; flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; rts_dur = ieee80211_rts_duration(dev, priv->vif, skb->len, info); } else if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { - flags |= RTL818X_TX_DESC_FLAG_CTS; + flags |= RTL818X_TX_DESC_FLAG_RTS | RTL818X_TX_DESC_FLAG_CTS; flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; + rts_dur = ieee80211_ctstoself_duration(dev, priv->vif, + skb->len, info); } if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {