From patchwork Wed Nov 24 20:25:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 12637743 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 06422C433FE for ; Wed, 24 Nov 2021 20:25:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230138AbhKXU2d (ORCPT ); Wed, 24 Nov 2021 15:28:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230183AbhKXU21 (ORCPT ); Wed, 24 Nov 2021 15:28:27 -0500 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68943C061756 for ; Wed, 24 Nov 2021 12:25:17 -0800 (PST) Received: by mail-il1-x12e.google.com with SMTP id r2so3671465ilb.10 for ; Wed, 24 Nov 2021 12:25:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PKb4x2fpJvvWj1MWlAu+w+srbFDuwrfT34Vp4ykdpr8=; b=O86KK2Nj8/wXBRuHWHOrbwrdi0QsUisBg2JVReNmc6zCcf+K0HY6eoqNUfI5G8GGQ3 yDLDtXP4pgJzRjyjqHaOgfM+8kP/DNp9fPcKfu9rhEOAv67nY7uSoTrXFiZa7sszCIV3 KvizyqdpTuT+DoXkrzClZLma3Nov/EAFhx67WaoZlLRutvCJG7HjJ46xIu9oo03Zv/+v xG10UMR01OCNMPA20TyLbdChHo8qkU0ugPGKa9ZqhmrrHjYABLSMiSTZz7Zfj4zq9aOB s07Fp1isYjJOa9CxhviEcuV2oBtnRGhRicyGdmUZW1qnXJZazBEGA/KOIVMm4ZbakwaS lMYQ== 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=PKb4x2fpJvvWj1MWlAu+w+srbFDuwrfT34Vp4ykdpr8=; b=Qv3iuUVUAwECAvav62pmaE58fuZixfBuy9DWsx13dKpto2YzEqPtErSC4e+wyBvfHa 5yZX39HxRt/tmCnMfUC6/FY7cJjX++7If5EDxPoizrZ//RuHLN2tNY34+mi5TkuPEuPF 19a9lkhHibnXmpLlPKMHFXkb8K1/zkntiYZX2iqfOEUngJYd1GewSw5UvxwxoORZYZZ9 kDQd9eaTrUYThhPk+V3O4L16Og8Jla917GVB604W67zKcWA/xd6o0fuVRdx24BKLF942 wAu/EYOl25kjRiqI4esX7EYvx3T3wIAuFY3pzjjcf53nKGvaJGsmtlODRQhNqfm2E81a RlgQ== X-Gm-Message-State: AOAM532/5u0Gmw5onFAuwam1vDW+GhfMPaKIVDMDFjHFcZMTR+JEVhhv JsEe5WmZfcFemTCJw+csMDnw3Q== X-Google-Smtp-Source: ABdhPJyd+OVmy3R6937TpVoq3X9au4fNktICf3CQtIjGFIHIvIcTHEPc2zMJ0RqeHdTEjOhfdEGnLA== X-Received: by 2002:a92:cd51:: with SMTP id v17mr15125016ilq.191.1637785516823; Wed, 24 Nov 2021 12:25:16 -0800 (PST) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id x2sm312795ile.29.2021.11.24.12.25.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Nov 2021 12:25:16 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: pkurapat@codeaurora.org, avuyyuru@codeaurora.org, bjorn.andersson@linaro.org, cpratapa@codeaurora.org, subashab@codeaurora.org, evgreen@chromium.org, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/7] net: ipa: kill ipa_modem_init() Date: Wed, 24 Nov 2021 14:25:05 -0600 Message-Id: <20211124202511.862588-2-elder@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211124202511.862588-1-elder@linaro.org> References: <20211124202511.862588-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org A recent commit made disabling the SMP2P "setup ready" interrupt unrelated to ipa_modem_stop(). Given that, it seems fitting to get rid of ipa_modem_init() and ipa_modem_exit() (which are trivial wrapper functions), and call ipa_smp2p_init() and ipa_smp2p_exit() directly instead. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_main.c | 7 ++++--- drivers/net/ipa/ipa_modem.c | 10 ---------- drivers/net/ipa/ipa_modem.h | 3 --- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index cdfa98a76e1f4..6960efbe66ddb 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -29,6 +29,7 @@ #include "ipa_mem.h" #include "ipa_table.h" #include "ipa_modem.h" +#include "ipa_smp2p.h" #include "ipa_uc.h" #include "ipa_interrupt.h" #include "gsi_trans.h" @@ -733,7 +734,7 @@ static int ipa_probe(struct platform_device *pdev) if (ret) goto err_endpoint_exit; - ret = ipa_modem_init(ipa, modem_init); + ret = ipa_smp2p_init(ipa, modem_init); if (ret) goto err_table_exit; @@ -775,7 +776,7 @@ static int ipa_probe(struct platform_device *pdev) ipa_deconfig(ipa); err_power_put: pm_runtime_put_noidle(dev); - ipa_modem_exit(ipa); + ipa_smp2p_exit(ipa); err_table_exit: ipa_table_exit(ipa); err_endpoint_exit: @@ -821,7 +822,7 @@ static int ipa_remove(struct platform_device *pdev) ipa_deconfig(ipa); out_power_put: pm_runtime_put_noidle(dev); - ipa_modem_exit(ipa); + ipa_smp2p_exit(ipa); ipa_table_exit(ipa); ipa_endpoint_exit(ipa); gsi_exit(&ipa->gsi); diff --git a/drivers/net/ipa/ipa_modem.c b/drivers/net/ipa/ipa_modem.c index ad116bcc0580e..33ac626bd803e 100644 --- a/drivers/net/ipa/ipa_modem.c +++ b/drivers/net/ipa/ipa_modem.c @@ -442,16 +442,6 @@ static int ipa_modem_notify(struct notifier_block *nb, unsigned long action, return NOTIFY_OK; } -int ipa_modem_init(struct ipa *ipa, bool modem_init) -{ - return ipa_smp2p_init(ipa, modem_init); -} - -void ipa_modem_exit(struct ipa *ipa) -{ - ipa_smp2p_exit(ipa); -} - int ipa_modem_config(struct ipa *ipa) { void *notifier; diff --git a/drivers/net/ipa/ipa_modem.h b/drivers/net/ipa/ipa_modem.h index 5e6e3d234454a..e64ccc2402e9d 100644 --- a/drivers/net/ipa/ipa_modem.h +++ b/drivers/net/ipa/ipa_modem.h @@ -18,9 +18,6 @@ void ipa_modem_skb_rx(struct net_device *netdev, struct sk_buff *skb); void ipa_modem_suspend(struct net_device *netdev); void ipa_modem_resume(struct net_device *netdev); -int ipa_modem_init(struct ipa *ipa, bool modem_init); -void ipa_modem_exit(struct ipa *ipa); - int ipa_modem_config(struct ipa *ipa); void ipa_modem_deconfig(struct ipa *ipa); From patchwork Wed Nov 24 20:25:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 12637745 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 9620DC43219 for ; Wed, 24 Nov 2021 20:25:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230404AbhKXU2e (ORCPT ); Wed, 24 Nov 2021 15:28:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230251AbhKXU22 (ORCPT ); Wed, 24 Nov 2021 15:28:28 -0500 Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F8F3C061574 for ; Wed, 24 Nov 2021 12:25:18 -0800 (PST) Received: by mail-io1-xd36.google.com with SMTP id x10so4793071ioj.9 for ; Wed, 24 Nov 2021 12:25:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=plwYDiYcXYV2zvdNN9Jp81+zqt/Mzq3cyFwkMtLfyOk=; b=VrFMiG+5GlldG4MT4Wu/F8/bGPXiEyWvGO++EFoPw91HXTIIyb1athM2B2LUMm+haB zxqGGHvyrvXvu4f/f89Dh6Myt4IZ6ZR+E8JA+vLT254SrWXGkOY12ypBVg194nmdEItR 5jSwlnXvM/EX/TWcFuDecVW1AMxtd8f+VKDsiJUwmpb91HOJTbGM/fbYAnG5edH+pDKd Z1y5ZtWAg13iUJ7S5jLPYqPcDH7u8ErBx9t7ABqLD/+up8rkrcuts+2+CWBi0QYoxD4k d1JUy92XzZHP1o+m9nN17btWAF/z+tBf/XK1wf5Js1MFtEi38h2kG7tuej3w5nRac2tg MRTA== 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=plwYDiYcXYV2zvdNN9Jp81+zqt/Mzq3cyFwkMtLfyOk=; b=FUC7T3BAsLF06mCuLUxI02z+pXKHhl8nSFf3kB1Kls5ZYYS3agOSxmWlkIX/mWPQv7 BjsXmF35m+sdxMTCqH/je/wZ6W20eOtswoAvdoSNRt5zqk1guiW07AGGqSVWN9YDAu+m u7m3Wg/d8BaX5aeopFGgE0br7HLph20ji/XabinpWr8gBhRsSO5QCY0VXbwZWWUe/+5Q jgB6sZZJ7o+QcpnWq8WeiE8z6uqIP2bMPZnHSyWDf3sZyeBhFS9SCutTIRDBnvrFSPRX 4OQ0+9GH6r7iv/z3aoZOJV1Tj5uX/Lm2fhrqUqoGwKBk1mN9usv7xm6G/+okiOJEv/hg QmNQ== X-Gm-Message-State: AOAM532tE10qropYNc3bputRzANLTJtYez9SLCn2rltZH9Omux4qErlF 8y7at/BinqfdRC2w4vOelpVx4Q== X-Google-Smtp-Source: ABdhPJwUcR65Y5eltxPo9e5VNWxWwujODAbOnG2ac9H3yII0Nar6lQvW6YExtaHExuNUbba0BEy7ww== X-Received: by 2002:a05:6638:250a:: with SMTP id v10mr20586107jat.119.1637785518026; Wed, 24 Nov 2021 12:25:18 -0800 (PST) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id x2sm312795ile.29.2021.11.24.12.25.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Nov 2021 12:25:17 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: pkurapat@codeaurora.org, avuyyuru@codeaurora.org, bjorn.andersson@linaro.org, cpratapa@codeaurora.org, subashab@codeaurora.org, evgreen@chromium.org, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 2/7] net: ipa: zero unused portions of filter table memory Date: Wed, 24 Nov 2021 14:25:06 -0600 Message-Id: <20211124202511.862588-3-elder@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211124202511.862588-1-elder@linaro.org> References: <20211124202511.862588-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Not all filter table entries are used. Only certain endpoints support filtering, and the table begins with a bitmap indicating which endpoints use the "slots" that follow for filter rules. Currently, unused filter table entries are not initialized. Instead, zero-fill the entire unused portion of the filter table memory regions, to make it more obvious that memory is unused (and not subsequently modified). This is not strictly necessary, but the result is reassuring when looking at filter table memory. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_table.c | 48 +++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/drivers/net/ipa/ipa_table.c b/drivers/net/ipa/ipa_table.c index 1da334f54944a..2f5a58bfc529a 100644 --- a/drivers/net/ipa/ipa_table.c +++ b/drivers/net/ipa/ipa_table.c @@ -419,21 +419,26 @@ static void ipa_table_init_add(struct gsi_trans *trans, bool filter, const struct ipa_mem *mem = ipa_mem_find(ipa, mem_id); dma_addr_t hash_addr; dma_addr_t addr; + u32 zero_offset; u16 hash_count; + u32 zero_size; u16 hash_size; u16 count; u16 size; - /* The number of filtering endpoints determines number of entries - * in the filter table. The hashed and non-hashed filter table - * will have the same number of entries. The size of the route - * table region determines the number of entries it has. - */ + /* Compute the number of table entries to initialize */ if (filter) { - /* Include one extra "slot" to hold the filter map itself */ + /* The number of filtering endpoints determines number of + * entries in the filter table; we also add one more "slot" + * to hold the bitmap itself. The size of the hashed filter + * table is either the same as the non-hashed one, or zero. + */ count = 1 + hweight32(ipa->filter_map); hash_count = hash_mem->size ? count : 0; } else { + /* The size of a route table region determines the number + * of entries it has. + */ count = mem->size / sizeof(__le64); hash_count = hash_mem->size / sizeof(__le64); } @@ -445,13 +450,42 @@ static void ipa_table_init_add(struct gsi_trans *trans, bool filter, ipa_cmd_table_init_add(trans, opcode, size, mem->offset, addr, hash_size, hash_mem->offset, hash_addr); + if (!filter) + return; + + /* Zero the unused space in the filter table */ + zero_offset = mem->offset + size; + zero_size = mem->size - size; + ipa_cmd_dma_shared_mem_add(trans, zero_offset, zero_size, + ipa->zero_addr, true); + if (!hash_size) + return; + + /* Zero the unused space in the hashed filter table */ + zero_offset = hash_mem->offset + hash_size; + zero_size = hash_mem->size - hash_size; + ipa_cmd_dma_shared_mem_add(trans, zero_offset, zero_size, + ipa->zero_addr, true); } int ipa_table_setup(struct ipa *ipa) { struct gsi_trans *trans; - trans = ipa_cmd_trans_alloc(ipa, 4); + /* We will need at most 8 TREs: + * - IPv4: + * - One for route table initialization (non-hashed and hashed) + * - One for filter table initialization (non-hashed and hashed) + * - One to zero unused entries in the non-hashed filter table + * - One to zero unused entries in the hashed filter table + * - IPv6: + * - One for route table initialization (non-hashed and hashed) + * - One for filter table initialization (non-hashed and hashed) + * - One to zero unused entries in the non-hashed filter table + * - One to zero unused entries in the hashed filter table + * All platforms support at least 8 TREs in a transaction. + */ + trans = ipa_cmd_trans_alloc(ipa, 8); if (!trans) { dev_err(&ipa->pdev->dev, "no transaction for table setup\n"); return -EBUSY; From patchwork Wed Nov 24 20:25:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 12637755 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 345EBC433F5 for ; Wed, 24 Nov 2021 20:25:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235156AbhKXU2o (ORCPT ); Wed, 24 Nov 2021 15:28:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229875AbhKXU2b (ORCPT ); Wed, 24 Nov 2021 15:28:31 -0500 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 D86EBC06175A for ; Wed, 24 Nov 2021 12:25:19 -0800 (PST) Received: by mail-io1-xd34.google.com with SMTP id p23so4815895iod.7 for ; Wed, 24 Nov 2021 12:25:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=V/tQ+LMRwDn/cQ7ovJGI35qWLjlsnDni7U8vJdBfy88=; b=nAczvN/1W7rpfOKy1l7TqE0s8oAMerPBgjpD0DreyUtGsmm5gw9R+j7zlGXTpgTNsV xbFiHjeALVKcceFPWkYR+LHpnZdi7rPvk4kZMIP5L1op8aN8oKzGimilaLFLENV1hCzG v2lLiNkdQPWl81CeDQxDSBP84qzctBrM996fpjXbeEW23Lq3Ye9NC09EFWpzfepn+lH6 3tIeYpDPEHN2lcZXAm8/UvdOeoj8Z8309u9HVdn/4bB7In98DbflMeLKUd8TxijuJysq tUexoYNpYnoABHvTw/fLOSLJ0ihXrqx+EsKXouMoahHVV+EeS7lssxFTS420YEZNiN80 ZPow== 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=V/tQ+LMRwDn/cQ7ovJGI35qWLjlsnDni7U8vJdBfy88=; b=GEK7xBh37PlejdiSk2iYOdlA11mgQAIzMCaHEWVj0IfuykcKu5SuQ4XLWkrVbmthJT vksRWGV9zBVo0GBx9DJCvogKwl7AccojuxhncMr2Bcar6e7Pb9Gj2MgUGftkD93wUAMR PC16F1Yj4Lcge/9oX2ZhBPZ4ZZwcYmTE+G6mDi8EJZ1KcYnqlV42zB0jZHw5dj5c7by7 Nvc8+TkAEKfEMjB7Jt7ic4lo6xiojDb6n5iE44z1QQGBOaOTXYajMm1YZYMxQ7kmWM7h Lksym9p+Gfzdu3P6NIJroatkh9Ud87ee88o0TEt2Sv8BFITc3/cu6c47mhL74RCf09FE /f6Q== X-Gm-Message-State: AOAM530AwUFQl4GKC3j8wnDzBXMMSzTZjq9p0H7hwS9mN2UNt4uLecdl h+ZfOV+LJOIMqQzSTovlJuIhmA== X-Google-Smtp-Source: ABdhPJx//eLtgSULZ55971nSYne2KQfJMglNKCLSSRugpVVdQNgaVqflp4uzE+AcnM8iyS2FSO/Fqg== X-Received: by 2002:a02:cc91:: with SMTP id s17mr20562588jap.3.1637785519287; Wed, 24 Nov 2021 12:25:19 -0800 (PST) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id x2sm312795ile.29.2021.11.24.12.25.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Nov 2021 12:25:18 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: pkurapat@codeaurora.org, avuyyuru@codeaurora.org, bjorn.andersson@linaro.org, cpratapa@codeaurora.org, subashab@codeaurora.org, evgreen@chromium.org, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 3/7] net: ipa: rework how HOL_BLOCK handling is specified Date: Wed, 24 Nov 2021 14:25:07 -0600 Message-Id: <20211124202511.862588-4-elder@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211124202511.862588-1-elder@linaro.org> References: <20211124202511.862588-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The head-of-line block (HOLB) drop timer is only meaningful when dropping packets due to blocking is enabled. Given that, redefine the interface so the timer is specified when enabling HOLB drop, and use a different function when disabling. To enable and disable HOLB drop, these functions will now be used: ipa_endpoint_init_hol_block_enable(endpoint, milliseconds) ipa_endpoint_init_hol_block_disable(endpoint) The existing ipa_endpoint_init_hol_block_enable() becomes a helper function, renamed ipa_endpoint_init_hol_block_en(), and used with ipa_endpoint_init_hol_block_timer() to enable HOLB block on an endpoint. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_endpoint.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index ef790fd0ab56a..405410a6222ce 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -860,7 +860,7 @@ static void ipa_endpoint_init_hol_block_timer(struct ipa_endpoint *endpoint, } static void -ipa_endpoint_init_hol_block_enable(struct ipa_endpoint *endpoint, bool enable) +ipa_endpoint_init_hol_block_en(struct ipa_endpoint *endpoint, bool enable) { u32 endpoint_id = endpoint->endpoint_id; u32 offset; @@ -874,6 +874,19 @@ ipa_endpoint_init_hol_block_enable(struct ipa_endpoint *endpoint, bool enable) iowrite32(val, endpoint->ipa->reg_virt + offset); } +/* Assumes HOL_BLOCK is in disabled state */ +static void ipa_endpoint_init_hol_block_enable(struct ipa_endpoint *endpoint, + u32 microseconds) +{ + ipa_endpoint_init_hol_block_timer(endpoint, microseconds); + ipa_endpoint_init_hol_block_en(endpoint, true); +} + +static void ipa_endpoint_init_hol_block_disable(struct ipa_endpoint *endpoint) +{ + ipa_endpoint_init_hol_block_en(endpoint, false); +} + void ipa_endpoint_modem_hol_block_clear_all(struct ipa *ipa) { u32 i; @@ -884,9 +897,8 @@ void ipa_endpoint_modem_hol_block_clear_all(struct ipa *ipa) if (endpoint->toward_ipa || endpoint->ee_id != GSI_EE_MODEM) continue; - ipa_endpoint_init_hol_block_enable(endpoint, false); - ipa_endpoint_init_hol_block_timer(endpoint, 0); - ipa_endpoint_init_hol_block_enable(endpoint, true); + ipa_endpoint_init_hol_block_disable(endpoint); + ipa_endpoint_init_hol_block_enable(endpoint, 0); } } From patchwork Wed Nov 24 20:25:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 12637749 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 79077C433FE for ; Wed, 24 Nov 2021 20:25:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231758AbhKXU2f (ORCPT ); Wed, 24 Nov 2021 15:28:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231355AbhKXU2b (ORCPT ); Wed, 24 Nov 2021 15:28:31 -0500 Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23371C06175B for ; Wed, 24 Nov 2021 12:25:21 -0800 (PST) Received: by mail-il1-x135.google.com with SMTP id r2so3671622ilb.10 for ; Wed, 24 Nov 2021 12:25:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=U+1ZMb25RFdAwm161yRXw6iBBPms0tJ9oVdKiifaLz0=; b=DmEJN+qF6u5mk/dHhx+SeBOWwoxgNw9+v1x1zW3vbp4SxbwlksSwIA2h2wu1UqNXFL WxfBoL4TmFqOAhO7q3U3mNfFZQ5/SHK6H6WvzJgZQlvermSpYHyuD9H46+uq74pR/fWT OSPrZCQIbL0fPvo6GgRAlqabZHvdaGtasLtO/iv9f+GmeorNoOSKdWOH1ulZHDvqmPgn rcUOucWNRiYfULyowOl5eIZ0mTmgqw7JhXXbLp2YRohvQw7XTkHmZ6bDSW9R3Oy4t4zm 87CmWU7WJ+8J2+PkS2kMvsx7lsEHdrumxu80nI3b28YxMLxuGNOsVenLcv42RodMWcWj Bygw== 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=U+1ZMb25RFdAwm161yRXw6iBBPms0tJ9oVdKiifaLz0=; b=eEY6mhtQoYRV0mZWqA+rIlzrkvR851Be5R+SqhlAWs+tfkmMuFYRzv4Mt1o3VqppGJ 5eoOdzR5NeHUuWn1jhtmB/B/baTy1nkJT7skRnapJhvuLdsqJeGsOMl9vVCb7qHKA+ig SslOgJkFWJO2ZgN+hax3l5OlmZSbrGnSXv7G7R6NqgXahLnp/4J18c4epRhxz8Er7t7B Hf5bcr5ccJdswbSNnECeid51SYUEqL1hm+xe4Z0rbR44WGSY86gjMbAP24OY1UuPhxPh E6NCJJMu8QcWu3y8/xBG7UjfFRo9b9uZ/J5tSerWxgHXrERDBZ1vQmrxtlbYlhjeGXfl b+4Q== X-Gm-Message-State: AOAM532brXVC8uS9zdhyT6mF6A+vJx7DEUrCqEQUAtbybLlJhZPF10ix d429MbRaRif3T5zfakNMFESweA== X-Google-Smtp-Source: ABdhPJy6NMfLKmLLwqCdQ0mqYzjtcIr124BMXvfDpKPKfCK9adSmC7aHNl4K+T2J81c9Ph/X9DldoQ== X-Received: by 2002:a92:ca46:: with SMTP id q6mr15013771ilo.54.1637785520542; Wed, 24 Nov 2021 12:25:20 -0800 (PST) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id x2sm312795ile.29.2021.11.24.12.25.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Nov 2021 12:25:20 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: pkurapat@codeaurora.org, avuyyuru@codeaurora.org, bjorn.andersson@linaro.org, cpratapa@codeaurora.org, subashab@codeaurora.org, evgreen@chromium.org, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 4/7] net: ipa: explicitly disable HOLB drop during setup Date: Wed, 24 Nov 2021 14:25:08 -0600 Message-Id: <20211124202511.862588-5-elder@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211124202511.862588-1-elder@linaro.org> References: <20211124202511.862588-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org During setup, ipa_endpoint_program() programs each endpoint with various configuration parameters. One of those registers defines whether to drop packets when a head-of-line blocking condition is detected on an RX endpoint. We currently assume this is disabled; instead, explicitly set it to be disabled. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_endpoint.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 405410a6222ce..eeb9f082a0e4c 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -1542,6 +1542,8 @@ 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); ipa_endpoint_init_deaggr(endpoint); ipa_endpoint_init_rsrc_grp(endpoint); ipa_endpoint_init_seq(endpoint); From patchwork Wed Nov 24 20:25:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 12637751 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 3BF68C433FE for ; Wed, 24 Nov 2021 20:25:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230284AbhKXU2o (ORCPT ); Wed, 24 Nov 2021 15:28:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231437AbhKXU2c (ORCPT ); Wed, 24 Nov 2021 15:28:32 -0500 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49738C061748 for ; Wed, 24 Nov 2021 12:25:22 -0800 (PST) Received: by mail-il1-x12d.google.com with SMTP id j21so3704854ila.5 for ; Wed, 24 Nov 2021 12:25:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZCqaOer2ok1ocDOYiRL6Fx51PuC9d9Pr4rUsp1pZAp8=; b=EQYoknl5iHBH/JH9MgOiuwzo4aHCMCUs8dv+XfTbwTKAEzeJh7uzbUqJ2wd52ZJxNK qj7OFqPo6K0TiNFilTAj8n4wnvnF3Zaalw+QsdAHMIbDvjAf7xEBFTvXt8/CvFb4tyCw TkXzqkPDaw5VXmZabft2uvsYTa/kxJw+0Lg1Z1mgp1MGPpyvl0LjJ7tN1TmzA+oqpvgA hRc0T8xs9kIHLLdNyIJGjUmPuZ5jnQ/J4nvzGEieOCdDrn9wW9cLxnIupUBE8RRxDKrC PbF18D3Vw/zLRp5WWZq9bfTVimrhCg4KmTKrxWqPzigbJ1EmW1E+b0csPfqanRHjJvMA ylVw== 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=ZCqaOer2ok1ocDOYiRL6Fx51PuC9d9Pr4rUsp1pZAp8=; b=O9PG05FKTUnseoZCCRxg4BSOoktGO5x4E3qHpxBj0gqaLkJ/MVqbEd2C89hjEZC5E4 CiczZ21JgFtVmmAW0iays+ySABazyW5gJpQqGX56AEEpwmgeIhQJHabStcpV94Z7B5Vm rPml7NXZg5fw1tg5tb/Sl+W3xeM46EGXNXAvkoNAqcjMqJ2J6A5UcyWTdw7mN4tt1PPD P4cEDxqA0QuGnHDQKL6C+dPZejTrWFvTJntzXcvLByrOrY1qLv0qGeLb82hIUDk5s0CH YzlG9sNYopyyuf4XAAQGp5whPbbyeM9c1yoI7KYLXwX6Vq37mXMnS9i+mijCYWel73NU JFqQ== X-Gm-Message-State: AOAM531CSXdOJWjec39z2PyAfnz6OZt9dSZc5JUT1L7+imv67uPkUQ+x SjAUS2wwZ+odPqDoVqys/mka+Q== X-Google-Smtp-Source: ABdhPJwG9gEfx0GFEigZB6slQU6RWL9OQuF35yu01FXi7vGpSfutK5fHIrg/UuDZeBgF6+bx7VKjkw== X-Received: by 2002:a05:6e02:1bec:: with SMTP id y12mr15676800ilv.40.1637785521741; Wed, 24 Nov 2021 12:25:21 -0800 (PST) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id x2sm312795ile.29.2021.11.24.12.25.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Nov 2021 12:25:21 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: pkurapat@codeaurora.org, avuyyuru@codeaurora.org, bjorn.andersson@linaro.org, cpratapa@codeaurora.org, subashab@codeaurora.org, evgreen@chromium.org, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 5/7] net: ipa: skip SKB copy if no netdev Date: Wed, 24 Nov 2021 14:25:09 -0600 Message-Id: <20211124202511.862588-6-elder@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211124202511.862588-1-elder@linaro.org> References: <20211124202511.862588-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org In ipa_endpoint_skb_copy(), a new socket buffer structure is allocated so that some data can be copied into it. However, after doing this, if the endpoint has a null netdev pointer, we just drop free the socket buffer. Instead, check endpoint->netdev pointer first, and just return early if it's null. Also return early if the SKB allocation fails, to avoid the deeper indentation in the normal path. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_endpoint.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index eeb9f082a0e4c..fba576a7717fa 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -1153,18 +1153,19 @@ static void ipa_endpoint_skb_copy(struct ipa_endpoint *endpoint, { struct sk_buff *skb; + if (!endpoint->netdev) + return; + skb = __dev_alloc_skb(len, GFP_ATOMIC); - if (skb) { - skb_put(skb, len); - memcpy(skb->data, data, len); - skb->truesize += extra; - } + if (!skb) + return; - /* Now receive it, or drop it if there's no netdev */ - if (endpoint->netdev) - ipa_modem_skb_rx(endpoint->netdev, skb); - else if (skb) - dev_kfree_skb_any(skb); + /* Copy the data into the socket buffer and receive it */ + skb_put(skb, len); + memcpy(skb->data, data, len); + skb->truesize += extra; + + ipa_modem_skb_rx(endpoint->netdev, skb); } static bool ipa_endpoint_skb_build(struct ipa_endpoint *endpoint, From patchwork Wed Nov 24 20:25:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 12637747 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 EF17EC433EF for ; Wed, 24 Nov 2021 20:25:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232327AbhKXU2g (ORCPT ); Wed, 24 Nov 2021 15:28:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231987AbhKXU2d (ORCPT ); Wed, 24 Nov 2021 15:28:33 -0500 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 8ED42C06173E for ; Wed, 24 Nov 2021 12:25:23 -0800 (PST) Received: by mail-io1-xd2f.google.com with SMTP id y16so4791414ioc.8 for ; Wed, 24 Nov 2021 12:25:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UpKBv5Hg3B/Al/7B7GMLhRk/WGXeQjxo7kM2CiDkP7w=; b=mQ07PSmcSlu687rnQXtx+JCScGMkeE8ni8caCVYHxZ0a7FrY7yi2olVe4OgNBzxGGM V/b2yOZXbgj5LDLQOym9nmFva4htHoS6g32+KlHcBA4gQnpfpwW3UNmGh8E+yyORxPnF vGKUdgGo2PdMrn0XeETcJvSa4H3FN403xTrMOdylCkxj9JYZ9syenS3+yWqfIn/7LdL9 acTM0r5Q8Q+Xm2EQABT1de+Vf9E8YrVyHwA9DYzPps/kIThou24EuNkoeKC0wXB+L0Yu /hCM5OUEORNbcN5mL4/VJiTxL1lZnckfuf/q7/QQw9rGg82Xnfx/fzCRjwEKnkabSr9o fOhA== 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=UpKBv5Hg3B/Al/7B7GMLhRk/WGXeQjxo7kM2CiDkP7w=; b=HUJqZikMRsF42ErTYJmiiJIxGH87E7w3V9JXn+8zwL8QnTW3mkZ3IkTvVilcdST0Tw /gbShUeQHHi6K25Un4FBRCodotfuSNKmuwetg3idnEEjnZ5uqCTTh7l8ozFQ1LtX3rWz 9dQjp7lHxHn0hT9h2rnUE+TCt6FUUACll+dVvmqMQGb4iq/K13cuS83beXyYMCfG1etX nNPM7QCsmfbzlTa4uFuLfvz2iwUUOH3tucdXuPC+rWAGQ3Loft1IwL+PmDbJRpTbzyT0 FoxTBYfJl2UJYp4khP8GJQHUcDysjzV0jQYkze2NIgZ8tFVbQuAwXBJdpBGUJC2PNLVR 5FXA== X-Gm-Message-State: AOAM533e+DF6tadneOABngdNYE62pgpeAgmBDiSbBONcZfP6cCvjr+Lp SSyCUyX3P8jhhaLzVzhZYN7WWg== X-Google-Smtp-Source: ABdhPJz/WtlL3Vm2NRZQwhH6/z31JIZ417jxnVDAYaCYUtMdQu23rkD0Rd3Cd4BU7bSUfmcP+PxcyQ== X-Received: by 2002:a5d:9ec2:: with SMTP id a2mr18823785ioe.44.1637785522979; Wed, 24 Nov 2021 12:25:22 -0800 (PST) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id x2sm312795ile.29.2021.11.24.12.25.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Nov 2021 12:25:22 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: pkurapat@codeaurora.org, avuyyuru@codeaurora.org, bjorn.andersson@linaro.org, cpratapa@codeaurora.org, subashab@codeaurora.org, evgreen@chromium.org, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 6/7] net: ipa: GSI only needs one completion Date: Wed, 24 Nov 2021 14:25:10 -0600 Message-Id: <20211124202511.862588-7-elder@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211124202511.862588-1-elder@linaro.org> References: <20211124202511.862588-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org A mutex ensures we never submit more than one GSI command of any kind at once. This means the per-channel and per-event ring completion structures provide no benefit. Instead, just use the single (existing) GSI completion to signal the completion of GSI commands of all types. This makes gsi_evt_ring_init() a trivial function with no inverse, so open-code it in its sole caller and get rid of the function. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 44 +++++++++++-------------------------------- drivers/net/ipa/gsi.h | 5 +---- 2 files changed, 12 insertions(+), 37 deletions(-) diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index a2fcdb1abdb96..b611e39167fe0 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -339,10 +339,10 @@ static u32 gsi_ring_index(struct gsi_ring *ring, u32 offset) * completion to be signaled. Returns true if the command completes * or false if it times out. */ -static bool -gsi_command(struct gsi *gsi, u32 reg, u32 val, struct completion *completion) +static bool gsi_command(struct gsi *gsi, u32 reg, u32 val) { unsigned long timeout = msecs_to_jiffies(GSI_CMD_TIMEOUT); + struct completion *completion = &gsi->completion; reinit_completion(completion); @@ -366,8 +366,6 @@ gsi_evt_ring_state(struct gsi *gsi, u32 evt_ring_id) static void gsi_evt_ring_command(struct gsi *gsi, u32 evt_ring_id, enum gsi_evt_cmd_opcode opcode) { - struct gsi_evt_ring *evt_ring = &gsi->evt_ring[evt_ring_id]; - struct completion *completion = &evt_ring->completion; struct device *dev = gsi->dev; bool timeout; u32 val; @@ -378,7 +376,7 @@ static void gsi_evt_ring_command(struct gsi *gsi, u32 evt_ring_id, val = u32_encode_bits(evt_ring_id, EV_CHID_FMASK); val |= u32_encode_bits(opcode, EV_OPCODE_FMASK); - timeout = !gsi_command(gsi, GSI_EV_CH_CMD_OFFSET, val, completion); + timeout = !gsi_command(gsi, GSI_EV_CH_CMD_OFFSET, val); gsi_irq_ev_ctrl_disable(gsi); @@ -478,7 +476,6 @@ static enum gsi_channel_state gsi_channel_state(struct gsi_channel *channel) static void gsi_channel_command(struct gsi_channel *channel, enum gsi_ch_cmd_opcode opcode) { - struct completion *completion = &channel->completion; u32 channel_id = gsi_channel_id(channel); struct gsi *gsi = channel->gsi; struct device *dev = gsi->dev; @@ -490,7 +487,7 @@ gsi_channel_command(struct gsi_channel *channel, enum gsi_ch_cmd_opcode opcode) val = u32_encode_bits(channel_id, CH_CHID_FMASK); val |= u32_encode_bits(opcode, CH_OPCODE_FMASK); - timeout = !gsi_command(gsi, GSI_CH_CMD_OFFSET, val, completion); + timeout = !gsi_command(gsi, GSI_CH_CMD_OFFSET, val); gsi_irq_ch_ctrl_disable(gsi); @@ -1074,13 +1071,10 @@ static void gsi_isr_chan_ctrl(struct gsi *gsi) while (channel_mask) { u32 channel_id = __ffs(channel_mask); - struct gsi_channel *channel; channel_mask ^= BIT(channel_id); - channel = &gsi->channel[channel_id]; - - complete(&channel->completion); + complete(&gsi->completion); } } @@ -1094,13 +1088,10 @@ static void gsi_isr_evt_ctrl(struct gsi *gsi) while (event_mask) { u32 evt_ring_id = __ffs(event_mask); - struct gsi_evt_ring *evt_ring; event_mask ^= BIT(evt_ring_id); - evt_ring = &gsi->evt_ring[evt_ring_id]; - - complete(&evt_ring->completion); + complete(&gsi->completion); } } @@ -1110,7 +1101,7 @@ gsi_isr_glob_chan_err(struct gsi *gsi, u32 err_ee, u32 channel_id, u32 code) { if (code == GSI_OUT_OF_RESOURCES) { dev_err(gsi->dev, "channel %u out of resources\n", channel_id); - complete(&gsi->channel[channel_id].completion); + complete(&gsi->completion); return; } @@ -1127,7 +1118,7 @@ gsi_isr_glob_evt_err(struct gsi *gsi, u32 err_ee, u32 evt_ring_id, u32 code) struct gsi_evt_ring *evt_ring = &gsi->evt_ring[evt_ring_id]; u32 channel_id = gsi_channel_id(evt_ring->channel); - complete(&evt_ring->completion); + complete(&gsi->completion); dev_err(gsi->dev, "evt_ring for channel %u out of resources\n", channel_id); return; @@ -1651,7 +1642,6 @@ static void gsi_channel_teardown_one(struct gsi *gsi, u32 channel_id) static int gsi_generic_command(struct gsi *gsi, u32 channel_id, enum gsi_generic_cmd_opcode opcode) { - struct completion *completion = &gsi->completion; bool timeout; u32 val; @@ -1675,7 +1665,7 @@ static int gsi_generic_command(struct gsi *gsi, u32 channel_id, val |= u32_encode_bits(channel_id, GENERIC_CHID_FMASK); val |= u32_encode_bits(GSI_EE_MODEM, GENERIC_EE_FMASK); - timeout = !gsi_command(gsi, GSI_GENERIC_CMD_OFFSET, val, completion); + timeout = !gsi_command(gsi, GSI_GENERIC_CMD_OFFSET, val); /* Disable the GP_INT1 IRQ type again */ iowrite32(BIT(ERROR_INT), gsi->virt + GSI_CNTXT_GLOB_IRQ_EN_OFFSET); @@ -1975,18 +1965,6 @@ static void gsi_channel_evt_ring_exit(struct gsi_channel *channel) gsi_evt_ring_id_free(gsi, evt_ring_id); } -/* Init function for event rings; there is no gsi_evt_ring_exit() */ -static void gsi_evt_ring_init(struct gsi *gsi) -{ - u32 evt_ring_id = 0; - - gsi->event_bitmap = gsi_event_bitmap_init(GSI_EVT_RING_COUNT_MAX); - gsi->ieob_enabled_bitmap = 0; - do - init_completion(&gsi->evt_ring[evt_ring_id].completion); - while (++evt_ring_id < GSI_EVT_RING_COUNT_MAX); -} - static bool gsi_channel_data_valid(struct gsi *gsi, const struct ipa_gsi_endpoint_data *data) { @@ -2069,7 +2047,6 @@ static int gsi_channel_init_one(struct gsi *gsi, channel->tlv_count = data->channel.tlv_count; channel->tre_count = tre_count; channel->event_count = data->channel.event_count; - init_completion(&channel->completion); ret = gsi_channel_evt_ring_init(channel); if (ret) @@ -2129,7 +2106,8 @@ static int gsi_channel_init(struct gsi *gsi, u32 count, /* IPA v4.2 requires the AP to allocate channels for the modem */ modem_alloc = gsi->version == IPA_VERSION_4_2; - gsi_evt_ring_init(gsi); /* No matching exit required */ + gsi->event_bitmap = gsi_event_bitmap_init(GSI_EVT_RING_COUNT_MAX); + gsi->ieob_enabled_bitmap = 0; /* The endpoint data array is indexed by endpoint name */ for (i = 0; i < count; i++) { diff --git a/drivers/net/ipa/gsi.h b/drivers/net/ipa/gsi.h index 88b80dc3db79f..ccaa333e37620 100644 --- a/drivers/net/ipa/gsi.h +++ b/drivers/net/ipa/gsi.h @@ -114,8 +114,6 @@ struct gsi_channel { u16 tre_count; u16 event_count; - struct completion completion; /* signals channel command completion */ - struct gsi_ring tre_ring; u32 evt_ring_id; @@ -141,7 +139,6 @@ enum gsi_evt_ring_state { struct gsi_evt_ring { struct gsi_channel *channel; - struct completion completion; /* signals event ring state changes */ struct gsi_ring ring; }; @@ -160,7 +157,7 @@ struct gsi { u32 modem_channel_bitmap; /* modem channels to allocate */ u32 type_enabled_bitmap; /* GSI IRQ types enabled */ u32 ieob_enabled_bitmap; /* IEOB IRQ enabled (event rings) */ - struct completion completion; /* for global EE commands */ + struct completion completion; /* Signals GSI command completion */ int result; /* Negative errno (generic commands) */ struct mutex mutex; /* protects commands, programming */ }; From patchwork Wed Nov 24 20:25:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 12637753 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 24F8DC4332F for ; Wed, 24 Nov 2021 20:25:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234599AbhKXU2m (ORCPT ); Wed, 24 Nov 2021 15:28:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232422AbhKXU2f (ORCPT ); Wed, 24 Nov 2021 15:28:35 -0500 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 08010C061746 for ; Wed, 24 Nov 2021 12:25:25 -0800 (PST) Received: by mail-io1-xd31.google.com with SMTP id f9so4763273ioo.11 for ; Wed, 24 Nov 2021 12:25:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EsV2SEwRbXH/MiB85OZ9gOtuzuulNPsgUywfp2AegPE=; b=wRs57miWUjiAN3yKPWYe1Ff4Rp2qfpsN7anHj65SyTRB3SUa7jliQhYH8SbZy6KGjA RWv9bZoBdvG+BwFVGHxB9hu9OPl2AjtmxAXJKsusk0lX4j1NPOSwY/SUj4TobnhI4ipD C8p8/hgp0pyMHxPphDqraqPbHcImo73e6R+EG0yIGNQdTYqKDua/MiKD24fKhqL4VSEt bkiMOjgyDI4ZLWHOeHjNRHDs3NraKsbumZYaC+jqoUAVEDCTY/6EE40TFYjPBsT4mDdz xxfxWMUrYYqT/FKsOJEU4YghDWj6UOMTiF6SXp6CVU42PPGPl9vNeffu3Emr6eZtL/Kt 8Vjw== 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=EsV2SEwRbXH/MiB85OZ9gOtuzuulNPsgUywfp2AegPE=; b=EkI1oasXqoYX4WIdMY33ZQJll95BypBsEXRK8FwkX2iRhgJTj0K4+HlT08hHy1Vpxj zoj+80Q8w+p+rl/tDrnb33hFKaeNO4d2O8LY1CfbSNxAYtkJUa0HLObvmQBZ7LeTmX6c O2pHjBVKW3gJbbb6+RvfXHEZkHO39QdZe6Qf7JVXCHHSEpA5bTWec4BhI7Fc10+G4Qe4 d/z+7Q5Minb/Cz7HNSpHhpqWSBXF0rP40HPfgA7x1e0gPcv2ps75uBR4gh5OU5WBMsAb RaKOK4QvFvvNxcaJk/VRjJ2s2ocaklTz7wEiqQsBVGilgrFxN3FlVwG++VOhhlGf1Bk9 +RVg== X-Gm-Message-State: AOAM5307+1ZURGvOltY1vhHGKrMUtXM2r881Yfz3hTNbYn2Q8v2oQNkr uZYOvxbv2nBG0TOLRoYxyVFtgw== X-Google-Smtp-Source: ABdhPJz6abhDsO/1DFeTnORM770ghgL/aQBKugHIxMndKddTitNV9WFH/2HF08BKYJIzM7iN/b02mw== X-Received: by 2002:a05:6602:14d3:: with SMTP id b19mr18395447iow.17.1637785524195; Wed, 24 Nov 2021 12:25:24 -0800 (PST) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id x2sm312795ile.29.2021.11.24.12.25.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Nov 2021 12:25:23 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: pkurapat@codeaurora.org, avuyyuru@codeaurora.org, bjorn.andersson@linaro.org, cpratapa@codeaurora.org, subashab@codeaurora.org, evgreen@chromium.org, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 7/7] net: ipa: rearrange GSI structure fields Date: Wed, 24 Nov 2021 14:25:11 -0600 Message-Id: <20211124202511.862588-8-elder@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211124202511.862588-1-elder@linaro.org> References: <20211124202511.862588-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The dummy net_device is a large field in the GSI structure, but it is not at all interesting from the perspective of debugging. Move it to the end of the GSI structure so the other fields are easier to find in memory. The channel and event ring arrays are also very large, so move them near the end of the structure as well. Swap the position of the result and completion fields to improve structure packing. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ipa/gsi.h b/drivers/net/ipa/gsi.h index ccaa333e37620..75dfc7655f3ba 100644 --- a/drivers/net/ipa/gsi.h +++ b/drivers/net/ipa/gsi.h @@ -145,21 +145,21 @@ struct gsi_evt_ring { struct gsi { struct device *dev; /* Same as IPA device */ enum ipa_version version; - struct net_device dummy_dev; /* needed for NAPI */ void __iomem *virt_raw; /* I/O mapped address range */ void __iomem *virt; /* Adjusted for most registers */ u32 irq; u32 channel_count; u32 evt_ring_count; - struct gsi_channel channel[GSI_CHANNEL_COUNT_MAX]; - struct gsi_evt_ring evt_ring[GSI_EVT_RING_COUNT_MAX]; u32 event_bitmap; /* allocated event rings */ u32 modem_channel_bitmap; /* modem channels to allocate */ u32 type_enabled_bitmap; /* GSI IRQ types enabled */ u32 ieob_enabled_bitmap; /* IEOB IRQ enabled (event rings) */ - struct completion completion; /* Signals GSI command completion */ int result; /* Negative errno (generic commands) */ + struct completion completion; /* Signals GSI command completion */ struct mutex mutex; /* protects commands, programming */ + struct gsi_channel channel[GSI_CHANNEL_COUNT_MAX]; + struct gsi_evt_ring evt_ring[GSI_EVT_RING_COUNT_MAX]; + struct net_device dummy_dev; /* needed for NAPI */ }; /**