lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211223011358.4031459-36-davidm@egauge.net>
Date:   Thu, 23 Dec 2021 01:14:07 +0000 (UTC)
From:   David Mosberger-Tang <davidm@...uge.net>
To:     Ajay Singh <ajay.kathat@...rochip.com>
Cc:     Claudiu Beznea <claudiu.beznea@...rochip.com>,
        Kalle Valo <kvalo@...nel.org>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        David Mosberger-Tang <davidm@...uge.net>
Subject: [PATCH v2 35/50] wilc1000: introduce copy_and_send_packets() helper
 function

Continuing the quest of simplifying the txq handler, factor the code
to copy and send packets into its own function.

Signed-off-by: David Mosberger-Tang <davidm@...uge.net>
---
 .../net/wireless/microchip/wilc1000/wlan.c    | 23 ++++++++++++++-----
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index 803d35b18d2e0..18b1e7fad4d71 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -906,6 +906,22 @@ static int send_packets(struct wilc *wilc, int len)
 	return func->hif_block_tx_ext(wilc, 0, wilc->tx_buffer, len);
 }
 
+static int copy_and_send_packets(struct wilc *wilc, int entries,
+				 u32 vmm_table[WILC_VMM_TBL_SIZE],
+				 u8 vmm_entries_ac[WILC_VMM_TBL_SIZE])
+{
+	int len, ret;
+
+	len = copy_packets(wilc, entries, vmm_table, vmm_entries_ac);
+	if (len <= 0)
+		return len;
+
+	acquire_bus(wilc, WILC_BUS_ACQUIRE_ONLY);
+	ret = send_packets(wilc, len);
+	release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
+	return ret;
+}
+
 int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
 {
 	int vmm_table_len, entries;
@@ -940,12 +956,7 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
 	if (entries <= 0) {
 		ret = entries;
 	} else {
-		ret = copy_packets(wilc, entries, vmm_table, vmm_entries_ac);
-		if (ret > 0) {
-			acquire_bus(wilc, WILC_BUS_ACQUIRE_ONLY);
-			ret = send_packets(wilc, ret);
-			release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
-		}
+		ret = copy_and_send_packets(wilc, entries, vmm_table, vmm_entries_ac);
 	}
 	if (ret >= 0 && entries < vmm_table_len)
 		ret = WILC_VMM_ENTRY_FULL_RETRY;
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ