From patchwork Wed Mar 10 10:11:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1450442 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=AlSSY7Hl; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DwT743cFqz9sSC for ; Wed, 10 Mar 2021 21:37:52 +1100 (AEDT) Received: from localhost ([::1]:52082 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lJwDu-0002Us-H0 for incoming@patchwork.ozlabs.org; Wed, 10 Mar 2021 05:37:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33646) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lJvpG-0000un-Lb for qemu-devel@nongnu.org; Wed, 10 Mar 2021 05:12:23 -0500 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]:39063) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lJvpE-0006qp-77 for qemu-devel@nongnu.org; Wed, 10 Mar 2021 05:12:22 -0500 Received: by mail-ej1-x62f.google.com with SMTP id p7so26139161eju.6 for ; Wed, 10 Mar 2021 02:12:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=+ErR6Z+Y2Il/k73obafgKyiBO/JmeOnY663d8gWjCYE=; b=AlSSY7HlJeJfVLKshOQ1NY9d92pE882xv2ApzNwSnETFI6z1YzQkLlV4AKLDlZ9cpE xQhxQ7OMG+XDQrb06yBiv9UMlszUO1zNNuadh13VtWgO+b+w1JmBkkzp7AUwIvG/GdXP sm/tnPTP9jAEE9D/9T0nHiTwr5+5YrE5U9n33NVib25OFupM0OcgMIe+Tzi5i2f29m77 HMXU/qEFeplFznszwxjySybTcM9D7CwKXI8syAWdkpaMUhg7jI6E8w8mjGTDiD3/pUY4 7ryEiy+hFMQtp3u6g36awtEuXMBQtLQtgZbJOx0i6FxU9A/AzIKm1wqMt0D5omWRn9BZ YESg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=+ErR6Z+Y2Il/k73obafgKyiBO/JmeOnY663d8gWjCYE=; b=iMQjVQhG2zla5rQtpQV6NlAPk2YrtpFdblFjxJxkC43agWwwF4e2t4I5gD9T+4nwCb ZUTxHg3uRmzJ+zsMsUBdadLE7Oeg3KDgrgXmgdwJoINNR2ru641HTU1yJCI6Lmeym6fd ZTThv0oUPKDnWAN70LFU6wFyZA+3SApApQc7qJ6OU1O5gcLccVdyNeK6lxPDCnHfk16z K1jo4dYij9wQbRm3wgCUIFsnJjkgd1DhB8M1/LegTEBBaymqm0FE9TFx44+LnAH4LDZ8 t/y1mqsrVfc3nLpCpf3NYtF2EAPpNEK3nt1DLyBUChXMGYevJgqqngsnehHXi+Mwx5SP hsWA== X-Gm-Message-State: AOAM531j2eQzr4jWkwyzquiNDC9mWDkhyiNbRjnd/qLqmessgKIPYQzS /2KmaeMJNBGOdafWpwI/rSM= X-Google-Smtp-Source: ABdhPJz39INgveqXVjVQ6v1teFFb8sZgJo8hPHdkHBuWQon9PPQsVRsxB5uMbge854tT5Ml3SGDisw== X-Received: by 2002:a17:906:b2cd:: with SMTP id cf13mr2825782ejb.181.1615371138865; Wed, 10 Mar 2021 02:12:18 -0800 (PST) Received: from pek-vx-bsp9.wrs.com (ec2-44-242-66-180.us-west-2.compute.amazonaws.com. [44.242.66.180]) by smtp.gmail.com with ESMTPSA id n26sm5966864eds.22.2021.03.10.02.12.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Mar 2021 02:12:18 -0800 (PST) From: Bin Meng To: Jason Wang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell , qemu-devel@nongnu.org Subject: [PATCH 03/10] hw/net: e1000: Remove the logic of padding short frames in the receive path Date: Wed, 10 Mar 2021 18:11:50 +0800 Message-Id: <20210310101157.15136-4-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210310101157.15136-1-bmeng.cn@gmail.com> References: <20210310101157.15136-1-bmeng.cn@gmail.com> Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=bmeng.cn@gmail.com; helo=mail-ej1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Now that we have implemented unified short frames padding in the QEMU networking codes, remove the same logic in the NIC codes. This actually reverts commit 78aeb23eded2d0b765bf9145c71f80025b568acd. Signed-off-by: Bin Meng --- hw/net/e1000.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/hw/net/e1000.c b/hw/net/e1000.c index d8da2f6528..a53ba9052b 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -882,7 +882,6 @@ e1000_receive_iov(NetClientState *nc, const struct iovec *iov, int iovcnt) uint16_t vlan_special = 0; uint8_t vlan_status = 0; uint8_t min_buf[MIN_BUF_SIZE]; - struct iovec min_iov; uint8_t *filter_buf = iov->iov_base; size_t size = iov_size(iov, iovcnt); size_t iov_ofs = 0; @@ -898,15 +897,7 @@ e1000_receive_iov(NetClientState *nc, const struct iovec *iov, int iovcnt) return 0; } - /* Pad to minimum Ethernet frame length */ - if (size < sizeof(min_buf)) { - iov_to_buf(iov, iovcnt, 0, min_buf, size); - memset(&min_buf[size], 0, sizeof(min_buf) - size); - min_iov.iov_base = filter_buf = min_buf; - min_iov.iov_len = size = sizeof(min_buf); - iovcnt = 1; - iov = &min_iov; - } else if (iov->iov_len < MAXIMUM_ETHERNET_HDR_LEN) { + if (iov->iov_len < MAXIMUM_ETHERNET_HDR_LEN) { /* This is very unlikely, but may happen. */ iov_to_buf(iov, iovcnt, 0, min_buf, MAXIMUM_ETHERNET_HDR_LEN); filter_buf = min_buf;