From patchwork Mon Sep 18 19:50:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 9957557 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9296F601E9 for ; Mon, 18 Sep 2017 19:55:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84F2128D6A for ; Mon, 18 Sep 2017 19:55:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 787E028D6E; Mon, 18 Sep 2017 19:55:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0979828D6A for ; Mon, 18 Sep 2017 19:55:50 +0000 (UTC) Received: from localhost ([::1]:38625 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1du28z-00012P-4p for patchwork-qemu-devel@patchwork.kernel.org; Mon, 18 Sep 2017 15:55:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37315) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1du24r-0006lx-L5 for qemu-devel@nongnu.org; Mon, 18 Sep 2017 15:51:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1du24q-0006H7-RM for qemu-devel@nongnu.org; Mon, 18 Sep 2017 15:51:33 -0400 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]:33183) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1du24o-0006FP-Dg; Mon, 18 Sep 2017 15:51:30 -0400 Received: by mail-pg0-x242.google.com with SMTP id i130so781785pgc.0; Mon, 18 Sep 2017 12:51:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Ogk4glSLUUFcMz+YRhCxIE+lk8AJJwGYtZEpni0jNJI=; b=KRDEtcOhKRN9ZJNGtIfM2LVyCUaewoiO/QQ3C+Pu53/O35+1T/INqSqfwYkbYAMeO1 tP+MIqONxPC7575sheeemI1Iquv4zzHmtm7evgvT5UTpbs3sLFGp7CrlpsLLb1eghV2r ycCLqpWMrMmZhI0e2BEzPZ7UhfR2jrGpCruv3y58I9udRSu0P+kHniwg4SA+R+nJRSrG HcSlgD/SJLxhQJWEJtVN6djL7TsYiW0SZhPYGVtjDFefv1JokqRs0bwHBNKjXeEWytzx VIWXmhxERb3xGoAlWSpArND3ENxvU2ebjCyWF9L/kNVNRarW1rTFX0G97trxRMuM8POS qcYA== 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; bh=Ogk4glSLUUFcMz+YRhCxIE+lk8AJJwGYtZEpni0jNJI=; b=Go0aWpg06Bj32ZTvDAm/rK/mjuvtmOpccCZL/5OQXygR/OiZx2IaeSE8ufGSHJXEY4 n0DH0xNffMU9fzLYsk2gR6tHTiHoXgxo4sviBVWVGezZj9l4TT2NetBfnpEXXGBM1tLV +j2FkK+9urE4801jzrPPX7PLI5nPv3aFHsK7h3FE6iioFJngv+F0eONYbUYczaCl+iXV Re+rKZwbuLRZEYWZNmgP/PGNPbTXaC/pzgeoGKM0gGGmCJWHkLmepEGEpht8AXRrU/Rh mBUh7Yu8V2OxBoEtUwHPJFyoXIFIt9AkSPMTbwXzw7RVQNIvUfXIrTdIA0mRGZ2o3KKF j0JA== X-Gm-Message-State: AHPjjUhA+Ax2zs0/MsowsGMVnEZViI5qja17QO1MSb6edPyOmTbGxoLA fk0xyHDH7J5qc5ESgGQ= X-Google-Smtp-Source: AOwi7QBZWZ0wVgj6zmm688V+R954QQuXKWt58Jknd9kSWhTvuixBbt2YShOAik6gtVSB95fi6OM28g== X-Received: by 10.84.150.129 with SMTP id h1mr18981044plh.59.1505764289306; Mon, 18 Sep 2017 12:51:29 -0700 (PDT) Received: from squirtle.westlake.spaceflightindustries.com ([173.226.206.194]) by smtp.gmail.com with ESMTPSA id d186sm200791pfd.117.2017.09.18.12.51.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Sep 2017 12:51:28 -0700 (PDT) From: Andrey Smirnov To: qemu-arm@nongnu.org Date: Mon, 18 Sep 2017 12:50:48 -0700 Message-Id: <20170918195100.17593-6-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170918195100.17593-1-andrew.smirnov@gmail.com> References: <20170918195100.17593-1-andrew.smirnov@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::242 Subject: [Qemu-devel] [PATCH 05/17] imx_fec: Use ENET_FTRL to determine truncation length X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrey Smirnov , Peter Maydell , Jason Wang , qemu-devel@nongnu.org, yurovsky@gmail.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Frame truncation length, TRUNC_FL, is determined by the contents of ENET_FTRL register, so convert the code to use it instead of a hardcoded constant. Cc: Peter Maydell Cc: Jason Wang Cc: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Cc: yurovsky@gmail.com Signed-off-by: Andrey Smirnov --- hw/net/imx_fec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c index 767402909d..989c11be5f 100644 --- a/hw/net/imx_fec.c +++ b/hw/net/imx_fec.c @@ -1050,8 +1050,8 @@ static ssize_t imx_enet_receive(NetClientState *nc, const uint8_t *buf, size += 4; /* Huge frames are truncted. */ - if (size > ENET_MAX_FRAME_SIZE) { - size = ENET_MAX_FRAME_SIZE; + if (size > s->regs[ENET_FTRL]) { + size = s->regs[ENET_FTRL]; flags |= ENET_BD_TR | ENET_BD_LG; }