All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Matyukevich OS <sergey.matyukevich.os@quantenna.com>
To: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: Igor Mitsyanko OS <igor.mitsyanko.os@quantenna.com>,
	Sergey Matyukevich OS <sergey.matyukevich.os@quantenna.com>
Subject: [PATCH 12/13] qtnfmac: drop redundant data copy in control path
Date: Tue, 2 Oct 2018 09:26:09 +0000	[thread overview]
Message-ID: <20181002092542.18966-13-sergey.matyukevich.os@quantenna.com> (raw)
In-Reply-To: <20181002092542.18966-1-sergey.matyukevich.os@quantenna.com>

Command responses and events from the firmware are copied twice in
control path: at first in shm core (qtnf_shm_handle_new_data) and
then in pcie bus drivers (qtnf_pcie_control_rx_callback). There
is no need to copy this data twice, it can be done only once
in rx callbacks.

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
---
 drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c |  5 +++--
 drivers/net/wireless/quantenna/qtnfmac/shm_ipc.c   | 13 ++++++-------
 drivers/net/wireless/quantenna/qtnfmac/shm_ipc.h   |  4 +---
 3 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
index d1637f2354a6..16795dbe475b 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
@@ -242,7 +242,8 @@ static int qtnf_pcie_init_memory(struct qtnf_pcie_bus_priv *priv)
 	return 0;
 }
 
-static void qtnf_pcie_control_rx_callback(void *arg, const u8 *buf, size_t len)
+static void qtnf_pcie_control_rx_callback(void *arg, const u8 __iomem *buf,
+					  size_t len)
 {
 	struct qtnf_pcie_bus_priv *priv = arg;
 	struct qtnf_bus *bus = pci_get_drvdata(priv->pdev);
@@ -260,7 +261,7 @@ static void qtnf_pcie_control_rx_callback(void *arg, const u8 *buf, size_t len)
 		return;
 	}
 
-	skb_put_data(skb, buf, len);
+	memcpy_fromio(skb_put(skb, len), buf, len);
 
 	qtnf_trans_handle_rx_ctl_packet(bus, skb);
 }
diff --git a/drivers/net/wireless/quantenna/qtnfmac/shm_ipc.c b/drivers/net/wireless/quantenna/qtnfmac/shm_ipc.c
index aa106dd0a14b..2ec334199c2b 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/shm_ipc.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/shm_ipc.c
@@ -42,19 +42,18 @@ static void qtnf_shm_handle_new_data(struct qtnf_shm_ipc *ipc)
 	if (unlikely(size == 0 || size > QTN_IPC_MAX_DATA_SZ)) {
 		pr_err("wrong rx packet size: %zu\n", size);
 		rx_buff_ok = false;
-	} else {
-		memcpy_fromio(ipc->rx_data, ipc->shm_region->data, size);
+	}
+
+	if (likely(rx_buff_ok)) {
+		ipc->rx_packet_count++;
+		ipc->rx_callback.fn(ipc->rx_callback.arg,
+				    ipc->shm_region->data, size);
 	}
 
 	writel(QTNF_SHM_IPC_ACK, &shm_reg_hdr->flags);
 	readl(&shm_reg_hdr->flags); /* flush PCIe write */
 
 	ipc->interrupt.fn(ipc->interrupt.arg);
-
-	if (likely(rx_buff_ok)) {
-		ipc->rx_packet_count++;
-		ipc->rx_callback.fn(ipc->rx_callback.arg, ipc->rx_data, size);
-	}
 }
 
 static void qtnf_shm_ipc_irq_work(struct work_struct *work)
diff --git a/drivers/net/wireless/quantenna/qtnfmac/shm_ipc.h b/drivers/net/wireless/quantenna/qtnfmac/shm_ipc.h
index 453dd6477b12..c2a3702a9ee7 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/shm_ipc.h
+++ b/drivers/net/wireless/quantenna/qtnfmac/shm_ipc.h
@@ -32,7 +32,7 @@ struct qtnf_shm_ipc_int {
 };
 
 struct qtnf_shm_ipc_rx_callback {
-	void (*fn)(void *arg, const u8 *buf, size_t len);
+	void (*fn)(void *arg, const u8 __iomem *buf, size_t len);
 	void *arg;
 };
 
@@ -51,8 +51,6 @@ struct qtnf_shm_ipc {
 
 	u8 waiting_for_ack;
 
-	u8 rx_data[QTN_IPC_MAX_DATA_SZ] __aligned(sizeof(u32));
-
 	struct qtnf_shm_ipc_int interrupt;
 	struct qtnf_shm_ipc_rx_callback rx_callback;
 
-- 
2.11.0


  parent reply	other threads:[~2018-10-02  9:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-02  9:25 [PATCH 00/13] qtnfmac: fixes and cleanups for STA mode Sergey Matyukevich OS
2018-10-02  9:25 ` [PATCH 01/13] qtnfmac: do not track STA states in driver Sergey Matyukevich OS
2018-10-02  9:25 ` [PATCH 02/13] qtnfmac: generate local disconnect event in disconnect callback Sergey Matyukevich OS
2018-10-02  9:25 ` [PATCH 03/13] qtnfmac: request userspace to do OBSS scanning if FW can not Sergey Matyukevich OS
2018-10-02  9:25 ` [PATCH 04/13] qtnfmac: do not initialize per-MAC data multiple times Sergey Matyukevich OS
2018-10-02  9:26 ` [PATCH 05/13] qtnfmac: cleanup and unify command error handling Sergey Matyukevich OS
2018-10-02  9:26 ` [PATCH 06/13] qtnfmac: do not cancel scan in disconnect callback Sergey Matyukevich OS
2018-10-02  9:26 ` [PATCH 07/13] qtnfmac: pass sgi rate info flag to wireless core Sergey Matyukevich OS
2018-10-02  9:26 ` [PATCH 08/13] qtnfmac: pass supported extended capabilities to wiphy Sergey Matyukevich OS
2018-10-02  9:26 ` [PATCH 09/13] qtnfmac: drop error reports for out-of-bounds key indexes Sergey Matyukevich OS
2018-10-02  9:26 ` [PATCH 10/13] qtnfmac: add support for scan flush Sergey Matyukevich OS
2018-10-02  9:26 ` [PATCH 11/13] qtnfmac: add support for scan dwell time configuration Sergey Matyukevich OS
2018-10-02  9:26 ` Sergey Matyukevich OS [this message]
2018-10-02  9:26 ` [PATCH 13/13] qtnfmac: implement dump_station support for STA mode Sergey Matyukevich OS
2018-10-05  8:19 ` [PATCH 00/13] qtnfmac: fixes and cleanups " Kalle Valo
2018-10-05  9:56   ` Sergey Matyukevich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181002092542.18966-13-sergey.matyukevich.os@quantenna.com \
    --to=sergey.matyukevich.os@quantenna.com \
    --cc=igor.mitsyanko.os@quantenna.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.