Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1141442lqb; Thu, 30 May 2024 01:07:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVX9080IhLYOqJ78a3UXV1f9D6hu9nCjc+aZgXB4rII/ltVEWulvaBfcJqwttfaYpeIQKQGOyAIfNF36BU/trM3Zb1I3Ew5NyPv4EUGtg== X-Google-Smtp-Source: AGHT+IGYKE9Mg6i1VQE03pvPhMWesDoOYYkY0zQkxQTmOb4+/Nks8aSCy/hPbra5ucfVvWztH2kr X-Received: by 2002:a50:8d8d:0:b0:578:4b06:fdf7 with SMTP id 4fb4d7f45d1cf-57a177f88d4mr782947a12.25.1717056431532; Thu, 30 May 2024 01:07:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717056431; cv=pass; d=google.com; s=arc-20160816; b=U8bU1lJvrCd0g7BTxpGPZdT7YE0twFgl9r/wDJui+HbRJGPYPC/b3fBBENx1JD7rjv q10RKwJDN79FFwaaop2I8t/W7DccMScYfdM32cGmo2XExgQQACRLHhEemW86kmRR2mQ7 NMDhZsw+pcyz1vt0DF6SDIb2IXp6MiZC7znWRlTNWoyi+1O6hnQvRQQ6adJlOyDkp7OI wwB1v/XM/nugQoWptdLAmRwJmJGvrXfmZzKvXqxAWKu/LNdHV4NBsXsbYmq+rcICoba2 YWwrexVpzqgDgwR2WDaVkvBWdi1WwBFpt8vtuoTqILrTK7yfXOGNZGJtt1fhNTxx9mwX LDLg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=qexI4QGXkxBpctS6P9RXu0XZbRrPHyV+9mwGN0BskeU=; fh=s0colnkX5wi8KIsz208x0GXi6hebndwDqa/JmwJPUNc=; b=F6OLLtSVxxFo6FF2506QpQxbBoVXJkYeo41AM1zJFUuMDi4tIkbNFIx96z2TIVJ7b4 aluNpsfWUgUErWvEgpttreI7o25z3kDuyTTE9ljNduOiaiL/RDjQUJJ8PqFEGRQ9pfug 81FP3MzKY/LUsfyzZWNhSTsWWU+88Gg0qAEoAs2SC9w30bNw62rg8cKDcE/H/jzCCbEF AqYnF3og8EZbiSwsFT9nbPmiaUiBm93+ymS45TzjsK4FCtMxVAbjk4Q9I4gO8lnBwbcE Le8DLty+0wqp1J9pqb9+vm1FKvm4MoqxfE+V24EvyVNxnlrfp8RxTF8bYVIlCmRpgAoM IQFw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="GD/Y+GHC"; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-wireless+bounces-8305-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8305-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-579c492233bsi5639530a12.323.2024.05.30.01.07.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 01:07:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-8305-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="GD/Y+GHC"; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-wireless+bounces-8305-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8305-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 42CCF1F22E00 for ; Thu, 30 May 2024 08:07:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BEFF81459EF; Thu, 30 May 2024 08:07:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="GD/Y+GHC" X-Original-To: linux-wireless@vger.kernel.org Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C3613176AD2; Thu, 30 May 2024 08:07:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.141 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717056427; cv=none; b=dlKOihIdW3+F5VXgTed5PpSxMSILggiuUJgph+/4j5+IbjRZXeyLztjtvlTbDFhtq552HJaHzKx/QAarDvd3R5SQFHEpYYmruAQqbH7/YNyS+gqhLU+AAbjozL1Yp+ZRL9ipjenVwVRNcjlTKc3AUMM8bg3vIhdoUUHeJtBAvsw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717056427; c=relaxed/simple; bh=f2yIws9zTPZwAdY+cKgAvCt/JJvMVgXx7fnZPjo/WDA=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=L4q1yaq4rmNACvUY0nLvpxs/0knd00eLrN9RtNqd1V9pw0beuyGJcKVFPFVjeAI3IJe5gg5vZLshLFBHh/9UQ+2+CZ20CvOecj4aESke22LTQjCRq1NDIezQR95rQ2x/7cYCBLZmb5c8CrtxfakUF+dCFGLaHNhAySmxhDuzi38= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=GD/Y+GHC; arc=none smtp.client-ip=198.47.19.141 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 44U86hXQ105654; Thu, 30 May 2024 03:06:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1717056403; bh=qexI4QGXkxBpctS6P9RXu0XZbRrPHyV+9mwGN0BskeU=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=GD/Y+GHCbkPQTFf6M2YTDR8OyFvHUL59wDoTRQrO10+HyldYZ8mjfUDv7WODoQn8f R4cZkh9uD9i5J22DvXx3FzPH88Ytcg7ZWgO0ECK78sWsx1SbP3hxyRmGIWBEIFsiHZ kP+8EfKBN84/DVb/zWVS2pXvUyaabueSpimu9qpQ= Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 44U86hTg009239 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 30 May 2024 03:06:43 -0500 Received: from lewvowa02.ent.ti.com (10.180.75.80) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 30 May 2024 03:06:43 -0500 Received: from DLEE108.ent.ti.com (157.170.170.38) by lewvowa02.ent.ti.com (10.180.75.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2507.34; Thu, 30 May 2024 03:06:42 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Thu, 30 May 2024 03:06:42 -0500 Received: from [137.167.6.219] (lt5cg1094w5k.dhcp.ti.com [137.167.6.219]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 44U86fDk114845; Thu, 30 May 2024 03:06:41 -0500 Message-ID: Date: Thu, 30 May 2024 11:06:40 +0300 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [EXTERNAL] [PATCH wireless-next 6/8] wifi: wlcore: add pn16 support To: "Russell King (Oracle)" , Kalle Valo CC: Johannes Berg , , References: Content-Language: en-US From: "Nemanov, Michael" In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 On 5/28/2024 12:18 PM, Russell King (Oracle) wrote: [...] > > static int wlcore_fw_status(struct wl1271 *wl, struct wl_fw_status *status) > { > + struct wl12xx_vif *wlvifsta; > + struct wl12xx_vif *wlvifap; > struct wl12xx_vif *wlvif; > u32 old_tx_blk_count = wl->tx_blocks_available; > int avail, freed_blocks; > @@ -410,23 +412,100 @@ static int wlcore_fw_status(struct wl1271 *wl, struct wl_fw_status *status) > wl->tx_pkts_freed[i] = status->counters.tx_released_pkts[i]; > } > [...] > for_each_set_bit(i, wl->links_map, wl->num_links) { > + u16 diff16, sec_pn16; > u8 diff, tx_lnk_free_pkts; > + > lnk = &wl->links[i]; > > /* prevent wrap-around in freed-packets counter */ > tx_lnk_free_pkts = status->counters.tx_lnk_free_pkts[i]; > diff = (tx_lnk_free_pkts - lnk->prev_freed_pkts) & 0xff; > > - if (diff == 0) > + if (diff) { > + lnk->allocated_pkts -= diff; > + lnk->prev_freed_pkts = tx_lnk_free_pkts; > + } > + > + /* Get the current sec_pn16 value if present */ > + if (status->counters.tx_lnk_sec_pn16) > + sec_pn16 = __le16_to_cpu(status->counters.tx_lnk_sec_pn16[i]); > + else > + sec_pn16 = 0; > + /* prevent wrap-around in pn16 counter */ > + diff16 = (sec_pn16 - lnk->prev_sec_pn16) & 0xffff; > + > + /* FIXME: since free_pkts is a 8-bit counter of packets that > + * rolls over, it can become zero. If it is zero, then we > + * omit processing below. Is that really correct? > + */ > + if (tx_lnk_free_pkts <= 0) > continue; > The original code was         tx_lnk_free_pkts = status->counters.tx_lnk_free_pkts[i];         diff = (tx_lnk_free_pkts - lnk->prev_freed_pkts) & 0xff;         if (diff == 0)             continue; I wonder if comparing tx_lnk_free_pkts to 0 was added intentionally? This is monotonously incremented counter so 0 is not significant, unlike the diff. Have I missed something? Michael.