From patchwork Tue May 5 21:12:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Malcolm Priestley X-Patchwork-Id: 215714 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE7F5C47254 for ; Tue, 5 May 2020 21:12:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B368D206FA for ; Tue, 5 May 2020 21:12:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RiKHfoTU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729054AbgEEVMJ (ORCPT ); Tue, 5 May 2020 17:12:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726350AbgEEVMI (ORCPT ); Tue, 5 May 2020 17:12:08 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C640C061A0F for ; Tue, 5 May 2020 14:12:08 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id u127so59407wmg.1 for ; Tue, 05 May 2020 14:12:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=bS/cZOt/hptvsdPV4RhZemHIC9RWIuhYXFdYJuvfz4Q=; b=RiKHfoTU0lmqEt9zFwCmUgcmU8yfa3rf3uHGQLGPH6JTAPoAAww7WlKWNxNgzLDt80 0KV/EY6/v2KJJzFmPiBZJrBJB1xABlIEiENNLX+CsWXxJzZ9qU/f1/Go7OpFFatssXnc 82IvFupbR72GbV/vMzyveSa3ADB5+sIBhMNtnFer5l58/vl6IY6J9FqZBXfCvNQh949D ivICHK1u3NxJn9kQRWj/Qi4hkliAZ529ooStE1z8Mf2axzq16phWAvcG42MgtbkmPUET 7Q+CrN15u22bamCZcs/z5Pd5RWPBL0X9Q2mGsNAr/m5KbNU7v+eCeTEOt+7VVBIZLLEV ZgGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=bS/cZOt/hptvsdPV4RhZemHIC9RWIuhYXFdYJuvfz4Q=; b=sTE3OqSSiw5E9tM563e4LPBL5hnZ7lyr2ZEoy1ZDEFmTfLcBzKHpjit5gLy0DMVElL BrWDsnsxX7u9r8rmzn0HQQ6qJC5mqtV5fC0EdaJ78T9PK62HZujrPLAE/7KM8AfACcxX xLpn9khg0sZ1nfKaJCNElG69F9qOcChS2i5mmdEDAWGyvPxyi8/0mscCZvzVNljpmWZ2 dPE3io8gjfcnhbf7HWHW9M5/0lgE60qbdsPqCG9iREtXB2p8tasFLQBfp1jS4tSdfjlL O6bL1iAhobHrT4rLICIvZOEXGbKXsy8nJ03YL6x6jPrkE8Fe4Wn50VkpEUFnKfXOfp5s w+VQ== X-Gm-Message-State: AGi0PuaTw8oQiadAKFmn5E9dWHnybpDouuHJT394KO0kfN+5vhZZzA2k jEAt99bpVxa6ICpTgQv+kyc= X-Google-Smtp-Source: APiQypJoIVCggnHBJVTQ/nK2vRO3YfMsPgL6hAJAdn4WVKzZ9rzKYPgNvWNvmCL63P/8680u75L/lw== X-Received: by 2002:a7b:c390:: with SMTP id s16mr556784wmj.14.1588713127172; Tue, 05 May 2020 14:12:07 -0700 (PDT) Received: from [192.168.43.18] (188.29.165.117.threembb.co.uk. [188.29.165.117]) by smtp.gmail.com with ESMTPSA id k9sm5452228wrd.17.2020.05.05.14.12.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 May 2020 14:12:06 -0700 (PDT) From: Malcolm Priestley Subject: [PATCH 1/6] staging: vt6656: vnt_rxtx_rsvtime_le16 to use ieee80211_generic_frame_duration. To: Greg Kroah-Hartman Cc: "devel@driverdev.osuosl.org" , linux-wireless@vger.kernel.org, Oscar Carter Message-ID: Date: Tue, 5 May 2020 22:12:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 Content-Language: en-US Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org ieee80211_generic_frame_duration is the mac80211 equivalent to vnt_get_rsvtime use this to get our frame time. There is a change where there is rrv_time_a and rrv_time_b the frame duration is always the same so both are equal. Signed-off-by: Malcolm Priestley --- drivers/staging/vt6656/rxtx.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c index 68be0fa7b201..6724b213a723 100644 --- a/drivers/staging/vt6656/rxtx.c +++ b/drivers/staging/vt6656/rxtx.c @@ -216,11 +216,16 @@ static u32 vnt_get_rsvtime(struct vnt_private *priv, u8 pkt_type, return data_time; } -static __le16 vnt_rxtx_rsvtime_le16(struct vnt_private *priv, u8 pkt_type, - u32 frame_length, u16 rate, int need_ack) +static __le16 vnt_rxtx_rsvtime_le16(struct vnt_usb_send_context *context) { - return cpu_to_le16((u16)vnt_get_rsvtime(priv, pkt_type, - frame_length, rate, need_ack)); + struct vnt_private *priv = context->priv; + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(context->skb); + struct ieee80211_rate *rate = ieee80211_get_tx_rate(priv->hw, info); + + return ieee80211_generic_frame_duration(priv->hw, + info->control.vif, info->band, + context->frame_len, + rate); } static __le16 vnt_get_rtscts_rsvtime_le(struct vnt_private *priv, u8 rsv_type, @@ -465,7 +470,6 @@ static void vnt_rxtx_rts(struct vnt_usb_send_context *tx_context, union vnt_tx_data_head *head = &tx_head->tx_rts.tx.head; u32 frame_len = tx_context->frame_len; u16 current_rate = tx_context->tx_rate; - u8 need_ack = tx_context->need_ack; buf->rts_rrv_time_aa = vnt_get_rtscts_rsvtime_le(priv, 2, tx_context->pkt_type, frame_len, current_rate); @@ -474,11 +478,8 @@ static void vnt_rxtx_rts(struct vnt_usb_send_context *tx_context, buf->rts_rrv_time_bb = vnt_get_rtscts_rsvtime_le(priv, 0, tx_context->pkt_type, frame_len, current_rate); - buf->rrv_time_a = vnt_rxtx_rsvtime_le16(priv, tx_context->pkt_type, - frame_len, current_rate, - need_ack); - buf->rrv_time_b = vnt_rxtx_rsvtime_le16(priv, PK_TYPE_11B, frame_len, - priv->top_cck_basic_rate, need_ack); + buf->rrv_time_a = vnt_rxtx_rsvtime_le16(tx_context); + buf->rrv_time_b = buf->rrv_time_a; if (need_mic) head = &tx_head->tx_rts.tx.mic.head; @@ -494,12 +495,9 @@ static void vnt_rxtx_cts(struct vnt_usb_send_context *tx_context, union vnt_tx_data_head *head = &tx_head->tx_cts.tx.head; u32 frame_len = tx_context->frame_len; u16 current_rate = tx_context->tx_rate; - u8 need_ack = tx_context->need_ack; - buf->rrv_time_a = vnt_rxtx_rsvtime_le16(priv, tx_context->pkt_type, - frame_len, current_rate, need_ack); - buf->rrv_time_b = vnt_rxtx_rsvtime_le16(priv, PK_TYPE_11B, - frame_len, priv->top_cck_basic_rate, need_ack); + buf->rrv_time_a = vnt_rxtx_rsvtime_le16(tx_context); + buf->rrv_time_b = buf->rrv_time_a; buf->cts_rrv_time_ba = vnt_get_rtscts_rsvtime_le(priv, 3, tx_context->pkt_type, frame_len, current_rate); @@ -519,10 +517,8 @@ static void vnt_rxtx_ab(struct vnt_usb_send_context *tx_context, union vnt_tx_data_head *head = &tx_head->tx_ab.tx.head; u32 frame_len = tx_context->frame_len; u16 current_rate = tx_context->tx_rate; - u8 need_ack = tx_context->need_ack; - buf->rrv_time = vnt_rxtx_rsvtime_le16(priv, tx_context->pkt_type, - frame_len, current_rate, need_ack); + buf->rrv_time = vnt_rxtx_rsvtime_le16(tx_context); if (need_mic) head = &tx_head->tx_ab.tx.mic.head; From patchwork Tue May 5 21:15:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Malcolm Priestley X-Patchwork-Id: 215713 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF9A8C47258 for ; Tue, 5 May 2020 21:15:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BB6EA206B8 for ; Tue, 5 May 2020 21:15:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="P6UvQqfl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729338AbgEEVPQ (ORCPT ); Tue, 5 May 2020 17:15:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729335AbgEEVPP (ORCPT ); Tue, 5 May 2020 17:15:15 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C950C061A0F for ; Tue, 5 May 2020 14:15:15 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id 188so177022wmc.2 for ; Tue, 05 May 2020 14:15:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=EGVbbPzyVO01/FIopW3nxXbQ2QWRQV9JRxf2+f7pU/4=; b=P6UvQqflx2ZYERn4eaqY506W5Rur02ytOd9iAp3fhiX4TboDGEdGzxcvDCr5I7Osjl 7pRzLT9GwIUgNFlOJ0S8AGI4AIH3IJWEg7EokoPNsFRK+18JotIzsCQIT/d6n+AoTeyM yShcJtOHQDHsDgt41qOf4nk00EU73qs3AzoGPuSWwjjOHPnvQCUBWD0rxB51p3b8Q50t gZai9+2CmLPODDxy1n+7N5ySATlkxaIFjssCrx24PyzowQI7qJ6dO1AvpXhtvB1pCAHi z04XJr1EGGag2UWWApHgdR725ORJ4ZQZniyt8n6eaAZSdo5M7dtIjNnrsNXDJ3fS9Ny2 ZmyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=EGVbbPzyVO01/FIopW3nxXbQ2QWRQV9JRxf2+f7pU/4=; b=VfPqm0gsc6XVuZI73K8IzVbIMcCuzb59HG033rlm2nOpvHPYWNCMv+FXlRwz/xv3ha tH/I1SW9ByKOXYax4BjPHlVTl0PYcdC/Ksl+DORRIJaFt5Kw1xhZbjjwx4TpHnQwGHv8 vfvrBraUJv7wUkWwZAslOdf880CkIfrapL1M0g7DxM9HS5yQa9Pa8bWy+TuIJi/K0Fkh wCTOROL35FpPJ+PN9h6bbL1SALiFkOCPlBKnbsWhXfUSbMbjEmeEi6InIe+8LOHYB8fw ynTzUn377jca4j9zfkyr4wnllnnRmvd1Ui/UzVLczsb/0FWrDyUpW0Duvz8dE8p0TZTZ dfUQ== X-Gm-Message-State: AGi0PubcGiZGvtgKDmoc90m22BZSov5Ew6b7GJ4+BY9sAvUtUofRtsq6 fBo9diR27kNlHDkNnh5PnO4= X-Google-Smtp-Source: APiQypKV8F3AYlmVJISg2XtrkQm49hI0dMxlxUu0DXgIwqB2WAr6o/1OsZu4cXhcCO65eCr/qDSWLA== X-Received: by 2002:a7b:c417:: with SMTP id k23mr546692wmi.147.1588713314066; Tue, 05 May 2020 14:15:14 -0700 (PDT) Received: from [192.168.43.18] (188.29.165.117.threembb.co.uk. [188.29.165.117]) by smtp.gmail.com with ESMTPSA id 145sm64647wma.1.2020.05.05.14.15.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 May 2020 14:15:13 -0700 (PDT) From: Malcolm Priestley Subject: [PATCH 3/6] staging: vt6656: vnt_get_rtscts_duration_le use ieee80211_ctstoself_duration To: Greg Kroah-Hartman Cc: "devel@driverdev.osuosl.org" , linux-wireless@vger.kernel.org, Oscar Carter Message-ID: Date: Tue, 5 May 2020 22:15:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 Content-Language: en-US Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org use the mac80211 ieee80211_ctstoself_duration for CTS to self frames. Signed-off-by: Malcolm Priestley --- drivers/staging/vt6656/rxtx.c | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c index 48fe16c27d3f..27069ac60b15 100644 --- a/drivers/staging/vt6656/rxtx.c +++ b/drivers/staging/vt6656/rxtx.c @@ -195,27 +195,6 @@ static __le16 vnt_time_stamp_off(struct vnt_private *priv, u16 rate) [rate % MAX_RATE]); } -static u32 vnt_get_rsvtime(struct vnt_private *priv, u8 pkt_type, - u32 frame_length, u16 rate, int need_ack) -{ - u32 data_time, ack_time; - - data_time = vnt_get_frame_time(priv->preamble_type, pkt_type, - frame_length, rate); - - if (pkt_type == PK_TYPE_11B) - ack_time = vnt_get_frame_time(priv->preamble_type, pkt_type, 14, - (u16)priv->top_cck_basic_rate); - else - ack_time = vnt_get_frame_time(priv->preamble_type, pkt_type, 14, - (u16)priv->top_ofdm_basic_rate); - - if (need_ack) - return data_time + priv->sifs + ack_time; - - return data_time; -} - static __le16 vnt_rxtx_rsvtime_le16(struct vnt_usb_send_context *context) { struct vnt_private *priv = context->priv; @@ -285,9 +264,6 @@ static __le16 vnt_get_rtscts_duration_le(struct vnt_usb_send_context *context, u8 dur_type, u8 pkt_type, u16 rate) { struct vnt_private *priv = context->priv; - u32 dur_time = 0; - u32 frame_length = context->frame_len; - u8 need_ack = context->need_ack; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(context->skb); switch (dur_type) { @@ -298,15 +274,13 @@ static __le16 vnt_get_rtscts_duration_le(struct vnt_usb_send_context *context, return ieee80211_rts_duration(priv->hw, priv->vif, context->frame_len, info); case CTSDUR_BA: - dur_time = priv->sifs + vnt_get_rsvtime(priv, - pkt_type, frame_length, rate, need_ack); - break; - + return ieee80211_ctstoself_duration(priv->hw, priv->vif, + context->frame_len, info); default: break; } - return cpu_to_le16((u16)dur_time); + return cpu_to_le16(0); } static u16 vnt_mac_hdr_pos(struct vnt_usb_send_context *tx_context, From patchwork Tue May 5 21:19:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Malcolm Priestley X-Patchwork-Id: 215712 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1944C47247 for ; Tue, 5 May 2020 21:19:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C8BAC206B8 for ; Tue, 5 May 2020 21:19:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="p/cFx7ah" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729236AbgEEVTu (ORCPT ); Tue, 5 May 2020 17:19:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729218AbgEEVTt (ORCPT ); Tue, 5 May 2020 17:19:49 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D055C061A0F for ; Tue, 5 May 2020 14:19:48 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id u127so77939wmg.1 for ; Tue, 05 May 2020 14:19:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=ovg5uG6Er2DJMMJWpEb2o36AuuxqZ1svjaaL2gfkOuo=; b=p/cFx7ahsIoKBGlAo7yncJg/d8vZiWmKJNBjP4A2PY37ho4qrl2f45naLlId8C+8uB VPpUeKc2erJDBNHuGPG8Xzwa1V2Q0jbqnjUr6gE7dqG83XWJoVXsGY4OIL9RrTE11Cke FTffgjLZ7/n0WXTHu8WE03aKCDUVng45jXUsqIOD0gShoiIoyJfx+D8CAZ7GM8TDt3N9 tPSoHokVIVUiQ81fXylJ4U4z3/TO5lA8e+92DBkzL2SCcMkzvxuonPdehz7zgfn0L70V aWMb1jH2PPGameg/m3KEMN+8/RO6Hx+hOEJXU92Z6KTwJMS4CICPYA+63/pvbaSC4HJ0 CsKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=ovg5uG6Er2DJMMJWpEb2o36AuuxqZ1svjaaL2gfkOuo=; b=DPvPYUys/2p14nsV9bPrbiMCbdHGb2eFz0FN1j7umqsy6kbwLS3cuy7K6tcBSC+eiC l+lQN9NccdxOBv+4rsOLLE+S1x0ccKzGgV7d2RVoF2vVkrJUJrvWPAFoCWUQRJ3W5MqK 8lei7yJ1bFS7tKlWxGjdh3hBHyWijYXVqW6jHlcp7PGLgLiugZLcR4frZDbvPo/h9mwt iwHShcYxXfy27yLoXrjqUOznzKHHymIGyUciTlF4+A4jj/ig/HBBQGs6Rr0Hej0d+5sR 4X0EiIYXVId9YMj41VFkPgyGSoame7W26f9FdRmO2aDncvCRBYPA3e4yIeqaBZOoQ80W ZIaQ== X-Gm-Message-State: AGi0PuZlXD1kzcAq03iIYWQPG/VDPsId5RLxhGrclMkQUdMgPBYWB/pA OQ4hR4eitIoNeiBIW3rFyJ0= X-Google-Smtp-Source: APiQypL6uXQsQRD/vg7Kf8cYy0Uo1KmfKVQNNFvHXNq+lUBkhogp/udvkPVIvLZMxiWqAGxazSxUSQ== X-Received: by 2002:a7b:c5d4:: with SMTP id n20mr618983wmk.92.1588713587308; Tue, 05 May 2020 14:19:47 -0700 (PDT) Received: from [192.168.43.18] (188.29.165.117.threembb.co.uk. [188.29.165.117]) by smtp.gmail.com with ESMTPSA id a67sm35988wmc.30.2020.05.05.14.19.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 May 2020 14:19:46 -0700 (PDT) From: Malcolm Priestley Subject: [PATCH 5/6] staging: vt6656: vnt_get_rtscts_rsvtime_le replace with rts/cts duration. To: Greg Kroah-Hartman Cc: "devel@driverdev.osuosl.org" , linux-wireless@vger.kernel.org, Oscar Carter Message-ID: <4c0fe356-7e08-bf66-58b7-5ab683ba9536@gmail.com> Date: Tue, 5 May 2020 22:19:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 Content-Language: en-US Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org rsvtime is the time needed in firmware to process the received frame time in firmware so they can be the same as vnt_get_rts_duration or vnt_get_cts_duration where appropriate. The rts_rrv_time are now all the same timing in vnt_rxtx_rts. So vnt_get_rtscts_rsvtime_le and and vnt_get_frame_time are no longer required. Signed-off-by: Malcolm Priestley --- drivers/staging/vt6656/rxtx.c | 113 ++-------------------------------- 1 file changed, 5 insertions(+), 108 deletions(-) diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c index 47da9dabb133..8348ffe6ebfa 100644 --- a/drivers/staging/vt6656/rxtx.c +++ b/drivers/staging/vt6656/rxtx.c @@ -13,7 +13,6 @@ * * Functions: * vnt_generate_tx_parameter - Generate tx dma required parameter. - * vnt_get_rtscts_rsvtime_le- get rts/cts reserved time * vnt_get_rsvtime- get frame reserved time * vnt_fill_cts_head- fulfill CTS ctl header * @@ -92,37 +91,6 @@ static struct vnt_usb_send_context return NULL; } -/* Frame time for Tx */ -static unsigned int vnt_get_frame_time(u8 preamble_type, u8 pkt_type, - unsigned int frame_length, u16 tx_rate) -{ - unsigned int frame_time; - unsigned int preamble; - unsigned int rate; - - if (tx_rate > RATE_54M) - return 0; - - rate = (unsigned int)vnt_frame_time[tx_rate]; - - if (tx_rate <= RATE_11M) { - if (preamble_type == PREAMBLE_SHORT) - preamble = 96; - else - preamble = 192; - - frame_time = DIV_ROUND_UP(frame_length * 80, rate); - return preamble + frame_time; - } - - frame_time = DIV_ROUND_UP(frame_length * 8 + 22, rate); - frame_time = frame_time * 4; - - if (pkt_type != PK_TYPE_11A) - frame_time += 6; - return 20 + frame_time; -} - /* Get Length, Service, and Signal fields of Phy for Tx */ static void vnt_get_phy_field(struct vnt_private *priv, u32 frame_length, u16 tx_rate, u8 pkt_type, @@ -202,59 +170,6 @@ static __le16 vnt_rxtx_rsvtime_le16(struct vnt_usb_send_context *context) rate); } -static __le16 vnt_get_rtscts_rsvtime_le(struct vnt_private *priv, u8 rsv_type, - u8 pkt_type, u32 frame_length, - u16 current_rate) -{ - u32 rrv_time, rts_time, cts_time, ack_time, data_time; - - rrv_time = 0; - rts_time = 0; - cts_time = 0; - ack_time = 0; - - data_time = vnt_get_frame_time(priv->preamble_type, pkt_type, - frame_length, current_rate); - - if (rsv_type == 0) { - rts_time = vnt_get_frame_time(priv->preamble_type, pkt_type, - 20, priv->top_cck_basic_rate); - ack_time = vnt_get_frame_time(priv->preamble_type, - pkt_type, 14, - priv->top_cck_basic_rate); - cts_time = ack_time; - - } else if (rsv_type == 1) { - rts_time = vnt_get_frame_time(priv->preamble_type, pkt_type, - 20, priv->top_cck_basic_rate); - cts_time = vnt_get_frame_time(priv->preamble_type, pkt_type, - 14, priv->top_cck_basic_rate); - ack_time = vnt_get_frame_time(priv->preamble_type, pkt_type, - 14, priv->top_ofdm_basic_rate); - } else if (rsv_type == 2) { - rts_time = vnt_get_frame_time(priv->preamble_type, pkt_type, - 20, priv->top_ofdm_basic_rate); - ack_time = vnt_get_frame_time(priv->preamble_type, - pkt_type, 14, - priv->top_ofdm_basic_rate); - cts_time = ack_time; - - } else if (rsv_type == 3) { - cts_time = vnt_get_frame_time(priv->preamble_type, pkt_type, - 14, priv->top_cck_basic_rate); - ack_time = vnt_get_frame_time(priv->preamble_type, pkt_type, - 14, priv->top_ofdm_basic_rate); - - rrv_time = cts_time + ack_time + data_time + 2 * priv->sifs; - - return cpu_to_le16((u16)rrv_time); - } - - rrv_time = rts_time + cts_time + ack_time + data_time + 3 * priv->sifs; - - return cpu_to_le16((u16)rrv_time); -} - static __le16 vnt_get_rts_duration(struct vnt_usb_send_context *context) { struct vnt_private *priv = context->priv; @@ -405,18 +320,12 @@ static void vnt_fill_cts_head(struct vnt_usb_send_context *tx_context, static void vnt_rxtx_rts(struct vnt_usb_send_context *tx_context, union vnt_tx_head *tx_head, bool need_mic) { - struct vnt_private *priv = tx_context->priv; struct vnt_rrv_time_rts *buf = &tx_head->tx_rts.rts; union vnt_tx_data_head *head = &tx_head->tx_rts.tx.head; - u32 frame_len = tx_context->frame_len; - u16 current_rate = tx_context->tx_rate; - buf->rts_rrv_time_aa = vnt_get_rtscts_rsvtime_le(priv, 2, - tx_context->pkt_type, frame_len, current_rate); - buf->rts_rrv_time_ba = vnt_get_rtscts_rsvtime_le(priv, 1, - tx_context->pkt_type, frame_len, current_rate); - buf->rts_rrv_time_bb = vnt_get_rtscts_rsvtime_le(priv, 0, - tx_context->pkt_type, frame_len, current_rate); + buf->rts_rrv_time_aa = vnt_get_rts_duration(tx_context); + buf->rts_rrv_time_ba = buf->rts_rrv_time_aa; + buf->rts_rrv_time_bb = buf->rts_rrv_time_aa; buf->rrv_time_a = vnt_rxtx_rsvtime_le16(tx_context); buf->rrv_time_b = buf->rrv_time_a; @@ -430,17 +339,13 @@ static void vnt_rxtx_rts(struct vnt_usb_send_context *tx_context, static void vnt_rxtx_cts(struct vnt_usb_send_context *tx_context, union vnt_tx_head *tx_head, bool need_mic) { - struct vnt_private *priv = tx_context->priv; struct vnt_rrv_time_cts *buf = &tx_head->tx_cts.cts; union vnt_tx_data_head *head = &tx_head->tx_cts.tx.head; - u32 frame_len = tx_context->frame_len; - u16 current_rate = tx_context->tx_rate; buf->rrv_time_a = vnt_rxtx_rsvtime_le16(tx_context); buf->rrv_time_b = buf->rrv_time_a; - buf->cts_rrv_time_ba = vnt_get_rtscts_rsvtime_le(priv, 3, - tx_context->pkt_type, frame_len, current_rate); + buf->cts_rrv_time_ba = vnt_get_cts_duration(tx_context); if (need_mic) head = &tx_head->tx_cts.tx.mic.head; @@ -452,11 +357,8 @@ static void vnt_rxtx_ab(struct vnt_usb_send_context *tx_context, union vnt_tx_head *tx_head, bool need_rts, bool need_mic) { - struct vnt_private *priv = tx_context->priv; struct vnt_rrv_time_ab *buf = &tx_head->tx_ab.ab; union vnt_tx_data_head *head = &tx_head->tx_ab.tx.head; - u32 frame_len = tx_context->frame_len; - u16 current_rate = tx_context->tx_rate; buf->rrv_time = vnt_rxtx_rsvtime_le16(tx_context); @@ -464,12 +366,7 @@ static void vnt_rxtx_ab(struct vnt_usb_send_context *tx_context, head = &tx_head->tx_ab.tx.mic.head; if (need_rts) { - if (tx_context->pkt_type == PK_TYPE_11B) - buf->rts_rrv_time = vnt_get_rtscts_rsvtime_le(priv, 0, - tx_context->pkt_type, frame_len, current_rate); - else /* PK_TYPE_11A */ - buf->rts_rrv_time = vnt_get_rtscts_rsvtime_le(priv, 2, - tx_context->pkt_type, frame_len, current_rate); + buf->rts_rrv_time = vnt_get_rts_duration(tx_context); vnt_rxtx_rts_ab_head(tx_context, &head->rts_ab);