From patchwork Thu May 12 15:10:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 572191 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 D141EC433EF for ; Thu, 12 May 2022 15:11:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355736AbiELPLT (ORCPT ); Thu, 12 May 2022 11:11:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355731AbiELPKo (ORCPT ); Thu, 12 May 2022 11:10:44 -0400 Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AF3A261F99 for ; Thu, 12 May 2022 08:10:39 -0700 (PDT) Received: by mail-io1-xd2b.google.com with SMTP id z26so5629182iot.8 for ; Thu, 12 May 2022 08:10:39 -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=ObrabPeHCvU+7dJRKxpHSNrTAOTtMCoM5TrsgPoZkdA=; b=LqDnul8IKgFzWCT9AVCqtSZZI7UcE9n96UHYaVIKrZD7cdeC9oVar/qF2tycyK52L9 oTwaHrqibKBzBzgpvySd/H2RB/YciH6aGzeX/lWqQp9oX6W4iaacU5tp2j7iCwLVbEf1 GtR0YBHiKSfuaWOIMt/cKZfC32ZkeRcQGMe46B8O7O2/AM1BadvnVdhlI4iLHtVg6qdN nWNG0+bxOEAWljR6Fykxtaq2gos/WENZtVibwse/JhU0gZ2KSlMPM4b9etNg9CjFdYQd C0fX3bE2KW57tZf3GFsI/X/F1hXKRO9qApQ9VmpBwg5OKzgjX04snqiC8uHg72rFCopV /GfA== 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=ObrabPeHCvU+7dJRKxpHSNrTAOTtMCoM5TrsgPoZkdA=; b=nlVRbzCsiuak1XjK7YUkMr7wdeKxqItuTMME6QV7NxlF7xSosMz5H6A6XIPS+z6uPn upk6CEnygtNA6jxjO2J58x4HRa1AclWj3aOlIWozJ0ucZooVbL1pj7TefI9wRaewAGn7 449Ln4yev9b618BbjWj8sshJiQ1ds94jZzMZLxMRKF0MdHa+xpnkT7Yd6zEZLfHVKXBv pn1XJJv9fv+vMNcq9Zo96jU96cE8dPw1SUz9YZJaSYryIUTNi9R4RFuMB/0nAvik+TdA 1jH5Dr3fDUNffcykcRvm09LQaZFghwe7pQFY3gDRfAsNH0aHKDO0e9KK1aYsdDdGLdpp TQkw== X-Gm-Message-State: AOAM530JyUYbq8He1XZqiU9wD3zEapmOR5tIVDq/N6AfdXzrNqj1aWDE wvNxUQqhjI5EBv56v/PnzEO1ZQ== X-Google-Smtp-Source: ABdhPJwQ7Zbh5j7m5lhCWjOFBKmPPzLvKaDYU8LgG42BXrcHI9hZ5ehn3NWDUSTp+qJkpYDhcAsLZQ== X-Received: by 2002:a02:84ac:0:b0:32b:a11b:4586 with SMTP id f41-20020a0284ac000000b0032ba11b4586mr202328jai.231.1652368238418; Thu, 12 May 2022 08:10:38 -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 p15-20020a6b8d0f000000b0065a47e16f3fsm18217iod.17.2022.05.12.08.10.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 08:10:38 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com Cc: lkp@intel.com, 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 1/3] net: ipa: certain dropped packets aren't accounted for Date: Thu, 12 May 2022 10:10:31 -0500 Message-Id: <20220512151033.211592-2-elder@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220512151033.211592-1-elder@linaro.org> References: <20220512151033.211592-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org If an RX endpoint receives packets containing status headers, and a packet in the buffer is not dropped, ipa_endpoint_skb_copy() is responsible for wrapping the packet data in an SKB and forwarding it to ipa_modem_skb_rx() for further processing. If ipa_endpoint_skb_copy() gets a null pointer from build_skb(), it just returns early. But in the process it doesn't record that as a dropped packet in the network device statistics. Instead, call ipa_modem_skb_rx() whether or not the SKB pointer is NULL; that function ensures the statistics are properly updated. Fixes: 1b65bbcc9a710 ("net: ipa: skip SKB copy if no netdev") Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_endpoint.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 888e94278a84f..cea7b2e2ce969 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -1150,13 +1150,12 @@ static void ipa_endpoint_skb_copy(struct ipa_endpoint *endpoint, return; skb = __dev_alloc_skb(len, GFP_ATOMIC); - if (!skb) - return; - - /* Copy the data into the socket buffer and receive it */ - skb_put(skb, len); - memcpy(skb->data, data, len); - skb->truesize += extra; + if (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); } From patchwork Thu May 12 15:10:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 571841 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 C246BC4332F for ; Thu, 12 May 2022 15:11:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355737AbiELPLV (ORCPT ); Thu, 12 May 2022 11:11:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355733AbiELPKu (ORCPT ); Thu, 12 May 2022 11:10:50 -0400 Received: from mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13E4BC07 for ; Thu, 12 May 2022 08:10:40 -0700 (PDT) Received: by mail-il1-x12c.google.com with SMTP id y11so3740684ilp.4 for ; Thu, 12 May 2022 08:10:40 -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=eOgHbfj1z9x8AM1kqdr9IhGDZyiiSFcLmzAdQEoyfaQ=; b=fRABJ8HyGFX71otkrr5FftjCDwBBddBTCZDYZOdT49Am4zy4q+9ONol2dB625OXVGs buL/orF3YMUKOihWwv+iKweSSVAu4ETlleQlEbzX+6lhqoXtY7gvK4asdIIA3l4SvwIz TNaF3x2PoIP6x5L8by9m1GKPbOk02zEIn47dc8mFX8CGu1V3x4HHDAaNN3TkuzUKMnYJ 0alIWPaAFZ1Ll9URbqngDcweZie36Mwhz8TMiOBIeUCRkXG05A/LQe2RN85qf+h1qY2w k4fqSVSWYtZvrFn+/EowBvfTn/+v7ehXnx20ljqKcnB2YRlgSNb4x9kp46kvxgO0dFKZ KtuQ== 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=eOgHbfj1z9x8AM1kqdr9IhGDZyiiSFcLmzAdQEoyfaQ=; b=YF3k4znDoNMr2Q8MKGy6NyjROVBcdO//q4gvjPj1mAJrSgv9u2a7J6hk6lgTb6fjDx RSWwihUZZj4syEWKNjawMS7ny8ZCaX98NHsUH1PCfo0MROZ3MAnSuv16iB3UH6HkqJEC M2svEgJZ6XFsKFD/FVJ1XhY8OhV60Xmww28k5qUSUDJkniIfxiOipWPZQyXBa5dpxcTg soCKe8cIFya+KW4EqGkG3aZ83n2OzSvYMnBz07RCfo570+4xUmOcJw94JbXGHdoy7xTh b2uIaedjk0/wCr1m9QzAAZ48RhqI74W4pEcX3IqjAGi1LhIF9J+DNLgpSDuaGuFutxaZ rVBg== X-Gm-Message-State: AOAM5301ijZRhUiwVrYOhhQRRk/op8JCE1VI33btwRnlTny4vUDOTx/Y BZNBHqdRl2pRG9L/OU/R3R0sBg== X-Google-Smtp-Source: ABdhPJzLmDHREoZVAiAK++xyPN2j5zeEm9VkEoK9bMJ2NMUJWjGTJDzeUr9CQWyTjreeECbUUgRuRg== X-Received: by 2002:a05:6e02:1808:b0:2cf:41d7:7a20 with SMTP id a8-20020a056e02180800b002cf41d77a20mr251580ilv.300.1652368239478; Thu, 12 May 2022 08:10:39 -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 p15-20020a6b8d0f000000b0065a47e16f3fsm18217iod.17.2022.05.12.08.10.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 08:10:39 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com Cc: lkp@intel.com, 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 2/3] net: ipa: record proper RX transaction count Date: Thu, 12 May 2022 10:10:32 -0500 Message-Id: <20220512151033.211592-3-elder@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220512151033.211592-1-elder@linaro.org> References: <20220512151033.211592-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Each time we are notified that some number of transactions on an RX channel has completed, we record the number of bytes that have been transferred since the previous notification. We also track the number of transactions completed, but that is not currently being calculated correctly; we're currently counting the number of such notifications, but each notification can represent many transaction completions. Fix this. Fixes: 650d1603825d8 ("soc: qcom: ipa: the generic software interface") Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index bc981043cc808..a701178a1d139 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -1367,9 +1367,10 @@ static void gsi_evt_ring_rx_update(struct gsi_evt_ring *evt_ring, u32 index) struct gsi_event *event_done; struct gsi_event *event; struct gsi_trans *trans; + u32 trans_count = 0; u32 byte_count = 0; - u32 old_index; u32 event_avail; + u32 old_index; trans_info = &channel->trans_info; @@ -1390,6 +1391,7 @@ static void gsi_evt_ring_rx_update(struct gsi_evt_ring *evt_ring, u32 index) do { trans->len = __le16_to_cpu(event->len); byte_count += trans->len; + trans_count++; /* Move on to the next event and transaction */ if (--event_avail) @@ -1401,7 +1403,7 @@ static void gsi_evt_ring_rx_update(struct gsi_evt_ring *evt_ring, u32 index) /* We record RX bytes when they are received */ channel->byte_count += byte_count; - channel->trans_count++; + channel->trans_count += trans_count; } /* Initialize a ring, including allocating DMA memory for its entries */ From patchwork Thu May 12 15:10:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 571842 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 E5731C433EF for ; Thu, 12 May 2022 15:11:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355738AbiELPLR (ORCPT ); Thu, 12 May 2022 11:11:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355736AbiELPKu (ORCPT ); Thu, 12 May 2022 11:10:50 -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 58398DEC for ; Thu, 12 May 2022 08:10:41 -0700 (PDT) Received: by mail-io1-xd31.google.com with SMTP id z26so5629300iot.8 for ; Thu, 12 May 2022 08:10:41 -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=V+ifJblrQS6wsvVLJbCK4vZS+8eWu82qh+mj7lpTlPI=; b=BlhKvvEpQGUSQwb9tVfoCMFR+KbiPKGe70gOBDgljTA5DQUqQ9ZtT0kR7HeX0WWSOy SAXnIDDky6RlT0fx4cOJkqAVuo6GGxtjfFg2Y1o63whslEzsP1X7zkyvQ//Wj99oxnVE q/nSbzbflXX3HOTfe0stKMdncBYqvdAOkIsHHN0ezP/vZLF59z0/O0aadl383jhInwDM w/idkEqDx7g1z3yyLvsGLYppYWYJtcqcsLkqyw6hGmRVVGgcIiqWdnYgvvNvfvfpbChQ mzwQ9U03GQ3QsIV/wOTEeGf3wLy16CmUAJ52ENMM5yvGoY+TzZKlcMZZ5EDrAjkGBvyr LI4A== 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+ifJblrQS6wsvVLJbCK4vZS+8eWu82qh+mj7lpTlPI=; b=FKJd1OTyQsiyQsYZ3Mkz9URO8vc4o2PdQj5CYDEFoDUrFD+hTGuIFlj2fZ3Aw6RTHu AiH2gSkYYVLO0YVqzxdLoYgsORTDCiM9cweST3nmSkHoTSzvPe/fSYIccwGXzEWDjvXy M7okkyNl6OFddsGSoqDOvk9bnKbjudlv8RFjm4rUZAKQv9VUg3qA5xAxXs67xPS1ioEy p92M3wTIW9nfAFNOBSAeMthidalaH7voB+NdPzrc437uPY96x3xpThMdWzhuv57XJQy2 tt/TSJYDetBI4DZX0NGmOw2IRM7ZNJ0HFy1UMMqYg2H247NGaHsIKLFJeAymmhqW2DtF p7/A== X-Gm-Message-State: AOAM531rFQpkcL//6KV+ldPE8Ta22is4j9bEyfumkRYIpWDLXqMuZSZ/ huY8ufS20/cgURGpeSPme9kKWA== X-Google-Smtp-Source: ABdhPJxlGm6rc2dunPT/tr/IfzWzjshBamNU2Qi/F2jgUz/yyiEQIT+JLijC3K3aRzy2BvP1FxejlQ== X-Received: by 2002:a05:6638:12d3:b0:32b:7235:6a08 with SMTP id v19-20020a05663812d300b0032b72356a08mr215122jas.27.1652368240573; Thu, 12 May 2022 08:10:40 -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 p15-20020a6b8d0f000000b0065a47e16f3fsm18217iod.17.2022.05.12.08.10.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 08:10:40 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com Cc: lkp@intel.com, 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 3/3] net: ipa: get rid of a duplicate initialization Date: Thu, 12 May 2022 10:10:33 -0500 Message-Id: <20220512151033.211592-4-elder@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220512151033.211592-1-elder@linaro.org> References: <20220512151033.211592-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org In ipa_qmi_ready(), the "ipa" local variable is set when initialized, but then set again just before it's first used. One or the other is enough, so get rid of the first one. References: https://lore.kernel.org/lkml/200de1bd-0f01-c334-ca18-43eed783dfac@intel.com/ Reported-by: kernel test robot Fixes: 530f9216a953 ("soc: qcom: ipa: AP/modem communications") Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_qmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ipa/ipa_qmi.c b/drivers/net/ipa/ipa_qmi.c index 90f3aec55b365..ec010cf2e816a 100644 --- a/drivers/net/ipa/ipa_qmi.c +++ b/drivers/net/ipa/ipa_qmi.c @@ -125,7 +125,7 @@ static void ipa_qmi_indication(struct ipa_qmi *ipa_qmi) */ static void ipa_qmi_ready(struct ipa_qmi *ipa_qmi) { - struct ipa *ipa = container_of(ipa_qmi, struct ipa, qmi); + struct ipa *ipa; int ret; /* We aren't ready until the modem and microcontroller are */