Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2915198ybl; Thu, 29 Aug 2019 15:02:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/W+2IVMNpoDiQbD2bc/BkMa/EzVDKQzgCZbTBPX4Anpu98OX4ir/eVDSSOrCvMXv/LTfN X-Received: by 2002:a17:902:1101:: with SMTP id d1mr12071806pla.208.1567116130873; Thu, 29 Aug 2019 15:02:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567116130; cv=none; d=google.com; s=arc-20160816; b=GwnHHRWtlkD1NhqfJY9mrMRBw1maCgfKnSOICJvfwtGcwKpxxc0yIvN/ff5CNuFqOr KALigezafoBf9wkmL3iyISkSshyODcYixxA+EWQH7vJVFFFO/mxfTdNticlhPZfeoyOX moPaB4vODTBBkVruxgYk52UO1dvJQIDzJR25ikPA1AEftQK6g/QXVQzmqbsTnveQGTr2 9LBjDgwzT29Bw4jULb/okvNp0EsqdEVxCnOMnpVkfHRBzCpqZ7J8BOl0zUZEWwo1mBfN P9bHTaWMGmG9iigSI3R1sUbpmpOZ0BupUOKL+uFYAfaKqqKD5Nukm8GxCGCcjMnC6AUN 17Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=eTVmUL8Hj/Z+wUeQJ7vA74CDDz0wcMQfnViTU6vCdQg=; b=A9zhbLuAwzwjdaxXjZp9XnhrbsQ5K9XQRRf6oeBW9VN6bBzght6T/4IHTcgyN3XG2w ifxw7s9phC1Dlrlp1IvgdVwZRhaQPBPJI2gJXhmCuaYDvElAGsS1SBXlYxwjkvPmMQuQ 6JvvM2Kbw2O7fGBVoRv4BBXLrSBv+xdzKHOkw1A0gGzRBaKLYxgxSojEKvnAYZCmcO46 6uDQywMMAWQcuGZXaJaXXlx4Vdtjm+HxrkuGnPvqhEIfBvwNSkLvETPxvjAoycD8KIXU aeBagEX5XveR8pUklW2DTukqMAk+Sbxn9Qni6/JEgy5RCZP0L4Unh7lwmwJkuYd461w3 pLpA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k3si3076520pgs.223.2019.08.29.15.01.54; Thu, 29 Aug 2019 15:02:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728161AbfH2WBB convert rfc822-to-8bit (ORCPT + 99 others); Thu, 29 Aug 2019 18:01:01 -0400 Received: from mx2.suse.de ([195.135.220.15]:50518 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727969AbfH2WBA (ORCPT ); Thu, 29 Aug 2019 18:01:00 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 6404BAEFB; Thu, 29 Aug 2019 22:00:59 +0000 (UTC) Date: Fri, 30 Aug 2019 00:00:58 +0200 From: Thomas Bogendoerfer To: Jakub Kicinski Cc: Ralf Baechle , Paul Burton , James Hogan , "David S. Miller" , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH v2 net-next 05/15] net: sgi: ioc3-eth: allocate space for desc rings only once Message-Id: <20190830000058.882feb357058437cddc71315@suse.de> In-Reply-To: <20190829140537.68abfc9f@cakuba.netronome.com> References: <20190829155014.9229-1-tbogendoerfer@suse.de> <20190829155014.9229-6-tbogendoerfer@suse.de> <20190829140537.68abfc9f@cakuba.netronome.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-suse-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 29 Aug 2019 14:05:37 -0700 Jakub Kicinski wrote: > On Thu, 29 Aug 2019 17:50:03 +0200, Thomas Bogendoerfer wrote: > > + if (skb) > > + dev_kfree_skb_any(skb); > > I think dev_kfree_skb_any() accepts NULL yes, I'll drop the if > > + > > + /* Allocate and rx ring. 4kb = 512 entries */ > > + ip->rxr = (unsigned long *)get_zeroed_page(GFP_ATOMIC); > > + if (!ip->rxr) { > > + pr_err("ioc3-eth: rx ring allocation failed\n"); > > + err = -ENOMEM; > > + goto out_stop; > > + } > > + > > + /* Allocate tx rings. 16kb = 128 bufs. */ > > + ip->txr = (struct ioc3_etxd *)__get_free_pages(GFP_KERNEL, 2); > > + if (!ip->txr) { > > + pr_err("ioc3-eth: tx ring allocation failed\n"); > > + err = -ENOMEM; > > + goto out_stop; > > + } > > Please just use kcalloc()/kmalloc_array() here, both allocation will be replaced in patch 11 with dma_direct_alloc_pages. So I hope I don't need to change it here. Out of curiosity does kcalloc/kmalloc_array give me the same guarantees about alignment ? rx ring needs to be 4KB aligned, tx ring 16KB aligned. >, and make sure the flags > are set to GFP_KERNEL whenever possible. Here and in ioc3_alloc_rings() > it looks like GFP_ATOMIC is unnecessary. yes, I'll change it Thomas. -- SUSE Software Solutions Germany GmbH HRB 247165 (AG M?nchen) Gesch?ftsf?hrer: Felix Imend?rffer