From nobody Fri May 17 11:58:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1614798736; cv=none; d=zohomail.com; s=zohoarc; b=lIpk2O2bcNt0Rmb+WeTylsItqfmdNItjSO9etmWaBYi7jNcNtidqmppIzFW8DUChx4JOw1SVR906sejoIUBxVpjXhpe5ScGwQA92gOYUC/bBJvQ3ee6rOUgY7iO47aJnXPRcUEuIFwEVl9i1Mgpq86/rtLTH27NmlQ7qj50ZBDI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614798736; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=MCpf1H4OXD9yrNlExURtQRGgfyEZrfNaghb6RD0f6bw=; b=PL6sTuN9hMli19lOOC/59XA0a0+C64w+oAHyqqqnMimOesmdObWHTeL+QqbvMQGDPdRcVM8IhNdikkx2VqwLfVXqHLqkmza1Sii5TfZDEKTgxlBSB0HwO8uFUTvlXLik2R8RlyTd1WMZmVTwYelGolL1Bk9MheAnbBglux1au48= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1614798736381540.5823446076415; Wed, 3 Mar 2021 11:12:16 -0800 (PST) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-589-H4S5MS1oNXyPXj_1BHnuFA-1; Wed, 03 Mar 2021 14:12:13 -0500 Received: by mail-wr1-f70.google.com with SMTP id x9so9333497wro.9 for ; Wed, 03 Mar 2021 11:12:13 -0800 (PST) Return-Path: Return-Path: 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) 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= X-MC-Unique: H4S5MS1oNXyPXj_1BHnuFA-1 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=OnC1SIIHcYHSncJiHDGNGTWfp1D9apX2O9hzHbq7Q98T2HgNdQWs/+KVPlI1ajFBdJ Lr+9rrM36fJ+ryFVAQH7peem34iaqucSdV4ekA6AH/CkI7qC9/+AHOSYvzIFF7DG1cnR C052VEUcUsnVFyhqxkybjIC2OrQbp+KLtGPdOafGEaoakQjVoHVnHC+q7KGSv5N4dYY7 MMJU3ytGstyXzXXc2q8QGnigq29wLfvYRMuIFK0YE0Tnx6lCE8O/OkxmTKWHYUsqhqna f0TzghWtMGuEWkDj5dJGORuk+h+c63MuEpZXxgvoX38rv/Qh5xlJ5+TbI0cQGwck/RK5 oXnA== X-Gm-Message-State: AOAM533RvQr3uF6qzEGDo69SaKcsyZQ7Ux61IpSG7v50kmJqG/0/4yxn L9xktzLF7znxKMI0DtqXs2G+eOPOf25KmnYbpxN95jR1Sk5FFcrMmjpdNwNxbwv+xULYXVvu8wT cY44fc78173Y9vg== X-Received: by 2002:adf:8341:: with SMTP id 59mr213902wrd.130.1614798732658; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Jason Wang , Bin Meng , Dmitry Fleytman , Peter Maydell , Richard Henderson , Bin Meng , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) 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=C3=A9 --- 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; } =20 -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 =3D { - .iov_base =3D (void *)data, - .iov_len =3D 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(NetCl= ientState *sender, { NetQueue *queue; int ret; + int iovcnt =3D 1; + struct iovec iov[] =3D { + [0] =3D { + .iov_base =3D (void *)buf, + .iov_len =3D size, + }, + }; =20 #ifdef DEBUG_NET printf("qemu_send_packet_async:\n"); @@ -649,21 +640,21 @@ static ssize_t qemu_send_packet_async_with_flags(NetC= lientState *sender, } =20 /* Let filters handle the packet first */ - ret =3D filter_receive(sender, NET_FILTER_DIRECTION_TX, - sender, flags, buf, size, sent_cb); + ret =3D filter_receive_iov(sender, NET_FILTER_DIRECTION_TX, + sender, flags, iov, iovcnt, sent_cb); if (ret) { return ret; } =20 - ret =3D filter_receive(sender->peer, NET_FILTER_DIRECTION_RX, - sender, flags, buf, size, sent_cb); + ret =3D filter_receive_iov(sender->peer, NET_FILTER_DIRECTION_RX, + sender, flags, iov, iovcnt, sent_cb); if (ret) { return ret; } =20 queue =3D sender->peer->incoming_queue; =20 - 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); } =20 ssize_t qemu_send_packet_async(NetClientState *sender, --=20 2.26.2 From nobody Fri May 17 11:58:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1614798741; cv=none; d=zohomail.com; s=zohoarc; b=PyYUPOGgrTQP+beK8UtTluTDSs6sQkhxVD8QS7KCIR6tHhmxGf/5lkxjWoZl07nmh169WWwDPpV4NGjlGwAJqfStyfcOI9gmfmjNCkKVAFE9fqQBbcFe2mUByRphhkcevD3nXk3+5BSbklvXT+//hx+xBQFlUzJRrGwyaLqF55M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614798741; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=oFEYxjFynxuNvujTQ+INd8vvNYEulGGn3mpP0DXpTGE=; b=bsk+lGQsgndOpYfwExn/L8JCCYrCzOSdkUFBtIBb+GCX7g+fp6T0acjrfh4xLv5wWEyyfbLoOhbHl3LjxT9Wrw9TdsrRhJZ1fCdhLFtAD4Hh0PREzNAN4EymLbovCJNVzZDtKgU3mwm1B98atXJHW50M2DasXmNmhbkF4yRfUz4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614798741509455.6723019541405; Wed, 3 Mar 2021 11:12:21 -0800 (PST) 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-154-m6WhV2phOIeTiESOgQsIvA-1; Wed, 03 Mar 2021 14:12:19 -0500 Received: by mail-wm1-f71.google.com with SMTP id w10so2158854wmk.1 for ; Wed, 03 Mar 2021 11:12:18 -0800 (PST) Return-Path: Return-Path: 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) 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= X-MC-Unique: m6WhV2phOIeTiESOgQsIvA-1 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=kN5CFAZtQ9yQDeCb9+nTl4UscmOmpuEhBMAxKuksmD05KCAD6N8rc3kog7JvBNBEIN xJjBEh3CW5veGWSHNu/l60Lebjtj3XHF0o+VRmPUp6ldp4OVEDBJkG7wm09b7EF534xR gOEXgUYUbEBYoJjuUxJs0etYvX4P2gqEx3qGjllZ/W31vnNOtX3TFU6uYmjIh77KlyVH W1HfGJlLH1maslJJ6rd5hv7YAzSdDbzLB8D1ErJXZCGCKeunKNrCvoRpund5Q+bwwYq1 0flqnK2VV35Sesgv+rX7sQ1YHGD8FEpnaSBXCMuoAydNfCC+MuyKSbjZa4O2SahbOwSe uktA== X-Gm-Message-State: AOAM531Kn69rLufdho82+3b2d9e/k62ixnoxbj1fe1888RbsOar0ztmu 7cJe7SOh/DVfJ3jemw8RmBRrzonMicyymqAF3W94G4OP8xWo3A0sS3c3exhp0H31Q2c8jingWSI d+Y4xRgtwk/hTfw== X-Received: by 2002:a5d:408a:: with SMTP id o10mr204249wrp.294.1614798737701; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Jason Wang , Bin Meng , Dmitry Fleytman , Peter Maydell , Richard Henderson , Bin Meng , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) 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=C3=A9 --- 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 @@ =20 #define ETH_ALEN 6 #define ETH_HLEN 14 +#define ETH_ZLEN 60 /* Min. octets in frame sans FCS */ =20 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(NetCli= entState *sender, const uint8_t *buf, int s= ize, NetPacketSent *sent_cb) { + static const uint8_t null_buf[ETH_ZLEN] =3D { }; NetQueue *queue; int ret; int iovcnt =3D 1; @@ -628,6 +629,10 @@ static ssize_t qemu_send_packet_async_with_flags(NetCl= ientState *sender, .iov_base =3D (void *)buf, .iov_len =3D size, }, + [1] =3D { + .iov_base =3D (void *)null_buf, + .iov_len =3D ETH_ZLEN, + }, }; =20 #ifdef DEBUG_NET @@ -639,6 +644,15 @@ static ssize_t qemu_send_packet_async_with_flags(NetCl= ientState *sender, return size; } =20 + /* Pad to minimum Ethernet frame length for SLiRP and TAP */ + if (sender->info->type =3D=3D NET_CLIENT_DRIVER_USER || + sender->info->type =3D=3D NET_CLIENT_DRIVER_TAP) { + if (size < ETH_ZLEN) { + iov[1].iov_len =3D ETH_ZLEN - size; + iovcnt =3D 2; + } + } + /* Let filters handle the packet first */ ret =3D filter_receive_iov(sender, NET_FILTER_DIRECTION_TX, sender, flags, iov, iovcnt, sent_cb); --=20 2.26.2 From nobody Fri May 17 11:58:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1614798748; cv=none; d=zohomail.com; s=zohoarc; b=VhSusGdlcNUsupSo8twbAQQ3Fg7NfWaSrP9IYJRjRO0f18rN249+Nd4s6GHZ50JRWzSDjJfOUdKuUlWgAowiOXpRquGjutcJ3Ln6gI7uzVbHGttGcbzk7tmx4COtBBm6pLwdYEbBV+EoQVnWAC55lej453R4yp/wFlHBX+vB3Nk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614798748; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=rkUBN+Qyzi1lTxDF0XgYdWokUl6SLdP1HYpG3c36ims=; b=evFKFPI2CZl9BxPcLZIdELDN5MWrLrZnR/30CsWE/Yk+XyWmdivrdObzRfrzBCO9Q61v/GrO4yd1fJGve0wrzdrj62Oeh1Dogudya63v1F4MjbuPizJr/K37bbYhsOEhQScRJ6YWxMEhIo+n+qFrk8ndjvJaGIYlfoS1wg5dz08= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1614798748848661.3594843475037; Wed, 3 Mar 2021 11:12:28 -0800 (PST) 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-529-6fsF8Y1VPGyXqAVm2F-RFw-1; Wed, 03 Mar 2021 14:12:24 -0500 Received: by mail-wm1-f72.google.com with SMTP id z26so3435346wml.4 for ; Wed, 03 Mar 2021 11:12:23 -0800 (PST) Return-Path: Return-Path: 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) 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= X-MC-Unique: 6fsF8Y1VPGyXqAVm2F-RFw-1 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=BpkpMFOs7xOqGRvJzbK71MokYnXbkcZBltVAqh3q7onLsgCYmEit7+2SZtNa7Gv6+k bN+lH8Jv4ACihfsz9sG/KW4Oz556sBFl/cy6we//aoZFY2l1oTC+Qh6EY8AkBMvSnwsh LaBF3lGOUBxlGgoPpHSWDRsVD/f3YcrcK2niHPs0H2jWU6CGPoPns+NsBSmWM4zCddZJ 8KcZ8nb9CQG1u8X0W94b0qL61k8nOOm1yDabFqhi9cU4rj8LlzoIFBKwfVtHpnlSbl+Y YI9SLuAEkk0v4sKhd1uk4T6cNfgyxmrA1g6CR2OU5udKJJ65AOAwONEi4ETMRRTBKSPl mHuQ== X-Gm-Message-State: AOAM533RsEX2mDG02ogTcZ67G45OnYSqQV233Us4HtrJoisXFdHJKOWr MPhnCEehYiD1HkeVcEHBI9mHgEFBCVarqVxsYkuqihGo59h3Y4cxhjYEUGOonvruH5SiERo57VB qxs+Pb76xuKe5cg== X-Received: by 2002:adf:d20b:: with SMTP id j11mr81821wrh.397.1614798743053; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Jason Wang , Bin Meng , Dmitry Fleytman , Peter Maydell , Richard Henderson , Bin Meng , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) 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=C3=A9 --- 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 iove= c *iov, int iovcnt) uint16_t vlan_special =3D 0; uint8_t vlan_status =3D 0; uint8_t min_buf[MIN_BUF_SIZE]; - struct iovec min_iov; uint8_t *filter_buf =3D iov->iov_base; size_t size =3D iov_size(iov, iovcnt); size_t iov_ofs =3D 0; @@ -898,15 +897,7 @@ e1000_receive_iov(NetClientState *nc, const struct iov= ec *iov, int iovcnt) return 0; } =20 - /* 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 =3D filter_buf =3D min_buf; - min_iov.iov_len =3D size =3D sizeof(min_buf); - iovcnt =3D 1; - iov =3D &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 =3D min_buf; --=20 2.26.2 From nobody Fri May 17 11:58:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1614798753; cv=none; d=zohomail.com; s=zohoarc; b=PQMMCL2j8ZjLLACCEyXFwxN+Ops5jrj8GFmMoHmn2lEsywvp5Q3qkAddiGBBbftTHmX8THxebb8sFVvq4x/TdTr+lA9FekfzJy4t4lLAudBBtrKJVdhnq7qBpTfxcJJ3zrI0Ciswbq+tWJ63aItPmDiEaojqbuuIHrtUU9O/tdY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614798753; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=lI2hg/5TdIAfeO1bSBITqXaKfCArmvxD5CXNkSGoaBM=; b=FmdPoQsPz57+AWCr0KYvH7uHYQez3MyX5WT3xrQPrlQh2Q4jNeky8HQzcyKQs+jyGK8K1KXB8Bv933A5g/CoR9/MuY/JyJoVH+mrmtILAPsQpx/65TFDDcbDYWRi9MZ3KCnofc+v9++iOav+MbQK4DD7TpXKm2GvZ4y2y56c8/Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 161479875390047.105086875986444; Wed, 3 Mar 2021 11:12:33 -0800 (PST) Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-384-3qo1AbqlMV6kVw8uu5EUiQ-1; Wed, 03 Mar 2021 14:12:29 -0500 Received: by mail-wm1-f70.google.com with SMTP id z26so3435424wml.4 for ; Wed, 03 Mar 2021 11:12:29 -0800 (PST) Return-Path: Return-Path: 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614798752; 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=jMA+lMDixm/hwTwObmxSBILrGW1wk4YZp6f2ZUtNFSUYYgQGc7Ljne+qYa7lnc7+d87sDc lCUeEdkdVlI/pp9sCq3bC5FD0TOniqiO7bOWq7wRbwf47Hjg7uzanXpFJc+e/imwD2JCUS HbFzg+QKG5Kf9XSnlBkFOlkThPQMSm0= X-MC-Unique: 3qo1AbqlMV6kVw8uu5EUiQ-1 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=fm08uIymgOrEvJeGOLsqx4X+lzpYPqzs2nDNKWa4Xat+iv2o12FyeWX54PRunmNQUG T/zygh/Q8R1KEuKIVuSsTeu3X3ZWzGlSNt98wOxdkHY3lzsKiwMe125g14Hwqbcf+TbM 900sU3otNttnu/P7DYcfijO9ziIHkmA5yldzZkPNWSr7qMhXEbTe78MOxsy0uGY6BLRF bJp/hYOKN5HH4UVDf9iqybIVUuXCw6ZbMath0pKqEFqzoEtJ4ON3mp4RoiUPIcZSOnsV s2yrJhNnyXstwwUivx326Q+XJ3ggnXDmgilQf2rr5Ol61kklf6W+bAj0YMPH7pANkIci qDmg== X-Gm-Message-State: AOAM531xP/afAJvqGVAdgp1eRAXBojDaoOIfhCLR6PCxWDMLKz6FINgx R7oV9h1KKES2Pk6QRG98PYskqfefzuagGIcwzv6SFAKf82IpABJbeEx6AWA22+ibqLKKbGp8VGQ fWdzzr77LsKC4Sg== X-Received: by 2002:a5d:6807:: with SMTP id w7mr113479wru.103.1614798748115; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Jason Wang , Bin Meng , Dmitry Fleytman , Peter Maydell , Richard Henderson , Bin Meng , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) 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=C3=A9 --- 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 @@ =20 #define PCI_DEVICE_ID_VMWARE_VMXNET3_REVISION 0x1 #define VMXNET3_MSIX_BAR_SIZE 0x2000 -#define MIN_BUF_SIZE 60 =20 /* Compatibility flags for migration */ #define VMXNET3_COMPAT_FLAG_OLD_MSI_OFFSETS_BIT 0 @@ -1951,7 +1950,6 @@ vmxnet3_receive(NetClientState *nc, const uint8_t *bu= f, size_t size) { VMXNET3State *s =3D qemu_get_nic_opaque(nc); size_t bytes_indicated; - uint8_t min_buf[MIN_BUF_SIZE]; =20 if (!vmxnet3_can_receive(nc)) { VMW_PKPRN("Cannot receive now"); @@ -1964,14 +1962,6 @@ vmxnet3_receive(NetClientState *nc, const uint8_t *b= uf, size_t size) size -=3D sizeof(struct virtio_net_hdr); } =20 - /* 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 =3D min_buf; - size =3D sizeof(min_buf); - } - net_rx_pkt_set_packet_type(s->rx_pkt, get_eth_packet_type(PKT_GET_ETH_HDR(buf))); =20 --=20 2.26.2 From nobody Fri May 17 11:58:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1614798757; cv=none; d=zohomail.com; s=zohoarc; b=fV9hg2oK0Fvkio+Ben9tP6LxD8JqpxHi7NpYRxM0ymaMHS6yiBGqvH+sOOZtAmxb/T9BapdFzTnUcU4w2Zluru2QtAN0vtZvMYGtGyHg+UCwqTR5cZmnTPc0/Ke6W/F6NrH0xS47+moA9LPr7X6/fTzVFIV+2EyJJLVeJlkhCY0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614798757; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=+ne5diQd2gxsPBtDDhKD/phqfjDFTA6zzQ5kRhrkwDo=; b=AHOwr0tEq0RhbAk7PeNeUZI2IvaWPL5sS8hZwTXPRNRsvQd3YO6b3XLqR7s3wHOehSqgcT38fl/e1FWRPUEMjVRykytBjuViv/wsBWB6tgHj+EwF/4gIesPc85uylPFHwfvieUzvtk3reqd7FlmNylW0XxFHxf6F1jCzzzvgruc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614798757173551.8347961565553; Wed, 3 Mar 2021 11:12:37 -0800 (PST) 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-524-VEWwvZqqPVaH-T-ivFMzIg-1; Wed, 03 Mar 2021 14:12:34 -0500 Received: by mail-wm1-f69.google.com with SMTP id q24so3445657wmc.1 for ; Wed, 03 Mar 2021 11:12:34 -0800 (PST) Return-Path: Return-Path: 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) 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= X-MC-Unique: VEWwvZqqPVaH-T-ivFMzIg-1 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=ZaFlAeyWRHgBZJKAp6FzTunG/OFNwYCn4HZf/o7/7NCshFBIlp6SJ4chDHxRzns7AV cAHB9UdNdvfktSwoQ4JOMH2Xd8b0WefKdj7AxPtwsyIRPSrUQ7PIr6ZSyDVxc5Dcq91u vPbEqa+w8t4PAO75rj7q+gHR2p9u9XK95VhTg/5QZQNoZ96uG3r5HqvdR9rXIcT0BwPb hgd4Dg9/ApGZfLWs/DgstZRMAr5dg72f+nGeU8xsEWYZJx1pOKWbaFbp0K3Z5ELbXKy6 evrQy0qDrvmuLxH/zhndQmiuXWtGuzIhRn+c3taTN90gYrqPmvh0pWXzchBI3eiVGFgl SX1w== X-Gm-Message-State: AOAM53103mV4f/kZJZrAwcc42hlZblmoNt1iSJ+js9/pKkzx4yMYPggK n871/3qQcotUrWnjPFc4wtuJo6a+C4e8flE0G76gOld/VRduZoPlFcj4bevXycQHO/5zE/Pw090 ySLAuDUEX/KAs8g== X-Received: by 2002:a05:600c:3550:: with SMTP id i16mr422454wmq.170.1614798753381; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Jason Wang , Bin Meng , Dmitry Fleytman , Peter Maydell , Richard Henderson , Bin Meng , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) 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=C3=A9 --- 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 =20 -#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; } =20 -#define MIN_BUF_SIZE 60 - ssize_t i82596_receive(NetClientState *nc, const uint8_t *buf, size_t sz) { I82596State *s =3D 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 =3D 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] =3D { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; =20 @@ -584,17 +577,6 @@ ssize_t i82596_receive(NetClientState *nc, const uint8= _t *buf, size_t sz) } } =20 - /* 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 =3D buf1; - if (len < MIN_BUF_SIZE) { - len =3D MIN_BUF_SIZE; - } - bufsz =3D len; - } - /* Calculate the ethernet checksum (4 bytes) */ len +=3D 4; crc =3D cpu_to_be32(crc32(~0, buf, sz)); --=20 2.26.2 From nobody Fri May 17 11:58:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1614798762; cv=none; d=zohomail.com; s=zohoarc; b=jl4IpCYoedlQ/uMLIQbXsxd2JvUEXK+ltSTrLcV+eTDeEjjbfVpP8z4cBqXLk54QIKqB8mx3ARc4PotQaw/lCsSgmYOd3IKW4hHA7F8PqRDCcI4YNLGbpk7Q2rsBd22shWFDypc5r6wuFSWQyv58nFmtN/y9hVoxQIvoBSFzOdQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614798762; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=rXFV9G0MJ4FvY42CmYEG0oMTNhQmH249ONzv0QeRcyQ=; b=Tfyydq0Osuc/ChydJ95xQswc/MYoMY26QRzZ42Kfa9bov8B85PKDhqfd3ECa0lfQRu/006P6Ui43xmAVlhqmyR0kFiXjD7zB6LT/oGW9oadj83U9pCy8915S9tr5XS8ir9MAJALopbEe3gtmYVnsRqbXuVusYtdXlAn6IC6w4Zo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1614798762264891.3730227184001; Wed, 3 Mar 2021 11:12:42 -0800 (PST) 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-473-OXZnQs5SOIWI5tclEZo-6Q-1; Wed, 03 Mar 2021 14:12:39 -0500 Received: by mail-wr1-f69.google.com with SMTP id r12so9149498wro.15 for ; Wed, 03 Mar 2021 11:12:39 -0800 (PST) Return-Path: Return-Path: 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) 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= X-MC-Unique: OXZnQs5SOIWI5tclEZo-6Q-1 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=qI6PAXypOis7MvcJRQWNNLa64P7hcDn1HhBfKF/cHambku+z5XIHZSEDcNwPGpKWYt HZ37O2Ufm7u1XjaPJkwJySPIc7MsR6ctoiBc4k1xRENrK18j8o/QvR6JrzD1nUJWZMwl MHiwVlDpfHVpQ62C4Hk5JUepqmBlIJ2ao/fmJMFpC7W1K8DUOK2+DBD+nbAVI02Q6E/B ZG0IjuCUvpJ7Jx2+4b8X2LYP+pKxtZ59CQyH39zwMCJU782MBzwK4LQekzS5Jh+WkmdR TURuJwznVUiGtcFFL7xDW4XS5xBTyumEFgo/ZjZZLXxz3vX2asHFxT/1y9P3DaZrG4FO Gepg== X-Gm-Message-State: AOAM532waP/JsPV0MfEzYcb0SY479ojfx6CuBCSd2QAj+lXEeWyj/RrI NF2BESeY2fPhIexFiHpON+OrLUqlDtWvYoD9huiJtHOgooXPCK2RKeTBG5vlCBgDt1JCJBu77bT 7Ff4eorXFqgi/uA== X-Received: by 2002:a1c:7fd8:: with SMTP id a207mr441357wmd.40.1614798758565; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Jason Wang , Bin Meng , Dmitry Fleytman , Peter Maydell , Richard Henderson , Bin Meng , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) 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=C3=A9 --- 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; } =20 -#define MIN_BUF_SIZE 60 - ssize_t ne2000_receive(NetClientState *nc, const uint8_t *buf, size_t size= _) { NE2000State *s =3D qemu_get_nic_opaque(nc); size_t size =3D 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] =3D { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; =20 @@ -213,15 +210,6 @@ ssize_t ne2000_receive(NetClientState *nc, const uint8= _t *buf, size_t size_) } } =20 - - /* 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 =3D buf1; - size =3D MIN_BUF_SIZE; - } - index =3D s->curpag << 8; if (index >=3D NE2000_PMEM_END) { index =3D s->start; --=20 2.26.2 From nobody Fri May 17 11:58:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1614798769; cv=none; d=zohomail.com; s=zohoarc; b=PjXcOKYStcNAcWg8TZusL0OEkfyWp0PMrDvY12xZaEAmGz1NQzmlOhjz/j05yUoeEZUagkQdjnSUPD70fIXuVlRgN/U2KnuNBW4TD6eG7JkxKajSEy7TxpFsshv6jBKh+L1ko57bJtmwACWICuBGhfpL6rgDqzVhCOPRYpydpFU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614798769; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=CouKFTwLkgo/uu4gqqm3VLXBNVa87X4zwN26JBMF5/w=; b=b7RQE8jaYmHNmxz/oBDCj55w1YnamvuI/kdi4T/8Zi6VyJs1sskvNUAB8j/mJpSBn6PHAPCFJ9kYGM62avdMM1VoSEr7xxt19EfZGI21Yc2Mrj5DwjfSNUDnRPcudq6VTeawblya1prPIVl/BrAd5Wc2vKZvAEjGT2AgG9OBdpg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614798769739426.711213646915; Wed, 3 Mar 2021 11:12:49 -0800 (PST) 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-166-oU_v5LSxPP2s1bzLJ4tJKA-1; Wed, 03 Mar 2021 14:12:45 -0500 Received: by mail-wm1-f72.google.com with SMTP id p8so3433678wmq.7 for ; Wed, 03 Mar 2021 11:12:44 -0800 (PST) Return-Path: Return-Path: 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614798768; 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=iE/iJHEsrrr87QYik3pen14Begh76ECjQNafc0KWyGRCv++JFSj6XUk4QUiYos8pFWu2uV YrXJCOj4XOKXf/OdLOSJ1ftVLjfjZFjqSBKrkoXPPRBZ7bJBD3Iw38z3Mrr5zttf3pZJ2T 0Gjbt0vbNuJnQPbQPT5Wug50vfCoCV0= X-MC-Unique: oU_v5LSxPP2s1bzLJ4tJKA-1 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=s55Dt5Q2f6mVw9Fs4HhpAeU0MKnaEQmE7hp9K+DvOCtOTWvKPMrV3Q3QUCXYgXdD5J gS9SH9QWvajshTfnpd0ZO0R62y2+YjXpoEpfNFOGvbY6NEr5M1eaa7LtfF/6RAqVE3Jk Xcd5dCvP24QKqmPmBj5K69EXVtmHUbCPst8jw79IAwReLo6QR5Mo+OGD5ADfOBav8/eJ UusL7VEVgACtT44JEH7ZySI5+f0k+I3qIfGKnkzmrgbSRkCJOEYwyYSuPy14B/HvxgKe mdAtx94K1gxocW6lR2ImJPW6BDdJvzGT2GV759VcRBIit059ea/cwZAZAX7hTp7Rb/5Z u3jA== X-Gm-Message-State: AOAM530CjuZBjp6a814HCI6o7HuIDRclabqifFqFqcjA2+immr29WCfM pDSOirEQldmOYzLNGJ41GPnyxPQIe8kyZLRr87vRdC69xpPMAzDPms5MLB/wE6BNuwldHRqYeda OEymstX7NwXzPIQ== X-Received: by 2002:a05:600c:190a:: with SMTP id j10mr434489wmq.140.1614798763735; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Jason Wang , Bin Meng , Dmitry Fleytman , Peter Maydell , Richard Henderson , Bin Meng , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) 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=C3=A9 --- 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 =3D qemu_get_nic_opaque(nc); int is_padr =3D 0, is_bcast =3D 0, is_ladr =3D 0; - uint8_t buf1[60]; int remaining; int crc_err =3D 0; size_t size =3D size_; @@ -1000,14 +999,6 @@ ssize_t pcnet_receive(NetClientState *nc, const uint8= _t *buf, size_t size_) printf("pcnet_receive size=3D%zu\n", size); #endif =20 - /* 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 =3D buf1; - size =3D MIN_BUF_SIZE; - } - if (CSR_PROM(s) || (is_padr=3Dpadr_match(s, buf, size)) || (is_bcast=3Dpadr_bcast(s, buf, size)) --=20 2.26.2 From nobody Fri May 17 11:58:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1614798773; cv=none; d=zohomail.com; s=zohoarc; b=AMFjf1qCzFNKZz7dIpguCzWKG+RDg2E6xxr9YfrYJkjWrcoK3efYr7WOBJWQBAMJDiIRlvpQNytn/uowT/VMstawZ8vvONIXbEom/Pz+tRArEa5v+0Kcu0hf37Rw7EEYkRGh9PliOaKueWfj6OBxBSNnYUxmtd7zM5PEqx743oE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614798773; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=oQ53tkWrp+KNAV5jr5E0Yd+AAzWqxTKyNH3MXsvMcQY=; b=DNd5NFA6VlkhrK9T3v3qqz/atmSID3m/TpYXZxg0sfx8/wPPBTQo4knJTQKUhAANXaJ9uq8eKn2yIOCIt5UVbM1X+JkRzRREVE9cMKDAL0NY7TcrGiHtKvOjkJ5d+0FdqaBB/fab5QUCI9hmyHFBxu6LT3wB2/iikSwhAKihG6g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614798773053971.0967864249718; Wed, 3 Mar 2021 11:12:53 -0800 (PST) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-430-cKKtimf5MEKWRkgoiFgYgA-1; Wed, 03 Mar 2021 14:12:50 -0500 Received: by mail-wr1-f70.google.com with SMTP id h5so4811762wrr.17 for ; Wed, 03 Mar 2021 11:12:49 -0800 (PST) Return-Path: Return-Path: 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614798772; 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=LmEsp2RvhV1S7jXt9EbRyQXwBu+q7S96RYArIDknEnr8thHPHXKWU8XWDiAJriucs576OG QoXmLjuO2iTWxwj0j4QwIpBOnr/RDwM67v3dyJM9XhNa0h8EaBwNwYHqWbi5Zs8o7y4rz3 6j3czl9jhCAUAe2m6LED+5G1TqxW+90= X-MC-Unique: cKKtimf5MEKWRkgoiFgYgA-1 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=nObw+EgQCCU8zGk0N76sRytggN+g6LJG52KFAwHqJo0pKyJJ5ZyW+BekboFYXhjV9L JMHPJ4zJoxp/7EorhKLWbPLwbEnrzKf7yV8Zw3hxpvPJY+bmJaeEjlgnYF4q4JejOJNg Rl+ieomF7rkmfJSRbD4ZypG8eSj38mAOIApXqugXV+9TJetQ1lYLjHl+eK/Ud6I2Rz4z 5WmwCfisy71C3z5zQb7pBr5vkJ8ORodcOnkQLlcHOUuHURQN2/5LUs83NJIjiAWsbGFa pL3U88UXB77AqkLvfkJQbQx18uY33/UmfrCc4PMBUsYyxQPO8pMkZEGm6PCcAuaYUPGt SBQQ== X-Gm-Message-State: AOAM531Zdb3q4ZHkwqPrGnbVpv+04wTuCV90cleLfDCYuc7R6asdFA0Y R9tZdsNkuy6wE4LLs69cNZKqxjbTJ8XVtETDLlc57sObMSQKFAXjNt/hSY37NUF+ymOLloSMJNk yekVjkkdm298W2Q== X-Received: by 2002:a5d:4441:: with SMTP id x1mr237385wrr.56.1614798768571; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Jason Wang , Bin Meng , Dmitry Fleytman , Peter Maydell , Richard Henderson , Bin Meng , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) 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=C3=A9 --- 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, c= onst uint8_t *buf, size_t =20 uint32_t packet_header =3D 0; =20 - uint8_t buf1[MIN_BUF_SIZE + VLAN_HLEN]; static const uint8_t broadcast_macaddr[6] =3D { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; =20 @@ -939,17 +938,6 @@ static ssize_t rtl8139_do_receive(NetClientState *nc, = const uint8_t *buf, size_t } } =20 - /* 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 =3D buf1; - if (size < MIN_BUF_SIZE) { - size =3D MIN_BUF_SIZE; - } - } - if (rtl8139_cp_receiver_enabled(s)) { if (!rtl8139_cp_rx_valid(s)) { --=20 2.26.2 From nobody Fri May 17 11:58:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1614798808; cv=none; d=zohomail.com; s=zohoarc; b=A1qQyM2ahqKY5mqjhqSWU2vrooF7EYfaddk2QezIcK2cnFXgaQAPHfdMtTAzeWMPJ2Zf/eWutEmhHH+eAjueHpn0LSEBMJw3FsY3N1LaSm84ylfr+hdSPOlE7usmC5k1gfalzs3Aq0jfvQJO7Am2Szqvyu3aBr2gD297UuwWBmo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614798808; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=A+1d1LK3/7O/279IVj+Ph/XHu1RN+wl0D3hJoCw8j8k=; b=H2b0NnToNmbkTUOFAcK57wV8hVUYfS1vwmfUH/LB/bSWpMr1zbKwN0hYINsa0sf+zdYHVMof6A85tum3KIxgcxeQVz5RFB94J7L9qY+8jzanQ57S8jwAv5PmVaz7C5gYLgQmTpgptM7p2HctgbpOSvJ+GktL4k/UQclph50qgZc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614798808374459.51057777724327; Wed, 3 Mar 2021 11:13:28 -0800 (PST) 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-566-cC4giK5kN7mFmonrqL62pg-1; Wed, 03 Mar 2021 14:12:55 -0500 Received: by mail-wm1-f71.google.com with SMTP id q24so3445973wmc.1 for ; Wed, 03 Mar 2021 11:12:55 -0800 (PST) Return-Path: Return-Path: 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614798807; 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=USDhtXk/bB0Z0KYBeYEy/d7C8W2H7RXv5JMARAqXsYGMAIV8W/5zhQAaUDaHodQZevvdJ+ JegssX5dC6FqtIG/qQ4tdkgQdT89V+d90Zbe0IC+UkUfIxW+wpTSaGLJSvmwnblNSGLQoR 91XTJCHpqed3sI4difki0tKCOclTeDg= X-MC-Unique: cC4giK5kN7mFmonrqL62pg-1 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=ahoS+Hr97SP1FzsHOVLfFnB2eMq9/w5FAG/iTGik8rB3VBXMjideU8fM3iwbwARUeE lpCHLDOBecdLP6T4w1s1ObeYVlIVUUPrdRQV/lHupxJSugBmbemkcpK4PRGvwHZ/pnnb UtONBLsWAgETc7oOxptKzZNIN3X73o2HTbLd64jHchqf87EN5J9CDevJ9FgnjOVLWynp axj2Wl5GIGJZqXidnA5K54x6icMaxCeE2AScgsGVR967VQjg+QZ43vNXpiroHLOqfIuy 9NIovREWLWjWHKMZU44Lsino1CLEIyIvXhjH4HMYcNIV+NKLnAlOLW9mifUB3iftogjy 3AZg== X-Gm-Message-State: AOAM5321htkBpKn/x5/YvG3d6UczW48wI8tsMFjrwR6R2qUFLEgrySOs fu1C4G/UPe8rj1wQLlNKzYf86EFpU2DoyDIPs2iKQUXxNEbyIuElDMfSNmPeGMHfUUXabwdL1Ho Tinbz9smMDsjaUQ== X-Received: by 2002:adf:a3d3:: with SMTP id m19mr243072wrb.24.1614798774332; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Jason Wang , Bin Meng , Dmitry Fleytman , Peter Maydell , Richard Henderson , Bin Meng , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) 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=C3=A9 --- 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 =3D 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, cons= t uint8_t *buf, return size; } =20 - /* 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 =3D smallbuf; - size =3D 60; - } - /* Get MAC crc */ mac_crc =3D net_crc32_le(buf, ETH_ALEN); =20 --=20 2.26.2 From nobody Fri May 17 11:58:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1614798784; cv=none; d=zohomail.com; s=zohoarc; b=Zip+BwS2ff8GFuWWYPvn5o05BsIRPOefxwoULZEFm1qOXSd3Uu2hOAD3LQCZYRiJ29+AM4yoiik1fdyTv9BuNm/94pLS0q/4CCmgTSTClWkaQ2/PbpRn+tBretwe+sa+G3gKwVg2aVfMgZ+53quAE9IkgDWwFveOr1VcLSXJ4Mk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614798784; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=BuH4+Q0BM50iRTQU72DhaJAvYxJTYB/CnCHI67AXPbc=; b=VIXn7zTlKudfetTrslHialTwo0Nm/6dyonXI0aWrpJEtvP0EMyOum4D+TJG059hl/AllKBgp6KZJh3zd66p6vOtIjRBQnu2Jbl5vIwvyw0/PGatrYHwFfu124tncxo91Zl1ne/Cq0hj6U2ZfnB4/sinaNxQ0X0Xysa4wkOjg3I4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1614798784185993.0344056021484; Wed, 3 Mar 2021 11:13:04 -0800 (PST) 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-477-qUbvYbccMheVq5h8m25lcA-1; Wed, 03 Mar 2021 14:13:01 -0500 Received: by mail-wr1-f71.google.com with SMTP id v1so2696550wru.7 for ; Wed, 03 Mar 2021 11:13:00 -0800 (PST) Return-Path: Return-Path: 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614798783; 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=B+vdZjKWScTr9KKY3XJ4tK6wrmj8o6sC0lpDqfIubPTqo+Z5CgNbi6jo5t+oUfK78zFkoo 320qKQqwIeLnw8/LRkPm9QTZFJB0a9bU3uGr59YyBsii/kdmoT6Rsqk0a/tVzSf7pyQAe2 e24MUpDukZyanIMx8wmn7oWB5VGteVk= X-MC-Unique: qUbvYbccMheVq5h8m25lcA-1 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=Se1m7jXx6XD2SHXSO2gyHPnywx7RdzS6MyeeMSPiUZZlUtO+hBJGSjlJncJNUxtNyq IQjabjXkZVuMgs01Ye422OQMlp9n0t6GREcQlk+X5mINmqbzYpft3t1FoITKsA0fpv15 W3qiRP3jkuPNjEtPwbUuKb1NmLYovc6Li4LzF5rf4ZfnK0qdEgDpRvnjp34Ou3Uh2E/g j+QrRF83mBTnRb5bKol0khBwkWOk5slsaBL6eG8lpjm4wTnNvJ+NcMXUiBeHpeu3g/25 5O9nwzk8ZkXAPorM6RMs/LxRi4ybmHKM5SEmuIbDr4FpxUp6H6KrgxZ+ZAc1rDuFqZ+5 wVXg== X-Gm-Message-State: AOAM532S1K1wWMOf5cqROa9PsIYGUdoUt8t8oLMFiDGkIX6dwr4phYYn TzqIQuhGVaz92ItfTNpeFhz1QUsrc4K3CrZtGbxvFfVgrAj457fwtjkTqMufnfmDb0SRaeZUWyg 1ZI5Ufu3WS+RhnA== X-Received: by 2002:a05:6000:18a:: with SMTP id p10mr224945wrx.166.1614798779294; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Jason Wang , Bin Meng , Dmitry Fleytman , Peter Maydell , Richard Henderson , Bin Meng , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) 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=C3=A9 --- 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] =3D ring; } =20 -#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; =20 trace_sunhme_rx_incoming(size); @@ -775,14 +772,6 @@ static ssize_t sunhme_receive(NetClientState *nc, cons= t uint8_t *buf, =20 trace_sunhme_rx_filter_accept(); =20 - /* 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 =3D buf1; - size =3D MIN_BUF_SIZE; - } - rb =3D s->erxregs[HME_ERXI_RING >> 2] & HME_ERXI_RING_ADDR; nr =3D sunhme_get_rx_ring_count(s); cr =3D sunhme_get_rx_ring_nr(s); --=20 2.26.2