From patchwork Wed Jun 10 19:53:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 187773 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp785858ilo; Wed, 10 Jun 2020 12:53:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwydISaiOuzM3s54QBjSWw9byqm0X17knCTIJo4u0n4FkKjm2TclXD8vBA/Sg0cNGHhpIm0 X-Received: by 2002:a50:fe0d:: with SMTP id f13mr4004971edt.204.1591818835012; Wed, 10 Jun 2020 12:53:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591818835; cv=none; d=google.com; s=arc-20160816; b=t5EHHL2DRX4ewde2+f6QfZFfBXDDSUdqYYk/gTwSxmDu3l/nbZD2YWizxRorfIawi7 Hbgg+fRlKuu6E271g9VT+6foeIprK2Gh5zoJc8PHWFOXRYF2JZRc8BhukPuA/9s9wZur R6UJ++SkICURB4n+MgqyzRh3FFO/Orc2oWal2JEBafU9LeVq8OI9wFaflsjj59LUlDVZ eFvOWEHJivwd2IsDz02umwyhC9p9kTNOEEIvLG1NBzc3Bp51BxBHZzey+w9kFHaf8UKr 9TTiiguXmvdhyo5Ii6uE7D/Ssb8CAr7w6LKpHz62EA4lQv4zSZHlk5ub07joZddaqn/v XAgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=q68mNiRrlOVR9JqLdcYN4kCb7Vw+wREfC4Qx6K31GJ4=; b=W2U4NgUlKIcKn/shKPMrbC+43mGFv+7kYq5aXJ9ouWg0hMvwRCHQWbJ37YtINJcuD5 Nzw1ROjtlASh7vEs1Ciy4jMHEJrWNrcofD/Gs/I8nSSN1Pg4Wu40UONRUZvvfKLEiWMo KOBaDRkj41ZLgfxH3k/4tkTKRW+rfRreDwYpPT0DLbumXWm5QPGTeWQ5bauDSIwqeJI4 fbmJu1kzAOgvItNF2XggyjpqMg1C1n/uIM0+sX2Sx5pogI9lRGNhxDMeqlwIt56GBAKH bqpMOeOEe6500+stFuAHFQtVDuLEzxa42OTqm3l+T2UiMVIifPT5z3BcamKbl6p+jJyD Rmvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AD52HOho; 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 mh14si596595ejb.534.2020.06.10.12.53.54; Wed, 10 Jun 2020 12:53:54 -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=AD52HOho; 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 S1730367AbgFJTxv (ORCPT + 9 others); Wed, 10 Jun 2020 15:53:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727773AbgFJTxt (ORCPT ); Wed, 10 Jun 2020 15:53:49 -0400 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8A26C03E96F for ; Wed, 10 Jun 2020 12:53:48 -0700 (PDT) Received: by mail-io1-xd43.google.com with SMTP id r77so3710739ior.3 for ; Wed, 10 Jun 2020 12:53:48 -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=q68mNiRrlOVR9JqLdcYN4kCb7Vw+wREfC4Qx6K31GJ4=; b=AD52HOhobXM+cO5sMUgUDJTJSSUaxpEo6eYeTf9//DvhPmJAYACkJvdED1+5Zd8kIv 2RZyWcmn15yvjf8Rbxh0KuI8U+CVGXTQcfwm8BSwJdxkBIcuSVOIx+BhAG1sMoGbaEK3 1wXCnCckPmNG8MfUms9aZhn+RwmdQlIPbX0tXPSQ/xZissGci/ZfG8S83dnqyABmMH7v +t2BM4NQzgVGjRws2xNGGa03CmOAI6Z97tIVNJsvgTkVRArg8HBZzrIxxHbV3q7+c23q IndY0xtoPo5d3VTECMGjZt8CoMV/wqFa7bf5LlTD3CbpDB1jpMAyHYRk2VEoSyJTmfop K/Sg== 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=q68mNiRrlOVR9JqLdcYN4kCb7Vw+wREfC4Qx6K31GJ4=; b=DdkJFW2LKBMNq7qHbu3Xm9fDKD6us0UbYRjkJ7AaeXEdVaPZRzEKLlKdkeBPUSiUG0 mKsNPLzRvcltuHUFmOsH6Hc0cgeekWXYrPNrdn07vTVRWSMWKKTrb/Kd11AnHf/V509P RdZ5Px2BBqWGamDeqzuME3VKmc79Z4f1/R7vWZ6qaJQQGTqBsoRKjyTHFW5U7u2ysCRt gb3iI0QQqUOebcVF4q2Y3v86DyIjtnxQXp42P0DNgzrSpepqs/+rDgSc5N5n0Ah+Gasu wm53C/SImwbsMt576vpv5ROrwvbRY6PbvHeeWnd3HO1AGwmKx0yY0IqL78nxVhYIKO8l AyNw== X-Gm-Message-State: AOAM53244NSThCpSw9o30eYDtPOayKgsMdjDSFrooJS/2eqS3yNINgJ5 eosGJtZrtNlmzgqniyL4oz5jzg== X-Received: by 2002:a02:ce56:: with SMTP id y22mr4734157jar.18.1591818828280; Wed, 10 Jun 2020 12:53:48 -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 r10sm408828ile.36.2020.06.10.12.53.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jun 2020 12:53:47 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, subashab@codeaurora.org, cpratapa@codeaurora.org, bjorn.andersson@linaro.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net 1/5] net: ipa: program metadata mask differently Date: Wed, 10 Jun 2020 14:53:28 -0500 Message-Id: <20200610195332.2612233-2-elder@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200610195332.2612233-1-elder@linaro.org> References: <20200610195332.2612233-1-elder@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The way the mask value is programmed for QMAP RX endpoints was based on some wrong assumptions about the way metadata containing the QMAP mux_id value is formatted. The metadata value supplied by the modem is *not* in QMAP format, and in fact contains the mux_id we want in its (big endian) low-order byte. That byte must be written by the IPA into offset 1 of the QMAP header it inserts before the received packet. QMAP TX endpoints *do* use a QMAP header as the metadata sent with each packet. The modem assumes this, and based on that assumes the mux_id is in the second byte. To match those assumptions we must program the modem TX (QMAP) endpoint HDR register to indicate the metadata will be found at offset 0 in the message header. The previous configuration managed to work, but it was not working correctly. This patch fixes a bug whose symptom was receipt of messages containing the wrong QMAP mux_id. In fixing this, get rid of ipa_rmnet_mux_id_metadata_mask(), which was more or less defined so there was a separate place to explain what was happening as we generated the mask value. Instead, put a longer description of how this works above ipa_endpoint_init_hdr(), and define the metadata mask to use as a simple constant. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_endpoint.c | 74 ++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 34 deletions(-) -- 2.25.1 diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 66649a806dd1..6015fabb4df5 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -32,6 +32,9 @@ /* The amount of RX buffer space consumed by standard skb overhead */ #define IPA_RX_BUFFER_OVERHEAD (PAGE_SIZE - SKB_MAX_ORDER(NET_SKB_PAD, 0)) +/* Where to find the QMAP mux_id for a packet within modem-supplied metadata */ +#define IPA_ENDPOINT_QMAP_METADATA_MASK 0x000000ff /* host byte order */ + #define IPA_ENDPOINT_RESET_AGGR_RETRY_MAX 3 #define IPA_AGGR_TIME_LIMIT_DEFAULT 1000 /* microseconds */ @@ -433,7 +436,25 @@ static void ipa_endpoint_init_cfg(struct ipa_endpoint *endpoint) iowrite32(val, endpoint->ipa->reg_virt + offset); } -static void ipa_endpoint_init_hdr(struct ipa_endpoint *endpoint) +/** + * We program QMAP endpoints so each packet received is preceded by a QMAP + * header structure. The QMAP header contains a 1-byte mux_id and 2-byte + * packet size field, and we have the IPA hardware populate both for each + * received packet. The header is configured (in the HDR_EXT register) + * to use big endian format. + * + * The packet size is written into the QMAP header's pkt_len field. That + * location is defined here using the HDR_OFST_PKT_SIZE field. + * + * The mux_id comes from a 4-byte metadata value supplied with each packet + * by the modem. It is *not* a QMAP header, but it does contain the mux_id + * value that we want, in its low-order byte. A bitmask defined in the + * endpoint's METADATA_MASK register defines which byte within the modem + * metadata contains the mux_id. And the OFST_METADATA field programmed + * here indicates where the extracted byte should be placed within the QMAP + * header. + */ +void ipa_endpoint_init_hdr(struct ipa_endpoint *endpoint) { u32 offset = IPA_REG_ENDP_INIT_HDR_N_OFFSET(endpoint->endpoint_id); u32 val = 0; @@ -441,25 +462,31 @@ static void ipa_endpoint_init_hdr(struct ipa_endpoint *endpoint) if (endpoint->data->qmap) { size_t header_size = sizeof(struct rmnet_map_header); + /* 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 |= u32_encode_bits(header_size, HDR_LEN_FMASK); - /* metadata is the 4 byte rmnet_map header itself */ - val |= HDR_OFST_METADATA_VALID_FMASK; - val |= u32_encode_bits(0, HDR_OFST_METADATA_FMASK); - /* HDR_ADDITIONAL_CONST_LEN is 0; (IPA->AP only) */ + + /* Define how to fill mux_id in a received QMAP header */ if (!endpoint->toward_ipa) { - u32 size_offset = offsetof(struct rmnet_map_header, - pkt_len); + u32 off; /* Field offset within header */ + /* Where IPA will write the metadata value */ + off = offsetof(struct rmnet_map_header, mux_id); + val |= u32_encode_bits(off, HDR_OFST_METADATA_FMASK); + + /* Where IPA will write the length */ + off = offsetof(struct rmnet_map_header, pkt_len); val |= HDR_OFST_PKT_SIZE_VALID_FMASK; - val |= u32_encode_bits(size_offset, - HDR_OFST_PKT_SIZE_FMASK); + val |= u32_encode_bits(off, HDR_OFST_PKT_SIZE_FMASK); } + /* For QMAP TX, metadata offset is 0 (modem assumes this) */ + val |= HDR_OFST_METADATA_VALID_FMASK; + + /* HDR_ADDITIONAL_CONST_LEN is 0; (RX only) */ /* HDR_A5_MUX is 0 */ /* HDR_LEN_INC_DEAGG_HDR is 0 */ - /* HDR_METADATA_REG_VALID is 0; (AP->IPA only) */ + /* HDR_METADATA_REG_VALID is 0 (TX only) */ } iowrite32(val, endpoint->ipa->reg_virt + offset); @@ -482,28 +509,6 @@ static void ipa_endpoint_init_hdr_ext(struct ipa_endpoint *endpoint) iowrite32(val, endpoint->ipa->reg_virt + offset); } -/** - * Generate a metadata mask value that will select only the mux_id - * field in an rmnet_map header structure. The mux_id is at offset - * 1 byte from the beginning of the structure, but the metadata - * value is treated as a 4-byte unit. So this mask must be computed - * with endianness in mind. Note that ipa_endpoint_init_hdr_metadata_mask() - * will convert this value to the proper byte order. - * - * Marked __always_inline because this is really computing a - * constant value. - */ -static __always_inline __be32 ipa_rmnet_mux_id_metadata_mask(void) -{ - size_t mux_id_offset = offsetof(struct rmnet_map_header, mux_id); - u32 mux_id_mask = 0; - u8 *bytes; - - bytes = (u8 *)&mux_id_mask; - bytes[mux_id_offset] = 0xff; /* mux_id is 1 byte */ - - return cpu_to_be32(mux_id_mask); -} static void ipa_endpoint_init_hdr_metadata_mask(struct ipa_endpoint *endpoint) { @@ -513,8 +518,9 @@ static void ipa_endpoint_init_hdr_metadata_mask(struct ipa_endpoint *endpoint) offset = IPA_REG_ENDP_INIT_HDR_METADATA_MASK_N_OFFSET(endpoint_id); + /* Note that HDR_ENDIANNESS indicates big endian header fields */ if (!endpoint->toward_ipa && endpoint->data->qmap) - val = ipa_rmnet_mux_id_metadata_mask(); + val = cpu_to_be32(IPA_ENDPOINT_QMAP_METADATA_MASK); iowrite32(val, endpoint->ipa->reg_virt + offset); } From patchwork Wed Jun 10 19:53:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 187776 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp786081ilo; Wed, 10 Jun 2020 12:54:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFeo3/O3H7+GHvfrNafjkp0rkZ35nVDmOBzGgRUwMbG16b/Zw5gb/G+qRzrjDTK+ziufbl X-Received: by 2002:aa7:d0c5:: with SMTP id u5mr3871021edo.51.1591818857053; Wed, 10 Jun 2020 12:54:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591818857; cv=none; d=google.com; s=arc-20160816; b=NGf7stetoPIt9Nr044d7y0VzcY1udAAcnZ9LzInUKw7FKHwo7pnYMJIC/VndeVjbp3 vLWb23vTRbJ0PD2znE/Y5uZqVgTpximNnpWRljBcZErvC/3UH9KsbgUg90ZGqPYxXOXN 5s4e8SWFISP1eZCHDq3+GYoSrOxT60tQsN3ETASTXx47XNbEOT+ezB+CfEA72p6Oe6Wx DBfnGVFeEEOP38hmXi/CN80nustFiJ9vUz99S4dUfHjRain+2DoU5bXtoe/dlCWmFK0b /0SDtgI+k9iHyscZ/leOMm1h1eLxTclJnezoVyrOLj2XIunY52mzzwxv6PdwYjaIXKR1 WPXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NjH1etSnlY+P/0B3j0s0VstfhJWLswlmVgehJV9D28o=; b=Y1oPmTzC3n5N0E49QnXzgWgUSrz9C+ktJtFfHskpE8STxjSwH2sUsvSZ7GgAspFwgX 85xW2bK8C1Z9TWm5JsXqhOpUywG+Xx0MACJI6GuH0PSJviOrLyHuJugm5+guNum0Ewu9 UO+KH03WuQd7DlWhj9bC++tTFXJMSzldwqF16hWWyNTNvNnrfs8HVdZ29CGOqL5CJQvo JyXU9za9vqijtPfyvH8g9cPbGeL8GQ0mZc/CwKSm3vXhAlp5LYx34hcBhAqgdGrQG/Ac Rh2Ttx6n+ZYcpQnMr4vk9l5KvLk/ItzwbUWRmy7Q6Mi2WlF1+7ZbFkgmzmu/VlC9rEB+ t7Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LmFsn+i7; 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 i20si561840eja.745.2020.06.10.12.54.16; Wed, 10 Jun 2020 12:54:17 -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=LmFsn+i7; 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 S1730386AbgFJTxy (ORCPT + 9 others); Wed, 10 Jun 2020 15:53:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730362AbgFJTxu (ORCPT ); Wed, 10 Jun 2020 15:53:50 -0400 Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BA5EC08C5C1 for ; Wed, 10 Jun 2020 12:53:50 -0700 (PDT) Received: by mail-il1-x143.google.com with SMTP id c75so3175611ila.8 for ; Wed, 10 Jun 2020 12:53:50 -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=NjH1etSnlY+P/0B3j0s0VstfhJWLswlmVgehJV9D28o=; b=LmFsn+i7H0lG2owSIrQFk7zD3AEzxMUy0bdlLNPUyt5D6sfBVlNAeQo1nctCYCk1uZ A8Oq1TnLOoPFvzNCduPaZ21+uWYg6XIj9+TKMWGjY2DXujGxKx4R9w6GzJwGYgRsgklc fwhWicjuXSiNxgMFEezobW7wnNOwDsZDqpXxvFe5n+FdfD+lJFob4cWqWeC/RQtaGObQ CI7EmdbO1jl2BoxWSMWJm96WPMllkMlihSQDKO+Zms2sw11jGNuq5A7wnFYaAjRG8375 aPA0QV8ZJr94xd6FXol4D7j7Yzj9y4ViTDVz6ASnjsE2uL/jhi3M8axgU60ZDOtybEl6 Gj1w== 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=NjH1etSnlY+P/0B3j0s0VstfhJWLswlmVgehJV9D28o=; b=QG6j76nbsBnfYsgebYtr/0h5Vi6q3k99slo05GdRFVsqf4qSC85PIFbrmlFX9/Cle9 K9gMG1Octj3pRnQdsBmSBZihv4cw+yznXmqs3s1mTXZ9OkVhRUQEy/P1rhdA1/nUFKp/ Qxf6GgzgA6jC1G8Wfz16+qukTw1CmffJAkWbKC3+bfS30KR/x01H4MGRD5yKD8uTB4Yh Oo1weIW+Cy+euiO+DiMIuw9hsDmf9mnP+er+8uPYn/NBV4h5ezxefzkSDO4BJeEiKYuN KyGLnQpNoZZfGimb8Bf8xQKZVcwrkCXqgjaz5t+xhIMo5hAdb+4KuFbFiRHdlAZEMBLn uv7Q== X-Gm-Message-State: AOAM531kzK3hixOA1vAL045RA0h/p33jjzlpe0FwFJsjRtdWcFrGNpKQ 6yXi/SoPb+Xn5yqUf9uT7kxTmA== X-Received: by 2002:a92:9f12:: with SMTP id u18mr4539197ili.287.1591818829501; Wed, 10 Jun 2020 12:53:49 -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 r10sm408828ile.36.2020.06.10.12.53.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jun 2020 12:53:49 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, subashab@codeaurora.org, cpratapa@codeaurora.org, bjorn.andersson@linaro.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net 2/5] net: ipa: fix modem LAN RX endpoint id Date: Wed, 10 Jun 2020 14:53:29 -0500 Message-Id: <20200610195332.2612233-3-elder@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200610195332.2612233-1-elder@linaro.org> References: <20200610195332.2612233-1-elder@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The endpoint id assigned to the modem LAN RX endpoint for the SC7180 SoC is incorrect. The erroneous value might have been copied from SDM845 and never updated. The correct endpoint id to use for this SoC is 11. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_data-sc7180.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.25.1 diff --git a/drivers/net/ipa/ipa_data-sc7180.c b/drivers/net/ipa/ipa_data-sc7180.c index 43faa35ae726..d4c2bc7ad24b 100644 --- a/drivers/net/ipa/ipa_data-sc7180.c +++ b/drivers/net/ipa/ipa_data-sc7180.c @@ -106,7 +106,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { [IPA_ENDPOINT_MODEM_LAN_RX] = { .ee_id = GSI_EE_MODEM, .channel_id = 3, - .endpoint_id = 13, + .endpoint_id = 11, .toward_ipa = false, }, [IPA_ENDPOINT_MODEM_AP_TX] = { From patchwork Wed Jun 10 19:53:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 187774 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp785918ilo; Wed, 10 Jun 2020 12:54:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+Y+MAuVvqySxQ7+vbuCIS56IGLnRJw1facpHQguCw/MLAlnIX6lL9+aFpENvl5/flRcO4 X-Received: by 2002:a17:906:6a92:: with SMTP id p18mr4890543ejr.233.1591818841031; Wed, 10 Jun 2020 12:54:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591818841; cv=none; d=google.com; s=arc-20160816; b=d8hwcTpd1e1LeC77IWHhAZNqM2nre19cYcN/HgeYp+6vIfraHFJCgD155lFuJP+WrX 33DqeV+nMhtpYsdSI68B8NlMhdzcvLegFSshJ0YeTyp0YRRYza73Okfb9XkxJtB6UCLS LQ4DagB35U3AhM4dwhuOQ3tuqNXPx3NjIGu91gHVJdXcvlpOVu+2714GIF7AqhzMr06b Yd+sHWLXGr7vd1F0xzuk6xxsnyAXACY8Jydh/87O0j1mlrs/6HM2nXyZu1oReUSRcE1P +8ynmcaj6pxjd71JXssCe0ziVqExx+efCIh9l468yXh36FQ2zfAyXmwASU6m7PtgmanP bCkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TPu28iSnpxiaKV6OmQYQaLs7QlaJe31+At5Kd0wdaDI=; b=YxvjqYqfQp3KYeVro0WLntfXE0MUCfKVZUFcR4Qm77knZh612MG9xvgcvWUySQrEgS LNK7ZuZ08UGNTtEvQDw6hvt99KGxeoc8K8+Nk0Tb1MiSg9qKfDT79zmrNOwQQzaDUG9T FlBU3lsN5LJ5v/chmBhU9wAYEL6EleOrnwF0Sxah8oqJbWJSZjBhncoXU49D24KPdwgO 3UbGj2Cehfw1X2hSpRseF2u/qlrF3b2IfZkPDBxBkgslR5tv8fMYFJ4ncAVd6UQ4JsZU ts3CA0yEBFbTZlWkiibq/x+QNSh9E45XZnEthTGs0gtT1qQRVRyTSkH6pE1tAP8Rb2FY gSFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K3+ZwfOR; 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 gl17si636834ejb.336.2020.06.10.12.54.00; Wed, 10 Jun 2020 12:54:01 -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=K3+ZwfOR; 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 S1730403AbgFJTx5 (ORCPT + 9 others); Wed, 10 Jun 2020 15:53:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730368AbgFJTxv (ORCPT ); Wed, 10 Jun 2020 15:53:51 -0400 Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 639B1C03E96B for ; Wed, 10 Jun 2020 12:53:51 -0700 (PDT) Received: by mail-io1-xd42.google.com with SMTP id q8so3697906iow.7 for ; Wed, 10 Jun 2020 12:53:51 -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=TPu28iSnpxiaKV6OmQYQaLs7QlaJe31+At5Kd0wdaDI=; b=K3+ZwfORmOVFRGG1urRqIcC4gUufLJJjuwLcZ7LSR+xCycfbHvEeB6GoJxqPsZwH1H 6p0Q+K4GKZtgn+82EMsnrOfYroJoKWl8b94TzFLGm5GmDGnOhg8t0mnC5U8TV+yjqG0l Humzwmlu/BVXvtE1GkdoJlmkoaEIvBgI8pMGOJDTfIxJuBgKd04lms6IXA87MUVhkVhH DP8axBJPM9c75q9HQ+PnrYDmI/+owBVOhw0OM7Bjr4QRTfGk966Qy1kSNxrm3Od/YldA piYET9anDy4k2M/bpN1Dl82TjtyAdxG7DwCEtWNiCYB10HYNa/s3ifQWJFpSUQk/mGe7 Qleg== 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=TPu28iSnpxiaKV6OmQYQaLs7QlaJe31+At5Kd0wdaDI=; b=gY1Y0co6DBTCEfXST0ME9PGNap6fTX3g9o2OU49HB1KHDzKpajqWhCApvd+vFAKfU5 s8b/dsDK6yUv/AVamRvD5uoCfYCWoJCbnaNMCWcvJpHqjuFxY6ymBdxdQP6JgFk5AgZI eO4e1Ey5n0sz3GC274irX3jv/qATWETd6VXF55yV/RioxDjpY2h7iHQsSMVpIi+/EoRI s4YEQzDabRkqWh2TO534gUg3A9xfL3bi3JroDghCtKhIIpv9xC0WBSyZWTCqb0agOrK6 Dxg5n3SMGQap30c12qYJSSIDvgwHdmj+54uEpNz7N4KpaMZ5No9R6ZyPcW2lbELTlLfj OBOQ== X-Gm-Message-State: AOAM5308BMzj5Jt9mBTQVyVaBo3+XErOcsMhgU0IUAj2JXlGydx/ipvX UTl+UzsP5L4oO0miFZKTMQlvRA== X-Received: by 2002:a6b:2cc5:: with SMTP id s188mr4956803ios.77.1591818830843; Wed, 10 Jun 2020 12:53:50 -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 r10sm408828ile.36.2020.06.10.12.53.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jun 2020 12:53:50 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, subashab@codeaurora.org, cpratapa@codeaurora.org, bjorn.andersson@linaro.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net 3/5] net: ipa: program upper nibbles of sequencer type Date: Wed, 10 Jun 2020 14:53:30 -0500 Message-Id: <20200610195332.2612233-4-elder@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200610195332.2612233-1-elder@linaro.org> References: <20200610195332.2612233-1-elder@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The upper two nibbles of the sequencer type were not used for SDM845, and were assumed to be 0. But for SC7180 they are used, and so they must be programmed by ipa_endpoint_init_seq(). Fix this bug. IPA_SEQ_PKT_PROCESS_NO_DEC_NO_UCP_DMAP doesn't have a descriptive comment, so add one. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_endpoint.c | 6 ++++-- drivers/net/ipa/ipa_reg.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) -- 2.25.1 diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 6015fabb4df5..59313ced7036 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -699,10 +699,12 @@ static void ipa_endpoint_init_seq(struct ipa_endpoint *endpoint) u32 seq_type = endpoint->seq_type; u32 val = 0; + /* Sequencer type is made up of four nibbles */ val |= u32_encode_bits(seq_type & 0xf, HPS_SEQ_TYPE_FMASK); val |= u32_encode_bits((seq_type >> 4) & 0xf, DPS_SEQ_TYPE_FMASK); - /* HPS_REP_SEQ_TYPE is 0 */ - /* DPS_REP_SEQ_TYPE is 0 */ + /* The second two apply to replicated packets */ + val |= u32_encode_bits((seq_type >> 8) & 0xf, HPS_REP_SEQ_TYPE_FMASK); + val |= u32_encode_bits((seq_type >> 12) & 0xf, DPS_REP_SEQ_TYPE_FMASK); iowrite32(val, endpoint->ipa->reg_virt + offset); } diff --git a/drivers/net/ipa/ipa_reg.h b/drivers/net/ipa/ipa_reg.h index 3b8106aa277a..0a688d8c1d7c 100644 --- a/drivers/net/ipa/ipa_reg.h +++ b/drivers/net/ipa/ipa_reg.h @@ -455,6 +455,8 @@ enum ipa_mode { * second packet processing pass + no decipher + microcontroller * @IPA_SEQ_DMA_DEC: DMA + cipher/decipher * @IPA_SEQ_DMA_COMP_DECOMP: DMA + compression/decompression + * @IPA_SEQ_PKT_PROCESS_NO_DEC_NO_UCP_DMAP: + * packet processing + no decipher + no uCP + HPS REP DMA parser * @IPA_SEQ_INVALID: invalid sequencer type * * The values defined here are broken into 4-bit nibbles that are written From patchwork Wed Jun 10 19:53:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 187777 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp786123ilo; Wed, 10 Jun 2020 12:54:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUUbL7/bCTj6oyg4IoRVpdZ7n0MC5d8rnAS0XNbil//TTBFCgBTc0e+Qse7s1cKKa86lbW X-Received: by 2002:aa7:c2c7:: with SMTP id m7mr3902529edp.148.1591818860063; Wed, 10 Jun 2020 12:54:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591818860; cv=none; d=google.com; s=arc-20160816; b=0UHmYNFXydTiquWo+VYj4f2d7MLxauA2F8Jqdi2RdUJInCZBW1pWY3jLIftLoEF2L6 iTxykcJon7XmZTZrA/preMpYqW5PJavc1XrnizIuhs/rFCLrH0Br9CBYBv0R/3H8wcMB ZvncPS331Dd/pW/hYTpKCM3U7ZQ+SPJHspSMPMQykxePg6p2tRfyafRhOA2QFR8nfYkj AySJyNV3RQJm7vOhPhytCNMtSONgFN2vJNJOsBHr5BUTFetwkLMnUiW39ksJrPjRxvCP PBHo3jppWv1uJbwANJvtfZNuPuntqFUUmfmw9woFDarpI7lDdvp2uQyCv3h9CQOL8mjn gKiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5T05cldmDvQfb77MhXbjwDSTWhsR/a0PAAsdMXfo7+U=; b=muGc1nJ2X9Pgh/5saUpz3uGhe+Et6qPUa7I8YQDxnl/R5edG50Qa1UNh1Ey25DJYez uLrGdiVIQPZuiiNdkLw8ZaxT2ixVdVifJJ5ZsxZ2zkQnQHG9fd466eqZp2F//Dh0Bw/H YAg+tCgaIib6EYzCZ+AGoBEfRvUdZgOfpJMwYtWgfxt5VCxhHyusJkXHQ/D1d3ymIVTT BvL6k42lr+Dhbx642fva6GZeQuF0V7B1Xd/bTgrubq+Z+xtdzPhYivGQ3xoCZoIVbyhJ U+9A2o8FKzoxirkg/bXIuSgf7APQB0uERneb15sJ0dEj6uK5ntNSOQurhKFcjc9JhSat 7gLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IYvRVub8; 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 i20si561840eja.745.2020.06.10.12.54.19; Wed, 10 Jun 2020 12:54: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=IYvRVub8; 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 S1730460AbgFJTyS (ORCPT + 9 others); Wed, 10 Jun 2020 15:54:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730383AbgFJTxx (ORCPT ); Wed, 10 Jun 2020 15:53:53 -0400 Received: from mail-il1-x144.google.com (mail-il1-x144.google.com [IPv6:2607:f8b0:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1304C03E96F for ; Wed, 10 Jun 2020 12:53:52 -0700 (PDT) Received: by mail-il1-x144.google.com with SMTP id 9so3153648ilg.12 for ; Wed, 10 Jun 2020 12:53:52 -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=5T05cldmDvQfb77MhXbjwDSTWhsR/a0PAAsdMXfo7+U=; b=IYvRVub8FU12CaBQnSJ2Hg6GIrhJmIi6cUGltv6PVN66zyTX70sHSyd0ICHKjU6V9x rLmepJu4GpTX4wNlOll08ytzCDn1Ol1D65KaSMQB5ySSrwfnKIPBXn2IAAXRjbkXLED6 kpEv+B1EZ4Tanfj8QYBKVQRrr27c6PPzXdubnHU3W2LPCSVV865TeTw4aSQdglLrGBvu frTbFad/Pil8R+xm9KOR/uH3wS/Um+sNQxvCVnrgIvUpEN6AGYTzu1QH92R6FYFETJh6 qWhWvcYPVDpfp7FCAIuax4b25ffslmx+YL1e9e+k//8jIYxawuDfIzUFyPMlvXzQ2lB9 zQRQ== 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=5T05cldmDvQfb77MhXbjwDSTWhsR/a0PAAsdMXfo7+U=; b=GCDQTpS66xSLUge6U27YUpVH3IqTW+n6A1Ea4cMXbJc31eh6uOqh3Bsmwf6qRMfQEw oOTSLPSVagVrIEg+WWw+L5MeRR9tYrvffrrtpNfnHpfOuLjPHvRhCEYgg1+Nmaox+7Vu WPRTxcoQUOj5EUQCSQA89cQ2PeDU6toODhJEaYD3ce4pdv026Iu913TbtO/jFfsQTrN9 McjS5dK72P3xwk2fsafeLnfjGrehm5kknvyoRHSRcYJET+zEARrRWV4yKgsdfgfSU7EM 9jLjKm7qppDTnC8UewvdEwosTOHKEv3Pkitl/pRbNCN39o1YQy38KTyA57hWr7iYy7ti fjtg== X-Gm-Message-State: AOAM530VU5DCkj9NV0A/v7J/tXFqIQTUK+ZYHOwW7rBhK2Yqlb8beg1c tybE7mJa16X3CvpxE21fGSUOBQ== X-Received: by 2002:a92:d302:: with SMTP id x2mr4710813ila.175.1591818832177; Wed, 10 Jun 2020 12:53:52 -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 r10sm408828ile.36.2020.06.10.12.53.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jun 2020 12:53:51 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, subashab@codeaurora.org, cpratapa@codeaurora.org, bjorn.andersson@linaro.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net 4/5] net: ipa: header pad field only valid for AP->modem endpoint Date: Wed, 10 Jun 2020 14:53:31 -0500 Message-Id: <20200610195332.2612233-5-elder@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200610195332.2612233-1-elder@linaro.org> References: <20200610195332.2612233-1-elder@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Only QMAP endpoints should be configured to find a pad size field within packet headers. They are found in the first byte of the QMAP header (and the hardware fills only the 6 bits in that byte that constitute the pad_len field). The RMNet driver assumes the pad_len field is valid for received packets, so we want to ensure the pad_len field is filled in that case. That driver also assumes the length in the QMAP header includes the pad bytes. The RMNet driver does *not* pad the packets it sends, so the pad_len field can be ignored. Fix ipa_endpoint_init_hdr_ext() so it only marks the pad field offset valid for QMAP RX endpoints, and in that case indicates that the length field in the header includes the pad bytes. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_endpoint.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) -- 2.25.1 diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 59313ced7036..b35e027003b3 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -467,7 +467,7 @@ void ipa_endpoint_init_hdr(struct ipa_endpoint *endpoint) header_size += sizeof(struct rmnet_map_ul_csum_header); val |= u32_encode_bits(header_size, HDR_LEN_FMASK); - /* Define how to fill mux_id in a received QMAP header */ + /* Define how to fill fields in a received QMAP header */ if (!endpoint->toward_ipa) { u32 off; /* Field offset within header */ @@ -499,10 +499,21 @@ static void ipa_endpoint_init_hdr_ext(struct ipa_endpoint *endpoint) u32 val = 0; val |= HDR_ENDIANNESS_FMASK; /* big endian */ - val |= HDR_TOTAL_LEN_OR_PAD_VALID_FMASK; - /* HDR_TOTAL_LEN_OR_PAD is 0 (pad, not total_len) */ + + /* A QMAP header contains a 6 bit pad field at offset 0. The RMNet + * driver assumes this field is meaningful in packets it receives, + * and assumes the header's payload length includes that padding. + * The RMNet driver does *not* pad packets it sends, however, so + * the pad field (although 0) should be ignored. + */ + if (endpoint->data->qmap && !endpoint->toward_ipa) { + val |= HDR_TOTAL_LEN_OR_PAD_VALID_FMASK; + /* HDR_TOTAL_LEN_OR_PAD is 0 (pad, not total_len) */ + val |= HDR_PAYLOAD_LEN_INC_PADDING_FMASK; + /* HDR_TOTAL_LEN_OR_PAD_OFFSET is 0 */ + } + /* HDR_PAYLOAD_LEN_INC_PADDING is 0 */ - /* HDR_TOTAL_LEN_OR_PAD_OFFSET is 0 */ if (!endpoint->toward_ipa) val |= u32_encode_bits(pad_align, HDR_PAD_TO_ALIGNMENT_FMASK); From patchwork Wed Jun 10 19:53:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 187775 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp786071ilo; Wed, 10 Jun 2020 12:54:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIT4LhbRmS5KqHH26NUVRksiJeZ+Q11FMO6Rnq+okombHEg/nYv+xa1hWdkqbhTXSjv63n X-Received: by 2002:a17:906:b89a:: with SMTP id hb26mr5135272ejb.137.1591818856058; Wed, 10 Jun 2020 12:54:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591818856; cv=none; d=google.com; s=arc-20160816; b=EEaboLBq8wHKphaVcLpUxQ17DlEYyGzN9DqmmmQNn6aF3QusMa4C9JRn7EgFVXUfor SnxhCUUV/nI2i4LjImP5HLSm5Cdo9SVWbQycF6+V4KwLFP7BJgRgnXSA5d92tnctrTfS iCzBISrDa+wLl/vTJ+FR7mhWaucsofYGaYDJlppcV6te8Hktvrm/O7e7TOiDXu3q2Aq9 QK+2GCKWtLmRaLj65ECvcqyYep1uH6heJIFr0knmwUx6SN10DQr1IqHPMdyxODp0BAuU 6aUJSlF5DKkeihjxnrpPc/jpPyWWDb6NxEIViUL5iwB6VYrhhxiJdE9PB74ABz0H7aiV QTzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qFk1tcTUGEhxvyWsBEGOYLJYcEuf08mLBBeRJsLstbs=; b=kTt94DDX1Lk+ECBIshXmv5E5OrBCyC/tQaMYsji1jjgTJ6RelBpr9DhwdbFHjKesVH c9IMqFv8OZVqE2OjfU2/BtSKOYhfAkeBE9Dau12o7oHM2sc4sxINhSVGeQabhi09EX6f +ljtCAd3D2jNKo1tKnWLxhVDhu79vRsWk8DUPVrh+n3sw7XIfuGtohJo+9cpMQ3NkO44 qepjyIUUiV1CVqGhub3vYXJdB9iN9IObBPSm7XPmHal6QowhEX3O+zR4kgMgG6rvsvlQ PDCwsyz8vut6HHtq9FgpHmuGiP3ds308gDwDPTTY1KVDyEMMo4BlsYugatKeICEq7FXi TJzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f+qaMkkg; 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 i20si561840eja.745.2020.06.10.12.54.15; Wed, 10 Jun 2020 12:54:16 -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=f+qaMkkg; 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 S1730440AbgFJTyM (ORCPT + 9 others); Wed, 10 Jun 2020 15:54:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730396AbgFJTx4 (ORCPT ); Wed, 10 Jun 2020 15:53:56 -0400 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2850EC08C5C2 for ; Wed, 10 Jun 2020 12:53:54 -0700 (PDT) Received: by mail-il1-x142.google.com with SMTP id 18so3175703iln.9 for ; Wed, 10 Jun 2020 12:53:54 -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=qFk1tcTUGEhxvyWsBEGOYLJYcEuf08mLBBeRJsLstbs=; b=f+qaMkkgTmEpLeYukJk2jIqUGUwMptIghPDgNeMi79EFCqrEzc7UWd8+rmILNyb2lu VpTRXZh7ruwCrvKbtyay4pCk33wMEKqSw7wX2pzq6D8ociuUxJE22S+jvMWTQE8sfwOj Q0CsjZT7NFAXIEjZpo0ofsrIJGVdywbr/R3XPvCMWOAKFxBLJdDA5f0qw2Q3sxPjBFUG ffu6C7l+z2e/H2q9a2AqhHYLFU/joTUqWu1sLoxuTh9FIRtJ8ijhFXtWE4iFykUiMqCx neBMWMXX2tV7RILU8ZdZlAF7zRr1kSe3n9tb6eWJ0TKQBqc65FVw2YexHWWd59hJMKeY fJww== 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=qFk1tcTUGEhxvyWsBEGOYLJYcEuf08mLBBeRJsLstbs=; b=UQNBEaYoID8TDs6bIkmzw1HRWypoc2JYWae/GiQ6N93F1aYSik+zc/Q0MhBr7CsTgp NhsSm1bi4nccPznAzoc3wxDPnRv4uXYfFi48ijmpGmqLcsnV4kbA72hU2FnmODXFDJlM Ah+QiT2VDU5ZSWR4qwA3KWKCKfNZAA30sJNTNQZcoQPV4C5g/KyQnB4R6xT7XzxoYIe9 V2DOjqlOPtZiJGsJmeOJ47pBHCe5Yt6NkLEFIO0OVJQUUTi+C1plWXUUtssopyfzMvbo eer+t0M9/Y6KQW4whf8O90CyP5V+aQ7uMzk2gIpTDv1IKDU8yyTmC6umrJRWs+NGFSm/ IT5w== X-Gm-Message-State: AOAM531IRx13Q1fa8+DSQ6eQqXgV+KAcN4/hIatrCS7JqhofWMg7H7ve WHmrfCqICTWc6c+66LzcHVYSBw== X-Received: by 2002:a05:6e02:104b:: with SMTP id p11mr3524033ilj.26.1591818833544; Wed, 10 Jun 2020 12:53:53 -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 r10sm408828ile.36.2020.06.10.12.53.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jun 2020 12:53:53 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, subashab@codeaurora.org, cpratapa@codeaurora.org, bjorn.andersson@linaro.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net 5/5] net: ipa: warn if gsi_trans structure is too big Date: Wed, 10 Jun 2020 14:53:32 -0500 Message-Id: <20200610195332.2612233-6-elder@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200610195332.2612233-1-elder@linaro.org> References: <20200610195332.2612233-1-elder@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When the DEBUG_SPINLOCK and DEBUG_LOCK_ALLOC config options are enabled, sizeof(raw_spinlock_t) grows considerably (from 4 bytes to 56 bytes currently). As a consequence the size of the gsi_trans structure exceeds 128 bytes, and this triggers a BUILD_BUG_ON() error. These are useful configuration options to enable, so rather than causing a build failure, just issue a warning message at run time if the structure is larger than we'd prefer. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.25.1 diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 76d5108b8403..94d9aa0e999b 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -669,9 +669,6 @@ static void ipa_validate_build(void) */ BUILD_BUG_ON(GSI_TLV_MAX > U8_MAX); - /* Exceeding 128 bytes makes the transaction pool *much* larger */ - BUILD_BUG_ON(sizeof(struct gsi_trans) > 128); - /* This is used as a divisor */ BUILD_BUG_ON(!IPA_AGGR_GRANULARITY); #endif /* IPA_VALIDATE */ @@ -715,6 +712,10 @@ static int ipa_probe(struct platform_device *pdev) int ret; ipa_validate_build(); + /* Exceeding 128 bytes makes the transaction pool *much* larger */ + if (sizeof(struct gsi_trans) > 128) + dev_warn(dev, "WARNING: sizeof(struct gsi_trans) = %zu\n", + sizeof(struct gsi_trans)); /* If we need Trust Zone, make sure it's available */ modem_init = of_property_read_bool(dev->of_node, "modem-init");