From patchwork Wed Jun 2 12:41:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 452503 Delivered-To: patch@linaro.org Received: by 2002:a02:c735:0:0:0:0:0 with SMTP id h21csp536153jao; Wed, 2 Jun 2021 05:43:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwouOEpM6NIDYT1qS1XXTUll1cMbl9x3aNjoAPxaQLn+7KLEZ8cUYQZunIokSgoc3W7rhJG X-Received: by 2002:aa7:df04:: with SMTP id c4mr8262467edy.147.1622637800925; Wed, 02 Jun 2021 05:43:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622637800; cv=none; d=google.com; s=arc-20160816; b=zghyAwVDZZszCyFp4KIF/F1DS1Mwhzosos/IPX853GJ0RKUanDuOMCH+MN7kAXV0wo UTfPpfvQk6OMNTOUkXsmkQjSSnoH7sfwcMXmYoGSuAgCpGoD1ylWNeF2m3Qm0Z+yQpek gqCgrd7FTi2NamFXYOYGgYT0wbg3K0fZJLiCR/l45u9qK4v3zi762XO7aIsB2vdjSlaB i3d7sBQLtdT3tXK3Ox3Fmc2wE2Lvxe0rsAHE8FYiD4ODYeo2fPkakL5zERjDyVi82v6s 3gCJIg9MCakjmO96r+anX1gWG7JtLH/5wKyzosfjBad2k09QobZzjpRNdjGWUfN8nXQr 6xQg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=X1l7jGyVWidF6uLQ2hGdIjNWnuokOqt3x1cj/hzGKNs=; b=rCmqqu1Sl2vJoLKSsD6p/o79FNoQuCeYVpVTLejsnsDVRWCXT2AVf7+8hCtSZGCFpQ Ypi42K6gnkzAUTQ4o+0yONhFuo61njJmBsB/IIt58dHjginsHqw3Bt4e3orN7Tzf6lus K5JHec2S96gkHc8DrNx9kWwjHJRG9jwBYd3m4kfYzZhNLBU55BZOYAwTO4Pehh4r4a6R ET3oUm/YKAfAHyCkusmGtwl85yMPy2xPRV7I0RDPxCRjpglVpXLf6U335EbEOdn5wNlt Hqgf1qzBCTMfxEN/NMf4zTV9g4Axrr8+EO50zKi7Vj8QJgTOfkz61Qo+4g9Xa+//gA7u GnSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sf7E38ME; 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 i29si2693173ejo.446.2021.06.02.05.43.20; Wed, 02 Jun 2021 05:43:20 -0700 (PDT) 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=sf7E38ME; 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 S230097AbhFBMoc (ORCPT + 8 others); Wed, 2 Jun 2021 08:44:32 -0400 Received: from mail-il1-f182.google.com ([209.85.166.182]:38783 "EHLO mail-il1-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230092AbhFBMo2 (ORCPT ); Wed, 2 Jun 2021 08:44:28 -0400 Received: by mail-il1-f182.google.com with SMTP id j30so1985897ila.5 for ; Wed, 02 Jun 2021 05:42:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=X1l7jGyVWidF6uLQ2hGdIjNWnuokOqt3x1cj/hzGKNs=; b=sf7E38MEGXMM+gyDmrNCm9O5Xnth6X9bGVa5y3jYUtGs57a5nrCX5jo/aPzLTyWN2R 9fxKNOPGk1W8AhmhL8aprqgoEWYU/ym51GfNYblTFHCwWLL06SqdMg+yXhLmtjjz+IzC NxFVaV5IGxiOjXtVP97YCiD+kpHueRb3k22/jTOdXvvzwlKQJMA9g397Ku2I8Bb8KiQT SKzZ8JsOO767LsOO9CTv1wUqVtVVOjzqzY8tcEJ2Xw/zMPOyh/MX0lsQGnO1wl9ffRpB K6tlzDc71ENo+sO4LwdUlFgb7lfeycWCdtK2VT61oiUp0T2UQ7bqYx2Bk10OoHkHMcB3 TkQA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=X1l7jGyVWidF6uLQ2hGdIjNWnuokOqt3x1cj/hzGKNs=; b=plMfNvklpmNdAtPSdV8bMkNFsjX074SS5cQiW7hv1LbNWj9bMYK9QKEWLEfcFutSah fLxo30t7HKaMGUpVeHPS28Vo9hp63Hb/gS14FPRAcQNy3HBRnL2xFFfBDEuIXlHf6rYe yppZlQj9Cej9elORtFGern2j4kk004A7coS+mo5Ck7MULWA15QfpZG2Cs2N7CzB70QGC HvCnlh/zudFJRFYRr4QezpfllPDprcSfAqNTR3SGQjQIh2UIqWpTGlCI3GWTotb7ykCH ODsNOU5bLBd6jnUgPsf89tcRKbmf/YqRsSupD6kYHNB7wXBYjh8+qQaImpz7LwsTJaHd fFZA== X-Gm-Message-State: AOAM532ek7Bc4vkgp0PQOGt07xEPitMKjfl2E3SdN0krVIjQ2mN9/i/o 96aZwmZESksQwU546gds06Sz+A== X-Received: by 2002:a05:6e02:12af:: with SMTP id f15mr23514489ilr.77.1622637696584; Wed, 02 Jun 2021 05:41:36 -0700 (PDT) Received: from presto.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id v18sm11087054iob.3.2021.06.02.05.41.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 05:41:36 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, sharathv@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/2] net: ipa: add support for inline checksum offload Date: Wed, 2 Jun 2021 07:41:30 -0500 Message-Id: <20210602124131.298325-2-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210602124131.298325-1-elder@linaro.org> References: <20210602124131.298325-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Starting with IPA v4.5, IP payload checksum offload is implemented differently. Prior to v4.5, the IPA hardware appends an rmnet_map_dl_csum_trailer structure to each packet if checksum offload is enabled in the download direction (modem->AP). In the upload direction (AP->modem) a rmnet_map_ul_csum_header structure is prepended before each sent packet. Starting with IPA v4.5, checksum offload is implemented using a single new rmnet_map_v5_csum_header structure which sits between the QMAP header and the packet data. The same header structure is used in both directions. The new header contains a header type (CSUM_OFFLOAD); a checksum flag; and a flag indicating whether any other headers follow this one. The checksum flag indicates whether the hardware should compute (and insert) the checksum on a sent packet. On a received packet the checksum flag indicates whether the hardware confirms the checksum value in the payload is correct. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_endpoint.c | 47 ++++++++++++++++++++++++++-------- drivers/net/ipa/ipa_reg.h | 1 + 2 files changed, 37 insertions(+), 11 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index ccc99ad983eb5..03719fb6a15a4 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -457,28 +457,34 @@ int ipa_endpoint_modem_exception_reset_all(struct ipa *ipa) static void ipa_endpoint_init_cfg(struct ipa_endpoint *endpoint) { u32 offset = IPA_REG_ENDP_INIT_CFG_N_OFFSET(endpoint->endpoint_id); + enum ipa_cs_offload_en enabled; u32 val = 0; /* FRAG_OFFLOAD_EN is 0 */ if (endpoint->data->checksum) { + enum ipa_version version = endpoint->ipa->version; + if (endpoint->toward_ipa) { u32 checksum_offset; - val |= u32_encode_bits(IPA_CS_OFFLOAD_UL, - CS_OFFLOAD_EN_FMASK); /* Checksum header offset is in 4-byte units */ checksum_offset = sizeof(struct rmnet_map_header); checksum_offset /= sizeof(u32); val |= u32_encode_bits(checksum_offset, CS_METADATA_HDR_OFFSET_FMASK); + + enabled = version < IPA_VERSION_4_5 + ? IPA_CS_OFFLOAD_UL + : IPA_CS_OFFLOAD_INLINE; } else { - val |= u32_encode_bits(IPA_CS_OFFLOAD_DL, - CS_OFFLOAD_EN_FMASK); + enabled = version < IPA_VERSION_4_5 + ? IPA_CS_OFFLOAD_DL + : IPA_CS_OFFLOAD_INLINE; } } else { - val |= u32_encode_bits(IPA_CS_OFFLOAD_NONE, - CS_OFFLOAD_EN_FMASK); + enabled = IPA_CS_OFFLOAD_NONE; } + val |= u32_encode_bits(enabled, CS_OFFLOAD_EN_FMASK); /* CS_GEN_QMB_MASTER_SEL is 0 */ iowrite32(val, endpoint->ipa->reg_virt + offset); @@ -498,6 +504,27 @@ static void ipa_endpoint_init_nat(struct ipa_endpoint *endpoint) iowrite32(val, endpoint->ipa->reg_virt + offset); } +static u32 +ipa_qmap_header_size(enum ipa_version version, struct ipa_endpoint *endpoint) +{ + u32 header_size = sizeof(struct rmnet_map_header); + + /* Without checksum offload, we just have the MAP header */ + if (!endpoint->data->checksum) + return header_size; + + if (version < IPA_VERSION_4_5) { + /* Checksum header inserted for AP TX endpoints only */ + if (endpoint->toward_ipa) + header_size += sizeof(struct rmnet_map_ul_csum_header); + } else { + /* Checksum header is used in both directions */ + header_size += sizeof(struct rmnet_map_v5_csum_header); + } + + return header_size; +} + /** * ipa_endpoint_init_hdr() - Initialize HDR endpoint configuration register * @endpoint: Endpoint pointer @@ -526,13 +553,11 @@ static void ipa_endpoint_init_hdr(struct ipa_endpoint *endpoint) u32 val = 0; if (endpoint->data->qmap) { - size_t header_size = sizeof(struct rmnet_map_header); enum ipa_version version = ipa->version; + size_t header_size; - /* We might supply a checksum header after the QMAP header */ - if (endpoint->toward_ipa && endpoint->data->checksum) - header_size += sizeof(struct rmnet_map_ul_csum_header); - val |= ipa_header_size_encoded(version, header_size); + header_size = ipa_qmap_header_size(version, endpoint); + val = ipa_header_size_encoded(version, header_size); /* Define how to fill fields in a received QMAP header */ if (!endpoint->toward_ipa) { diff --git a/drivers/net/ipa/ipa_reg.h b/drivers/net/ipa/ipa_reg.h index 286ea9634c49d..b89dec5865a5b 100644 --- a/drivers/net/ipa/ipa_reg.h +++ b/drivers/net/ipa/ipa_reg.h @@ -368,6 +368,7 @@ enum ipa_cs_offload_en { IPA_CS_OFFLOAD_NONE = 0x0, IPA_CS_OFFLOAD_UL = 0x1, /* Before IPA v4.5 (TX) */ IPA_CS_OFFLOAD_DL = 0x2, /* Before IPA v4.5 (RX) */ + IPA_CS_OFFLOAD_INLINE = 0x1, /* IPA v4.5 (TX and RX) */ }; /* Valid only for TX (IPA consumer) endpoints */ From patchwork Wed Jun 2 12:41:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 452502 Delivered-To: patch@linaro.org Received: by 2002:a02:c735:0:0:0:0:0 with SMTP id h21csp536146jao; Wed, 2 Jun 2021 05:43:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysP/uDxwVtDICKEsIGsdusX1Cvi0a9etFFM63zYA7lzB0IVwngfPn30C3I5D0Ue0UmrSWQ X-Received: by 2002:a17:907:d92:: with SMTP id go18mr16338637ejc.317.1622637800045; Wed, 02 Jun 2021 05:43:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622637800; cv=none; d=google.com; s=arc-20160816; b=n5a4qqVP9BlHNoYBMTwwZNBgyAyFHxvbLu3OFXe3ad20IEpXPcmAbTZlosgQZ/4gsW hM41a/z+tfyIhaSaYlqitCbVyYUoHh4Tn6M5znT3LMi66ig4fqGQFEkkNejXV9gE/ile W7wf5qR/t6sgs0o9pSaQX6EHHmOlbGQ2hTFNqWhrYt/CrxdpdlJr9Jq/CJnMqu4qCBqR keeKWjKKzuC2Ouz1LK/T+cAM9fgNuTROp90/8oSAylBnuQriEO8F5LkMO1r9lrUBka/N gsu30nA14ZgTb6xJTfrU2X+skoC0Y++IT29SgfjivM8EVBuiXnCYChKCkf66mKlyYIjp fuPg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZomBGs4eHViKX0lomLvHZXS684AyWHKwDi/uxcM0kfk=; b=0p0CsMIBc2HAS6o2W8SCrZN7w67WLcAHQkY6jQPup/a5LFerwWlWq7i/+vvOlhdAUl HP1ZnrtpMPn5A8nNB7XWa8OwkPG4oL9fmJ8FPHdZs3aA69Yrn9abCkOBbgRfewZfjPb1 erhWZgIYoZvF4jG+diIT0I01tBcCh7jaIabyiAUC1VbJxmQ3+l9czxtRm04FlYzqdeIY 6P+dqF8fs/zIpHIxvOMZLGsB2OmXHprluDBl7ZSzxNAypJi972Gl9mm7RrlWU4YwmvNa 340SdGteXqN9IGWD192z0sBFeZHGJ0t2oaFmBgWPBJOjLO93YrhfIKKG6yWKwUUcvX+e ZAWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="X/OqE2o/"; 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 i29si2693173ejo.446.2021.06.02.05.43.19; Wed, 02 Jun 2021 05:43:20 -0700 (PDT) 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="X/OqE2o/"; 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 S229907AbhFBMoY (ORCPT + 8 others); Wed, 2 Jun 2021 08:44:24 -0400 Received: from mail-io1-f46.google.com ([209.85.166.46]:42625 "EHLO mail-io1-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229850AbhFBMoU (ORCPT ); Wed, 2 Jun 2021 08:44:20 -0400 Received: by mail-io1-f46.google.com with SMTP id k22so2332453ioa.9 for ; Wed, 02 Jun 2021 05:42:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZomBGs4eHViKX0lomLvHZXS684AyWHKwDi/uxcM0kfk=; b=X/OqE2o/bDI7oS3yDQ3/ISNF9qRVnYqvKykmcyzPbDDb94BR02haXzQnwZGjreaWqf m/YnjyDqiop5o0bPRHxBOj0a9Tm4dkeHAWTM7Ob6c7HqQHRclsjFid7PrIBQKAc8tFL9 yU/gwEIYLrYo0GLzo/lEiiul37BCpn+8loGB5O8UhJ31f8Xin0fAOoehhaQlcL+c1koO utTUzEqwRZe5SpQs/YsVhnXQEamdOHEYZa3FM1rhpq7CeCiiJez72fZX2OrbkgrkztiC jgOLUCYqjwM8Z4iqFvWiCGryV6RmWhDFSkryaIt1INIWl5XceOEihUKH1dCdE8tGccr+ 5pqQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZomBGs4eHViKX0lomLvHZXS684AyWHKwDi/uxcM0kfk=; b=TMIFcPhr67siJpFUfgpPAQg7rT+SQ1VVtB8GTcnTBuVAxWNSbaqbBViZxLLs9yoFP+ lDFBF65YB5sYiai65xEowqhStDAtSfbh8g4EHJ1PMptsE9Y4dhiq9b2T8AK7za/+Y6Pj uga38kxc0uECLlz32iCKxeO7vK7Bhgi7+YW8rNTfG0XdKjdSP60faWohSpG76hl8vaAY um8aV3Yphje/jbs7HHJs6aAqZp/n7uNOhkLojhYRT1bzKogpfRmvJJuIpAZg2mo0IX+/ vKAWLyLGgflzeBsxFxi1IGNV7YqPSChSyyBnY4Qm34dNv7OkCEZVwf0rCBqC6pYCv12L jNlQ== X-Gm-Message-State: AOAM530kW0XweQyAPgVxPBEA2mTEhCcCtFn4NqiU5N/55eUPbihsVwrd uXwsm5K3MrE3J73NOSC1Iuh1Qg== X-Received: by 2002:a5d:8501:: with SMTP id q1mr25531804ion.66.1622637697713; Wed, 02 Jun 2021 05:41:37 -0700 (PDT) Received: from presto.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id v18sm11087054iob.3.2021.06.02.05.41.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 05:41:37 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, sharathv@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 2/2] Revert "net: ipa: disable checksum offload for IPA v4.5+" Date: Wed, 2 Jun 2021 07:41:31 -0500 Message-Id: <20210602124131.298325-3-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210602124131.298325-1-elder@linaro.org> References: <20210602124131.298325-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This reverts commit c88c34fcf8f501d588c0a999aa7e51e18552c5f0. The RMNet driver now supports inline checksum offload. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_endpoint.c | 16 ---------------- 1 file changed, 16 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 03719fb6a15a4..07a81b73306fe 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -88,11 +88,6 @@ static bool ipa_endpoint_data_valid_one(struct ipa *ipa, u32 count, if (ipa_gsi_endpoint_data_empty(data)) return true; - /* IPA v4.5+ uses checksum offload, not yet supported by RMNet */ - if (ipa->version >= IPA_VERSION_4_5) - if (data->endpoint.config.checksum) - return false; - if (!data->toward_ipa) { if (data->endpoint.filter_support) { dev_err(dev, "filtering not supported for " @@ -235,17 +230,6 @@ static bool ipa_endpoint_data_valid(struct ipa *ipa, u32 count, static bool ipa_endpoint_data_valid(struct ipa *ipa, u32 count, const struct ipa_gsi_endpoint_data *data) { - const struct ipa_gsi_endpoint_data *dp = data; - enum ipa_endpoint_name name; - - if (ipa->version < IPA_VERSION_4_5) - return true; - - /* IPA v4.5+ uses checksum offload, not yet supported by RMNet */ - for (name = 0; name < count; name++, dp++) - if (data->endpoint.config.checksum) - return false; - return true; }