From patchwork Wed Mar 1 09:01:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13155675 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 7F598C7EE30 for ; Wed, 1 Mar 2023 09:03:09 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXILx-0004CP-Bi; Wed, 01 Mar 2023 04:02:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXILm-0004Am-Ez for qemu-devel@nongnu.org; Wed, 01 Mar 2023 04:02:14 -0500 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pXILk-0002mX-L9 for qemu-devel@nongnu.org; Wed, 01 Mar 2023 04:02:14 -0500 Received: by mail-pj1-x102c.google.com with SMTP id h11-20020a17090a2ecb00b00237c740335cso11275572pjs.3 for ; Wed, 01 Mar 2023 01:02:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nPoeDtOvmGxYvwpMM4bXj84/8ik0pjk8FjiBqOPYuhE=; b=V1eP2P6bVL6EZ8NtR0FoH+hMQDaC3+HgrcvRutGifIsKSIwO7VaMUL3PSp0waG0i3E 22H3g/OLJzNXpr5MU1KHNUtW82rxYN75k1yYHneu0G+wk/UU46Hg6B6QCU1GQmHpcRKr Fn+X3/I4pCpgSNQXEtH3BulXsFbhHfrzwQkGTqtxjuJ35hOz0/ud2w1+8wxrhpyzasKl ZgiP3M+eTq/DN1SfKmdAe/opIhJiO66oA0+lPZyOy/8lkW/DabOrjRzqwgO6PhVx64nR 9NZT4NnvMCEdZJTneChPKqKe/ri0BRK+q5oj3J6DlGgzHF71Q3+1OumnAfh7I13UBW+a eYUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nPoeDtOvmGxYvwpMM4bXj84/8ik0pjk8FjiBqOPYuhE=; b=lcPLnZU4wPIr9qUYFAz9FKhnxYCXu+kuZJb6XNXJDum51pmjWpYYlc5eG/f1aE1S60 UcjODcSf2UqR2sEtF0V1c+OJ6R0y542N32DNvnDtjITbGs4ALN7CMUK3+l7KPQvqF/jk ZU0Ifog/HWOU6dff9u+S6RPEPU+d7BkST+gxIlhyno+8wMUuBrgclkXw8RayKgmOvrYb VgmknRevNKY+JNmKK32dXx1dsEfgMpJtOcZt53Pt75xWmrfND7vRT6PdgtisccR4nc/w OxpvZwmj277Y843JIkPoHs/C5/aD8jFiPxHXKyg82mlu9462EaJLYlY7ZvQN9/sxfGdz G3Yw== X-Gm-Message-State: AO0yUKWzoH+cI8wV5VRF1mbSer1CU4H6sIsbcAJjkp71AqLtEiYGHe96 xGl2dVR71wPpUnWv9W9qGz8= X-Google-Smtp-Source: AK7set9VZmFJHNcb+Xg/EWJ/uhYWtgo3SlBI7GIDxIh2uuzIaRXhiNqJZo/WtvWf6FeQseUyepijlA== X-Received: by 2002:a17:903:228f:b0:19b:33c0:409e with SMTP id b15-20020a170903228f00b0019b33c0409emr6823864plh.50.1677661331158; Wed, 01 Mar 2023 01:02:11 -0800 (PST) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id iw6-20020a170903044600b0019aa8149cb3sm7878991plb.219.2023.03.01.01.02.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 01:02:10 -0800 (PST) From: bmeng.cn@gmail.com To: Jason Wang , qemu-devel@nongnu.org Cc: Bin Meng , Bin Meng Subject: [PATCH v6 1/8] hw/net: e1000: Remove the logic of padding short frames in the receive path Date: Wed, 1 Mar 2023 17:01:56 +0800 Message-Id: <20230301090203.1601925-2-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230301090203.1601925-1-bmeng.cn@gmail.com> References: <20230301090203.1601925-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=bmeng.cn@gmail.com; helo=mail-pj1-x102c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 Signed-off-by: Bin Meng --- hw/net/e1000.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/hw/net/e1000.c b/hw/net/e1000.c index 7efb8a4c52..d9637cbc6d 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -908,7 +908,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; @@ -924,15 +923,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 1 09:01:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13155673 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 2D39CC64ED6 for ; Wed, 1 Mar 2023 09:03:00 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXILz-0004Dd-WF; Wed, 01 Mar 2023 04:02:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXILo-0004BO-MG for qemu-devel@nongnu.org; Wed, 01 Mar 2023 04:02:23 -0500 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pXILn-0002ms-3z for qemu-devel@nongnu.org; Wed, 01 Mar 2023 04:02:16 -0500 Received: by mail-pj1-x102b.google.com with SMTP id l1so12667081pjt.2 for ; Wed, 01 Mar 2023 01:02:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=x6vp6dv83Vf40I3tbMcnSG4AhIfhnL/EIy8Bk2DCRgU=; b=eoomrohaLX13B+Nj4oZsGO3UqZvMuRmP6pWAyWatXmMMKtxkUDfOUM4WWgTSXyUhkR Pvzzsm5VBXUHjrIDXr6p/WNzc9Wvrb6fe0BPmzDV8XOiG8YOsBX17zNyDegi9qaTpfQk PWvjkpWCyuwyMqszSHElG3QmvukF0aOtU25KEra6RtJDEx80NnDshvaFR+UPlCOjUBY2 QOgzsmLbySYCC8L6E/Qi3vizdbZ/Zht6G/x//fw/C/UP9lWa2KvmOOrkKJXABBSaro4l NuzQrKhmcRufaq6i4IrFljZidnF91ZCUGf8cNfFuqdcUsdGDyijdP80xYmFsh9U2b+3+ HGMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=x6vp6dv83Vf40I3tbMcnSG4AhIfhnL/EIy8Bk2DCRgU=; b=RSShOkptLaqXc4QcjIc9pzNgJiMFFuThqTXYiTITmRJYcndTDOc2E2qEZCzUDYNeQK gTls2ceIc9/rjk4V4D+rF3zFxkfCsOexm6znBnqzPfia1lJ7KLy+xZpBY11hivRQ3fSW nIBBG3Gk+Pn8zUwzUFKUo8BEB9ycp8xT+pA5kTCLJC/GHUxO1vrY4e3EgaxkBM/QVQh8 WQtgTCdkP/SvhTxMdf/HiCDtU76+G6p5G5SioDsMUWDoTyYyMkIWOJiKvlCq4vu4Am1t Kx2UaAg4Ds4RrN6KS4VS1v19DLDNw/+0Lp2yDbudMHHTTgDb3SibbFeIewMEXfE82bUe BpUg== X-Gm-Message-State: AO0yUKU5feVLk+rEGkvy/XsiJhV/gk+hGbynidsz59P2M1NScW0+D5u5 F3L70+a7qXDrxbfBXFU7xZ4= X-Google-Smtp-Source: AK7set9Cd1Z9sQ7WfRZBZmWXpNnfZJvK0FBanxn9yYOVrIRRNILxCBxce+ieIoIiJQzqDkUvABjgWg== X-Received: by 2002:a17:902:e74b:b0:199:33ff:918a with SMTP id p11-20020a170902e74b00b0019933ff918amr6946023plf.21.1677661333471; Wed, 01 Mar 2023 01:02:13 -0800 (PST) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id iw6-20020a170903044600b0019aa8149cb3sm7878991plb.219.2023.03.01.01.02.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 01:02:13 -0800 (PST) From: bmeng.cn@gmail.com To: Jason Wang , qemu-devel@nongnu.org Cc: Bin Meng , Bin Meng , Dmitry Fleytman Subject: [PATCH v6 2/8] hw/net: vmxnet3: Remove the logic of padding short frames in the receive path Date: Wed, 1 Mar 2023 17:01:57 +0800 Message-Id: <20230301090203.1601925-3-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230301090203.1601925-1-bmeng.cn@gmail.com> References: <20230301090203.1601925-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=bmeng.cn@gmail.com; helo=mail-pj1-x102b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 Signed-off-by: Bin Meng --- hw/net/vmxnet3.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c index 56559cda24..ea01b1f75f 100644 --- a/hw/net/vmxnet3.c +++ b/hw/net/vmxnet3.c @@ -40,7 +40,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 @@ -1979,7 +1978,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"); @@ -1992,14 +1990,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 1 09:01:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13155679 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 2518BC64ED6 for ; Wed, 1 Mar 2023 09:03:44 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXIM1-0004EJ-9s; Wed, 01 Mar 2023 04:02:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXILr-0004BP-KG for qemu-devel@nongnu.org; Wed, 01 Mar 2023 04:02:23 -0500 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pXILp-0002n7-4t for qemu-devel@nongnu.org; Wed, 01 Mar 2023 04:02:19 -0500 Received: by mail-pl1-x62b.google.com with SMTP id n6so11892304plf.5 for ; Wed, 01 Mar 2023 01:02:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BZ8AkG9QTobJMyOjnuuHxMJCe9FqyNNvl3I0MN2F60s=; b=oT4Lfx1XL6L0s2l0Tw+As+Nq9LbEmt/EQqG2UHjRyb3wqL5ytMt+9qGN5ppSEklLEU WpnThplaDWE83g0ksIGzEGf2pGRNqIyA6XS6EZ/ic7djXsIL90foUesP3e6sRuL1UqR8 wl3VlAJugbxig/ccHXGZRCbsi4B+3XxKMotXtWfpdNL4lLEc2IZswp/4feJTSmQXxbl2 gVHjgs/8W73LOrCYFicqSB9Ol2yzDtksnpcfN35WCHHlGGL9hoObpyqQ9zxSJh6W7Biq A7m4OVWvHZTnXdoSEnCeLhqgletDZAbKNjQ9jKmjFjpgA2pQq4ofF3yyPcgel+oCIs2A 5wQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BZ8AkG9QTobJMyOjnuuHxMJCe9FqyNNvl3I0MN2F60s=; b=gA39s6A7gcv7nTxy+eYlPQuQlztokIIzBZE6IIO1s2A23JwYo7eRT2LwmTR+eGgvG1 oUysgPqluomo/URC/KM1gX+0szzP3phVBNGmd/mGT7Ob9Q85X8nl5RevMzgcpGP10akA Ol1nYLOxHiywnGNtuBtQIJr2ioBmcLdru719tlef/WHWg/cLrQR5eqWbzmGXlIsoPu5G jL/3CNQ/ukLQNKdOkZBdhaYerxP0ysaFEyY0ZHL6SfyAYMPek2EtzwKHrkeuzSuVzz+D fe6zl5giOd6L2yyeNTAiJkajRn3K7sHN61CVOGZTOWoY7VGQWN/I+LEKIuym7FQA6omz nUqA== X-Gm-Message-State: AO0yUKXgy3oUm8myvzS0Us4j2IdHaDxBBXTj8F60W8NpXc6CdB3tfS71 HurU5XButtML1OensfQdRsk= X-Google-Smtp-Source: AK7set+gBDgokJSgzNQDhK2Bb20YTJ+vx8V+koZjeCdDT96LIcHdUmTsoNP353t66jGypaBrvIcYgQ== X-Received: by 2002:a17:902:c407:b0:19d:5b5:c159 with SMTP id k7-20020a170902c40700b0019d05b5c159mr7492406plk.1.1677661335880; Wed, 01 Mar 2023 01:02:15 -0800 (PST) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id iw6-20020a170903044600b0019aa8149cb3sm7878991plb.219.2023.03.01.01.02.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 01:02:15 -0800 (PST) From: bmeng.cn@gmail.com To: Jason Wang , qemu-devel@nongnu.org Cc: Bin Meng , Bin Meng , Helge Deller , Richard Henderson Subject: [PATCH v6 3/8] hw/net: i82596: Remove the logic of padding short frames in the receive path Date: Wed, 1 Mar 2023 17:01:58 +0800 Message-Id: <20230301090203.1601925-4-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230301090203.1601925-1-bmeng.cn@gmail.com> References: <20230301090203.1601925-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=bmeng.cn@gmail.com; helo=mail-pl1-x62b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 Signed-off-by: Bin Meng --- hw/net/i82596.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/hw/net/i82596.c b/hw/net/i82596.c index ec21e2699a..ab26f8bea1 100644 --- a/hw/net/i82596.c +++ b/hw/net/i82596.c @@ -72,10 +72,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) @@ -488,8 +484,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); @@ -500,7 +494,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 }; @@ -583,17 +576,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 1 09:01:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13155681 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 935B0C64EC7 for ; Wed, 1 Mar 2023 09:03:57 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXIM2-0004Ef-3b; Wed, 01 Mar 2023 04:02:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXILs-0004BR-NC for qemu-devel@nongnu.org; Wed, 01 Mar 2023 04:02:23 -0500 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pXILr-0002nN-8s for qemu-devel@nongnu.org; Wed, 01 Mar 2023 04:02:20 -0500 Received: by mail-pl1-x633.google.com with SMTP id v11so9746400plz.8 for ; Wed, 01 Mar 2023 01:02:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bR3FRdQWQGBH8ttmejZMVXzSfOR2rdp5N4y48mjA/eU=; b=PLJKHnMpll0rtX9ZGJ+4GFapGyN6tFlowy/jm24Rse53PCD1RjN28Ms3he0UzyUwrp P2QincGGFzmVeNKj7X1htAaenn+YIhw/PkGZSREaeqDDYHjq/P41zHyz5ro+ko+GAcn5 AJXkbpafrLAESg6zh0mQ/KhvKOFVlzorateyvfYhI3iLMDa8K9w5QoJE1dJpkS/OogT2 ZTk5mpmilTLctBBYt/4ZO2JJNOkzduXuXu8UQuyhMKrKvIueun4jLt+nmXg0iA7ojm2J 8qH19ngrD8ZEokgbccTrfeOcQ0xR4pd/7/EWYS5H2SGhSFRLer5a77ktzgLdk1UBCNUg TTdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bR3FRdQWQGBH8ttmejZMVXzSfOR2rdp5N4y48mjA/eU=; b=RezxqXcu+5dB1hHTIqvITQ2II6ILf1z5PKhLLtx+IFDtZD2HxS3CZRM3l8j5rsOsuB ijw0DiyobxuufiOCGk+0x+klIewq739Mn5x7mHPbu5zmWwg4ms+ZxPCdPQF5kLR64+QD HvWjmPOmM9W2I+VEFEWfd69O5BbKawDp20aaQqHGS81V8DzjELxxKq1G7jFqdCz2JmuE Tf5h4vPwyq00zT96kjGRpLCWQT6K1bAeYoGj4JjN5tQTD1mKZbvXL5CbaIUJiJQ4P4IS 6P16RIwnDZx3Sf07B36Psf/kkXaBQr8yGQfYOtMnWkbU5Y28guUtVJrguRvXzKoWwie3 ERzg== X-Gm-Message-State: AO0yUKVtLiqfmgUGrNDAhsEf7eN1HCQLHsihro0VgYY0f5BVIj5npfvZ uIiHo74dHey9f5OpPgfCSQY= X-Google-Smtp-Source: AK7set+GvU8FAXva4mEKXVfijtDysbl3WaKuMpR/5C5lpddUWDUJyOmxRyBwAk7FKuLgIky1gd4Ccg== X-Received: by 2002:a17:90b:38c7:b0:237:8686:1b78 with SMTP id nn7-20020a17090b38c700b0023786861b78mr6803057pjb.12.1677661337897; Wed, 01 Mar 2023 01:02:17 -0800 (PST) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id iw6-20020a170903044600b0019aa8149cb3sm7878991plb.219.2023.03.01.01.02.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 01:02:17 -0800 (PST) From: bmeng.cn@gmail.com To: Jason Wang , qemu-devel@nongnu.org Cc: Bin Meng , Bin Meng Subject: [PATCH v6 4/8] hw/net: ne2000: Remove the logic of padding short frames in the receive path Date: Wed, 1 Mar 2023 17:01:59 +0800 Message-Id: <20230301090203.1601925-5-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230301090203.1601925-1-bmeng.cn@gmail.com> References: <20230301090203.1601925-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=bmeng.cn@gmail.com; helo=mail-pl1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 Signed-off-by: Bin Meng --- hw/net/ne2000.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/hw/net/ne2000.c b/hw/net/ne2000.c index 3f31d04efb..d79c884d50 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 1 09:02:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13155678 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 63747C64EC7 for ; Wed, 1 Mar 2023 09:03:43 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXIM2-0004F1-Qd; Wed, 01 Mar 2023 04:02:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXILx-0004CQ-2r for qemu-devel@nongnu.org; Wed, 01 Mar 2023 04:02:25 -0500 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pXILv-0002nj-4O for qemu-devel@nongnu.org; Wed, 01 Mar 2023 04:02:24 -0500 Received: by mail-pl1-x62a.google.com with SMTP id h8so9975256plf.10 for ; Wed, 01 Mar 2023 01:02:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8Jom0mo8a7rLZDLeUuzG8/w1CotxFmoY2CGtNaw29Hg=; b=PJwSQRpsd/OBUIT0hrWNrgQiScw9HjVo1LQH9HDixsikTazEvXeBdfIx0PFOgjjV/m rfunMnFa26YuoxcelSGcHcxFzvWkJh+518dTuq6K/DK+Or9Brbqu4JagrPeLjTLNyZUs cwSZ+7Sn2h85MyIqfE91gaWOrTKOjwAG1lfosKPBBFbCbA0HJAWcYbWzoSs9gsxLhwSH zA/FCN43hncRvRruNnnhGtInMYBhbJRkciCA4UqpXXtEJF+T2PPDWIBstqkm/ATzdHtR 67VeUYeFT1m6IiijBUw1nYk6xqb9VD6iPIMBZJIwJFX/2KuwFyq11Nhrn7VSjM5m8m2J +1rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8Jom0mo8a7rLZDLeUuzG8/w1CotxFmoY2CGtNaw29Hg=; b=ebxENwQxqstFBzfo6CvP/j64opP2u/XZWFNE04BW9z0TkdLMPD40AYI6WCrQ4Z9Dao plbEHk9978Im4Zjq+/bhHCUQ6i8kI4vkuTZY5pUWp4YHmT3juRZry7CsfdY+roYAhLzJ LkC9gJmrsDlbcaOVxTYI0z7bQQy4TiiQymo1QmWA3Npu645Q0sIJraDXInCBl/ff5xPc 3zwHEQ4OAoFYQFqEjpIOmbhQOD3c+WRqrQeGKUDuS04ErZ0mHUOeD2OCIdmddZwOI8l/ +L4wvJwDTct4xGVEBvo5AzPMCFMidyqXj+QMTcSixkixjKKzWBIY2qpK7mzPMr41GEDC R3/w== X-Gm-Message-State: AO0yUKWILdsUfe6FH9+FIOxkN+id0wwzOH7Nqj+JCSmjLanQQfDCSeOf h2L+tP4QxLMBxzKF43S9/F3s/HOA48A= X-Google-Smtp-Source: AK7set/0NbR1PANtNTYmwLXGAyqFosxffHAoz3Za84TlPKCoxXCzoxwiLI3vhLecATag6+iA/FV8Lw== X-Received: by 2002:a17:903:187:b0:19c:b662:e216 with SMTP id z7-20020a170903018700b0019cb662e216mr6566066plg.69.1677661339963; Wed, 01 Mar 2023 01:02:19 -0800 (PST) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id iw6-20020a170903044600b0019aa8149cb3sm7878991plb.219.2023.03.01.01.02.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 01:02:19 -0800 (PST) From: bmeng.cn@gmail.com To: Jason Wang , qemu-devel@nongnu.org Cc: Bin Meng , Bin Meng Subject: [PATCH v6 5/8] hw/net: pcnet: Remove the logic of padding short frames in the receive path Date: Wed, 1 Mar 2023 17:02:00 +0800 Message-Id: <20230301090203.1601925-6-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230301090203.1601925-1-bmeng.cn@gmail.com> References: <20230301090203.1601925-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=bmeng.cn@gmail.com; helo=mail-pl1-x62a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 Signed-off-by: Bin Meng --- hw/net/pcnet.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/hw/net/pcnet.c b/hw/net/pcnet.c index d456094575..02828ae716 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 1 09:02:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13155677 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id A5A2EC64EC7 for ; Wed, 1 Mar 2023 09:03:30 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXIM1-0004ER-P5; Wed, 01 Mar 2023 04:02:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXILy-0004Ct-Aj for qemu-devel@nongnu.org; Wed, 01 Mar 2023 04:02:27 -0500 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pXILw-0002o2-R2 for qemu-devel@nongnu.org; Wed, 01 Mar 2023 04:02:26 -0500 Received: by mail-pj1-x1033.google.com with SMTP id qa18-20020a17090b4fd200b0023750b675f5so16506737pjb.3 for ; Wed, 01 Mar 2023 01:02:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4REMxXLq5nMhxUujFS74vlm3meLGVHAvBOdhv4pig1E=; b=b5GBVzAXMIGFgSaCzUIm1hv7bxuHxM/b/4QC8+C1/Np1V1HAu2fIgsIONIzymiq2L5 dxPvlRmieYa+knt6wbrPqHXlKsJkn/xCvl2QAH5VVcnq/1UbAmC+zOWYhrpuenM9h7ft pbcZSj4Q5G8i/IiUJF4o+hZiqHTiD6Bm4tFv8JpCHV080Wkm83omEV3wM9MDdtS7yJQA pbIC974i+lCUqe2478lIDx6ChkcgKuPLv6Luddb9p/GtVAAkHLt3E/xMsX5OuDb161Jd Ud2oZCNIWMXcYYGFw/o2k1Roa8XEWJIXCr8ASABsLweoaTgeCH2/LuycSVCYuvZdg1+7 k67g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4REMxXLq5nMhxUujFS74vlm3meLGVHAvBOdhv4pig1E=; b=VDPctSjF/YCGaDv1hxvB89zE6EC3d3qgNtwscVOGKiP2koarvQavMvo17TDFq1p89A eE3p/E/5LBaN2C2+1c23aTaLzJAbtG4cw+edjR7pYqu9OMcGhxHZzZI9U7h54yQqOdwS 9GqrlXexy26QuVFHK9U0RkzH7h8OuYVYcxmHEQm/RGaOz+DUR4zY2TzCUiAXCvt6+yT9 eJ2zbGhbQ4Iwqno/hkQXeC2dSOEh/rjciohc2Q3cQHJVZlJdc8jA2hszdzSJn5NzzHEX Hk+bIYwWCv8oI+VKCz5XpGsk+XiUQi1OCAbC3TZAetKkQzEQo5+HgR1k6paUCFZuYy71 L0Og== X-Gm-Message-State: AO0yUKUtsorCi5QF9TFLfKcgTVkyL3CWoEaRSwWJo8gxjC9eSVzjbdln b14gW8gRWLXfpsKJpFvsCa6qGARypmQ= X-Google-Smtp-Source: AK7set/3SZeFakrh7RHMv/DTYL3b22fdAH7ltifODiVW62GZYaPPE1GqBUdBJQNPaeRRQyzc6pSX/g== X-Received: by 2002:a17:902:a606:b0:19c:fa22:e984 with SMTP id u6-20020a170902a60600b0019cfa22e984mr4730997plq.48.1677661342027; Wed, 01 Mar 2023 01:02:22 -0800 (PST) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id iw6-20020a170903044600b0019aa8149cb3sm7878991plb.219.2023.03.01.01.02.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 01:02:21 -0800 (PST) From: bmeng.cn@gmail.com To: Jason Wang , qemu-devel@nongnu.org Cc: Bin Meng , Bin Meng Subject: [PATCH v6 6/8] hw/net: rtl8139: Remove the logic of padding short frames in the receive path Date: Wed, 1 Mar 2023 17:02:01 +0800 Message-Id: <20230301090203.1601925-7-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230301090203.1601925-1-bmeng.cn@gmail.com> References: <20230301090203.1601925-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=bmeng.cn@gmail.com; helo=mail-pj1-x1033.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 Signed-off-by: Bin Meng --- hw/net/rtl8139.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c index 5a5aaf868d..a52b961bda 100644 --- a/hw/net/rtl8139.c +++ b/hw/net/rtl8139.c @@ -826,7 +826,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 }; @@ -938,17 +937,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 1 09:02:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13155680 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 3415CC7EE30 for ; Wed, 1 Mar 2023 09:03:53 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXIM3-0004G2-Lj; Wed, 01 Mar 2023 04:02:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXILy-0004D5-T9 for qemu-devel@nongnu.org; Wed, 01 Mar 2023 04:02:27 -0500 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pXILx-0002oN-B8 for qemu-devel@nongnu.org; Wed, 01 Mar 2023 04:02:26 -0500 Received: by mail-pj1-x102b.google.com with SMTP id bo22so1089507pjb.4 for ; Wed, 01 Mar 2023 01:02:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5E5DVE4eB+QRDYi6pDSGyhfGQbeGfFsis7Omg79ptfs=; b=PteInzrMzo3FCKypBT/HV9fh9VHUwZ5+7ghUgmVO3IyrXglIOLZIs1mrQgp2O894Yx 1hmSZUiQ3UY+6TnjxfLGspy2PW60+CPxiOgCJ7WsmQMEI4WExG/sfOaPhdzu97kzxy1J Kfpxa2uKRu5Dh+3QbRqxzyszLhpfvgSXp7nBrSazFXJKGJB9ck8VvQ3qn+62DOauic5C cjh0WgDXFrG64RKeB4U4EBxsVPUvu1l8qKmglgSLoN32cD1fAQwP1/TYlnOnLy/bxAc8 klMgL7NbInthXX1z9Zh71UZbakwfQr88eU/JNZ+uoB7e8mMwa1HO8v6M8QBjv7rIqvx6 2ZDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5E5DVE4eB+QRDYi6pDSGyhfGQbeGfFsis7Omg79ptfs=; b=AzwdLllsLoTUcKfXk57THTThKZUDYAoFW5Yq5gu8gaq+6Saj1zCRzgqovddNFYss3z 3Nj+abY/lN99a0VfT/n12lAnjdXd84aQJbnTarUrF3uX5MJsZ3798quBwVoQhJIg0cVE DkXQIDSu5WN0ZzTjlKq/9dsaHoWmbAYw9X0g4ocqC2sztC0BkO7FVAcE9hPJSlNErTk0 Yy/Z9TVUYvHWy5zFvhgXlP02dqMkG9e1k4lgDhxgBJEgPyH+5/nGaFNzRxTrOQ7w97SM fP60o3TtZNeP6zJyEgqvn4s28K5BYlbUz9BgVaIyUjIyOu6QZwkoej45MN83aeWDTT76 vH0w== X-Gm-Message-State: AO0yUKVaeF3s8/yWS1KmLbCyw5ILdvAGnAPMwie8ZN03MD02iWQydEyB ED1CW6I0cMe8doBY85eFSPk= X-Google-Smtp-Source: AK7set+SKsMStImEQ+nHc6IaxDIUM3+u3p18g1/wBIIlMBFyx8zwDwRanaZkRtIZzBGd0J27Q4aUrQ== X-Received: by 2002:a17:903:244f:b0:19a:7217:32a9 with SMTP id l15-20020a170903244f00b0019a721732a9mr6851278pls.26.1677661344145; Wed, 01 Mar 2023 01:02:24 -0800 (PST) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id iw6-20020a170903044600b0019aa8149cb3sm7878991plb.219.2023.03.01.01.02.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 01:02:23 -0800 (PST) From: bmeng.cn@gmail.com To: Jason Wang , qemu-devel@nongnu.org Cc: Bin Meng , Bin Meng Subject: [PATCH v6 7/8] hw/net: sungem: Remove the logic of padding short frames in the receive path Date: Wed, 1 Mar 2023 17:02:02 +0800 Message-Id: <20230301090203.1601925-8-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230301090203.1601925-1-bmeng.cn@gmail.com> References: <20230301090203.1601925-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=bmeng.cn@gmail.com; helo=mail-pj1-x102b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 Signed-off-by: Bin Meng --- hw/net/sungem.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/hw/net/sungem.c b/hw/net/sungem.c index eb01520790..103376c133 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 1 09:02:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13155676 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C0D14C64ED6 for ; Wed, 1 Mar 2023 09:03:24 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXIM4-0004GF-Cp; Wed, 01 Mar 2023 04:02:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXIM1-0004EG-A6 for qemu-devel@nongnu.org; Wed, 01 Mar 2023 04:02:29 -0500 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pXILz-0002op-I1 for qemu-devel@nongnu.org; Wed, 01 Mar 2023 04:02:28 -0500 Received: by mail-pj1-x1036.google.com with SMTP id q31-20020a17090a17a200b0023750b69614so12300011pja.5 for ; Wed, 01 Mar 2023 01:02:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FFzPkPZf6Pa8JMQAdnFsH+CdOrPu+2uPdlCUdItrC+M=; b=OpGLH6pH6wXjDc/gl8rXaBYWQqD6yBP3XK7WPH3/0OCW0WegvnieEACFROqtqAAPaO oMvYwAAFWAcxHgBeZqtrN+pwyVyr5GQNGJcZyYi/86S6CmElQsRpJRPias+6QX0nziai 1kHoakyDIJ0T5zp1Q43NNYFntcDiPzaMibspgcRkOsZFZc1dMJJIgZCE+dZprrdj0G+j kmTSPp5Mlfzfr3VenUk4siItm0GdWgaXc9JTHv4qcRXqS98mFmSTy7OxV4EZfVMa0yYf kOWrsJTaEYBy7FJj+sGLmiZESJx2LHJUelMDIhalm5B9zpKJfPD8AsR7DDun3PAbjDs1 petA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FFzPkPZf6Pa8JMQAdnFsH+CdOrPu+2uPdlCUdItrC+M=; b=P+hFf56XYf1/BdvH7kSc/ye/Pmej0AWTPLmcn9W93i9Q3PMDrra7b9f4DmiKx1DTiI zk7USyRzCUq0Fklyle3tRqc7hTjbaJRgUFfgRaCadKsE3zK6uPAL2FquKmq+TZ5PGiGj IwBVua/X0jofTKmmZDrWz930OjYpsGgW9r2B0vmAogx1tvzoX37jVhy/6YPkPHGTmOmu rDCcSjUYads6sa3p4lV6dmnrc/5EH/fRCrH8kci4wLMpF+6bi1A7D38kBrkDRRmy+zT3 JUrT66ceoaz/noJ+NOlDuzz623eTnP6U0/WYDPxrNX4TmPCMl5hF9xNVHiZBHSDvVCiL q5dg== X-Gm-Message-State: AO0yUKWnRXkEmCoUKmk0eKd2E+FH80U2mD3gz1/N2GeeJj1hWA7KMRJD nVxwU2ZRWkNBB7fRY/J0OOk= X-Google-Smtp-Source: AK7set+AqErlQxLqqIWlRsutBvPksKUJB0y1Tmlrnrj6eLlSVGJTGIu1xixJo3ECvcawInaOUEIxWg== X-Received: by 2002:a17:902:c401:b0:19d:297:f30b with SMTP id k1-20020a170902c40100b0019d0297f30bmr7046920plk.19.1677661346358; Wed, 01 Mar 2023 01:02:26 -0800 (PST) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id iw6-20020a170903044600b0019aa8149cb3sm7878991plb.219.2023.03.01.01.02.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 01:02:25 -0800 (PST) From: bmeng.cn@gmail.com To: Jason Wang , qemu-devel@nongnu.org Cc: Bin Meng , Bin Meng Subject: [PATCH v6 8/8] hw/net: sunhme: Remove the logic of padding short frames in the receive path Date: Wed, 1 Mar 2023 17:02:03 +0800 Message-Id: <20230301090203.1601925-9-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230301090203.1601925-1-bmeng.cn@gmail.com> References: <20230301090203.1601925-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=bmeng.cn@gmail.com; helo=mail-pj1-x1036.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 Signed-off-by: Bin Meng --- hw/net/sunhme.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/hw/net/sunhme.c b/hw/net/sunhme.c index 1f3d8011ae..391d26fb82 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);