linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Elder <elder@linaro.org>
To: davem@davemloft.net, kuba@kernel.org
Cc: elder@kernel.org, evgreen@chromium.org,
	bjorn.andersson@linaro.org, cpratapa@codeaurora.org,
	subashab@codeaurora.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH net-next] net: ipa: pass checksum trailer with received packets
Date: Wed, 10 Feb 2021 15:13:49 -0600	[thread overview]
Message-ID: <20210210211349.13158-1-elder@linaro.org> (raw)

For a QMAP RX endpoint, received packets will be passed to the RMNet
driver.  If RX checksum offload is enabled, the RMNet driver expects
to find a trailer following each packet that contains computed
checksum information.  Currently the IPA driver is passing the
packet without the trailer.

Fix this bug.

Fixes: 84f9bd12d46db ("soc: qcom: ipa: IPA endpoints")
Signed-off-by: Alex Elder <elder@linaro.org>
---

David/Jakub,
I would like to have this back-ported as bug fix.  At its core, the
fix is simple, but even if it were reduced to a one-line change, the
result won't cleanly apply to both net/master and net-next/master.
How should this be handled?  What can I do to make it easier?

Thanks.

					-Alex

 drivers/net/ipa/ipa_endpoint.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c
index 7209ee3c31244..5e3c2b3f38a95 100644
--- a/drivers/net/ipa/ipa_endpoint.c
+++ b/drivers/net/ipa/ipa_endpoint.c
@@ -1232,6 +1232,11 @@ static void ipa_endpoint_status_parse(struct ipa_endpoint *endpoint,
 	void *data = page_address(page) + NET_SKB_PAD;
 	u32 unused = IPA_RX_BUFFER_SIZE - total_len;
 	u32 resid = total_len;
+	u32 trailer_len = 0;
+
+	/* If checksum offload is enabled, each packet includes a trailer */
+	if (endpoint->data->checksum)
+		trailer_len = sizeof(struct rmnet_map_dl_csum_trailer);
 
 	while (resid) {
 		const struct ipa_status *status = data;
@@ -1260,18 +1265,18 @@ static void ipa_endpoint_status_parse(struct ipa_endpoint *endpoint,
 		 */
 		align = endpoint->data->rx.pad_align ? : 1;
 		len = le16_to_cpu(status->pkt_len);
-		len = sizeof(*status) + ALIGN(len, align);
-		if (endpoint->data->checksum)
-			len += sizeof(struct rmnet_map_dl_csum_trailer);
+		len = sizeof(*status) + ALIGN(len, align) + trailer_len;
 
 		if (!ipa_endpoint_status_drop(endpoint, status)) {
 			void *data2;
 			u32 extra;
 			u32 len2;
 
-			/* Client receives only packet data (no status) */
+			/* Strip off the status element and pass only the
+			 * packet data (plus checksum trailer if enabled).
+			 */
 			data2 = data + sizeof(*status);
-			len2 = le16_to_cpu(status->pkt_len);
+			len2 = le16_to_cpu(status->pkt_len) + trailer_len;
 
 			/* Have the true size reflect the extra unused space in
 			 * the original receive buffer.  Distribute the "cost"
-- 
2.20.1


             reply	other threads:[~2021-02-10 21:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-10 21:13 Alex Elder [this message]
2021-02-11 11:25 ` [PATCH net-next] net: ipa: pass checksum trailer with received packets Alex Elder

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=20210210211349.13158-1-elder@linaro.org \
    --to=elder@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=cpratapa@codeaurora.org \
    --cc=davem@davemloft.net \
    --cc=elder@kernel.org \
    --cc=evgreen@chromium.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=subashab@codeaurora.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).