Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp1362260ybb; Fri, 29 Mar 2019 03:03:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqzKghq7xYVCSp0bu8TZ6XXDsnkAV25Fs93WcflK73/sfuTb20zfPxt9GFW6FNOPsIkRzbs1 X-Received: by 2002:a62:415d:: with SMTP id o90mr45798972pfa.236.1553853802666; Fri, 29 Mar 2019 03:03:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553853802; cv=none; d=google.com; s=arc-20160816; b=X67D1EXPOykax3R+05yYNB5JlOK7iVEQeY0G8yQyGsAZJ/SO6aNHqlbYy1x18Cbpip nXb+HUhtWgB62jQ88gZ5oLffHyWyVZa3eaK24vOlQTKYvr4mx4PlRBnDLztceDkBSi7/ SsEwdtRp4/VWF923VBOUtPsMJzxHQdcs8DWLLNLW/FXRoEaEEGLjS+GFVMbhGJoIntpu 4KtkfPehU8TP/LXLG1Ddc+aAE7c8ce7c2WgwoFfAE+U0EqeIVJP2w6mA9ch8UYgxeVBQ So+3rrM4LUTkljPyN5DtXsXUF4rbqwqoThzahoNWBeS3mUWU4G8Jg02qIZ3dDJAuW1/S G2Dw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=+8qp36qToz6I6sVBRJIAS0uiVYgFHpo6+Vxm+x/s0E8=; b=fl4HVxKOIfcYHUCUGPjdi9bPw0cGYAXT0w/tzCpf75AKYiFRtEHBOvW22ImnAukbAk ND2+kleJ21MSYBP12u3jPjNEqQJQHxH4fK+wj2ihsFdGtzg4RgwQlAqvjUhrkBktuqye Q5WCjsBzvfV7lopoOOAMeZr+fx5MqNy3FP85so9oAYuEeK8K3Vq7qorS57M1r8EqpkQP eYqjQ56ZZdh2BZW9p28pGT4eDIrQP/OJBJ6u4G0n0c+SmIFYdvQ6pXp9k56Ut2Ni0Nhg YMspzGd4ElihRuDXp/CrbZ5uHV0j1jM8vyumPwtOj2MR5U5uvQrKnKl4vkX5xiaOSjw7 bbuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b="Ds/Ag/Ey"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s61si1613602plb.305.2019.03.29.03.03.07; Fri, 29 Mar 2019 03:03:22 -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; dkim=pass header.i=@synopsys.com header.s=mail header.b="Ds/Ag/Ey"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728957AbfC2KCZ (ORCPT + 99 others); Fri, 29 Mar 2019 06:02:25 -0400 Received: from smtprelay4.synopsys.com ([198.182.47.9]:57954 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728771AbfC2KCY (ORCPT ); Fri, 29 Mar 2019 06:02:24 -0400 Received: from mailhost.synopsys.com (unknown [10.12.135.161]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtprelay.synopsys.com (Postfix) with ESMTPS id EBC3924E2AAF; Fri, 29 Mar 2019 03:02:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1553853744; bh=n/hAicS4JO3SCAcW1j0Bor5yU57BYXIsWLe4ckI54D8=; h=Subject:To:CC:References:From:Date:In-Reply-To:From; b=Ds/Ag/EycMrbNBJqzOT0DRz9j2T2kOZPdeHxoZ9a3bRiG0Ptp87oyvJ+uuCmKrmFl xJtqV8r6TfX4OfMNGS4EE/2xvRrHblxTenf72Wf9rBRjDYdPytDkNjm0OneP3g5UPF PFb+mI9OxYtX9k6C9Sd14Ls1lFZFrip0TclwD35cWFCaeqwEoyq/d9mcmWi6clYIMt VnAuoDjefYcFT4jPlzuVXc7Pt/Kwn5FyfqZ4mJN0xv8Ji1htBHHQVR8wg2kxtNoGAf BfAF5/wR7ebWJVf4T/e9TeRZRC1KogtVkU0ZYInYeV9Kt9ks1EMxwG1ix+RpL4VYP+ qHhi9k2Bh9Y/g== Received: from us01wehtc1.internal.synopsys.com (us01wehtc1-vip.internal.synopsys.com [10.12.239.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mailhost.synopsys.com (Postfix) with ESMTPS id DB557A0098; Fri, 29 Mar 2019 10:02:22 +0000 (UTC) Received: from DE02WEHTCB.internal.synopsys.com (10.225.19.94) by us01wehtc1.internal.synopsys.com (10.12.239.231) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 29 Mar 2019 03:02:22 -0700 Received: from DE02WEHTCA.internal.synopsys.com (10.225.19.92) by DE02WEHTCB.internal.synopsys.com (10.225.19.94) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 29 Mar 2019 11:02:22 +0100 Received: from [10.107.19.176] (10.107.19.176) by DE02WEHTCA.internal.synopsys.com (10.225.19.80) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 29 Mar 2019 11:02:21 +0100 Subject: Re: [PATCH 1/6] net: stmmac: use correct DMA buffer size in the RX descriptor To: Aaro Koskinen , "David S. Miller" , Jose Abreu , Alexandre Torgue , Giuseppe Cavallaro , CC: , Aaro Koskinen References: <20190327203540.1884-1-aaro.koskinen@iki.fi> <20190327203540.1884-2-aaro.koskinen@iki.fi> From: Jose Abreu Message-ID: <5c480a83-dfcf-c20c-f277-4449a7b41403@synopsys.com> Date: Fri, 29 Mar 2019 10:02:20 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <20190327203540.1884-2-aaro.koskinen@iki.fi> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.107.19.176] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/27/2019 8:35 PM, Aaro Koskinen wrote: > From: Aaro Koskinen > > We always program the maximum DMA buffer size into the receive descriptor, > although the allocated size may be less. E.g. with the default MTU size > we allocate only 1536 bytes. If somebody sends us a bigger frame, then > memory may get corrupted. > > Fix by using exact buffer sizes. > > Signed-off-by: Aaro Koskinen So, I'm seeing that the maximum allowed buffer size that can be put in the descriptor changes between enhanced descriptors to normal descriptors (8KB vs. 2KB right ?). Shouldn't stmmac_main know about this limit before trying to init descriptors ? We do limit the MTU according to HW version but I would rather prefer not having to need to calculate min() values in the descriptor code and just use the value as is ... Thanks, Jose Miguel Abreu