From mboxrd@z Thu Jan 1 00:00:00 1970 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 E3C97C433EF for ; Tue, 17 May 2022 07:14:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233375AbiEQHOF (ORCPT ); Tue, 17 May 2022 03:14:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229714AbiEQHN7 (ORCPT ); Tue, 17 May 2022 03:13:59 -0400 Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::221]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7B5847AE8; Tue, 17 May 2022 00:13:57 -0700 (PDT) Received: (Authenticated sender: maxime.chevallier@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 544C824000B; Tue, 17 May 2022 07:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1652771636; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xitUkq6bcM9fi9wtca3gUKwmXKGzceoo2Uwj87umL3M=; b=ic2ayfE8pirXVkiRfeQEXjc+pUm9p2S9hs0tZCRPD5ogHX2kOc8JwJxpjPIwKp25ltQHqy LHAk2iEYeip1QrIugBL8BX+aO9GLEwRy1EA7KceqO54A7EUW5l5MqA99VKAxmNpouR7DQ/ zKST4YHmoe9TLU326QQJF2x3OYU6tbExyk7DRB97tj61GiKHhBqT8jXxt091g9EgyuRJuN Hcn0bkMSKPHSPOKzPDiqBmiBydhnGEzGPl0BvOlt+qf5MRrmkr6zOGney2Cr3td79Wi2ax iSVCaq1ucJrg0I+xduBEtu7GL9+rNsFXc9NKwxn5J4pG/HAvyRZaIu0CrG3wrw== Date: Tue, 17 May 2022 09:13:52 +0200 From: Maxime Chevallier To: Andrew Lunn Cc: davem@davemloft.net, Rob Herring , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, thomas.petazzoni@bootlin.com, Florian Fainelli , Heiner Kallweit , Russell King , linux-arm-kernel@lists.infradead.org, Vladimir Oltean , Luka Perkov , Robert Marko Subject: Re: [PATCH net-next v2 1/5] net: ipqess: introduce the Qualcomm IPQESS driver Message-ID: <20220517091352.13795c8e@pc-20.home> In-Reply-To: References: <20220514150656.122108-1-maxime.chevallier@bootlin.com> <20220514150656.122108-2-maxime.chevallier@bootlin.com> Organization: Bootlin X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andrew, On Mon, 16 May 2022 04:51:03 +0200 Andrew Lunn wrote: > > +static int ipqess_tx_ring_alloc(struct ipqess *ess) > > +{ > > + struct device *dev = &ess->pdev->dev; > > + int i; > > + > > + for (i = 0; i < IPQESS_NETDEV_QUEUES; i++) { > > + struct ipqess_tx_ring *tx_ring = &ess->tx_ring[i]; > > + size_t size; > > + u32 idx; > > + > > + tx_ring->ess = ess; > > + tx_ring->ring_id = i; > > + tx_ring->idx = i * 4; > > + tx_ring->count = IPQESS_TX_RING_SIZE; > > + tx_ring->nq = netdev_get_tx_queue(ess->netdev, i); > > + > > + size = sizeof(struct ipqess_buf) * > > IPQESS_TX_RING_SIZE; > > + tx_ring->buf = devm_kzalloc(dev, size, GFP_KERNEL); > > + if (!tx_ring->buf) { > > + netdev_err(ess->netdev, "buffer alloc of > > tx ring failed"); > > + return -ENOMEM; > > + } > > kzalloc() is pretty loud when there is no memory. So you see patches > removing such warning messages. Ack, I'll remove that > > +static int ipqess_rx_napi(struct napi_struct *napi, int budget) > > +{ > > + struct ipqess_rx_ring *rx_ring = container_of(napi, struct > > ipqess_rx_ring, > > + napi_rx); > > + struct ipqess *ess = rx_ring->ess; > > + u32 rx_mask = BIT(rx_ring->idx); > > + int remain_budget = budget; > > + int rx_done; > > + u32 status; > > + > > +poll_again: > > + ipqess_w32(ess, IPQESS_REG_RX_ISR, rx_mask); > > + rx_done = ipqess_rx_poll(rx_ring, remain_budget); > > + > > + if (rx_done == remain_budget) > > + return budget; > > + > > + status = ipqess_r32(ess, IPQESS_REG_RX_ISR); > > + if (status & rx_mask) { > > + remain_budget -= rx_done; > > + goto poll_again; > > + } > > Could this be turned into a do while() loop? Yes indeed, I'll fix this for v3 > > +static void ipqess_irq_enable(struct ipqess *ess) > > +{ > > + int i; > > + > > + ipqess_w32(ess, IPQESS_REG_RX_ISR, 0xff); > > + ipqess_w32(ess, IPQESS_REG_TX_ISR, 0xffff); > > + for (i = 0; i < IPQESS_NETDEV_QUEUES; i++) { > > + ipqess_w32(ess, > > IPQESS_REG_RX_INT_MASK_Q(ess->rx_ring[i].idx), 1); > > + ipqess_w32(ess, > > IPQESS_REG_TX_INT_MASK_Q(ess->tx_ring[i].idx), 1); > > + } > > +} > > + > > +static void ipqess_irq_disable(struct ipqess *ess) > > +{ > > + int i; > > + > > + for (i = 0; i < IPQESS_NETDEV_QUEUES; i++) { > > + ipqess_w32(ess, > > IPQESS_REG_RX_INT_MASK_Q(ess->rx_ring[i].idx), 0); > > + ipqess_w32(ess, > > IPQESS_REG_TX_INT_MASK_Q(ess->tx_ring[i].idx), 0); > > + } > > +} > > Enable and disable are not symmetric? Ah nice catch too, I'll dig into this, either to make it symmetric or to explain with a comment why it isn't > > > +static inline void ipqess_kick_tx(struct ipqess_tx_ring *tx_ring) > > No inline functions please in .c files. Let the compiler decide. Ack, I'll address that. > Andrew Thanks again for the review Maxime From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 47B1FC433F5 for ; Tue, 17 May 2022 07:15:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=J8O6MQK/lf4qL4jN5b1v2ZQPTME/iV+OV8R6mExm/uE=; b=3ybejqk2qtoW9a z/TAcI4EmHCtcgUnjYN5f3pEVGTWgsGs2lemEZN6pr3lJplc08jfOlh006LJL40Awc8ZU3dzAuCXB rtEwp+V6VRhkvw11BvsSv2aOJ/enLymmp39ekUrTOT7Je4mwTMx3sdt1ptZGbx5A7pNRSvgCkBAaA +N1S7ShzM0Lo4hOR9ug80OSqx1HnsLcecDMg7yFFJBGlS5MOKAYR/7BGmhIpLNu9W6KYmuV1740Kn 1kHjVHldSgrFqivPOJXReeD75cJXmn7rtCZzlcT2/oRQTHLLpXl3TMH7RrGMhlC80Hx1U8D+IltKP 7gtt10V7wOAjGGT2XiCA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nqrPE-00C3NE-F0; Tue, 17 May 2022 07:14:09 +0000 Received: from relay1-d.mail.gandi.net ([217.70.183.193]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nqrP7-00C3Ii-0K for linux-arm-kernel@lists.infradead.org; Tue, 17 May 2022 07:14:03 +0000 Received: (Authenticated sender: maxime.chevallier@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 544C824000B; Tue, 17 May 2022 07:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1652771636; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xitUkq6bcM9fi9wtca3gUKwmXKGzceoo2Uwj87umL3M=; b=ic2ayfE8pirXVkiRfeQEXjc+pUm9p2S9hs0tZCRPD5ogHX2kOc8JwJxpjPIwKp25ltQHqy LHAk2iEYeip1QrIugBL8BX+aO9GLEwRy1EA7KceqO54A7EUW5l5MqA99VKAxmNpouR7DQ/ zKST4YHmoe9TLU326QQJF2x3OYU6tbExyk7DRB97tj61GiKHhBqT8jXxt091g9EgyuRJuN Hcn0bkMSKPHSPOKzPDiqBmiBydhnGEzGPl0BvOlt+qf5MRrmkr6zOGney2Cr3td79Wi2ax iSVCaq1ucJrg0I+xduBEtu7GL9+rNsFXc9NKwxn5J4pG/HAvyRZaIu0CrG3wrw== Date: Tue, 17 May 2022 09:13:52 +0200 From: Maxime Chevallier To: Andrew Lunn Cc: davem@davemloft.net, Rob Herring , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, thomas.petazzoni@bootlin.com, Florian Fainelli , Heiner Kallweit , Russell King , linux-arm-kernel@lists.infradead.org, Vladimir Oltean , Luka Perkov , Robert Marko Subject: Re: [PATCH net-next v2 1/5] net: ipqess: introduce the Qualcomm IPQESS driver Message-ID: <20220517091352.13795c8e@pc-20.home> In-Reply-To: References: <20220514150656.122108-1-maxime.chevallier@bootlin.com> <20220514150656.122108-2-maxime.chevallier@bootlin.com> Organization: Bootlin X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-redhat-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220517_001401_363993_529DFA87 X-CRM114-Status: GOOD ( 18.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Andrew, On Mon, 16 May 2022 04:51:03 +0200 Andrew Lunn wrote: > > +static int ipqess_tx_ring_alloc(struct ipqess *ess) > > +{ > > + struct device *dev = &ess->pdev->dev; > > + int i; > > + > > + for (i = 0; i < IPQESS_NETDEV_QUEUES; i++) { > > + struct ipqess_tx_ring *tx_ring = &ess->tx_ring[i]; > > + size_t size; > > + u32 idx; > > + > > + tx_ring->ess = ess; > > + tx_ring->ring_id = i; > > + tx_ring->idx = i * 4; > > + tx_ring->count = IPQESS_TX_RING_SIZE; > > + tx_ring->nq = netdev_get_tx_queue(ess->netdev, i); > > + > > + size = sizeof(struct ipqess_buf) * > > IPQESS_TX_RING_SIZE; > > + tx_ring->buf = devm_kzalloc(dev, size, GFP_KERNEL); > > + if (!tx_ring->buf) { > > + netdev_err(ess->netdev, "buffer alloc of > > tx ring failed"); > > + return -ENOMEM; > > + } > > kzalloc() is pretty loud when there is no memory. So you see patches > removing such warning messages. Ack, I'll remove that > > +static int ipqess_rx_napi(struct napi_struct *napi, int budget) > > +{ > > + struct ipqess_rx_ring *rx_ring = container_of(napi, struct > > ipqess_rx_ring, > > + napi_rx); > > + struct ipqess *ess = rx_ring->ess; > > + u32 rx_mask = BIT(rx_ring->idx); > > + int remain_budget = budget; > > + int rx_done; > > + u32 status; > > + > > +poll_again: > > + ipqess_w32(ess, IPQESS_REG_RX_ISR, rx_mask); > > + rx_done = ipqess_rx_poll(rx_ring, remain_budget); > > + > > + if (rx_done == remain_budget) > > + return budget; > > + > > + status = ipqess_r32(ess, IPQESS_REG_RX_ISR); > > + if (status & rx_mask) { > > + remain_budget -= rx_done; > > + goto poll_again; > > + } > > Could this be turned into a do while() loop? Yes indeed, I'll fix this for v3 > > +static void ipqess_irq_enable(struct ipqess *ess) > > +{ > > + int i; > > + > > + ipqess_w32(ess, IPQESS_REG_RX_ISR, 0xff); > > + ipqess_w32(ess, IPQESS_REG_TX_ISR, 0xffff); > > + for (i = 0; i < IPQESS_NETDEV_QUEUES; i++) { > > + ipqess_w32(ess, > > IPQESS_REG_RX_INT_MASK_Q(ess->rx_ring[i].idx), 1); > > + ipqess_w32(ess, > > IPQESS_REG_TX_INT_MASK_Q(ess->tx_ring[i].idx), 1); > > + } > > +} > > + > > +static void ipqess_irq_disable(struct ipqess *ess) > > +{ > > + int i; > > + > > + for (i = 0; i < IPQESS_NETDEV_QUEUES; i++) { > > + ipqess_w32(ess, > > IPQESS_REG_RX_INT_MASK_Q(ess->rx_ring[i].idx), 0); > > + ipqess_w32(ess, > > IPQESS_REG_TX_INT_MASK_Q(ess->tx_ring[i].idx), 0); > > + } > > +} > > Enable and disable are not symmetric? Ah nice catch too, I'll dig into this, either to make it symmetric or to explain with a comment why it isn't > > > +static inline void ipqess_kick_tx(struct ipqess_tx_ring *tx_ring) > > No inline functions please in .c files. Let the compiler decide. Ack, I'll address that. > Andrew Thanks again for the review Maxime _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel