Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4156186iob; Tue, 17 May 2022 15:33:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySsoxayvVq7+IJMuINhSjaiN1PHRgG5kn5Pj4/pFE22G9gaVMizbYqAwrsAiq350ZCb75Y X-Received: by 2002:a17:902:c951:b0:15e:abf8:d025 with SMTP id i17-20020a170902c95100b0015eabf8d025mr23866577pla.10.1652826788770; Tue, 17 May 2022 15:33:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652826788; cv=none; d=google.com; s=arc-20160816; b=h4FsMhbP7cEby0/sNfqsBit7DLJHk3MW3V8K15+o4Lb4UGllLjJCpbT9pQR00/q427 Z08mlyrEiVxoV2N1kEmCtZMuQxQsH9s75fnWyXGN2m56f4l8RqLLK2FsBbuK38tuByWo /q2ItnEgjVKcqF86h1PRxr605lyJfjzvcAp9hnp+ZRqF7QGSYZfFUF/sq2HBIuekckaQ oV30Egq/W9hYB6H2bEdG99lpyY074O2bLp7qDrbw7E5XxBo/HiAShQQT9UF8kppDEDSm yBJ8Jb3S8pnpX8dGq9BnWb4Y5slRbET+x8W+x2cP8C4RYA91gtLYPk76zMKGdY1NREbQ +OgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=xitUkq6bcM9fi9wtca3gUKwmXKGzceoo2Uwj87umL3M=; b=ZS+bu+aQF18mdqynLZnu7z8w2XRwlnHUjWS2tKeQPGWqJ1U9VlmNIS2tgvBk2MMfEE k9EvfLPf5RCxlAKgoMSF/AWzHD1xzntShGSUb9HaxOQCcYh44vpe2PP9unkQl4BLAYkj rhe4oR5+i9sC2IzaE7lwbKl6T7U3dvfu04aixaOtes752PLdIHzsqtSLOeLQCKMOgqDD wlGBkiofSUqLCW5AvnBwrWB3rkVs+vrve3NaMXj0aIQWyp63aaKE+96n7h+wOzP+VxeZ 5XPBEQcxdyFibNjbSybyXV0isNy82j/bcOsm+odyry1pLGl2dFHsuXL+buULsNduJxB5 Ofsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=ic2ayfE8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c6-20020a17090a4d0600b001dc3f088349si3973987pjg.139.2022.05.17.15.32.56; Tue, 17 May 2022 15:33:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=ic2ayfE8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233806AbiEQHOE (ORCPT + 99 others); Tue, 17 May 2022 03:14:04 -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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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