From patchwork Wed Jan 13 17:15:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 12017439 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6F39C433DB for ; Wed, 13 Jan 2021 17:17:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 649F523432 for ; Wed, 13 Jan 2021 17:17:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728098AbhAMRQx (ORCPT ); Wed, 13 Jan 2021 12:16:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727971AbhAMRQx (ORCPT ); Wed, 13 Jan 2021 12:16:53 -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 6E00FC0617A2 for ; Wed, 13 Jan 2021 09:15:38 -0800 (PST) Received: by mail-io1-xd34.google.com with SMTP id d9so5627071iob.6 for ; Wed, 13 Jan 2021 09:15:38 -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=aRwGdFI2JNmHcGPkamTAcTzIYOj5ZfZH0cIxNdbAZHY=; b=uXJNMHGXscrnSoI79efLaUuFvE7/ABS22pvoY3+9K/k0B68J1lt39suBR/zXUoR2Fc FEgfrqHtIJQFokAqr+GmaXSU/AJ+ZEnexW94vAyF4AsofEZDQp0R0EHH6hqVIfRWnvfg 2ddrJa+jaOM9QHG0KrRKM6E8E3GZGlqCCAAgqi8cBNsgHDWyfdBJzNM3svvQ57Gb5dB9 xa1peFwhj3myH7zMiNAgEOi8lwaWvMmfD/7HFD2USuoA794qXM/FTavf/Fe3+7oNKXvj qYAuZT1yfRkCPR1/7y4/fgkP2BFOO2880XJgeja3bp2DuTppNOILc7w4BnCUMNwfzl4o P1Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aRwGdFI2JNmHcGPkamTAcTzIYOj5ZfZH0cIxNdbAZHY=; b=aZeHL0B9F62s3K5YrkFqFhuLlT3tOEErBEhoYDulHRBgMEbwPrNsS1HFTgrbett+aF A2+oa93HpNItVcnGJYPpVlxya6xqJrAvxBihwwCw3facizgLEgNX24Aej5a8WZlo8dTq Qab8WekwHyhtuK9svomXRlfKWNMQ0HlCxLoOZqAOBRMcSI13yeAJRvof47Rz8MvVsx6j 91Q+qxfdXW+kDGqcswdZn6V3clNLRvkgveG/7OtyG0FP5U5BdJYyQD5pk3rY1mpm2kte UMsgc+SW0KRGkbQypMOv2fxhcKqO8llUQPembRhh0Soef9GuG/u8SDD9IbxBlkTNs8GN XGxw== X-Gm-Message-State: AOAM531y588r15rLgMPECqBslHnS5Hbzsjuvxwpt+395oUXrOdhpZaN/ ffXJOzJBhUE/q48ttRjdeEzLYA== X-Google-Smtp-Source: ABdhPJxmKQZYLN3X8LSa7lHDsX4cc7G5qtNntqZZmsJ6VN6TwXinxmIs8EQXy6WrwgnZDkOYyOanyA== X-Received: by 2002:a92:9ada:: with SMTP id c87mr3336323ill.5.1610558137845; Wed, 13 Jan 2021 09:15:37 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id h9sm1120579ili.43.2021.01.13.09.15.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 09:15:37 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, bjorn.andersson@linaro.org, cpratapa@codeaurora.org, subashab@codeaurora.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/6] net: ipa: a few simple renames Date: Wed, 13 Jan 2021 11:15:27 -0600 Message-Id: <20210113171532.19248-2-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210113171532.19248-1-elder@linaro.org> References: <20210113171532.19248-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The return value of gsi_command() is true if successful or false if we time out waiting for a completion interrupt. Rename the variables in the three callers of gsi_command() to be "timeout", to make it more obvious that's the only reason for failure. In addition, add a "gsi_" prefix to evt_ring_command() so its name is consistent with the convention used for GSI channel and generic commands. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 14d9a791924bf..b5913ce0bc943 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -326,13 +326,13 @@ gsi_evt_ring_state(struct gsi *gsi, u32 evt_ring_id) } /* Issue an event ring command and wait for it to complete */ -static void evt_ring_command(struct gsi *gsi, u32 evt_ring_id, - enum gsi_evt_cmd_opcode opcode) +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 success; + bool timeout; u32 val; /* We only perform one event ring command at a time, and event @@ -354,13 +354,13 @@ static void 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); - success = gsi_command(gsi, GSI_EV_CH_CMD_OFFSET, val, completion); + timeout = !gsi_command(gsi, GSI_EV_CH_CMD_OFFSET, val, completion); /* Disable the interrupt again */ gsi_irq_type_disable(gsi, GSI_EV_CTRL); iowrite32(0, gsi->virt + GSI_CNTXT_SRC_EV_CH_IRQ_MSK_OFFSET); - if (success) + if (!timeout) return; dev_err(dev, "GSI command %u for event ring %u timed out, state %u\n", @@ -380,7 +380,7 @@ static int gsi_evt_ring_alloc_command(struct gsi *gsi, u32 evt_ring_id) return -EINVAL; } - evt_ring_command(gsi, evt_ring_id, GSI_EVT_ALLOCATE); + gsi_evt_ring_command(gsi, evt_ring_id, GSI_EVT_ALLOCATE); /* If successful the event ring state will have changed */ if (evt_ring->state == GSI_EVT_RING_STATE_ALLOCATED) @@ -405,7 +405,7 @@ static void gsi_evt_ring_reset_command(struct gsi *gsi, u32 evt_ring_id) return; } - evt_ring_command(gsi, evt_ring_id, GSI_EVT_RESET); + gsi_evt_ring_command(gsi, evt_ring_id, GSI_EVT_RESET); /* If successful the event ring state will have changed */ if (evt_ring->state == GSI_EVT_RING_STATE_ALLOCATED) @@ -426,7 +426,7 @@ static void gsi_evt_ring_de_alloc_command(struct gsi *gsi, u32 evt_ring_id) return; } - evt_ring_command(gsi, evt_ring_id, GSI_EVT_DE_ALLOC); + gsi_evt_ring_command(gsi, evt_ring_id, GSI_EVT_DE_ALLOC); /* If successful the event ring state will have changed */ if (evt_ring->state == GSI_EVT_RING_STATE_NOT_ALLOCATED) @@ -456,7 +456,7 @@ gsi_channel_command(struct gsi_channel *channel, enum gsi_ch_cmd_opcode opcode) u32 channel_id = gsi_channel_id(channel); struct gsi *gsi = channel->gsi; struct device *dev = gsi->dev; - bool success; + bool timeout; u32 val; /* We only perform one channel command at a time, and channel @@ -477,13 +477,13 @@ 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); - success = gsi_command(gsi, GSI_CH_CMD_OFFSET, val, completion); + timeout = !gsi_command(gsi, GSI_CH_CMD_OFFSET, val, completion); /* Disable the interrupt again */ gsi_irq_type_disable(gsi, GSI_CH_CTRL); iowrite32(0, gsi->virt + GSI_CNTXT_SRC_CH_IRQ_MSK_OFFSET); - if (success) + if (!timeout) return; dev_err(dev, "GSI command %u for channel %u timed out, state %u\n", @@ -1627,7 +1627,7 @@ static int gsi_generic_command(struct gsi *gsi, u32 channel_id, enum gsi_generic_cmd_opcode opcode) { struct completion *completion = &gsi->completion; - bool success; + bool timeout; u32 val; /* The error global interrupt type is always enabled (until we @@ -1650,12 +1650,12 @@ 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); - success = gsi_command(gsi, GSI_GENERIC_CMD_OFFSET, val, completion); + timeout = !gsi_command(gsi, GSI_GENERIC_CMD_OFFSET, val, completion); /* Disable the GP_INT1 IRQ type again */ iowrite32(BIT(ERROR_INT), gsi->virt + GSI_CNTXT_GLOB_IRQ_EN_OFFSET); - if (success) + if (!timeout) return gsi->result; dev_err(gsi->dev, "GSI generic command %u to channel %u timed out\n", From patchwork Wed Jan 13 17:15:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 12017433 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 259BAC433E6 for ; Wed, 13 Jan 2021 17:17:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C96F623432 for ; Wed, 13 Jan 2021 17:17:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728111AbhAMRQy (ORCPT ); Wed, 13 Jan 2021 12:16:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727988AbhAMRQx (ORCPT ); Wed, 13 Jan 2021 12:16:53 -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 95B0BC0617A3 for ; Wed, 13 Jan 2021 09:15:39 -0800 (PST) Received: by mail-io1-xd31.google.com with SMTP id z5so5569997iob.11 for ; Wed, 13 Jan 2021 09:15:39 -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=GXvZPSGq6x3yeoMxoYd+JlpMOpfBxN00Vmli9SdjOe4=; b=xXal6/FBYvLJt9S3Aum1Mf3YrBTGnLOJkLzQ1bFhtl6Jgg7XxrBNvHLTkSGE5IcYzT S7EstxEHuf6Tk+5ZD16TsO7bbyBuU7bpzUUUmXsXgq98YFPCEkw9RTCIUP1VNaI4fykw W7/wup2Kk4Ksdtq+Q5E140LGW2bdqsc8CJRJWMUCAWZkTHLXNYjitx+5rIWMzARgJXwV LoIOcquX6A0K+f6uid+H7G1Nn5xpQt+3jXa3JX4taT0eEeZ+PVXp/Dhv0zwkBx71890F MvvaxHoRY1r+tA0nm5B5krkv84Hhr5ErtUvsseHRxKHEfPl2lGQGJ0r/G1lehygSYZnd 2vhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GXvZPSGq6x3yeoMxoYd+JlpMOpfBxN00Vmli9SdjOe4=; b=XXO/2mGFHfkFr9HCNSG6mrjQ/Lz4D3EbXGiW7v/dMqtkq1P7x57aJfHM+iQnSgybqm 7j3CLKW24K/mk4CUBxwM92q/s8EG+D4WOEzqve0NADzxVwXSBx3rX4iiKpH9ZvHA56h2 n07h5RZyr6kyIxfNSqZORqOSaDhC1R+7EGs3Jhc/emi1805pj3xKHF9VTyebqvDhJta8 IVP+k1x9JY7zGHiHEzlU9qyV4/3AP9lkHVJQgzXpwBz8Yo2nMw+bPYvZaepd7Wxoyqrv FfkZsf2BBNnRgVCRbQjlA4CH5u3LalyAGZL2hBy5z3cAdrTNsYewq3/9QUqzHbZi10ed 4Frw== X-Gm-Message-State: AOAM533RFSY2bP9Gfk753cHjL24XNk9J2XJG8SWeHzuHBE1DJyC6r0HV C11oiL9XKyCVJvylXKFx8mJbIQ== X-Google-Smtp-Source: ABdhPJy6/3uTg/SGPGO8lmIATCEf7rvP3WZKgI+71wO7E0jKmQJ1Lq1E94TnUSM51Xm2bv/nxjDZ5w== X-Received: by 2002:a92:db52:: with SMTP id w18mr2517597ilq.56.1610558138911; Wed, 13 Jan 2021 09:15:38 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id h9sm1120579ili.43.2021.01.13.09.15.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 09:15:38 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, bjorn.andersson@linaro.org, cpratapa@codeaurora.org, subashab@codeaurora.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 2/6] net: ipa: introduce some interrupt helpers Date: Wed, 13 Jan 2021 11:15:28 -0600 Message-Id: <20210113171532.19248-3-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210113171532.19248-1-elder@linaro.org> References: <20210113171532.19248-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Create a new function gsi_irq_ev_ctrl_enable() that encapsulates enabling the event ring control GSI interrupt type, and enables a single event ring to signal that interrupt. When an event ring changes state as a result of an event ring command, it triggers this interrupt. Create an inverse function gsi_irq_ev_ctrl_disable() as well. Because only one event ring at a time is enabled for this interrupt, we can simply disable the interrupt for *all* channels. Create a pair of helpers that serve the same purpose for channel commands. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 94 ++++++++++++++++++++++++++----------------- 1 file changed, 58 insertions(+), 36 deletions(-) diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index b5913ce0bc943..e5681a39b5fc6 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -220,6 +220,58 @@ static void gsi_irq_teardown(struct gsi *gsi) /* Nothing to do */ } +/* Event ring commands are performed one at a time. Their completion + * is signaled by the event ring control GSI interrupt type, which is + * only enabled when we issue an event ring command. Only the event + * ring being operated on has this interrupt enabled. + */ +static void gsi_irq_ev_ctrl_enable(struct gsi *gsi, u32 evt_ring_id) +{ + u32 val = BIT(evt_ring_id); + + /* There's a small chance that a previous command completed + * after the interrupt was disabled, so make sure we have no + * pending interrupts before we enable them. + */ + iowrite32(~0, gsi->virt + GSI_CNTXT_SRC_EV_CH_IRQ_CLR_OFFSET); + + iowrite32(val, gsi->virt + GSI_CNTXT_SRC_EV_CH_IRQ_MSK_OFFSET); + gsi_irq_type_enable(gsi, GSI_EV_CTRL); +} + +/* Disable event ring control interrupts */ +static void gsi_irq_ev_ctrl_disable(struct gsi *gsi) +{ + gsi_irq_type_disable(gsi, GSI_EV_CTRL); + iowrite32(0, gsi->virt + GSI_CNTXT_SRC_EV_CH_IRQ_MSK_OFFSET); +} + +/* Channel commands are performed one at a time. Their completion is + * signaled by the channel control GSI interrupt type, which is only + * enabled when we issue a channel command. Only the channel being + * operated on has this interrupt enabled. + */ +static void gsi_irq_ch_ctrl_enable(struct gsi *gsi, u32 channel_id) +{ + u32 val = BIT(channel_id); + + /* There's a small chance that a previous command completed + * after the interrupt was disabled, so make sure we have no + * pending interrupts before we enable them. + */ + iowrite32(~0, gsi->virt + GSI_CNTXT_SRC_CH_IRQ_CLR_OFFSET); + + iowrite32(val, gsi->virt + GSI_CNTXT_SRC_CH_IRQ_MSK_OFFSET); + gsi_irq_type_enable(gsi, GSI_CH_CTRL); +} + +/* Disable channel control interrupts */ +static void gsi_irq_ch_ctrl_disable(struct gsi *gsi) +{ + gsi_irq_type_disable(gsi, GSI_CH_CTRL); + iowrite32(0, gsi->virt + GSI_CNTXT_SRC_CH_IRQ_MSK_OFFSET); +} + static void gsi_irq_ieob_enable(struct gsi *gsi, u32 evt_ring_id) { bool enable_ieob = !gsi->ieob_enabled_bitmap; @@ -335,30 +387,15 @@ static void gsi_evt_ring_command(struct gsi *gsi, u32 evt_ring_id, bool timeout; u32 val; - /* We only perform one event ring command at a time, and event - * control interrupts should only occur when such a command - * is issued here. Only permit *this* event ring to trigger - * an interrupt, and only enable the event control IRQ type - * when we expect it to occur. - * - * There's a small chance that a previous command completed - * after the interrupt was disabled, so make sure we have no - * pending interrupts before we enable them. - */ - iowrite32(~0, gsi->virt + GSI_CNTXT_SRC_EV_CH_IRQ_CLR_OFFSET); - - val = BIT(evt_ring_id); - iowrite32(val, gsi->virt + GSI_CNTXT_SRC_EV_CH_IRQ_MSK_OFFSET); - gsi_irq_type_enable(gsi, GSI_EV_CTRL); + /* Enable the completion interrupt for the command */ + gsi_irq_ev_ctrl_enable(gsi, 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); - /* Disable the interrupt again */ - gsi_irq_type_disable(gsi, GSI_EV_CTRL); - iowrite32(0, gsi->virt + GSI_CNTXT_SRC_EV_CH_IRQ_MSK_OFFSET); + gsi_irq_ev_ctrl_disable(gsi); if (!timeout) return; @@ -459,29 +496,14 @@ gsi_channel_command(struct gsi_channel *channel, enum gsi_ch_cmd_opcode opcode) bool timeout; u32 val; - /* We only perform one channel command at a time, and channel - * control interrupts should only occur when such a command is - * issued here. So we only permit *this* channel to trigger - * an interrupt and only enable the channel control IRQ type - * when we expect it to occur. - * - * There's a small chance that a previous command completed - * after the interrupt was disabled, so make sure we have no - * pending interrupts before we enable them. - */ - iowrite32(~0, gsi->virt + GSI_CNTXT_SRC_CH_IRQ_CLR_OFFSET); - - val = BIT(channel_id); - iowrite32(val, gsi->virt + GSI_CNTXT_SRC_CH_IRQ_MSK_OFFSET); - gsi_irq_type_enable(gsi, GSI_CH_CTRL); + /* Enable the completion interrupt for the command */ + gsi_irq_ch_ctrl_enable(gsi, channel_id); 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); - /* Disable the interrupt again */ - gsi_irq_type_disable(gsi, GSI_CH_CTRL); - iowrite32(0, gsi->virt + GSI_CNTXT_SRC_CH_IRQ_MSK_OFFSET); + gsi_irq_ch_ctrl_disable(gsi); if (!timeout) return; From patchwork Wed Jan 13 17:15:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 12017431 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B130C433E9 for ; Wed, 13 Jan 2021 17:17:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F2CA423406 for ; Wed, 13 Jan 2021 17:17:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728124AbhAMRQy (ORCPT ); Wed, 13 Jan 2021 12:16:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728082AbhAMRQx (ORCPT ); Wed, 13 Jan 2021 12:16:53 -0500 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8316C0617A5 for ; Wed, 13 Jan 2021 09:15:40 -0800 (PST) Received: by mail-io1-xd29.google.com with SMTP id u17so5692481iow.1 for ; Wed, 13 Jan 2021 09:15:40 -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=l1IOSEu+vyCQsNm2sF39ZzPXY+5QREQKKoylCV6H1Jg=; b=r1J29VmGqzEuZBHBu8w8M6gaA/yEBauw84YklgDIGC8Me5dWwVlqJEmQ9g6mUeH0f7 neiyLIkHJ+WYeG54zWirQgT48uRaz2Nk0O4otQnLjCUVFMl+XqOzCM0f5rMemd/LDAvB 1aa0v+tDSVv/WAbxNf/JumsXXXmcf0uEzBvbQ5gVxK3A+nkdu0gV7DgjfvH6QhLoxY3X kvjf4geDG88wbhVr4Opf/6pCQWkjrsukt9Fk+RFNdycpjk9u7mr1WshMH5L8nBUAO1Fy 7K/GUWOUKAnuhN/l8GkVXYPdjQ63V8f3Ge23VRzJJa1n43a+ehLUZy8uc8yn4+VA3boT 3mgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=l1IOSEu+vyCQsNm2sF39ZzPXY+5QREQKKoylCV6H1Jg=; b=eeQcHrhH469n/LRBp5Jc+aocTz23AETg3kJVDgs1DzSdH4bQJaIpdG0WE56uy7Bo+4 gBYxRI5wkvPjMw59j99XlOrvVTd2IYdoMks8JPBC40ePfNm+KakqxxBNMZ5+CtyZBb2p viLlM20PIquFRQ3x9aqSRQDfn1scAFCSXMeI3Q8y0aaCEnPtKb3V/30r+Dpv0xy9LeFA WjHSk+EXItMtMofqqQZugKud9iLGwMgRl0c+lu9a++nKDVF1hGnRjy8Wssf/cXyY1K4B c9GkfnUzfiMBVok5IffBdDtX8Dx7zwwpMs9hvt/7IeEUmpHO89I9IjBjtUPddVe/LZ7I gpGg== X-Gm-Message-State: AOAM530Z3Vw7NVzNxLr8zJHCkKGBmlehpbJmqVj86SYkLcM6OEDI9YRn VSbOzs/1I1WbMLg42F4Rzcyu4Q== X-Google-Smtp-Source: ABdhPJxm7gYHJB7apQRYjR8zQpXumSWaySY7r83l6ly50Epp/7LV1S/UqlovAbe+zT5ENtBbO3eCZg== X-Received: by 2002:a92:4906:: with SMTP id w6mr3225429ila.234.1610558140086; Wed, 13 Jan 2021 09:15:40 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id h9sm1120579ili.43.2021.01.13.09.15.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 09:15:39 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, bjorn.andersson@linaro.org, cpratapa@codeaurora.org, subashab@codeaurora.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 3/6] net: ipa: use usleep_range() Date: Wed, 13 Jan 2021 11:15:29 -0600 Message-Id: <20210113171532.19248-4-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210113171532.19248-1-elder@linaro.org> References: <20210113171532.19248-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The use of msleep() for small periods (less than 20 milliseconds) is not recommended because the actual delay can be much different than expected. We use msleep(1) in several places in the IPA driver to insert short delays. Replace them with usleep_range calls, which should reliably delay a period in the range requested. Fixes: 650d1603825d8 ("soc: qcom: ipa: the generic software interface") Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 5 +++-- drivers/net/ipa/ipa_endpoint.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index e5681a39b5fc6..93b143ba92be5 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -611,7 +611,8 @@ static void gsi_channel_reset_command(struct gsi_channel *channel) struct device *dev = channel->gsi->dev; enum gsi_channel_state state; - msleep(1); /* A short delay is required before a RESET command */ + /* A short delay is required before a RESET command */ + usleep_range(USEC_PER_MSEC, 2 * USEC_PER_MSEC); state = gsi_channel_state(channel); if (state != GSI_CHANNEL_STATE_STOPPED && @@ -900,7 +901,7 @@ int gsi_channel_stop(struct gsi *gsi, u32 channel_id) ret = gsi_channel_stop_command(channel); if (ret != -EAGAIN) break; - msleep(1); + usleep_range(USEC_PER_MSEC, 2 * USEC_PER_MSEC); } while (retries--); mutex_unlock(&gsi->mutex); diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 9f4be9812a1f3..688a3dd40510a 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -1378,7 +1378,7 @@ static int ipa_endpoint_reset_rx_aggr(struct ipa_endpoint *endpoint) do { if (!ipa_endpoint_aggr_active(endpoint)) break; - msleep(1); + usleep_range(USEC_PER_MSEC, 2 * USEC_PER_MSEC); } while (retries--); /* Check one last time */ @@ -1399,7 +1399,7 @@ static int ipa_endpoint_reset_rx_aggr(struct ipa_endpoint *endpoint) */ gsi_channel_reset(gsi, endpoint->channel_id, true); - msleep(1); + usleep_range(USEC_PER_MSEC, 2 * USEC_PER_MSEC); goto out_suspend_again; From patchwork Wed Jan 13 17:15:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 12017441 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58525C43381 for ; Wed, 13 Jan 2021 17:17:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2070123437 for ; Wed, 13 Jan 2021 17:17:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728213AbhAMRRU (ORCPT ); Wed, 13 Jan 2021 12:17:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728126AbhAMRQ6 (ORCPT ); Wed, 13 Jan 2021 12:16:58 -0500 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D584DC0617A9 for ; Wed, 13 Jan 2021 09:15:41 -0800 (PST) Received: by mail-io1-xd29.google.com with SMTP id y19so5671323iov.2 for ; Wed, 13 Jan 2021 09:15:41 -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=9HP5QJchHpYyjOaAf3lP3KAwAYZ3mwgofh4y4UljDvM=; b=AHdCpwhK97XEhzE6KaoVys78e8zun3noFVwcwXWVGjOD6NjAnDi1pM1OP7CEQLvKf4 DR670E9/PS3jDvNT5NBz001lF91xZC/U0jI9R2mmddz5rUrA7zhWc5K4awqOqlqAuzGB Att4bp/gXCF6wa9oub1iQPUSi6Hou3FZqfoq0B5Ah5/oXs+3WILsE/jWfxngz1DKDien n54dI6ix40kCPgeNCzOALbwWFzOWy2smb32xUk2cYDrPfOcg3NgUNGPfyYnmKH0XOvG2 KB73bDsM4Hi1zGxPxixGNR+MWMKBoDZ4LWlw8Fy5KgLKpt9SzW60qjD9TY49SvgePE8x ZMwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9HP5QJchHpYyjOaAf3lP3KAwAYZ3mwgofh4y4UljDvM=; b=B9Vf4iMnR5pceSzRiXE4GuiahEGnt24dqPodyfNqat9YWgCw2DLeK2ez2p0KC+3/mB YXB3Fr+znd236q2M2jSv7dKzxwtPUibnAhyKH5P4s4Zls5cg8YI/QqsW0o/4nsjfNQh7 EPt48tRRxM6bg6SK/9hAGfFFsFWOXNCVeFcDHsm5INn6uo9bPuSXyzVrJx7ONnBRrrsO HnCd+25no+ECChUwJG7ZY5fNx+KQfiPVz7VyjnBq5cMfU534PIfnV0z9EgcyXyfBySBj CVTo7v9liP2XHyTgejcr8miu3zHWXDwYRNxglUGQ8kmsyHTv6+48PJTS1NKQcYS5onIy k4Ng== X-Gm-Message-State: AOAM5304RF5IVfzyeqPFUdS74BWu49s5HuG9rPWKCCo+csNfcIgktzW4 5ZWAgdtax4SzX9QiSpgLz15LDQ== X-Google-Smtp-Source: ABdhPJz9zCzSka5zLcCuOh0/8P/Qdzmqj2EEZyCAhM9sJD5VKvN91qQR224sw2tjRW89mhZFLBOYQA== X-Received: by 2002:a05:6638:2243:: with SMTP id m3mr3267192jas.115.1610558141221; Wed, 13 Jan 2021 09:15:41 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id h9sm1120579ili.43.2021.01.13.09.15.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 09:15:40 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, bjorn.andersson@linaro.org, cpratapa@codeaurora.org, subashab@codeaurora.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 4/6] net: ipa: change GSI command timeout Date: Wed, 13 Jan 2021 11:15:30 -0600 Message-Id: <20210113171532.19248-5-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210113171532.19248-1-elder@linaro.org> References: <20210113171532.19248-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The GSI command timeout is currently 5 seconds, which is much higher than it should be. Express the timeout in milliseconds rather than seconds, and reduce it to 50 milliseconds. 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 93b143ba92be5..4de769166978b 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -89,7 +89,7 @@ /* Delay period for interrupt moderation (in 32KHz IPA internal timer ticks) */ #define GSI_EVT_RING_INT_MODT (32 * 1) /* 1ms under 32KHz clock */ -#define GSI_CMD_TIMEOUT 5 /* seconds */ +#define GSI_CMD_TIMEOUT 50 /* milliseconds */ #define GSI_CHANNEL_STOP_RX_RETRIES 10 #define GSI_CHANNEL_MODEM_HALT_RETRIES 10 @@ -359,11 +359,13 @@ static u32 gsi_ring_index(struct gsi_ring *ring, u32 offset) static bool gsi_command(struct gsi *gsi, u32 reg, u32 val, struct completion *completion) { + unsigned long timeout = msecs_to_jiffies(GSI_CMD_TIMEOUT); + reinit_completion(completion); iowrite32(val, gsi->virt + reg); - return !!wait_for_completion_timeout(completion, GSI_CMD_TIMEOUT * HZ); + return !!wait_for_completion_timeout(completion, timeout); } /* Return the hardware's notion of the current state of an event ring */ From patchwork Wed Jan 13 17:15:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 12017435 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D46EBC4332E for ; Wed, 13 Jan 2021 17:17:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A619223406 for ; Wed, 13 Jan 2021 17:17:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728152AbhAMRQ7 (ORCPT ); Wed, 13 Jan 2021 12:16:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728129AbhAMRQ6 (ORCPT ); Wed, 13 Jan 2021 12:16:58 -0500 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 EB72FC0617AA for ; Wed, 13 Jan 2021 09:15:42 -0800 (PST) Received: by mail-io1-xd2a.google.com with SMTP id u26so5667790iof.3 for ; Wed, 13 Jan 2021 09:15:42 -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=4ne5Zo1fGRu2iVcYjOo63CG/Ih5OIPi4+1L9+3+54RU=; b=sbTiZViyBdcIcY4TVKLFp8dMDvOB4aVI4mbfI/SnTr0qjNrxX70pM1g+vz1sNk3GQG 5ua75OuvAWyvNffK2SnKjyBQXPEGehG9YcSDUTb25W9uXNlJeR9g0K+1w/Mw2hoB0ul9 qK88hj4K0F35DtHh+Jpkuo9fZmHGbiFCH1amd5EuGFa6HY1PuQi0fVy9m6vVOjpFLn+6 gw4JytVhDzdpgtnmLZzm0ujlTRNebECGbuGasjItPUm3gR0Mwxd4iGAzNTUT5FlIUOfB 304dS++1ksF9IFYEXKGfWJ23OtEArnIjaE+4WrwsHPQEHbpqKEBMIF1D0ut470lXDoj+ JCLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4ne5Zo1fGRu2iVcYjOo63CG/Ih5OIPi4+1L9+3+54RU=; b=bn4oSlSBeleyjj1fs3k8FVA3QXSEo8pnjQCzL42Yn2EmIx76nj9Ii8FzsIqriNh7j/ fHVPz7qkqYFpykIBewLGGNWXmq7uIpil7o2rwnh9MffRbNLi+1D04Q6Dz3s1qry0fVUK 4fYTBGzLC96pR1jUjoCh93NjXxFX2R89fr7SH225pyIacLEqbONhAonGlpVBlbempops +xG9UeRsNbXEQtppnSQxe2Nz3z3jSaqRwPfcU5ab3l729ELp1qFVgvtMgkhIuLoCUGdw VdFtwhCBTpbqBXme6HwQIIQKiXTkeUARlmnHGWIADLA9/PTVtnRK9tq2PEVFT/U9ffC8 GIAg== X-Gm-Message-State: AOAM531+UQvpSS7XrBQgT3wDmJN6n3fFt6VD+FnrLV+ZDEDt5yPsfNpC YoITx4J3uPBTUUSaruACQFa7Lg== X-Google-Smtp-Source: ABdhPJwqgwzDrfl1xbczv4gWCZ6+t/rZG8bYbPRZzSuQ+fnazWGSZlOMnh6fqSXE9w0TNxSGNjOJig== X-Received: by 2002:a5e:dc0d:: with SMTP id b13mr2581885iok.31.1610558142318; Wed, 13 Jan 2021 09:15:42 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id h9sm1120579ili.43.2021.01.13.09.15.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 09:15:41 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, bjorn.andersson@linaro.org, cpratapa@codeaurora.org, subashab@codeaurora.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 5/6] net: ipa: change stop channel retry delay Date: Wed, 13 Jan 2021 11:15:31 -0600 Message-Id: <20210113171532.19248-6-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210113171532.19248-1-elder@linaro.org> References: <20210113171532.19248-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org If a GSI stop channel command leaves the channel in STOP_IN_PROC state, we retry the stop command after a 1-2 millisecond delay. I have been told that a 3-5 millisecond delay is a better choice. Fixes: 650d1603825d8 ("soc: qcom: ipa: the generic software interface") Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 4de769166978b..5c163f9c0ea7b 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -903,7 +903,7 @@ int gsi_channel_stop(struct gsi *gsi, u32 channel_id) ret = gsi_channel_stop_command(channel); if (ret != -EAGAIN) break; - usleep_range(USEC_PER_MSEC, 2 * USEC_PER_MSEC); + usleep_range(3 * USEC_PER_MSEC, 5 * USEC_PER_MSEC); } while (retries--); mutex_unlock(&gsi->mutex); From patchwork Wed Jan 13 17:15:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 12017437 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18A3DC43332 for ; Wed, 13 Jan 2021 17:17:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CE62D23437 for ; Wed, 13 Jan 2021 17:17:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728178AbhAMRRI (ORCPT ); Wed, 13 Jan 2021 12:17:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728143AbhAMRQ7 (ORCPT ); Wed, 13 Jan 2021 12:16:59 -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 32376C0617B0 for ; Wed, 13 Jan 2021 09:15:44 -0800 (PST) Received: by mail-io1-xd2f.google.com with SMTP id u26so5667939iof.3 for ; Wed, 13 Jan 2021 09:15:44 -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=cya1YllzUew1Cz7aOjwGwTo+phSDuV7y8gvGZ//U/9Q=; b=mU/mNVI1DbIGzLDbFVMDvJokTzluyxYOZ835J5gSBXl9SNgJli/wh4cNdHzIkBHYdH b3dr+Gphw383vAAc1jzu4Ry+RMtAVkVT96qLS9S9dJ9sDXyCQIRf9w4lh4QHDBNaWHSr fcy1W8pHyz+lOKDFGkUma55jl5L9zqZVgHcK1plyCaOhBxUbqRlvGx0Cl0mA6llTaHLI ZNFS6agCjJpko710CEz1QhKyonVyzVprbrcxDwicKFQ+UktUiiRNW1DvpOE3MoaNIYeD qlp9v7mDHhdjEvbUmoiYh37CDW0s7hBG3tK5Ja1f4b3fe7LKBigxGSt7L2XGMnJKZsWC fgag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cya1YllzUew1Cz7aOjwGwTo+phSDuV7y8gvGZ//U/9Q=; b=Mcsvwm+90caFRP5rYFSunks/QhrrxyaHkrTJZAL7nq9CpBW03NsgkPj2GeH0NxrwC8 ZvI8zYKAoRKfPy6Zwqn+638WEOsHNvtKg9TgL9C5amS4ezwRpuWMMb/vGj/KwTe3Mpki DhdUQmR1CMBhzXunYCbOKEyEf4khyM9L997puap29PggWLUggt0d+CzzBU/gwHlr99QF z3LVJrayusfmr/ys6cllWiWLxyPtST+HisEv4HvZATKw7XsZYONCnWnmZ+ucjGaNFPDw C5yVtO2axrl4dykF3uWYHE/8s1cNjCLEek29Vnp6vq0E9iYlx/axV6ByX1QLv9kg9QRQ zhYA== X-Gm-Message-State: AOAM533sVnD8s0HApX0XwQq44OsOv6S3uGKN1q1K3pM98TD9dGzO9Gl3 aIJjfwfA5UhqwcLijWJNSlsMTQ== X-Google-Smtp-Source: ABdhPJwMS0K6oCxdHlBm9fgUOW23pCifG3ouH/c8/rfeYPNFtkVcq24RoUabju6o4jccQq/x07ZxvQ== X-Received: by 2002:a02:cf9a:: with SMTP id w26mr3268797jar.25.1610558143520; Wed, 13 Jan 2021 09:15:43 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id h9sm1120579ili.43.2021.01.13.09.15.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 09:15:42 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, bjorn.andersson@linaro.org, cpratapa@codeaurora.org, subashab@codeaurora.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 6/6] net: ipa: retry TX channel stop commands Date: Wed, 13 Jan 2021 11:15:32 -0600 Message-Id: <20210113171532.19248-7-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210113171532.19248-1-elder@linaro.org> References: <20210113171532.19248-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org For RX channels we issue a stop command more than once if necessary to allow it to stop. It turns out that TX channels could also require retries. Retry channel stop commands if necessary regardless of the channel direction. Rename the symbol defining the retry count so it's not RX-specific. Fixes: 650d1603825d8 ("soc: qcom: ipa: the generic software interface") Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 5c163f9c0ea7b..5b29f7d9d6ac1 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -91,7 +91,7 @@ #define GSI_CMD_TIMEOUT 50 /* milliseconds */ -#define GSI_CHANNEL_STOP_RX_RETRIES 10 +#define GSI_CHANNEL_STOP_RETRIES 10 #define GSI_CHANNEL_MODEM_HALT_RETRIES 10 #define GSI_MHI_EVENT_ID_START 10 /* 1st reserved event id */ @@ -889,14 +889,11 @@ int gsi_channel_start(struct gsi *gsi, u32 channel_id) int gsi_channel_stop(struct gsi *gsi, u32 channel_id) { struct gsi_channel *channel = &gsi->channel[channel_id]; - u32 retries; + u32 retries = GSI_CHANNEL_STOP_RETRIES; int ret; gsi_channel_freeze(channel); - /* RX channels might require a little time to enter STOPPED state */ - retries = channel->toward_ipa ? 0 : GSI_CHANNEL_STOP_RX_RETRIES; - mutex_lock(&gsi->mutex); do {