From patchwork Wed Mar 3 19:11:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12114113 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07E1FC433DB for ; Wed, 3 Mar 2021 19:14:32 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 5369F64E90 for ; Wed, 3 Mar 2021 19:14:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5369F64E90 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:34508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHWx4-0001XW-BK for qemu-devel@archiver.kernel.org; Wed, 03 Mar 2021 14:14:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39626) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHWv2-0008Gj-HH for qemu-devel@nongnu.org; Wed, 03 Mar 2021 14:12:26 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:40345) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lHWuw-0006lp-0j for qemu-devel@nongnu.org; Wed, 03 Mar 2021 14:12:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614798735; 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=MCpf1H4OXD9yrNlExURtQRGgfyEZrfNaghb6RD0f6bw=; b=DmGUCLgVxY4aCBNyFdfI8yuJV+SoUK8+2qOiQkkKppHTiQ9uFGgneiOXIy4Z1ldawTX01o Ic0WPsg0EECH8FSJ3krKL9eKyeEMuNjghAUgVfnOe8hkKJ00Gotwx6/bgooVmmd4onW+7X kOYELwyLxc/JrjIXqA3n3eTQmQonzC8= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-499-ewiXDgk5OeW4RJpC9VTfMQ-1; Wed, 03 Mar 2021 14:12:14 -0500 X-MC-Unique: ewiXDgk5OeW4RJpC9VTfMQ-1 Received: by mail-wr1-f69.google.com with SMTP id m9so7487587wrx.6 for ; Wed, 03 Mar 2021 11:12:13 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=MCpf1H4OXD9yrNlExURtQRGgfyEZrfNaghb6RD0f6bw=; b=L8V9hanlBbtNMweZ2W5K1MgmsieyvkmvHpFOMFRrHuFjmtWey1bgW7yHT5ZGV+Ge1x Ro9I7hyEiOwI4XBh8okytmiHlTsmgj6AcNIMKCAbP4tWnEg61FGwRNfGrEMO82yj5zGw ZiS0kWJ+23zue3b9P8gfyT38B15ct0lcTYng61cnBcpfPcAT2w6FJPG7YtKsal/7igXy IArrfnG1b/8zba5savwhPxk8I8TVf2oHK8m70wZk6Ah89+lxRl8E/+LvOqSg1/t+WBx8 Gv/eL+/tR/FmrHu829PBOFn0i/SzGzaovA+80VnrHJRjYAXqATXSUCQirFMpF88S3fi5 GwvA== X-Gm-Message-State: AOAM531MZmXtl3mFZN+UzpALwBaLkUzIsgPG7ze+VlL9HxRou7VTOZoi yXnyvNW9ulbhn/PnCpwUuu5q+LKR4uDXUpb2rMDdJT2fcpdy5+b20QuNPupcvi/3X//8yocp/Sz Hlh9GIymjiRW2SE6ZXLfIW+t1w+xiaW7Ig8bYr5RzH8+7VTOhWk+KgYPq+3usEGnw X-Received: by 2002:adf:8341:: with SMTP id 59mr213910wrd.130.1614798732693; Wed, 03 Mar 2021 11:12:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJzdOBrnV985ExD4APTwSwarDv2aq51sOhfto7G+StqDdiOrCyv1U376c2/iT2arhc9NF13VKA== X-Received: by 2002:adf:8341:: with SMTP id 59mr213883wrd.130.1614798732550; Wed, 03 Mar 2021 11:12:12 -0800 (PST) Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id h20sm6859508wmb.1.2021.03.03.11.12.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 11:12:12 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH v3 01/10] net: Use 'struct iovec' in qemu_send_packet_async_with_flags() Date: Wed, 3 Mar 2021 20:11:56 +0100 Message-Id: <20210303191205.1656980-2-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210303191205.1656980-1-philmd@redhat.com> References: <20210303191205.1656980-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Dmitry Fleytman , Jason Wang , Bin Meng , Richard Henderson , Bin Meng , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Directly use iovec structure in qemu_send_packet_async_with_flags() by inlining filter_receive() and using qemu_net_queue_send_iov() instead of qemu_net_queue_send(). Signed-off-by: Philippe Mathieu-Daudé --- net/net.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/net/net.c b/net/net.c index fb7b7dcc252..159e4d0ec25 100644 --- a/net/net.c +++ b/net/net.c @@ -581,22 +581,6 @@ static ssize_t filter_receive_iov(NetClientState *nc, return ret; } -static ssize_t filter_receive(NetClientState *nc, - NetFilterDirection direction, - NetClientState *sender, - unsigned flags, - const uint8_t *data, - size_t size, - NetPacketSent *sent_cb) -{ - struct iovec iov = { - .iov_base = (void *)data, - .iov_len = size - }; - - return filter_receive_iov(nc, direction, sender, flags, &iov, 1, sent_cb); -} - void qemu_purge_queued_packets(NetClientState *nc) { if (!nc->peer) { @@ -638,6 +622,13 @@ static ssize_t qemu_send_packet_async_with_flags(NetClientState *sender, { NetQueue *queue; int ret; + int iovcnt = 1; + struct iovec iov[] = { + [0] = { + .iov_base = (void *)buf, + .iov_len = size, + }, + }; #ifdef DEBUG_NET printf("qemu_send_packet_async:\n"); @@ -649,21 +640,21 @@ static ssize_t qemu_send_packet_async_with_flags(NetClientState *sender, } /* Let filters handle the packet first */ - ret = filter_receive(sender, NET_FILTER_DIRECTION_TX, - sender, flags, buf, size, sent_cb); + ret = filter_receive_iov(sender, NET_FILTER_DIRECTION_TX, + sender, flags, iov, iovcnt, sent_cb); if (ret) { return ret; } - ret = filter_receive(sender->peer, NET_FILTER_DIRECTION_RX, - sender, flags, buf, size, sent_cb); + ret = filter_receive_iov(sender->peer, NET_FILTER_DIRECTION_RX, + sender, flags, iov, iovcnt, sent_cb); if (ret) { return ret; } queue = sender->peer->incoming_queue; - return qemu_net_queue_send(queue, sender, flags, buf, size, sent_cb); + return qemu_net_queue_send_iov(queue, sender, flags, iov, iovcnt, sent_cb); } ssize_t qemu_send_packet_async(NetClientState *sender, From patchwork Wed Mar 3 19:11:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12114123 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 632BFC433DB for ; Wed, 3 Mar 2021 19:18:44 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id DBEA164EEC for ; Wed, 3 Mar 2021 19:18:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DBEA164EEC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:43158 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHX18-0005RZ-OV for qemu-devel@archiver.kernel.org; Wed, 03 Mar 2021 14:18:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39698) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHWv5-0008HQ-0w for qemu-devel@nongnu.org; Wed, 03 Mar 2021 14:12:27 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:43296) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lHWv0-0006o6-8J for qemu-devel@nongnu.org; Wed, 03 Mar 2021 14:12:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614798740; 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=oFEYxjFynxuNvujTQ+INd8vvNYEulGGn3mpP0DXpTGE=; b=Bx5swj7zanq2FsG8AQ6F3FfU+NtSNk60qH3vMY26HoZTuhftw+RWVcSqJo2qbj6YG3h5cj Cb86Dq7QV2YhgbO32CAMYMTVwh+Iw4+5f2SAprgmyoTGG/9ll+dAsfkL7TLUw7Bs+elYRL w7GKSsQHV5SiGGQmXYT7M5EBGk37hD0= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-320-He0wCmrOPmOiBntIicQY-g-1; Wed, 03 Mar 2021 14:12:19 -0500 X-MC-Unique: He0wCmrOPmOiBntIicQY-g-1 Received: by mail-wr1-f72.google.com with SMTP id z6so4500326wrh.11 for ; Wed, 03 Mar 2021 11:12:19 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=oFEYxjFynxuNvujTQ+INd8vvNYEulGGn3mpP0DXpTGE=; b=hrLuZzrcl0fM40HRFMj5NjFP+BTpZGzClyeVdTQwzKyx9XI1NJ4x2MLPFQ5s2l4qIA O+185X14INJJ0CTfzzAC7/DlnRICtqVdCOqRyGqFongh5nVu+DG/OTxFgCSX+C+mQvxk 3lYMhseY/+NLIcAjkR1mcPIPjxcXoTowtKWKTj339NcxCEvlLCEv2cv73zKfC5MmdPpT bGv3N2Vf9MvPnWtJTrRfwSjxEq7+R2vGq96Grgj0OKgx5Cbkmkbi9302SFfpGCoIlMTf aLfAEyfjaPC5ip3o0gUdI5aj/qg33OOykeew5wLx5EjjmC/JDY6rMu+jHK+me0SuYn0x 9ENA== X-Gm-Message-State: AOAM532mu2A1X8CzIY7mIkHqt69lMkpvGA3twEBN/LKstRhRPFpw/bxv AFsP6f5ww+3HL/fh4UoRJ+u68jhWgYRi36XkDM/pTEPaei0t5N3OX4ESTEYNoY0V+jSIlVaUlGz 3Opd2reLFEaTIk9MiPQEIoRPZzBidNanrd66DUg3tRxsRVHp6w13ImRP3ARuMm85t X-Received: by 2002:a5d:408a:: with SMTP id o10mr204256wrp.294.1614798737727; Wed, 03 Mar 2021 11:12:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJyh5lDMIz1tJsqk3Q1ZBm72v/BtZudfFjdMLMfKvir4Yb/x/8IWZQ9bsRNdQSXybTHsGavSTw== X-Received: by 2002:a5d:408a:: with SMTP id o10mr204235wrp.294.1614798737520; Wed, 03 Mar 2021 11:12:17 -0800 (PST) Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id m6sm32937966wrv.73.2021.03.03.11.12.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 11:12:17 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH v3 02/10] net: Pad short frames to minimum size before send from SLiRP/TAP Date: Wed, 3 Mar 2021 20:11:57 +0100 Message-Id: <20210303191205.1656980-3-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210303191205.1656980-1-philmd@redhat.com> References: <20210303191205.1656980-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Dmitry Fleytman , Jason Wang , Bin Meng , Richard Henderson , Bin Meng , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng The minimum Ethernet frame length is 60 bytes. For short frames with smaller length like ARP packets (only 42 bytes), on a real world NIC it can choose either padding its length to the minimum required 60 bytes, or sending it out directly to the wire. Such behavior can be hardcoded or controled by a register bit. Similarly on the receive path, NICs can choose either dropping such short frames directly or handing them over to software to handle. On the other hand, for the network backends SLiRP/TAP, they don't expose a way to control the short frame behavior. As of today they just send/receive data from/to the other end connected to them, which means any sized packet is acceptable. So they can send and receive short frames without any problem. It is observed that ARP packets sent from SLiRP/TAP are 42 bytes, and SLiRP/TAP just send these ARP packets to the other end which might be a NIC model that does not allow short frames to pass through. To provide better compatibility, for packets sent from SLiRP/TAP, we change to pad short frames before sending it out to the other end. This ensures SLiRP/TAP as an Ethernet sender do not violate the spec. But with this change, the behavior of dropping short frames in the NIC model cannot be emulated because it always receives a packet that is spec complaint. The capability of sending short frames from NIC models are still supported and short frames can still pass through SLiRP/TAP interfaces. This commit should be able to fix the issue as reported with some NIC models before, that ARP requests get dropped, preventing the guest from becoming visible on the network. It was workarounded in these NIC models on the receive path, that when a short frame is received, it is padded up to 60 bytes. The following 2 commits seem to be the one to workaround this issue in e1000 and vmxenet3 before, and should probably be reverted. commit 78aeb23eded2 ("e1000: Pad short frames to minimum size (60 bytes)") commit 40a87c6c9b11 ("vmxnet3: Pad short frames to minimum size (60 bytes)") Signed-off-by: Bin Meng Message-Id: <1614763306-18026-2-git-send-email-bmeng.cn@gmail.com> [PMD: Use struct iovec for zero-copy] Signed-off-by: Philippe Mathieu-Daudé --- include/net/eth.h | 1 + net/net.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/net/eth.h b/include/net/eth.h index 0671be69165..7c825ecb2f7 100644 --- a/include/net/eth.h +++ b/include/net/eth.h @@ -31,6 +31,7 @@ #define ETH_ALEN 6 #define ETH_HLEN 14 +#define ETH_ZLEN 60 /* Min. octets in frame sans FCS */ struct eth_header { uint8_t h_dest[ETH_ALEN]; /* destination eth addr */ diff --git a/net/net.c b/net/net.c index 159e4d0ec25..d42ac9365eb 100644 --- a/net/net.c +++ b/net/net.c @@ -620,6 +620,7 @@ static ssize_t qemu_send_packet_async_with_flags(NetClientState *sender, const uint8_t *buf, int size, NetPacketSent *sent_cb) { + static const uint8_t null_buf[ETH_ZLEN] = { }; NetQueue *queue; int ret; int iovcnt = 1; @@ -628,6 +629,10 @@ static ssize_t qemu_send_packet_async_with_flags(NetClientState *sender, .iov_base = (void *)buf, .iov_len = size, }, + [1] = { + .iov_base = (void *)null_buf, + .iov_len = ETH_ZLEN, + }, }; #ifdef DEBUG_NET @@ -639,6 +644,15 @@ static ssize_t qemu_send_packet_async_with_flags(NetClientState *sender, return size; } + /* Pad to minimum Ethernet frame length for SLiRP and TAP */ + if (sender->info->type == NET_CLIENT_DRIVER_USER || + sender->info->type == NET_CLIENT_DRIVER_TAP) { + if (size < ETH_ZLEN) { + iov[1].iov_len = ETH_ZLEN - size; + iovcnt = 2; + } + } + /* Let filters handle the packet first */ ret = filter_receive_iov(sender, NET_FILTER_DIRECTION_TX, sender, flags, iov, iovcnt, sent_cb); From patchwork Wed Mar 3 19:11:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12114131 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1DF7C433E0 for ; Wed, 3 Mar 2021 19:21:47 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 2651C64EF4 for ; Wed, 3 Mar 2021 19:21:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2651C64EF4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:49732 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHX44-0008Ll-EQ for qemu-devel@archiver.kernel.org; Wed, 03 Mar 2021 14:21:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39742) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHWv6-0008Je-FY for qemu-devel@nongnu.org; Wed, 03 Mar 2021 14:12:28 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:50305) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lHWv4-0006oi-CC for qemu-devel@nongnu.org; Wed, 03 Mar 2021 14:12:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614798745; 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=rkUBN+Qyzi1lTxDF0XgYdWokUl6SLdP1HYpG3c36ims=; b=IfrY/C6kHmjT8jg5Sp30GA8xwOL+lGMu/8SHCKIzw7zk/91CbTJFICHRzqdcBnBsAZJA4L vHl7zzkRQvWIQfA2kID0JO6zkSR7jp2+GK8SmYWWdSdl6t1CT+7IDXjktciCICMCFl0A/l AKTaqAF2m+QfrJyXwAG43Z8whp4A7g0= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-101-v8KP6CahNbyY1jwezaGc8w-1; Wed, 03 Mar 2021 14:12:24 -0500 X-MC-Unique: v8KP6CahNbyY1jwezaGc8w-1 Received: by mail-wr1-f72.google.com with SMTP id s10so2280698wre.0 for ; Wed, 03 Mar 2021 11:12:24 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=rkUBN+Qyzi1lTxDF0XgYdWokUl6SLdP1HYpG3c36ims=; b=PSpd6m5EB+8J1/kJSclb/dwe5qVXSiZpDnqT2p/c++1T6M6Hj2DUPv4Rp2s9LY4taj 8OXd/HoTu1LAwC9aJRlkBWBJLukgxbNQ5d3joK0mpWp11q4R4ynMrJUj9UhK/hLYdqnx y3yNTIgmGvMPlgVRkXtt44KicVcnvbKMas06WdsHRAQH/yFeeEPeGaMvKrtvRvk16Xbk 6+X/LqYG8cSRD5LhWjZFJ49HMLDWNIwruuUw89BobjIOYMQalTIH+Maj1IK5F3z04VcL whpvjrWDIEV7L+7yzJDMx7XEjZ55CHFdVq/SZux8zjC5JLJUcWx9OX8Xeb4sCUVwGz+m Uw4Q== X-Gm-Message-State: AOAM531XiWLhJeeTO5bAElTAZSeXKQwCjYDOR1SpR7FHnIuVqR9XWA4m KZFZ2j8iZDDcP/XEc8hBsTUmoz1v+B5RSRoSZkqX0Oev3h56vmTDZjz/dFTgkEeTkU1xWDE1AXc gHYdtOxcJWaEDp2+kj4NdPbNl5MRILVxw14eBmGFBL61lDyeAs8Zkb8wgTjOa3/gs X-Received: by 2002:adf:d20b:: with SMTP id j11mr81832wrh.397.1614798743079; Wed, 03 Mar 2021 11:12:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJw0fJ17F+T3MrMvg9kX4RG2hRdOq/LhhlY/5lxP/sftpW0dnnGIGnU6W8QkUAppqHhWrlBO1w== X-Received: by 2002:adf:d20b:: with SMTP id j11mr81811wrh.397.1614798742947; Wed, 03 Mar 2021 11:12:22 -0800 (PST) Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id a6sm8828062wmm.0.2021.03.03.11.12.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 11:12:22 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH v3 03/10] hw/net: e1000: Remove the logic of padding short frames in the receive path Date: Wed, 3 Mar 2021 20:11:58 +0100 Message-Id: <20210303191205.1656980-4-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210303191205.1656980-1-philmd@redhat.com> References: <20210303191205.1656980-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Dmitry Fleytman , Jason Wang , Bin Meng , Richard Henderson , Bin Meng , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng 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 Message-Id: <1614763306-18026-3-git-send-email-bmeng.cn@gmail.com> Signed-off-by: Philippe Mathieu-Daudé --- 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 d8da2f6528b..a53ba9052b4 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; From patchwork Wed Mar 3 19:11:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12114115 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F019C433E0 for ; Wed, 3 Mar 2021 19:14:40 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 02EBC60241 for ; Wed, 3 Mar 2021 19:14:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 02EBC60241 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:35442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHWxC-0001vA-Ua for qemu-devel@archiver.kernel.org; Wed, 03 Mar 2021 14:14:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39902) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHWvB-0008Sv-R6 for qemu-devel@nongnu.org; Wed, 03 Mar 2021 14:12:33 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:30654) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lHWvA-0006rs-5B for qemu-devel@nongnu.org; Wed, 03 Mar 2021 14:12:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614798751; 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=lI2hg/5TdIAfeO1bSBITqXaKfCArmvxD5CXNkSGoaBM=; b=Yox6x7JI59Jnn7YweD3mBtiu6DqMtiVqXxtybh3QALgqMvVQcXSqpmjcaK8mdN6puFtqQC HuztSTpacAjZhnEp+NMXoCvL0neNYmbH/tEN38HBDCThQtHiur1npxIU+o0ktn+dOly19v kGP++uxVkTJn107tIdaUqnT0jAwN6jE= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-378-ul0lOS3mM7y7kRr6HeRNnQ-1; Wed, 03 Mar 2021 14:12:29 -0500 X-MC-Unique: ul0lOS3mM7y7kRr6HeRNnQ-1 Received: by mail-wm1-f69.google.com with SMTP id q24so3445581wmc.1 for ; Wed, 03 Mar 2021 11:12:29 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=lI2hg/5TdIAfeO1bSBITqXaKfCArmvxD5CXNkSGoaBM=; b=IbLiGpCzG/hCjBMQeOTBUCaeeK/menevAnsK9lyB+fwoqV5eBdf97OeHTNejsfwQIT Hc1Q6DRmHJOd+QoRjOhGzQFnCRRI2bOEcevZHu/cGO428o/88rcwmIxBUC2N0XhLCLkz RFVpWJl0FGbM52+FCswVWF9rkfAatNN7B+DwHeqGn8PBkGawJ9CU9wmjIl9xfDRSDTiw EseNzLD/u8EDJ7n0ixSsDZH5tZkAFjN4WEK5qCr/tfLptuyLsJiKRZVY39Cs60N9kScX J7B1ljo67vmWxckQNb3nPj/0YPFo4Ra4o+L9jew2FQhx+3h6pqGHhQMST5XNX8J/fyo3 d7VQ== X-Gm-Message-State: AOAM5333Sbb5sHLj5B9ZEFpHRUo8PqSs/C/qvSuxtZ46PHld/OCINqVx 4U9z4HctWLN6jPy6t0Y+G2d5WxVE1u5cChx4M9NDv3vO4noaPaYy5TNd9XZNM83yOSpJPqf+20l 9q5WzPjqMga1/jmer3KvEOV+2CpKjlJ5oIoqbDDf7CkPWPAEZWmQFglat/k3hJ/2Z X-Received: by 2002:a5d:6807:: with SMTP id w7mr113485wru.103.1614798748196; Wed, 03 Mar 2021 11:12:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJzJ/vu7VkJDNRTJxHn8KacjuJXnNtB5wI32n3AUCT7z22SIxTEMI2t8fZ+4Xaeq6zopWEhjJA== X-Received: by 2002:a5d:6807:: with SMTP id w7mr113461wru.103.1614798748012; Wed, 03 Mar 2021 11:12:28 -0800 (PST) Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id b186sm5250134wmc.44.2021.03.03.11.12.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 11:12:27 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH v3 04/10] hw/net: vmxnet3: Remove the logic of padding short frames in the receive path Date: Wed, 3 Mar 2021 20:11:59 +0100 Message-Id: <20210303191205.1656980-5-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210303191205.1656980-1-philmd@redhat.com> References: <20210303191205.1656980-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Dmitry Fleytman , Jason Wang , Bin Meng , Richard Henderson , Bin Meng , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng 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 40a87c6c9b11ef9c14e0301f76abf0eb2582f08e. Signed-off-by: Bin Meng Message-Id: <1614763306-18026-4-git-send-email-bmeng.cn@gmail.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/net/vmxnet3.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c index eff299f6290..d993cce097a 100644 --- a/hw/net/vmxnet3.c +++ b/hw/net/vmxnet3.c @@ -39,7 +39,6 @@ #define PCI_DEVICE_ID_VMWARE_VMXNET3_REVISION 0x1 #define VMXNET3_MSIX_BAR_SIZE 0x2000 -#define MIN_BUF_SIZE 60 /* Compatibility flags for migration */ #define VMXNET3_COMPAT_FLAG_OLD_MSI_OFFSETS_BIT 0 @@ -1951,7 +1950,6 @@ vmxnet3_receive(NetClientState *nc, const uint8_t *buf, size_t size) { VMXNET3State *s = qemu_get_nic_opaque(nc); size_t bytes_indicated; - uint8_t min_buf[MIN_BUF_SIZE]; if (!vmxnet3_can_receive(nc)) { VMW_PKPRN("Cannot receive now"); @@ -1964,14 +1962,6 @@ vmxnet3_receive(NetClientState *nc, const uint8_t *buf, size_t size) size -= sizeof(struct virtio_net_hdr); } - /* Pad to minimum Ethernet frame length */ - if (size < sizeof(min_buf)) { - memcpy(min_buf, buf, size); - memset(&min_buf[size], 0, sizeof(min_buf) - size); - buf = min_buf; - size = sizeof(min_buf); - } - net_rx_pkt_set_packet_type(s->rx_pkt, get_eth_packet_type(PKT_GET_ETH_HDR(buf))); From patchwork Wed Mar 3 19:12:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12114135 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98E93C433E6 for ; Wed, 3 Mar 2021 19:24:40 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id EAEF064EBB for ; Wed, 3 Mar 2021 19:24:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EAEF064EBB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:56502 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHX6t-0002kx-2c for qemu-devel@archiver.kernel.org; Wed, 03 Mar 2021 14:24:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40144) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHWvP-000095-KI for qemu-devel@nongnu.org; Wed, 03 Mar 2021 14:12:47 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:39150) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lHWvE-0006tt-Vn for qemu-devel@nongnu.org; Wed, 03 Mar 2021 14:12:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614798756; 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=+ne5diQd2gxsPBtDDhKD/phqfjDFTA6zzQ5kRhrkwDo=; b=O6JFfd5oKqK3K6Ff/9sf6yHk2GSZ6kweGxGaSeHhiRo4nH7VmFhwae6cgmSOULUMzFLFkS kxOl3uDSFyKyD9I/RxrE6LMz6HIvmCb+9nXYpMvnlG43739hVEu4H+fR612gpZgX8Gcwrx A3ld80DAl3Z4/+END1iSbAZV5CA/DDw= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-126-Nf1qtPstOBWfSGmp_XcZ4Q-1; Wed, 03 Mar 2021 14:12:34 -0500 X-MC-Unique: Nf1qtPstOBWfSGmp_XcZ4Q-1 Received: by mail-wm1-f69.google.com with SMTP id z26so3435502wml.4 for ; Wed, 03 Mar 2021 11:12:34 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=+ne5diQd2gxsPBtDDhKD/phqfjDFTA6zzQ5kRhrkwDo=; b=O2hwYsnaXwYTiojAkSI4RzX/PIJHwbsdK7kkOIjCWaL45fqch9K8EQIfwbUWjQ5rsJ bnkNzJIUhiJyrlgYr7CJ9yZllRkqyGnNKeTeAVEZVFIv4ipZ+lXWjgxmWgDVHt6Tu/wx CsMtxabLzo7wc6XFrU/5bekmXI60o9zNu/+o6BeEztShnOzrxv5Peh8ep+E7epcC4wdx AJsX49tryIJmbPb7PLtNK0vgL3ObMrKyardKKGdTkmMOizvD4MwbzQr1b9I2K+Lzeoku IBHo1CWyOgVx7MO+6c+kOQlFYgbXVqzM4ONa12PRBn90v1OplPmvkWCXCVLE04UUr1hs OQuA== X-Gm-Message-State: AOAM53385lghqvgAAkw9ry6ZuwdWVoe8LnpNYI+SV6iXN1oV5znVejBe IqIsy0l/sFO6eH3gJ2rfejq8IGn35TNd9SzjsE926nLhHaEhwHwhN9BqNwCBWeo01r57DsbV/Lv nNDOIoFGSF0jsTsFkJxvsRYNDz1PlzUV17pwH6cPbDw8uobE5Jol3hfvj3twIT/1o X-Received: by 2002:a05:600c:3550:: with SMTP id i16mr422460wmq.170.1614798753419; Wed, 03 Mar 2021 11:12:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJwZA5/B1eI7smmS4ewi3nccrPKKBhVMku1/gpsBY17BdRWDdfNhFoWqUQrKMEk3cvQHqLn/FA== X-Received: by 2002:a05:600c:3550:: with SMTP id i16mr422439wmq.170.1614798753184; Wed, 03 Mar 2021 11:12:33 -0800 (PST) Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id z188sm8934994wme.32.2021.03.03.11.12.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 11:12:32 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH v3 05/10] hw/net: i82596: Remove the logic of padding short frames in the receive path Date: Wed, 3 Mar 2021 20:12:00 +0100 Message-Id: <20210303191205.1656980-6-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210303191205.1656980-1-philmd@redhat.com> References: <20210303191205.1656980-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Dmitry Fleytman , Jason Wang , Bin Meng , Richard Henderson , Bin Meng , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Now that we have implemented unified short frames padding in the QEMU networking codes, remove the same logic in the NIC codes. Signed-off-by: Bin Meng Message-Id: <1614763306-18026-5-git-send-email-bmeng.cn@gmail.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/net/i82596.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/hw/net/i82596.c b/hw/net/i82596.c index 055c3a1470c..1eca2e2d816 100644 --- a/hw/net/i82596.c +++ b/hw/net/i82596.c @@ -73,10 +73,6 @@ enum commands { #define I596_EOF 0x8000 #define SIZE_MASK 0x3fff -#define ETHER_TYPE_LEN 2 -#define VLAN_TCI_LEN 2 -#define VLAN_HLEN (ETHER_TYPE_LEN + VLAN_TCI_LEN) - /* various flags in the chip config registers */ #define I596_PREFETCH (s->config[0] & 0x80) #define I596_PROMISC (s->config[8] & 0x01) @@ -489,8 +485,6 @@ bool i82596_can_receive(NetClientState *nc) return true; } -#define MIN_BUF_SIZE 60 - ssize_t i82596_receive(NetClientState *nc, const uint8_t *buf, size_t sz) { I82596State *s = qemu_get_nic_opaque(nc); @@ -501,7 +495,6 @@ ssize_t i82596_receive(NetClientState *nc, const uint8_t *buf, size_t sz) size_t bufsz = sz; /* length of data in buf */ uint32_t crc; uint8_t *crc_ptr; - uint8_t buf1[MIN_BUF_SIZE + VLAN_HLEN]; static const uint8_t broadcast_macaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; @@ -584,17 +577,6 @@ ssize_t i82596_receive(NetClientState *nc, const uint8_t *buf, size_t sz) } } - /* if too small buffer, then expand it */ - if (len < MIN_BUF_SIZE + VLAN_HLEN) { - memcpy(buf1, buf, len); - memset(buf1 + len, 0, MIN_BUF_SIZE + VLAN_HLEN - len); - buf = buf1; - if (len < MIN_BUF_SIZE) { - len = MIN_BUF_SIZE; - } - bufsz = len; - } - /* Calculate the ethernet checksum (4 bytes) */ len += 4; crc = cpu_to_be32(crc32(~0, buf, sz)); From patchwork Wed Mar 3 19:12:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12114117 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3B58C433DB for ; Wed, 3 Mar 2021 19:14:52 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 3932064E90 for ; Wed, 3 Mar 2021 19:14:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3932064E90 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:35838 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHWxO-00024v-0u for qemu-devel@archiver.kernel.org; Wed, 03 Mar 2021 14:14:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40196) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHWvR-0000BQ-NC for qemu-devel@nongnu.org; Wed, 03 Mar 2021 14:12:49 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:60128) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lHWvN-0006uy-2w for qemu-devel@nongnu.org; Wed, 03 Mar 2021 14:12:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614798761; 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=rXFV9G0MJ4FvY42CmYEG0oMTNhQmH249ONzv0QeRcyQ=; b=Cy56EltcrPG+LDMBgLd1tkl5gDd3PztVgb8BZpfkonySZVYsRLqIwsdi1pmL+JikrbBd3G Lp9ML1GNIZIiseVfznStFbBOsxkm5hVlCCbY5LgE/74/Ozt9X8KODdsRZw0TL7ziu6gjWY 1dFh28PLpbRB0qa54gq64b9X5sWnjHU= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-548-mZIPPWBGNmq1xAbnBEUdbg-1; Wed, 03 Mar 2021 14:12:40 -0500 X-MC-Unique: mZIPPWBGNmq1xAbnBEUdbg-1 Received: by mail-wr1-f71.google.com with SMTP id e29so13196263wra.12 for ; Wed, 03 Mar 2021 11:12:39 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=rXFV9G0MJ4FvY42CmYEG0oMTNhQmH249ONzv0QeRcyQ=; b=Vp+CmtXLYmFwr44IqSmPK1mjPw6gZxNDNVHuVO5DwqsISdX/0HwV9MR5k7EX5gvXnJ lx9dkVwrNvtpt7E+nWIsA7cyZ7D+haxtx9d0mhsfHEN7oIcAA69umN2UEcKBhKKCRCzf NHXEN6rZw2OIf3hbh/FKw+XNQUGGOJDKnupz7Q9TEGbVve5lo4GgNfsynF7KdV0xr8Dl 9OM43HU/0bx9G6T9bQtcMcJWVZREhOmskoZh7E+XnLhUfDs4tVgOQ5N+ACXVyTcwZ0/A nLGs4Qf2X5dpH0tXotHjsGjJhqRzkRYxvHo/QwlQ4gf28d21JgGhW4RLP4ZNis2y1l9K 4lDA== X-Gm-Message-State: AOAM532DHl4m2oQfZDOrN5mZnT+HOJdhEHgb0SecCxfjGI059MhW46/v LBqqtQMS3/ng7l4mtbKFoq2IsBIzqkkHPXb9U8gyVjmPnZSDC0EH6ZylbcwEl6hAORjjHcl2eUu E0rAF8bQEJJdiwr8QOcLpxcCWxijtzMEDszuXm8DTjxSzBLKpUAlHmNHPL+3NGDRP X-Received: by 2002:a1c:7fd8:: with SMTP id a207mr441371wmd.40.1614798758643; Wed, 03 Mar 2021 11:12:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJwUlGR3AFf6/QS6ZZh+/wUME62yJZIX+H+tEgqvi46UMWQqbq4iaUNQm6UKm+TWUtbuYK9G+g== X-Received: by 2002:a1c:7fd8:: with SMTP id a207mr441341wmd.40.1614798758390; Wed, 03 Mar 2021 11:12:38 -0800 (PST) Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id p6sm19301832wru.2.2021.03.03.11.12.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 11:12:37 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH v3 06/10] hw/net: ne2000: Remove the logic of padding short frames in the receive path Date: Wed, 3 Mar 2021 20:12:01 +0100 Message-Id: <20210303191205.1656980-7-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210303191205.1656980-1-philmd@redhat.com> References: <20210303191205.1656980-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Dmitry Fleytman , Jason Wang , Bin Meng , Richard Henderson , Bin Meng , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Now that we have implemented unified short frames padding in the QEMU networking codes, remove the same logic in the NIC codes. Signed-off-by: Bin Meng Message-Id: <1614763306-18026-6-git-send-email-bmeng.cn@gmail.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/net/ne2000.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/hw/net/ne2000.c b/hw/net/ne2000.c index 6c17ee1ae21..b0a120ece63 100644 --- a/hw/net/ne2000.c +++ b/hw/net/ne2000.c @@ -167,15 +167,12 @@ static int ne2000_buffer_full(NE2000State *s) return 0; } -#define MIN_BUF_SIZE 60 - ssize_t ne2000_receive(NetClientState *nc, const uint8_t *buf, size_t size_) { NE2000State *s = qemu_get_nic_opaque(nc); size_t size = size_; uint8_t *p; unsigned int total_len, next, avail, len, index, mcast_idx; - uint8_t buf1[60]; static const uint8_t broadcast_macaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; @@ -213,15 +210,6 @@ ssize_t ne2000_receive(NetClientState *nc, const uint8_t *buf, size_t size_) } } - - /* if too small buffer, then expand it */ - if (size < MIN_BUF_SIZE) { - memcpy(buf1, buf, size); - memset(buf1 + size, 0, MIN_BUF_SIZE - size); - buf = buf1; - size = MIN_BUF_SIZE; - } - index = s->curpag << 8; if (index >= NE2000_PMEM_END) { index = s->start; From patchwork Wed Mar 3 19:12:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12114127 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E665EC433DB for ; Wed, 3 Mar 2021 19:18:52 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 7491364EDF for ; Wed, 3 Mar 2021 19:18:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7491364EDF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:44058 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHX1H-0005nZ-BW for qemu-devel@archiver.kernel.org; Wed, 03 Mar 2021 14:18:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40210) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHWvS-0000DU-Qw for qemu-devel@nongnu.org; Wed, 03 Mar 2021 14:12:52 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24348) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lHWvP-0006wJ-Cz for qemu-devel@nongnu.org; Wed, 03 Mar 2021 14:12:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614798766; 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=CouKFTwLkgo/uu4gqqm3VLXBNVa87X4zwN26JBMF5/w=; b=bXVu90Lr4EjjQQFkZAnEuCclZzbwE3jcy+EDJbtcMJxSQCVhYIDIQbURL4BZeDf21N3m6D Xg6unmp4QQUiSpSJAQ+xZ8SVzp8QQClliXA+9q+A4qPVgqW3iRl/sp5ra8JxFC3A2Z2Dez 9gnYdceJQNJd4/PmoH7yTmW8QmaKe4g= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-171-JZk-2UlRM6ihVtK-uGrTDQ-1; Wed, 03 Mar 2021 14:12:45 -0500 X-MC-Unique: JZk-2UlRM6ihVtK-uGrTDQ-1 Received: by mail-wm1-f72.google.com with SMTP id 73so3402360wma.3 for ; Wed, 03 Mar 2021 11:12:45 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=CouKFTwLkgo/uu4gqqm3VLXBNVa87X4zwN26JBMF5/w=; b=tYQ+dN2d6gblnrWHqohPI6Ab3W5Db5wAJwO2kaGeHDY0BnrpYHxDpMNd1hMvC4oEcM 5Ajzwf83swieM48zySkz0dHHBLAqxRiuIZM2csWXsFROc04019nZOa2bBAWMiqHIuaqM M0iiaEinVFAVvPsb4mwh+IvjdVcBinlwnlTaeT8uVRm+SIzxlYtggOsCfSCFgDK5cGR+ TfUa3y5bfgw7AdMzW5m0cpOt5Yxkvyo2sUIjo7e8maklWKTqClp6V/T4luQl5ziPe2dX jeg2ST2R8pZSzF5cOWo3pV3gHT+rDqaGRvtiE9xsuRKjj51r7qiNxXKfHhIWCccP0s4L LwMg== X-Gm-Message-State: AOAM532yq0HGT0h+iQSRXkpVyPlDOyqj0GNzIH4wy5y4bvALaME+kceu UmuPhr549FcYIYU1/sZreY4cSBL6xZnpvPnjdBX/vjUf6VRTUa0iqhWsdzeg7JrjXjG6dYpArMQ ku6dpyIsNlCRhSxriuulFfmPKA27f+dwVz7aqSOMYqi3Lg9z4l2q7e/itCLzJU7lS X-Received: by 2002:a05:600c:190a:: with SMTP id j10mr434498wmq.140.1614798763900; Wed, 03 Mar 2021 11:12:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJx7KjNPYS7LmJ1FqpfG69PqrQf7LLPtRfa5i5RiOdU8sfsXXZsOLrYJYu5YQg7rrpKBCWEYcQ== X-Received: by 2002:a05:600c:190a:: with SMTP id j10mr434483wmq.140.1614798763615; Wed, 03 Mar 2021 11:12:43 -0800 (PST) Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id c184sm5706813wmf.28.2021.03.03.11.12.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 11:12:42 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH v3 07/10] hw/net: pcnet: Remove the logic of padding short frames in the receive path Date: Wed, 3 Mar 2021 20:12:02 +0100 Message-Id: <20210303191205.1656980-8-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210303191205.1656980-1-philmd@redhat.com> References: <20210303191205.1656980-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Dmitry Fleytman , Jason Wang , Bin Meng , Richard Henderson , Bin Meng , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Now that we have implemented unified short frames padding in the QEMU networking codes, remove the same logic in the NIC codes. Signed-off-by: Bin Meng Message-Id: <1614763306-18026-7-git-send-email-bmeng.cn@gmail.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/net/pcnet.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/hw/net/pcnet.c b/hw/net/pcnet.c index f3f18d8598c..16330335cd2 100644 --- a/hw/net/pcnet.c +++ b/hw/net/pcnet.c @@ -987,7 +987,6 @@ ssize_t pcnet_receive(NetClientState *nc, const uint8_t *buf, size_t size_) { PCNetState *s = qemu_get_nic_opaque(nc); int is_padr = 0, is_bcast = 0, is_ladr = 0; - uint8_t buf1[60]; int remaining; int crc_err = 0; size_t size = size_; @@ -1000,14 +999,6 @@ ssize_t pcnet_receive(NetClientState *nc, const uint8_t *buf, size_t size_) printf("pcnet_receive size=%zu\n", size); #endif - /* if too small buffer, then expand it */ - if (size < MIN_BUF_SIZE) { - memcpy(buf1, buf, size); - memset(buf1 + size, 0, MIN_BUF_SIZE - size); - buf = buf1; - size = MIN_BUF_SIZE; - } - if (CSR_PROM(s) || (is_padr=padr_match(s, buf, size)) || (is_bcast=padr_bcast(s, buf, size)) From patchwork Wed Mar 3 19:12:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12114125 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98901C433E0 for ; Wed, 3 Mar 2021 19:18:48 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 077DC64EDF for ; Wed, 3 Mar 2021 19:18:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 077DC64EDF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:43602 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHX1D-0005cT-1C for qemu-devel@archiver.kernel.org; Wed, 03 Mar 2021 14:18:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40300) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHWvZ-0000NT-9F for qemu-devel@nongnu.org; Wed, 03 Mar 2021 14:12:57 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:27131) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lHWvU-0006yL-L9 for qemu-devel@nongnu.org; Wed, 03 Mar 2021 14:12:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614798771; 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=oQ53tkWrp+KNAV5jr5E0Yd+AAzWqxTKyNH3MXsvMcQY=; b=KY3BsIDBPIpF2FmTl4SPFqewZwI69Fc2UMw1tRrJw4j0LQtx7ffwM+TLaTM/4+Xx35buX8 JfNPtbCxfHlS3TSWthdVCyQYRVCoaXJq1fEvys1VU87g9Olbo4Yh4S1UnVhJtoBsakTIis rXBXAthbNvn8orqhhXkd7fLTUylC2Lk= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-368-ToFesamSNWKEgIMnfuw5Rg-1; Wed, 03 Mar 2021 14:12:50 -0500 X-MC-Unique: ToFesamSNWKEgIMnfuw5Rg-1 Received: by mail-wr1-f69.google.com with SMTP id g2so6334191wrx.20 for ; Wed, 03 Mar 2021 11:12:49 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=oQ53tkWrp+KNAV5jr5E0Yd+AAzWqxTKyNH3MXsvMcQY=; b=B7HAD5CsSHzlQTC/1MK5wmNxwM8N7jxkcjH6zgA8SQi6uhzDXk47P1i/MMq3qxcsA0 BjbBal5C1g9fP/6NTJpSYgMUevfU7L5U7DIs3KWlQEO7LVuMl6iPDFBus5WczgPdD06Y PM+gIsqNkG2z9AxzSNt1a4Yyto5kVpm1oSeUprZ4ib5VhGeTSvpV1jCDFIilVrFzPAlV PcoZF5SUBI4fTWHanoUG7xquKR0/6h9krv66TOGukypFEZBkfLJBvnv1HpG7u/BQ63fY AO1ycZ28lR982u9GdXs3Sszsi/Aqcm06VmWejFlrNlgcc389IP/V2k0fmvvnYRbMrBMQ IN9w== X-Gm-Message-State: AOAM530cXNhpt3bnKSxqrQBVegCCROh8dSQGoKL59pOU0zs0hLYnDdgG ae+8J2vk8ZqJdbsatlxdHum/C0cK+Ine5npvIylmgxsTR7f/7pOA/M95wHij52bpenXp1IxLoOj DrMv4zt/RXy0c+Y7lD7uXObB2ohmkEWqppR+IKkgFHjGVN5Po9MqsXGFjPVhzr6Sr X-Received: by 2002:a5d:4441:: with SMTP id x1mr237389wrr.56.1614798768595; Wed, 03 Mar 2021 11:12:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHTDhfewwPm3ptxhLftX31Jg88sQIBIyES19/h2UGeP8kX83MU0iK2F7p74uwCS+h7MR0X6g== X-Received: by 2002:a5d:4441:: with SMTP id x1mr237359wrr.56.1614798768412; Wed, 03 Mar 2021 11:12:48 -0800 (PST) Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id w16sm20019656wrk.41.2021.03.03.11.12.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 11:12:47 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH v3 08/10] hw/net: rtl8139: Remove the logic of padding short frames in the receive path Date: Wed, 3 Mar 2021 20:12:03 +0100 Message-Id: <20210303191205.1656980-9-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210303191205.1656980-1-philmd@redhat.com> References: <20210303191205.1656980-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Dmitry Fleytman , Jason Wang , Bin Meng , Richard Henderson , Bin Meng , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Now that we have implemented unified short frames padding in the QEMU networking codes, remove the same logic in the NIC codes. Signed-off-by: Bin Meng Message-Id: <1614763306-18026-8-git-send-email-bmeng.cn@gmail.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/net/rtl8139.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c index 4675ac878e9..cbfe29a2867 100644 --- a/hw/net/rtl8139.c +++ b/hw/net/rtl8139.c @@ -827,7 +827,6 @@ static ssize_t rtl8139_do_receive(NetClientState *nc, const uint8_t *buf, size_t uint32_t packet_header = 0; - uint8_t buf1[MIN_BUF_SIZE + VLAN_HLEN]; static const uint8_t broadcast_macaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; @@ -939,17 +938,6 @@ static ssize_t rtl8139_do_receive(NetClientState *nc, const uint8_t *buf, size_t } } - /* if too small buffer, then expand it - * Include some tailroom in case a vlan tag is later removed. */ - if (size < MIN_BUF_SIZE + VLAN_HLEN) { - memcpy(buf1, buf, size); - memset(buf1 + size, 0, MIN_BUF_SIZE + VLAN_HLEN - size); - buf = buf1; - if (size < MIN_BUF_SIZE) { - size = MIN_BUF_SIZE; - } - } - if (rtl8139_cp_receiver_enabled(s)) { if (!rtl8139_cp_rx_valid(s)) { From patchwork Wed Mar 3 19:12:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12114137 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D3A8C433DB for ; Wed, 3 Mar 2021 19:24:44 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id C73EE601FB for ; Wed, 3 Mar 2021 19:24:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C73EE601FB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:56790 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHX6w-0002x7-Ud for qemu-devel@archiver.kernel.org; Wed, 03 Mar 2021 14:24:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41074) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHWw9-0000pv-0z for qemu-devel@nongnu.org; Wed, 03 Mar 2021 14:13:33 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:35360) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lHWw5-0007E7-Gk for qemu-devel@nongnu.org; Wed, 03 Mar 2021 14:13:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614798808; 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=A+1d1LK3/7O/279IVj+Ph/XHu1RN+wl0D3hJoCw8j8k=; b=hl9jEc/8cHq2p0TbpBb7Dipa6dep6FQFqR1VUE+DUwiDRBv08N+DoNgpsc2tQ7mYdu7GNh bqidqwXT5cZipm+n9jS0LhyXcdphvYJ78f2wpbdk/tDiqUqREokdezNuaeo3OLT/KKpqRC 97NPZvgvLSdIz8TUschCFMP3Alah4go= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-321-QomY5t_NPayWSJaXdlo5cg-1; Wed, 03 Mar 2021 14:12:57 -0500 X-MC-Unique: QomY5t_NPayWSJaXdlo5cg-1 Received: by mail-wm1-f71.google.com with SMTP id c7so1718768wml.8 for ; Wed, 03 Mar 2021 11:12:57 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=A+1d1LK3/7O/279IVj+Ph/XHu1RN+wl0D3hJoCw8j8k=; b=Gi7n3aZ8kmPI9z03hCLV3AV9kb9wTYbJlZ+m/6iwFOvZKyeBvaWhozsPvpNUHM/mCv 3IZ/6LjAXFeG7i7t70Sh4TR9wNITMea8G9ujeqAzVa5NXEx8ai5I0vr+Xg+f6DiPZwcT DgpljCEWFPyOmJ63hVwFzTLrGVRcCz4v1LtudPJA/YbnX4QyvvmzbgXsk1O1Du+OPBCG 8/VSuQLcSOK0CLDEobaRdSPlu/iWHcs/aKyFzJ8eMPbP1lbFp9aKMr4ceB1bTjF3+v04 7oyslUS41maYMH9QcubWbwGCVaKuVCANznI8kjZng4IbGkAN/q6LpHwZ2DABn0P9R3oF RHKg== X-Gm-Message-State: AOAM530fdJh9tCGg0N9XoLqbSMeysc0aXqefmkmwhVvNLguwJaKxpRyQ gVczwORGxzH24pi0Nc4FM+i26qMYgSQ2F0q8XpoE7FJJI0E4gjxt31+HWgUJnz67dDtLYmxt8xl /KRQaAmkMbVU9ikzOnag2FBjrmGAmhRuiSVLC2F44Pogm1BSVJEoFesmGLw2G5X4L X-Received: by 2002:adf:a3d3:: with SMTP id m19mr243080wrb.24.1614798774358; Wed, 03 Mar 2021 11:12:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJwDgbCUusOf8YtEWk8TzhlZX/nvR+AqM92YsE96kKHqIJ7afW6SvKWRzcLx5UhuRTsivyFi0Q== X-Received: by 2002:adf:a3d3:: with SMTP id m19mr243062wrb.24.1614798774227; Wed, 03 Mar 2021 11:12:54 -0800 (PST) Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id f16sm32286601wrt.21.2021.03.03.11.12.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 11:12:53 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH v3 09/10] hw/net: sungem: Remove the logic of padding short frames in the receive path Date: Wed, 3 Mar 2021 20:12:04 +0100 Message-Id: <20210303191205.1656980-10-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210303191205.1656980-1-philmd@redhat.com> References: <20210303191205.1656980-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Dmitry Fleytman , Jason Wang , Bin Meng , Richard Henderson , Bin Meng , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Now that we have implemented unified short frames padding in the QEMU networking codes, remove the same logic in the NIC codes. Signed-off-by: Bin Meng Message-Id: <1614763306-18026-9-git-send-email-bmeng.cn@gmail.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/net/sungem.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/hw/net/sungem.c b/hw/net/sungem.c index 33c3722df6f..3fa83168db0 100644 --- a/hw/net/sungem.c +++ b/hw/net/sungem.c @@ -550,7 +550,6 @@ static ssize_t sungem_receive(NetClientState *nc, const uint8_t *buf, PCIDevice *d = PCI_DEVICE(s); uint32_t mac_crc, done, kick, max_fsize; uint32_t fcs_size, ints, rxdma_cfg, rxmac_cfg, csum, coff; - uint8_t smallbuf[60]; struct gem_rxd desc; uint64_t dbase, baddr; unsigned int rx_cond; @@ -584,19 +583,6 @@ static ssize_t sungem_receive(NetClientState *nc, const uint8_t *buf, return size; } - /* We don't drop too small frames since we get them in qemu, we pad - * them instead. We should probably use the min frame size register - * but I don't want to use a variable size staging buffer and I - * know both MacOS and Linux use the default 64 anyway. We use 60 - * here to account for the non-existent FCS. - */ - if (size < 60) { - memcpy(smallbuf, buf, size); - memset(&smallbuf[size], 0, 60 - size); - buf = smallbuf; - size = 60; - } - /* Get MAC crc */ mac_crc = net_crc32_le(buf, ETH_ALEN); From patchwork Wed Mar 3 19:12:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12114133 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A06F9C433DB for ; Wed, 3 Mar 2021 19:21:51 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id BF98A64EF4 for ; Wed, 3 Mar 2021 19:21:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF98A64EF4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:50044 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHX49-0008Tb-NU for qemu-devel@archiver.kernel.org; Wed, 03 Mar 2021 14:21:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40532) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHWvh-0000bS-1J for qemu-devel@nongnu.org; Wed, 03 Mar 2021 14:13:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:28689) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lHWvf-000741-8k for qemu-devel@nongnu.org; Wed, 03 Mar 2021 14:13:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614798782; 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=BuH4+Q0BM50iRTQU72DhaJAvYxJTYB/CnCHI67AXPbc=; b=XLGM4Usd/UJu0ikT9KrijgGyQyEQjg4JJssGc//FuEqx3vvG+lxlhFva8lZ891kwXKDFOe yg586oyeUinkNHG55+Jo1/Mi7btA/FqqOL6wwpzVxRXsIiteqhn3zfu4SGXpvECj5INIdQ 3vtggc9MYhkoSGpR2VcheCGzpo0numo= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-344-yfklY0mVNeShX1N9lYzklg-1; Wed, 03 Mar 2021 14:13:01 -0500 X-MC-Unique: yfklY0mVNeShX1N9lYzklg-1 Received: by mail-wr1-f69.google.com with SMTP id g5so13155501wrd.22 for ; Wed, 03 Mar 2021 11:13:01 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=BuH4+Q0BM50iRTQU72DhaJAvYxJTYB/CnCHI67AXPbc=; b=nN/FIiEfXcDfkZcPOBviABkHw/D/80Gof89c9QYVQU+DkQNSnPim0pIawD+jXKa8QD bWemHwwGzISGF/ZahjX3/ONw3GJee21LUrCkAqNCQD1TP9rQsee5EbaZkA8q6F23cVZ+ tvzwIqjZIavd7udN2Fkh0qgiEMMJngiWnkcoA5xU9cbbIPY3VhhE7cE9ZfIkPZE+gwUY g++V4hm/L09q2+Gh2k/sphxl5MXztIrWdPD5U0gnUxEp1jocFUE70KGnWPM7T4VTQiBx L7sVSrZTE4drvs3H0kvJ13Hh29UjVnfqWNEuhGOT40NWM+pZsEwJucFiq0ql2PlKIyvm jKtg== X-Gm-Message-State: AOAM533kQUUcfdjn1Dm5Y0T6sIDVY4CE96HT07Qz2cqi9TEy7OxriIaw hsSsNo9hyOGZjb1Der/ep3Fe7rai0qrWZO49o2skgdJF6Lerc7wHcvIGBuc6OjDbOTQH6DMtiEP PLegOEj6blj/u4JoljhFChJcgwdemkav+QVPrU3eIX/yAqH3VxZNdaPRMO8mJiclE X-Received: by 2002:a05:6000:18a:: with SMTP id p10mr224949wrx.166.1614798779314; Wed, 03 Mar 2021 11:12:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJzWtN2TXiNu/ZWiYkxV34OkYRiF1Vbunrzq6zARCVyP8COfaatgOcglggtfP1H3F9F4efQC9A== X-Received: by 2002:a05:6000:18a:: with SMTP id p10mr224930wrx.166.1614798779180; Wed, 03 Mar 2021 11:12:59 -0800 (PST) Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id v5sm6812810wmh.2.2021.03.03.11.12.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 11:12:58 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH v3 10/10] hw/net: sunhme: Remove the logic of padding short frames in the receive path Date: Wed, 3 Mar 2021 20:12:05 +0100 Message-Id: <20210303191205.1656980-11-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210303191205.1656980-1-philmd@redhat.com> References: <20210303191205.1656980-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Dmitry Fleytman , Jason Wang , Bin Meng , Richard Henderson , Bin Meng , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Now that we have implemented unified short frames padding in the QEMU networking codes, remove the same logic in the NIC codes. Signed-off-by: Bin Meng Message-Id: <1614763306-18026-10-git-send-email-bmeng.cn@gmail.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/net/sunhme.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/hw/net/sunhme.c b/hw/net/sunhme.c index fc34905f875..6971796e575 100644 --- a/hw/net/sunhme.c +++ b/hw/net/sunhme.c @@ -714,8 +714,6 @@ static inline void sunhme_set_rx_ring_nr(SunHMEState *s, int i) s->erxregs[HME_ERXI_RING >> 2] = ring; } -#define MIN_BUF_SIZE 60 - static ssize_t sunhme_receive(NetClientState *nc, const uint8_t *buf, size_t size) { @@ -724,7 +722,6 @@ static ssize_t sunhme_receive(NetClientState *nc, const uint8_t *buf, dma_addr_t rb, addr; uint32_t intstatus, status, buffer, buffersize, sum; uint16_t csum; - uint8_t buf1[60]; int nr, cr, len, rxoffset, csum_offset; trace_sunhme_rx_incoming(size); @@ -775,14 +772,6 @@ static ssize_t sunhme_receive(NetClientState *nc, const uint8_t *buf, trace_sunhme_rx_filter_accept(); - /* If too small buffer, then expand it */ - if (size < MIN_BUF_SIZE) { - memcpy(buf1, buf, size); - memset(buf1 + size, 0, MIN_BUF_SIZE - size); - buf = buf1; - size = MIN_BUF_SIZE; - } - rb = s->erxregs[HME_ERXI_RING >> 2] & HME_ERXI_RING_ADDR; nr = sunhme_get_rx_ring_count(s); cr = sunhme_get_rx_ring_nr(s);