From patchwork Wed Feb 10 21:13:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 380235 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1520010jah; Wed, 10 Feb 2021 13:16:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJyKlvwxzBQ8wc6/6/fPpAw8f1M1yq6ODO+A1Bmq3OEeQ2eE9CmpcBSgdx1NKRdHh+clikD9 X-Received: by 2002:a50:f30a:: with SMTP id p10mr4932768edm.214.1612991809672; Wed, 10 Feb 2021 13:16:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612991809; cv=none; d=google.com; s=arc-20160816; b=fDAGPCLlbcjrF3osB7888NsdQFAvc8q3CmAdfLicjJ5pvMUB349vWnLOp2pZwbb5Hl Z5smSJqc6qdXxrJsVWO4VjS7j/wWEr3/xkHpckJhj2X8ZVkSDurzgmEtOiKP3wwFWauf VePVyTDxBtPF77PfGGiJCqA5f4+OaVZGpFE7WDbWvHv3Ic7HRDsaBf3UJLFbJ0DLwXDf YaQnj/QMTo1Dnxy8zxyVetI1JOm8yVsSTPkVtVeNfrIOo/Dw/LWPEzisst3gbkQQnxqf bG7hYQAK8hUCLM7jPCE5asT65Qm7UkwNjaU7POevN7QvPYOGIKOwBrnvxJ9SKvSw7ja/ tQ2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=wkGHGHCDtF/e56vw7nKTBuP3UHCQdUWg9HZpFXYrggA=; b=XS8YBk9PD7+m/jnNVH8Ppg+QX9NAHF6IY6u5U738fdkerVmLcESh5lcYAnpZYNMV92 SGIdjDfg4dWKGarwEA2riMI40gKfY1wI2M9V9ygimX7PTxAbP8yula2sXNxgmhMLwzfH peN3vfNMvVbzNFFyGNb6XzE2FcDliq6uv9borxCEPUQD+xjTOKW8JYcOT+GLLzTl7Btj BUxSBqKjf+EOZy8+/Mjr0v7nC+b/zizjgaZiRV41sp/GNw/qD0CGqG7cUM3wKTzCq2kI wZty2wTA+Gu0dV9l4ENFI6TlIPZfLWzXdCV1W862uhyDY+EW2AgK7vJXUeYlZhHlVDMP 9y1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Jh9f0ljt; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bg8si2305333ejb.155.2021.02.10.13.16.49; Wed, 10 Feb 2021 13:16:49 -0800 (PST) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Jh9f0ljt; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233355AbhBJVQY (ORCPT + 9 others); Wed, 10 Feb 2021 16:16:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233521AbhBJVPm (ORCPT ); Wed, 10 Feb 2021 16:15:42 -0500 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D863BC061788 for ; Wed, 10 Feb 2021 13:13:54 -0800 (PST) Received: by mail-il1-x12e.google.com with SMTP id a16so3228215ilq.5 for ; Wed, 10 Feb 2021 13:13:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=wkGHGHCDtF/e56vw7nKTBuP3UHCQdUWg9HZpFXYrggA=; b=Jh9f0ljt8Jhp+qw+yxtvXzyErFX+M3LwJERppl/c3WO3UsxWbzHyBUpI1DBT+EH3nJ 43F8yDWf3EuwgrgrNZ0CWmWFgL1D26RAoMcEY+u0x1RaVLNrwlre6K9qmx8HjR4p3elV Hzlpfx9o23l5EgrFk36pQzqkmnbOHbyNV8A9pC4ezk2LuovAAFSwNnQofDEqsu4y5HgM IZNoH7ZJvAiG4J/lQfq3dMGAUn36xRL9++Es+hQC5N+2huEx38Ha47QBO2EuBY0s8Uti TNAX7706iRTGqeLJZVvbHXjAkuhLAWfT7VULCMrfAPimnTBFaE4yqUvA5L/gtklYqrUT tacg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=wkGHGHCDtF/e56vw7nKTBuP3UHCQdUWg9HZpFXYrggA=; b=qrZ2OXqlXjt1x4aA4ic7BcfxmveyR1PnR5fXNzb+YH3zYKJ1igT3Jbfe48gdDOFeKi MAsqLxvWfRUDqrkiBpSAW4qHZiI32M0qwJ7DfonHZNjzbFAq3qp8JXfZLMvmbHcAZp1m txGaRUfz8VKWlHk7Q1c/KJkTNY8R54cf6XHFrgr3FoYLI/9X3G7LHLRLMWavH+aO3vEW Ok2QaWpmrwgtkbmn3OuqI+QNZWggRcWy+DQtEfCN+ra+fusCPFRiRoM74Kjh8YdSP8/e 7sAX1HVzu7ZH1Zsmk1RgetE/VAeHdx++jbKwZOalmYIcYbeMb8+Gb3UX6OI5i/IGOpM8 t/Pw== X-Gm-Message-State: AOAM533CSZkNaWXyfW0eR8LhxP04BO0aea1U13FklthOyXuQyod4H3+X WsRWiIIByr8rQ8DyQDSSMBvbuQ== X-Received: by 2002:a92:d11:: with SMTP id 17mr2997477iln.57.1612991632527; Wed, 10 Feb 2021 13:13:52 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id v1sm1549546ilm.35.2021.02.10.13.13.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 13:13:51 -0800 (PST) From: Alex Elder 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 Message-Id: <20210210211349.13158-1-elder@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- 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(-) -- 2.20.1 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"