From patchwork Sun May 22 00:32:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 575248 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 969F5C4332F for ; Sun, 22 May 2022 00:32:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245373AbiEVAcd (ORCPT ); Sat, 21 May 2022 20:32:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244534AbiEVAca (ORCPT ); Sat, 21 May 2022 20:32:30 -0400 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94B8740A2C for ; Sat, 21 May 2022 17:32:28 -0700 (PDT) Received: by mail-io1-xd2a.google.com with SMTP id e3so12117968ios.6 for ; Sat, 21 May 2022 17:32:28 -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=RDjvNwQr73WDdKShZZtiXObHhvvbcnoL8/p/PaQfpbU=; b=eek14q3Lwl6FAankzSVWLllAf1o0oev61OR+Nqb0yCryCj2XIc9UKZsg4fXQNtpO58 seEPphVQELgMmDZ9O7JfVNyWieVwPFpfnLscMX/OhRDXlgQkEXwCM+3FfB5zOWHAqCu9 pyuYB6VfS6nxxAQi2QEnGInu4AnsJkeLkjx/73Uxer5HzbuwZbHL4flDGCPnOlj27j77 XuerVRpKO/9B55nFn+O0/1AY7xj+/lzr4L4Mmr7Zs6iWnq9zaBIbrgBDdpLvGBTjGcuz V/saFSfzJv7AAJcP3nH/brw1GYRAGDfictuChY49STFdyRjX9cLEXcH6xoE/sZkSp+5Z 2kYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RDjvNwQr73WDdKShZZtiXObHhvvbcnoL8/p/PaQfpbU=; b=7K9io7SbPgbGx0OLfRKaBsSrD03x4OXef3Nt1cFZ9vncXJzeVINaCah72l1UGsWOOc pQQHM9TIcoANj3YDIe0Y0L9UbXewsd148D7uPcVGJJj8nUOXwtG/EUuZyT2lIQbqb/Ad TfAnnz8R6kUYRJn+cbcls3gygzNpDkIQMaljkjNbLXVUStJkLnI1iGzzPJqp5KxArox3 tx8PHR5fmuLA1MBesSIUYX9Iiv8EJCGavy3+uIZMoTbiD53Bq9UCSQZkX1VMFmQ9UD/T Mv+l507FifKHnkY3/90P2lhYb3gJlRIxIPhFmfNIeGwfkAHt22LsxsLTK6hYpDrDKLLz 1uUQ== X-Gm-Message-State: AOAM5337B3CMTetivom3l4IRoQjBSBIoIRhMZzWgAr2nd0n2qsa2RU3P /PGf0+oqp1Ved6hwV6hiccyxRw== X-Google-Smtp-Source: ABdhPJxlJWDFbCYtcr3ZvCg2ar0i8GMB37v/oJ4mq3nsyLJfP/UhPrIn/3a6SYMYXxtMxEXA/fdBoQ== X-Received: by 2002:a5d:9ccb:0:b0:660:6a38:60eb with SMTP id w11-20020a5d9ccb000000b006606a3860ebmr3692744iow.110.1653179547944; Sat, 21 May 2022 17:32:27 -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 g8-20020a02c548000000b0032b5e78bfcbsm1757115jaj.135.2022.05.21.17.32.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 17:32:27 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: mka@chromium.org, evgreen@chromium.org, bjorn.andersson@linaro.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 1/9] net: ipa: make endpoint HOLB drop configurable Date: Sat, 21 May 2022 19:32:15 -0500 Message-Id: <20220522003223.1123705-2-elder@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220522003223.1123705-1-elder@linaro.org> References: <20220522003223.1123705-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add a new Boolean flag for RX endpoints defining whether HOLB drop is initially enabled or disabled for the endpoint. All existing AP endpoints should have HOLB drop disabled. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_endpoint.c | 8 ++++++-- drivers/net/ipa/ipa_endpoint.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 0f489723689c5..3ad97fbf6884e 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -1554,8 +1554,12 @@ static void ipa_endpoint_program(struct ipa_endpoint *endpoint) ipa_endpoint_init_hdr_metadata_mask(endpoint); ipa_endpoint_init_mode(endpoint); ipa_endpoint_init_aggr(endpoint); - if (!endpoint->toward_ipa) - ipa_endpoint_init_hol_block_disable(endpoint); + if (!endpoint->toward_ipa) { + if (endpoint->config.rx.holb_drop) + ipa_endpoint_init_hol_block_enable(endpoint, 0); + else + ipa_endpoint_init_hol_block_disable(endpoint); + } ipa_endpoint_init_deaggr(endpoint); ipa_endpoint_init_rsrc_grp(endpoint); ipa_endpoint_init_seq(endpoint); diff --git a/drivers/net/ipa/ipa_endpoint.h b/drivers/net/ipa/ipa_endpoint.h index 39a12c249f66d..3ab62fb892ec6 100644 --- a/drivers/net/ipa/ipa_endpoint.h +++ b/drivers/net/ipa/ipa_endpoint.h @@ -60,6 +60,7 @@ struct ipa_endpoint_tx { * @buffer_size: requested receive buffer size (bytes) * @pad_align: power-of-2 boundary to which packet payload is aligned * @aggr_close_eof: whether aggregation closes on end-of-frame + * @holb_drop: whether to drop packets to avoid head-of-line blocking * * With each packet it transfers, the IPA hardware can perform certain * transformations of its packet data. One of these is adding pad bytes @@ -74,6 +75,7 @@ struct ipa_endpoint_rx { u32 buffer_size; u32 pad_align; bool aggr_close_eof; + bool holb_drop; }; /** From patchwork Sun May 22 00:32:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 575499 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 342BCC433FE for ; Sun, 22 May 2022 00:32:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238406AbiEVAcc (ORCPT ); Sat, 21 May 2022 20:32:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245373AbiEVAca (ORCPT ); Sat, 21 May 2022 20:32:30 -0400 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FC343DA69 for ; Sat, 21 May 2022 17:32:29 -0700 (PDT) Received: by mail-io1-xd35.google.com with SMTP id n145so2547785iod.3 for ; Sat, 21 May 2022 17:32:29 -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=hNHj18Pk290f11iq3jTbhbcmsqgCknmENNznS9C6gdk=; b=kJTlt5YRoe5urnbQdQT3RvhkSKoiMZ7YR5SIwY3bAn8E+TXLebh7Soug5KbH2Q36fn m7yxIBj5gThA0L40Y5ZSAAtAr+Y3ArSQ+bqBscEK8e8hJ0oevxU0iyp45TVowEOdkN9E LL/6Ah6mqX5EHQZSQR/Vq9JHoEGB9XGU5ugRe1qxs1lLcsrzyx8A8kHmTT0mJlNw5Ufu bS9cZeEkOuujffbZoaK333NKZ97zbhHyUQCIZmapDWPsOK2ty2Wt7beCkjGpcC9gAxy3 1tdPQ0q4Z9jTuiHGlsTkrkVx3+Xm6N5vuj0HbYbLWfv8pQCYEc8GB4wh2gU6Ks9Mwxxk Ir0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hNHj18Pk290f11iq3jTbhbcmsqgCknmENNznS9C6gdk=; b=ie3inx51puxBHchGRZ4bx0K3QjXCoYBoxMyKbfNdk6umdBA+c+qD6fV4PKWePD1Aet 3gvSFIRaAQNeaLwlgzyHo9ZPhznAZCatdqqMOHOpOFxSScj8odxoBmzzG6DtwqOr+Hun 6EByEClegA5On3wD+1Py1+FB3CGji6YXMApYBUoroTt6/cZfgK3eKnFvXe2+Zul6DkSg T1A4gPBOvk9d18/hmrZJaj0p8CSrf3Z771hAURCjBcUjcD/jw1HjtMXM32dJ4VpnTNqg YzIxltJ+hiwdDsLVuL/DtNfbSlffv+VnCx9face0k2xa31UWkmgwTn72jX9iZKbJfYI1 Ho/w== X-Gm-Message-State: AOAM530hm3Sn62Qt2xwddWxeHKn1KxHtOxkSst46L+6OmcScgKPadn1Y ZVhLkcUNH478imeQtgmfqCEzvg== X-Google-Smtp-Source: ABdhPJw3+r3+3wYlOtgN7exHO5itMZ5ZeSIkdzU4nCi1sblSyXkWyfkGlPQHeWPl+aPUd3YeLeOVBQ== X-Received: by 2002:a05:6638:248c:b0:32e:be23:7160 with SMTP id x12-20020a056638248c00b0032ebe237160mr735222jat.311.1653179548996; Sat, 21 May 2022 17:32:28 -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 g8-20020a02c548000000b0032b5e78bfcbsm1757115jaj.135.2022.05.21.17.32.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 17:32:28 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: mka@chromium.org, evgreen@chromium.org, bjorn.andersson@linaro.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 2/9] net: ipa: support hard aggregation limits Date: Sat, 21 May 2022 19:32:16 -0500 Message-Id: <20220522003223.1123705-3-elder@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220522003223.1123705-1-elder@linaro.org> References: <20220522003223.1123705-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add a new flag for AP receive endpoints that indicates whether a "hard limit" is used as a criterion for closing aggregation. Add comments explaining the difference between "hard" and "soft" aggregation limits. Pass a flag to ipa_aggr_size_kb() so it computes the proper aggregation size value whether using hard or soft limits. Move that function earlier in "ipa_endpoint.c" so it can be used without a forward-reference. Update ipa_endpoint_data_valid_one() so it validates endpoints whose data indicate a hard aggregation limit is used, and so it reports set aggregation flags for endpoints without aggregation enabled. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_endpoint.c | 89 +++++++++++++++++++++------------- drivers/net/ipa/ipa_endpoint.h | 15 +++++- 2 files changed, 69 insertions(+), 35 deletions(-) diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 3ad97fbf6884e..6079670bd8605 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -81,6 +81,24 @@ static u32 aggr_byte_limit_max(enum ipa_version version) return field_max(aggr_byte_limit_fmask(false)); } +/* Compute the aggregation size value to use for a given buffer size */ +static u32 ipa_aggr_size_kb(u32 rx_buffer_size, bool aggr_hard_limit) +{ + /* A hard aggregation limit will not be crossed; aggregation closes + * if saving incoming data would cross the hard byte limit boundary. + * + * With a soft limit, aggregation closes *after* the size boundary + * has been crossed. In that case the limit must leave enough space + * after that limit to receive a full MTU of data plus overhead. + */ + if (!aggr_hard_limit) + rx_buffer_size -= IPA_MTU + IPA_RX_BUFFER_OVERHEAD; + + /* The byte limit is encoded as a number of kilobytes */ + + return rx_buffer_size / SZ_1K; +} + static bool ipa_endpoint_data_valid_one(struct ipa *ipa, u32 count, const struct ipa_gsi_endpoint_data *all_data, const struct ipa_gsi_endpoint_data *data) @@ -93,7 +111,9 @@ static bool ipa_endpoint_data_valid_one(struct ipa *ipa, u32 count, return true; if (!data->toward_ipa) { + const struct ipa_endpoint_rx *rx_config; u32 buffer_size; + u32 aggr_size; u32 limit; if (data->endpoint.filter_support) { @@ -107,8 +127,10 @@ static bool ipa_endpoint_data_valid_one(struct ipa *ipa, u32 count, if (data->ee_id != GSI_EE_AP) return true; - buffer_size = data->endpoint.config.rx.buffer_size; + rx_config = &data->endpoint.config.rx; + /* The buffer size must hold an MTU plus overhead */ + buffer_size = rx_config->buffer_size; limit = IPA_MTU + IPA_RX_BUFFER_OVERHEAD; if (buffer_size < limit) { dev_err(dev, "RX buffer size too small for RX endpoint %u (%u < %u)\n", @@ -116,27 +138,39 @@ static bool ipa_endpoint_data_valid_one(struct ipa *ipa, u32 count, return false; } - /* For an endpoint supporting receive aggregation, the - * aggregation byte limit defines the point at which an - * aggregation window will close. It is programmed into the - * IPA hardware as a number of KB. We don't use "hard byte - * limit" aggregation, so we need to supply enough space in - * a receive buffer to hold a complete MTU plus normal skb - * overhead *after* that aggregation byte limit has been - * crossed. - * - * This check just ensures the receive buffer size doesn't - * exceed what's representable in the aggregation limit field. + if (!data->endpoint.config.aggregation) { + bool result = true; + + /* No aggregation; check for bogus aggregation data */ + if (rx_config->aggr_hard_limit) { + dev_err(dev, "hard limit with no aggregation for RX endpoint %u\n", + data->endpoint_id); + result = false; + } + + if (rx_config->aggr_close_eof) { + dev_err(dev, "close EOF with no aggregation for RX endpoint %u\n", + data->endpoint_id); + result = false; + } + + return result; /* Nothing more to check */ + } + + /* For an endpoint supporting receive aggregation, the byte + * limit defines the point at which aggregation closes. This + * check ensures the receive buffer size doesn't result in a + * limit that exceeds what's representable in the aggregation + * byte limit field. */ - if (data->endpoint.config.aggregation) { - limit += SZ_1K * aggr_byte_limit_max(ipa->version); - if (buffer_size - NET_SKB_PAD > limit) { - dev_err(dev, "RX buffer size too large for aggregated RX endpoint %u (%u > %u)\n", - data->endpoint_id, - buffer_size - NET_SKB_PAD, limit); + aggr_size = ipa_aggr_size_kb(buffer_size - NET_SKB_PAD, + rx_config->aggr_hard_limit); + limit = aggr_byte_limit_max(ipa->version); + if (aggr_size > limit) { + dev_err(dev, "aggregated size too large for RX endpoint %u (%u KB > %u KB)\n", + data->endpoint_id, aggr_size, limit); - return false; - } + return false; } return true; /* Nothing more to check for RX */ @@ -670,18 +704,6 @@ static void ipa_endpoint_init_mode(struct ipa_endpoint *endpoint) iowrite32(val, endpoint->ipa->reg_virt + offset); } -/* Compute the aggregation size value to use for a given buffer size */ -static u32 ipa_aggr_size_kb(u32 rx_buffer_size) -{ - /* We don't use "hard byte limit" aggregation, so we define the - * aggregation limit such that our buffer has enough space *after* - * that limit to receive a full MTU of data, plus overhead. - */ - rx_buffer_size -= IPA_MTU + IPA_RX_BUFFER_OVERHEAD; - - return rx_buffer_size / SZ_1K; -} - /* Encoded values for AGGR endpoint register fields */ static u32 aggr_byte_limit_encoded(enum ipa_version version, u32 limit) { @@ -753,7 +775,8 @@ static void ipa_endpoint_init_aggr(struct ipa_endpoint *endpoint) val |= u32_encode_bits(IPA_GENERIC, AGGR_TYPE_FMASK); buffer_size = rx_config->buffer_size; - limit = ipa_aggr_size_kb(buffer_size - NET_SKB_PAD); + limit = ipa_aggr_size_kb(buffer_size - NET_SKB_PAD, + rx_config->aggr_hard_limit); val |= aggr_byte_limit_encoded(version, limit); limit = IPA_AGGR_TIME_LIMIT; diff --git a/drivers/net/ipa/ipa_endpoint.h b/drivers/net/ipa/ipa_endpoint.h index 3ab62fb892ec6..1e72a9695d3d9 100644 --- a/drivers/net/ipa/ipa_endpoint.h +++ b/drivers/net/ipa/ipa_endpoint.h @@ -59,21 +59,32 @@ struct ipa_endpoint_tx { * struct ipa_endpoint_rx - Endpoint configuration for RX endpoints * @buffer_size: requested receive buffer size (bytes) * @pad_align: power-of-2 boundary to which packet payload is aligned + * @aggr_hard_limit: whether aggregation closes before or after boundary * @aggr_close_eof: whether aggregation closes on end-of-frame * @holb_drop: whether to drop packets to avoid head-of-line blocking * + * The actual size of the receive buffer is rounded up if necessary + * to be a power-of-2 number of pages. + * * With each packet it transfers, the IPA hardware can perform certain * transformations of its packet data. One of these is adding pad bytes * to the end of the packet data so the result ends on a power-of-2 boundary. * * It is also able to aggregate multiple packets into a single receive buffer. * Aggregation is "open" while a buffer is being filled, and "closes" when - * certain criteria are met. One of those criteria is the sender indicating - * a "frame" consisting of several transfers has ended. + * certain criteria are met. + * + * Insufficient space available in the receive buffer can close aggregation. + * The aggregation byte limit defines the point (in units of 1024 bytes) in + * the buffer where aggregation closes. With a "soft" aggregation limit, + * aggregation closes when a packet written to the buffer *crosses* that + * aggregation limit. With a "hard" aggregation limit, aggregation will + * close *before* writing a packet that would cross that boundary. */ struct ipa_endpoint_rx { u32 buffer_size; u32 pad_align; + bool aggr_hard_limit; bool aggr_close_eof; bool holb_drop; }; From patchwork Sun May 22 00:32:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 575498 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCDDBC433EF for ; Sun, 22 May 2022 00:32:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347978AbiEVAce (ORCPT ); Sat, 21 May 2022 20:32:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345036AbiEVAcb (ORCPT ); Sat, 21 May 2022 20:32:31 -0400 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F58140A27 for ; Sat, 21 May 2022 17:32:30 -0700 (PDT) Received: by mail-io1-xd35.google.com with SMTP id f4so12150875iov.2 for ; Sat, 21 May 2022 17:32:30 -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=O/hJEGVRLdpoiwk4u/5VFj9MSjRvGNpyvBvim/3YzJc=; b=YUScAgYBJ4o4GLBfTX+dczvlWRsAM4gTN0nLkhrhs21rT1KH/5ATRKSxjnf4akTbFI +GkP+SVxWcswc0Mvk635r1ZiawvlTm8GdthMiuDzFMxiIm7N4yAay4I0pH6gY9u0nfZS cpZs7aK1CvNWItzR/ao8ExkEN0bLK1XtkkhnZN0An2qioTybQgYiW9en/ONaYVWjHR/U kWU+Ys3XlM+06K/woCqUBGNo3Xsw04mF2di0YcCON5pLpeQ7NFS25zT1vUcAy/wet2IU GKjZ6DV4iC3HlcJgp7zf6JqhfHHhABgI/cnLUFwoHxzYaGZJB1Z6/4WdCn+m0MS7AajD B5Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=O/hJEGVRLdpoiwk4u/5VFj9MSjRvGNpyvBvim/3YzJc=; b=i0eQcMW+h8rewhH54q7WlQESgEmfiFVBN3iXp+Mez95pB3gK3fXM2diihLadoJjUwB U9uk1OTT5C5nCc7mjYuDvh6LM75UkF5GTqSrHSLoG0d/AJDAunNpzJKv+sywkShMxehw O15jNKLRNMabLttSneNlCyWguwkx5VmLjK8sBTgLf/yw+iVaYRyK9WVHavHzqUBWxZVP JpmfCYVZbX5FVWuyK68oqfGONs0+7LE93IlYJfzhXJqvUwMETlBOjg5loBjp+bM1hZqS OfbolNqbs/iTU/q2ZrqVjbO7GHvp0oRq07XwKdP6ABcCT5i/eswdlztaN7hKNBhKLGuh PuLA== X-Gm-Message-State: AOAM533iDYQLzRoL+4K3x3SWPhy1wDaWci15pd0cuOt/M0wiUxExu01C Comigp09zIZv+7cFCGj8IbJb8w== X-Google-Smtp-Source: ABdhPJx4/EiguPUhstcKxYnhAFO2U4V/4+lh739Tnt4W1ouT+YoYogNMQmURmxaqN2myLHqd3ORH8Q== X-Received: by 2002:a5d:8b91:0:b0:65e:47bb:bc36 with SMTP id p17-20020a5d8b91000000b0065e47bbbc36mr6662671iol.130.1653179549988; Sat, 21 May 2022 17:32:29 -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 g8-20020a02c548000000b0032b5e78bfcbsm1757115jaj.135.2022.05.21.17.32.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 17:32:29 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: mka@chromium.org, evgreen@chromium.org, bjorn.andersson@linaro.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 3/9] net: ipa: specify RX aggregation time limit in config data Date: Sat, 21 May 2022 19:32:17 -0500 Message-Id: <20220522003223.1123705-4-elder@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220522003223.1123705-1-elder@linaro.org> References: <20220522003223.1123705-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Don't assume that a 500 microsecond time limit should be used for all receive endpoints that support aggregation. Instead, specify the time limit to use in the configuration data. Set a 500 microsecond limit for all existing RX endpoints, as before. Checking for overflow for the time limit field is a bit complicated. Rather than duplicate a lot of code in ipa_endpoint_data_valid_one(), call WARN() if any value is found to be too large when encoding it. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_data-v3.1.c | 2 ++ drivers/net/ipa/ipa_data-v3.5.1.c | 2 ++ drivers/net/ipa/ipa_data-v4.11.c | 2 ++ drivers/net/ipa/ipa_data-v4.2.c | 2 ++ drivers/net/ipa/ipa_data-v4.5.c | 2 ++ drivers/net/ipa/ipa_data-v4.9.c | 2 ++ drivers/net/ipa/ipa_endpoint.c | 21 +++++++++++++++++---- drivers/net/ipa/ipa_endpoint.h | 6 ++++++ 8 files changed, 35 insertions(+), 4 deletions(-) diff --git a/drivers/net/ipa/ipa_data-v3.1.c b/drivers/net/ipa/ipa_data-v3.1.c index 8ff351aefd23f..00f4e506e6e51 100644 --- a/drivers/net/ipa/ipa_data-v3.1.c +++ b/drivers/net/ipa/ipa_data-v3.1.c @@ -103,6 +103,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { .rx = { .buffer_size = 8192, .pad_align = ilog2(sizeof(u32)), + .aggr_time_limit = 500, }, }, }, @@ -150,6 +151,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { .aggregation = true, .rx = { .buffer_size = 8192, + .aggr_time_limit = 500, .aggr_close_eof = true, }, }, diff --git a/drivers/net/ipa/ipa_data-v3.5.1.c b/drivers/net/ipa/ipa_data-v3.5.1.c index d1c466abddb22..b7e32e87733eb 100644 --- a/drivers/net/ipa/ipa_data-v3.5.1.c +++ b/drivers/net/ipa/ipa_data-v3.5.1.c @@ -94,6 +94,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { .rx = { .buffer_size = 8192, .pad_align = ilog2(sizeof(u32)), + .aggr_time_limit = 500, }, }, }, @@ -142,6 +143,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { .aggregation = true, .rx = { .buffer_size = 8192, + .aggr_time_limit = 500, .aggr_close_eof = true, }, }, diff --git a/drivers/net/ipa/ipa_data-v4.11.c b/drivers/net/ipa/ipa_data-v4.11.c index b1991cc6f0ca6..1be823e5c5c22 100644 --- a/drivers/net/ipa/ipa_data-v4.11.c +++ b/drivers/net/ipa/ipa_data-v4.11.c @@ -88,6 +88,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { .rx = { .buffer_size = 8192, .pad_align = ilog2(sizeof(u32)), + .aggr_time_limit = 500, }, }, }, @@ -135,6 +136,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { .aggregation = true, .rx = { .buffer_size = 32768, + .aggr_time_limit = 500, .aggr_close_eof = true, }, }, diff --git a/drivers/net/ipa/ipa_data-v4.2.c b/drivers/net/ipa/ipa_data-v4.2.c index 1190a43e8743c..683f1f91042f4 100644 --- a/drivers/net/ipa/ipa_data-v4.2.c +++ b/drivers/net/ipa/ipa_data-v4.2.c @@ -84,6 +84,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { .rx = { .buffer_size = 8192, .pad_align = ilog2(sizeof(u32)), + .aggr_time_limit = 500, }, }, }, @@ -132,6 +133,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { .aggregation = true, .rx = { .buffer_size = 8192, + .aggr_time_limit = 500, .aggr_close_eof = true, }, }, diff --git a/drivers/net/ipa/ipa_data-v4.5.c b/drivers/net/ipa/ipa_data-v4.5.c index 944f72b0f285e..79398f286a9cf 100644 --- a/drivers/net/ipa/ipa_data-v4.5.c +++ b/drivers/net/ipa/ipa_data-v4.5.c @@ -97,6 +97,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { .rx = { .buffer_size = 8192, .pad_align = ilog2(sizeof(u32)), + .aggr_time_limit = 500, }, }, }, @@ -144,6 +145,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { .aggregation = true, .rx = { .buffer_size = 8192, + .aggr_time_limit = 500, .aggr_close_eof = true, }, }, diff --git a/drivers/net/ipa/ipa_data-v4.9.c b/drivers/net/ipa/ipa_data-v4.9.c index 16786bff7ef84..4b96efd05cf22 100644 --- a/drivers/net/ipa/ipa_data-v4.9.c +++ b/drivers/net/ipa/ipa_data-v4.9.c @@ -89,6 +89,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { .rx = { .buffer_size = 8192, .pad_align = ilog2(sizeof(u32)), + .aggr_time_limit = 500, }, }, }, @@ -136,6 +137,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { .aggregation = true, .rx = { .buffer_size = 8192, + .aggr_time_limit = 500, .aggr_close_eof = true, }, }, diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 6079670bd8605..586529511cf6b 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -35,7 +35,6 @@ #define IPA_ENDPOINT_QMAP_METADATA_MASK 0x000000ff /* host byte order */ #define IPA_ENDPOINT_RESET_AGGR_RETRY_MAX 3 -#define IPA_AGGR_TIME_LIMIT 500 /* microseconds */ /** enum ipa_status_opcode - status element opcode hardware values */ enum ipa_status_opcode { @@ -142,6 +141,13 @@ static bool ipa_endpoint_data_valid_one(struct ipa *ipa, u32 count, bool result = true; /* No aggregation; check for bogus aggregation data */ + if (rx_config->aggr_time_limit) { + dev_err(dev, + "time limit with no aggregation for RX endpoint %u\n", + data->endpoint_id); + result = false; + } + if (rx_config->aggr_hard_limit) { dev_err(dev, "hard limit with no aggregation for RX endpoint %u\n", data->endpoint_id); @@ -722,9 +728,13 @@ static u32 aggr_time_limit_encoded(enum ipa_version version, u32 limit) if (version < IPA_VERSION_4_5) { /* We set aggregation granularity in ipa_hardware_config() */ - limit = DIV_ROUND_CLOSEST(limit, IPA_AGGR_GRANULARITY); + fmask = aggr_time_limit_fmask(true); + val = DIV_ROUND_CLOSEST(limit, IPA_AGGR_GRANULARITY); + WARN(val > field_max(fmask), + "aggr_time_limit too large (%u > %u usec)\n", + val, field_max(fmask) * IPA_AGGR_GRANULARITY); - return u32_encode_bits(limit, aggr_time_limit_fmask(true)); + return u32_encode_bits(val, fmask); } /* IPA v4.5 expresses the time limit using Qtime. The AP has @@ -739,6 +749,9 @@ static u32 aggr_time_limit_encoded(enum ipa_version version, u32 limit) /* Have to use pulse generator 1 (millisecond granularity) */ gran_sel = AGGR_GRAN_SEL_FMASK; val = DIV_ROUND_CLOSEST(limit, 1000); + WARN(val > field_max(fmask), + "aggr_time_limit too large (%u > %u usec)\n", + limit, field_max(fmask) * 1000); } else { /* We can use pulse generator 0 (100 usec granularity) */ gran_sel = 0; @@ -779,7 +792,7 @@ static void ipa_endpoint_init_aggr(struct ipa_endpoint *endpoint) rx_config->aggr_hard_limit); val |= aggr_byte_limit_encoded(version, limit); - limit = IPA_AGGR_TIME_LIMIT; + limit = rx_config->aggr_time_limit; val |= aggr_time_limit_encoded(version, limit); /* AGGR_PKT_LIMIT is 0 (unlimited) */ diff --git a/drivers/net/ipa/ipa_endpoint.h b/drivers/net/ipa/ipa_endpoint.h index 1e72a9695d3d9..01790c60bee8d 100644 --- a/drivers/net/ipa/ipa_endpoint.h +++ b/drivers/net/ipa/ipa_endpoint.h @@ -59,6 +59,7 @@ struct ipa_endpoint_tx { * struct ipa_endpoint_rx - Endpoint configuration for RX endpoints * @buffer_size: requested receive buffer size (bytes) * @pad_align: power-of-2 boundary to which packet payload is aligned + * @aggr_time_limit: time before aggregation closes (microseconds) * @aggr_hard_limit: whether aggregation closes before or after boundary * @aggr_close_eof: whether aggregation closes on end-of-frame * @holb_drop: whether to drop packets to avoid head-of-line blocking @@ -74,6 +75,10 @@ struct ipa_endpoint_tx { * Aggregation is "open" while a buffer is being filled, and "closes" when * certain criteria are met. * + * A time limit can be specified to close aggregation. Aggregation will be + * closed if this period passes after data is first written into a receive + * buffer. If not specified, no time limit is imposed. + * * Insufficient space available in the receive buffer can close aggregation. * The aggregation byte limit defines the point (in units of 1024 bytes) in * the buffer where aggregation closes. With a "soft" aggregation limit, @@ -84,6 +89,7 @@ struct ipa_endpoint_tx { struct ipa_endpoint_rx { u32 buffer_size; u32 pad_align; + u32 aggr_time_limit; bool aggr_hard_limit; bool aggr_close_eof; bool holb_drop; From patchwork Sun May 22 00:32:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 575495 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8B56C4332F for ; Sun, 22 May 2022 00:32:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344960AbiEVAcs (ORCPT ); Sat, 21 May 2022 20:32:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347829AbiEVAcc (ORCPT ); Sat, 21 May 2022 20:32:32 -0400 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9282240A2C for ; Sat, 21 May 2022 17:32:31 -0700 (PDT) Received: by mail-io1-xd34.google.com with SMTP id 2so2305719iou.5 for ; Sat, 21 May 2022 17:32:31 -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=uoOxtouvB2bKJ6UVCiMo5Cjkg2ZKrup85zpIf1aDzB0=; b=RUgedeWSHp2R2QZqA36Oc5g0B717zQVLlTrZprybbNiEo6pCuoRjUK69MdXJsRqz5W g3i5oqEZcyvmVMBbpfG7cA9xbr1W5l+12s5WirdcBymk3vZOiiZ+8OD1fT7PeiGDJMBr bRVvkEEIYmL50eIFCt+JDHlvcou5M0MamP408CTffNtX6kmYl9kSY6HnqTeUezwGGUT1 U/NCySNTCqF+eeSBdbzUVO+m2drgeAdGt78Av172UHu7c/+HmlFuBfQK1qiBAvs5NMVo pB/lW9p3unnyu7qh95ZoY/DLrySGpbx5iWAXqGdFyVznxAlL70v60QVadS8EILVSGu1n BOag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uoOxtouvB2bKJ6UVCiMo5Cjkg2ZKrup85zpIf1aDzB0=; b=ryTJjUoll+n96LXEzq9RcxZwCKaeVF+ZlYwnS3qHMfGiU+jBe5VsEiL2BcfKHQyGnr VQyRcS8jSVIDdJr51k6g5qivGX4ey31LH3RaET+rxesftRVZ6uJ8OdfaPyC/BSxDuWv4 f5z6rnii1H/+yUYnkWsvaR/HUsoIteFQlb0Sdm4P3j9Tlv0n6wTUy+8VsIO02Y2dSgyV mHj/QNRpgNb/gZy9ttxOatQKMq92cTTjDg1+xAJXCFoExvTQFRbO8MI4DlnDBuAP1dmA +ePcvbIILIo4vfGnZiVOspf6wTPr9x/aGlPES+f/0hRvQDsXWbDj7v9vQXhYY9otWK/B Q3mw== X-Gm-Message-State: AOAM530khMZlAXp4V/fg6Z6jEsKV7HG0bUnKrz+vQ5WDbsQ446m4M1V2 302/X96TZ2vODcGmAFp8myn/bA== X-Google-Smtp-Source: ABdhPJwPf7WoA9lMh9qECk3gFPkxZS8I36WMRezlgWGfoTK9FCm5VMPTx4o8qnCZLQhKQnQExwE4SA== X-Received: by 2002:a05:6638:3792:b0:32b:5cd3:50cd with SMTP id w18-20020a056638379200b0032b5cd350cdmr8379821jal.118.1653179550935; Sat, 21 May 2022 17:32:30 -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 g8-20020a02c548000000b0032b5e78bfcbsm1757115jaj.135.2022.05.21.17.32.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 17:32:30 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: mka@chromium.org, evgreen@chromium.org, bjorn.andersson@linaro.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 4/9] net: ipa: kill gsi_trans_commit_wait_timeout() Date: Sat, 21 May 2022 19:32:18 -0500 Message-Id: <20220522003223.1123705-5-elder@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220522003223.1123705-1-elder@linaro.org> References: <20220522003223.1123705-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Since the beginning gsi_trans_commit_wait_timeout() has existed to provide a way to allow waiting a limited time for a transaction to complete. But that function has never been used. In fact, there is no use for this function, because a transaction committed to hardware should *always* complete. The only reason it might not complete is if there were a hardware failure, or perhaps a system configuration error. Furthermore, if a timeout ever did occur, the IPA hardware would be in an indeterminate state, from which there is no recovery. It would require some sort of complete IPA reset, and would require the participation of the modem, and at this time there is no such sequence defined. So get rid of the definition of gsi_trans_commit_wait_timeout(), and update a few comments accordingly. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi_trans.c | 22 ---------------------- drivers/net/ipa/gsi_trans.h | 9 --------- drivers/net/ipa/ipa_cmd.c | 15 +++++++-------- drivers/net/ipa/ipa_endpoint.c | 1 - 4 files changed, 7 insertions(+), 40 deletions(-) diff --git a/drivers/net/ipa/gsi_trans.c b/drivers/net/ipa/gsi_trans.c index 87e1d43c118c1..bf31ef3d56adc 100644 --- a/drivers/net/ipa/gsi_trans.c +++ b/drivers/net/ipa/gsi_trans.c @@ -637,28 +637,6 @@ void gsi_trans_commit_wait(struct gsi_trans *trans) gsi_trans_free(trans); } -/* Commit a GSI transaction and wait for it to complete, with timeout */ -int gsi_trans_commit_wait_timeout(struct gsi_trans *trans, - unsigned long timeout) -{ - unsigned long timeout_jiffies = msecs_to_jiffies(timeout); - unsigned long remaining = 1; /* In case of empty transaction */ - - if (!trans->used) - goto out_trans_free; - - refcount_inc(&trans->refcount); - - __gsi_trans_commit(trans, true); - - remaining = wait_for_completion_timeout(&trans->completion, - timeout_jiffies); -out_trans_free: - gsi_trans_free(trans); - - return remaining ? 0 : -ETIMEDOUT; -} - /* Process the completion of a transaction; called while polling */ void gsi_trans_complete(struct gsi_trans *trans) { diff --git a/drivers/net/ipa/gsi_trans.h b/drivers/net/ipa/gsi_trans.h index af379b49299ee..387ea50dd039e 100644 --- a/drivers/net/ipa/gsi_trans.h +++ b/drivers/net/ipa/gsi_trans.h @@ -205,15 +205,6 @@ void gsi_trans_commit(struct gsi_trans *trans, bool ring_db); */ void gsi_trans_commit_wait(struct gsi_trans *trans); -/** - * gsi_trans_commit_wait_timeout() - Commit a GSI transaction and wait for - * it to complete, with timeout - * @trans: Transaction to commit - * @timeout: Timeout period (in milliseconds) - */ -int gsi_trans_commit_wait_timeout(struct gsi_trans *trans, - unsigned long timeout); - /** * gsi_trans_read_byte() - Issue a single byte read TRE on a channel * @gsi: GSI pointer diff --git a/drivers/net/ipa/ipa_cmd.c b/drivers/net/ipa/ipa_cmd.c index d57472ea077f2..77b84cea6e68f 100644 --- a/drivers/net/ipa/ipa_cmd.c +++ b/drivers/net/ipa/ipa_cmd.c @@ -26,14 +26,13 @@ * other than data transfer to another endpoint. * * Immediate commands are represented by GSI transactions just like other - * transfer requests, represented by a single GSI TRE. Each immediate - * command has a well-defined format, having a payload of a known length. - * This allows the transfer element's length field to be used to hold an - * immediate command's opcode. The payload for a command resides in DRAM - * and is described by a single scatterlist entry in its transaction. - * Commands do not require a transaction completion callback. To commit - * an immediate command transaction, either gsi_trans_commit_wait() or - * gsi_trans_commit_wait_timeout() is used. + * transfer requests, and use a single GSI TRE. Each immediate command + * has a well-defined format, having a payload of a known length. This + * allows the transfer element's length field to be used to hold an + * immediate command's opcode. The payload for a command resides in AP + * memory and is described by a single scatterlist entry in its transaction. + * Commands do not require a transaction completion callback, and are + * (currently) always issued using gsi_trans_commit_wait(). */ /* Some commands can wait until indicated pipeline stages are clear */ diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 586529511cf6b..5ed5b8fd3ea36 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -478,7 +478,6 @@ int ipa_endpoint_modem_exception_reset_all(struct ipa *ipa) ipa_cmd_pipeline_clear_add(trans); - /* XXX This should have a 1 second timeout */ gsi_trans_commit_wait(trans); ipa_cmd_pipeline_clear_wait(ipa); From patchwork Sun May 22 00:32:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 575245 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CED68C433F5 for ; Sun, 22 May 2022 00:32:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348258AbiEVAcq (ORCPT ); Sat, 21 May 2022 20:32:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347927AbiEVAcd (ORCPT ); Sat, 21 May 2022 20:32:33 -0400 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EED740931 for ; Sat, 21 May 2022 17:32:32 -0700 (PDT) Received: by mail-io1-xd31.google.com with SMTP id y12so12136084ior.7 for ; Sat, 21 May 2022 17:32:32 -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=w1h7lzBoTRhyrnPIVZrDCLdy25xtg4IsChqOgLd2WKk=; b=PTPwtLovhOsE11ooX/9DB0FEdX+sJIpSa7FNxpe2MzRMAc29BQRY/87J/gghpZlaHR Gu4/vFxwFtAZrsqoRHSxenYN2XSRM8laXMahnoLARsVn0clT3nRmTn2eF2bEb3quQ34e MezpcjuRVABCCgWSSgqfyw9rIZ+GpUqG6uLOKW39fGLpUNXLWCm2xEuqqQkMGh033lWF HReLueNOm/jQhwOGW/qAqCUtc0Q/BTa9lnG12eItT/q+C2UkVU0Tyz8jqsgfM00ncXF2 ic8PiPUA4L2u0fqcrEv+jgQv6r2Gr8NXjfp3JRV0gmSbc6lYo8U131FvDkTXCWCPXO+t 8D8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=w1h7lzBoTRhyrnPIVZrDCLdy25xtg4IsChqOgLd2WKk=; b=4nhHGoHbPBv4juLPFZfKkjzzybrwtM2URczMgGLZCDWtKRsKdjaH7F1EsA+FWzmEmd IaVb7iV1JpvIX7MRdfPA7VWafsDAjcOUUYtGxgQ2lsc+9ZnFl3krna5ceg1mgKYKOjaY u2ndVVwZ2IolEiRVFpvHJQhIv2LxAef5jPmfjtq0/OcQq2jXLM8e8lYgrLRRxN2zzXkm RwCcngQBizXUKFOrV66m4ucumqKpgCWmDliqhDLULotlcvxkg4TZ4NBF0VUXRdt27cAn 8neLd/MTzVnx7u9rHU451A9Uc6jXicFsfWb9zrgMBquG4wmGLpUKbQOCoNtqCEiq6Avw +dbQ== X-Gm-Message-State: AOAM53342NKG+Y6oE6ursnKqsKVNpctLp1rUpHP018jxAOD9YZ6F9v3O nEGaBogjP2RKtg4/1dFEdVqxyQ== X-Google-Smtp-Source: ABdhPJw2rchZw30QgObmn4lR9kWP2wPXd/KGSAKRpLux2f8JtTrVAukiW/XFW5bnYvuNHfPPq9cccA== X-Received: by 2002:a6b:3e41:0:b0:65a:4456:90b8 with SMTP id l62-20020a6b3e41000000b0065a445690b8mr7491000ioa.57.1653179551901; Sat, 21 May 2022 17:32:31 -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 g8-20020a02c548000000b0032b5e78bfcbsm1757115jaj.135.2022.05.21.17.32.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 17:32:31 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: mka@chromium.org, evgreen@chromium.org, bjorn.andersson@linaro.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 5/9] net: ipa: count the number of modem TX endpoints Date: Sat, 21 May 2022 19:32:19 -0500 Message-Id: <20220522003223.1123705-6-elder@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220522003223.1123705-1-elder@linaro.org> References: <20220522003223.1123705-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org In ipa_endpoint_modem_exception_reset_all(), a high estimate was made of the number of endpoints that need their status register updated. We only used what was needed, so the high estimate didn't matter much. However the next few patches are going to limit the number of commands in a single transaction, and the overestimate would exceed that. So count the number of modem TX endpoints at initialization time, and use it in ipa_endpoint_modem_exception_reset_all(). Signed-off-by: Alex Elder --- v2: This is a new patch added to the series. drivers/net/ipa/ipa.h | 2 ++ drivers/net/ipa/ipa_endpoint.c | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/net/ipa/ipa.h b/drivers/net/ipa/ipa.h index 9fc880eb7e3a6..4fc3c72359f5e 100644 --- a/drivers/net/ipa/ipa.h +++ b/drivers/net/ipa/ipa.h @@ -62,6 +62,7 @@ struct ipa_interrupt; * @initialized: Bit mask indicating endpoints initialized * @set_up: Bit mask indicating endpoints set up * @enabled: Bit mask indicating endpoints enabled + * @modem_tx_count: Number of defined modem TX endoints * @endpoint: Array of endpoint information * @channel_map: Mapping of GSI channel to IPA endpoint * @name_map: Mapping of IPA endpoint name to IPA endpoint @@ -114,6 +115,7 @@ struct ipa { u32 set_up; u32 enabled; + u32 modem_tx_count; struct ipa_endpoint endpoint[IPA_ENDPOINT_MAX]; struct ipa_endpoint *channel_map[GSI_CHANNEL_COUNT_MAX]; struct ipa_endpoint *name_map[IPA_ENDPOINT_COUNT]; diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 5ed5b8fd3ea36..385aa63ab4bbc 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -442,12 +442,10 @@ int ipa_endpoint_modem_exception_reset_all(struct ipa *ipa) struct gsi_trans *trans; u32 count; - /* We need one command per modem TX endpoint. We can get an upper - * bound on that by assuming all initialized endpoints are modem->IPA. - * That won't happen, and we could be more precise, but this is fine - * for now. End the transaction with commands to clear the pipeline. + /* We need one command per modem TX endpoint, plus the commands + * that clear the pipeline. */ - count = hweight32(initialized) + ipa_cmd_pipeline_clear_count(); + count = ipa->modem_tx_count + ipa_cmd_pipeline_clear_count(); trans = ipa_cmd_trans_alloc(ipa, count); if (!trans) { dev_err(&ipa->pdev->dev, @@ -1924,6 +1922,8 @@ u32 ipa_endpoint_init(struct ipa *ipa, u32 count, if (data->endpoint.filter_support) filter_map |= BIT(data->endpoint_id); + if (data->ee_id == GSI_EE_MODEM && data->toward_ipa) + ipa->modem_tx_count++; } if (!ipa_filter_map_valid(ipa, filter_map)) From patchwork Sun May 22 00:32:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 575496 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26CA4C4332F for ; Sun, 22 May 2022 00:32:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348166AbiEVAcq (ORCPT ); Sat, 21 May 2022 20:32:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348027AbiEVAci (ORCPT ); Sat, 21 May 2022 20:32:38 -0400 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D94941332 for ; Sat, 21 May 2022 17:32:33 -0700 (PDT) Received: by mail-io1-xd34.google.com with SMTP id d198so7081319iof.12 for ; Sat, 21 May 2022 17:32:33 -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=vSHRCF1zLoP2q/+UJGoTXeLZBLEijQ7Yq4ob+ptO93g=; b=iB7k+gP/BYojiNiJGmsLTKWyLiYiZe4T/k9oRUOCYCdxlbsD4IneL0be9ghqu1hItr co8BwQFyZd3oNiZh647qlXR1Mo00IGm+V/oSu568oNy8yKWNUl0KMKM9tUMuxquEsgLx JNip0o8vWKTHYlZdtCwsf8+REuPAGObOG5E6twpZOdnsPTk2tNv24SbSu1d+kRHBbr+R IHSULEYDDd8Ouq9cPU7JkPxWCsz9GbrmiV02NYV0gqpIYd20Qk9UpP8rCJf+5CRei7UY SR+hRizcba8KB8U2EqhPkUizrNfqwZnBCEDHqc4LnfJVCu5IYAZLX9A2i3sojTchWutS 3p1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vSHRCF1zLoP2q/+UJGoTXeLZBLEijQ7Yq4ob+ptO93g=; b=0FWtufYk9pkoFirqcu3qVwJ8qR9xYWY2c7gaTWoRpHR9z0dE1weKASSBOescRNXV7B jj7bBai67hX1/WtGFQfTWSszKCCvWiANvXlN31P70BnhrcZnfNDGLY1jNRq8ejfhtEoj Y10MGl5JmXnAysr+Kh2GCcFSQkaODiEgEG5O2DGksW+2T1zZmHr+31fugEfvMvu7CK2R C9E9CA1W9+F9j+PbCQLofnsIQ1/o8Bz1SjEIGd9PZJGHQwo/d9buQKgrtagTId6z/2Qu biWG/aKDzJnx4cD7gGCYVpNLdAv+3l+s2ESsxlpfXytZr8XJp8PU1SSOAebn9hS2Iu/w uoFA== X-Gm-Message-State: AOAM5326hEBJwLqFeQxHzZbbuuAviaQc271HwmkzHtB+jXNd5eYNQA5N vT/YQkurLiC32sUqWhP2S/tiXg== X-Google-Smtp-Source: ABdhPJzD0BYBNArdMKVqWQ6eigVMGbyZEWe6N3RLCKQ4XXDUato0ebby29kpFim3TkXxl9zBUX4NyA== X-Received: by 2002:a02:234a:0:b0:32a:f07c:e8 with SMTP id u71-20020a02234a000000b0032af07c00e8mr8363690jau.87.1653179552867; Sat, 21 May 2022 17:32:32 -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 g8-20020a02c548000000b0032b5e78bfcbsm1757115jaj.135.2022.05.21.17.32.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 17:32:32 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: mka@chromium.org, evgreen@chromium.org, bjorn.andersson@linaro.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 6/9] net: ipa: get rid of ipa_cmd_info->direction Date: Sat, 21 May 2022 19:32:20 -0500 Message-Id: <20220522003223.1123705-7-elder@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220522003223.1123705-1-elder@linaro.org> References: <20220522003223.1123705-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The direction field of the ipa_cmd_info structure is set, but never used. It seems it might have been used for the DMA_SHARED_MEM immediate command, but the DIRECTION flag is set based on the value of the passed-in direction flag there. Anyway, remove this unused field from the ipa_cmd_info structure. This is done as a separate patch to make it very obvious that it's not required. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi_trans.c | 5 +---- drivers/net/ipa/ipa_cmd.h | 2 -- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/net/ipa/gsi_trans.c b/drivers/net/ipa/gsi_trans.c index bf31ef3d56adc..cf8ee42373547 100644 --- a/drivers/net/ipa/gsi_trans.c +++ b/drivers/net/ipa/gsi_trans.c @@ -413,7 +413,6 @@ void gsi_trans_cmd_add(struct gsi_trans *trans, void *buf, u32 size, dma_addr_t addr, enum dma_data_direction direction, enum ipa_cmd_opcode opcode) { - struct ipa_cmd_info *info; u32 which = trans->used++; struct scatterlist *sg; @@ -438,9 +437,7 @@ void gsi_trans_cmd_add(struct gsi_trans *trans, void *buf, u32 size, sg_dma_address(sg) = addr; sg_dma_len(sg) = size; - info = &trans->info[which]; - info->opcode = opcode; - info->direction = direction; + trans->info[which].opcode = opcode; } /* Add a page transfer to a transaction. It will fill the only TRE. */ diff --git a/drivers/net/ipa/ipa_cmd.h b/drivers/net/ipa/ipa_cmd.h index 05ed7e42e1842..d4dbe2ce96dcd 100644 --- a/drivers/net/ipa/ipa_cmd.h +++ b/drivers/net/ipa/ipa_cmd.h @@ -50,11 +50,9 @@ enum ipa_cmd_opcode { * struct ipa_cmd_info - information needed for an IPA immediate command * * @opcode: The command opcode. - * @direction: Direction of data transfer for DMA commands */ struct ipa_cmd_info { enum ipa_cmd_opcode opcode; - enum dma_data_direction direction; }; /** From patchwork Sun May 22 00:32:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 575247 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEA92C433F5 for ; Sun, 22 May 2022 00:32:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348048AbiEVAck (ORCPT ); Sat, 21 May 2022 20:32:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348081AbiEVAcj (ORCPT ); Sat, 21 May 2022 20:32:39 -0400 Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67B0441600 for ; Sat, 21 May 2022 17:32:34 -0700 (PDT) Received: by mail-io1-xd2f.google.com with SMTP id p74so8497405iod.8 for ; Sat, 21 May 2022 17:32:34 -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=ym9OYI6aJ18dYi6ySu0CCwN+bayr/dGSVhve9l8ISjg=; b=KuZEmJbmTHrLdBEmn5boklpye3PNVq3z35R6zKUmXg0RlkAzsG4CyYTiCnzxkhkqGD GB6w7g6sV4ZBxzS2DwB5mWHtHfOfY3iJ2KZO/qf1VT7nwta5JOduxZD839yew9ZyoORR DzQCoF/MYvAolWkUap0ikBmrWT56h5dm8pYfeY9c7RBdfAc8Tf55y/Ycu5+PQAUw3Nq6 Q41ljgvVNVdYiFZDvTZUxylfjFw5xqSuu//w2dXtPKdpYzNVMBVoqXqDHxFhYekZbwjT 0DlXaZ1rS5+PQUnNyPwdMH82GK3S8xnMcewmPUqzc8H397VOluhoAxYhaOPcfGMMai1q aWpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ym9OYI6aJ18dYi6ySu0CCwN+bayr/dGSVhve9l8ISjg=; b=PfmF0lx6E4FNBk7pg9QXLNN1DITA6jWr8hG94u7S/smI5ZsKPMyIWRpHrrq9qbgnby OBWpSBSDacPzISbCWWvxT0J22+9gtU37nOuYOv3z14aK3vv/xCtdmikaWAZAbUcW4gOo kLIrPLQOlhE7MNVR2dx2vz7iFt6KFzBRzTymkvaJ4/do1bsIXxqQTof1oAmBpz7yT0jC tHISKj2BlLssXHfNO+KYqP8KMef0EK5NrXt7ldRJeLdWUbTWWwzqRCbYVdQGdFVWLSUA deHB3CFOeztN5t8FY85FbJaSHQawi8v0EA5k952yBEqVb0uXwR+s/lZBkjXFRQNXuSrh Aijg== X-Gm-Message-State: AOAM530LZNb4Cs6jH5vbjsYWKr8Uinr1bwmY2sA6ytOfcaxeLPQbNTDD ctzYBSO1uOYJglaxMMTk17ADXg== X-Google-Smtp-Source: ABdhPJwsYrD8/1poPZZ1cPHP4HJ2D5y/ecdDDDexSDvrGYSpusV9+UR1gE5e4fKnjHr/t7A7IZEo5A== X-Received: by 2002:a05:6638:1486:b0:32b:e870:b2a7 with SMTP id j6-20020a056638148600b0032be870b2a7mr8571202jak.200.1653179553820; Sat, 21 May 2022 17:32:33 -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 g8-20020a02c548000000b0032b5e78bfcbsm1757115jaj.135.2022.05.21.17.32.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 17:32:33 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: mka@chromium.org, evgreen@chromium.org, bjorn.andersson@linaro.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 7/9] net: ipa: remove command direction argument Date: Sat, 21 May 2022 19:32:21 -0500 Message-Id: <20220522003223.1123705-8-elder@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220522003223.1123705-1-elder@linaro.org> References: <20220522003223.1123705-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org We no longer use the direction argument for gsi_trans_cmd_add(), so get rid of it in its definition, and in its seven callers. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi_trans.c | 3 +-- drivers/net/ipa/gsi_trans.h | 4 +--- drivers/net/ipa/ipa_cmd.c | 22 +++++++--------------- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/drivers/net/ipa/gsi_trans.c b/drivers/net/ipa/gsi_trans.c index cf8ee42373547..472792992f866 100644 --- a/drivers/net/ipa/gsi_trans.c +++ b/drivers/net/ipa/gsi_trans.c @@ -410,8 +410,7 @@ void gsi_trans_free(struct gsi_trans *trans) /* Add an immediate command to a transaction */ void gsi_trans_cmd_add(struct gsi_trans *trans, void *buf, u32 size, - dma_addr_t addr, enum dma_data_direction direction, - enum ipa_cmd_opcode opcode) + dma_addr_t addr, enum ipa_cmd_opcode opcode) { u32 which = trans->used++; struct scatterlist *sg; diff --git a/drivers/net/ipa/gsi_trans.h b/drivers/net/ipa/gsi_trans.h index 387ea50dd039e..9a39909915ef5 100644 --- a/drivers/net/ipa/gsi_trans.h +++ b/drivers/net/ipa/gsi_trans.h @@ -165,12 +165,10 @@ void gsi_trans_free(struct gsi_trans *trans); * @buf: Buffer pointer for command payload * @size: Number of bytes in buffer * @addr: DMA address for payload - * @direction: Direction of DMA transfer (or DMA_NONE if none required) * @opcode: IPA immediate command opcode */ void gsi_trans_cmd_add(struct gsi_trans *trans, void *buf, u32 size, - dma_addr_t addr, enum dma_data_direction direction, - enum ipa_cmd_opcode opcode); + dma_addr_t addr, enum ipa_cmd_opcode opcode); /** * gsi_trans_page_add() - Add a page transfer to a transaction diff --git a/drivers/net/ipa/ipa_cmd.c b/drivers/net/ipa/ipa_cmd.c index 77b84cea6e68f..5fd74d7007044 100644 --- a/drivers/net/ipa/ipa_cmd.c +++ b/drivers/net/ipa/ipa_cmd.c @@ -402,7 +402,6 @@ void ipa_cmd_table_init_add(struct gsi_trans *trans, dma_addr_t hash_addr) { struct ipa *ipa = container_of(trans->gsi, struct ipa, gsi); - enum dma_data_direction direction = DMA_TO_DEVICE; struct ipa_cmd_hw_ip_fltrt_init *payload; union ipa_cmd_payload *cmd_payload; dma_addr_t payload_addr; @@ -433,7 +432,7 @@ void ipa_cmd_table_init_add(struct gsi_trans *trans, payload->nhash_rules_addr = cpu_to_le64(addr); gsi_trans_cmd_add(trans, payload, sizeof(*payload), payload_addr, - direction, opcode); + opcode); } /* Initialize header space in IPA-local memory */ @@ -442,7 +441,6 @@ void ipa_cmd_hdr_init_local_add(struct gsi_trans *trans, u32 offset, u16 size, { struct ipa *ipa = container_of(trans->gsi, struct ipa, gsi); enum ipa_cmd_opcode opcode = IPA_CMD_HDR_INIT_LOCAL; - enum dma_data_direction direction = DMA_TO_DEVICE; struct ipa_cmd_hw_hdr_init_local *payload; union ipa_cmd_payload *cmd_payload; dma_addr_t payload_addr; @@ -464,7 +462,7 @@ void ipa_cmd_hdr_init_local_add(struct gsi_trans *trans, u32 offset, u16 size, payload->flags = cpu_to_le32(flags); gsi_trans_cmd_add(trans, payload, sizeof(*payload), payload_addr, - direction, opcode); + opcode); } void ipa_cmd_register_write_add(struct gsi_trans *trans, u32 offset, u32 value, @@ -521,7 +519,7 @@ void ipa_cmd_register_write_add(struct gsi_trans *trans, u32 offset, u32 value, payload->clear_options = cpu_to_le32(options); gsi_trans_cmd_add(trans, payload, sizeof(*payload), payload_addr, - DMA_NONE, opcode); + opcode); } /* Skip IP packet processing on the next data transfer on a TX channel */ @@ -529,7 +527,6 @@ static void ipa_cmd_ip_packet_init_add(struct gsi_trans *trans, u8 endpoint_id) { struct ipa *ipa = container_of(trans->gsi, struct ipa, gsi); enum ipa_cmd_opcode opcode = IPA_CMD_IP_PACKET_INIT; - enum dma_data_direction direction = DMA_TO_DEVICE; struct ipa_cmd_ip_packet_init *payload; union ipa_cmd_payload *cmd_payload; dma_addr_t payload_addr; @@ -541,7 +538,7 @@ static void ipa_cmd_ip_packet_init_add(struct gsi_trans *trans, u8 endpoint_id) IPA_PACKET_INIT_DEST_ENDPOINT_FMASK); gsi_trans_cmd_add(trans, payload, sizeof(*payload), payload_addr, - direction, opcode); + opcode); } /* Use a DMA command to read or write a block of IPA-resident memory */ @@ -552,7 +549,6 @@ void ipa_cmd_dma_shared_mem_add(struct gsi_trans *trans, u32 offset, u16 size, enum ipa_cmd_opcode opcode = IPA_CMD_DMA_SHARED_MEM; struct ipa_cmd_hw_dma_mem_mem *payload; union ipa_cmd_payload *cmd_payload; - enum dma_data_direction direction; dma_addr_t payload_addr; u16 flags; @@ -583,17 +579,14 @@ void ipa_cmd_dma_shared_mem_add(struct gsi_trans *trans, u32 offset, u16 size, payload->flags = cpu_to_le16(flags); payload->system_addr = cpu_to_le64(addr); - direction = toward_ipa ? DMA_TO_DEVICE : DMA_FROM_DEVICE; - gsi_trans_cmd_add(trans, payload, sizeof(*payload), payload_addr, - direction, opcode); + opcode); } static void ipa_cmd_ip_tag_status_add(struct gsi_trans *trans) { struct ipa *ipa = container_of(trans->gsi, struct ipa, gsi); enum ipa_cmd_opcode opcode = IPA_CMD_IP_PACKET_TAG_STATUS; - enum dma_data_direction direction = DMA_TO_DEVICE; struct ipa_cmd_ip_packet_tag_status *payload; union ipa_cmd_payload *cmd_payload; dma_addr_t payload_addr; @@ -604,14 +597,13 @@ static void ipa_cmd_ip_tag_status_add(struct gsi_trans *trans) payload->tag = le64_encode_bits(0, IP_PACKET_TAG_STATUS_TAG_FMASK); gsi_trans_cmd_add(trans, payload, sizeof(*payload), payload_addr, - direction, opcode); + opcode); } /* Issue a small command TX data transfer */ static void ipa_cmd_transfer_add(struct gsi_trans *trans) { struct ipa *ipa = container_of(trans->gsi, struct ipa, gsi); - enum dma_data_direction direction = DMA_TO_DEVICE; enum ipa_cmd_opcode opcode = IPA_CMD_NONE; union ipa_cmd_payload *payload; dma_addr_t payload_addr; @@ -620,7 +612,7 @@ static void ipa_cmd_transfer_add(struct gsi_trans *trans) payload = ipa_cmd_payload_alloc(ipa, &payload_addr); gsi_trans_cmd_add(trans, payload, sizeof(*payload), payload_addr, - direction, opcode); + opcode); } /* Add immediate commands to a transaction to clear the hardware pipeline */ From patchwork Sun May 22 00:32:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 575497 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EF0FC4332F for ; Sun, 22 May 2022 00:32:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239104AbiEVAcn (ORCPT ); Sat, 21 May 2022 20:32:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348119AbiEVAcj (ORCPT ); Sat, 21 May 2022 20:32:39 -0400 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D50D41616 for ; Sat, 21 May 2022 17:32:35 -0700 (PDT) Received: by mail-io1-xd35.google.com with SMTP id n145so2547785iod.3 for ; Sat, 21 May 2022 17:32:35 -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=gEtlxxZ1RupvbnWDC4YcRwDjh6C8P556iqC2Z5nSepA=; b=pVeCNjqlXdZr6ozyMwGMKd8KjrCVSOm8NYfPrUvOF07pBV/Nfl2woek/UjKDUabc+a yi9oc19hvalUxl6QCIkg4h65GEcdalztzc6AC85wjdOElrYqSmWeXEBcHg81PwiOyQUl vbyOuNnBu71SZS+MG0LHIEUL1EiHTe1aS3Xdcw235kR5gWWegUUvGyRkGZnF7/XtR+4v h43iPhrPQWv/waAR4UwPpnpjDLAynE56am9o8iAgkalQ9TEezpy339+0D5hW507v1YKN mvRJ+UKyTr29ypAh+GExGaVbQogTkZySd8lbPBzAcMkFPmjwIDf78I92xkieRn4ZPewY /R1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gEtlxxZ1RupvbnWDC4YcRwDjh6C8P556iqC2Z5nSepA=; b=B8ycPp4GgvEAuDbi5jX6MdXoEBklIvy8GL0xzxlxOgRdZdqbOrDy99jskWnWo3zvos vXQlCoW7Ojz74lhu3p/DWFRFH5LxCCP9S362sOW0z3/lzhA4tQV7HADq2IGMuyUl2Mw6 yEvSAI03njqtV7tB/0ezTUHSXvPy0nI39GcVCjsvoW4g7QKc5GuBBsP7NA8w6Yk7AUXw W5Y/7IO/3PsReCwFpZ2TV6MIterpuYrkejxHpzVl+7/jqjNP1IzJaUP7PKrOfkRy8Csx aZaJvEkuA4b9XxCP36yB4EkTz+ObE+1wFYcLAtQU8TYQcntikFxnzxXZTUYvrfyNusD+ tpyw== X-Gm-Message-State: AOAM532ARN/GPEgcgOp+9QVdBvcNOruPxlYXS5ucuCAgNqd3z+Jwk4lz 3P/v2CRcJgwEqMt3xe0efritmQ== X-Google-Smtp-Source: ABdhPJw4YvFzwi9c/GZ3Kzv6V6od+/zagSEOGtVBAVBZQ/cLSK8y8fy07D5vVqv22Jm1X1dLKYgI0g== X-Received: by 2002:a5d:895a:0:b0:65e:4de4:1998 with SMTP id b26-20020a5d895a000000b0065e4de41998mr5620826iot.87.1653179554771; Sat, 21 May 2022 17:32:34 -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 g8-20020a02c548000000b0032b5e78bfcbsm1757115jaj.135.2022.05.21.17.32.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 17:32:34 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: mka@chromium.org, evgreen@chromium.org, bjorn.andersson@linaro.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 8/9] net: ipa: remove command info pool Date: Sat, 21 May 2022 19:32:22 -0500 Message-Id: <20220522003223.1123705-9-elder@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220522003223.1123705-1-elder@linaro.org> References: <20220522003223.1123705-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The ipa_cmd_info structure now contains only one field, and it's an enumerated type whose values all fit in 8 bits. Currently we'll never use more than 8 TREs in a command transaction, and we can represent that number of command opcodes in the same space as a 64 bit pointer to an ipa_cmd_info structure. Define IPA_COMMAND_TRANS_TRE_MAX as the maximum number of TREs that can be in a command transaction. Replace the info pointer in a transaction with a fixed-size array named cmd_opcode[] of that many bytes. Store the opcode in this array when adding a command TRE to a transaction, as was done previously for the info array. This makes the ipa_cmd_info unused, so get rid of it. When committing an immediate command transaction, use the channel's Boolean command flag to determine whether to fill in the opcode, which will be taken (as before) from the array in the transaction. This makes the command info pool unnecessary, so get rid of it. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.h | 1 - drivers/net/ipa/gsi_trans.c | 10 ++++----- drivers/net/ipa/gsi_trans.h | 7 +++++-- drivers/net/ipa/ipa_cmd.c | 41 ++++++++----------------------------- drivers/net/ipa/ipa_cmd.h | 9 -------- 5 files changed, 18 insertions(+), 50 deletions(-) diff --git a/drivers/net/ipa/gsi.h b/drivers/net/ipa/gsi.h index 9cc6576588116..5d66116b46b03 100644 --- a/drivers/net/ipa/gsi.h +++ b/drivers/net/ipa/gsi.h @@ -84,7 +84,6 @@ struct gsi_trans_info { struct gsi_trans_pool pool; /* transaction pool */ struct gsi_trans_pool sg_pool; /* scatterlist pool */ struct gsi_trans_pool cmd_pool; /* command payload DMA pool */ - struct gsi_trans_pool info_pool;/* command information pool */ struct gsi_trans **map; /* TRE -> transaction map */ spinlock_t spinlock; /* protects updates to the lists */ diff --git a/drivers/net/ipa/gsi_trans.c b/drivers/net/ipa/gsi_trans.c index 472792992f866..55f8fe7d2668e 100644 --- a/drivers/net/ipa/gsi_trans.c +++ b/drivers/net/ipa/gsi_trans.c @@ -436,7 +436,7 @@ void gsi_trans_cmd_add(struct gsi_trans *trans, void *buf, u32 size, sg_dma_address(sg) = addr; sg_dma_len(sg) = size; - trans->info[which].opcode = opcode; + trans->cmd_opcode[which] = opcode; } /* Add a page transfer to a transaction. It will fill the only TRE. */ @@ -552,10 +552,10 @@ static void __gsi_trans_commit(struct gsi_trans *trans, bool ring_db) struct gsi_ring *ring = &channel->tre_ring; enum ipa_cmd_opcode opcode = IPA_CMD_NONE; bool bei = channel->toward_ipa; - struct ipa_cmd_info *info; struct gsi_tre *dest_tre; struct scatterlist *sg; u32 byte_count = 0; + u8 *cmd_opcode; u32 avail; u32 i; @@ -566,7 +566,7 @@ static void __gsi_trans_commit(struct gsi_trans *trans, bool ring_db) * If there is no info array we're doing a simple data * transfer request, whose opcode is IPA_CMD_NONE. */ - info = trans->info ? &trans->info[0] : NULL; + cmd_opcode = channel->command ? &trans->cmd_opcode[0] : NULL; avail = ring->count - ring->index % ring->count; dest_tre = gsi_ring_virt(ring, ring->index); for_each_sg(trans->sgl, sg, trans->used, i) { @@ -577,8 +577,8 @@ static void __gsi_trans_commit(struct gsi_trans *trans, bool ring_db) byte_count += len; if (!avail--) dest_tre = gsi_ring_virt(ring, 0); - if (info) - opcode = info++->opcode; + if (cmd_opcode) + opcode = *cmd_opcode++; gsi_trans_tre_fill(dest_tre, addr, len, last_tre, bei, opcode); dest_tre++; diff --git a/drivers/net/ipa/gsi_trans.h b/drivers/net/ipa/gsi_trans.h index 9a39909915ef5..99ce2cba0dc3c 100644 --- a/drivers/net/ipa/gsi_trans.h +++ b/drivers/net/ipa/gsi_trans.h @@ -22,6 +22,9 @@ struct gsi; struct gsi_trans; struct gsi_trans_pool; +/* Maximum number of TREs in an IPA immediate command transaction */ +#define IPA_COMMAND_TRANS_TRE_MAX 8 + /** * struct gsi_trans - a GSI transaction * @@ -34,8 +37,8 @@ struct gsi_trans_pool; * @used: Number of TREs *used* (could be less than tre_count) * @len: Total # of transfer bytes represented in sgl[] (set by core) * @data: Preserved but not touched by the core transaction code + * @cmd_opcode: Array of command opcodes (command channel only) * @sgl: An array of scatter/gather entries managed by core code - * @info: Array of command information structures (command channel) * @direction: DMA transfer direction (DMA_NONE for commands) * @refcount: Reference count used for destruction * @completion: Completed when the transaction completes @@ -58,8 +61,8 @@ struct gsi_trans { u32 len; /* total # bytes across sgl[] */ void *data; + u8 cmd_opcode[IPA_COMMAND_TRANS_TRE_MAX]; struct scatterlist *sgl; - struct ipa_cmd_info *info; /* array of entries, or null */ enum dma_data_direction direction; refcount_t refcount; diff --git a/drivers/net/ipa/ipa_cmd.c b/drivers/net/ipa/ipa_cmd.c index 5fd74d7007044..e58cd4478fd3d 100644 --- a/drivers/net/ipa/ipa_cmd.c +++ b/drivers/net/ipa/ipa_cmd.c @@ -349,7 +349,6 @@ int ipa_cmd_pool_init(struct gsi_channel *channel, u32 tre_max) { struct gsi_trans_info *trans_info = &channel->trans_info; struct device *dev = channel->gsi->dev; - int ret; /* This is as good a place as any to validate build constants */ ipa_cmd_validate_build(); @@ -358,20 +357,9 @@ int ipa_cmd_pool_init(struct gsi_channel *channel, u32 tre_max) * a single transaction can require up to tlv_count of them, * so we treat them as if that many can be allocated at once. */ - ret = gsi_trans_pool_init_dma(dev, &trans_info->cmd_pool, - sizeof(union ipa_cmd_payload), - tre_max, channel->tlv_count); - if (ret) - return ret; - - /* Each TRE needs a command info structure */ - ret = gsi_trans_pool_init(&trans_info->info_pool, - sizeof(struct ipa_cmd_info), - tre_max, channel->tlv_count); - if (ret) - gsi_trans_pool_exit_dma(dev, &trans_info->cmd_pool); - - return ret; + return gsi_trans_pool_init_dma(dev, &trans_info->cmd_pool, + sizeof(union ipa_cmd_payload), + tre_max, channel->tlv_count); } void ipa_cmd_pool_exit(struct gsi_channel *channel) @@ -379,7 +367,6 @@ void ipa_cmd_pool_exit(struct gsi_channel *channel) struct gsi_trans_info *trans_info = &channel->trans_info; struct device *dev = channel->gsi->dev; - gsi_trans_pool_exit(&trans_info->info_pool); gsi_trans_pool_exit_dma(dev, &trans_info->cmd_pool); } @@ -652,28 +639,16 @@ void ipa_cmd_pipeline_clear_wait(struct ipa *ipa) wait_for_completion(&ipa->completion); } -static struct ipa_cmd_info * -ipa_cmd_info_alloc(struct ipa_endpoint *endpoint, u32 tre_count) -{ - struct gsi_channel *channel; - - channel = &endpoint->ipa->gsi.channel[endpoint->channel_id]; - - return gsi_trans_pool_alloc(&channel->trans_info.info_pool, tre_count); -} - /* Allocate a transaction for the command TX endpoint */ struct gsi_trans *ipa_cmd_trans_alloc(struct ipa *ipa, u32 tre_count) { struct ipa_endpoint *endpoint; - struct gsi_trans *trans; + + if (WARN_ON(tre_count > IPA_COMMAND_TRANS_TRE_MAX)) + return NULL; endpoint = ipa->name_map[IPA_ENDPOINT_AP_COMMAND_TX]; - trans = gsi_channel_trans_alloc(&ipa->gsi, endpoint->channel_id, - tre_count, DMA_NONE); - if (trans) - trans->info = ipa_cmd_info_alloc(endpoint, tre_count); - - return trans; + return gsi_channel_trans_alloc(&ipa->gsi, endpoint->channel_id, + tre_count, DMA_NONE); } diff --git a/drivers/net/ipa/ipa_cmd.h b/drivers/net/ipa/ipa_cmd.h index d4dbe2ce96dcd..9215ddad10107 100644 --- a/drivers/net/ipa/ipa_cmd.h +++ b/drivers/net/ipa/ipa_cmd.h @@ -46,15 +46,6 @@ enum ipa_cmd_opcode { IPA_CMD_IP_PACKET_TAG_STATUS = 0x14, }; -/** - * struct ipa_cmd_info - information needed for an IPA immediate command - * - * @opcode: The command opcode. - */ -struct ipa_cmd_info { - enum ipa_cmd_opcode opcode; -}; - /** * ipa_cmd_table_valid() - Validate a memory region holding a table * @ipa: - IPA pointer From patchwork Sun May 22 00:32:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 575246 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BBE4C433FE for ; Sun, 22 May 2022 00:32:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348210AbiEVAco (ORCPT ); Sat, 21 May 2022 20:32:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348166AbiEVAcj (ORCPT ); Sat, 21 May 2022 20:32:39 -0400 Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 522B641632 for ; Sat, 21 May 2022 17:32:36 -0700 (PDT) Received: by mail-io1-xd2d.google.com with SMTP id n145so2547907iod.3 for ; Sat, 21 May 2022 17:32: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=doVlcQ6Xlwn2BqCTeY/iG09ipnCZzy9t3u/uMA+1XFU=; b=rXoH1vIlolKTcPa7XyPoQrChIH0W6X5hmQjuJx0KajKXf88oC9gsolgD1vM/3SDwtO KXp+4BffG/nUhOQ7WUIjHGwgqxKMIPaG7CqYHCWPtxHWZZMTtESo4MyAvC5Q0MN4Bw8W BpuFXH+vpHdAxYC3GXEbEzaCEPfOscQuRN0Q3PGWONxd0Xvd/lpeK3uxlLK05NQJkgRE Q32LKVwDrXeFkAaVbL+y258ggOHaOSkbqf+uy6VDWksjVVy4Hv0ywnW4NXrWOIEWyUi1 vczwXnuDN43CPTg++j/C9QPxBQxI45ixSnGD/1UIzmK/qd+mFQmaDxKwMymOURD3iutk bZ/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=doVlcQ6Xlwn2BqCTeY/iG09ipnCZzy9t3u/uMA+1XFU=; b=bmE3hB1INgXm0ZVdkBWNhtv07koW3fegzR1Za3m80i1tH5FEb7RecMK97sIwphwbtc NJvLu30jZ/irC8uDNXkXwTrHehWYAZVUDFpnyl4dKbdmGN/DtkW4vYEpRrsWwhSLkS7D 5zlK3XXkfX6K2nWeamS0d5LVNn9Rq7BzTbDB32HOAN3D4S2ykLaY1hpRseuOq+CMsxBz QOHEUd2jCEVQZMHADNXVIzfDrzZmDNs8XEDcTVTLQ1RETSb6UVKDz6uHO/tXpJLHSXKy AlqsLSVZsJH6BTs4bIICQJXqMXwQhcmz4pDAZJP7VwEYFle4RyyDTdfXTXIRwu7A7p9W M3EA== X-Gm-Message-State: AOAM533/x/tXeq2AsRJf5pjTytTk5+PR9cOuqELhU1ommcO6Iv/0N7NR pLYRrq6tsecq7nnFgRnnR3jRow== X-Google-Smtp-Source: ABdhPJyXsa5e5p8ofFsd6pLkt2bgKU0IrEydH4ftdbr15h1s+8SWttkScVwWZvGizVvPjJPscGqlQw== X-Received: by 2002:a05:6638:34a4:b0:32b:b205:ca82 with SMTP id t36-20020a05663834a400b0032bb205ca82mr8167007jal.165.1653179555689; Sat, 21 May 2022 17:32:35 -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 g8-20020a02c548000000b0032b5e78bfcbsm1757115jaj.135.2022.05.21.17.32.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 17:32:35 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: mka@chromium.org, evgreen@chromium.org, bjorn.andersson@linaro.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 9/9] net: ipa: use data space for command opcodes Date: Sat, 21 May 2022 19:32:23 -0500 Message-Id: <20220522003223.1123705-10-elder@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220522003223.1123705-1-elder@linaro.org> References: <20220522003223.1123705-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The 64-bit data field in a transaction is not used for commands. And the opcode array is *only* used for commands. They're (currently) the same size; save a little space in the transaction structure by enclosing the two fields in a union. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi_trans.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ipa/gsi_trans.h b/drivers/net/ipa/gsi_trans.h index 99ce2cba0dc3c..020c3b32de1d7 100644 --- a/drivers/net/ipa/gsi_trans.h +++ b/drivers/net/ipa/gsi_trans.h @@ -60,8 +60,10 @@ struct gsi_trans { u8 used; /* # entries used in sgl[] */ u32 len; /* total # bytes across sgl[] */ - void *data; - u8 cmd_opcode[IPA_COMMAND_TRANS_TRE_MAX]; + union { + void *data; + u8 cmd_opcode[IPA_COMMAND_TRANS_TRE_MAX]; + }; struct scatterlist *sgl; enum dma_data_direction direction;