From patchwork Wed Apr 26 10:36:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773973 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=qTjoz4Kc; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wLv0Lsqz23vG for ; Wed, 26 Apr 2023 20:38:15 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcWk-0007Zz-7j; Wed, 26 Apr 2023 06:37:34 -0400 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 1prcWi-0007ZK-9H for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:37:32 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcWg-0002i5-GY for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:37:31 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-63b64a32fd2so8910790b3a.2 for ; Wed, 26 Apr 2023 03:37:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505449; x=1685097449; 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=I/pDwl8AWifWnquycf9eti2pt0sVkbePe+g+hr0tUgQ=; b=qTjoz4Kcjzgk6XpvtKa4u6mV4KvKzisduE6VVwVIC0fscvdYUie+/lgNaCr11uuqG4 glEmRG1CtqsantQcniuTI/l4rSbdZq16aUJz2JNHu8J8OXRJDmP6LEZ8N9QfidGxpq5K vvlpn0IUuoaK4CumdmKkh+SqYVvkwHKrOSywV1jh0bmI0PYHcWFTuU6NTKtp/4QLDrFo 0fd3cy3EErX6VKufhgXsSJDNX+zQoWRhY/boEmr3KdWsWwF1DuteHnKHygHwM3adcq+1 VdTcvS/tXEG6m3T9X9iQ56neFrYuLpPc56PtIYi43cbAR/d89xCUQ/S1BiYiX2BB42Gh u2Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505449; x=1685097449; 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=I/pDwl8AWifWnquycf9eti2pt0sVkbePe+g+hr0tUgQ=; b=ei0WiMTgydAvRsd1XGHApf1AsbiHd9N2hhkjzH5B7vgHfYek3pwlkoynDq4FN8gmoR 0HQfYpvj2I7LZBpdGrgj19Y+ZJIwpvMo5pMkK8oGG/mQkJsyh3PTF+sVfbr40vV2TYcQ aYkSPPZHj+xQDv23hqqwrsPIAY0C1i6lNLs1xJOO36JVTgo6Cj76S0QZTMzeqNLHN+ts HuW8fMRJ8TUxhnnj8QfqX3ztzrkWH1nGCDCzrSi0IcJYZrOAL1pscouxetGmcDC3MAec WxwekDH+XcSkmHKQ/sHCmMWTLAIwVJxBHKy32yJ+jLq6yiS5S3CaiQYW6Uqu7VpK5x3P wNOQ== X-Gm-Message-State: AAQBX9eq4iS14qGGrUqxSp8P8ZehJOz9zfyEAQwsRxMjYIR2d4d/w6xe 7/jhJblnXhufA3N7scuinwHbXQ== X-Google-Smtp-Source: AKy350YdBDZNuN95DUe+wkztT0W+JGkOR5S5rm/eOxgmNF/qLDSBRHvm5dSWQ7NCZ91hiu95qwCT3g== X-Received: by 2002:a05:6a21:7889:b0:f0:42b4:d428 with SMTP id bf9-20020a056a21788900b000f042b4d428mr25452429pzc.61.1682505449070; Wed, 26 Apr 2023 03:37:29 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.37.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:37:28 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 01/48] hw/net/net_tx_pkt: Decouple implementation from PCI Date: Wed, 26 Apr 2023 19:36:29 +0900 Message-Id: <20230426103716.26279-2-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::42f; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This is intended to be followed by another change for the interface. It also fixes the leak of memory mapping when the specified memory is partially mapped. Fixes: e263cd49c7 ("Packet abstraction for VMWARE network devices") Signed-off-by: Akihiko Odaki --- hw/net/net_tx_pkt.h | 9 ++++++++ hw/net/net_tx_pkt.c | 53 ++++++++++++++++++++++++++++----------------- 2 files changed, 42 insertions(+), 20 deletions(-) diff --git a/hw/net/net_tx_pkt.h b/hw/net/net_tx_pkt.h index e5ce6f20bc..5eb123ef90 100644 --- a/hw/net/net_tx_pkt.h +++ b/hw/net/net_tx_pkt.h @@ -153,6 +153,15 @@ void net_tx_pkt_dump(struct NetTxPkt *pkt); */ void net_tx_pkt_reset(struct NetTxPkt *pkt, PCIDevice *dev); +/** + * Unmap a fragment mapped from a PCI device. + * + * @context: PCI device owning fragment + * @base: pointer to fragment + * @len: length of fragment + */ +void net_tx_pkt_unmap_frag_pci(void *context, void *base, size_t len); + /** * Send packet to qemu. handles sw offloads if vhdr is not supported. * diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c index 8dc8568ba2..aca12ff035 100644 --- a/hw/net/net_tx_pkt.c +++ b/hw/net/net_tx_pkt.c @@ -384,10 +384,9 @@ void net_tx_pkt_setup_vlan_header_ex(struct NetTxPkt *pkt, } } -bool net_tx_pkt_add_raw_fragment(struct NetTxPkt *pkt, hwaddr pa, - size_t len) +static bool net_tx_pkt_add_raw_fragment_common(struct NetTxPkt *pkt, + void *base, size_t len) { - hwaddr mapped_len = 0; struct iovec *ventry; assert(pkt); @@ -395,23 +394,12 @@ bool net_tx_pkt_add_raw_fragment(struct NetTxPkt *pkt, hwaddr pa, return false; } - if (!len) { - return true; - } - ventry = &pkt->raw[pkt->raw_frags]; - mapped_len = len; + ventry->iov_base = base; + ventry->iov_len = len; + pkt->raw_frags++; - ventry->iov_base = pci_dma_map(pkt->pci_dev, pa, - &mapped_len, DMA_DIRECTION_TO_DEVICE); - - if ((ventry->iov_base != NULL) && (len == mapped_len)) { - ventry->iov_len = mapped_len; - pkt->raw_frags++; - return true; - } else { - return false; - } + return true; } bool net_tx_pkt_has_fragments(struct NetTxPkt *pkt) @@ -465,8 +453,9 @@ void net_tx_pkt_reset(struct NetTxPkt *pkt, PCIDevice *pci_dev) assert(pkt->raw); for (i = 0; i < pkt->raw_frags; i++) { assert(pkt->raw[i].iov_base); - pci_dma_unmap(pkt->pci_dev, pkt->raw[i].iov_base, - pkt->raw[i].iov_len, DMA_DIRECTION_TO_DEVICE, 0); + net_tx_pkt_unmap_frag_pci(pkt->pci_dev, + pkt->raw[i].iov_base, + pkt->raw[i].iov_len); } } pkt->pci_dev = pci_dev; @@ -476,6 +465,30 @@ void net_tx_pkt_reset(struct NetTxPkt *pkt, PCIDevice *pci_dev) pkt->l4proto = 0; } +void net_tx_pkt_unmap_frag_pci(void *context, void *base, size_t len) +{ + pci_dma_unmap(context, base, len, DMA_DIRECTION_TO_DEVICE, 0); +} + +bool net_tx_pkt_add_raw_fragment(struct NetTxPkt *pkt, hwaddr pa, + size_t len) +{ + dma_addr_t mapped_len = len; + void *base = pci_dma_map(pkt->pci_dev, pa, &mapped_len, + DMA_DIRECTION_TO_DEVICE); + if (!base) { + return false; + } + + if (mapped_len != len || + !net_tx_pkt_add_raw_fragment_common(pkt, base, len)) { + net_tx_pkt_unmap_frag_pci(pkt->pci_dev, base, mapped_len); + return false; + } + + return true; +} + static void net_tx_pkt_do_sw_csum(struct NetTxPkt *pkt, struct iovec *iov, uint32_t iov_len, uint16_t csl) From patchwork Wed Apr 26 10:36:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773974 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=qI7Th0jh; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wMJ5wDlz23vG for ; Wed, 26 Apr 2023 20:38:36 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcWt-0007dc-C0; Wed, 26 Apr 2023 06:37:43 -0400 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 1prcWm-0007aS-D5 for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:37:36 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcWj-0002jr-R8 for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:37:35 -0400 Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-51fcf5d1e44so6873939a12.3 for ; Wed, 26 Apr 2023 03:37:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505452; x=1685097452; 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=rhyO5KHv07P2fPZjwxVzrfZ1VN6it93oojEHbZCgRoA=; b=qI7Th0jhKbOX/HardGDAjSFT/4nYg9aD8Ccxc+9B364yS+vPpsvC5TBgnKnCYqzDBJ w4bcyVTlu/iD11ay0aLXU6B/7zDTBhe6YEHaD+r5bxiJNg2dcndqc/JrNDK60Y34Kab+ CvCNfum+4ue1uUfkafDH40YpFkz295YCZurvc0HcQ/RtLDnCcP49UU58ppTbUcopkQMU wHQaodo+ybD26/1kEciSfViMA1/RqWyUyapP+lOFpZG625sLKYJrhb6IZ1MBaHJSW6F6 IMFKDQ39ZpLHZ7iluloJSsIKfvGpPuYtfwlHUCD8bE+cb670EWsc4PzwpWd72s5B9c8t /zEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505452; x=1685097452; 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=rhyO5KHv07P2fPZjwxVzrfZ1VN6it93oojEHbZCgRoA=; b=cCrFPpRYw1r4+vPueD+hxMTH0IW67ZDXizGNnn6abvJBvTrsIut8slSlrA7Yo8DdLZ CtznKUiUqPrg5E13emvETvroKUT5hxtVlgUfQnQunqfFVIqkAlrAvM8mWIGmZTSs1NB9 J9uLBU9dST47OKSdFPoeNFt4wgQ0+ZbYXGOAUHgjfCZJIoH8e1nlqOh97yikR5Y4bU0g aDAdDNYpUP0SQyK2QxgKf0eUm0NAtStkE00dmmErg54wb3B0WrLuT4jEYtHIBj8A5Pq2 JmHB1f1hA9dL7eWszYj+AbZWLVCAimtrq/XFH3dz9bVIjTtkDTuu7k8KNB+0BWn//WzN g62g== X-Gm-Message-State: AAQBX9d0lPaG9WVBWjYJWU7K9MtNtuBG7fBasYmYbWQCw5xhMMm2QKwr DY9um0rmaGvomOvxX0b6LmaJ6Q== X-Google-Smtp-Source: AKy350ak6UKsGYuaFbVCD2R/axDbSZYYCQXRoi1njbw483exKTA57RPviutWc3IEOZxTbRltnhnLeA== X-Received: by 2002:a05:6a21:792:b0:ef:e240:b562 with SMTP id mg18-20020a056a21079200b000efe240b562mr23039167pzb.39.1682505452541; Wed, 26 Apr 2023 03:37:32 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.37.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:37:32 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 02/48] hw/net/net_tx_pkt: Decouple interface from PCI Date: Wed, 26 Apr 2023 19:36:30 +0900 Message-Id: <20230426103716.26279-3-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::52b; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x52b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This allows to use the network packet abstractions even if PCI is not used. Signed-off-by: Akihiko Odaki --- hw/net/net_tx_pkt.h | 31 ++++++++++++++++++++----------- hw/net/e1000e_core.c | 13 ++++++++----- hw/net/igb_core.c | 13 ++++++------- hw/net/net_tx_pkt.c | 36 +++++++++++++----------------------- hw/net/vmxnet3.c | 14 +++++++------- 5 files changed, 54 insertions(+), 53 deletions(-) diff --git a/hw/net/net_tx_pkt.h b/hw/net/net_tx_pkt.h index 5eb123ef90..4d7233e975 100644 --- a/hw/net/net_tx_pkt.h +++ b/hw/net/net_tx_pkt.h @@ -26,17 +26,16 @@ struct NetTxPkt; -typedef void (* NetTxPktCallback)(void *, const struct iovec *, int, const struct iovec *, int); +typedef void (*NetTxPktFreeFrag)(void *, void *, size_t); +typedef void (*NetTxPktSend)(void *, const struct iovec *, int, const struct iovec *, int); /** * Init function for tx packet functionality * * @pkt: packet pointer - * @pci_dev: PCI device processing this packet * @max_frags: max tx ip fragments */ -void net_tx_pkt_init(struct NetTxPkt **pkt, PCIDevice *pci_dev, - uint32_t max_frags); +void net_tx_pkt_init(struct NetTxPkt **pkt, uint32_t max_frags); /** * Clean all tx packet resources. @@ -95,12 +94,11 @@ net_tx_pkt_setup_vlan_header(struct NetTxPkt *pkt, uint16_t vlan) * populate data fragment into pkt context. * * @pkt: packet - * @pa: physical address of fragment + * @base: pointer to fragment * @len: length of fragment * */ -bool net_tx_pkt_add_raw_fragment(struct NetTxPkt *pkt, hwaddr pa, - size_t len); +bool net_tx_pkt_add_raw_fragment(struct NetTxPkt *pkt, void *base, size_t len); /** * Fix ip header fields and calculate IP header and pseudo header checksums. @@ -148,10 +146,11 @@ void net_tx_pkt_dump(struct NetTxPkt *pkt); * reset tx packet private context (needed to be called between packets) * * @pkt: packet - * @dev: PCI device processing the next packet - * + * @callback: function to free the fragments + * @context: pointer to be passed to the callback */ -void net_tx_pkt_reset(struct NetTxPkt *pkt, PCIDevice *dev); +void net_tx_pkt_reset(struct NetTxPkt *pkt, + NetTxPktFreeFrag callback, void *context); /** * Unmap a fragment mapped from a PCI device. @@ -162,6 +161,16 @@ void net_tx_pkt_reset(struct NetTxPkt *pkt, PCIDevice *dev); */ void net_tx_pkt_unmap_frag_pci(void *context, void *base, size_t len); +/** + * map data fragment from PCI device and populate it into pkt context. + * + * @pci_dev: PCI device owning fragment + * @pa: physical address of fragment + * @len: length of fragment + */ +bool net_tx_pkt_add_raw_fragment_pci(struct NetTxPkt *pkt, PCIDevice *pci_dev, + dma_addr_t pa, size_t len); + /** * Send packet to qemu. handles sw offloads if vhdr is not supported. * @@ -182,7 +191,7 @@ bool net_tx_pkt_send(struct NetTxPkt *pkt, NetClientState *nc); * @ret: operation result */ bool net_tx_pkt_send_custom(struct NetTxPkt *pkt, bool offload, - NetTxPktCallback callback, void *context); + NetTxPktSend callback, void *context); /** * parse raw packet data and analyze offload requirements. diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c index cfa3f55e96..15821a75e0 100644 --- a/hw/net/e1000e_core.c +++ b/hw/net/e1000e_core.c @@ -746,7 +746,8 @@ e1000e_process_tx_desc(E1000ECore *core, addr = le64_to_cpu(dp->buffer_addr); if (!tx->skip_cp) { - if (!net_tx_pkt_add_raw_fragment(tx->tx_pkt, addr, split_size)) { + if (!net_tx_pkt_add_raw_fragment_pci(tx->tx_pkt, core->owner, + addr, split_size)) { tx->skip_cp = true; } } @@ -764,7 +765,7 @@ e1000e_process_tx_desc(E1000ECore *core, } tx->skip_cp = false; - net_tx_pkt_reset(tx->tx_pkt, core->owner); + net_tx_pkt_reset(tx->tx_pkt, net_tx_pkt_unmap_frag_pci, core->owner); tx->sum_needed = 0; tx->cptse = 0; @@ -3421,7 +3422,7 @@ e1000e_core_pci_realize(E1000ECore *core, qemu_add_vm_change_state_handler(e1000e_vm_state_change, core); for (i = 0; i < E1000E_NUM_QUEUES; i++) { - net_tx_pkt_init(&core->tx[i].tx_pkt, core->owner, E1000E_MAX_TX_FRAGS); + net_tx_pkt_init(&core->tx[i].tx_pkt, E1000E_MAX_TX_FRAGS); } net_rx_pkt_init(&core->rx_pkt); @@ -3446,7 +3447,8 @@ e1000e_core_pci_uninit(E1000ECore *core) qemu_del_vm_change_state_handler(core->vmstate); for (i = 0; i < E1000E_NUM_QUEUES; i++) { - net_tx_pkt_reset(core->tx[i].tx_pkt, core->owner); + net_tx_pkt_reset(core->tx[i].tx_pkt, + net_tx_pkt_unmap_frag_pci, core->owner); net_tx_pkt_uninit(core->tx[i].tx_pkt); } @@ -3571,7 +3573,8 @@ static void e1000e_reset(E1000ECore *core, bool sw) e1000x_reset_mac_addr(core->owner_nic, core->mac, core->permanent_mac); for (i = 0; i < ARRAY_SIZE(core->tx); i++) { - net_tx_pkt_reset(core->tx[i].tx_pkt, core->owner); + net_tx_pkt_reset(core->tx[i].tx_pkt, + net_tx_pkt_unmap_frag_pci, core->owner); memset(&core->tx[i].props, 0, sizeof(core->tx[i].props)); core->tx[i].skip_cp = false; } diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index 826e7a6cf1..abfdce9aaf 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -597,7 +597,8 @@ igb_process_tx_desc(IGBCore *core, length = cmd_type_len & 0xFFFF; if (!tx->skip_cp) { - if (!net_tx_pkt_add_raw_fragment(tx->tx_pkt, buffer_addr, length)) { + if (!net_tx_pkt_add_raw_fragment_pci(tx->tx_pkt, dev, + buffer_addr, length)) { tx->skip_cp = true; } } @@ -616,7 +617,7 @@ igb_process_tx_desc(IGBCore *core, tx->first = true; tx->skip_cp = false; - net_tx_pkt_reset(tx->tx_pkt, dev); + net_tx_pkt_reset(tx->tx_pkt, net_tx_pkt_unmap_frag_pci, dev); } } @@ -842,8 +843,6 @@ igb_start_xmit(IGBCore *core, const IGB_TxRing *txr) d = core->owner; } - net_tx_pkt_reset(txr->tx->tx_pkt, d); - while (!igb_ring_empty(core, txi)) { base = igb_ring_head_descr(core, txi); @@ -861,6 +860,8 @@ igb_start_xmit(IGBCore *core, const IGB_TxRing *txr) core->mac[EICR] |= eic; igb_set_interrupt_cause(core, E1000_ICR_TXDW); } + + net_tx_pkt_reset(txr->tx->tx_pkt, net_tx_pkt_unmap_frag_pci, d); } static uint32_t @@ -3954,7 +3955,7 @@ igb_core_pci_realize(IGBCore *core, core->vmstate = qemu_add_vm_change_state_handler(igb_vm_state_change, core); for (i = 0; i < IGB_NUM_QUEUES; i++) { - net_tx_pkt_init(&core->tx[i].tx_pkt, NULL, E1000E_MAX_TX_FRAGS); + net_tx_pkt_init(&core->tx[i].tx_pkt, E1000E_MAX_TX_FRAGS); } net_rx_pkt_init(&core->rx_pkt); @@ -3979,7 +3980,6 @@ igb_core_pci_uninit(IGBCore *core) qemu_del_vm_change_state_handler(core->vmstate); for (i = 0; i < IGB_NUM_QUEUES; i++) { - net_tx_pkt_reset(core->tx[i].tx_pkt, NULL); net_tx_pkt_uninit(core->tx[i].tx_pkt); } @@ -4158,7 +4158,6 @@ static void igb_reset(IGBCore *core, bool sw) for (i = 0; i < ARRAY_SIZE(core->tx); i++) { tx = &core->tx[i]; - net_tx_pkt_reset(tx->tx_pkt, NULL); memset(tx->ctx, 0, sizeof(tx->ctx)); tx->first = true; tx->skip_cp = false; diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c index aca12ff035..cc36750c9b 100644 --- a/hw/net/net_tx_pkt.c +++ b/hw/net/net_tx_pkt.c @@ -16,12 +16,12 @@ */ #include "qemu/osdep.h" -#include "net_tx_pkt.h" #include "net/eth.h" #include "net/checksum.h" #include "net/tap.h" #include "net/net.h" #include "hw/pci/pci_device.h" +#include "net_tx_pkt.h" enum { NET_TX_PKT_VHDR_FRAG = 0, @@ -32,8 +32,6 @@ enum { /* TX packet private context */ struct NetTxPkt { - PCIDevice *pci_dev; - struct virtio_net_hdr virt_hdr; struct iovec *raw; @@ -59,13 +57,10 @@ struct NetTxPkt { uint8_t l4proto; }; -void net_tx_pkt_init(struct NetTxPkt **pkt, PCIDevice *pci_dev, - uint32_t max_frags) +void net_tx_pkt_init(struct NetTxPkt **pkt, uint32_t max_frags) { struct NetTxPkt *p = g_malloc0(sizeof *p); - p->pci_dev = pci_dev; - p->vec = g_new(struct iovec, max_frags + NET_TX_PKT_PL_START_FRAG); p->raw = g_new(struct iovec, max_frags); @@ -384,8 +379,7 @@ void net_tx_pkt_setup_vlan_header_ex(struct NetTxPkt *pkt, } } -static bool net_tx_pkt_add_raw_fragment_common(struct NetTxPkt *pkt, - void *base, size_t len) +bool net_tx_pkt_add_raw_fragment(struct NetTxPkt *pkt, void *base, size_t len) { struct iovec *ventry; assert(pkt); @@ -433,7 +427,8 @@ void net_tx_pkt_dump(struct NetTxPkt *pkt) #endif } -void net_tx_pkt_reset(struct NetTxPkt *pkt, PCIDevice *pci_dev) +void net_tx_pkt_reset(struct NetTxPkt *pkt, + NetTxPktFreeFrag callback, void *context) { int i; @@ -453,12 +448,9 @@ void net_tx_pkt_reset(struct NetTxPkt *pkt, PCIDevice *pci_dev) assert(pkt->raw); for (i = 0; i < pkt->raw_frags; i++) { assert(pkt->raw[i].iov_base); - net_tx_pkt_unmap_frag_pci(pkt->pci_dev, - pkt->raw[i].iov_base, - pkt->raw[i].iov_len); + callback(context, pkt->raw[i].iov_base, pkt->raw[i].iov_len); } } - pkt->pci_dev = pci_dev; pkt->raw_frags = 0; pkt->hdr_len = 0; @@ -470,19 +462,17 @@ void net_tx_pkt_unmap_frag_pci(void *context, void *base, size_t len) pci_dma_unmap(context, base, len, DMA_DIRECTION_TO_DEVICE, 0); } -bool net_tx_pkt_add_raw_fragment(struct NetTxPkt *pkt, hwaddr pa, - size_t len) +bool net_tx_pkt_add_raw_fragment_pci(struct NetTxPkt *pkt, PCIDevice *pci_dev, + dma_addr_t pa, size_t len) { dma_addr_t mapped_len = len; - void *base = pci_dma_map(pkt->pci_dev, pa, &mapped_len, - DMA_DIRECTION_TO_DEVICE); + void *base = pci_dma_map(pci_dev, pa, &mapped_len, DMA_DIRECTION_TO_DEVICE); if (!base) { return false; } - if (mapped_len != len || - !net_tx_pkt_add_raw_fragment_common(pkt, base, len)) { - net_tx_pkt_unmap_frag_pci(pkt->pci_dev, base, mapped_len); + if (mapped_len != len || !net_tx_pkt_add_raw_fragment(pkt, base, len)) { + net_tx_pkt_unmap_frag_pci(pci_dev, base, mapped_len); return false; } @@ -710,7 +700,7 @@ static void net_tx_pkt_udp_fragment_fix(struct NetTxPkt *pkt, } static bool net_tx_pkt_do_sw_fragmentation(struct NetTxPkt *pkt, - NetTxPktCallback callback, + NetTxPktSend callback, void *context) { uint8_t gso_type = pkt->virt_hdr.gso_type & ~VIRTIO_NET_HDR_GSO_ECN; @@ -807,7 +797,7 @@ bool net_tx_pkt_send(struct NetTxPkt *pkt, NetClientState *nc) } bool net_tx_pkt_send_custom(struct NetTxPkt *pkt, bool offload, - NetTxPktCallback callback, void *context) + NetTxPktSend callback, void *context) { assert(pkt); diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c index f7b874c139..9acff310e7 100644 --- a/hw/net/vmxnet3.c +++ b/hw/net/vmxnet3.c @@ -651,9 +651,8 @@ static void vmxnet3_process_tx_queue(VMXNET3State *s, int qidx) data_len = (txd.len > 0) ? txd.len : VMXNET3_MAX_TX_BUF_SIZE; data_pa = txd.addr; - if (!net_tx_pkt_add_raw_fragment(s->tx_pkt, - data_pa, - data_len)) { + if (!net_tx_pkt_add_raw_fragment_pci(s->tx_pkt, PCI_DEVICE(s), + data_pa, data_len)) { s->skip_current_tx_pkt = true; } } @@ -678,7 +677,8 @@ static void vmxnet3_process_tx_queue(VMXNET3State *s, int qidx) vmxnet3_complete_packet(s, qidx, txd_idx); s->tx_sop = true; s->skip_current_tx_pkt = false; - net_tx_pkt_reset(s->tx_pkt, PCI_DEVICE(s)); + net_tx_pkt_reset(s->tx_pkt, + net_tx_pkt_unmap_frag_pci, PCI_DEVICE(s)); } } } @@ -1159,7 +1159,7 @@ static void vmxnet3_deactivate_device(VMXNET3State *s) { if (s->device_active) { VMW_CBPRN("Deactivating vmxnet3..."); - net_tx_pkt_reset(s->tx_pkt, PCI_DEVICE(s)); + net_tx_pkt_reset(s->tx_pkt, net_tx_pkt_unmap_frag_pci, PCI_DEVICE(s)); net_tx_pkt_uninit(s->tx_pkt); net_rx_pkt_uninit(s->rx_pkt); s->device_active = false; @@ -1519,7 +1519,7 @@ static void vmxnet3_activate_device(VMXNET3State *s) /* Preallocate TX packet wrapper */ VMW_CFPRN("Max TX fragments is %u", s->max_tx_frags); - net_tx_pkt_init(&s->tx_pkt, PCI_DEVICE(s), s->max_tx_frags); + net_tx_pkt_init(&s->tx_pkt, s->max_tx_frags); net_rx_pkt_init(&s->rx_pkt); /* Read rings memory locations for RX queues */ @@ -2399,7 +2399,7 @@ static int vmxnet3_post_load(void *opaque, int version_id) { VMXNET3State *s = opaque; - net_tx_pkt_init(&s->tx_pkt, PCI_DEVICE(s), s->max_tx_frags); + net_tx_pkt_init(&s->tx_pkt, s->max_tx_frags); net_rx_pkt_init(&s->rx_pkt); if (s->msix_used) { From patchwork Wed Apr 26 10:36:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773971 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=VgMAMELA; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wLf1xhcz23vG for ; Wed, 26 Apr 2023 20:38:02 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcWu-0007fG-UO; Wed, 26 Apr 2023 06:37:44 -0400 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 1prcWt-0007db-8a for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:37:43 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcWp-0002kV-EV for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:37:41 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-63b7b54642cso5036494b3a.0 for ; Wed, 26 Apr 2023 03:37:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505456; x=1685097456; 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=BnuVnIj/2ZuF2EgM3/qsznMkchxIe/D9v7O7piK8to0=; b=VgMAMELAd1BaVL8KJ3raP7oIzqis/lO9H5swWWNHiEHN6dcYUo0JNoOoehc6IgShQ8 NoqjL9y6tYL/ayBPXww3ZYpU4UnBVBg7hGsqk05ikbE/hi+rx8eR4vDpCDyevAQsMwED CZj2nT8iIrsWMcbWcPJFdBkR6navmMw5Sg+qBVSjSR1f393LN47u8wdZJu+iHhjVwXES 69S2Bv5THx7LV9XOy8UGTgRugT22SkcGVZIpI10dVVKWcAPwb9gxdu5sHs6U92xXJzPQ zM+D3C6MNGT2DIDBfzLDGFgcsTLP/gHHV5HnqJTvBwkldiTaFhkNJ3hyDn6IfnXnMTFj ZouA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505456; x=1685097456; 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=BnuVnIj/2ZuF2EgM3/qsznMkchxIe/D9v7O7piK8to0=; b=QIgtbesbRLOH31XZq2Ei2YkfU4aABSLsdIW2zwdcZJfLUN/v2y5J1/bhqmRIuNhXfZ p2dqMRAgncS1shqL4ZEAj9pokv76jzWeb+jvcROZ6QrmS0G7AmWl1Tjvv6VBzwnJ9DMO /2ZguWLo+Zj2wLz1c+g3FdNwM99xmRnw1d3tJg+8BKjMFLogehlTARxpJwCzho3O9uvz QwhQo8446xT/fgNJjH5dOn9zZG5XDxgC5NOyp7V32EggzifeU+WNbp7zZeNFfwLBmoya RLNJd/tVjRJuRT9no1qY14wjas9tz4jD8Iyu1JetGgobORWdcyaBTHnZzpbDKPDpA2Jn YTxg== X-Gm-Message-State: AAQBX9dkeW7BVW/eUUiFC9IYY2Yj21u9WyoWWdKI7pMw9O0ICQ/lvt+R Whfch0H2jYlgwqJAlv7Im0S8Mg== X-Google-Smtp-Source: AKy350YRZX5oJP1lDFEHIk3xUmYnUFKdJ84tZQ436QwLQEPovYyGqGJwFcSyw+Hn78A26ZPNaiFMrg== X-Received: by 2002:a05:6a20:3d10:b0:f2:c7a5:26d8 with SMTP id y16-20020a056a203d1000b000f2c7a526d8mr22367661pzi.11.1682505456000; Wed, 26 Apr 2023 03:37:36 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.37.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:37:35 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 03/48] e1000x: Fix BPRC and MPRC Date: Wed, 26 Apr 2023 19:36:31 +0900 Message-Id: <20230426103716.26279-4-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::42c; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Before this change, e1000 and the common code updated BPRC and MPRC depending on the matched filter, but e1000e and igb decided to update those counters by deriving the packet type independently. This inconsistency caused a multicast packet to be counted twice. Updating BPRC and MPRC depending on are fundamentally flawed anyway as a filter can be used for different types of packets. For example, it is possible to filter broadcast packets with MTA. Always determine what counters to update by inspecting the packets. Fixes: 3b27430177 ("e1000: Implementing various counters") Signed-off-by: Akihiko Odaki Reviewed-by: Sriram Yagnaraman --- hw/net/e1000x_common.h | 5 +++-- hw/net/e1000.c | 6 +++--- hw/net/e1000e_core.c | 20 +++----------------- hw/net/e1000x_common.c | 25 +++++++++++++++++++------ hw/net/igb_core.c | 22 +++++----------------- 5 files changed, 33 insertions(+), 45 deletions(-) diff --git a/hw/net/e1000x_common.h b/hw/net/e1000x_common.h index 911abd8a90..0298e06283 100644 --- a/hw/net/e1000x_common.h +++ b/hw/net/e1000x_common.h @@ -91,8 +91,9 @@ e1000x_update_regs_on_link_up(uint32_t *mac, uint16_t *phy) } void e1000x_update_rx_total_stats(uint32_t *mac, - size_t data_size, - size_t data_fcs_size); + eth_pkt_types_e pkt_type, + size_t pkt_size, + size_t pkt_fcs_size); void e1000x_core_prepare_eeprom(uint16_t *eeprom, const uint16_t *templ, diff --git a/hw/net/e1000.c b/hw/net/e1000.c index 59bacb5d3b..18eb6d8876 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -826,12 +826,10 @@ receive_filter(E1000State *s, const uint8_t *buf, int size) } if (ismcast && (rctl & E1000_RCTL_MPE)) { /* promiscuous mcast */ - e1000x_inc_reg_if_not_full(s->mac_reg, MPRC); return 1; } if (isbcast && (rctl & E1000_RCTL_BAM)) { /* broadcast enabled */ - e1000x_inc_reg_if_not_full(s->mac_reg, BPRC); return 1; } @@ -922,6 +920,7 @@ e1000_receive_iov(NetClientState *nc, const struct iovec *iov, int iovcnt) size_t desc_offset; size_t desc_size; size_t total_size; + eth_pkt_types_e pkt_type; if (!e1000x_hw_rx_enabled(s->mac_reg)) { return -1; @@ -971,6 +970,7 @@ e1000_receive_iov(NetClientState *nc, const struct iovec *iov, int iovcnt) size -= 4; } + pkt_type = get_eth_packet_type(PKT_GET_ETH_HDR(filter_buf)); rdh_start = s->mac_reg[RDH]; desc_offset = 0; total_size = size + e1000x_fcs_len(s->mac_reg); @@ -1036,7 +1036,7 @@ e1000_receive_iov(NetClientState *nc, const struct iovec *iov, int iovcnt) } } while (desc_offset < total_size); - e1000x_update_rx_total_stats(s->mac_reg, size, total_size); + e1000x_update_rx_total_stats(s->mac_reg, pkt_type, size, total_size); n = E1000_ICS_RXT0; if ((rdt = s->mac_reg[RDT]) < s->mac_reg[RDH]) diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c index 15821a75e0..c2d864a504 100644 --- a/hw/net/e1000e_core.c +++ b/hw/net/e1000e_core.c @@ -1488,24 +1488,10 @@ e1000e_write_to_rx_buffers(E1000ECore *core, } static void -e1000e_update_rx_stats(E1000ECore *core, - size_t data_size, - size_t data_fcs_size) +e1000e_update_rx_stats(E1000ECore *core, size_t pkt_size, size_t pkt_fcs_size) { - e1000x_update_rx_total_stats(core->mac, data_size, data_fcs_size); - - switch (net_rx_pkt_get_packet_type(core->rx_pkt)) { - case ETH_PKT_BCAST: - e1000x_inc_reg_if_not_full(core->mac, BPRC); - break; - - case ETH_PKT_MCAST: - e1000x_inc_reg_if_not_full(core->mac, MPRC); - break; - - default: - break; - } + eth_pkt_types_e pkt_type = net_rx_pkt_get_packet_type(core->rx_pkt); + e1000x_update_rx_total_stats(core->mac, pkt_type, pkt_size, pkt_fcs_size); } static inline bool diff --git a/hw/net/e1000x_common.c b/hw/net/e1000x_common.c index 4c8e7dcf70..7694673bcc 100644 --- a/hw/net/e1000x_common.c +++ b/hw/net/e1000x_common.c @@ -80,7 +80,6 @@ bool e1000x_rx_group_filter(uint32_t *mac, const uint8_t *buf) f = mta_shift[(rctl >> E1000_RCTL_MO_SHIFT) & 3]; f = (((buf[5] << 8) | buf[4]) >> f) & 0xfff; if (mac[MTA + (f >> 5)] & (1 << (f & 0x1f))) { - e1000x_inc_reg_if_not_full(mac, MPRC); return true; } @@ -212,13 +211,14 @@ e1000x_rxbufsize(uint32_t rctl) void e1000x_update_rx_total_stats(uint32_t *mac, - size_t data_size, - size_t data_fcs_size) + eth_pkt_types_e pkt_type, + size_t pkt_size, + size_t pkt_fcs_size) { static const int PRCregs[6] = { PRC64, PRC127, PRC255, PRC511, PRC1023, PRC1522 }; - e1000x_increase_size_stats(mac, PRCregs, data_fcs_size); + e1000x_increase_size_stats(mac, PRCregs, pkt_fcs_size); e1000x_inc_reg_if_not_full(mac, TPR); e1000x_inc_reg_if_not_full(mac, GPRC); /* TOR - Total Octets Received: @@ -226,8 +226,21 @@ e1000x_update_rx_total_stats(uint32_t *mac, * Address> field through the field, inclusively. * Always include FCS length (4) in size. */ - e1000x_grow_8reg_if_not_full(mac, TORL, data_size + 4); - e1000x_grow_8reg_if_not_full(mac, GORCL, data_size + 4); + e1000x_grow_8reg_if_not_full(mac, TORL, pkt_size + 4); + e1000x_grow_8reg_if_not_full(mac, GORCL, pkt_size + 4); + + switch (pkt_type) { + case ETH_PKT_BCAST: + e1000x_inc_reg_if_not_full(mac, BPRC); + break; + + case ETH_PKT_MCAST: + e1000x_inc_reg_if_not_full(mac, MPRC); + break; + + default: + break; + } } void diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index abfdce9aaf..464a41d0aa 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -1438,29 +1438,17 @@ igb_write_to_rx_buffers(IGBCore *core, static void igb_update_rx_stats(IGBCore *core, const E1000E_RingInfo *rxi, - size_t data_size, size_t data_fcs_size) + size_t pkt_size, size_t pkt_fcs_size) { - e1000x_update_rx_total_stats(core->mac, data_size, data_fcs_size); - - switch (net_rx_pkt_get_packet_type(core->rx_pkt)) { - case ETH_PKT_BCAST: - e1000x_inc_reg_if_not_full(core->mac, BPRC); - break; - - case ETH_PKT_MCAST: - e1000x_inc_reg_if_not_full(core->mac, MPRC); - break; - - default: - break; - } + eth_pkt_types_e pkt_type = net_rx_pkt_get_packet_type(core->rx_pkt); + e1000x_update_rx_total_stats(core->mac, pkt_type, pkt_size, pkt_fcs_size); if (core->mac[MRQC] & 1) { uint16_t pool = rxi->idx % IGB_NUM_VM_POOLS; - core->mac[PVFGORC0 + (pool * 64)] += data_size + 4; + core->mac[PVFGORC0 + (pool * 64)] += pkt_size + 4; core->mac[PVFGPRC0 + (pool * 64)]++; - if (net_rx_pkt_get_packet_type(core->rx_pkt) == ETH_PKT_MCAST) { + if (pkt_type == ETH_PKT_MCAST) { core->mac[PVFMPRC0 + (pool * 64)]++; } } From patchwork Wed Apr 26 10:36:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773987 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=R9wNQcPz; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wNy4jb0z23vG for ; Wed, 26 Apr 2023 20:40:02 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcWw-0007fo-4D; Wed, 26 Apr 2023 06:37:46 -0400 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 1prcWu-0007ew-JJ for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:37:44 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcWs-0002hH-T5 for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:37:44 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-63b57c49c4cso5719967b3a.3 for ; Wed, 26 Apr 2023 03:37:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505459; x=1685097459; 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=TFx0uWHXmGtU+bW523w2MjKrmNDNNhMu9pkvmW6PJDU=; b=R9wNQcPzYcUYfmS0btkHwABAH6tyVWIyZemfPm41jBBYC0ivhmue4a+LywWB6N36A7 TmswysPI8U8Xr36sAXDEkH/7kGz2jZcTF/w8oW5o9VfPnYliSIkOKKH5OZfTomDaPIYS 1aBXj828gVGHSHcaDdqlEF2hGLN4c7fZP2YgT+zTrFyb+a2Edt/t67QYxZj4Nl1eZ9gA P9xQpce+yru545R4TglHlmzHEfaEx0nCvH0MAPyF7jJNq+5gtxSn5FBX+TxKtjxRNnVZ AOQ3s7VPae+fzatYgMiWjXH4Sz8F9MG+NW1bUZSCkikRPqfAxTOHjJBBU/LewQ/6cKC4 VFEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505459; x=1685097459; 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=TFx0uWHXmGtU+bW523w2MjKrmNDNNhMu9pkvmW6PJDU=; b=G0elSe/wOuF/HcICtlCp2WCMW1PVP+vKcJtKFPVdgvCz0kBqolnchCXk8sKoEWOWV0 pb6cLlp6t7PcqGeKZr+5mfEshXjeH3uUKf/lIwxT5zaY6NOkLTwDfvAQbFe7W69vZ0N1 EgWmPRJIac4crveqUjLlktzSw5Sct4fgHbXi6O6rEGVieBm4v7jyLdEN3rtyIHtHtBmf 4mENoyJFy8/jIDvIj6FbSZIawZRL9/fzc94ZfhighzLl6FDMWkBWki0QCeX59HTcdwMJ pVSOEPzMKlult7j88WJUVJVCz1hbx3STqH+sc7xze+HZ5M5WHel/uYcesOJVhBVQ2wGb yo8g== X-Gm-Message-State: AAQBX9cZLozyV7hziZR4NWTH1Oek0YDu3f1Dbya7qR9iCY8uQgb8Ixye +K43pmHDSEEUcKG5tLvHMY75jw== X-Google-Smtp-Source: AKy350a69RHlKvylHGKYWdkOEAyi70ThdFLk/jEAt6pbYx3rukcSFh9OWXmUrr6RDJSKr1MM8Et4SQ== X-Received: by 2002:a05:6a20:8f29:b0:f2:813b:ac5c with SMTP id b41-20020a056a208f2900b000f2813bac5cmr24108557pzk.21.1682505459497; Wed, 26 Apr 2023 03:37:39 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.37.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:37:39 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 04/48] igb: Fix Rx packet type encoding Date: Wed, 26 Apr 2023 19:36:32 +0900 Message-Id: <20230426103716.26279-5-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::42b; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org igb's advanced descriptor uses a packet type encoding different from one used in e1000e's extended descriptor. Fix the logic to encode Rx packet type accordingly. Fixes: 3a977deebe ("Intrdocue igb device emulation") Signed-off-by: Akihiko Odaki Reviewed-by: Sriram Yagnaraman --- hw/net/igb_regs.h | 5 +++++ hw/net/igb_core.c | 38 +++++++++++++++++++------------------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/hw/net/igb_regs.h b/hw/net/igb_regs.h index c5c5b3c3b8..21ee9a3b2d 100644 --- a/hw/net/igb_regs.h +++ b/hw/net/igb_regs.h @@ -641,6 +641,11 @@ union e1000_adv_rx_desc { #define E1000_STATUS_NUM_VFS_SHIFT 14 +#define E1000_ADVRXD_PKT_IP4 BIT(4) +#define E1000_ADVRXD_PKT_IP6 BIT(6) +#define E1000_ADVRXD_PKT_TCP BIT(8) +#define E1000_ADVRXD_PKT_UDP BIT(9) + static inline uint8_t igb_ivar_entry_rx(uint8_t i) { return i < 8 ? i * 4 : (i - 8) * 4 + 2; diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index 464a41d0aa..dbd1192a8e 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -1227,7 +1227,6 @@ igb_build_rx_metadata(IGBCore *core, struct virtio_net_hdr *vhdr; bool hasip4, hasip6; EthL4HdrProto l4hdr_proto; - uint32_t pkt_type; *status_flags = E1000_RXD_STAT_DD; @@ -1266,28 +1265,29 @@ igb_build_rx_metadata(IGBCore *core, trace_e1000e_rx_metadata_ack(); } - if (hasip6 && (core->mac[RFCTL] & E1000_RFCTL_IPV6_DIS)) { - trace_e1000e_rx_metadata_ipv6_filtering_disabled(); - pkt_type = E1000_RXD_PKT_MAC; - } else if (l4hdr_proto == ETH_L4_HDR_PROTO_TCP || - l4hdr_proto == ETH_L4_HDR_PROTO_UDP) { - pkt_type = hasip4 ? E1000_RXD_PKT_IP4_XDP : E1000_RXD_PKT_IP6_XDP; - } else if (hasip4 || hasip6) { - pkt_type = hasip4 ? E1000_RXD_PKT_IP4 : E1000_RXD_PKT_IP6; - } else { - pkt_type = E1000_RXD_PKT_MAC; - } + if (pkt_info) { + *pkt_info = rss_info->enabled ? rss_info->type : 0; - trace_e1000e_rx_metadata_pkt_type(pkt_type); + if (hasip4) { + *pkt_info |= E1000_ADVRXD_PKT_IP4; + } - if (pkt_info) { - if (rss_info->enabled) { - *pkt_info = rss_info->type; + if (hasip6) { + *pkt_info |= E1000_ADVRXD_PKT_IP6; } - *pkt_info |= (pkt_type << 4); - } else { - *status_flags |= E1000_RXD_PKT_TYPE(pkt_type); + switch (l4hdr_proto) { + case ETH_L4_HDR_PROTO_TCP: + *pkt_info |= E1000_ADVRXD_PKT_TCP; + break; + + case ETH_L4_HDR_PROTO_UDP: + *pkt_info |= E1000_ADVRXD_PKT_UDP; + break; + + default: + break; + } } if (hdr_info) { From patchwork Wed Apr 26 10:36:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773992 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=DicpEqqX; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wPl5Blmz23vF for ; Wed, 26 Apr 2023 20:40:43 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcX2-0007iG-M3; Wed, 26 Apr 2023 06:37:52 -0400 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 1prcWw-0007fs-N2 for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:37:46 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcWv-0002lL-6J for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:37:46 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-63b73203e0aso42051042b3a.1 for ; Wed, 26 Apr 2023 03:37:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505463; x=1685097463; 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=publPZs1fhxTrshwCuWg7dsVdQXSXv6ynCZ1gW8YOpU=; b=DicpEqqXI4YGDoCOa20hvlnvQdFe3BYtqlxDYF6aPDw6xJeQEWjMeMUbBh5EDabb0x XkxXVd/sy+jdrtjMYn4vyhcL8OqzveEyvY3W5e6EN5+pnRsP2kw/hyV7CAEiMzkJ/G2D P8xS9vxsRf2vI+cPGRqCo7CjI4KU7BdhEFDMrJbu65zHgFa4XgBTgwJ2FVRo5RWt6pAv DL6jB8RSBmdSfE+024gxItr9LDC0t8jFG04UNZ2KvBkJGt1wrp8MV5rLF/gQgpiyWm0Y x6diSPqChWl0QybuBsNgaQTYNsJuSkg46NENg7sEicABGRvMXaDc0SllXsJ4h6JtgZxV cmAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505463; x=1685097463; 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=publPZs1fhxTrshwCuWg7dsVdQXSXv6ynCZ1gW8YOpU=; b=GoRrvViR07nzl8kEGNfG2TuC7F0WlInJYFoy6Y93nfu88MWokLFL8/7eEP2U7+Slb7 BevFZpgRJ/HPbURzPT9QhBrdL7fluJUh33pB+5ZfBv+hsrgasTrbWXo1UBu2hS49XY12 Uek6lY8t/RC5+uog+h2M+BoVm9aS34lf5cMgTD1HXJ7okIPYd6CZGbRG50SsJuxTid+Z 4LkPYL21qjOaqkkaR8ze42CeyinOFGvhjsTJFdhTaYNpqZF9MLCmlgM1UipeNWMuJgw6 MgB/RlJND6SKQNQz+tz8dK3jEXebkbR0/qO9Ho7ke0OIHNxAgVv05fvFyrIrZI3sr69n cMbQ== X-Gm-Message-State: AC+VfDz/bhvgO9Pj+R6KG6WdWG+Z3LmJ72WcHzAxZX+onN9+OR6m5k2v dXX4+un6dl+hRMIvR8q+FB4LrA== X-Google-Smtp-Source: ACHHUZ5h/3rseSl/TQNbwXZzEeJcn5dbPfJYjI8iPBK5RQYCzeSoqFUf30o7kOALXPcZVOdKMQWcGA== X-Received: by 2002:a05:6a20:8f11:b0:f0:a283:4854 with SMTP id b17-20020a056a208f1100b000f0a2834854mr2370522pzk.13.1682505463002; Wed, 26 Apr 2023 03:37:43 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.37.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:37:42 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 05/48] igb: Do not require CTRL.VME for tx VLAN tagging Date: Wed, 26 Apr 2023 19:36:33 +0900 Message-Id: <20230426103716.26279-6-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::42c; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org While the datasheet of e1000e says it checks CTRL.VME for tx VLAN tagging, igb's datasheet has no such statements. It also says for "CTRL.VLE": > This register only affects the VLAN Strip in Rx it does not have any > influence in the Tx path in the 82576. (Appendix A. Changes from the 82575) There is no "CTRL.VLE" so it is more likely that it is a mistake of CTRL.VME. Fixes: fba7c3b788 ("igb: respect VMVIR and VMOLR for VLAN") Signed-off-by: Akihiko Odaki Reviewed-by: Sriram Yagnaraman --- hw/net/igb_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index dbd1192a8e..96a118b6c1 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -402,7 +402,7 @@ igb_tx_insert_vlan(IGBCore *core, uint16_t qn, struct igb_tx *tx, } } - if (insert_vlan && e1000x_vlan_enabled(core->mac)) { + if (insert_vlan) { net_tx_pkt_setup_vlan_header_ex(tx->tx_pkt, vlan, core->mac[VET] & 0xffff); } From patchwork Wed Apr 26 10:36:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1774020 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=U5QkINFc; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wXc3dxNz23vK for ; Wed, 26 Apr 2023 20:46:40 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcX8-0007tN-Qp; Wed, 26 Apr 2023 06:37:58 -0400 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 1prcWz-0007gX-Fj for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:37:50 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcWx-0002pZ-OF for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:37:49 -0400 Received: by mail-pj1-x1035.google.com with SMTP id 98e67ed59e1d1-247296def99so4870343a91.1 for ; Wed, 26 Apr 2023 03:37:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505466; x=1685097466; 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=C4uJN0iy+s7MSPURvkGvWZYRnxu2nNdOIstdrqPSpeQ=; b=U5QkINFc5QJJKwXYIsGVQyCujp3+9MO7TvVe9kpKMni0I+Sln0tEhesbPXrYsMQ+uQ hwhXLxfaHuE2KBhMUsNteiW4rUsESVQWo2B2WBQS1zT7WsdLjV4nNoyBhQOInCwIrOSJ Y0V3DI3LlqAhmTIXQhd4QfZXM/I+jS+gaSN70Rwg3JyEGqc+W3rfHCCWIccKpu2DN8sp ls7OOXONzJcwGndIC1iohKFyj0tfP0WlPxanIxzSvCZ03qV2D8Eaj+sTgy685RaYY2D1 Hze8AQPxLz2ggSx825OuRhRwTEx5aSZfbLpR+0fM5LixybqswsV0hT50BFaokCVSNnxF afyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505466; x=1685097466; 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=C4uJN0iy+s7MSPURvkGvWZYRnxu2nNdOIstdrqPSpeQ=; b=aGCLh16fgAnF8/4GuFT1ACBKw/jE5GGaUqO/A1vHlfp6ngHuTgr8y+MpNAOR5vZzPO J11/DiZQuJul8plYox2GQEjO7aUY41VRLpLB25Z4c/uRIytAPKeiUTszuuKwvfT2cny/ lTOPZCGQYCJnw8k+Q3yqWQt9qav7FItqdkUUUAO7uv0dF7vee3jlsrpRmIiaE+D+iwGM j8NcX7n58T9PMpgm0MlWQyw6f+aVOU30l06IoXbs/P6uqpSsOo7BSr75N5WOkciaecNh TGYledjB+r67NwOZRtGVY8Owvp5S2+JX3siLnrP7AARztjtjeMAH72dtz8hJfIKGNKC2 eyeA== X-Gm-Message-State: AAQBX9fDhTLhpDQc7sViBOGD+110D2dQpsloq1leHnWLxm/m7OfliJSN fRF04aHG8o43rUfdFADF9viZ8A== X-Google-Smtp-Source: AKy350aApsuTgl9wiOD/WIt93YWeSgFqEYRdAqIas1XWbYxG/d99e0X9mqMaH2+kABeMw3McFdIQnA== X-Received: by 2002:a17:90a:e518:b0:247:2288:851d with SMTP id t24-20020a17090ae51800b002472288851dmr19206318pjy.35.1682505466486; Wed, 26 Apr 2023 03:37:46 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.37.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:37:46 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 06/48] igb: Clear IMS bits when committing ICR access Date: Wed, 26 Apr 2023 19:36:34 +0900 Message-Id: <20230426103716.26279-7-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::1035; envelope-from=akihiko.odaki@daynix.com; helo=mail-pj1-x1035.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The datasheet says contradicting statements regarding ICR accesses so it is not reliable to determine the behavior of ICR accesses. However, e1000e does clear IMS bits when reading ICR accesses and Linux also expects ICR accesses will clear IMS bits according to: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/ethernet/intel/igb/igb_main.c?h=v6.2#n8048 Fixes: 3a977deebe ("Intrdocue igb device emulation") Signed-off-by: Akihiko Odaki Reviewed-by: Sriram Yagnaraman --- hw/net/igb_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index 96a118b6c1..eaca5bd2b6 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -2452,16 +2452,16 @@ igb_set_ims(IGBCore *core, int index, uint32_t val) static void igb_commit_icr(IGBCore *core) { /* - * If GPIE.NSICR = 0, then the copy of IAM to IMS will occur only if at + * If GPIE.NSICR = 0, then the clear of IMS will occur only if at * least one bit is set in the IMS and there is a true interrupt as * reflected in ICR.INTA. */ if ((core->mac[GPIE] & E1000_GPIE_NSICR) || (core->mac[IMS] && (core->mac[ICR] & E1000_ICR_INT_ASSERTED))) { - igb_set_ims(core, IMS, core->mac[IAM]); - } else { - igb_update_interrupt_state(core); + igb_clear_ims_bits(core, core->mac[IAM]); } + + igb_update_interrupt_state(core); } static void igb_set_icr(IGBCore *core, int index, uint32_t val) From patchwork Wed Apr 26 10:36:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773993 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=Z8l6vo9j; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wPp19zKz23vF for ; Wed, 26 Apr 2023 20:40:46 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcXA-0008Gy-Ra; Wed, 26 Apr 2023 06:38:00 -0400 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 1prcX5-0007y0-Am for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:37:58 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcX1-0002sb-Df for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:37:54 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-63b5465fc13so5518571b3a.3 for ; Wed, 26 Apr 2023 03:37:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505470; x=1685097470; 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=XbX0kk3EzojZbFg8WaqmfhGqaNouPuKvplrb+Gup2Js=; b=Z8l6vo9jmwwf1LpKQbcajBCSi6S49l0uZlj/H6Y2JbWfjnk4VSuzACFz4oFA4qkMEt YJHg8r5daDKLWySO5wuUY09NCsh4om98rfgDsC/y3GHvvqOjTyJkN57w6VrjBXOgwEuF YAUBr96HZQ78x4qpXiwHBL9/q4L5Rj5BAN8DZ9PckbABdGmSuyvQ3BEREcW6P+ty1D2f CUYcnY8MGhBQVd9yCtjgk/fSNRdueJfZjvyVkI7ZbcH1DFnDFqD8C9DaSaKpCCDChmFz XksawBHRwWRij8c62JISSpESrHHo6AIqrHaVddIHWMqt3M1kFamZ+WQ/sjm7Z/lEBg1J qB0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505470; x=1685097470; 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=XbX0kk3EzojZbFg8WaqmfhGqaNouPuKvplrb+Gup2Js=; b=XdTQaZ4acjHxnVdJv3kYI9VJv+/oC7/PLqP+Em+jpR/J88sUp3XvDbNTuudWAB+P/Z Usis957uBcrxqEkNSb/abyQ+ybAb8zEHc6Tw6T+iLyX56/vRTb0UlMBr4XB7+2ohk56g T7wFASX16eoa788pJpTLlFKIGkOw/jVGr/VEli3LOD/FFG4veKpWUeJIJ9M/0ZljaTbp +yiG4CkPmZWL2CC7BYYpBOVsyBiaJQrgi6VJiZZDTY1KWAEhDC6RcoShXo5lQB3HS73Y oI9Cl+6NCptsvk523wy6lXROOrDnzDXwzmmJCHGXkNRieecRN+mw51kot1C0cVTehYAz vccg== X-Gm-Message-State: AAQBX9dqPwlDAqJSsy1YKJTX8YLAmWlJn5/NMLC6aIttAvyCX2xJh66w oLn+gpUAJt5ShIjiYrgiXld1kQ== X-Google-Smtp-Source: AKy350bZ7ruW7CVkM772gjrDRcmOzENwlwPXrOSQ+zVMz6aQQkukJLdUMfUzTAoLzt64IMgCFDACeA== X-Received: by 2002:a05:6a20:a40e:b0:ee:f064:9b00 with SMTP id z14-20020a056a20a40e00b000eef0649b00mr19360633pzk.45.1682505469959; Wed, 26 Apr 2023 03:37:49 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.37.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:37:49 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 07/48] net/net_rx_pkt: Use iovec for net_rx_pkt_set_protocols() Date: Wed, 26 Apr 2023 19:36:35 +0900 Message-Id: <20230426103716.26279-8-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::42a; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42a.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org igb does not properly ensure the buffer passed to net_rx_pkt_set_protocols() is contiguous for the entire L2/L3/L4 header. Allow it to pass scattered data to net_rx_pkt_set_protocols(). Fixes: 3a977deebe ("Intrdocue igb device emulation") Signed-off-by: Akihiko Odaki Reviewed-by: Sriram Yagnaraman --- hw/net/net_rx_pkt.h | 10 ++++++---- include/net/eth.h | 6 +++--- hw/net/igb_core.c | 2 +- hw/net/net_rx_pkt.c | 14 +++++--------- hw/net/virtio-net.c | 7 +++++-- hw/net/vmxnet3.c | 7 ++++++- net/eth.c | 18 ++++++++---------- 7 files changed, 34 insertions(+), 30 deletions(-) diff --git a/hw/net/net_rx_pkt.h b/hw/net/net_rx_pkt.h index d00b484900..a06f5c2675 100644 --- a/hw/net/net_rx_pkt.h +++ b/hw/net/net_rx_pkt.h @@ -55,12 +55,14 @@ size_t net_rx_pkt_get_total_len(struct NetRxPkt *pkt); * parse and set packet analysis results * * @pkt: packet - * @data: pointer to the data buffer to be parsed - * @len: data length + * @iov: received data scatter-gather list + * @iovcnt: number of elements in iov + * @iovoff: data start offset in the iov * */ -void net_rx_pkt_set_protocols(struct NetRxPkt *pkt, const void *data, - size_t len); +void net_rx_pkt_set_protocols(struct NetRxPkt *pkt, + const struct iovec *iov, size_t iovcnt, + size_t iovoff); /** * fetches packet analysis results diff --git a/include/net/eth.h b/include/net/eth.h index c5ae4493b4..9f19c3a695 100644 --- a/include/net/eth.h +++ b/include/net/eth.h @@ -312,10 +312,10 @@ eth_get_l2_hdr_length(const void *p) } static inline uint32_t -eth_get_l2_hdr_length_iov(const struct iovec *iov, int iovcnt) +eth_get_l2_hdr_length_iov(const struct iovec *iov, size_t iovcnt, size_t iovoff) { uint8_t p[sizeof(struct eth_header) + sizeof(struct vlan_header)]; - size_t copied = iov_to_buf(iov, iovcnt, 0, p, ARRAY_SIZE(p)); + size_t copied = iov_to_buf(iov, iovcnt, iovoff, p, ARRAY_SIZE(p)); if (copied < ARRAY_SIZE(p)) { return copied; @@ -397,7 +397,7 @@ typedef struct eth_l4_hdr_info_st { bool has_tcp_data; } eth_l4_hdr_info; -void eth_get_protocols(const struct iovec *iov, int iovcnt, +void eth_get_protocols(const struct iovec *iov, size_t iovcnt, size_t iovoff, bool *hasip4, bool *hasip6, size_t *l3hdr_off, size_t *l4hdr_off, diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index eaca5bd2b6..21a8d9ada4 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -1650,7 +1650,7 @@ igb_receive_internal(IGBCore *core, const struct iovec *iov, int iovcnt, ehdr = PKT_GET_ETH_HDR(filter_buf); net_rx_pkt_set_packet_type(core->rx_pkt, get_eth_packet_type(ehdr)); - net_rx_pkt_set_protocols(core->rx_pkt, filter_buf, size); + net_rx_pkt_set_protocols(core->rx_pkt, iov, iovcnt, iov_ofs); queues = igb_receive_assign(core, ehdr, size, &rss_info, external_tx); if (!queues) { diff --git a/hw/net/net_rx_pkt.c b/hw/net/net_rx_pkt.c index 39cdea06de..63be6e05ad 100644 --- a/hw/net/net_rx_pkt.c +++ b/hw/net/net_rx_pkt.c @@ -103,7 +103,7 @@ net_rx_pkt_pull_data(struct NetRxPkt *pkt, iov, iovcnt, ploff, pkt->tot_len); } - eth_get_protocols(pkt->vec, pkt->vec_len, &pkt->hasip4, &pkt->hasip6, + eth_get_protocols(pkt->vec, pkt->vec_len, 0, &pkt->hasip4, &pkt->hasip6, &pkt->l3hdr_off, &pkt->l4hdr_off, &pkt->l5hdr_off, &pkt->ip6hdr_info, &pkt->ip4hdr_info, &pkt->l4hdr_info); @@ -186,17 +186,13 @@ size_t net_rx_pkt_get_total_len(struct NetRxPkt *pkt) return pkt->tot_len; } -void net_rx_pkt_set_protocols(struct NetRxPkt *pkt, const void *data, - size_t len) +void net_rx_pkt_set_protocols(struct NetRxPkt *pkt, + const struct iovec *iov, size_t iovcnt, + size_t iovoff) { - const struct iovec iov = { - .iov_base = (void *)data, - .iov_len = len - }; - assert(pkt); - eth_get_protocols(&iov, 1, &pkt->hasip4, &pkt->hasip6, + eth_get_protocols(iov, iovcnt, iovoff, &pkt->hasip4, &pkt->hasip6, &pkt->l3hdr_off, &pkt->l4hdr_off, &pkt->l5hdr_off, &pkt->ip6hdr_info, &pkt->ip4hdr_info, &pkt->l4hdr_info); } diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 53e1c32643..37551fd854 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1835,9 +1835,12 @@ static int virtio_net_process_rss(NetClientState *nc, const uint8_t *buf, VIRTIO_NET_HASH_REPORT_UDPv6, VIRTIO_NET_HASH_REPORT_UDPv6_EX }; + struct iovec iov = { + .iov_base = (void *)buf, + .iov_len = size + }; - net_rx_pkt_set_protocols(pkt, buf + n->host_hdr_len, - size - n->host_hdr_len); + net_rx_pkt_set_protocols(pkt, &iov, 1, n->host_hdr_len); net_rx_pkt_get_protocols(pkt, &hasip4, &hasip6, &l4hdr_proto); net_hash_type = virtio_net_get_hash_type(hasip4, hasip6, l4hdr_proto, n->rss_data.hash_types); diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c index 9acff310e7..05f41b6dfa 100644 --- a/hw/net/vmxnet3.c +++ b/hw/net/vmxnet3.c @@ -2001,7 +2001,12 @@ vmxnet3_receive(NetClientState *nc, const uint8_t *buf, size_t size) get_eth_packet_type(PKT_GET_ETH_HDR(buf))); if (vmxnet3_rx_filter_may_indicate(s, buf, size)) { - net_rx_pkt_set_protocols(s->rx_pkt, buf, size); + struct iovec iov = { + .iov_base = (void *)buf, + .iov_len = size + }; + + net_rx_pkt_set_protocols(s->rx_pkt, &iov, 1, 0); vmxnet3_rx_need_csum_calculate(s->rx_pkt, buf, size); net_rx_pkt_attach_data(s->rx_pkt, buf, size, s->rx_vlan_stripping); bytes_indicated = vmxnet3_indicate_packet(s) ? size : -1; diff --git a/net/eth.c b/net/eth.c index 70bcd8e355..d7b30df79f 100644 --- a/net/eth.c +++ b/net/eth.c @@ -136,7 +136,7 @@ _eth_tcp_has_data(bool is_ip4, return l4len > TCP_HEADER_DATA_OFFSET(tcp); } -void eth_get_protocols(const struct iovec *iov, int iovcnt, +void eth_get_protocols(const struct iovec *iov, size_t iovcnt, size_t iovoff, bool *hasip4, bool *hasip6, size_t *l3hdr_off, size_t *l4hdr_off, @@ -147,26 +147,24 @@ void eth_get_protocols(const struct iovec *iov, int iovcnt, { int proto; bool fragment = false; - size_t l2hdr_len = eth_get_l2_hdr_length_iov(iov, iovcnt); size_t input_size = iov_size(iov, iovcnt); size_t copied; uint8_t ip_p; *hasip4 = *hasip6 = false; + *l3hdr_off = iovoff + eth_get_l2_hdr_length_iov(iov, iovcnt, iovoff); l4hdr_info->proto = ETH_L4_HDR_PROTO_INVALID; - proto = eth_get_l3_proto(iov, iovcnt, l2hdr_len); - - *l3hdr_off = l2hdr_len; + proto = eth_get_l3_proto(iov, iovcnt, *l3hdr_off); if (proto == ETH_P_IP) { struct ip_header *iphdr = &ip4hdr_info->ip4_hdr; - if (input_size < l2hdr_len) { + if (input_size < *l3hdr_off) { return; } - copied = iov_to_buf(iov, iovcnt, l2hdr_len, iphdr, sizeof(*iphdr)); + copied = iov_to_buf(iov, iovcnt, *l3hdr_off, iphdr, sizeof(*iphdr)); if (copied < sizeof(*iphdr) || IP_HEADER_VERSION(iphdr) != IP_HEADER_VERSION_4) { return; @@ -175,17 +173,17 @@ void eth_get_protocols(const struct iovec *iov, int iovcnt, *hasip4 = true; ip_p = iphdr->ip_p; ip4hdr_info->fragment = IP4_IS_FRAGMENT(iphdr); - *l4hdr_off = l2hdr_len + IP_HDR_GET_LEN(iphdr); + *l4hdr_off = *l3hdr_off + IP_HDR_GET_LEN(iphdr); fragment = ip4hdr_info->fragment; } else if (proto == ETH_P_IPV6) { - if (!eth_parse_ipv6_hdr(iov, iovcnt, l2hdr_len, ip6hdr_info)) { + if (!eth_parse_ipv6_hdr(iov, iovcnt, *l3hdr_off, ip6hdr_info)) { return; } *hasip6 = true; ip_p = ip6hdr_info->l4proto; - *l4hdr_off = l2hdr_len + ip6hdr_info->full_hdr_len; + *l4hdr_off = *l3hdr_off + ip6hdr_info->full_hdr_len; fragment = ip6hdr_info->fragment; } else { return; From patchwork Wed Apr 26 10:36:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773972 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=xbp7JSXw; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wLr4D7jz23vG for ; Wed, 26 Apr 2023 20:38:12 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcXE-0008Oi-Vx; Wed, 26 Apr 2023 06:38:05 -0400 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 1prcX7-00081Y-9b for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:37:58 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcX5-0002vu-Ll for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:37:56 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-63b50a02bffso5717756b3a.2 for ; Wed, 26 Apr 2023 03:37:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505473; x=1685097473; 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=NNBRwTKoPfNm6mzC2ZqFXQ6r5NBvVjojYda1M3prEL8=; b=xbp7JSXw9OygpZBL6B/c1fxfo9gN4SrniVh441BTLn5CpfyxA5Peh9w3xTvdoTm5wn P1xYUEG2Ymutk8R8qDudag9KUpl+0sCpFTk7u0yB9dLuXmdEoBzUCgL5Q2T2ioEZoD/8 992fKe7D2ncfnOcBpYUPw+eO4fQzVIONH7PydqolflGl6W1jAhGTZ7xR4gfS6h33o29y s8PWQwhcQRzahUf5OyW+mkFQDIzOy2YO71KafX3e0KhBQJaERa4Rf8G5jX7KLfDR1gAW PDcZl4KODURv2raCPhVR4auGX+OBOa+y/Qhx+d2UcQrdrw0PmiHQdNalqZZ5ySlVxvtO uDdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505473; x=1685097473; 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=NNBRwTKoPfNm6mzC2ZqFXQ6r5NBvVjojYda1M3prEL8=; b=DnNkXtqLQrTiy8Vyyo+5GBf8y0nx6+g2EEjKiWajgfAVICM5EYR+C7UzolGWNd84al Wenj3mNPpGqeHWheIzCxV06rk8a/zIwYVn4/J9AGVPpOyVIqt6X/8uRWmlVuXOMexgsC ljxxn3UoAvrQFro/0vir4Z9ZXt0vN9PAYj9rmEi7HDV5aPWHDOnvqXaIwfRlXv4P2fAb MwP//hL5XfVjN409O6CwfK7sxx3kJk2EWAnP4Y63823C1aCju5AvkPbCf82J0j9htGaR HicPXLSnp9MdCnqec5JndZqIuYOyNV+JI1UtgtJbl2K1UgsvZIDQmfwlbBuFQN3rT0H/ w4mA== X-Gm-Message-State: AAQBX9fjAFSg2jQHR8PFTgAHa4AWIEP8eIT59e5AcT/WlOaiKZVEwnac 5CFm/tyjojKFC+5rGtB3AUCB1A== X-Google-Smtp-Source: AKy350a7cphy69wXGmqwOnc01HtTYtJPprqWQZ4OxJezPtOECYIz3XMFasDz36KjC5B5NtKP+cb4MA== X-Received: by 2002:a05:6a20:4323:b0:ef:bf77:f76f with SMTP id h35-20020a056a20432300b000efbf77f76fmr26933146pzk.4.1682505473467; Wed, 26 Apr 2023 03:37:53 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.37.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:37:53 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 08/48] e1000e: Always copy ethernet header Date: Wed, 26 Apr 2023 19:36:36 +0900 Message-Id: <20230426103716.26279-9-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::42c; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org e1000e_receive_internal() used to check the iov length to determine copy the iovs to a contiguous buffer, but the check is flawed in two ways: - It does not ensure that iovcnt > 0. - It does not take virtio-net header into consideration. The size of this copy is just 18 octets, which can be even less than the code size required for checks. This (wrong) optimization is probably not worth so just remove it. Fixes: 6f3fbe4ed0 ("net: Introduce e1000e device emulation") Signed-off-by: Akihiko Odaki --- hw/net/e1000e_core.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c index c2d864a504..14b94db59c 100644 --- a/hw/net/e1000e_core.c +++ b/hw/net/e1000e_core.c @@ -1686,12 +1686,9 @@ static ssize_t e1000e_receive_internal(E1000ECore *core, const struct iovec *iov, int iovcnt, bool has_vnet) { - static const int maximum_ethernet_hdr_len = (ETH_HLEN + 4); - uint32_t n = 0; - uint8_t min_buf[ETH_ZLEN]; + uint8_t buf[ETH_ZLEN]; struct iovec min_iov; - uint8_t *filter_buf; size_t size, orig_size; size_t iov_ofs = 0; E1000E_RxRing rxr; @@ -1714,24 +1711,21 @@ e1000e_receive_internal(E1000ECore *core, const struct iovec *iov, int iovcnt, net_rx_pkt_unset_vhdr(core->rx_pkt); } - filter_buf = iov->iov_base + iov_ofs; orig_size = iov_size(iov, iovcnt); size = orig_size - iov_ofs; /* Pad to minimum Ethernet frame length */ - if (size < sizeof(min_buf)) { - iov_to_buf(iov, iovcnt, iov_ofs, min_buf, size); - memset(&min_buf[size], 0, sizeof(min_buf) - size); + if (size < sizeof(buf)) { + iov_to_buf(iov, iovcnt, iov_ofs, buf, size); + memset(&buf[size], 0, sizeof(buf) - size); e1000x_inc_reg_if_not_full(core->mac, RUC); - min_iov.iov_base = filter_buf = min_buf; - min_iov.iov_len = size = sizeof(min_buf); + min_iov.iov_base = buf; + min_iov.iov_len = size = sizeof(buf); iovcnt = 1; iov = &min_iov; iov_ofs = 0; - } else if (iov->iov_len < maximum_ethernet_hdr_len) { - /* This is very unlikely, but may happen. */ - iov_to_buf(iov, iovcnt, iov_ofs, min_buf, maximum_ethernet_hdr_len); - filter_buf = min_buf; + } else { + iov_to_buf(iov, iovcnt, iov_ofs, buf, ETH_HLEN + 4); } /* Discard oversized packets if !LPE and !SBP. */ @@ -1740,9 +1734,9 @@ e1000e_receive_internal(E1000ECore *core, const struct iovec *iov, int iovcnt, } net_rx_pkt_set_packet_type(core->rx_pkt, - get_eth_packet_type(PKT_GET_ETH_HDR(filter_buf))); + get_eth_packet_type(PKT_GET_ETH_HDR(buf))); - if (!e1000e_receive_filter(core, filter_buf, size)) { + if (!e1000e_receive_filter(core, buf, size)) { trace_e1000e_rx_flt_dropped(); return orig_size; } From patchwork Wed Apr 26 10:36:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773975 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=hDwSet4X; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wMN3D8Rz23vG for ; Wed, 26 Apr 2023 20:38:40 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcXJ-00006k-A6; Wed, 26 Apr 2023 06:38:11 -0400 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 1prcXA-0008Es-Gc for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:00 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcX8-0002wz-Kq for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:00 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-63b62d2f729so5526286b3a.1 for ; Wed, 26 Apr 2023 03:37:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505477; x=1685097477; 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=vrTwpWJZrAWBLGbRLPI18cIXTQf2vMwVvldgtWhPHt4=; b=hDwSet4XLApxrlnDzn/7ZNnwF0wTi2S2HAt1rBSgEHUImNe5tZ/Lk7t95Ut9rfJMy9 4z1QHgIGsBDESYcSXLM3cuYw78NPxv5RXYc9tYdPM3L3wE/SgjdBjztlLk7HizlD1Hx/ S/k2ogU6h6tgvMux1Cjiaut4r1i62GjiXa2EmWiEr/dj4LB9sHiJVn/bKiboTiYnJy3b 7sFc/DOSNkP3zDsKP+6mK3mAZoYpv6Y7RAus08WMxs+8UXrQ67nL+vD2HiX+rjpvhqnP Bi7jv+7/+DsLqvW0s9gUa2W57Rd5ARUegg0pycJDDsd+fbshlRZZDhEgGBPyb0/s5GT8 SxeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505477; x=1685097477; 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=vrTwpWJZrAWBLGbRLPI18cIXTQf2vMwVvldgtWhPHt4=; b=hnKeRGw6lUNecA1Yxk9eMkoRByscGoHnZd+Ll0TuVtq8ALzAt1TfeqNgp/eEVqNAZY G8ljUVMRrqJp78n/SGHUyxOE7ZEKTU+hHY/8fmWz3R7Qgg4lE8REgtCjVHrRPHdVLWEx 2oZXab2kgwhnpNzkrpLKYRzJnJeiQ/GTxmEGWGHKG4NionZUN8uK+uS5zTRu6hRJ3Wzi NYB8wc7MpKrJKuW6WdQWDImdHRDwrs5E/HTwrx5BzPPnwVo0E3n92aiuhTQMjdiQqjbz ThN3sVm2UPShTavERW0ts2ZNBL3Qp4Io+hwc5rvmYGPOadETF4uUOBEzR+l1J3GzFjRW dxvw== X-Gm-Message-State: AAQBX9dfKjaMqhoz/jfWT6QMLSXXJg7J2zsAsfPtNw2SrqKR8yim+QeK 1X3KIAJp762zG4H3mxz8w2wdDw== X-Google-Smtp-Source: AKy350buKa1WzVhbPyoXssOX2c5tcYX8iirmcer6fqqGxtYA92ookizey92NBuC8I+6jpL6eF0MGTw== X-Received: by 2002:a05:6a00:851:b0:637:920c:25fd with SMTP id q17-20020a056a00085100b00637920c25fdmr28795341pfk.17.1682505476879; Wed, 26 Apr 2023 03:37:56 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.37.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:37:56 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 09/48] igb: Always copy ethernet header Date: Wed, 26 Apr 2023 19:36:37 +0900 Message-Id: <20230426103716.26279-10-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::436; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x436.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org igb_receive_internal() used to check the iov length to determine copy the iovs to a contiguous buffer, but the check is flawed in two ways: - It does not ensure that iovcnt > 0. - It does not take virtio-net header into consideration. The size of this copy is just 22 octets, which can be even less than the code size required for checks. This (wrong) optimization is probably not worth so just remove it. Removing this also allows igb to assume aligned accesses for the ethernet header. Fixes: 3a977deebe ("Intrdocue igb device emulation") Signed-off-by: Akihiko Odaki Reviewed-by: Sriram Yagnaraman --- hw/net/igb_core.c | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index 21a8d9ada4..1123df9e77 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -67,6 +67,11 @@ typedef struct IGBTxPktVmdqCallbackContext { NetClientState *nc; } IGBTxPktVmdqCallbackContext; +typedef struct L2Header { + struct eth_header eth; + struct vlan_header vlan; +} L2Header; + static ssize_t igb_receive_internal(IGBCore *core, const struct iovec *iov, int iovcnt, bool has_vnet, bool *external_tx); @@ -961,15 +966,16 @@ igb_rx_is_oversized(IGBCore *core, uint16_t qn, size_t size) return size > (lpe ? max_ethernet_lpe_size : max_ethernet_vlan_size); } -static uint16_t igb_receive_assign(IGBCore *core, const struct eth_header *ehdr, +static uint16_t igb_receive_assign(IGBCore *core, const L2Header *l2_header, size_t size, E1000E_RSSInfo *rss_info, bool *external_tx) { static const int ta_shift[] = { 4, 3, 2, 0 }; + const struct eth_header *ehdr = &l2_header->eth; uint32_t f, ra[2], *macp, rctl = core->mac[RCTL]; uint16_t queues = 0; uint16_t oversized = 0; - uint16_t vid = lduw_be_p(&PKT_GET_VLAN_HDR(ehdr)->h_tci) & VLAN_VID_MASK; + uint16_t vid = be16_to_cpu(l2_header->vlan.h_tci) & VLAN_VID_MASK; bool accepted = false; int i; @@ -1590,14 +1596,13 @@ static ssize_t igb_receive_internal(IGBCore *core, const struct iovec *iov, int iovcnt, bool has_vnet, bool *external_tx) { - static const int maximum_ethernet_hdr_len = (ETH_HLEN + 4); - uint16_t queues = 0; uint32_t n = 0; - uint8_t min_buf[ETH_ZLEN]; + union { + L2Header l2_header; + uint8_t octets[ETH_ZLEN]; + } buf; struct iovec min_iov; - struct eth_header *ehdr; - uint8_t *filter_buf; size_t size, orig_size; size_t iov_ofs = 0; E1000E_RxRing rxr; @@ -1623,24 +1628,21 @@ igb_receive_internal(IGBCore *core, const struct iovec *iov, int iovcnt, net_rx_pkt_unset_vhdr(core->rx_pkt); } - filter_buf = iov->iov_base + iov_ofs; orig_size = iov_size(iov, iovcnt); size = orig_size - iov_ofs; /* Pad to minimum Ethernet frame length */ - if (size < sizeof(min_buf)) { - iov_to_buf(iov, iovcnt, iov_ofs, min_buf, size); - memset(&min_buf[size], 0, sizeof(min_buf) - size); + if (size < sizeof(buf)) { + iov_to_buf(iov, iovcnt, iov_ofs, &buf, size); + memset(&buf.octets[size], 0, sizeof(buf) - size); e1000x_inc_reg_if_not_full(core->mac, RUC); - min_iov.iov_base = filter_buf = min_buf; - min_iov.iov_len = size = sizeof(min_buf); + min_iov.iov_base = &buf; + min_iov.iov_len = size = sizeof(buf); iovcnt = 1; iov = &min_iov; iov_ofs = 0; - } else if (iov->iov_len < maximum_ethernet_hdr_len) { - /* This is very unlikely, but may happen. */ - iov_to_buf(iov, iovcnt, iov_ofs, min_buf, maximum_ethernet_hdr_len); - filter_buf = min_buf; + } else { + iov_to_buf(iov, iovcnt, iov_ofs, &buf, sizeof(buf.l2_header)); } /* Discard oversized packets if !LPE and !SBP. */ @@ -1648,11 +1650,12 @@ igb_receive_internal(IGBCore *core, const struct iovec *iov, int iovcnt, return orig_size; } - ehdr = PKT_GET_ETH_HDR(filter_buf); - net_rx_pkt_set_packet_type(core->rx_pkt, get_eth_packet_type(ehdr)); + net_rx_pkt_set_packet_type(core->rx_pkt, + get_eth_packet_type(&buf.l2_header.eth)); net_rx_pkt_set_protocols(core->rx_pkt, iov, iovcnt, iov_ofs); - queues = igb_receive_assign(core, ehdr, size, &rss_info, external_tx); + queues = igb_receive_assign(core, &buf.l2_header, size, + &rss_info, external_tx); if (!queues) { trace_e1000e_rx_flt_dropped(); return orig_size; From patchwork Wed Apr 26 10:36:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773976 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=bO5upV/6; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wMg0HM2z23vG for ; Wed, 26 Apr 2023 20:38:55 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcXJ-0000Be-5o; Wed, 26 Apr 2023 06:38:09 -0400 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 1prcXD-0008OK-7K for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:04 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcXB-0002kV-8Q for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:02 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-63b7b54642cso5036765b3a.0 for ; Wed, 26 Apr 2023 03:38:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505480; x=1685097480; 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=hO7vy38C7n7U8m09DYFIOuqZKNDrQj3wd3r1DxexBJ4=; b=bO5upV/6iP6Wuok1QTskvGZ7JwUp9AvXi9NaOrJSWo5K2iPCzwMDYZxSshGkizcE4Z Z5QXCxcVjpsmBiZLjBHOrU6RHR6mLPZNHnPhcgXCkiwKzZqhPZp06jT/8/YBLf9bD7VG i9YWiFcftNy6KDd4CtrLBO2RZQqfxCLF3udbgexT6APnp/OTNmY4m7P0YI8lBuHvP4KV GM1Vv4uJvCGGQ2OsCL0oh5/XNK6paRDdPPuaXsc9GBpMTbl8cUrjV/+M6RES5M9bC6bQ MOGHUeOqvFDzL+clhtaeUxMQMMJJEH6lKilqN3S90ekw7t/9eIV6H3ivHKlSZIMTD0k4 Qb5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505480; x=1685097480; 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=hO7vy38C7n7U8m09DYFIOuqZKNDrQj3wd3r1DxexBJ4=; b=hIHb+2CwCibFhRRI8gNoisZEpQVA2BU8fO5SgP3uyK9KiVLaY2ZuAYcvTeMU4Qarrm 8HO2T6eg3Tz/ShDbnfWcYZSJYRZskxbOAx2a2TqEti4beg27cRE6c7vNyNxqhY74Tey+ mJEAuaSBOFBrnN/jUo6W3Uc0AkRAI3PHeGlcm2Zn5Hj+EZ415jwekRA69jJSY78cq4Tp +PFBAPwl3+gJ7EgjC7hoWWcjGd+0qrw75g/2209vRPVzOZ7w2X5zoWJ5G6Oj/3uwqyXR OXXDKvKQgQFS22dWy+ovn/m54mDh8tKTdyAN52sSYybVdggqknk2hXEcjCoRtV0Qx1zE 84Ow== X-Gm-Message-State: AAQBX9f0FDDzwSxXJaUgLDpWD3/4UoL5IWpFsbZk9k+lkWOG5SlWH41u uQHA7uedfIKJloLH/nXB8llHBg== X-Google-Smtp-Source: AKy350bDAjvXpZn0k8RPFOag6oBE4nWzhR7VSX2Gq62nQEBO6RMiDfxwOA7H0+1uPKHc+z7TNH5f2Q== X-Received: by 2002:a05:6a00:23c5:b0:63a:8f4c:8be1 with SMTP id g5-20020a056a0023c500b0063a8f4c8be1mr28201130pfc.10.1682505480529; Wed, 26 Apr 2023 03:38:00 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.37.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:38:00 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 10/48] Fix references to igb Avocado test Date: Wed, 26 Apr 2023 19:36:38 +0900 Message-Id: <20230426103716.26279-11-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::42c; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Fixes: 9f95111474 ("tests/avocado: re-factor igb test to avoid timeouts") Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daudé --- MAINTAINERS | 2 +- docs/system/devices/igb.rst | 2 +- scripts/ci/org.centos/stream/8/x86_64/test-avocado | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index ef45b5e71e..c31d2279ab 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2256,7 +2256,7 @@ R: Sriram Yagnaraman S: Maintained F: docs/system/devices/igb.rst F: hw/net/igb* -F: tests/avocado/igb.py +F: tests/avocado/netdev-ethtool.py F: tests/qtest/igb-test.c F: tests/qtest/libqos/igb.c diff --git a/docs/system/devices/igb.rst b/docs/system/devices/igb.rst index 70edadd574..afe036dad2 100644 --- a/docs/system/devices/igb.rst +++ b/docs/system/devices/igb.rst @@ -60,7 +60,7 @@ Avocado test and can be ran with the following command: .. code:: shell - make check-avocado AVOCADO_TESTS=tests/avocado/igb.py + make check-avocado AVOCADO_TESTS=tests/avocado/netdev-ethtool.py References ========== diff --git a/scripts/ci/org.centos/stream/8/x86_64/test-avocado b/scripts/ci/org.centos/stream/8/x86_64/test-avocado index d2c0e5fb4c..a1aa601ee3 100755 --- a/scripts/ci/org.centos/stream/8/x86_64/test-avocado +++ b/scripts/ci/org.centos/stream/8/x86_64/test-avocado @@ -30,7 +30,7 @@ make get-vm-images tests/avocado/cpu_queries.py:QueryCPUModelExpansion.test \ tests/avocado/empty_cpu_model.py:EmptyCPUModel.test \ tests/avocado/hotplug_cpu.py:HotPlugCPU.test \ - tests/avocado/igb.py:IGB.test \ + tests/avocado/netdev-ethtool.py:NetDevEthtool.test_igb_nomsi \ tests/avocado/info_usernet.py:InfoUsernet.test_hostfwd \ tests/avocado/intel_iommu.py:IntelIOMMU.test_intel_iommu \ tests/avocado/intel_iommu.py:IntelIOMMU.test_intel_iommu_pt \ From patchwork Wed Apr 26 10:36:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1774005 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=lgqhn4iN; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wT14FJFz23vF for ; Wed, 26 Apr 2023 20:43:33 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcXP-0000Tu-Q9; Wed, 26 Apr 2023 06:38:15 -0400 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 1prcXG-000058-OX for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:07 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcXF-0002yn-CF for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:06 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-63b64a32fd2so8911623b3a.2 for ; Wed, 26 Apr 2023 03:38:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505484; x=1685097484; 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=3xDGlD2yRV3C0PkIp3jpH6p4fU6/buA90WdM6GaBzNs=; b=lgqhn4iN03rUJkZwDFZkkGjNv26Fbtjs3m5FtWWodbuVS6NeGeb+j19y9XUuGQtLPc P7H0PlJf7f825VtzCBLtFPdCtvjp5ffG20OqOqcMBvOiKFlzJDU90D1YsEi/qsRq13Ji kyBoS+B8J+CkznBdNx7ScNw6CLM0s8RKCsyW2SoFNXSRevQ5B2ttXKVIWlcnvaVhXmMV B0YY72StsJsHVhoMBFlcU4Ag/JfJ1PcESn8ZixMdPx97xmDiDyRR/wmq+xT+sBsfRFpx J+a0WSJB/su2AibGJNA0fWAk0pZOcLOTXWz45rOT8z0M2QO99BtfsGPW+TTHuHYBx4e/ ZNpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505484; x=1685097484; 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=3xDGlD2yRV3C0PkIp3jpH6p4fU6/buA90WdM6GaBzNs=; b=G11Fkh8711sZMJGbjVX6EIjiK1COev+l9Z28tGHTghTgkrSoJUQQ1oJd3uqcIkRBu4 d7RnyRQBeDiDQPbyZrqlHRPXl/dOxUFRRn4bscOAzdvvLZQ3RONKHoJVVFlfx+Ny/EYc oVmzT8fvAD0XJ9087rhk6w1je0YZFqVRpnGVksn58aAu+SoRdosL5SsaASdnaXL2i3W2 R2R4fEh2UvuHWCXNb7prQRSq7gkUwYhr1iizdXgwjirhAQlwuN095+BPH6Y2aEIQcAS8 LXhmaMIOvsOYv0beJwoY0ZVPMh3QySSIEyszTaOWRoQjCblcSRqGMkI2TDCnx0Tx6L3S WNAA== X-Gm-Message-State: AAQBX9cF5gmY6aXdl9LgiNJLGthsqz3i2FLJQagfxhP7WJwzcLHDelYn j3qQCVetS0kukLCYu3vebwLFeVi5gego8sB0lRE= X-Google-Smtp-Source: AKy350Yt4urDFP8PwdFkhqEaEcWD0RdYG+XA/aHN7NJNCrlRKQ07JPzCw8Z5bxZL2ibiAtTuo05NkQ== X-Received: by 2002:aa7:88c1:0:b0:63d:255f:36f4 with SMTP id k1-20020aa788c1000000b0063d255f36f4mr29145946pff.3.1682505484093; Wed, 26 Apr 2023 03:38:04 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.38.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:38:03 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 11/48] tests/avocado: Remove unused imports Date: Wed, 26 Apr 2023 19:36:39 +0900 Message-Id: <20230426103716.26279-12-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::436; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x436.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Akihiko Odaki --- tests/avocado/netdev-ethtool.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/avocado/netdev-ethtool.py b/tests/avocado/netdev-ethtool.py index f7e9464184..8de118e313 100644 --- a/tests/avocado/netdev-ethtool.py +++ b/tests/avocado/netdev-ethtool.py @@ -7,7 +7,6 @@ from avocado import skip from avocado_qemu import QemuSystemTest -from avocado_qemu import exec_command, exec_command_and_wait_for_pattern from avocado_qemu import wait_for_console_pattern class NetDevEthtool(QemuSystemTest): From patchwork Wed Apr 26 10:36:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773986 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=HoB18tD/; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wNt0Ppqz23vG for ; Wed, 26 Apr 2023 20:39:58 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcXR-0000eC-6g; Wed, 26 Apr 2023 06:38:17 -0400 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 1prcXL-0000Mc-GG for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:13 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcXJ-0002zn-Ab for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:10 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-63b733fd00bso5546022b3a.0 for ; Wed, 26 Apr 2023 03:38:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505487; x=1685097487; 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=AUBKW0bOVpI3HeJe5UwSavvtooPoaFokXdNy31dH5Ac=; b=HoB18tD/xWW7xAzalUFg1eeRYzgp2ZpikX5n2t8+K5me5ET0G8Kd29qQQ/BH/2bryL bS1yTBYoVZXu/Eko+9Hiu3S4VlEgaFFfTBciXEGKpSaOdR/QLARfMz+jVOesx2b/Lie7 bXW0YziMP/seIGPYs8JkQ9QbN2EGVmzzxrjzjN6q6JEZ+swIari+Ja3HgEztr6biHV4U f3caXTTaeup/bG7TvFChX0BriHJQaJPMXxPsZ1i4rHD1IX6WBmKkp0e1xuD1RmdswJA5 mBASJ/Lhj9t4DZbpSJ3dmzpjcj1SzRLHtAotQkPk4IEdrzCWLmMhs6AaaxJY9znJrwRv jZnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505487; x=1685097487; 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=AUBKW0bOVpI3HeJe5UwSavvtooPoaFokXdNy31dH5Ac=; b=Mp3t2yqcXLWRM882zSMo/PX6Z1BwmBbG1Bv+xjKGWXSC3xENOWCFftnMdU3Jsmd5lS BMy4MRXNaWj4UA8y5EMHAIcbhEVXNvM3GBTqIYIxVwwtpT+qZAJHHU4CxFZG6P/xN03Q 3wgSHLAr//dNlZkkxzo4STA9AnRw28Uag6f3eNgPEc8b0vWE5k+fUmJAUn1TOhtPYeSx qHn3GuVFrfWaMXJHZsbsM+SoeSjt4/9O6+/cq4kRDWVEM6vlDMxt0zVaeQN8bufnWksY 42JdQWnE5QBzfiZZtDeeQ5xceiXX5BEjRDrOIYQtcI0KYCg7Wz6+66Ti5IJnb3CcxfwB TPgA== X-Gm-Message-State: AAQBX9fonosxQU3gfH0QjI/Z17qrhlTTB02u2tDIJIG6EUT5U+NtTCGW AB8+EYnH5b1/nPfRcE9XcSV7Nw== X-Google-Smtp-Source: AKy350arZTQOsK9HVarWs6jmUVJy+OgyUiCe1nR813+0T2yLDf7hbMgSIv34ZHEGxH8h0WMDlCVVBA== X-Received: by 2002:a05:6a00:851:b0:637:920c:25fd with SMTP id q17-20020a056a00085100b00637920c25fdmr28796045pfk.17.1682505487566; Wed, 26 Apr 2023 03:38:07 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.38.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:38:07 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 12/48] tests/avocado: Remove test_igb_nomsi_kvm Date: Wed, 26 Apr 2023 19:36:40 +0900 Message-Id: <20230426103716.26279-13-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::430; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x430.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org It is unlikely to find more bugs with KVM so remove test_igb_nomsi_kvm to save time to run it. Signed-off-by: Akihiko Odaki Reviewed-by: Thomas Huth Acked-by: Alex Bennée --- tests/avocado/netdev-ethtool.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/tests/avocado/netdev-ethtool.py b/tests/avocado/netdev-ethtool.py index 8de118e313..6da800f62b 100644 --- a/tests/avocado/netdev-ethtool.py +++ b/tests/avocado/netdev-ethtool.py @@ -29,7 +29,7 @@ def get_asset(self, name, sha1): # URL into a unique one return self.fetch_asset(name=name, locations=(url), asset_hash=sha1) - def common_test_code(self, netdev, extra_args=None, kvm=False): + def common_test_code(self, netdev, extra_args=None): # This custom kernel has drivers for all the supported network # devices we can emulate in QEMU @@ -57,9 +57,6 @@ def common_test_code(self, netdev, extra_args=None, kvm=False): '-drive', drive, '-device', netdev) - if kvm: - self.vm.add_args('-accel', 'kvm') - self.vm.set_console(console_index=0) self.vm.launch() @@ -86,13 +83,6 @@ def test_igb_nomsi(self): """ self.common_test_code("igb", "pci=nomsi") - def test_igb_nomsi_kvm(self): - """ - :avocado: tags=device:igb - """ - self.require_accelerator('kvm') - self.common_test_code("igb", "pci=nomsi", True) - # It seems the other popular cards we model in QEMU currently fail # the pattern test with: # From patchwork Wed Apr 26 10:36:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773988 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=qt6Km7g+; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wP031Whz23vG for ; Wed, 26 Apr 2023 20:40:04 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcXR-0000cg-2N; Wed, 26 Apr 2023 06:38:17 -0400 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 1prcXO-0000PF-7h for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:15 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcXM-00030n-Kk for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:13 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-63d2ba63dddso5514027b3a.2 for ; Wed, 26 Apr 2023 03:38:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505491; x=1685097491; 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=s7PZIm04ooSj6Ki8OsJLg23id0yLR39T0g3+u0vz1Wk=; b=qt6Km7g+mwxkylJEodBnnUaezb1aADW6RH3u+V2RPeCUoboBA+jwFADGGV67Rp73sW mWHhKPY8KEDg1akkmUwrToh8g1QTuUGlEloWwYHGm1zXRYm1JqPo4xVoWg1ea99/JPp3 0qBG2iaaamYI8adNRfFNvp3j4OQcnr0PEeBQQz7XoVj8l9z3QFrOaobpQF9HiUbVLP50 JyqeWQybsNDZZtK02XWSjux4ZM3JQtASysO6K6ar3M3WU527POw9KyMcFJZDbmSAE7Pj mtYFlTPElagBGtLa2ac0mW55OYq7d1kMiQsRXNbmSX5dudQ0hk7NWpX1UnPB8A1roTUC 1ykw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505491; x=1685097491; 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=s7PZIm04ooSj6Ki8OsJLg23id0yLR39T0g3+u0vz1Wk=; b=f/BHguirskppKkwLdt9D3TPz67dIN2fhEvND7rgRQtrgtvtQPiO7BihW3QDDlyOkNY d5MzFXxmsYofBQfekxaBtTumEPZllt1xBWw+lteRy8DOizCDSskec24IG+2chxNNFnFM dQgCQ8GLrfblf4+Qc84yBrD31jXe4aPni6yt8q8CSU9xQWfva+2FU/I5mhJpZABvuRrM AvI6OPgNbMOaBbsqtaTy3j7SQ/W4elYC/RoVy25pgVUPL5hEQzmCKik/gFCqf8Qvxqui a9oHVIzNu7wUX3r5kiH6lzMH4w7tN3i7y9IkwL41g5p6UWRz9LS3LfueH2Th9Xvk0ZRW WcaQ== X-Gm-Message-State: AAQBX9e81rgLsHmLLJfnMUxUZjm4yuoNrpTy6A3XN5wEpIKZYwooINxL ZabItEQwPbMyt4/gXipEBDOuLA== X-Google-Smtp-Source: AKy350a1wjmfhn1khydsTbSyTJtAiudDdZroeFzayNO/uplm6f3q6cUo4Gvv2Svd20mw5eHa+HZCHQ== X-Received: by 2002:a05:6a21:788b:b0:d9:2cef:949a with SMTP id bf11-20020a056a21788b00b000d92cef949amr27901528pzc.28.1682505491072; Wed, 26 Apr 2023 03:38:11 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.38.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:38:10 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 13/48] hw/net/net_tx_pkt: Remove net_rx_pkt_get_l4_info Date: Wed, 26 Apr 2023 19:36:41 +0900 Message-Id: <20230426103716.26279-14-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::42b; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This function is not used. Signed-off-by: Akihiko Odaki --- hw/net/net_rx_pkt.h | 9 --------- hw/net/net_rx_pkt.c | 5 ----- 2 files changed, 14 deletions(-) diff --git a/hw/net/net_rx_pkt.h b/hw/net/net_rx_pkt.h index a06f5c2675..ce8dbdb284 100644 --- a/hw/net/net_rx_pkt.h +++ b/hw/net/net_rx_pkt.h @@ -119,15 +119,6 @@ eth_ip6_hdr_info *net_rx_pkt_get_ip6_info(struct NetRxPkt *pkt); */ eth_ip4_hdr_info *net_rx_pkt_get_ip4_info(struct NetRxPkt *pkt); -/** - * fetches L4 header analysis results - * - * Return: pointer to analysis results structure which is stored in internal - * packet area. - * - */ -eth_l4_hdr_info *net_rx_pkt_get_l4_info(struct NetRxPkt *pkt); - typedef enum { NetPktRssIpV4, NetPktRssIpV4Tcp, diff --git a/hw/net/net_rx_pkt.c b/hw/net/net_rx_pkt.c index 63be6e05ad..6125a063d7 100644 --- a/hw/net/net_rx_pkt.c +++ b/hw/net/net_rx_pkt.c @@ -236,11 +236,6 @@ eth_ip4_hdr_info *net_rx_pkt_get_ip4_info(struct NetRxPkt *pkt) return &pkt->ip4hdr_info; } -eth_l4_hdr_info *net_rx_pkt_get_l4_info(struct NetRxPkt *pkt) -{ - return &pkt->l4hdr_info; -} - static inline void _net_rx_rss_add_chunk(uint8_t *rss_input, size_t *bytes_written, void *ptr, size_t size) From patchwork Wed Apr 26 10:36:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1774008 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=EdlJtBaK; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wTp745sz23vF for ; Wed, 26 Apr 2023 20:44:14 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcXT-0000wx-8l; Wed, 26 Apr 2023 06:38:19 -0400 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 1prcXR-0000jS-NT for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:17 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcXP-00033K-Uo for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:17 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1a920d484bdso55726155ad.1 for ; Wed, 26 Apr 2023 03:38:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505494; x=1685097494; 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=gSCbOSVRPbfEpQgKQ7GTg6ZDQX9iteIjz577vrXcJ4w=; b=EdlJtBaKHYj+0jcLI/5p5vSQYXESw3zu7wBT7tts1g7+yQEdwJS1Pbm6b57T4DQxDS XnagHYF1fTj/S9iHfiltV8q7eOx3XPzFpc7MXXZnysk5nB8L7XSGrW1M/Y6rfniJJsZ1 bxcNjudQBE4dh1i+7ru5t0NYqTyQkML+E0U/juQ1gSjpOMCKf33qpV910XUOPm1K2kHL Zs+RzTVXs+v0eSKIyCkW8FGkoFoUWVBAZVuNF5IXK6SUgj5aMeUWdJ2B0eMxUmX+E/d8 lYuACEHikiRfJIbvf12y0rP4TaNDICaoDcQ9G4QIMLs06PrVfBK/9y4IVlXVox31/Wpv OndQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505494; x=1685097494; 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=gSCbOSVRPbfEpQgKQ7GTg6ZDQX9iteIjz577vrXcJ4w=; b=IiBcprpbQ9Dt8N9RlBXAF2DoyEpw23OqRwTfs9OiArgc9aMf/dQURa1HEyBajpakwC pIbCX1fVOgyzbb7VdxmHpAejdFuw0bPuwEeEeSWokYP4BM0CkohXhL4UlmEtH34PPawL BYzo1qNlyVOFMBy32SEFxlYEGwPVCuTJIzAs7UUGHnfUyAFSeBHzoU4xgMftlEBx8Vp9 zvTQff2h68CkOlc1tk+ku5+Fao2iK7fWxg5uaCJaCxM1V9TBBf4/++DpNUeXb/SdlxJa JW2PTfJCN1vRd4cwgFYHHUgusHS0HxaTDoLx1r3vqs5UEsgxNAw4aGJnBJO/exI/8+1c jYSA== X-Gm-Message-State: AAQBX9cDquNfNQUzdkixhZoFWVgtLFAyYE+0yYjO6dOJWQsGx9nGR3AH cZCkdpcNxBsB/Ns/SfWsPHUR0A== X-Google-Smtp-Source: AKy350aDrtBDy9jT2a7Zoh1s4Nm7l5fAOdY95iI5lgFwXxS3diAj8mQ0bIyWXUP7YQgpAyGt8sMQxg== X-Received: by 2002:a17:90b:297:b0:234:f77:d6d2 with SMTP id az23-20020a17090b029700b002340f77d6d2mr19432901pjb.45.1682505494491; Wed, 26 Apr 2023 03:38:14 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.38.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:38:14 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 14/48] net/eth: Rename eth_setup_vlan_headers_ex Date: Wed, 26 Apr 2023 19:36:42 +0900 Message-Id: <20230426103716.26279-15-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::629; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x629.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The old eth_setup_vlan_headers has no user so remove it and rename eth_setup_vlan_headers_ex. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daudé --- include/net/eth.h | 9 +-------- hw/net/net_tx_pkt.c | 2 +- net/eth.c | 2 +- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/include/net/eth.h b/include/net/eth.h index 9f19c3a695..e8af5742be 100644 --- a/include/net/eth.h +++ b/include/net/eth.h @@ -351,16 +351,9 @@ eth_strip_vlan_ex(const struct iovec *iov, int iovcnt, size_t iovoff, uint16_t eth_get_l3_proto(const struct iovec *l2hdr_iov, int iovcnt, size_t l2hdr_len); -void eth_setup_vlan_headers_ex(struct eth_header *ehdr, uint16_t vlan_tag, +void eth_setup_vlan_headers(struct eth_header *ehdr, uint16_t vlan_tag, uint16_t vlan_ethtype, bool *is_new); -static inline void -eth_setup_vlan_headers(struct eth_header *ehdr, uint16_t vlan_tag, - bool *is_new) -{ - eth_setup_vlan_headers_ex(ehdr, vlan_tag, ETH_P_VLAN, is_new); -} - uint8_t eth_get_gso_type(uint16_t l3_proto, uint8_t *l3_hdr, uint8_t l4proto); diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c index cc36750c9b..ce6b102391 100644 --- a/hw/net/net_tx_pkt.c +++ b/hw/net/net_tx_pkt.c @@ -368,7 +368,7 @@ void net_tx_pkt_setup_vlan_header_ex(struct NetTxPkt *pkt, bool is_new; assert(pkt); - eth_setup_vlan_headers_ex(pkt->vec[NET_TX_PKT_L2HDR_FRAG].iov_base, + eth_setup_vlan_headers(pkt->vec[NET_TX_PKT_L2HDR_FRAG].iov_base, vlan, vlan_ethtype, &is_new); /* update l2hdrlen */ diff --git a/net/eth.c b/net/eth.c index d7b30df79f..b6ff89c460 100644 --- a/net/eth.c +++ b/net/eth.c @@ -21,7 +21,7 @@ #include "net/checksum.h" #include "net/tap.h" -void eth_setup_vlan_headers_ex(struct eth_header *ehdr, uint16_t vlan_tag, +void eth_setup_vlan_headers(struct eth_header *ehdr, uint16_t vlan_tag, uint16_t vlan_ethtype, bool *is_new) { struct vlan_header *vhdr = PKT_GET_VLAN_HDR(ehdr); From patchwork Wed Apr 26 10:36:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773994 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=NB4VGusy; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wQ44PPYz23vF for ; Wed, 26 Apr 2023 20:41:00 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcXY-0001MN-3p; Wed, 26 Apr 2023 06:38:24 -0400 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 1prcXW-0001BM-Eb for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:22 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcXT-00034G-98 for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:21 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-63b5c4c769aso8914466b3a.3 for ; Wed, 26 Apr 2023 03:38:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505498; x=1685097498; 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=e46fgum6IqWBAKxjvmqfsH5H5ooO4AdZryMip5aPP70=; b=NB4VGusyO5752BYfpLXqksl0s5Fs8AgKZpIsIqlN9JLbwm9swuXktNRQKf3MZm5IgO Wh1L6lSDopB6+jsRZo4pUC3JXTobXGAaMb1+GeCn78KgwLOhrDKTmrTaTFD2dzXehCBJ ObK0gY1pfgbbddv8TQZGMFAotVzantOwriqtoHjR/+7Hbwn+5YAcAWbzcMt0u42O6sRT 27zGomG7zgLyS8PjNLC+6enkACexkcdjG3k2ENddT2IvR6X5TT29TY3BY8c6HK5tzPlJ 7dPLpVvdighyaIdtczVsorzH/C01+AGRX681X6uDRALEvj7wj2cL0EVnaujE1QA0zvv6 mcNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505498; x=1685097498; 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=e46fgum6IqWBAKxjvmqfsH5H5ooO4AdZryMip5aPP70=; b=SSYedCQ+hlNBm3ljTS2hKHYZs2xs2DQ84tATeS23xjKdgTVpRIL/ktjhPLj/I+OYuD G+mS79qQTDsYcxhgFrkn8xhELITbhLxMQ541Q0YEq0sIC7IVW6hR8u6Dxh8UmUcQNfka ejPtH3a51QFQ4pvbNN3tztoS4ul4PGHwqGT99EPvpdzNictmiiRu+oMj+DnLadDaRwPI Lc8ZheHal/yJkFa6hf8gll87e9EYRZ9OnAO1fLvatI1Rhk/+DqeJBVmUBcNkYPwhEuxZ mh2+wh5NYUX+y8ICQGgSrvAkDxAewxs78CbWf+DLDdeY4UZ+f66IWhrQ6SpuVaO2wQ1J vvEg== X-Gm-Message-State: AAQBX9cdP9nkA7KXvE7fxCQC4g8zbWIe4aLkYKGuLaziHv1Vw4nBkCXx ezg//yg2JQvGBpsimRLw+Ychkw== X-Google-Smtp-Source: AKy350atkl/fJl7Gk1i9h2KLb35ahO6isr3Atsa+WW1jveBve7JIy2tE5KpibL7ALC69ruClIrRTuA== X-Received: by 2002:a05:6a21:789b:b0:f5:b78b:1a0e with SMTP id bf27-20020a056a21789b00b000f5b78b1a0emr10453377pzc.9.1682505497924; Wed, 26 Apr 2023 03:38:17 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.38.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:38:17 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 15/48] e1000x: Share more Rx filtering logic Date: Wed, 26 Apr 2023 19:36:43 +0900 Message-Id: <20230426103716.26279-16-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::432; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x432.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This saves some code and enables tracepoint for e1000's VLAN filtering. Signed-off-by: Akihiko Odaki Reviewed-by: Sriram Yagnaraman --- hw/net/e1000x_common.h | 4 +++- hw/net/e1000.c | 35 +++++-------------------------- hw/net/e1000e_core.c | 47 +++++------------------------------------- hw/net/e1000x_common.c | 44 +++++++++++++++++++++++++++++++++------ hw/net/igb_core.c | 41 +++--------------------------------- hw/net/trace-events | 4 ++-- 6 files changed, 56 insertions(+), 119 deletions(-) diff --git a/hw/net/e1000x_common.h b/hw/net/e1000x_common.h index 0298e06283..be291684de 100644 --- a/hw/net/e1000x_common.h +++ b/hw/net/e1000x_common.h @@ -107,7 +107,9 @@ bool e1000x_rx_ready(PCIDevice *d, uint32_t *mac); bool e1000x_is_vlan_packet(const void *buf, uint16_t vet); -bool e1000x_rx_group_filter(uint32_t *mac, const uint8_t *buf); +bool e1000x_rx_vlan_filter(uint32_t *mac, const struct vlan_header *vhdr); + +bool e1000x_rx_group_filter(uint32_t *mac, const struct eth_header *ehdr); bool e1000x_hw_rx_enabled(uint32_t *mac); diff --git a/hw/net/e1000.c b/hw/net/e1000.c index 18eb6d8876..aae5f0bdc0 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -804,36 +804,11 @@ start_xmit(E1000State *s) } static int -receive_filter(E1000State *s, const uint8_t *buf, int size) +receive_filter(E1000State *s, const void *buf) { - uint32_t rctl = s->mac_reg[RCTL]; - int isbcast = is_broadcast_ether_addr(buf); - int ismcast = is_multicast_ether_addr(buf); - - if (e1000x_is_vlan_packet(buf, le16_to_cpu(s->mac_reg[VET])) && - e1000x_vlan_rx_filter_enabled(s->mac_reg)) { - uint16_t vid = lduw_be_p(&PKT_GET_VLAN_HDR(buf)->h_tci); - uint32_t vfta = - ldl_le_p((uint32_t *)(s->mac_reg + VFTA) + - ((vid >> E1000_VFTA_ENTRY_SHIFT) & E1000_VFTA_ENTRY_MASK)); - if ((vfta & (1 << (vid & E1000_VFTA_ENTRY_BIT_SHIFT_MASK))) == 0) { - return 0; - } - } - - if (!isbcast && !ismcast && (rctl & E1000_RCTL_UPE)) { /* promiscuous ucast */ - return 1; - } - - if (ismcast && (rctl & E1000_RCTL_MPE)) { /* promiscuous mcast */ - return 1; - } - - if (isbcast && (rctl & E1000_RCTL_BAM)) { /* broadcast enabled */ - return 1; - } - - return e1000x_rx_group_filter(s->mac_reg, buf); + return (!e1000x_is_vlan_packet(buf, s->mac_reg[VET]) || + e1000x_rx_vlan_filter(s->mac_reg, PKT_GET_VLAN_HDR(buf))) && + e1000x_rx_group_filter(s->mac_reg, buf); } static void @@ -949,7 +924,7 @@ e1000_receive_iov(NetClientState *nc, const struct iovec *iov, int iovcnt) return size; } - if (!receive_filter(s, filter_buf, size)) { + if (!receive_filter(s, filter_buf)) { return size; } diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c index 14b94db59c..41d2435074 100644 --- a/hw/net/e1000e_core.c +++ b/hw/net/e1000e_core.c @@ -1034,48 +1034,11 @@ e1000e_rx_l4_cso_enabled(E1000ECore *core) } static bool -e1000e_receive_filter(E1000ECore *core, const uint8_t *buf, int size) +e1000e_receive_filter(E1000ECore *core, const void *buf) { - uint32_t rctl = core->mac[RCTL]; - - if (e1000x_is_vlan_packet(buf, core->mac[VET]) && - e1000x_vlan_rx_filter_enabled(core->mac)) { - uint16_t vid = lduw_be_p(&PKT_GET_VLAN_HDR(buf)->h_tci); - uint32_t vfta = - ldl_le_p((uint32_t *)(core->mac + VFTA) + - ((vid >> E1000_VFTA_ENTRY_SHIFT) & E1000_VFTA_ENTRY_MASK)); - if ((vfta & (1 << (vid & E1000_VFTA_ENTRY_BIT_SHIFT_MASK))) == 0) { - trace_e1000e_rx_flt_vlan_mismatch(vid); - return false; - } else { - trace_e1000e_rx_flt_vlan_match(vid); - } - } - - switch (net_rx_pkt_get_packet_type(core->rx_pkt)) { - case ETH_PKT_UCAST: - if (rctl & E1000_RCTL_UPE) { - return true; /* promiscuous ucast */ - } - break; - - case ETH_PKT_BCAST: - if (rctl & E1000_RCTL_BAM) { - return true; /* broadcast enabled */ - } - break; - - case ETH_PKT_MCAST: - if (rctl & E1000_RCTL_MPE) { - return true; /* promiscuous mcast */ - } - break; - - default: - g_assert_not_reached(); - } - - return e1000x_rx_group_filter(core->mac, buf); + return (!e1000x_is_vlan_packet(buf, core->mac[VET]) || + e1000x_rx_vlan_filter(core->mac, PKT_GET_VLAN_HDR(buf))) && + e1000x_rx_group_filter(core->mac, buf); } static inline void @@ -1736,7 +1699,7 @@ e1000e_receive_internal(E1000ECore *core, const struct iovec *iov, int iovcnt, net_rx_pkt_set_packet_type(core->rx_pkt, get_eth_packet_type(PKT_GET_ETH_HDR(buf))); - if (!e1000e_receive_filter(core, buf, size)) { + if (!e1000e_receive_filter(core, buf)) { trace_e1000e_rx_flt_dropped(); return orig_size; } diff --git a/hw/net/e1000x_common.c b/hw/net/e1000x_common.c index 7694673bcc..6cc23138a8 100644 --- a/hw/net/e1000x_common.c +++ b/hw/net/e1000x_common.c @@ -58,32 +58,64 @@ bool e1000x_is_vlan_packet(const void *buf, uint16_t vet) return res; } -bool e1000x_rx_group_filter(uint32_t *mac, const uint8_t *buf) +bool e1000x_rx_vlan_filter(uint32_t *mac, const struct vlan_header *vhdr) +{ + if (e1000x_vlan_rx_filter_enabled(mac)) { + uint16_t vid = lduw_be_p(&vhdr->h_tci); + uint32_t vfta = + ldl_le_p((uint32_t *)(mac + VFTA) + + ((vid >> E1000_VFTA_ENTRY_SHIFT) & E1000_VFTA_ENTRY_MASK)); + if ((vfta & (1 << (vid & E1000_VFTA_ENTRY_BIT_SHIFT_MASK))) == 0) { + trace_e1000x_rx_flt_vlan_mismatch(vid); + return false; + } + + trace_e1000x_rx_flt_vlan_match(vid); + } + + return true; +} + +bool e1000x_rx_group_filter(uint32_t *mac, const struct eth_header *ehdr) { static const int mta_shift[] = { 4, 3, 2, 0 }; uint32_t f, ra[2], *rp, rctl = mac[RCTL]; + if (is_broadcast_ether_addr(ehdr->h_dest)) { + if (rctl & E1000_RCTL_BAM) { + return true; + } + } else if (is_multicast_ether_addr(ehdr->h_dest)) { + if (rctl & E1000_RCTL_MPE) { + return true; + } + } else { + if (rctl & E1000_RCTL_UPE) { + return true; + } + } + for (rp = mac + RA; rp < mac + RA + 32; rp += 2) { if (!(rp[1] & E1000_RAH_AV)) { continue; } ra[0] = cpu_to_le32(rp[0]); ra[1] = cpu_to_le32(rp[1]); - if (!memcmp(buf, (uint8_t *)ra, ETH_ALEN)) { + if (!memcmp(ehdr->h_dest, (uint8_t *)ra, ETH_ALEN)) { trace_e1000x_rx_flt_ucast_match((int)(rp - mac - RA) / 2, - MAC_ARG(buf)); + MAC_ARG(ehdr->h_dest)); return true; } } - trace_e1000x_rx_flt_ucast_mismatch(MAC_ARG(buf)); + trace_e1000x_rx_flt_ucast_mismatch(MAC_ARG(ehdr->h_dest)); f = mta_shift[(rctl >> E1000_RCTL_MO_SHIFT) & 3]; - f = (((buf[5] << 8) | buf[4]) >> f) & 0xfff; + f = (((ehdr->h_dest[5] << 8) | ehdr->h_dest[4]) >> f) & 0xfff; if (mac[MTA + (f >> 5)] & (1 << (f & 0x1f))) { return true; } - trace_e1000x_rx_flt_inexact_mismatch(MAC_ARG(buf), + trace_e1000x_rx_flt_inexact_mismatch(MAC_ARG(ehdr->h_dest), (rctl >> E1000_RCTL_MO_SHIFT) & 3, f >> 5, mac[MTA + (f >> 5)]); diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index 1123df9e77..934db3c3e5 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -976,7 +976,6 @@ static uint16_t igb_receive_assign(IGBCore *core, const L2Header *l2_header, uint16_t queues = 0; uint16_t oversized = 0; uint16_t vid = be16_to_cpu(l2_header->vlan.h_tci) & VLAN_VID_MASK; - bool accepted = false; int i; memset(rss_info, 0, sizeof(E1000E_RSSInfo)); @@ -986,16 +985,8 @@ static uint16_t igb_receive_assign(IGBCore *core, const L2Header *l2_header, } if (e1000x_is_vlan_packet(ehdr, core->mac[VET] & 0xffff) && - e1000x_vlan_rx_filter_enabled(core->mac)) { - uint32_t vfta = - ldl_le_p((uint32_t *)(core->mac + VFTA) + - ((vid >> E1000_VFTA_ENTRY_SHIFT) & E1000_VFTA_ENTRY_MASK)); - if ((vfta & (1 << (vid & E1000_VFTA_ENTRY_BIT_SHIFT_MASK))) == 0) { - trace_e1000e_rx_flt_vlan_mismatch(vid); - return queues; - } else { - trace_e1000e_rx_flt_vlan_match(vid); - } + !e1000x_rx_vlan_filter(core->mac, PKT_GET_VLAN_HDR(ehdr))) { + return queues; } if (core->mac[MRQC] & 1) { @@ -1103,33 +1094,7 @@ static uint16_t igb_receive_assign(IGBCore *core, const L2Header *l2_header, } } } else { - switch (net_rx_pkt_get_packet_type(core->rx_pkt)) { - case ETH_PKT_UCAST: - if (rctl & E1000_RCTL_UPE) { - accepted = true; /* promiscuous ucast */ - } - break; - - case ETH_PKT_BCAST: - if (rctl & E1000_RCTL_BAM) { - accepted = true; /* broadcast enabled */ - } - break; - - case ETH_PKT_MCAST: - if (rctl & E1000_RCTL_MPE) { - accepted = true; /* promiscuous mcast */ - } - break; - - default: - g_assert_not_reached(); - } - - if (!accepted) { - accepted = e1000x_rx_group_filter(core->mac, ehdr->h_dest); - } - + bool accepted = e1000x_rx_group_filter(core->mac, ehdr); if (!accepted) { for (macp = core->mac + RA2; macp < core->mac + RA2 + 16; macp += 2) { if (!(macp[1] & E1000_RAH_AV)) { diff --git a/hw/net/trace-events b/hw/net/trace-events index d35554fce8..a34d196ff7 100644 --- a/hw/net/trace-events +++ b/hw/net/trace-events @@ -106,6 +106,8 @@ e1000_receiver_overrun(size_t s, uint32_t rdh, uint32_t rdt) "Receiver overrun: # e1000x_common.c e1000x_rx_can_recv_disabled(bool link_up, bool rx_enabled, bool pci_master) "link_up: %d, rx_enabled %d, pci_master %d" e1000x_vlan_is_vlan_pkt(bool is_vlan_pkt, uint16_t eth_proto, uint16_t vet) "Is VLAN packet: %d, ETH proto: 0x%X, VET: 0x%X" +e1000x_rx_flt_vlan_mismatch(uint16_t vid) "VID mismatch: 0x%X" +e1000x_rx_flt_vlan_match(uint16_t vid) "VID match: 0x%X" e1000x_rx_flt_ucast_match(uint32_t idx, uint8_t b0, uint8_t b1, uint8_t b2, uint8_t b3, uint8_t b4, uint8_t b5) "unicast match[%d]: %02x:%02x:%02x:%02x:%02x:%02x" e1000x_rx_flt_ucast_mismatch(uint8_t b0, uint8_t b1, uint8_t b2, uint8_t b3, uint8_t b4, uint8_t b5) "unicast mismatch: %02x:%02x:%02x:%02x:%02x:%02x" e1000x_rx_flt_inexact_mismatch(uint8_t b0, uint8_t b1, uint8_t b2, uint8_t b3, uint8_t b4, uint8_t b5, uint32_t mo, uint32_t mta, uint32_t mta_val) "inexact mismatch: %02x:%02x:%02x:%02x:%02x:%02x MO %d MTA[%d] 0x%x" @@ -154,8 +156,6 @@ e1000e_rx_can_recv_rings_full(void) "Cannot receive: all rings are full" e1000e_rx_can_recv(void) "Can receive" e1000e_rx_has_buffers(int ridx, uint32_t free_desc, size_t total_size, uint32_t desc_buf_size) "ring #%d: free descr: %u, packet size %zu, descr buffer size %u" e1000e_rx_null_descriptor(void) "Null RX descriptor!!" -e1000e_rx_flt_vlan_mismatch(uint16_t vid) "VID mismatch: 0x%X" -e1000e_rx_flt_vlan_match(uint16_t vid) "VID match: 0x%X" e1000e_rx_desc_ps_read(uint64_t a0, uint64_t a1, uint64_t a2, uint64_t a3) "buffers: [0x%"PRIx64", 0x%"PRIx64", 0x%"PRIx64", 0x%"PRIx64"]" e1000e_rx_desc_ps_write(uint16_t a0, uint16_t a1, uint16_t a2, uint16_t a3) "bytes written: [%u, %u, %u, %u]" e1000e_rx_desc_buff_sizes(uint32_t b0, uint32_t b1, uint32_t b2, uint32_t b3) "buffer sizes: [%u, %u, %u, %u]" From patchwork Wed Apr 26 10:36:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773978 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=0MLh28W8; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wMx2Yq7z23vJ for ; Wed, 26 Apr 2023 20:39:09 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcXa-0001Ui-1T; Wed, 26 Apr 2023 06:38:26 -0400 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 1prcXY-0001MR-Cz for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:24 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcXW-00036C-OR for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:23 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-63f273b219eso3370027b3a.1 for ; Wed, 26 Apr 2023 03:38:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505501; x=1685097501; 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=rwy5rvMUqP3oelPjHxfIZcxpBNQc9ghPL/3JUmVe4oU=; b=0MLh28W8nT2dLpm+PmyKJbvKoo70w2guKkOeT6qvcJCmJd5y+SZQJHxLN+NyTyP5Tc JtOEEXIbn1iE4zBLSrOfqlrUFFMnBg2ADWWFuEiJoHk5L481VhpodiZdro0Emtn9YKwO 90+kcw1r/5WOBU8RHbDqxSJCy15SZ6htq+HE6PLaa6M4ycqML+7YxYFq/KYJKqhNxM6d RIgnsOctbk2VD4lovcFPxmPE1ezD9eTas2/YVI9PWWcDohHSz1diBx3w/340GJT8mC+q w26n9BsvQJmotlPAdru1plt1V+pmR4iYsdtq//GCN7W2je07YXKDpMIPd39RnCFA6hWs 6SHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505501; x=1685097501; 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=rwy5rvMUqP3oelPjHxfIZcxpBNQc9ghPL/3JUmVe4oU=; b=ZOY/uSGe03BSuwxB8fUKKfbNTxm9m8kfFZP7l6fTczF9AExmtO3KDCPBf9oFL9AGu4 3hFzymiUXsWHSqpPNwHEzngtjs4ZsLq+mG+XzXcTEvHxsyMBAS3O0VZn+e2r7I3EjKDH X3QPRdobVSlIe37k/t0Wbj0XOWM9KHWdh31Fp2m05pmAIVd+COyAjGtgC+a0b318mpQr 3BHoAlz7AlQ4ptWsJvbdichze309f6KSdkeb5NBWT7PYmLLTlquGysgKAxhu2XzdcQd3 E2cLlxpbwiWiltw0Ddq7M/wXB2iamaQr5RWWdy5+e3BehKnSi0Ld9AqxhF9h7aGpo7RU aTuQ== X-Gm-Message-State: AAQBX9dCZjB7LK8Z75W5Oz4P48l1SRcbQ8b3JeOdMJRkYazvkEYCO8RK FZBNxAdlUdkRw1NCAYu+tZuKxQ== X-Google-Smtp-Source: AKy350arCH229KHj6sNierzRm5VuvD+Ij4+qgpoWa5vk+c9wBwU3ngS/LrNEZPCIn7pBRpVyge5Paw== X-Received: by 2002:a05:6a00:b46:b0:63b:6b43:78c with SMTP id p6-20020a056a000b4600b0063b6b43078cmr26301469pfo.29.1682505501457; Wed, 26 Apr 2023 03:38:21 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.38.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:38:21 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 16/48] e1000x: Take CRC into consideration for size check Date: Wed, 26 Apr 2023 19:36:44 +0900 Message-Id: <20230426103716.26279-17-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::430; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x430.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Section 13.7.15 Receive Length Error Count says: > Packets over 1522 bytes are oversized if LongPacketEnable is 0b > (RCTL.LPE). If LongPacketEnable (LPE) is 1b, then an incoming packet > is considered oversized if it exceeds 16384 bytes. > These lengths are based on bytes in the received packet from > through , inclusively. As QEMU processes packets without CRC, the number of bytes for CRC need to be subtracted. This change adds some size definitions to be used to derive the new size thresholds to eth.h. Signed-off-by: Akihiko Odaki --- include/net/eth.h | 2 ++ hw/net/e1000x_common.c | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/net/eth.h b/include/net/eth.h index e8af5742be..05f56931e7 100644 --- a/include/net/eth.h +++ b/include/net/eth.h @@ -32,6 +32,8 @@ #define ETH_ALEN 6 #define ETH_HLEN 14 #define ETH_ZLEN 60 /* Min. octets in frame without FCS */ +#define ETH_FCS_LEN 4 +#define ETH_MTU 1500 struct eth_header { uint8_t h_dest[ETH_ALEN]; /* destination eth addr */ diff --git a/hw/net/e1000x_common.c b/hw/net/e1000x_common.c index 6cc23138a8..212873fd77 100644 --- a/hw/net/e1000x_common.c +++ b/hw/net/e1000x_common.c @@ -140,16 +140,16 @@ bool e1000x_hw_rx_enabled(uint32_t *mac) bool e1000x_is_oversized(uint32_t *mac, size_t size) { + size_t header_size = sizeof(struct eth_header) + sizeof(struct vlan_header); /* this is the size past which hardware will drop packets when setting LPE=0 */ - static const int maximum_ethernet_vlan_size = 1522; + size_t maximum_short_size = header_size + ETH_MTU; /* this is the size past which hardware will drop packets when setting LPE=1 */ - static const int maximum_ethernet_lpe_size = 16 * KiB; + size_t maximum_large_size = 16 * KiB - ETH_FCS_LEN; - if ((size > maximum_ethernet_lpe_size || - (size > maximum_ethernet_vlan_size - && !(mac[RCTL] & E1000_RCTL_LPE))) + if ((size > maximum_large_size || + (size > maximum_short_size && !(mac[RCTL] & E1000_RCTL_LPE))) && !(mac[RCTL] & E1000_RCTL_SBP)) { e1000x_inc_reg_if_not_full(mac, ROC); trace_e1000x_rx_oversized(size); From patchwork Wed Apr 26 10:36:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773983 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=4Yfw/BvR; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wNl1Xzhz23vG for ; Wed, 26 Apr 2023 20:39:51 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcXd-0001oG-Oy; Wed, 26 Apr 2023 06:38:29 -0400 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 1prcXc-0001ga-2p for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:28 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcXa-00038t-8N for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:27 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-63b67a26069so8943519b3a.0 for ; Wed, 26 Apr 2023 03:38:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505505; x=1685097505; 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=czInFey6q0dFALyqbaEMUD6RlsnbfHaBaPgz3oxyxjw=; b=4Yfw/BvRfsvb+pvSiqOk4yHlp1UVuD5c6Y3OmMx2JzEyfrHF3iMDYM+gKe7F4Diiqu Fg3KVOQT7d8cLy06Zw8g4LpwwhQpw+MjlPxzuyxDwUnP9AvHExa00e/+HrQ48/kd95/5 NGAUKweMAtZWnxMRvY40kQqS3/QUN/PTSkEumn+596KTO9Bw4JZvvudMeFU9b5RLrSeJ kXorvBqXJhBswLJzmeviqqoLvqzrd9caFmQwXuRdJbtQG0SisgF3b+vnPmex5kBz8m3B waeeexNKnjmg5gQtxOV4n6xGhuIq1cOrupQhLAI5Q3MQBZRFy88RUwmqrx8KyhJDKRuU ORHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505505; x=1685097505; 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=czInFey6q0dFALyqbaEMUD6RlsnbfHaBaPgz3oxyxjw=; b=JH17l12DiaIbCyGNoxuPjzgXa2cZYi4Dsz1HSpqEPaOofmkR3s1bDb2nEt+Z7gOd3c jUs/5wTQs8COV3VyHmAWUO/HwN5XLpGrVt/RUzWRJ9YdDxuzRAYg6+2cOX21Ai70fHLU lquQShcUpWxfKXYSo6EC5vJM57+OrSkH+DDTHhH0PW6N8x1wQ0+s6nkJGHnzH92jR0D4 gF7miVpQ6RgWXpbW8fXE9Ao4J77V7wNwzz9y9FpE5irOJk82QCnR8hh412EwWlBjgOZf QbFLn38XTVmb8ZNh0JBncxPfcnZLgE081T59InSvvEuW8xlgijZ4mGnYKPq3Y/AMo/8h QlfQ== X-Gm-Message-State: AC+VfDzSPlDT3KMsKqlTkdNMmgHPNIv8MEvA8JOmqoTwymYCAZYVr6JF 1MkA0XT3rXgJGxiEDoqwZiSkSQ== X-Google-Smtp-Source: ACHHUZ5niiLzm1Es3lmmEddbdlx9w3zr+cnTVssjlIDaAeaWbaXf+r/s3yrOHvMtiQMKBhUSEw4dgA== X-Received: by 2002:a05:6a00:218e:b0:641:a6d:46b0 with SMTP id h14-20020a056a00218e00b006410a6d46b0mr1009937pfi.22.1682505504959; Wed, 26 Apr 2023 03:38:24 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.38.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:38:24 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 17/48] e1000x: Rename TcpIpv6 into TcpIpv6Ex Date: Wed, 26 Apr 2023 19:36:45 +0900 Message-Id: <20230426103716.26279-18-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::433; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x433.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org e1000e and igb employs NetPktRssIpV6TcpEx for RSS hash if TcpIpv6 MRQC bit is set. Moreover, igb also has a MRQC bit for NetPktRssIpV6Tcp though it is not implemented yet. Rename it to TcpIpv6Ex to avoid confusion. Signed-off-by: Akihiko Odaki Reviewed-by: Sriram Yagnaraman --- hw/net/e1000x_regs.h | 24 ++++++++++++------------ hw/net/e1000e_core.c | 8 ++++---- hw/net/igb_core.c | 8 ++++---- hw/net/trace-events | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/hw/net/e1000x_regs.h b/hw/net/e1000x_regs.h index 6d3c4c6d3a..13760c66d3 100644 --- a/hw/net/e1000x_regs.h +++ b/hw/net/e1000x_regs.h @@ -290,18 +290,18 @@ #define E1000_RETA_IDX(hash) ((hash) & (BIT(7) - 1)) #define E1000_RETA_VAL(reta, hash) (((uint8_t *)(reta))[E1000_RETA_IDX(hash)]) -#define E1000_MRQC_EN_TCPIPV4(mrqc) ((mrqc) & BIT(16)) -#define E1000_MRQC_EN_IPV4(mrqc) ((mrqc) & BIT(17)) -#define E1000_MRQC_EN_TCPIPV6(mrqc) ((mrqc) & BIT(18)) -#define E1000_MRQC_EN_IPV6EX(mrqc) ((mrqc) & BIT(19)) -#define E1000_MRQC_EN_IPV6(mrqc) ((mrqc) & BIT(20)) - -#define E1000_MRQ_RSS_TYPE_NONE (0) -#define E1000_MRQ_RSS_TYPE_IPV4TCP (1) -#define E1000_MRQ_RSS_TYPE_IPV4 (2) -#define E1000_MRQ_RSS_TYPE_IPV6TCP (3) -#define E1000_MRQ_RSS_TYPE_IPV6EX (4) -#define E1000_MRQ_RSS_TYPE_IPV6 (5) +#define E1000_MRQC_EN_TCPIPV4(mrqc) ((mrqc) & BIT(16)) +#define E1000_MRQC_EN_IPV4(mrqc) ((mrqc) & BIT(17)) +#define E1000_MRQC_EN_TCPIPV6EX(mrqc) ((mrqc) & BIT(18)) +#define E1000_MRQC_EN_IPV6EX(mrqc) ((mrqc) & BIT(19)) +#define E1000_MRQC_EN_IPV6(mrqc) ((mrqc) & BIT(20)) + +#define E1000_MRQ_RSS_TYPE_NONE (0) +#define E1000_MRQ_RSS_TYPE_IPV4TCP (1) +#define E1000_MRQ_RSS_TYPE_IPV4 (2) +#define E1000_MRQ_RSS_TYPE_IPV6TCPEX (3) +#define E1000_MRQ_RSS_TYPE_IPV6EX (4) +#define E1000_MRQ_RSS_TYPE_IPV6 (5) #define E1000_ICR_ASSERTED BIT(31) #define E1000_EIAC_MASK 0x01F00000 diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c index 41d2435074..38d465a203 100644 --- a/hw/net/e1000e_core.c +++ b/hw/net/e1000e_core.c @@ -537,7 +537,7 @@ e1000e_rss_get_hash_type(E1000ECore *core, struct NetRxPkt *pkt) ip6info->rss_ex_dst_valid, ip6info->rss_ex_src_valid, core->mac[MRQC], - E1000_MRQC_EN_TCPIPV6(core->mac[MRQC]), + E1000_MRQC_EN_TCPIPV6EX(core->mac[MRQC]), E1000_MRQC_EN_IPV6EX(core->mac[MRQC]), E1000_MRQC_EN_IPV6(core->mac[MRQC])); @@ -546,8 +546,8 @@ e1000e_rss_get_hash_type(E1000ECore *core, struct NetRxPkt *pkt) ip6info->rss_ex_src_valid))) { if (l4hdr_proto == ETH_L4_HDR_PROTO_TCP && - E1000_MRQC_EN_TCPIPV6(core->mac[MRQC])) { - return E1000_MRQ_RSS_TYPE_IPV6TCP; + E1000_MRQC_EN_TCPIPV6EX(core->mac[MRQC])) { + return E1000_MRQ_RSS_TYPE_IPV6TCPEX; } if (E1000_MRQC_EN_IPV6EX(core->mac[MRQC])) { @@ -581,7 +581,7 @@ e1000e_rss_calc_hash(E1000ECore *core, case E1000_MRQ_RSS_TYPE_IPV4TCP: type = NetPktRssIpV4Tcp; break; - case E1000_MRQ_RSS_TYPE_IPV6TCP: + case E1000_MRQ_RSS_TYPE_IPV6TCPEX: type = NetPktRssIpV6TcpEx; break; case E1000_MRQ_RSS_TYPE_IPV6: diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index 934db3c3e5..209fdad862 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -301,7 +301,7 @@ igb_rss_get_hash_type(IGBCore *core, struct NetRxPkt *pkt) ip6info->rss_ex_dst_valid, ip6info->rss_ex_src_valid, core->mac[MRQC], - E1000_MRQC_EN_TCPIPV6(core->mac[MRQC]), + E1000_MRQC_EN_TCPIPV6EX(core->mac[MRQC]), E1000_MRQC_EN_IPV6EX(core->mac[MRQC]), E1000_MRQC_EN_IPV6(core->mac[MRQC])); @@ -310,8 +310,8 @@ igb_rss_get_hash_type(IGBCore *core, struct NetRxPkt *pkt) ip6info->rss_ex_src_valid))) { if (l4hdr_proto == ETH_L4_HDR_PROTO_TCP && - E1000_MRQC_EN_TCPIPV6(core->mac[MRQC])) { - return E1000_MRQ_RSS_TYPE_IPV6TCP; + E1000_MRQC_EN_TCPIPV6EX(core->mac[MRQC])) { + return E1000_MRQ_RSS_TYPE_IPV6TCPEX; } if (E1000_MRQC_EN_IPV6EX(core->mac[MRQC])) { @@ -343,7 +343,7 @@ igb_rss_calc_hash(IGBCore *core, struct NetRxPkt *pkt, E1000E_RSSInfo *info) case E1000_MRQ_RSS_TYPE_IPV4TCP: type = NetPktRssIpV4Tcp; break; - case E1000_MRQ_RSS_TYPE_IPV6TCP: + case E1000_MRQ_RSS_TYPE_IPV6TCPEX: type = NetPktRssIpV6TcpEx; break; case E1000_MRQ_RSS_TYPE_IPV6: diff --git a/hw/net/trace-events b/hw/net/trace-events index a34d196ff7..64d776bc2a 100644 --- a/hw/net/trace-events +++ b/hw/net/trace-events @@ -179,7 +179,7 @@ e1000e_rx_rss_disabled(void) "RSS is disabled" e1000e_rx_rss_type(uint32_t type) "RSS type is %u" e1000e_rx_rss_ip4(int l4hdr_proto, uint32_t mrqc, bool tcpipv4_enabled, bool ipv4_enabled) "RSS IPv4: L4 header protocol %d, mrqc 0x%X, tcpipv4 enabled %d, ipv4 enabled %d" e1000e_rx_rss_ip6_rfctl(uint32_t rfctl) "RSS IPv6: rfctl 0x%X" -e1000e_rx_rss_ip6(bool ex_dis, bool new_ex_dis, int l4hdr_proto, bool has_ext_headers, bool ex_dst_valid, bool ex_src_valid, uint32_t mrqc, bool tcpipv6_enabled, bool ipv6ex_enabled, bool ipv6_enabled) "RSS IPv6: ex_dis: %d, new_ex_dis: %d, L4 header protocol %d, has_ext_headers %d, ex_dst_valid %d, ex_src_valid %d, mrqc 0x%X, tcpipv6 enabled %d, ipv6ex enabled %d, ipv6 enabled %d" +e1000e_rx_rss_ip6(bool ex_dis, bool new_ex_dis, int l4hdr_proto, bool has_ext_headers, bool ex_dst_valid, bool ex_src_valid, uint32_t mrqc, bool tcpipv6ex_enabled, bool ipv6ex_enabled, bool ipv6_enabled) "RSS IPv6: ex_dis: %d, new_ex_dis: %d, L4 header protocol %d, has_ext_headers %d, ex_dst_valid %d, ex_src_valid %d, mrqc 0x%X, tcpipv6ex enabled %d, ipv6ex enabled %d, ipv6 enabled %d" e1000e_rx_metadata_protocols(bool hasip4, bool hasip6, int l4hdr_protocol) "protocols: ip4: %d, ip6: %d, l4hdr: %d" e1000e_rx_metadata_vlan(uint16_t vlan_tag) "VLAN tag is 0x%X" From patchwork Wed Apr 26 10:36:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773977 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=RTw3+nZw; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wMw6qFGz23vG for ; Wed, 26 Apr 2023 20:39:08 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcXg-0001xk-GM; Wed, 26 Apr 2023 06:38:32 -0400 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 1prcXf-0001uN-C1 for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:31 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcXd-0003AV-V8 for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:31 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-63b5ce4f069so8502344b3a.1 for ; Wed, 26 Apr 2023 03:38:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505508; x=1685097508; 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=v86U37XRvdRC1an+utHD5WjPRWfLTsBjzch5syyzVzw=; b=RTw3+nZwnxv+3a2dX6zmF32egtB9aWRrVxxWKjlyoAupMdRETiZsc3YUiYvTCFiHsa v1SgyCzzMmcmwt7UmG9mMw5cZaWZaDnUVZfpk5kYAYi4nnWiFhBCoen5LEzsqfLzK0ja aCa5lozJUuHFlAANogHMfWpu+23UHatBdYtGwNF0RiVAB5OIvOHYFZzHdeksDFG9IKDr mQRXbsE8sutmhLc9/0TDxIZ3adX7nHjVPR7Ow4CvRp+bJqupEJU1M9gsxwxWn0oB2iW+ 3mCMBrzf0C1Ji4C74ZXRZFPJ17QOoAbCnX+5sXoPCsfw552vXSEA4D546p+qFcaoFyxG oGTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505508; x=1685097508; 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=v86U37XRvdRC1an+utHD5WjPRWfLTsBjzch5syyzVzw=; b=Xh0ebHV8CWlhhGXatiLW9U3zCFSul87F2WfTnys67zYgS49jrvRiPCVxS14QiJvXrD 2JZipq07wXjVUficiDNqSL+wC1qnbUNhnyNOuCPhxOcJ8v5hQ2lc6qasWdytJ113d4B6 5RKkiYvZrwYccFyIT1ezFIAWoTYt+nxsGkYMn20d5M0dP59Na5sEmr70EQyoACmI4XXA uchNS9r5ub7e3zfiv9kCdumheq5APqazbzq/GxUIDKAGj2ShmpxU5P1T5R6MfRhN/dE3 h7v8jEx6Qi+VxRE9VbEuLGFxyiu83jFXZ/d1nfjh03WB5fVc9I0876+wvaTixG6e50lR d6Cw== X-Gm-Message-State: AAQBX9e8+At9yMwVjE9wCKrb3eQZ+bS43Q9jQbmIFLox+1kko+WCD0Ax +Vswn4CwJ6w84ZEO2iVOYNKmAQ== X-Google-Smtp-Source: AKy350ZKrJGFbMGJdmgRNC9wWaQrDYaJZtgGyY9fJGQ3tjZPHptuyjbzoff5CW/0yye7ZmaUvx/Ieg== X-Received: by 2002:aa7:8890:0:b0:63b:8df5:f8d with SMTP id z16-20020aa78890000000b0063b8df50f8dmr27413900pfe.3.1682505508459; Wed, 26 Apr 2023 03:38:28 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.38.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:38:28 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 18/48] e1000e: Always log status after building rx metadata Date: Wed, 26 Apr 2023 19:36:46 +0900 Message-Id: <20230426103716.26279-19-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::432; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x432.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Without this change, the status flags may not be traced e.g. if checksum offloading is disabled. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daudé --- hw/net/e1000e_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c index 38d465a203..6a213c0224 100644 --- a/hw/net/e1000e_core.c +++ b/hw/net/e1000e_core.c @@ -1244,9 +1244,8 @@ e1000e_build_rx_metadata(E1000ECore *core, trace_e1000e_rx_metadata_l4_cso_disabled(); } - trace_e1000e_rx_metadata_status_flags(*status_flags); - func_exit: + trace_e1000e_rx_metadata_status_flags(*status_flags); *status_flags = cpu_to_le32(*status_flags); } From patchwork Wed Apr 26 10:36:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1774011 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=D1w9FV9X; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wW23dwxz23vG for ; Wed, 26 Apr 2023 20:45:18 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcXj-00020X-IJ; Wed, 26 Apr 2023 06:38:35 -0400 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 1prcXi-0001yJ-EI for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:34 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcXh-0003CZ-22 for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:34 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-63b4bf2d74aso5479004b3a.2 for ; Wed, 26 Apr 2023 03:38:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505512; x=1685097512; 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=CA6Nq82v8xkh13KZN69Qd2MmAy9Lo2TKxBNxM5FodsU=; b=D1w9FV9XaBlXQHPeSwcgG7yVQjdqtN6Juvqv5JCzzHUmlyL4Zv137OI5P6ASFYO60h 35khmsqnQ3T5j8jj96yqeg1gqAx7/m+iJoh9olmvHsdPR9kwv2G2B7bUTdAWbs3Q+1Iz O6Dx/fLikf2ZmYvJRLyPpW+gU6lVfQlzlxdOmJFRH7FC3YWGcvox/9OWHF/zLc7EZdsm WLZI2yHvoKbeYp/05CfOED0XRDb4N9U6aRDMwd5vxbxin5ctH1mm9gOzr/GFV/YfrNfR u4rkF4PnimzUIWFYYHZZHYBvpD3awm8rq85lO+XW0Qz6/jRqnKoetntNJvnKKoGFRWW0 ctbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505512; x=1685097512; 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=CA6Nq82v8xkh13KZN69Qd2MmAy9Lo2TKxBNxM5FodsU=; b=hrpQdI8RynXQ1lOusN/46oiwqJn0Ip944z8n4cx6PsLzfsLZdwJ4VxIEuAbufcfQJ1 aarCNRobp8aJH4Yh22sThU7nP3wWbmUoOuAJFpL9znbepC8w+XWgB7Y29SCtI3Pru5Nf 7P5fwCFFrqROukeaAoKvFKlx9iIyuriMuZnXFMfY17ATjgq5Eez/TfD7escyLVDux8QZ c3V/pMpfgXccPfgTAGf5DCVSn3SYyVciRSuQOw9MIshQESxEr/W5srAzU4uC+YKRFpJC nv39RYYr/q8LrZMt5nItunLyU3pRSnsCEfXRDVwCfCyTmjkjZMPJsi3L6N2K6KkE4IPZ s8zQ== X-Gm-Message-State: AAQBX9fpX3jDBk/tI9cvrZOVq5HcdApWhGakYbo4RYsAoHtrLceta/eN PBMqY9Ystad+CDvJxvMNrO1uBQ== X-Google-Smtp-Source: AKy350aOQiD/AvRii9QUFcWQMeVEy2apwhdcedfioshoOpsm22V8spwzHaqjNfK9Asw9WWDIzXr/zw== X-Received: by 2002:a05:6a20:3ca4:b0:f2:7da5:f276 with SMTP id b36-20020a056a203ca400b000f27da5f276mr21683559pzj.51.1682505511865; Wed, 26 Apr 2023 03:38:31 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.38.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:38:31 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 19/48] igb: Always log status after building rx metadata Date: Wed, 26 Apr 2023 19:36:47 +0900 Message-Id: <20230426103716.26279-20-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::42b; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Without this change, the status flags may not be traced e.g. if checksum offloading is disabled. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daudé --- hw/net/igb_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index 209fdad862..946b917f91 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -1303,9 +1303,8 @@ igb_build_rx_metadata(IGBCore *core, trace_e1000e_rx_metadata_l4_cso_disabled(); } - trace_e1000e_rx_metadata_status_flags(*status_flags); - func_exit: + trace_e1000e_rx_metadata_status_flags(*status_flags); *status_flags = cpu_to_le32(*status_flags); } From patchwork Wed Apr 26 10:36:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773985 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=MPairb+D; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wNr02Ghz23vG for ; Wed, 26 Apr 2023 20:39:56 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcXo-0002Ke-9g; Wed, 26 Apr 2023 06:38:40 -0400 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 1prcXm-00029l-C9 for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:38 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcXk-0003D3-FK for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:37 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-63b62d2f729so5526806b3a.1 for ; Wed, 26 Apr 2023 03:38:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505515; x=1685097515; 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=gxmYdGyeyclr6nIITv2T0ZzAW4fVgPRCULVfg9/kFCc=; b=MPairb+DMLnLRuNk1P+3Dw4c8G0MZWQY87RcZTyeXGnz+9ze6dVomNTkIJN5GH0pvx 5d6ERaSyogsuZms+wbSo6bjFupQHa/A90lPE8TpwE4TCIOL6CIhZzrG0WhZsUWTKCKqf Sm269HXSabTQu+LC/H/3cNU91QCZn7zFCyqmaI3FHaUoDaS7PN97mihKsJj/A/o2ky6y swh1qQHWg/enaYxOC1ah3VtEBneDgDKWcPKAMUYj/Kg9bt7GWvPL7LMX5DwSVzqq1pz5 23a5c5TBCywdIhS4Rd212RD9ysuwg+pwVB3x/uySkkeeWR3eV1523g8E0azK6S6lsxeq hbjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505515; x=1685097515; 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=gxmYdGyeyclr6nIITv2T0ZzAW4fVgPRCULVfg9/kFCc=; b=lzcJwS/AbUbhw8vflh5L+JxU2Pdzy7+skgzanhuhkzPbRjwtK4PWQPlFxa6A7HH72+ xOD7R5IjgqCTB4mBu5YtPQnZ97rEXQKLYyG9kYyYDvy+vjpkTVY88StijV3H2OZtZpHK ihtHF6if17m/GXxdkznLjYwcJchQEqGwn6Ib56W2qNVeNi/xeVq2TjLi54atsWuNKL1n L/phdE9GRnbURD2aB4pJQS/rAlmUQ0lBdRM905rswcsSbviq8mXnfvfBPya/WS1HqsIa /wHVHEOkRWvPYcgCpovgsoXgj+UV9sEbdHMRgb/jf9j1qYS6DA2EypSLL+IKrPjKvjX7 4Mxg== X-Gm-Message-State: AAQBX9dQnAFOJfHVN0OQTGfMLlXezv0yUyikGd+ZnDV8zXli6O+f1Xv5 kDqk2N+OJ9mWC5Ewc2XJBHIWoQ== X-Google-Smtp-Source: AKy350ZtKemE62+YEBZyON7cHzwdIuOBfLlFDejQbJq5q90XJIIdS/Pl6s2aXs7OzuVCfgEnfNmBDw== X-Received: by 2002:a05:6a21:99a5:b0:f2:8c89:cd30 with SMTP id ve37-20020a056a2199a500b000f28c89cd30mr22697818pzb.13.1682505515250; Wed, 26 Apr 2023 03:38:35 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.38.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:38:35 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 20/48] igb: Remove goto Date: Wed, 26 Apr 2023 19:36:48 +0900 Message-Id: <20230426103716.26279-21-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::42f; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The goto is a bit confusing as it changes the control flow only if L4 protocol is not recognized. It is also different from e1000e, and noisy when comparing e1000e and igb. Signed-off-by: Akihiko Odaki Reviewed-by: Sriram Yagnaraman --- hw/net/igb_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index 946b917f91..bae51cbb63 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -1297,7 +1297,7 @@ igb_build_rx_metadata(IGBCore *core, break; default: - goto func_exit; + break; } } else { trace_e1000e_rx_metadata_l4_cso_disabled(); From patchwork Wed Apr 26 10:36:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773979 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=4d4MKCqS; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wN02LkQz23vG for ; Wed, 26 Apr 2023 20:39:12 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcXq-0002cQ-QP; Wed, 26 Apr 2023 06:38:42 -0400 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 1prcXp-0002Un-EE for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:41 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcXn-0003DV-QK for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:41 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-63b50a02bffso5718275b3a.2 for ; Wed, 26 Apr 2023 03:38:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505518; x=1685097518; 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=I5FVG+q2iK4NMFLv4iSqRBvbjAOoFwdqrI/x89PeOJo=; b=4d4MKCqSXLs2o8URsDWBAumrXry2pMY0CgqJcqTMUPcVtyGmlfhS+36tH3MzlBn47m UEejcTI30OoorJZXgN7KCYJbfBUkvihT22fGGp2tOBcNFtYeGTMeifdhSYG0LCPYE56V 51UBkV7bJrAOhbaEKGESkyeXLU0ocIjnyXjPi33Sa0HQ9JG8o0gpUB5YrYfu9rYvHDrE pgvwN91/1ZH6/uvNgv8+g6gE3Up01mHEuB4IBMW/RywnXTvTEUsOJoMM20M3qwDtiCzf tjOl7pOVcCaipPQeKU2R5jomKQr/sAalyvV5dkHRJMpRQy51eB8UhUtbfzXdXXU4KXQq XrEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505518; x=1685097518; 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=I5FVG+q2iK4NMFLv4iSqRBvbjAOoFwdqrI/x89PeOJo=; b=MRTFbGMP6kFTal2xTEBPUdnxA604IcsFjjs1FmpvB93V+sNAWvqD0M5bHDcwwCmrHk IGZ8fNYg4egAPkNJptlkixvZfqpNBCnqYv7KgJYMuftTnHdrtRHTrKFGlPQmRIi3352p +Bpx1IgqGV2j9bv1AzwOn9a/RoAiBpPhEy3uBqO1LQGQ+ymDDUpMeG7wolu7MFLOsS+u nNjcIRMiFD4PypIFwOa6g9WGmoKwcw12aFexqKXedI+tonUWStM0RZY2K6bCbSyyjRlQ 269yz9aN3deLIGMeAPxf6HXv1rZ/hUOYLpDYwK4XEryHkVM50+JWHz84PmDqvMDX9axo KcnQ== X-Gm-Message-State: AAQBX9cTLAbI/y5Ehg2pMT2xrX6VE5lv6qIJmqRMsLXRechIwsT2fcgA OXrWb5ItYFGaAwhjEOmClarVvA== X-Google-Smtp-Source: AKy350ZuZLCM3o/6G/0WwnkITfRFad0xYinaD6LnXB4VTS12HeCXaoUy1EhaAnyIFe/394s7jEO+9g== X-Received: by 2002:a05:6a00:10cc:b0:63a:cefa:9d44 with SMTP id d12-20020a056a0010cc00b0063acefa9d44mr23259422pfu.14.1682505518682; Wed, 26 Apr 2023 03:38:38 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.38.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:38:38 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 21/48] igb: Read DCMD.VLE of the first Tx descriptor Date: Wed, 26 Apr 2023 19:36:49 +0900 Message-Id: <20230426103716.26279-22-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::432; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x432.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Section 7.2.2.3 Advanced Transmit Data Descriptor says: > For frames that spans multiple descriptors, all fields apart from > DCMD.EOP, DCMD.RS, DCMD.DEXT, DTALEN, Address and DTYP are valid only > in the first descriptors and are ignored in the subsequent ones. Signed-off-by: Akihiko Odaki Reviewed-by: Sriram Yagnaraman --- hw/net/igb_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index bae51cbb63..162ef26789 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -613,7 +613,7 @@ igb_process_tx_desc(IGBCore *core, idx = (tx->first_olinfo_status >> 4) & 1; igb_tx_insert_vlan(core, queue_index, tx, tx->ctx[idx].vlan_macip_lens >> 16, - !!(cmd_type_len & E1000_TXD_CMD_VLE)); + !!(tx->first_cmd_type_len & E1000_TXD_CMD_VLE)); if (igb_tx_pkt_send(core, tx, queue_index)) { igb_on_tx_done_update_stats(core, tx->tx_pkt, queue_index); From patchwork Wed Apr 26 10:36:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1774015 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=MFy6i5Ck; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wW43dZxz23vN for ; Wed, 26 Apr 2023 20:45:19 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcXv-0002jw-5D; Wed, 26 Apr 2023 06:38:47 -0400 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 1prcXt-0002i8-0P for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:45 -0400 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 1prcXr-0003Dw-Fy for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:44 -0400 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-24781e23c27so6210411a91.0 for ; Wed, 26 Apr 2023 03:38:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505522; x=1685097522; 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=KtUv0mGmA7OSWgIJyTpKTrAjxT7V/SfSD72W9CU2fMA=; b=MFy6i5CkM6ogUGITRMhjs40Asdz875poZMAZOrl2nTp23dJEYsTwIKkU+1sLzgDWTR js6Sq8fZNIen1cFRemvSD/e92Sp0m3/pWQWACCXvpPBUFGGDrCHseZOsmeCvakJ7bTC0 /NKem46gIweaJnsgZoCpS5/ZUoemwoIpC2l2X8Mn+yD3Pi5i6v56X9IKAFFNeio3Eyyt A7TA9Y9su3ih6uEF3l0syoG53OFkgEA6TxgeLMbZB9sB6MuO7NBFdupDWPbwfaxsCpgQ UpJYrc1jtsY31LTb9IhCoTG6F3mrWQ3w54Gsap8CmT24o9vPIKjgIdGrb4W26N5DcAZQ EdEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505522; x=1685097522; 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=KtUv0mGmA7OSWgIJyTpKTrAjxT7V/SfSD72W9CU2fMA=; b=Qx/JYZ1kfjwWkQpE0ZLLTeTzfBCNYNmM8riox9yo0OxrBsWRZkhsp8Utjwr7BqamQp rswo/babGMBe2TpesfI0mvBNg7LRrE8Lyl0e7+NqS7kopNZ3wo8p7tszG2E5Q7dDECwp O0QPnwlEBrwj6x+V7WtP29m60rXaur+gyq8rsF7MInyhc8/JPDvDu6Ib9ErfkheLIUPT MO4pI6o1Th9CAGPwgljJ6DgYrBH4cr+VdVKQOYqhdWuNrD/MjlkMUPZFvRsee8sqFfcT cqEECM3aOOT8QicFJAScoI2KJOvcAOZ6bLklf25SPbas6sdaokf3pBGbok+0DtMNmCKl 8MDA== X-Gm-Message-State: AAQBX9eUYEpZFSHj9J/CGspAhvkLHCiUJulX61cQNq36GvZ2JaPV+K6E I0rEnf7JRhYTyO3OKnE6axxvCw== X-Google-Smtp-Source: AKy350Z/Efqzv5xLQEj4WpqB3ZylZNJSLTE6RJrJt2BqgKUIgdsYdkkZBfoUj7v2wyQW0IQh/m+pIA== X-Received: by 2002:a17:90b:1957:b0:23d:376a:c2bc with SMTP id nk23-20020a17090b195700b0023d376ac2bcmr18985318pjb.5.1682505522138; Wed, 26 Apr 2023 03:38:42 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.38.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:38:41 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 22/48] e1000e: Reset packet state after emptying Tx queue Date: Wed, 26 Apr 2023 19:36:50 +0900 Message-Id: <20230426103716.26279-23-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::102b; envelope-from=akihiko.odaki@daynix.com; helo=mail-pj1-x102b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Keeping Tx packet state after the transmit queue is emptied has some problems: - The datasheet says the descriptors can be reused after the transmit queue is emptied, but the Tx packet state may keep references to them. - The Tx packet state cannot be migrated so it can be reset anytime the migration happens. Always reset Tx packet state always after the queue is emptied. Signed-off-by: Akihiko Odaki --- hw/net/e1000e_core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c index 6a213c0224..7dce448657 100644 --- a/hw/net/e1000e_core.c +++ b/hw/net/e1000e_core.c @@ -959,6 +959,8 @@ e1000e_start_xmit(E1000ECore *core, const E1000E_TxRing *txr) if (!ide || !e1000e_intrmgr_delay_tx_causes(core, &cause)) { e1000e_set_interrupt_cause(core, cause); } + + net_tx_pkt_reset(txr->tx->tx_pkt, net_tx_pkt_unmap_frag_pci, core->owner); } static bool @@ -3389,8 +3391,6 @@ e1000e_core_pci_uninit(E1000ECore *core) qemu_del_vm_change_state_handler(core->vmstate); for (i = 0; i < E1000E_NUM_QUEUES; i++) { - net_tx_pkt_reset(core->tx[i].tx_pkt, - net_tx_pkt_unmap_frag_pci, core->owner); net_tx_pkt_uninit(core->tx[i].tx_pkt); } @@ -3515,8 +3515,6 @@ static void e1000e_reset(E1000ECore *core, bool sw) e1000x_reset_mac_addr(core->owner_nic, core->mac, core->permanent_mac); for (i = 0; i < ARRAY_SIZE(core->tx); i++) { - net_tx_pkt_reset(core->tx[i].tx_pkt, - net_tx_pkt_unmap_frag_pci, core->owner); memset(&core->tx[i].props, 0, sizeof(core->tx[i].props)); core->tx[i].skip_cp = false; } From patchwork Wed Apr 26 10:36:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773990 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=ITalNc8x; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wPL554Dz23vF for ; Wed, 26 Apr 2023 20:40:22 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcXy-0002l7-Ux; Wed, 26 Apr 2023 06:38:50 -0400 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 1prcXw-0002kE-5C for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:48 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcXu-0003Fj-O5 for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:47 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-63d4595d60fso42175510b3a.0 for ; Wed, 26 Apr 2023 03:38:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505525; x=1685097525; 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=vyIvtVtEkzRRQ65xTTp3qSNNrOItJcBqvkf4ykjxuok=; b=ITalNc8xoixZUGAhI5RP6XE0Hwx0ifzL6L0rPTIBAewFH6SEOnk0OAGfkYnhX2XsT3 KuSE4p+sgOMMx6OTtdTXqJgv+N9UH2lUD1cmj0GTOZE1LZS0NpZwjC0Bm7PJ+DhMcsFF Gg3svJ305UDZKKpdJUWtX5ywvrrVwdgnFMNkGcA5MY9MsE6+AA6OJntXjGhTOVcP8h9A chODwYaahX6+3xz+QXM3ivTasipSoN8Nl6UPfTphbIgAAbO4qtaLvPRTJDFdZ44D/vRm 2LKAs3g9kO1XwFDgjyridYz1r3wv+rGhNF/MaQhE6tRrMJ4ZaAYT0/kIqtDdNLT3e5xU Cf6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505525; x=1685097525; 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=vyIvtVtEkzRRQ65xTTp3qSNNrOItJcBqvkf4ykjxuok=; b=QtwLcovjIBAqQnFgvqHb5wXywiQ/bN3lqwjJzjifNiL6Je6PVeVahhaYrxFtoBfgro a1mChjlPYmk9TI2Y7QEuSCaTmIueac7jnwrCMrGJi4Pj4/D+o879AnTBC0qR53GwV7MX Bi+kt11H3wzBpLwZ+n6UbA59atU8ETvItyOJMRBl6lFcRflMNtjDE9JT2dwEIRYKofwj sEjxTiEm3Pof7ZzGWnLXMza8pcBrBZ0Yr+OaR/ho35jy97s/Ft6GH3ZKRySRzzxOVzHM dMwgCANA5RCEA9ffSZTu1Onl0VQpuwzvSnhoBSu1CQg02IrxbPFgDIgr7cFJG9n+PXSm szrA== X-Gm-Message-State: AC+VfDyZEXB3UTGzX81RR8FFE2QlfTxJy5dfKJxXWyE9TGfibkOh1fH1 bqnfAoWZOwb4Q8OMJh22fCE1Kg== X-Google-Smtp-Source: ACHHUZ6PEFvouzRammnSvNvgxE38XiBjddxnOw5u+qe23SvHrKaLGBO8HRobG4JU3eeRip8sIX7ZNA== X-Received: by 2002:a05:6a21:78a2:b0:f5:e533:4dc2 with SMTP id bf34-20020a056a2178a200b000f5e5334dc2mr2549730pzc.12.1682505525554; Wed, 26 Apr 2023 03:38:45 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.38.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:38:45 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 23/48] vmxnet3: Reset packet state after emptying Tx queue Date: Wed, 26 Apr 2023 19:36:51 +0900 Message-Id: <20230426103716.26279-24-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::429; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x429.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Keeping Tx packet state after the transmit queue is emptied but this behavior is unreliable as the state can be reset anytime the migration happens. Always reset Tx packet state always after the queue is emptied. Signed-off-by: Akihiko Odaki --- hw/net/vmxnet3.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c index 05f41b6dfa..18b9edfdb2 100644 --- a/hw/net/vmxnet3.c +++ b/hw/net/vmxnet3.c @@ -681,6 +681,8 @@ static void vmxnet3_process_tx_queue(VMXNET3State *s, int qidx) net_tx_pkt_unmap_frag_pci, PCI_DEVICE(s)); } } + + net_tx_pkt_reset(s->tx_pkt, net_tx_pkt_unmap_frag_pci, PCI_DEVICE(s)); } static inline void @@ -1159,7 +1161,6 @@ static void vmxnet3_deactivate_device(VMXNET3State *s) { if (s->device_active) { VMW_CBPRN("Deactivating vmxnet3..."); - net_tx_pkt_reset(s->tx_pkt, net_tx_pkt_unmap_frag_pci, PCI_DEVICE(s)); net_tx_pkt_uninit(s->tx_pkt); net_rx_pkt_uninit(s->rx_pkt); s->device_active = false; From patchwork Wed Apr 26 10:36:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773982 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=s/Xny+XT; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wNW0WXLz23vG for ; Wed, 26 Apr 2023 20:39:39 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcY4-0002pV-TP; Wed, 26 Apr 2023 06:38:57 -0400 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 1prcY0-0002lV-8F for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:52 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcXy-0003GD-K5 for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:52 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-63b7588005fso5790308b3a.0 for ; Wed, 26 Apr 2023 03:38:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505529; x=1685097529; 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=UD3tok/robUh/ITv/zdjm3SWmSNjhXL/rVRQIfCxUtc=; b=s/Xny+XTZjSArmCn+hiZKkjcMsNn5rn1OKOBfa4jo2TLNnxIBrwF0/DHllqR5RV23y 4r+1wMr/nTDPcGPW+FjuTtlxvRU19yOat+5U5AcfA7iYZdoQ3YEog0IF14GQW2BTBc50 B+WGwn9Hpd2TTvsu4ybQqQgGfGgs9bjQWCiPfrrOVLIZtGuvBblPplL1IIjTVIMxOVg7 o9f7dt3MRvZMYYycV8f4DiaIm4bFfwsieG4hOf/0QuMB25l6DOThyILTXZbynMnBz8w+ Yr+bUPLZ6UuPtqTTYM3Nwsbc4iB3t10PUYbBCq77H6FNgEoy56l92DV9c1/un7sWI+vs ifLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505529; x=1685097529; 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=UD3tok/robUh/ITv/zdjm3SWmSNjhXL/rVRQIfCxUtc=; b=bI7Q9LDywl14o5Tded7po3QzyYo+znuHMzZFBAws83Dky+wXgirAhYjNX68opdrB3q Syl1a3AsQPIgZCQ0+CfQmXh4iMdz58KX0AXyUU+gXDOkOT6F79ceP19LpFtYqZe2PxB8 +hS/67Pr7lxlW7+YVC3xIX3LRbbb9ScOSufRjmVZCaCtzNm/wqywNr56gf7YAmBe8VRy mZXeHQIkQP/zOH+CLNWVG5gO8/1iTcwiBuMkxwy5dzc3tDvLyhbzE9J/S2M69/PQaw4g qUYfOHQ0Hj87ixsjaTntiLnF3HF+gtzPGNL8QEtk+t9L4uKRfBbCK5bojqvkcPX1QT4M ispA== X-Gm-Message-State: AAQBX9dEmf8ewK8g5E7i71mwxRb5Q3zLKP1tYrAbLE+ytyyJtKGHZjI8 zRtBRIYeGSlTWKGywNeyGYeFSA== X-Google-Smtp-Source: AKy350ayrDYfESgh2nHX7qFzmPaY3a7wR/Jw6nOU0fk3VQVCxLRdM6E2mfsp4Zh8sBbi+etDjoer+g== X-Received: by 2002:a05:6a00:1988:b0:63d:3a32:7407 with SMTP id d8-20020a056a00198800b0063d3a327407mr28404758pfl.16.1682505529062; Wed, 26 Apr 2023 03:38:49 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.38.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:38:48 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 24/48] igb: Add more definitions for Tx descriptor Date: Wed, 26 Apr 2023 19:36:52 +0900 Message-Id: <20230426103716.26279-25-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::429; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x429.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Akihiko Odaki Reviewed-by: Sriram Yagnaraman --- hw/net/igb_regs.h | 32 +++++++++++++++++++++++++++----- hw/net/igb_core.c | 4 ++-- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/hw/net/igb_regs.h b/hw/net/igb_regs.h index 21ee9a3b2d..eb995d8b2e 100644 --- a/hw/net/igb_regs.h +++ b/hw/net/igb_regs.h @@ -42,11 +42,6 @@ union e1000_adv_tx_desc { } wb; }; -#define E1000_ADVTXD_DTYP_CTXT 0x00200000 /* Advanced Context Descriptor */ -#define E1000_ADVTXD_DTYP_DATA 0x00300000 /* Advanced Data Descriptor */ -#define E1000_ADVTXD_DCMD_DEXT 0x20000000 /* Descriptor Extension (1=Adv) */ -#define E1000_ADVTXD_DCMD_TSE 0x80000000 /* TCP/UDP Segmentation Enable */ - #define E1000_ADVTXD_POTS_IXSM 0x00000100 /* Insert TCP/UDP Checksum */ #define E1000_ADVTXD_POTS_TXSM 0x00000200 /* Insert TCP/UDP Checksum */ @@ -151,6 +146,10 @@ union e1000_adv_rx_desc { #define IGB_82576_VF_DEV_ID 0x10CA #define IGB_I350_VF_DEV_ID 0x1520 +/* VLAN info */ +#define IGB_TX_FLAGS_VLAN_MASK 0xffff0000 +#define IGB_TX_FLAGS_VLAN_SHIFT 16 + /* from igb/e1000_82575.h */ #define E1000_MRQC_ENABLE_RSS_MQ 0x00000002 @@ -160,6 +159,29 @@ union e1000_adv_rx_desc { #define E1000_MRQC_RSS_FIELD_IPV6_UDP 0x00800000 #define E1000_MRQC_RSS_FIELD_IPV6_UDP_EX 0x01000000 +/* Adv Transmit Descriptor Config Masks */ +#define E1000_ADVTXD_MAC_TSTAMP 0x00080000 /* IEEE1588 Timestamp packet */ +#define E1000_ADVTXD_DTYP_CTXT 0x00200000 /* Advanced Context Descriptor */ +#define E1000_ADVTXD_DTYP_DATA 0x00300000 /* Advanced Data Descriptor */ +#define E1000_ADVTXD_DCMD_EOP 0x01000000 /* End of Packet */ +#define E1000_ADVTXD_DCMD_IFCS 0x02000000 /* Insert FCS (Ethernet CRC) */ +#define E1000_ADVTXD_DCMD_RS 0x08000000 /* Report Status */ +#define E1000_ADVTXD_DCMD_DEXT 0x20000000 /* Descriptor extension (1=Adv) */ +#define E1000_ADVTXD_DCMD_VLE 0x40000000 /* VLAN pkt enable */ +#define E1000_ADVTXD_DCMD_TSE 0x80000000 /* TCP Seg enable */ +#define E1000_ADVTXD_PAYLEN_SHIFT 14 /* Adv desc PAYLEN shift */ + +#define E1000_ADVTXD_MACLEN_SHIFT 9 /* Adv ctxt desc mac len shift */ +#define E1000_ADVTXD_TUCMD_L4T_UDP 0x00000000 /* L4 Packet TYPE of UDP */ +#define E1000_ADVTXD_TUCMD_IPV4 0x00000400 /* IP Packet Type: 1=IPv4 */ +#define E1000_ADVTXD_TUCMD_L4T_TCP 0x00000800 /* L4 Packet TYPE of TCP */ +#define E1000_ADVTXD_TUCMD_L4T_SCTP 0x00001000 /* L4 packet TYPE of SCTP */ +/* IPSec Encrypt Enable for ESP */ +#define E1000_ADVTXD_L4LEN_SHIFT 8 /* Adv ctxt L4LEN shift */ +#define E1000_ADVTXD_MSS_SHIFT 16 /* Adv ctxt MSS shift */ +/* Adv ctxt IPSec SA IDX mask */ +/* Adv ctxt IPSec ESP len mask */ + /* Additional Transmit Descriptor Control definitions */ #define E1000_TXDCTL_QUEUE_ENABLE 0x02000000 /* Enable specific Tx Queue */ diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index 162ef26789..56a53872cf 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -418,7 +418,7 @@ igb_setup_tx_offloads(IGBCore *core, struct igb_tx *tx) { if (tx->first_cmd_type_len & E1000_ADVTXD_DCMD_TSE) { uint32_t idx = (tx->first_olinfo_status >> 4) & 1; - uint32_t mss = tx->ctx[idx].mss_l4len_idx >> 16; + uint32_t mss = tx->ctx[idx].mss_l4len_idx >> E1000_ADVTXD_MSS_SHIFT; if (!net_tx_pkt_build_vheader(tx->tx_pkt, true, true, mss)) { return false; } @@ -612,7 +612,7 @@ igb_process_tx_desc(IGBCore *core, if (!tx->skip_cp && net_tx_pkt_parse(tx->tx_pkt)) { idx = (tx->first_olinfo_status >> 4) & 1; igb_tx_insert_vlan(core, queue_index, tx, - tx->ctx[idx].vlan_macip_lens >> 16, + tx->ctx[idx].vlan_macip_lens >> IGB_TX_FLAGS_VLAN_SHIFT, !!(tx->first_cmd_type_len & E1000_TXD_CMD_VLE)); if (igb_tx_pkt_send(core, tx, queue_index)) { From patchwork Wed Apr 26 10:36:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1774017 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=DKReVZ4q; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wW55KLWz23vQ for ; Wed, 26 Apr 2023 20:45:20 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcY8-00031U-GF; Wed, 26 Apr 2023 06:39:00 -0400 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 1prcY3-0002oL-5O for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:55 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcY1-0003Gf-Ki for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:54 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-63b78b344d5so5532288b3a.1 for ; Wed, 26 Apr 2023 03:38:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505532; x=1685097532; 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=MrtCRX6iQBVwgwLH2Xil/FY7eqoBzL39/3IOXtgkA6M=; b=DKReVZ4q6laiO1kEePrRfMjWY6bB+7nxURadLjDiyJC1+B3KzZhnYxhK2eYoZwutC5 l4k4HXlH6vRFooU/9qMNk0TrKQxYAxYjK9Ny7BJglv+p2X8T4kU+aC69lBNgAeZX1Z7w 1Lb6cWJZFKf7u5ksxaagk44nB/bm0xMd1QSCfGqG+xNsDTmL0lCmuphQSyfZFytJML2h wcYan6djxaGV2K5eT2JqItfLDkVLCf7jrHdPLTQ4AvvafMQVMMxuuMnYXOl5POpTD1U+ nMyC+C/PkVVYEP6cn01TJ9EKV7mOE+mHq70LpGCUqrd1s6d3A73Tc/JA7TfgNh+83pke 6moQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505532; x=1685097532; 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=MrtCRX6iQBVwgwLH2Xil/FY7eqoBzL39/3IOXtgkA6M=; b=YYMLMywg+/c91Z1JIbEPbLpYXDRqe5Sf2DUpmDufxy29JjDy7LsTojjqcU5l8QtINu o4rGctJuJqG8FAwSvPSvECtrfULpUM5Bt59zIMNCw6SfA/X4FSn8mUcdUXDMiwiZwj1Q aueY5wCCsj9HTNMtGW5z9cXpYrxHlyYWmJJygCOI7+7zdfmr5WprkYPpTIBCqJtuI7po wQ3uP+yTQLn87ulhpH7eMgq6hSaZ0Fr2fWxTYWKwC+XMjAOpH48mt4nmrS99Zvx1AnWz 9h0bjWmdrkI97s4sh+0L1vZzArguKD7qiys5K5p1ZzbjZD+7Dyyp6sF5gMwst2kOL6jH appQ== X-Gm-Message-State: AAQBX9c9ZbmZ8WStEMIn+1AF0qDxBYQKlObWCk0BoQnKUYl5Ld8YtPVx YJTM4OFxNA+SOp4QTn1rZt28SXlcEOfEmWUxWB4= X-Google-Smtp-Source: AKy350Za4zLE+SgC47DwDNS4ga4zM4dnGjCtbQn+ZMqP+pk3/fQpmBK0ifntC95djyIJjqdlJDEcrg== X-Received: by 2002:a05:6a20:748c:b0:f1:c0a1:803c with SMTP id p12-20020a056a20748c00b000f1c0a1803cmr24995892pzd.3.1682505532497; Wed, 26 Apr 2023 03:38:52 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.38.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:38:52 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 25/48] igb: Share common VF constants Date: Wed, 26 Apr 2023 19:36:53 +0900 Message-Id: <20230426103716.26279-26-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::429; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x429.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The constants need to be consistent between the PF and VF. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Sriram Yagnaraman --- hw/net/igb_common.h | 8 ++++++++ hw/net/igb.c | 10 +++++----- hw/net/igbvf.c | 7 ------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/hw/net/igb_common.h b/hw/net/igb_common.h index 69ac490f75..f2a9065791 100644 --- a/hw/net/igb_common.h +++ b/hw/net/igb_common.h @@ -28,6 +28,14 @@ #include "igb_regs.h" +#define TYPE_IGBVF "igbvf" + +#define IGBVF_MMIO_BAR_IDX (0) +#define IGBVF_MSIX_BAR_IDX (3) + +#define IGBVF_MMIO_SIZE (16 * 1024) +#define IGBVF_MSIX_SIZE (16 * 1024) + #define defreg(x) x = (E1000_##x >> 2) #define defreg_indexed(x, i) x##i = (E1000_##x(i) >> 2) #define defreg_indexeda(x, i) x##i##_A = (E1000_##x##_A(i) >> 2) diff --git a/hw/net/igb.c b/hw/net/igb.c index 51a7e9133e..1c989d7677 100644 --- a/hw/net/igb.c +++ b/hw/net/igb.c @@ -433,16 +433,16 @@ static void igb_pci_realize(PCIDevice *pci_dev, Error **errp) pcie_ari_init(pci_dev, 0x150, 1); - pcie_sriov_pf_init(pci_dev, IGB_CAP_SRIOV_OFFSET, "igbvf", + pcie_sriov_pf_init(pci_dev, IGB_CAP_SRIOV_OFFSET, TYPE_IGBVF, IGB_82576_VF_DEV_ID, IGB_MAX_VF_FUNCTIONS, IGB_MAX_VF_FUNCTIONS, IGB_VF_OFFSET, IGB_VF_STRIDE); - pcie_sriov_pf_init_vf_bar(pci_dev, 0, + pcie_sriov_pf_init_vf_bar(pci_dev, IGBVF_MMIO_BAR_IDX, PCI_BASE_ADDRESS_MEM_TYPE_64 | PCI_BASE_ADDRESS_MEM_PREFETCH, - 16 * KiB); - pcie_sriov_pf_init_vf_bar(pci_dev, 3, + IGBVF_MMIO_SIZE); + pcie_sriov_pf_init_vf_bar(pci_dev, IGBVF_MSIX_BAR_IDX, PCI_BASE_ADDRESS_MEM_TYPE_64 | PCI_BASE_ADDRESS_MEM_PREFETCH, - 16 * KiB); + IGBVF_MSIX_SIZE); igb_init_net_peer(s, pci_dev, macaddr); diff --git a/hw/net/igbvf.c b/hw/net/igbvf.c index 70beb7af50..284ea61184 100644 --- a/hw/net/igbvf.c +++ b/hw/net/igbvf.c @@ -50,15 +50,8 @@ #include "trace.h" #include "qapi/error.h" -#define TYPE_IGBVF "igbvf" OBJECT_DECLARE_SIMPLE_TYPE(IgbVfState, IGBVF) -#define IGBVF_MMIO_BAR_IDX (0) -#define IGBVF_MSIX_BAR_IDX (3) - -#define IGBVF_MMIO_SIZE (16 * 1024) -#define IGBVF_MSIX_SIZE (16 * 1024) - struct IgbVfState { PCIDevice parent_obj; From patchwork Wed Apr 26 10:36:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773980 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=yfXnIfAs; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wN906nzz23vJ for ; Wed, 26 Apr 2023 20:39:21 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcY9-0003Ba-UA; Wed, 26 Apr 2023 06:39:01 -0400 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 1prcY6-0002xg-ST for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:00 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcY5-0003H6-6u for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:38:58 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-63b620188aeso8232618b3a.0 for ; Wed, 26 Apr 2023 03:38:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505536; x=1685097536; 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=Ho7Ifk220llWAYq2NpVv9HWCzuj9d3CRqUY2rx+9SrM=; b=yfXnIfAszULTcAWNYR7tyuIg+Y8uZ/jvFFy38weM8HkQtzVV12DFAOygtxtP6TxBph dcleSf5tHr6G2SEQmVly318DyJZy3Fj7a8rrY32Fnmfr3Iwgcp3KND65nxm5yu1SBr6m b2PKw1s2V9PUNtapkbegRgJXe8HlkKyppUiswBff3DE2M9I1WUQE70pC166GCziuZbyE J2FWttqkeuqM1LgVAfGLL7B93Wtxogu0SgMvuIwyPJohxAtJhyFHRAaAI7/c/LsgJpSA ZQUchjWymGrClROwl/UBNes/Sjfc1lFmshsZJfdhndDIs4I1OVUOWM9cX/Crz6q8LRxW /z2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505536; x=1685097536; 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=Ho7Ifk220llWAYq2NpVv9HWCzuj9d3CRqUY2rx+9SrM=; b=UvgYyXla3EhL/ia8mrWQ7VKoX/BD/AUEhPp/DWVocjQMJf0hhrPHO7h4gN0eN9KfN9 AT0yhTpEUsMOzu2sQXHz7xFW4tJNHikt8RPeKHLdoiAnx4mhRls76gNjjxdq+3aI1aEh PJe21qxOHa+nJjHuOpcIeqab6DHEnqIblyUm8oMCLyGrlMjUtc8G7sbAd3JfCSE/y7uX hcYAw7ZNoSC6H+KOCkJBFAabVAhdLtn3W27gbDfQGDOyh3Bhm3NvgxMgaGMJ4w+qpsYy r54PXQd0HD+UpwnXHqw8lN9nu9wEnD0OdTWL4z9Sf0ugHN0vEu3bsRIbALfBBC94bLDh IKvA== X-Gm-Message-State: AAQBX9fOIkXgNSqedCNMg9H6BkdLVXFXVASRtDWQEz+EZL/D3I9yT6WG DcePo5SMfarCqreae4c8YL0CCg== X-Google-Smtp-Source: AKy350Y6hpF/dFlSSHwgy0ZQhN4bCzi51lwDbHpokUAA6Ihn5/PAQMHXf08dOTbH65C+JrCBU1ylFQ== X-Received: by 2002:a05:6a00:2e8b:b0:63b:84a2:6f54 with SMTP id fd11-20020a056a002e8b00b0063b84a26f54mr26805852pfb.26.1682505535978; Wed, 26 Apr 2023 03:38:55 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.38.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:38:55 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 26/48] igb: Fix igb_mac_reg_init coding style alignment Date: Wed, 26 Apr 2023 19:36:54 +0900 Message-Id: <20230426103716.26279-27-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::434; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x434.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, UPPERCASE_50_75=0.008 autolearn=no 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daudé --- hw/net/igb_core.c | 96 +++++++++++++++++++++++------------------------ 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index 56a53872cf..20645c4764 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -4027,54 +4027,54 @@ static const uint32_t igb_mac_reg_init[] = { [VMOLR0 ... VMOLR0 + 7] = 0x2600 | E1000_VMOLR_STRCRC, [RPLOLR] = E1000_RPLOLR_STRCRC, [RLPML] = 0x2600, - [TXCTL0] = E1000_DCA_TXCTRL_DATA_RRO_EN | - E1000_DCA_TXCTRL_TX_WB_RO_EN | - E1000_DCA_TXCTRL_DESC_RRO_EN, - [TXCTL1] = E1000_DCA_TXCTRL_DATA_RRO_EN | - E1000_DCA_TXCTRL_TX_WB_RO_EN | - E1000_DCA_TXCTRL_DESC_RRO_EN, - [TXCTL2] = E1000_DCA_TXCTRL_DATA_RRO_EN | - E1000_DCA_TXCTRL_TX_WB_RO_EN | - E1000_DCA_TXCTRL_DESC_RRO_EN, - [TXCTL3] = E1000_DCA_TXCTRL_DATA_RRO_EN | - E1000_DCA_TXCTRL_TX_WB_RO_EN | - E1000_DCA_TXCTRL_DESC_RRO_EN, - [TXCTL4] = E1000_DCA_TXCTRL_DATA_RRO_EN | - E1000_DCA_TXCTRL_TX_WB_RO_EN | - E1000_DCA_TXCTRL_DESC_RRO_EN, - [TXCTL5] = E1000_DCA_TXCTRL_DATA_RRO_EN | - E1000_DCA_TXCTRL_TX_WB_RO_EN | - E1000_DCA_TXCTRL_DESC_RRO_EN, - [TXCTL6] = E1000_DCA_TXCTRL_DATA_RRO_EN | - E1000_DCA_TXCTRL_TX_WB_RO_EN | - E1000_DCA_TXCTRL_DESC_RRO_EN, - [TXCTL7] = E1000_DCA_TXCTRL_DATA_RRO_EN | - E1000_DCA_TXCTRL_TX_WB_RO_EN | - E1000_DCA_TXCTRL_DESC_RRO_EN, - [TXCTL8] = E1000_DCA_TXCTRL_DATA_RRO_EN | - E1000_DCA_TXCTRL_TX_WB_RO_EN | - E1000_DCA_TXCTRL_DESC_RRO_EN, - [TXCTL9] = E1000_DCA_TXCTRL_DATA_RRO_EN | - E1000_DCA_TXCTRL_TX_WB_RO_EN | - E1000_DCA_TXCTRL_DESC_RRO_EN, - [TXCTL10] = E1000_DCA_TXCTRL_DATA_RRO_EN | - E1000_DCA_TXCTRL_TX_WB_RO_EN | - E1000_DCA_TXCTRL_DESC_RRO_EN, - [TXCTL11] = E1000_DCA_TXCTRL_DATA_RRO_EN | - E1000_DCA_TXCTRL_TX_WB_RO_EN | - E1000_DCA_TXCTRL_DESC_RRO_EN, - [TXCTL12] = E1000_DCA_TXCTRL_DATA_RRO_EN | - E1000_DCA_TXCTRL_TX_WB_RO_EN | - E1000_DCA_TXCTRL_DESC_RRO_EN, - [TXCTL13] = E1000_DCA_TXCTRL_DATA_RRO_EN | - E1000_DCA_TXCTRL_TX_WB_RO_EN | - E1000_DCA_TXCTRL_DESC_RRO_EN, - [TXCTL14] = E1000_DCA_TXCTRL_DATA_RRO_EN | - E1000_DCA_TXCTRL_TX_WB_RO_EN | - E1000_DCA_TXCTRL_DESC_RRO_EN, - [TXCTL15] = E1000_DCA_TXCTRL_DATA_RRO_EN | - E1000_DCA_TXCTRL_TX_WB_RO_EN | - E1000_DCA_TXCTRL_DESC_RRO_EN, + [TXCTL0] = E1000_DCA_TXCTRL_DATA_RRO_EN | + E1000_DCA_TXCTRL_TX_WB_RO_EN | + E1000_DCA_TXCTRL_DESC_RRO_EN, + [TXCTL1] = E1000_DCA_TXCTRL_DATA_RRO_EN | + E1000_DCA_TXCTRL_TX_WB_RO_EN | + E1000_DCA_TXCTRL_DESC_RRO_EN, + [TXCTL2] = E1000_DCA_TXCTRL_DATA_RRO_EN | + E1000_DCA_TXCTRL_TX_WB_RO_EN | + E1000_DCA_TXCTRL_DESC_RRO_EN, + [TXCTL3] = E1000_DCA_TXCTRL_DATA_RRO_EN | + E1000_DCA_TXCTRL_TX_WB_RO_EN | + E1000_DCA_TXCTRL_DESC_RRO_EN, + [TXCTL4] = E1000_DCA_TXCTRL_DATA_RRO_EN | + E1000_DCA_TXCTRL_TX_WB_RO_EN | + E1000_DCA_TXCTRL_DESC_RRO_EN, + [TXCTL5] = E1000_DCA_TXCTRL_DATA_RRO_EN | + E1000_DCA_TXCTRL_TX_WB_RO_EN | + E1000_DCA_TXCTRL_DESC_RRO_EN, + [TXCTL6] = E1000_DCA_TXCTRL_DATA_RRO_EN | + E1000_DCA_TXCTRL_TX_WB_RO_EN | + E1000_DCA_TXCTRL_DESC_RRO_EN, + [TXCTL7] = E1000_DCA_TXCTRL_DATA_RRO_EN | + E1000_DCA_TXCTRL_TX_WB_RO_EN | + E1000_DCA_TXCTRL_DESC_RRO_EN, + [TXCTL8] = E1000_DCA_TXCTRL_DATA_RRO_EN | + E1000_DCA_TXCTRL_TX_WB_RO_EN | + E1000_DCA_TXCTRL_DESC_RRO_EN, + [TXCTL9] = E1000_DCA_TXCTRL_DATA_RRO_EN | + E1000_DCA_TXCTRL_TX_WB_RO_EN | + E1000_DCA_TXCTRL_DESC_RRO_EN, + [TXCTL10] = E1000_DCA_TXCTRL_DATA_RRO_EN | + E1000_DCA_TXCTRL_TX_WB_RO_EN | + E1000_DCA_TXCTRL_DESC_RRO_EN, + [TXCTL11] = E1000_DCA_TXCTRL_DATA_RRO_EN | + E1000_DCA_TXCTRL_TX_WB_RO_EN | + E1000_DCA_TXCTRL_DESC_RRO_EN, + [TXCTL12] = E1000_DCA_TXCTRL_DATA_RRO_EN | + E1000_DCA_TXCTRL_TX_WB_RO_EN | + E1000_DCA_TXCTRL_DESC_RRO_EN, + [TXCTL13] = E1000_DCA_TXCTRL_DATA_RRO_EN | + E1000_DCA_TXCTRL_TX_WB_RO_EN | + E1000_DCA_TXCTRL_DESC_RRO_EN, + [TXCTL14] = E1000_DCA_TXCTRL_DATA_RRO_EN | + E1000_DCA_TXCTRL_TX_WB_RO_EN | + E1000_DCA_TXCTRL_DESC_RRO_EN, + [TXCTL15] = E1000_DCA_TXCTRL_DATA_RRO_EN | + E1000_DCA_TXCTRL_TX_WB_RO_EN | + E1000_DCA_TXCTRL_DESC_RRO_EN, }; static void igb_reset(IGBCore *core, bool sw) From patchwork Wed Apr 26 10:36:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773989 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=KLqMLbuW; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wP3335Xz23vH for ; Wed, 26 Apr 2023 20:40:07 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcYA-0003GG-W7; Wed, 26 Apr 2023 06:39:03 -0400 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 1prcYA-0003CS-5K for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:02 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcY8-0003HW-J2 for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:01 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-63f273b219eso3370400b3a.1 for ; Wed, 26 Apr 2023 03:39:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505539; x=1685097539; 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=hp2InDnsuAVyTdeGynRAHIQCpujuFW2lt68SJPRTlkY=; b=KLqMLbuWNz63QCKBykdDWGG1xyXtKZw3lArHvwAzzJovc4LiUQME8s7OM2rgyYOiMk CDdkOkimqBRJsJmMVcXz+rRQQaTh+vP8HpKfrZbfD7y2dO+PIQ/K7R4bguNoNRLwwf9S /DRtcdhOpXy6E5bWvFPTkmqNG4ggtl/8CcFng6EgFoYM65rGHR/2dofo+TvMBo8xp3YW QniwcMi+wRFhVg6Y8TNm3PVB5BZ9uNLgDoPRixpbWunMxQjZanwOqmg+l5kD9tOwWcS6 pbwbKEtCAFk1Olwc5mq7iabTLqUE6AET7zJsEo/zFGyJE1izVZeEjeTgHGsiDy9lnGDF 4edg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505539; x=1685097539; 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=hp2InDnsuAVyTdeGynRAHIQCpujuFW2lt68SJPRTlkY=; b=aNOBCEQaR5uhhOmJ+A6vu3IG8hPdyq/PNfN2zAxnE7e0QNagVJqVbYTrdzO3kXgOZe gk0lONpz1uiMnO96RkBuGgVLhaLKxaiuYJtz1eSJBhylxiPl0H0/jWaDc5/jobQX/QSb BmG4Jhi/hfsXq45yttBbtZlWPOoBuVSbIdOTMX/NB2yLuv3ivWioSK4J6QYanJFNNRRC EFW3ZcXQyc2ffUEDpXj1fI/p05u6X0EEuluXJOVwLNuzG+Sft0orwxpW/+IpEDzT8ttR itqTNRRonjJtd8NO0oX3zhD5+wNVOy2cfwwzhlFEH9zyz9gew6iwkEh6Us7Uxw7cTi0p MA7Q== X-Gm-Message-State: AAQBX9eW2TDulIP6evIwxxu77d7uKGeSDwGy2EmUf+uFQme+hIZ5N0fV FNmJu4teonZmqrGx1xBbJUQeUQ== X-Google-Smtp-Source: AKy350Z2TC7GGh732JsuGxFJBp2wPo5bY2vE0+RS6AfxuO0T33JaAPhF/a+NFExLk377gagLASvI3Q== X-Received: by 2002:a05:6a20:c1a6:b0:e5:58e6:be37 with SMTP id bg38-20020a056a20c1a600b000e558e6be37mr22571232pzb.61.1682505539428; Wed, 26 Apr 2023 03:38:59 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.38.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:38:59 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 27/48] igb: Clear EICR bits for delayed MSI-X interrupts Date: Wed, 26 Apr 2023 19:36:55 +0900 Message-Id: <20230426103716.26279-28-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::432; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x432.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Section 7.3.4.1 says: > When auto-clear is enabled for an interrupt cause, the EICR bit is > set when a cause event mapped to this vector occurs. When the EITR > Counter reaches zero, the MSI-X message is sent on PCIe. Then the > EICR bit is cleared and enabled to be set by a new cause event Signed-off-by: Akihiko Odaki Reviewed-by: Sriram Yagnaraman --- hw/net/igb_core.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index 20645c4764..edda07e564 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -97,23 +97,31 @@ igb_lower_legacy_irq(IGBCore *core) pci_set_irq(core->owner, 0); } -static void igb_msix_notify(IGBCore *core, unsigned int vector) +static void igb_msix_notify(IGBCore *core, unsigned int cause) { PCIDevice *dev = core->owner; uint16_t vfn; + uint32_t effective_eiac; + unsigned int vector; - vfn = 8 - (vector + 2) / IGBVF_MSIX_VEC_NUM; + vfn = 8 - (cause + 2) / IGBVF_MSIX_VEC_NUM; if (vfn < pcie_sriov_num_vfs(core->owner)) { dev = pcie_sriov_get_vf_at_index(core->owner, vfn); assert(dev); - vector = (vector + 2) % IGBVF_MSIX_VEC_NUM; - } else if (vector >= IGB_MSIX_VEC_NUM) { + vector = (cause + 2) % IGBVF_MSIX_VEC_NUM; + } else if (cause >= IGB_MSIX_VEC_NUM) { qemu_log_mask(LOG_GUEST_ERROR, "igb: Tried to use vector unavailable for PF"); return; + } else { + vector = cause; } msix_notify(dev, vector); + + trace_e1000e_irq_icr_clear_eiac(core->mac[EICR], core->mac[EIAC]); + effective_eiac = core->mac[EIAC] & BIT(cause); + core->mac[EICR] &= ~effective_eiac; } static inline void @@ -1834,7 +1842,6 @@ igb_eitr_should_postpone(IGBCore *core, int idx) static void igb_send_msix(IGBCore *core) { uint32_t causes = core->mac[EICR] & core->mac[EIMS]; - uint32_t effective_eiac; int vector; for (vector = 0; vector < IGB_INTR_NUM; ++vector) { @@ -1842,10 +1849,6 @@ static void igb_send_msix(IGBCore *core) trace_e1000e_irq_msix_notify_vec(vector); igb_msix_notify(core, vector); - - trace_e1000e_irq_icr_clear_eiac(core->mac[EICR], core->mac[EIAC]); - effective_eiac = core->mac[EIAC] & BIT(vector); - core->mac[EICR] &= ~effective_eiac; } } } From patchwork Wed Apr 26 10:36:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773981 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=0t9Py6Zw; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wNM42xQz23vG for ; Wed, 26 Apr 2023 20:39:31 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcYF-0003lL-BZ; Wed, 26 Apr 2023 06:39:07 -0400 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 1prcYD-0003Yf-RO for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:05 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcYC-0003I6-9R for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:05 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-63b60366047so5495198b3a.1 for ; Wed, 26 Apr 2023 03:39:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505543; x=1685097543; 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=TKps3i+/xgR1NdMHKFtK//L/h8EqWJC3mpa9ycy+Xdw=; b=0t9Py6Zwd+fJfqIWTOZGSmZkDB0FJFmnWasP03ClAIdGU5gIHBjYWlVGjJgGFvnyit Xe6iFjXv3hXW1m4ffXUqpRYmD46xCbDqZahIJ0wjaECBkCgxOZfQVpRz0Uqnw2UGDCHy KFsSe9fdt/+4+6Kcet+89SPa8l3ZW733FWVOs2MJC2xeG+KAv/ocUFGI1LR5Z2EN0Vuv Dlf41lONOHDuY5Xqa3I7hBYazNYmMHHx50vNp6vacH4TzpZmI3qWevDaFAdkM86kVZlR 2DQxCprvlAml2OwO62LtPReOoM35qpGgCRGsbZn53S0sfR2ha2sxJ3MlQfDJyTLP5l94 ljQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505543; x=1685097543; 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=TKps3i+/xgR1NdMHKFtK//L/h8EqWJC3mpa9ycy+Xdw=; b=NXFKn0wfT/hfsX4YUHdGXE0xwOvgmw1FfmB1MHaHjzmBoW82Trfe4vPlla0Jv9EByL pCb4rAla++ZEBvNeiiTW91znQELgLzsZ18JsxLu6oyf5bFD/1UNxtvxGxs5Dbv9Xicou 1Tnrtd4R/OfZl+2rrq5YiLy7HlKIi3TmAZ5Em4IUBr2OAULA4y4yikKrYYDLhmOVL0Wu dIz54Pedspd7lj7OeuIwz+pEHAoJd3cA4ixkBLrCiRempfnwcwK7+eZQt/XsTA+QFJ22 xWM62p6SXbrH4gM0gpjpRB44QWhdbSHjSTQ45tv9uDcaAFwSeDB0gOQq+pqlfPud8BPe 05sw== X-Gm-Message-State: AAQBX9el089wYM9B/NAbKC5d87nYUwpyFynJFjC/+gDl7l4lU1vkZP60 tQBrREmMns3RRFbSWsBdkfBeMg== X-Google-Smtp-Source: AKy350bCXtWvoqnTybP+QK8lOncTq7z9GY5uft4MzTsX5MeEnJtOTFUhIM3gCWyzwUkzzlGh+POY3Q== X-Received: by 2002:a05:6a00:1825:b0:63d:3aed:44fb with SMTP id y37-20020a056a00182500b0063d3aed44fbmr30229450pfa.21.1682505542869; Wed, 26 Apr 2023 03:39:02 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.38.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:39:02 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 28/48] e1000e: Rename a variable in e1000e_receive_internal() Date: Wed, 26 Apr 2023 19:36:56 +0900 Message-Id: <20230426103716.26279-29-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::432; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x432.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Rename variable "n" to "causes", which properly represents the content of the variable. Signed-off-by: Akihiko Odaki --- hw/net/e1000e_core.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c index 7dce448657..aea70b74d9 100644 --- a/hw/net/e1000e_core.c +++ b/hw/net/e1000e_core.c @@ -1650,7 +1650,7 @@ static ssize_t e1000e_receive_internal(E1000ECore *core, const struct iovec *iov, int iovcnt, bool has_vnet) { - uint32_t n = 0; + uint32_t causes = 0; uint8_t buf[ETH_ZLEN]; struct iovec min_iov; size_t size, orig_size; @@ -1723,32 +1723,32 @@ e1000e_receive_internal(E1000ECore *core, const struct iovec *iov, int iovcnt, /* Perform small receive detection (RSRPD) */ if (total_size < core->mac[RSRPD]) { - n |= E1000_ICS_SRPD; + causes |= E1000_ICS_SRPD; } /* Perform ACK receive detection */ if (!(core->mac[RFCTL] & E1000_RFCTL_ACK_DIS) && (e1000e_is_tcp_ack(core, core->rx_pkt))) { - n |= E1000_ICS_ACK; + causes |= E1000_ICS_ACK; } /* Check if receive descriptor minimum threshold hit */ rdmts_hit = e1000e_rx_descr_threshold_hit(core, rxr.i); - n |= e1000e_rx_wb_interrupt_cause(core, rxr.i->idx, rdmts_hit); + causes |= e1000e_rx_wb_interrupt_cause(core, rxr.i->idx, rdmts_hit); trace_e1000e_rx_written_to_guest(rxr.i->idx); } else { - n |= E1000_ICS_RXO; + causes |= E1000_ICS_RXO; retval = 0; trace_e1000e_rx_not_written_to_guest(rxr.i->idx); } - if (!e1000e_intrmgr_delay_rx_causes(core, &n)) { - trace_e1000e_rx_interrupt_set(n); - e1000e_set_interrupt_cause(core, n); + if (!e1000e_intrmgr_delay_rx_causes(core, &causes)) { + trace_e1000e_rx_interrupt_set(causes); + e1000e_set_interrupt_cause(core, causes); } else { - trace_e1000e_rx_interrupt_delayed(n); + trace_e1000e_rx_interrupt_delayed(causes); } return retval; From patchwork Wed Apr 26 10:36:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1774009 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=VRC4swqx; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wV13bd3z23vF for ; Wed, 26 Apr 2023 20:44:25 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcYI-00049l-Mp; Wed, 26 Apr 2023 06:39:10 -0400 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 1prcYH-0003zr-0Z for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:09 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcYF-0003Ie-CZ for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:08 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-63b4a64c72bso5501212b3a.0 for ; Wed, 26 Apr 2023 03:39:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505546; x=1685097546; 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=/MRmwwy8OAhnmp58Nb2Kd682XzfWOCrxeSmDJ43dpfc=; b=VRC4swqxvCt6up0fUvwgxQ7tZZEeckJz7s69CUjAkWO/hNZmQY05vn64rkJkEjjOXr 6xbJrCT3Xpj6CgUBMTMOSPUC3GRm+w8cI1hQAqF3iUYggn3eAPXK+r8MYcww1UF1/nU5 j4rjF5yeR2c/7WxEyfKWQvALYV2gpUeed3FoUZOxw6k1yGC0mq1veH5H81gf+s72jRT8 DsSdaCpETJNCAQq2p5Ddc79TQVLkO2T+W7uQzeK8ioqxaq6h93ConrjB5Jli6Ao1MuAk 5BeWmx5k7XUlnQavwzIhlEzMZz16TjgnRQ9CHRJKDtRmMrwNPzLUu6865gEoBrjrwweB kSvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505546; x=1685097546; 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=/MRmwwy8OAhnmp58Nb2Kd682XzfWOCrxeSmDJ43dpfc=; b=Vr7Nzymy530SzGNKmTxobdhcKOqnUr/8owCBroDwfSn7fK74qEtpXh2gYzRVD1XaoF qDnLA93QS8i9rxvNBuOP7S5uPrXtYXFpTJuaYcWZaUpkpnTm/PP2X/Ja1CBM2mUirZyv o3OlrdbrbqaMRuf5K2IyWAN2mt3gtBEI6UTTttJO3F5Pxs/WVIUZShoqdZzWH1394SJp +QRE7EaUzaIIdwD3bt37gFdutr4g51rREh5V9FdWTSmXQZBwmr4/E1+nCe3zaMNmKVQO TSDlcuxSiPlUuozseLkDOHgZoviUr7c2iUFBCP8lWEQDff3/Bo7Ur4E3nzojqjoiqGHx +2Qw== X-Gm-Message-State: AAQBX9cZrNdNsLeATK1Wi+RJ3facqyKGFTFgKFCN6L4boFfM4rpizl7b kp7fLgoG4yGeXrK7+vyBzgxt4w== X-Google-Smtp-Source: AKy350YoAhTKx+TeQWpiJMkEQvw1GsiX1WDtJJ5NrTqKBJxruBAjDv9vSpQopb5DzbFMtaXsPJIcwQ== X-Received: by 2002:a05:6a20:1456:b0:f0:110b:bf9b with SMTP id a22-20020a056a20145600b000f0110bbf9bmr28643262pzi.16.1682505546263; Wed, 26 Apr 2023 03:39:06 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.39.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:39:05 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 29/48] igb: Rename a variable in igb_receive_internal() Date: Wed, 26 Apr 2023 19:36:57 +0900 Message-Id: <20230426103716.26279-30-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::432; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x432.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Rename variable "n" to "causes", which properly represents the content of the variable. Signed-off-by: Akihiko Odaki Reviewed-by: Sriram Yagnaraman --- hw/net/igb_core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index edda07e564..c954369964 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -1569,7 +1569,7 @@ igb_receive_internal(IGBCore *core, const struct iovec *iov, int iovcnt, bool has_vnet, bool *external_tx) { uint16_t queues = 0; - uint32_t n = 0; + uint32_t causes = 0; union { L2Header l2_header; uint8_t octets[ETH_ZLEN]; @@ -1649,19 +1649,19 @@ igb_receive_internal(IGBCore *core, const struct iovec *iov, int iovcnt, e1000x_fcs_len(core->mac); if (!igb_has_rxbufs(core, rxr.i, total_size)) { - n |= E1000_ICS_RXO; + causes |= E1000_ICS_RXO; trace_e1000e_rx_not_written_to_guest(rxr.i->idx); continue; } - n |= E1000_ICR_RXDW; + causes |= E1000_ICR_RXDW; igb_rx_fix_l4_csum(core, core->rx_pkt); igb_write_packet_to_guest(core, core->rx_pkt, &rxr, &rss_info); /* Check if receive descriptor minimum threshold hit */ if (igb_rx_descr_threshold_hit(core, rxr.i)) { - n |= E1000_ICS_RXDMT0; + causes |= E1000_ICS_RXDMT0; } core->mac[EICR] |= igb_rx_wb_eic(core, rxr.i->idx); @@ -1669,8 +1669,8 @@ igb_receive_internal(IGBCore *core, const struct iovec *iov, int iovcnt, trace_e1000e_rx_written_to_guest(rxr.i->idx); } - trace_e1000e_rx_interrupt_set(n); - igb_set_interrupt_cause(core, n); + trace_e1000e_rx_interrupt_set(causes); + igb_set_interrupt_cause(core, causes); return orig_size; } From patchwork Wed Apr 26 10:36:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773995 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=lMXiM2TU; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wQP4Tr6z23vF for ; Wed, 26 Apr 2023 20:41:17 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcYM-0004It-3M; Wed, 26 Apr 2023 06:39:14 -0400 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 1prcYK-0004Gj-EU for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:12 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcYI-0003JH-UN for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:12 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-63b70f0b320so8917152b3a.1 for ; Wed, 26 Apr 2023 03:39:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505550; x=1685097550; 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=oSx/Q5Zg5D9OUWDD4DVLGcD91xlqvbaERviIetrBRHM=; b=lMXiM2TUCBS/bG+Gnimp14vHsfPrjEz3VLhwSjtYTIgA+K3BFKrVHlcOHNGk5/oJlP z4Ei12DVg0sSMUCePBPeT6yLreLZbN+bmychV8rYGuFIj/XE1YtvB5ryM7d3QI4cELzv Ca9M5QpY82uhJgT91YPXULaOG9KQ4iiXs4MmJ0+8va+8GVyyshex7ikvD9WRwI3sfOWi poOdUFhTQoBCcTZfHE1PImOH95ETZWdNMwGKC0vP4jYpDl2+qUL4aOwGQhbytql3Pijq lx3EEt123KK2SVWiMRVd9+RdpJGZF3u7y7pmBH7VgTZBvBKS25agFpxJYZ3iyk7CGQNM UYgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505550; x=1685097550; 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=oSx/Q5Zg5D9OUWDD4DVLGcD91xlqvbaERviIetrBRHM=; b=edqzwlevxMlCvLYhXy7cmhA0RXhbzea9u9o0wE/QWenWY796cMclmlNX73AB8RmHEj G1dGk5cdAi+BkV/yLTlPIgEUFvbj1gyegpY2Div4vHBTm6K0YhwxtH4wz7s+vqWFIsik u50TtWDKPyAz4ARuJlZQ6al6ge3LfZY0JT5qcPBo5mv7HtNzetfy1NTjK3X4LpUVfNJt I7MpH3cAxOZ4fJpzmYcZ3RgbiLnUSwJPhUB+4z5sMGDb3IbeElwPtScXh5K1JOciSAYn GgxRprZTVbrNEDv/FGdicPm81RWBNLySm0sK3KYrs+xRj4ouYzMOySbovkDKJwX1TTMF Xh2Q== X-Gm-Message-State: AAQBX9eUXMsvJyqM6XfoKi9Hev2KmEZ+/PBuBPEmRuxgH3EYVLdHZZW1 RVrGbQO8LhFnHKMuGvxqeU4jJQ== X-Google-Smtp-Source: AKy350YZgyzvuYkRQhMY5TpVs0GFwknaLEonEbXNV7iRWIb/VD7jBqHnpmYPdQGROHjFNqURGdpz+Q== X-Received: by 2002:a05:6a21:789b:b0:f5:b78b:1a0e with SMTP id bf27-20020a056a21789b00b000f5b78b1a0emr10456509pzc.9.1682505549736; Wed, 26 Apr 2023 03:39:09 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.39.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:39:09 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 30/48] net/eth: Use void pointers Date: Wed, 26 Apr 2023 19:36:58 +0900 Message-Id: <20230426103716.26279-31-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::42e; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The uses of uint8_t pointers were misleading as they are never accessed as an array of octets and it even require more strict alignment to access as struct eth_header. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daudé --- include/net/eth.h | 4 ++-- net/eth.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/net/eth.h b/include/net/eth.h index 05f56931e7..95ff24d6b8 100644 --- a/include/net/eth.h +++ b/include/net/eth.h @@ -342,12 +342,12 @@ eth_get_pkt_tci(const void *p) size_t eth_strip_vlan(const struct iovec *iov, int iovcnt, size_t iovoff, - uint8_t *new_ehdr_buf, + void *new_ehdr_buf, uint16_t *payload_offset, uint16_t *tci); size_t eth_strip_vlan_ex(const struct iovec *iov, int iovcnt, size_t iovoff, - uint16_t vet, uint8_t *new_ehdr_buf, + uint16_t vet, void *new_ehdr_buf, uint16_t *payload_offset, uint16_t *tci); uint16_t diff --git a/net/eth.c b/net/eth.c index b6ff89c460..f7ffbda600 100644 --- a/net/eth.c +++ b/net/eth.c @@ -226,11 +226,11 @@ void eth_get_protocols(const struct iovec *iov, size_t iovcnt, size_t iovoff, size_t eth_strip_vlan(const struct iovec *iov, int iovcnt, size_t iovoff, - uint8_t *new_ehdr_buf, + void *new_ehdr_buf, uint16_t *payload_offset, uint16_t *tci) { struct vlan_header vlan_hdr; - struct eth_header *new_ehdr = (struct eth_header *) new_ehdr_buf; + struct eth_header *new_ehdr = new_ehdr_buf; size_t copied = iov_to_buf(iov, iovcnt, iovoff, new_ehdr, sizeof(*new_ehdr)); @@ -276,7 +276,7 @@ eth_strip_vlan(const struct iovec *iov, int iovcnt, size_t iovoff, size_t eth_strip_vlan_ex(const struct iovec *iov, int iovcnt, size_t iovoff, - uint16_t vet, uint8_t *new_ehdr_buf, + uint16_t vet, void *new_ehdr_buf, uint16_t *payload_offset, uint16_t *tci) { struct vlan_header vlan_hdr; From patchwork Wed Apr 26 10:36:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773999 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=rb22nDfC; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wQx2zjvz23vF for ; Wed, 26 Apr 2023 20:41:45 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcYQ-0004Ux-OJ; Wed, 26 Apr 2023 06:39:18 -0400 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 1prcYN-0004Jr-Uj for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:15 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcYM-0003Ji-Bb for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:15 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-63b50a02bffso5718634b3a.2 for ; Wed, 26 Apr 2023 03:39:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505553; x=1685097553; 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=WfMEYJ9MsNl1NEs1qpCe7w36MfTu1Ir4rIbITGTkOa8=; b=rb22nDfCSoXMRxnD/vMrnf+RCtoEbC+X430lXkn0SlhaXQDDU+M4IxxjLrY4jxmnyF Q7jyHvuPw/Pz21qe2h8Imp5h27QgSOCQIjdHgxnbdQ0aI8ZTjpJb/j1L8P14WCFSQ8cN A10ZSngBDy9bGKJW0q4SKinbC7+JT5gTdw6mElBjvqHhwtWiu5zXdRaDsp+g9X+l//L3 f1lHTXauZ96T6kOQVWG49LbiQ3i3eGoewtRNkM7FhAtIfUE/TufxSzdwOPJyYJ5wnIoP +Vlwvrxw/4LIrm+gsDbvjpv8Ji0FELI8HTFwTS6vyfeNA5pJylm8TgEJx5bZ3/mdUsQn J5ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505553; x=1685097553; 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=WfMEYJ9MsNl1NEs1qpCe7w36MfTu1Ir4rIbITGTkOa8=; b=esZLAhhJ8etylEwtfkdoLTJ7FFF2tjpwbylaMlzTJbHV7x4Ge5uFho4tsGw/m8HttX 7ASMcdSbcXLZvR7VBHtSGw0HiTnXe73Xg+wpT2ffbW+2Kqxd7vdnrdSun5M08yP+IvSq MNMh/6hLCt8mQ/bXx59Z90nBozTFP9hsAj5vFjMwCqtFmc2R0btynuL4G3nkyhebP/SJ yR00aMPQQl+WjvsmHa85uqd2UPJd7e/zUgy55ylvyGdb/679Plf2i4dgoD4o5V+KXonL HYGRnEgS1SXyHKFrZxUc+q/V3EkzaEVzoSOZHX2wvH610ybRhmjh5BRKxLU+oGCsm35d aOSw== X-Gm-Message-State: AAQBX9c1gfLKLvuu2dQOLYhAMMfF1DZ9xJVGtmdMiQPcBcz5TMgghvOw 499e86Cr1V0nDBRFXM3Ec5E18w== X-Google-Smtp-Source: AKy350b/7PEdjzFvNsud50s6fW+8+9VPRl68t+j0Kf/xYaoanmuybI8sGmFMbfpyxsnlv3qDYF08HA== X-Received: by 2002:a05:6a20:8e24:b0:f3:3578:6699 with SMTP id y36-20020a056a208e2400b000f335786699mr17998327pzj.45.1682505553241; Wed, 26 Apr 2023 03:39:13 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.39.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:39:12 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 31/48] net/eth: Always add VLAN tag Date: Wed, 26 Apr 2023 19:36:59 +0900 Message-Id: <20230426103716.26279-32-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::42c; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org It is possible to have another VLAN tag even if the packet is already tagged. Signed-off-by: Akihiko Odaki --- include/net/eth.h | 4 ++-- hw/net/net_tx_pkt.c | 16 +++++++--------- net/eth.c | 22 ++++++---------------- 3 files changed, 15 insertions(+), 27 deletions(-) diff --git a/include/net/eth.h b/include/net/eth.h index 95ff24d6b8..048e434685 100644 --- a/include/net/eth.h +++ b/include/net/eth.h @@ -353,8 +353,8 @@ eth_strip_vlan_ex(const struct iovec *iov, int iovcnt, size_t iovoff, uint16_t eth_get_l3_proto(const struct iovec *l2hdr_iov, int iovcnt, size_t l2hdr_len); -void eth_setup_vlan_headers(struct eth_header *ehdr, uint16_t vlan_tag, - uint16_t vlan_ethtype, bool *is_new); +void eth_setup_vlan_headers(struct eth_header *ehdr, size_t *ehdr_size, + uint16_t vlan_tag, uint16_t vlan_ethtype); uint8_t eth_get_gso_type(uint16_t l3_proto, uint8_t *l3_hdr, uint8_t l4proto); diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c index ce6b102391..af8f77a3f0 100644 --- a/hw/net/net_tx_pkt.c +++ b/hw/net/net_tx_pkt.c @@ -40,7 +40,10 @@ struct NetTxPkt { struct iovec *vec; - uint8_t l2_hdr[ETH_MAX_L2_HDR_LEN]; + struct { + struct eth_header eth; + struct vlan_header vlan[3]; + } l2_hdr; union { struct ip_header ip; struct ip6_header ip6; @@ -365,18 +368,13 @@ bool net_tx_pkt_build_vheader(struct NetTxPkt *pkt, bool tso_enable, void net_tx_pkt_setup_vlan_header_ex(struct NetTxPkt *pkt, uint16_t vlan, uint16_t vlan_ethtype) { - bool is_new; assert(pkt); eth_setup_vlan_headers(pkt->vec[NET_TX_PKT_L2HDR_FRAG].iov_base, - vlan, vlan_ethtype, &is_new); + &pkt->vec[NET_TX_PKT_L2HDR_FRAG].iov_len, + vlan, vlan_ethtype); - /* update l2hdrlen */ - if (is_new) { - pkt->hdr_len += sizeof(struct vlan_header); - pkt->vec[NET_TX_PKT_L2HDR_FRAG].iov_len += - sizeof(struct vlan_header); - } + pkt->hdr_len += sizeof(struct vlan_header); } bool net_tx_pkt_add_raw_fragment(struct NetTxPkt *pkt, void *base, size_t len) diff --git a/net/eth.c b/net/eth.c index f7ffbda600..5307978486 100644 --- a/net/eth.c +++ b/net/eth.c @@ -21,26 +21,16 @@ #include "net/checksum.h" #include "net/tap.h" -void eth_setup_vlan_headers(struct eth_header *ehdr, uint16_t vlan_tag, - uint16_t vlan_ethtype, bool *is_new) +void eth_setup_vlan_headers(struct eth_header *ehdr, size_t *ehdr_size, + uint16_t vlan_tag, uint16_t vlan_ethtype) { struct vlan_header *vhdr = PKT_GET_VLAN_HDR(ehdr); - switch (be16_to_cpu(ehdr->h_proto)) { - case ETH_P_VLAN: - case ETH_P_DVLAN: - /* vlan hdr exists */ - *is_new = false; - break; - - default: - /* No VLAN header, put a new one */ - vhdr->h_proto = ehdr->h_proto; - ehdr->h_proto = cpu_to_be16(vlan_ethtype); - *is_new = true; - break; - } + memmove(vhdr + 1, vhdr, *ehdr_size - ETH_HLEN); vhdr->h_tci = cpu_to_be16(vlan_tag); + vhdr->h_proto = ehdr->h_proto; + ehdr->h_proto = cpu_to_be16(vlan_ethtype); + *ehdr_size += sizeof(*vhdr); } uint8_t From patchwork Wed Apr 26 10:37:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1774003 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=hw54M7VB; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wSP0rQqz23vF for ; Wed, 26 Apr 2023 20:43:01 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcYW-0005Ae-Hc; Wed, 26 Apr 2023 06:39:24 -0400 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 1prcYS-0004v0-KI for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:20 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcYQ-0003K1-Sw for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:20 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-63b52ad6311so8219937b3a.2 for ; Wed, 26 Apr 2023 03:39:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505557; x=1685097557; 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=8cbPtOGCt4/DtgDNQOMqkazCwuM1SU58VR9lfEcSjFg=; b=hw54M7VBYGISGO3Kt+gmGet5n8z0bODob2Iw8yfaD2FqrLVDuitAsAwn+CqonsXsB/ sUPhl0Tn6o1e8VFoHK2vqZa5qzi5Ky5fq4Gx8Q1uljQEXS0rjcBr0sTvKe4+L4crac07 GxP0ZI1f/YIlmNRInU2JNeeUco/IEnRit92pPdm2DFcaUBe94nzFTSZZvDaeZRhqiaAn ngobLYVaz8QToFManTARnzIE0oxKQ526U4Cc9RBJiAK5Dd6I9n96hzpu1ldEvZ7kATgC 3fU5zKPR1A7UoCWr30YHOFaqWJdiCGHZgrKXTLBL2+HJ39r5mGPQ1dReCKn8wwO1rHyx 1z1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505557; x=1685097557; 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=8cbPtOGCt4/DtgDNQOMqkazCwuM1SU58VR9lfEcSjFg=; b=QOW7DZZVqkAY2OrA1ZONzOY6iky5m/sYZeLa0dpxkNaWfi16xLAEMJt/RnlQqdJlep hl9REFD2ogChFQ0SxgCXy4N9HWQyoy7M5G5yTTwS67113IqBOMB8ha2wWj7PX/EUzMTY 6p7Q72Dx8Z7xZle+0dwJ/Yb8kjVJMVMn34w80Tft9NfYd+IWt3rH6ivkDZiCN5eqYXW5 gYRhgy3tbjzEV9mmTOmSupT3liftbusx4F/RSFHOc4IWVD0yHZrQOW5x1w5N1Z1JZhsI XRfThHB6x4sNArRkyPEesNtfDoYInTbqLOuMYBktR8mrkepfFpZxA8JJbIAeOnjmc1rM KQoA== X-Gm-Message-State: AC+VfDzSf2brP92nv3YviojzxYlhOCOPq7VOlRy445ajeZ3dqwSsw0Av xWWens4ksP/ebqKoihWW4nrJcw== X-Google-Smtp-Source: ACHHUZ695xuXPN+rCljXR2poYk1E3OjQlT/ZFI/r7mxqbIZoHJzM7aI0953MvDbwJsTqTCMl7eF9cg== X-Received: by 2002:a05:6a20:1606:b0:f6:5a75:7d44 with SMTP id l6-20020a056a20160600b000f65a757d44mr5898263pzj.12.1682505556742; Wed, 26 Apr 2023 03:39:16 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.39.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:39:16 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 32/48] hw/net/net_rx_pkt: Enforce alignment for eth_header Date: Wed, 26 Apr 2023 19:37:00 +0900 Message-Id: <20230426103716.26279-33-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::42b; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org eth_strip_vlan and eth_strip_vlan_ex refers to ehdr_buf as struct eth_header. Enforce alignment for the structure. Signed-off-by: Akihiko Odaki Reviewed-by: Sriram Yagnaraman --- hw/net/net_rx_pkt.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/hw/net/net_rx_pkt.c b/hw/net/net_rx_pkt.c index 6125a063d7..1de42b4f51 100644 --- a/hw/net/net_rx_pkt.c +++ b/hw/net/net_rx_pkt.c @@ -23,7 +23,10 @@ struct NetRxPkt { struct virtio_net_hdr virt_hdr; - uint8_t ehdr_buf[sizeof(struct eth_header) + sizeof(struct vlan_header)]; + struct { + struct eth_header eth; + struct vlan_header vlan; + } ehdr_buf; struct iovec *vec; uint16_t vec_len_total; uint16_t vec_len; @@ -89,7 +92,7 @@ net_rx_pkt_pull_data(struct NetRxPkt *pkt, if (pkt->ehdr_buf_len) { net_rx_pkt_iovec_realloc(pkt, iovcnt + 1); - pkt->vec[0].iov_base = pkt->ehdr_buf; + pkt->vec[0].iov_base = &pkt->ehdr_buf; pkt->vec[0].iov_len = pkt->ehdr_buf_len; pkt->tot_len = pllen + pkt->ehdr_buf_len; @@ -120,7 +123,7 @@ void net_rx_pkt_attach_iovec(struct NetRxPkt *pkt, assert(pkt); if (strip_vlan) { - pkt->ehdr_buf_len = eth_strip_vlan(iov, iovcnt, iovoff, pkt->ehdr_buf, + pkt->ehdr_buf_len = eth_strip_vlan(iov, iovcnt, iovoff, &pkt->ehdr_buf, &ploff, &tci); } else { pkt->ehdr_buf_len = 0; @@ -142,7 +145,7 @@ void net_rx_pkt_attach_iovec_ex(struct NetRxPkt *pkt, if (strip_vlan) { pkt->ehdr_buf_len = eth_strip_vlan_ex(iov, iovcnt, iovoff, vet, - pkt->ehdr_buf, + &pkt->ehdr_buf, &ploff, &tci); } else { pkt->ehdr_buf_len = 0; From patchwork Wed Apr 26 10:37:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1774000 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=G3pG/u88; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wQx73Q6z23vJ for ; Wed, 26 Apr 2023 20:41:45 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcYZ-0005q5-I1; Wed, 26 Apr 2023 06:39:27 -0400 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 1prcYX-0005Lv-7P for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:25 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcYT-0003Kb-IB for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:23 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-63b5465fc13so5519657b3a.3 for ; Wed, 26 Apr 2023 03:39:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505560; x=1685097560; 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=gJTd+zlMFrMjrpg4tmDtHb6BwlxiXhf67UG5csq1fUM=; b=G3pG/u88nBRNI4Dfq4kMsOwAhO3VOJwDEaSvALvTrudt9+xPnGqP26R2QFSccU0R29 KvHFuukxY1pLGjUxBHqNjWMU3qgmvjEzfkOJm7/ZI4DIcJeMinfTB893iAmz7byoSYZs wwjUqZw9A0qraYvZxthLdauW04A7ZNnvzdD9FjIQSULsXLFTD7OG8WikEm2iuNDPICrb uasw6HoZOCaq4lEPbrizigEnJOGv+9V4fkQ4MCeEvmN0l6j3sIzNtBR1JH2xTvldcSdi AICCL+dThh8teeytlSMZsljXN5ElN1+dRUoIwIXq8I1WyiiRKLE7yGvvBsQzQSas6Lfo q1zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505560; x=1685097560; 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=gJTd+zlMFrMjrpg4tmDtHb6BwlxiXhf67UG5csq1fUM=; b=b5/3w/ScbIKjleiBofnCCD9bLKPLcNbBKP5eJLMYsqzfZCmLFkCuFYn46mC8hYmqAY g/mSy0y0FvlMiOECQwm6opY5rRJdm3Qc3qW9NhDhxI1s601ql6mBjdPTf6bv4vkU9D5f VmV9kGpGHRwUVS0TrnlxML4oBSdgVF2tgx3WLMBg2BteO57TxIY4Kwx2RTwfexNm94tx ZzKEWma9cwn+7rTJkgu/f5de8XmWvcu2rGB9Cs6WYj1ZatnV1zDRl+t/vP1nyC+g7MUK LBh3oDaXxOOv/rC4xt6d4sgNrbxKXiJhM8j1nOUAl2mqEaHDMtV5VykV9y0xjrRwUS7B gWVg== X-Gm-Message-State: AAQBX9e98EMmNuQiwjSOftTooy6iUcLwE+PBcKFyLj8Fy5ST558ywM9x gfb3cIr0ZbSZj0KgXkX+mUF+TQ== X-Google-Smtp-Source: AKy350bEgAUnxtRaoAOnLLEOYu/WUAgo3MAsPWtjI+7x7PWsDsmsI1YvOcZ63T56OLKQPEfceEVMow== X-Received: by 2002:a05:6a20:d906:b0:ef:bd:38 with SMTP id jd6-20020a056a20d90600b000ef00bd0038mr22643268pzb.55.1682505560381; Wed, 26 Apr 2023 03:39:20 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.39.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:39:19 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 33/48] tests/qtest/libqos/igb: Set GPIE.Multiple_MSIX Date: Wed, 26 Apr 2023 19:37:01 +0900 Message-Id: <20230426103716.26279-34-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::431; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x431.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org GPIE.Multiple_MSIX is not set by default, and needs to be set to get interrupts from multiple MSI-X vectors. Signed-off-by: Akihiko Odaki Reviewed-by: Sriram Yagnaraman --- tests/qtest/libqos/igb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qtest/libqos/igb.c b/tests/qtest/libqos/igb.c index 12fb531bf0..a603468beb 100644 --- a/tests/qtest/libqos/igb.c +++ b/tests/qtest/libqos/igb.c @@ -114,6 +114,7 @@ static void igb_pci_start_hw(QOSGraphObject *obj) e1000e_macreg_write(&d->e1000e, E1000_RCTL, E1000_RCTL_EN); /* Enable all interrupts */ + e1000e_macreg_write(&d->e1000e, E1000_GPIE, E1000_GPIE_MSIX_MODE); e1000e_macreg_write(&d->e1000e, E1000_IMS, 0xFFFFFFFF); e1000e_macreg_write(&d->e1000e, E1000_EIMS, 0xFFFFFFFF); From patchwork Wed Apr 26 10:37:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1774004 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=oV0zU1VM; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wSq4GvBz23vF for ; Wed, 26 Apr 2023 20:43:23 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcYb-00068J-Cl; Wed, 26 Apr 2023 06:39:29 -0400 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 1prcYY-0005i4-IS for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:26 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcYX-0003Kp-1V for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:26 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-63b5c830d5eso5531482b3a.2 for ; Wed, 26 Apr 2023 03:39:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505564; x=1685097564; 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=YYGEusVh9zHqlKsubKM+jw8dRcawh8Vbu1NCV6xm7qc=; b=oV0zU1VMvPH/GhURMTAdNtasYylovaXV31q8LZanPPTAuAFU9kAS8TN47oGgPQXnWH BjVVvFhQ3EJWAliOUReD7HBK4torHn7ftUcKk7M+YchiVvrqWu3XrFnoz/NnQPKpY8r8 rmM9VxqFNOBdAO2Vk/Kwoyvp6lvYH8D1QQQE0t4QC0Tfjv+P9jbg0z1D0COjeiMhTZLE Esl0k4PLR/5BJzgLonk8Kuhtdg8Jo5XQyN08B4gQH+X/uGAnqLnvEbiZKJEkpEYofh/t SH4njK2Svfs2CmbkXaXu91uL6kc7VpfMXAbvVuJ9/JCyWA74KlUO+XeWVCPeJ3RWRgKJ 63oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505564; x=1685097564; 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=YYGEusVh9zHqlKsubKM+jw8dRcawh8Vbu1NCV6xm7qc=; b=DMHdEmENPBZHoaBuVqiDC1M1E1QHwjGSsAAlWR/cu8LXyXx+ecOWtup3ifJE0ya5H5 r4eGLqFRUuDQBENl6mLZW8DHWbFJ9Co7ZP2mBDWwhYy0z8IRMEhmKqH8+Rk4ENXhXpFf 8ukBdtsyxTr8hbRTK+IRhk/ky6UpoRmgrofFdgLST71HpK7CRd/BNUx2aDabsEj/CmwA 9uzVOwe6PBiHM4erDAM0QkqtuByrZ/1684J52JkADrOm35YGucxEf5plwdzZN9tiACoB GYZkjdVX4he2+R0QjIi8g3gELjkdKvSCKDgT3ABtPU1kaCc9Fh2dqT4T2rD+N1hwEYbK nzRA== X-Gm-Message-State: AAQBX9e2uSDXhqmthRsSH+tgx5LWyqiMcx6q3xb2hbEgqcrFxVjffBw9 AgJXCv6VZFkiTdE7YtKKoY5hZw== X-Google-Smtp-Source: AKy350a+ws/M7LYf93qTWMZ7E/3BdUr6/tCEVkMqcCcfHt0SHFAZdsqK8T49MFQHCtSxrW6KEYWjlw== X-Received: by 2002:a05:6a20:9150:b0:f4:4ff5:11ab with SMTP id x16-20020a056a20915000b000f44ff511abmr13922652pzc.58.1682505563959; Wed, 26 Apr 2023 03:39:23 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.39.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:39:23 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 34/48] igb: Implement MSI-X single vector mode Date: Wed, 26 Apr 2023 19:37:02 +0900 Message-Id: <20230426103716.26279-35-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::42c; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Akihiko Odaki Reviewed-by: Sriram Yagnaraman --- hw/net/igb_core.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index c954369964..6d55b43fb4 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -1873,7 +1873,7 @@ igb_update_interrupt_state(IGBCore *core) icr = core->mac[ICR] & core->mac[IMS]; - if (msix_enabled(core->owner)) { + if (core->mac[GPIE] & E1000_GPIE_MSIX_MODE) { if (icr) { causes = 0; if (icr & E1000_ICR_DRSTA) { @@ -1908,7 +1908,12 @@ igb_update_interrupt_state(IGBCore *core) trace_e1000e_irq_pending_interrupts(core->mac[ICR] & core->mac[IMS], core->mac[ICR], core->mac[IMS]); - if (msi_enabled(core->owner)) { + if (msix_enabled(core->owner)) { + if (icr) { + trace_e1000e_irq_msix_notify_vec(0); + msix_notify(core->owner, 0); + } + } else if (msi_enabled(core->owner)) { if (icr) { msi_notify(core->owner, 0); } From patchwork Wed Apr 26 10:37:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773998 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=cNKNcsgf; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wQn6FbQz23vJ for ; Wed, 26 Apr 2023 20:41:37 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcYd-0006SV-DO; Wed, 26 Apr 2023 06:39:31 -0400 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 1prcYc-0006K1-I3 for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:30 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcYa-0003LP-J1 for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:30 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-63b4960b015so5530101b3a.3 for ; Wed, 26 Apr 2023 03:39:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505567; x=1685097567; 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=bJRayCsOMhTmAlO0+FOFmMcdEqB6FQTUEfx99JEjow8=; b=cNKNcsgfyKPBx22DHSpNN5SY/y34wFJt4Hegai5FE8Te4q1FaSmaroA2tuMRpLFR4k Xv2i8MSMzmvDqa0gmN/NQ2z5sT4iWteVS4RjYWFaIk7z27MBcAXlO1kJr4qf+WHYdp1q PdOE+z0Ya3Hu5y8TEmJ7N+NrvjQU1l7kVAZmXVORwdktmIYjWQYEtXNmuwjH9tkbQtf7 Q+VBW9Bg6eekK3mvQPBtf5PoFtm9A2qFdnn1Z3gTQxJlsw1W/GNkjrq0JGYrCbLett8U wWroN3YuEEgWRUkcNhBAm84F7A6eDZ4RsnNadPOrwbyKRXeAHx4IgUc7LXYxQgNf9w3v jcFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505567; x=1685097567; 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=bJRayCsOMhTmAlO0+FOFmMcdEqB6FQTUEfx99JEjow8=; b=ACn1BuF1VsnDMdlh5y0G/YJiCJbYfI4CQ6KYL1P7ZY0s0ytqWjwNad1eiICm4GrC4J VbzwYi1lrUVQpzT+krqb6HdcBj2ZKW+Ifvqp0m83DubVZRtAIEexs1IESsNCqVp8j/4v jaIdB2YE2lpNiETTQNs8/na+e/CgxV9582JwL8uO6HmIufDA3Va+SLCP7o/w/PihjCxX X61XbvyaC00WjLLHQzuR0jawieBFu1N+mXUviIzw/c5bS33vvOTVAWMSWpygHdOzZpeW 8jmYz6qV+LaYoJFIQ6W7NyRRrfxBj913cZkhnnNGo3gCEeO/FGLMk/nH1dmvEgA0ZidQ 9YlQ== X-Gm-Message-State: AAQBX9cddG3TFaLhgz22eIsqKZ4KG7Ss8VOp7ofsnXIiPfnP6k3GzPAC vORi7y/SlLN7Vf9BqcFKLApYzdOvr2qEAZI/cXI= X-Google-Smtp-Source: AKy350YrSHmDr3LP5/9U7Q64RxFzCg1y4RQsg/mHZcmQ0GbiuDz2dZWo+M4LXxtIK4ZTooreimHadA== X-Received: by 2002:a05:6a20:8697:b0:f2:5a2:c04c with SMTP id k23-20020a056a20869700b000f205a2c04cmr17771392pze.6.1682505567450; Wed, 26 Apr 2023 03:39:27 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.39.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:39:27 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 35/48] igb: Use UDP for RSS hash Date: Wed, 26 Apr 2023 19:37:03 +0900 Message-Id: <20230426103716.26279-36-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::42f; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org e1000e does not support using UDP for RSS hash, but igb does. Signed-off-by: Akihiko Odaki Reviewed-by: Sriram Yagnaraman --- hw/net/igb_regs.h | 3 +++ hw/net/igb_core.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/hw/net/igb_regs.h b/hw/net/igb_regs.h index eb995d8b2e..e6ac26dc0e 100644 --- a/hw/net/igb_regs.h +++ b/hw/net/igb_regs.h @@ -659,6 +659,9 @@ union e1000_adv_rx_desc { #define E1000_RSS_QUEUE(reta, hash) (E1000_RETA_VAL(reta, hash) & 0x0F) +#define E1000_MRQ_RSS_TYPE_IPV4UDP 7 +#define E1000_MRQ_RSS_TYPE_IPV6UDP 8 + #define E1000_STATUS_IOV_MODE 0x00040000 #define E1000_STATUS_NUM_VFS_SHIFT 14 diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index 6d55b43fb4..41a2e5bf7b 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -287,6 +287,11 @@ igb_rss_get_hash_type(IGBCore *core, struct NetRxPkt *pkt) return E1000_MRQ_RSS_TYPE_IPV4TCP; } + if (l4hdr_proto == ETH_L4_HDR_PROTO_UDP && + (core->mac[MRQC] & E1000_MRQC_RSS_FIELD_IPV4_UDP)) { + return E1000_MRQ_RSS_TYPE_IPV4UDP; + } + if (E1000_MRQC_EN_IPV4(core->mac[MRQC])) { return E1000_MRQ_RSS_TYPE_IPV4; } @@ -322,6 +327,11 @@ igb_rss_get_hash_type(IGBCore *core, struct NetRxPkt *pkt) return E1000_MRQ_RSS_TYPE_IPV6TCPEX; } + if (l4hdr_proto == ETH_L4_HDR_PROTO_UDP && + (core->mac[MRQC] & E1000_MRQC_RSS_FIELD_IPV6_UDP)) { + return E1000_MRQ_RSS_TYPE_IPV6UDP; + } + if (E1000_MRQC_EN_IPV6EX(core->mac[MRQC])) { return E1000_MRQ_RSS_TYPE_IPV6EX; } @@ -360,6 +370,12 @@ igb_rss_calc_hash(IGBCore *core, struct NetRxPkt *pkt, E1000E_RSSInfo *info) case E1000_MRQ_RSS_TYPE_IPV6EX: type = NetPktRssIpV6Ex; break; + case E1000_MRQ_RSS_TYPE_IPV4UDP: + type = NetPktRssIpV4Udp; + break; + case E1000_MRQ_RSS_TYPE_IPV6UDP: + type = NetPktRssIpV6Udp; + break; default: assert(false); return 0; From patchwork Wed Apr 26 10:37:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773984 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=F43CKyYE; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wNm5L9Rz23vG for ; Wed, 26 Apr 2023 20:39:52 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcYi-00071j-KQ; Wed, 26 Apr 2023 06:39:36 -0400 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 1prcYg-0006tR-F6 for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:34 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcYe-0003Lp-GB for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:34 -0400 Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-517bdd9957dso5032334a12.1 for ; Wed, 26 Apr 2023 03:39:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505571; x=1685097571; 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=i1h2gNCPzKCVe4nkC9x4aEZNkMw7e5kJQrpSFW0kAms=; b=F43CKyYEZ8xqL3Phz+qEc7J17mjQv0+b7+AFF1htJdGZ7QOrf288YHo5NxEM0rvFA0 U9rKy0tBX9AH3POf41qsKm2drYeLUSRiffvyNg0KViIJ//l7zU2H2mEEvBFBPl/mqf7s 4+r6a7LG/0e0uteoQY/ynaVviB7/n5+b3vsEzRaEHrzcbGxcPCNDwNaf0OncI0GZq3zW +7ag/46BrQ0IsiLjhZfsCPRcxz7kt050HuW3GvCtojoMFOsgmf3T6NKzUdMZf4UrjPje DAT+MSUWU0PWWyI8zEL/ZWa0FD5iLSoujmXaJRN8xb87HBCO+3SdkiM7JQVukoKBpuzb 0Hwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505571; x=1685097571; 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=i1h2gNCPzKCVe4nkC9x4aEZNkMw7e5kJQrpSFW0kAms=; b=P6rk87B66sKZCFDmXS7jrUERsuiH3mt49EAJI5lxf/90C63rfO/q5wsmliahrU2oaV kSVtwPp76eS0wX1U84xDzbaN12LJugTS+UPeyZr6VVb6m+QNHLXptkCSgVFCdTe++m2/ +EiFXkMTjMXsMmohebfUhs+PPqNQqR9mXGhyGMr1fqVlKEtgP7icYL+YNmTHO17Hdxkv bCfrzRehxwLhj+S4WC/W4lBuh6x+bwZDhhK9sYXKD7elWBvYOXGiTn6lraux7KZh7V2F vAyu0hNmilmbnUNdD9zckjMRTgU7g592cUlKkhDj9iHG7yzRaPnXlDdblczqlNJI5Ptf wY1A== X-Gm-Message-State: AAQBX9dKVTqxw2cmh5XwaazOaOjBKU1MEyN+XITtqMMOcfl6nyhm697g mGkY/5eTfMkNJ1M7cTdHm+HNOA== X-Google-Smtp-Source: AKy350bOOMWM15NThxM+zxuxlyYYvNSnT1uazupEyXWjMLUn/NHOZkmD6nPv9f46AiD9x0vfYa7MMQ== X-Received: by 2002:a17:90b:81:b0:247:3895:e416 with SMTP id bb1-20020a17090b008100b002473895e416mr19916238pjb.16.1682505570977; Wed, 26 Apr 2023 03:39:30 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.39.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:39:30 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 36/48] igb: Implement Rx SCTP CSO Date: Wed, 26 Apr 2023 19:37:04 +0900 Message-Id: <20230426103716.26279-37-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::534; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x534.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Akihiko Odaki Reviewed-by: Sriram Yagnaraman --- hw/net/igb_regs.h | 1 + include/net/eth.h | 4 ++- include/qemu/crc32c.h | 1 + hw/net/e1000e_core.c | 5 ++++ hw/net/igb_core.c | 15 +++++++++- hw/net/net_rx_pkt.c | 64 +++++++++++++++++++++++++++++++++++-------- net/eth.c | 4 +++ util/crc32c.c | 8 ++++++ 8 files changed, 89 insertions(+), 13 deletions(-) diff --git a/hw/net/igb_regs.h b/hw/net/igb_regs.h index e6ac26dc0e..4b4ebd3369 100644 --- a/hw/net/igb_regs.h +++ b/hw/net/igb_regs.h @@ -670,6 +670,7 @@ union e1000_adv_rx_desc { #define E1000_ADVRXD_PKT_IP6 BIT(6) #define E1000_ADVRXD_PKT_TCP BIT(8) #define E1000_ADVRXD_PKT_UDP BIT(9) +#define E1000_ADVRXD_PKT_SCTP BIT(10) static inline uint8_t igb_ivar_entry_rx(uint8_t i) { diff --git a/include/net/eth.h b/include/net/eth.h index 048e434685..75e7f1551c 100644 --- a/include/net/eth.h +++ b/include/net/eth.h @@ -224,6 +224,7 @@ struct tcp_hdr { #define IP_HEADER_VERSION_6 (6) #define IP_PROTO_TCP (6) #define IP_PROTO_UDP (17) +#define IP_PROTO_SCTP (132) #define IPTOS_ECN_MASK 0x03 #define IPTOS_ECN(x) ((x) & IPTOS_ECN_MASK) #define IPTOS_ECN_CE 0x03 @@ -379,7 +380,8 @@ typedef struct eth_ip4_hdr_info_st { typedef enum EthL4HdrProto { ETH_L4_HDR_PROTO_INVALID, ETH_L4_HDR_PROTO_TCP, - ETH_L4_HDR_PROTO_UDP + ETH_L4_HDR_PROTO_UDP, + ETH_L4_HDR_PROTO_SCTP } EthL4HdrProto; typedef struct eth_l4_hdr_info_st { diff --git a/include/qemu/crc32c.h b/include/qemu/crc32c.h index 5b78884c38..88b4d2b3b3 100644 --- a/include/qemu/crc32c.h +++ b/include/qemu/crc32c.h @@ -30,5 +30,6 @@ uint32_t crc32c(uint32_t crc, const uint8_t *data, unsigned int length); +uint32_t iov_crc32c(uint32_t crc, const struct iovec *iov, size_t iov_cnt); #endif diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c index aea70b74d9..0b939ff5a3 100644 --- a/hw/net/e1000e_core.c +++ b/hw/net/e1000e_core.c @@ -1114,6 +1114,11 @@ e1000e_verify_csum_in_sw(E1000ECore *core, return; } + if (l4hdr_proto != ETH_L4_HDR_PROTO_TCP && + l4hdr_proto != ETH_L4_HDR_PROTO_UDP) { + return; + } + if (!net_rx_pkt_validate_l4_csum(pkt, &csum_valid)) { trace_e1000e_rx_metadata_l4_csum_validation_failed(); return; diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index 41a2e5bf7b..95d46d6e6d 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -1220,7 +1220,7 @@ igb_build_rx_metadata(IGBCore *core, uint16_t *vlan_tag) { struct virtio_net_hdr *vhdr; - bool hasip4, hasip6; + bool hasip4, hasip6, csum_valid; EthL4HdrProto l4hdr_proto; *status_flags = E1000_RXD_STAT_DD; @@ -1280,6 +1280,10 @@ igb_build_rx_metadata(IGBCore *core, *pkt_info |= E1000_ADVRXD_PKT_UDP; break; + case ETH_L4_HDR_PROTO_SCTP: + *pkt_info |= E1000_ADVRXD_PKT_SCTP; + break; + default: break; } @@ -1312,6 +1316,15 @@ igb_build_rx_metadata(IGBCore *core, if (igb_rx_l4_cso_enabled(core)) { switch (l4hdr_proto) { + case ETH_L4_HDR_PROTO_SCTP: + if (!net_rx_pkt_validate_l4_csum(pkt, &csum_valid)) { + trace_e1000e_rx_metadata_l4_csum_validation_failed(); + goto func_exit; + } + if (!csum_valid) { + *status_flags |= E1000_RXDEXT_STATERR_TCPE; + } + /* fall through */ case ETH_L4_HDR_PROTO_TCP: *status_flags |= E1000_RXD_STAT_TCPCS; break; diff --git a/hw/net/net_rx_pkt.c b/hw/net/net_rx_pkt.c index 1de42b4f51..3575c8b9f9 100644 --- a/hw/net/net_rx_pkt.c +++ b/hw/net/net_rx_pkt.c @@ -16,6 +16,7 @@ */ #include "qemu/osdep.h" +#include "qemu/crc32c.h" #include "trace.h" #include "net_rx_pkt.h" #include "net/checksum.h" @@ -554,32 +555,73 @@ _net_rx_pkt_calc_l4_csum(struct NetRxPkt *pkt) return csum; } -bool net_rx_pkt_validate_l4_csum(struct NetRxPkt *pkt, bool *csum_valid) +static bool +_net_rx_pkt_validate_sctp_sum(struct NetRxPkt *pkt) { - uint16_t csum; + size_t csum_off; + size_t off = pkt->l4hdr_off; + size_t vec_len = pkt->vec_len; + struct iovec *vec; + uint32_t calculated = 0; + uint32_t original; + bool valid; - trace_net_rx_pkt_l4_csum_validate_entry(); + for (vec = pkt->vec; vec->iov_len < off; vec++) { + off -= vec->iov_len; + vec_len--; + } - if (pkt->l4hdr_info.proto != ETH_L4_HDR_PROTO_TCP && - pkt->l4hdr_info.proto != ETH_L4_HDR_PROTO_UDP) { - trace_net_rx_pkt_l4_csum_validate_not_xxp(); + csum_off = off + 8; + + if (!iov_to_buf(vec, vec_len, csum_off, &original, sizeof(original))) { return false; } - if (pkt->l4hdr_info.proto == ETH_L4_HDR_PROTO_UDP && - pkt->l4hdr_info.hdr.udp.uh_sum == 0) { - trace_net_rx_pkt_l4_csum_validate_udp_with_no_checksum(); + if (!iov_from_buf(vec, vec_len, csum_off, + &calculated, sizeof(calculated))) { return false; } + calculated = crc32c(0xffffffff, + (uint8_t *)vec->iov_base + off, vec->iov_len - off); + calculated = iov_crc32c(calculated ^ 0xffffffff, vec + 1, vec_len - 1); + valid = calculated == le32_to_cpu(original); + iov_from_buf(vec, vec_len, csum_off, &original, sizeof(original)); + + return valid; +} + +bool net_rx_pkt_validate_l4_csum(struct NetRxPkt *pkt, bool *csum_valid) +{ + uint32_t csum; + + trace_net_rx_pkt_l4_csum_validate_entry(); + if (pkt->hasip4 && pkt->ip4hdr_info.fragment) { trace_net_rx_pkt_l4_csum_validate_ip4_fragment(); return false; } - csum = _net_rx_pkt_calc_l4_csum(pkt); + switch (pkt->l4hdr_info.proto) { + case ETH_L4_HDR_PROTO_UDP: + if (pkt->l4hdr_info.hdr.udp.uh_sum == 0) { + trace_net_rx_pkt_l4_csum_validate_udp_with_no_checksum(); + return false; + } + /* fall through */ + case ETH_L4_HDR_PROTO_TCP: + csum = _net_rx_pkt_calc_l4_csum(pkt); + *csum_valid = ((csum == 0) || (csum == 0xFFFF)); + break; + + case ETH_L4_HDR_PROTO_SCTP: + *csum_valid = _net_rx_pkt_validate_sctp_sum(pkt); + break; - *csum_valid = ((csum == 0) || (csum == 0xFFFF)); + default: + trace_net_rx_pkt_l4_csum_validate_not_xxp(); + return false; + } trace_net_rx_pkt_l4_csum_validate_csum(*csum_valid); diff --git a/net/eth.c b/net/eth.c index 5307978486..7f02aea010 100644 --- a/net/eth.c +++ b/net/eth.c @@ -211,6 +211,10 @@ void eth_get_protocols(const struct iovec *iov, size_t iovcnt, size_t iovoff, *l5hdr_off = *l4hdr_off + sizeof(l4hdr_info->hdr.udp); } break; + + case IP_PROTO_SCTP: + l4hdr_info->proto = ETH_L4_HDR_PROTO_SCTP; + break; } } diff --git a/util/crc32c.c b/util/crc32c.c index 762657d853..ea7f345de8 100644 --- a/util/crc32c.c +++ b/util/crc32c.c @@ -113,3 +113,11 @@ uint32_t crc32c(uint32_t crc, const uint8_t *data, unsigned int length) return crc^0xffffffff; } +uint32_t iov_crc32c(uint32_t crc, const struct iovec *iov, size_t iov_cnt) +{ + while (iov_cnt--) { + crc = crc32c(crc, iov->iov_base, iov->iov_len) ^ 0xffffffff; + iov++; + } + return crc ^ 0xffffffff; +} From patchwork Wed Apr 26 10:37:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1774010 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=fhcfhEGX; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wV73gmNz23vF for ; Wed, 26 Apr 2023 20:44:31 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcYl-0007GO-Q5; Wed, 26 Apr 2023 06:39:39 -0400 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 1prcYj-00077a-AP for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:37 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcYh-0003ME-Fp for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:36 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-63b57c49c4cso5721228b3a.3 for ; Wed, 26 Apr 2023 03:39:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505574; x=1685097574; 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=6M3XBA2ZnKRrmKvfDf9nkh3S989gOSnRI0c+3tpxFkM=; b=fhcfhEGXjLN3fUHeV13/EvfqIgcOkJt4fx5xSdGIpgC+qvRYNwR7yxWmT9TmZ/HRoZ jmdEFKatI1KFbzutUKSv4snfwage8GIf2JOOD0od9LwnZ632JEB9eFeKCaRU2q8cobUk 4vwywpWLCR0B5Cm9C2SOX1DGcIAc2svR1CFCC9m0kzUt+QIYA4jOCdPWwd0BEh2qYF6M zAfIe/rRnUaN9Kb6PxVOQ9ZuuRLTeuM5mFui4vSxE08eNErcuoMuFM5HfFwy6bWVTPSd E/dRwQGDrOB0DH9fvo1LYL9aPX2cCsX0I3jsHDgnO8kaZV8b5plN8VRNQ5yMIOZoOapU f9DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505574; x=1685097574; 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=6M3XBA2ZnKRrmKvfDf9nkh3S989gOSnRI0c+3tpxFkM=; b=elD0BeXjLigewM/yaqB3PxVzqjEfnv7VEDcJUrueJCiPlwiNKrLsii/vum2rb1uAIl waLRaEc6M2rbb+uVnOf7cPILiRFFuNRB9Ky7JlJ6amfQ67+VN8oS04UjBWAfx/auglWq eM7EPeHHPh3S0UvIx+PY9DqnQ38o4jMg0EchJaLRklxipiUNPY92etjlWpzJCDL9uckM YfThwaHHx9c3dbtjcv5+nCvwC5HbZvIVZw+aW3WwnKm92x4++SoR3WF+tUqgopQFLvrb lHxflYWfSfJoAuI5+hF6FeLweiaT5P1fifbSrZFyhLnSJeza2NTMtfIcjdYjiOA2LWh9 pZzw== X-Gm-Message-State: AC+VfDzMEYY9pV8zOSrY7Wyw+cZ7r4qXhUEPjjGYtqAA7VcFfGqj1B05 UXTMIvB/6/tnCdNfCSc/nQ7Nxg== X-Google-Smtp-Source: ACHHUZ4H1sXD5GINkuDhYMOY/Wr+7tW5euIIiXvWxermW3XRYhaWw/BobTE1H0GTZfuiUsS5MNjrrg== X-Received: by 2002:a05:6a21:587:b0:f4:7cbd:c236 with SMTP id lw7-20020a056a21058700b000f47cbdc236mr154187pzb.54.1682505574445; Wed, 26 Apr 2023 03:39:34 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.39.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:39:34 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 37/48] igb: Implement Tx SCTP CSO Date: Wed, 26 Apr 2023 19:37:05 +0900 Message-Id: <20230426103716.26279-38-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::434; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x434.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Akihiko Odaki Reviewed-by: Sriram Yagnaraman --- hw/net/net_tx_pkt.h | 8 ++++++++ hw/net/igb_core.c | 12 +++++++----- hw/net/net_tx_pkt.c | 18 ++++++++++++++++++ 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/hw/net/net_tx_pkt.h b/hw/net/net_tx_pkt.h index 4d7233e975..0a716e74a5 100644 --- a/hw/net/net_tx_pkt.h +++ b/hw/net/net_tx_pkt.h @@ -116,6 +116,14 @@ void net_tx_pkt_update_ip_checksums(struct NetTxPkt *pkt); */ void net_tx_pkt_update_ip_hdr_checksum(struct NetTxPkt *pkt); +/** + * Calculate the SCTP checksum. + * + * @pkt: packet + * + */ +bool net_tx_pkt_update_sctp_checksum(struct NetTxPkt *pkt); + /** * get length of all populated data. * diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index 95d46d6e6d..5eacf1cd8c 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -440,8 +440,9 @@ igb_tx_insert_vlan(IGBCore *core, uint16_t qn, struct igb_tx *tx, static bool igb_setup_tx_offloads(IGBCore *core, struct igb_tx *tx) { + uint32_t idx = (tx->first_olinfo_status >> 4) & 1; + if (tx->first_cmd_type_len & E1000_ADVTXD_DCMD_TSE) { - uint32_t idx = (tx->first_olinfo_status >> 4) & 1; uint32_t mss = tx->ctx[idx].mss_l4len_idx >> E1000_ADVTXD_MSS_SHIFT; if (!net_tx_pkt_build_vheader(tx->tx_pkt, true, true, mss)) { return false; @@ -452,10 +453,11 @@ igb_setup_tx_offloads(IGBCore *core, struct igb_tx *tx) return true; } - if (tx->first_olinfo_status & E1000_ADVTXD_POTS_TXSM) { - if (!net_tx_pkt_build_vheader(tx->tx_pkt, false, true, 0)) { - return false; - } + if ((tx->first_olinfo_status & E1000_ADVTXD_POTS_TXSM) && + !((tx->ctx[idx].type_tucmd_mlhl & E1000_ADVTXD_TUCMD_L4T_SCTP) ? + net_tx_pkt_update_sctp_checksum(tx->tx_pkt) : + net_tx_pkt_build_vheader(tx->tx_pkt, false, true, 0))) { + return false; } if (tx->first_olinfo_status & E1000_ADVTXD_POTS_IXSM) { diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c index af8f77a3f0..2e5f58b3c9 100644 --- a/hw/net/net_tx_pkt.c +++ b/hw/net/net_tx_pkt.c @@ -16,6 +16,7 @@ */ #include "qemu/osdep.h" +#include "qemu/crc32c.h" #include "net/eth.h" #include "net/checksum.h" #include "net/tap.h" @@ -135,6 +136,23 @@ void net_tx_pkt_update_ip_checksums(struct NetTxPkt *pkt) pkt->virt_hdr.csum_offset, &csum, sizeof(csum)); } +bool net_tx_pkt_update_sctp_checksum(struct NetTxPkt *pkt) +{ + uint32_t csum = 0; + struct iovec *pl_start_frag = pkt->vec + NET_TX_PKT_PL_START_FRAG; + + if (iov_from_buf(pl_start_frag, pkt->payload_frags, 8, &csum, sizeof(csum)) < sizeof(csum)) { + return false; + } + + csum = cpu_to_le32(iov_crc32c(0xffffffff, pl_start_frag, pkt->payload_frags)); + if (iov_from_buf(pl_start_frag, pkt->payload_frags, 8, &csum, sizeof(csum)) < sizeof(csum)) { + return false; + } + + return true; +} + static void net_tx_pkt_calculate_hdr_len(struct NetTxPkt *pkt) { pkt->hdr_len = pkt->vec[NET_TX_PKT_L2HDR_FRAG].iov_len + From patchwork Wed Apr 26 10:37:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1774016 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=TjTr1FIq; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wW43hCJz23vP for ; Wed, 26 Apr 2023 20:45:19 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcYr-0007Tf-6j; Wed, 26 Apr 2023 06:39:45 -0400 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 1prcYm-0007IJ-CJ for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:40 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcYk-0003JH-Gl for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:40 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-63b70f0b320so8917472b3a.1 for ; Wed, 26 Apr 2023 03:39:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505578; x=1685097578; 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=FRcI7GOaBHVeMkmbzMSkbbAEWkpolE03IrvdD81fzko=; b=TjTr1FIqc91dkKpgVLQ/yMtVlBu7EXhTtWy6GgopqxrJrXvmWt3eVC1N2DhdhVR396 rGzSle/oTRnoqB2C+tGGVG9JOjG7hcOm673kM9cPhuxszaet4q/NIPWUWPnkCASd5VDb nNOAPAJlYPOjfRcXf0V6rTYflyeuw7mqYZz10RLJi/QWoRrL2HZ1dowBj7aRdeMqSFst C0S95ZNI31jYFvBT5pvi+ZOUh7qy2M5+7xi622ysr78Uklp+lxlSb2M7oNwvu49bgD+A C5zpu9LBt355fJPFvkgrDp7pDe9qZ1j8qzgKq/poqjtuDVkeNzV24H4iutozNv90Eh2T AoTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505578; x=1685097578; 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=FRcI7GOaBHVeMkmbzMSkbbAEWkpolE03IrvdD81fzko=; b=D9NX7M/LSb4g0R2ksn38mqhfjWsZz5VVYjp2sP2TJQEA00H4IJHauzhyX9vY0Opasr BYq6LFqFby3yDafn4uu36vqgTA3B/1zAFfemx4xYgmhsUl29n6IaFhMHGm17YxrgXEVQ 7vN362OjFWL2JRmYx+l76a6Zd3rClTwOLaVV/fDSBMBgewZIISnOmEkwkaIWM4fpHGgw Jqnn9nsv0qHQQzrwFRIGE/MVoY5B85gHUnjK+et29A9uBo1Nn9AlU9csc7ftR/PHYl48 3V4EiOBo1GWcOFyRNSQ72ZmOKWOj5BzBtXYhLRqAkGYRCdbr3ndNIAa3gYVQEPkm70av ZBnw== X-Gm-Message-State: AAQBX9dOHDvnbFEqY2UEPJuefEBf0dEd5yITuMIRteYSEWTRQzDc6jOD 3JXNJUJH4kq8yjX68LvTzXj2mg== X-Google-Smtp-Source: AKy350ZC9DAS3E+/riFBQ3PCaMfDwdF/blKYO7UZhoGwTXOe4LiI0/Y53XSt/TL0n0yCbajxUC782g== X-Received: by 2002:a05:6a20:8e26:b0:f1:1af5:75fe with SMTP id y38-20020a056a208e2600b000f11af575femr24329700pzj.36.1682505577860; Wed, 26 Apr 2023 03:39:37 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.39.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:39:37 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 38/48] igb: Strip the second VLAN tag for extended VLAN Date: Wed, 26 Apr 2023 19:37:06 +0900 Message-Id: <20230426103716.26279-39-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::42e; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Akihiko Odaki --- hw/net/net_rx_pkt.h | 19 ++++++++-------- include/net/eth.h | 4 ++-- hw/net/e1000e_core.c | 3 ++- hw/net/igb_core.c | 14 ++++++++++-- hw/net/net_rx_pkt.c | 15 +++++-------- net/eth.c | 52 ++++++++++++++++++++++++++++---------------- 6 files changed, 65 insertions(+), 42 deletions(-) diff --git a/hw/net/net_rx_pkt.h b/hw/net/net_rx_pkt.h index ce8dbdb284..55ec67a1a7 100644 --- a/hw/net/net_rx_pkt.h +++ b/hw/net/net_rx_pkt.h @@ -223,18 +223,19 @@ void net_rx_pkt_attach_iovec(struct NetRxPkt *pkt, /** * attach scatter-gather data to rx packet * -* @pkt: packet -* @iov: received data scatter-gather list -* @iovcnt number of elements in iov -* @iovoff data start offset in the iov -* @strip_vlan: should the module strip vlan from data -* @vet: VLAN tag Ethernet type +* @pkt: packet +* @iov: received data scatter-gather list +* @iovcnt: number of elements in iov +* @iovoff: data start offset in the iov +* @strip_vlan_index: index of Q tag if it is to be stripped. negative otherwise. +* @vet: VLAN tag Ethernet type +* @vet_ext: outer VLAN tag Ethernet type * */ void net_rx_pkt_attach_iovec_ex(struct NetRxPkt *pkt, - const struct iovec *iov, int iovcnt, - size_t iovoff, bool strip_vlan, - uint16_t vet); + const struct iovec *iov, int iovcnt, + size_t iovoff, int strip_vlan_index, + uint16_t vet, uint16_t vet_ext); /** * attach data to rx packet diff --git a/include/net/eth.h b/include/net/eth.h index 75e7f1551c..3b80b6e07f 100644 --- a/include/net/eth.h +++ b/include/net/eth.h @@ -347,8 +347,8 @@ eth_strip_vlan(const struct iovec *iov, int iovcnt, size_t iovoff, uint16_t *payload_offset, uint16_t *tci); size_t -eth_strip_vlan_ex(const struct iovec *iov, int iovcnt, size_t iovoff, - uint16_t vet, void *new_ehdr_buf, +eth_strip_vlan_ex(const struct iovec *iov, int iovcnt, size_t iovoff, int index, + uint16_t vet, uint16_t vet_ext, void *new_ehdr_buf, uint16_t *payload_offset, uint16_t *tci); uint16_t diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c index 0b939ff5a3..d601386992 100644 --- a/hw/net/e1000e_core.c +++ b/hw/net/e1000e_core.c @@ -1711,7 +1711,8 @@ e1000e_receive_internal(E1000ECore *core, const struct iovec *iov, int iovcnt, } net_rx_pkt_attach_iovec_ex(core->rx_pkt, iov, iovcnt, iov_ofs, - e1000x_vlan_enabled(core->mac), core->mac[VET]); + e1000x_vlan_enabled(core->mac) ? 0 : -1, + core->mac[VET], 0); e1000e_rss_parse_packet(core, core->rx_pkt, &rss_info); e1000e_rx_ring_init(core, &rxr, rss_info.queue); diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index 5eacf1cd8c..688eaf7319 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -1611,6 +1611,7 @@ igb_receive_internal(IGBCore *core, const struct iovec *iov, int iovcnt, E1000E_RxRing rxr; E1000E_RSSInfo rss_info; size_t total_size; + int strip_vlan_index; int i; trace_e1000e_rx_receive_iov(iovcnt); @@ -1672,9 +1673,18 @@ igb_receive_internal(IGBCore *core, const struct iovec *iov, int iovcnt, igb_rx_ring_init(core, &rxr, i); + if (!igb_rx_strip_vlan(core, rxr.i)) { + strip_vlan_index = -1; + } else if (core->mac[CTRL_EXT] & BIT(26)) { + strip_vlan_index = 1; + } else { + strip_vlan_index = 0; + } + net_rx_pkt_attach_iovec_ex(core->rx_pkt, iov, iovcnt, iov_ofs, - igb_rx_strip_vlan(core, rxr.i), - core->mac[VET] & 0xffff); + strip_vlan_index, + core->mac[VET] & 0xffff, + core->mac[VET] >> 16); total_size = net_rx_pkt_get_total_len(core->rx_pkt) + e1000x_fcs_len(core->mac); diff --git a/hw/net/net_rx_pkt.c b/hw/net/net_rx_pkt.c index 3575c8b9f9..32e5f3f9cf 100644 --- a/hw/net/net_rx_pkt.c +++ b/hw/net/net_rx_pkt.c @@ -137,20 +137,17 @@ void net_rx_pkt_attach_iovec(struct NetRxPkt *pkt, void net_rx_pkt_attach_iovec_ex(struct NetRxPkt *pkt, const struct iovec *iov, int iovcnt, - size_t iovoff, bool strip_vlan, - uint16_t vet) + size_t iovoff, int strip_vlan_index, + uint16_t vet, uint16_t vet_ext) { uint16_t tci = 0; uint16_t ploff = iovoff; assert(pkt); - if (strip_vlan) { - pkt->ehdr_buf_len = eth_strip_vlan_ex(iov, iovcnt, iovoff, vet, - &pkt->ehdr_buf, - &ploff, &tci); - } else { - pkt->ehdr_buf_len = 0; - } + pkt->ehdr_buf_len = eth_strip_vlan_ex(iov, iovcnt, iovoff, + strip_vlan_index, vet, vet_ext, + &pkt->ehdr_buf, + &ploff, &tci); pkt->tci = tci; diff --git a/net/eth.c b/net/eth.c index 7f02aea010..649e66bb1f 100644 --- a/net/eth.c +++ b/net/eth.c @@ -269,36 +269,50 @@ eth_strip_vlan(const struct iovec *iov, int iovcnt, size_t iovoff, } size_t -eth_strip_vlan_ex(const struct iovec *iov, int iovcnt, size_t iovoff, - uint16_t vet, void *new_ehdr_buf, +eth_strip_vlan_ex(const struct iovec *iov, int iovcnt, size_t iovoff, int index, + uint16_t vet, uint16_t vet_ext, void *new_ehdr_buf, uint16_t *payload_offset, uint16_t *tci) { struct vlan_header vlan_hdr; - struct eth_header *new_ehdr = (struct eth_header *) new_ehdr_buf; - - size_t copied = iov_to_buf(iov, iovcnt, iovoff, - new_ehdr, sizeof(*new_ehdr)); - - if (copied < sizeof(*new_ehdr)) { - return 0; - } + uint16_t *new_ehdr_proto; + size_t new_ehdr_size; + size_t copied; - if (be16_to_cpu(new_ehdr->h_proto) == vet) { - copied = iov_to_buf(iov, iovcnt, iovoff + sizeof(*new_ehdr), - &vlan_hdr, sizeof(vlan_hdr)); + switch (index) { + case 0: + new_ehdr_proto = &PKT_GET_ETH_HDR(new_ehdr_buf)->h_proto; + new_ehdr_size = sizeof(struct eth_header); + copied = iov_to_buf(iov, iovcnt, iovoff, new_ehdr_buf, new_ehdr_size); + break; - if (copied < sizeof(vlan_hdr)) { + case 1: + new_ehdr_proto = &PKT_GET_VLAN_HDR(new_ehdr_buf)->h_proto; + new_ehdr_size = sizeof(struct eth_header) + sizeof(struct vlan_header); + copied = iov_to_buf(iov, iovcnt, iovoff, new_ehdr_buf, new_ehdr_size); + if (be16_to_cpu(PKT_GET_ETH_HDR(new_ehdr_buf)->h_proto) != vet_ext) { return 0; } + break; - new_ehdr->h_proto = vlan_hdr.h_proto; + default: + return 0; + } - *tci = be16_to_cpu(vlan_hdr.h_tci); - *payload_offset = iovoff + sizeof(*new_ehdr) + sizeof(vlan_hdr); - return sizeof(struct eth_header); + if (copied < new_ehdr_size || be16_to_cpu(*new_ehdr_proto) != vet) { + return 0; + } + + copied = iov_to_buf(iov, iovcnt, iovoff + new_ehdr_size, + &vlan_hdr, sizeof(vlan_hdr)); + if (copied < sizeof(vlan_hdr)) { + return 0; } - return 0; + *new_ehdr_proto = vlan_hdr.h_proto; + *payload_offset = iovoff + new_ehdr_size + sizeof(vlan_hdr); + *tci = be16_to_cpu(vlan_hdr.h_tci); + + return new_ehdr_size; } void From patchwork Wed Apr 26 10:37:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1774012 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=DkFfpWDB; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wW14wc5z23vF for ; Wed, 26 Apr 2023 20:45:17 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcYs-0007fj-KA; Wed, 26 Apr 2023 06:39:46 -0400 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 1prcYq-0007Th-2F for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:44 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcYo-0003Ms-Ft for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:43 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-63b620188aeso8233728b3a.0 for ; Wed, 26 Apr 2023 03:39:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505581; x=1685097581; 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=hPvTkBCxnRmVQmgIKjTmgQ+aBaL4yZpdSUSmce9k6qw=; b=DkFfpWDB7JQG0jtLSNmOVVg5vO/dZzSvmx7VIMOexEKrLdylD1pEUHBqQK2Zk8VdAl riixcrcbjy8m7eaqDJFc9nXFXPDoa1IIFhCQjUdHKz3OjCHGLbycn6jUOuSvNxQTkyze R1hHMr/WPkXrgTtEyQfurtRBJtIjkgjg30pkIwcSLF133Xay1gsZPLiMiIp2tcVT2ytA WV1KEoyEAc6Vzsqzsp/uW49sQ/N061l94+g7CL6PVHhREuWXc3vBnglcs+EmOxt24EdN JWwGN2ivkHVi8i8YfW1cVIgsjyK/NVFvUPxD8Nmuz0T7PGmuI/QK9INsoNPkvVZJeo/V OCqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505581; x=1685097581; 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=hPvTkBCxnRmVQmgIKjTmgQ+aBaL4yZpdSUSmce9k6qw=; b=O+IXjAf5iqqYvgiOyYBDKzHgbtkIXrbybxhdbKS0pY8ehlJo0pXk/0ClqSXzeICMyU fqVePtZj4WDMgli9GjQGkJUIfKVb12oPmFWtL1rSswaPcoB/6VD3x4G3vWdSeNo6iWkB aLCppQwc/JIQyhjVK+bSRDG/bTJL+8KjqmPOkt3HLPIpRboDm9VWgNI7LYChsvMna3AO NXTxCTDacAl/k5TGj6avt6WZA8b+Wak/SyFE3AfL/O//RtDoZdoyhxoJPYXtaj0U2ua6 uO7yu4Suo81GC1da4XKhd5o9LVO9n2XU/iIipmAZdtt4Bz+6GLau2LLFBSUezblwZO7B 2x4g== X-Gm-Message-State: AAQBX9dOQEAIv6JrB++TRrngEcxNL9LQ5X41uQjETOCPsrA0JM3bP5/O gR4uY/PsRtrVYJB6cWI264qbSg== X-Google-Smtp-Source: AKy350ayHnR9egIme6CpwqDYS2g+jGW0SaLz1+gDVhg6RhhsS1NHSBPBVaEyVs2WVJMDnqJVS0vlaA== X-Received: by 2002:a05:6a00:1305:b0:63d:a0d:6fa1 with SMTP id j5-20020a056a00130500b0063d0a0d6fa1mr23963010pfu.21.1682505581321; Wed, 26 Apr 2023 03:39:41 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.39.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:39:41 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 39/48] igb: Filter with the second VLAN tag for extended VLAN Date: Wed, 26 Apr 2023 19:37:07 +0900 Message-Id: <20230426103716.26279-40-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::42c; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Akihiko Odaki --- hw/net/igb_core.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index 688eaf7319..5345f57031 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -69,7 +69,7 @@ typedef struct IGBTxPktVmdqCallbackContext { typedef struct L2Header { struct eth_header eth; - struct vlan_header vlan; + struct vlan_header vlan[2]; } L2Header; static ssize_t @@ -1001,7 +1001,7 @@ static uint16_t igb_receive_assign(IGBCore *core, const L2Header *l2_header, uint32_t f, ra[2], *macp, rctl = core->mac[RCTL]; uint16_t queues = 0; uint16_t oversized = 0; - uint16_t vid = be16_to_cpu(l2_header->vlan.h_tci) & VLAN_VID_MASK; + size_t vlan_num = 0; int i; memset(rss_info, 0, sizeof(E1000E_RSSInfo)); @@ -1010,8 +1010,19 @@ static uint16_t igb_receive_assign(IGBCore *core, const L2Header *l2_header, *external_tx = true; } - if (e1000x_is_vlan_packet(ehdr, core->mac[VET] & 0xffff) && - !e1000x_rx_vlan_filter(core->mac, PKT_GET_VLAN_HDR(ehdr))) { + if (core->mac[CTRL_EXT] & BIT(26)) { + if (be16_to_cpu(ehdr->h_proto) == core->mac[VET] >> 16 && + be16_to_cpu(l2_header->vlan[0].h_proto) == (core->mac[VET] & 0xffff)) { + vlan_num = 2; + } + } else { + if (be16_to_cpu(ehdr->h_proto) == (core->mac[VET] & 0xffff)) { + vlan_num = 1; + } + } + + if (vlan_num && + !e1000x_rx_vlan_filter(core->mac, l2_header->vlan + vlan_num - 1)) { return queues; } @@ -1065,7 +1076,9 @@ static uint16_t igb_receive_assign(IGBCore *core, const L2Header *l2_header, if (e1000x_vlan_rx_filter_enabled(core->mac)) { uint16_t mask = 0; - if (e1000x_is_vlan_packet(ehdr, core->mac[VET] & 0xffff)) { + if (vlan_num) { + uint16_t vid = be16_to_cpu(l2_header->vlan[vlan_num - 1].h_tci) & VLAN_VID_MASK; + for (i = 0; i < E1000_VLVF_ARRAY_SIZE; i++) { if ((core->mac[VLVF0 + i] & E1000_VLVF_VLANID_MASK) == vid && (core->mac[VLVF0 + i] & E1000_VLVF_VLANID_ENABLE)) { From patchwork Wed Apr 26 10:37:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1774023 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=3iDTZgnO; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wYS4VGkz23vK for ; Wed, 26 Apr 2023 20:47:24 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcYv-000825-3s; Wed, 26 Apr 2023 06:39:49 -0400 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 1prcYt-0007pt-Tj for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:47 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcYs-0003Ob-0r for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:47 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-63b4e5fdb1eso8218308b3a.1 for ; Wed, 26 Apr 2023 03:39:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505585; x=1685097585; 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=Oa4nI3WEIewnmzpuEcGtrA2tT88NXiwX772ys8tKjw0=; b=3iDTZgnOZy0Eq7zrqWGlRLrNUsqa3wp6cKwXEDxwAWZ0pQKPK6Bhu1kU+56fLQXggZ fFuGS5UjyAztpTqSx7zIZZVpif42MLB48Gi8SmQc1M0ZNO9GEwvQQgZx6yGNG/plgfj5 wFp8TpYrbDNFoDuiEhGmFKDam2kTIqYk88KXkfdtBYU26xHgDT6qVxPfNhhUwzuflCF+ dggECrxi7KY1Jds6/+HIjGGetkAbwOIydZelZ7LgZZ9P6GftRujDyR6mSsAxK1YwTRo7 n8d/pboRzy5kvyAu+xnt1LYzLaW9HFl8DsAzSzBRQqAGzme/GBN8W/TL05jdLhOkVPaR LGpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505585; x=1685097585; 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=Oa4nI3WEIewnmzpuEcGtrA2tT88NXiwX772ys8tKjw0=; b=OdrxIhR18fCScNavmHs5bgwm38PItLyZ8FwpsQYZkT0VPrH/rzDe8G5sj23RI1IIzN 7m2orGYJx/q+B0WgZr54EvP0V+hcAhjEG66sUPgtRjmlP457FpugKORDr9bhUui0Q/3p Ndzuih8c6ODsm7LE1McH5WGIAc6wxVxGwQNXpvsgztHufrQEgm7lF0ATZ0IYLATFNTY7 djopgEgYydoKbG6DDy1baYWmIMHoPVF0eo1nf3w+ZI7qWLogVrepi7C6wNvBA13wRrMZ 1+JCDM1xfEhmD2yo/SbpEA0e09OuGgSVPvcT3/qFAqHelxPvEGfh59tWgrrxiKfSdCre vKEg== X-Gm-Message-State: AAQBX9eUYZmfsmbs/E4ncKMxMXbWuakr+WVQQ/9PXwXxt3ynWyXgM5Z0 tm6EHRjLlpsI2vsJQievmWk4khKvbMeTLZcBoTE= X-Google-Smtp-Source: AKy350at+IzE96FQQVPicDiym5XKyfbMKN7eMPoxR03J9V25RGlOLbtdtLEzh7iy3Gp1fEs12mIQaw== X-Received: by 2002:a05:6a00:c8a:b0:626:cc72:51ac with SMTP id a10-20020a056a000c8a00b00626cc7251acmr28283131pfv.30.1682505584841; Wed, 26 Apr 2023 03:39:44 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.39.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:39:44 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 40/48] igb: Implement igb-specific oversize check Date: Wed, 26 Apr 2023 19:37:08 +0900 Message-Id: <20230426103716.26279-41-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::42c; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org igb has a configurable size limit for LPE, and uses different limits depending on whether the packet is treated as a VLAN packet. Signed-off-by: Akihiko Odaki Reviewed-by: Sriram Yagnaraman --- hw/net/igb_core.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index 5345f57031..c04ec01117 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -980,16 +980,13 @@ igb_rx_l4_cso_enabled(IGBCore *core) return !!(core->mac[RXCSUM] & E1000_RXCSUM_TUOFLD); } -static bool -igb_rx_is_oversized(IGBCore *core, uint16_t qn, size_t size) +static bool igb_rx_is_oversized(IGBCore *core, const struct eth_header *ehdr, + size_t size, size_t vlan_num, + bool lpe, uint16_t rlpml) { - uint16_t pool = qn % IGB_NUM_VM_POOLS; - bool lpe = !!(core->mac[VMOLR0 + pool] & E1000_VMOLR_LPE); - int max_ethernet_lpe_size = - core->mac[VMOLR0 + pool] & E1000_VMOLR_RLPML_MASK; - int max_ethernet_vlan_size = 1522; - - return size > (lpe ? max_ethernet_lpe_size : max_ethernet_vlan_size); + size_t vlan_header_size = sizeof(struct vlan_header) * vlan_num; + size_t header_size = sizeof(struct eth_header) + vlan_header_size; + return lpe ? size + ETH_FCS_LEN > rlpml : size > header_size + ETH_MTU; } static uint16_t igb_receive_assign(IGBCore *core, const L2Header *l2_header, @@ -1002,6 +999,8 @@ static uint16_t igb_receive_assign(IGBCore *core, const L2Header *l2_header, uint16_t queues = 0; uint16_t oversized = 0; size_t vlan_num = 0; + bool lpe; + uint16_t rlpml; int i; memset(rss_info, 0, sizeof(E1000E_RSSInfo)); @@ -1021,6 +1020,14 @@ static uint16_t igb_receive_assign(IGBCore *core, const L2Header *l2_header, } } + lpe = !!(core->mac[RCTL] & E1000_RCTL_LPE); + rlpml = core->mac[RLPML]; + if (!(core->mac[RCTL] & E1000_RCTL_SBP) && + igb_rx_is_oversized(core, ehdr, size, vlan_num, lpe, rlpml)) { + trace_e1000x_rx_oversized(size); + return queues; + } + if (vlan_num && !e1000x_rx_vlan_filter(core->mac, l2_header->vlan + vlan_num - 1)) { return queues; @@ -1106,7 +1113,11 @@ static uint16_t igb_receive_assign(IGBCore *core, const L2Header *l2_header, queues &= core->mac[VFRE]; if (queues) { for (i = 0; i < IGB_NUM_VM_POOLS; i++) { - if ((queues & BIT(i)) && igb_rx_is_oversized(core, i, size)) { + lpe = !!(core->mac[VMOLR0 + i] & E1000_VMOLR_LPE); + rlpml = core->mac[VMOLR0 + i] & E1000_VMOLR_RLPML_MASK; + if ((queues & BIT(i)) && + igb_rx_is_oversized(core, ehdr, size, vlan_num, + lpe, rlpml)) { oversized |= BIT(i); } } @@ -1662,11 +1673,6 @@ igb_receive_internal(IGBCore *core, const struct iovec *iov, int iovcnt, iov_to_buf(iov, iovcnt, iov_ofs, &buf, sizeof(buf.l2_header)); } - /* Discard oversized packets if !LPE and !SBP. */ - if (e1000x_is_oversized(core->mac, size)) { - return orig_size; - } - net_rx_pkt_set_packet_type(core->rx_pkt, get_eth_packet_type(&buf.l2_header.eth)); net_rx_pkt_set_protocols(core->rx_pkt, iov, iovcnt, iov_ofs); From patchwork Wed Apr 26 10:37:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1774013 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=YwwFM1tA; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wW23vL1z23vK for ; Wed, 26 Apr 2023 20:45:18 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcYz-0008TF-2d; Wed, 26 Apr 2023 06:39:53 -0400 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 1prcYy-0008Nc-36 for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:52 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcYv-0003P8-NH for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:51 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1a68f2345c5so54927895ad.2 for ; Wed, 26 Apr 2023 03:39:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505588; x=1685097588; 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=ASLXW4ydloOjXWWcUTqGMHsBOsLVGYm+ZRTvavT0Kz8=; b=YwwFM1tAOt8xIMG89bdN+j3O0xWTBuSXfoWXjdFT9n6LRgL9Ci30Gn2BOkwbaaMO1s rH9a/8DcOukGuY+d6s48ganw0kS9qiY++zZIuKvClt734t1xox+mzS8OhQ2lAypA+Epn bHLladzsc7IMKrDaw0uznPZhvkFI7SgcROgVVlWxONcs7anjf5ywwzoPCs1Nr3RDRE95 vhh5Kn2khShrFm4xzNQ3T+TVYbyIivhVPAPuYE8azAiiR2FMSBTLIXhCYngLBVLdETrn 8M0WvmtZd6yxps2Y3JxUFS7FZ7KiR5Zv4zdZOfI5MQWpaSR95/4ZK31NzP7x0jhdIO1h Vprw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505588; x=1685097588; 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=ASLXW4ydloOjXWWcUTqGMHsBOsLVGYm+ZRTvavT0Kz8=; b=baqdbzumXsx887Z9QFQHiFFIUjHIUCwfJn0VI8m+au55qthG85FD7reT3gbBrov+Te oaSFLYnwintm6Kzh0oKZ2qqZ/O3/jP7amFvFv826uWSO5SoJ3TKXGh5bFEC+CcRPVM/V 8VZYB9ZDgvQZtoB3AvwRrt2dKrlu6+xaembXMnyEOgkCr2QDJfNvcB0Rw16uLh3x+8vz aQRa9fz/Fz7VLHxonidWuSPhjjmolzoTvTFnjxt+w7tnYtLgnCSLOM3qL9tKszrfaU43 xsxhY8FdrEgpsI//TWNYX4mQCrc++KoqzSrH+37PqvmsLhcAFPMqPzlbDARqm27sibh7 VodQ== X-Gm-Message-State: AAQBX9cloysHAdOK8HbNWYnbIB26+SpaN6mvmbSXP7UAZH1Us3U+qMtm ud30q10t1FmoHVwEnwr3aa8urg== X-Google-Smtp-Source: AKy350ZwV7c1G1GQwxzytXWgoQ1xWsTPE5pgJlAXaUuoJzOD5eIMCZ0Dg4R6V7KqxtE5geHYYPEF8A== X-Received: by 2002:a17:903:40cb:b0:1a6:9e53:950e with SMTP id t11-20020a17090340cb00b001a69e53950emr20670215pld.41.1682505588344; Wed, 26 Apr 2023 03:39:48 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.39.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:39:48 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 41/48] igb: Implement Rx PTP2 timestamp Date: Wed, 26 Apr 2023 19:37:09 +0900 Message-Id: <20230426103716.26279-42-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::635; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x635.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Akihiko Odaki --- hw/net/igb_common.h | 16 +++--- hw/net/igb_regs.h | 23 ++++++++ hw/net/igb_core.c | 129 ++++++++++++++++++++++++++++++++------------ 3 files changed, 127 insertions(+), 41 deletions(-) diff --git a/hw/net/igb_common.h b/hw/net/igb_common.h index f2a9065791..5c261ba9d3 100644 --- a/hw/net/igb_common.h +++ b/hw/net/igb_common.h @@ -51,7 +51,7 @@ defreg_indexeda(x, 0), defreg_indexeda(x, 1), \ defreg_indexeda(x, 2), defreg_indexeda(x, 3) -#define defregv(x) defreg_indexed(x, 0), defreg_indexed(x, 1), \ +#define defreg8(x) defreg_indexed(x, 0), defreg_indexed(x, 1), \ defreg_indexed(x, 2), defreg_indexed(x, 3), \ defreg_indexed(x, 4), defreg_indexed(x, 5), \ defreg_indexed(x, 6), defreg_indexed(x, 7) @@ -122,6 +122,8 @@ enum { defreg(EICS), defreg(EIMS), defreg(EIMC), defreg(EIAM), defreg(EICR), defreg(IVAR_MISC), defreg(GPIE), + defreg(TSYNCRXCFG), defreg8(ETQF), + defreg(RXPBS), defregd(RDBAL), defregd(RDBAH), defregd(RDLEN), defregd(SRRCTL), defregd(RDH), defregd(RDT), defregd(RXDCTL), defregd(RXCTL), defregd(RQDPC), defreg(RA2), @@ -133,15 +135,15 @@ enum { defreg(VT_CTL), - defregv(P2VMAILBOX), defregv(V2PMAILBOX), defreg(MBVFICR), defreg(MBVFIMR), + defreg8(P2VMAILBOX), defreg8(V2PMAILBOX), defreg(MBVFICR), defreg(MBVFIMR), defreg(VFLRE), defreg(VFRE), defreg(VFTE), defreg(WVBR), defreg(QDE), defreg(DTXSWC), defreg_indexed(VLVF, 0), - defregv(VMOLR), defreg(RPLOLR), defregv(VMBMEM), defregv(VMVIR), + defreg8(VMOLR), defreg(RPLOLR), defreg8(VMBMEM), defreg8(VMVIR), - defregv(PVTCTRL), defregv(PVTEICS), defregv(PVTEIMS), defregv(PVTEIMC), - defregv(PVTEIAC), defregv(PVTEIAM), defregv(PVTEICR), defregv(PVFGPRC), - defregv(PVFGPTC), defregv(PVFGORC), defregv(PVFGOTC), defregv(PVFMPRC), - defregv(PVFGPRLBC), defregv(PVFGPTLBC), defregv(PVFGORLBC), defregv(PVFGOTLBC), + defreg8(PVTCTRL), defreg8(PVTEICS), defreg8(PVTEIMS), defreg8(PVTEIMC), + defreg8(PVTEIAC), defreg8(PVTEIAM), defreg8(PVTEICR), defreg8(PVFGPRC), + defreg8(PVFGPTC), defreg8(PVFGORC), defreg8(PVFGOTC), defreg8(PVFMPRC), + defreg8(PVFGPRLBC), defreg8(PVFGPTLBC), defreg8(PVFGORLBC), defreg8(PVFGOTLBC), defreg(MTA_A), diff --git a/hw/net/igb_regs.h b/hw/net/igb_regs.h index 4b4ebd3369..894705599d 100644 --- a/hw/net/igb_regs.h +++ b/hw/net/igb_regs.h @@ -210,6 +210,15 @@ union e1000_adv_rx_desc { #define E1000_DCA_TXCTRL_CPUID_SHIFT 24 /* Tx CPUID now in the last byte */ #define E1000_DCA_RXCTRL_CPUID_SHIFT 24 /* Rx CPUID now in the last byte */ +/* ETQF register bit definitions */ +#define E1000_ETQF_FILTER_ENABLE BIT(26) +#define E1000_ETQF_1588 BIT(30) +#define E1000_ETQF_IMM_INT BIT(29) +#define E1000_ETQF_QUEUE_ENABLE BIT(31) +#define E1000_ETQF_QUEUE_SHIFT 16 +#define E1000_ETQF_QUEUE_MASK 0x00070000 +#define E1000_ETQF_ETYPE_MASK 0x0000FFFF + #define E1000_DTXSWC_MAC_SPOOF_MASK 0x000000FF /* Per VF MAC spoof control */ #define E1000_DTXSWC_VLAN_SPOOF_MASK 0x0000FF00 /* Per VF VLAN spoof control */ #define E1000_DTXSWC_LLE_MASK 0x00FF0000 /* Per VF Local LB enables */ @@ -384,6 +393,20 @@ union e1000_adv_rx_desc { #define E1000_FRTIMER 0x01048 /* Free Running Timer - RW */ #define E1000_FCRTV 0x02460 /* Flow Control Refresh Timer Value - RW */ +#define E1000_TSYNCRXCFG 0x05F50 /* Time Sync Rx Configuration - RW */ + +/* Filtering Registers */ +#define E1000_SAQF(_n) (0x5980 + 4 * (_n)) +#define E1000_DAQF(_n) (0x59A0 + 4 * (_n)) +#define E1000_SPQF(_n) (0x59C0 + 4 * (_n)) +#define E1000_FTQF(_n) (0x59E0 + 4 * (_n)) +#define E1000_SAQF0 E1000_SAQF(0) +#define E1000_DAQF0 E1000_DAQF(0) +#define E1000_SPQF0 E1000_SPQF(0) +#define E1000_FTQF0 E1000_FTQF(0) +#define E1000_SYNQF(_n) (0x055FC + (4 * (_n))) /* SYN Packet Queue Fltr */ +#define E1000_ETQF(_n) (0x05CB0 + (4 * (_n))) /* EType Queue Fltr */ + #define E1000_RQDPC(_n) (0x0C030 + ((_n) * 0x40)) #define E1000_RXPBS 0x02404 /* Rx Packet Buffer Size - RW */ diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index c04ec01117..e0433ae7cf 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -72,6 +72,24 @@ typedef struct L2Header { struct vlan_header vlan[2]; } L2Header; +typedef struct PTP2 { + uint8_t message_id_transport_specific; + uint8_t version_ptp; + uint16_t message_length; + uint8_t subdomain_number; + uint8_t reserved0; + uint16_t flags; + uint64_t correction; + uint8_t reserved1[5]; + uint8_t source_communication_technology; + uint32_t source_uuid_lo; + uint16_t source_uuid_hi; + uint16_t source_port_id; + uint16_t sequence_id; + uint8_t control; + uint8_t log_message_period; +} PTP2; + static ssize_t igb_receive_internal(IGBCore *core, const struct iovec *iov, int iovcnt, bool has_vnet, bool *external_tx); @@ -989,9 +1007,11 @@ static bool igb_rx_is_oversized(IGBCore *core, const struct eth_header *ehdr, return lpe ? size + ETH_FCS_LEN > rlpml : size > header_size + ETH_MTU; } -static uint16_t igb_receive_assign(IGBCore *core, const L2Header *l2_header, - size_t size, E1000E_RSSInfo *rss_info, - bool *external_tx) +static uint16_t igb_receive_assign(IGBCore *core, const struct iovec *iov, + size_t iovcnt, size_t iov_ofs, + const L2Header *l2_header, size_t size, + E1000E_RSSInfo *rss_info, + uint16_t *etqf, bool *ts, bool *external_tx) { static const int ta_shift[] = { 4, 3, 2, 0 }; const struct eth_header *ehdr = &l2_header->eth; @@ -999,11 +1019,13 @@ static uint16_t igb_receive_assign(IGBCore *core, const L2Header *l2_header, uint16_t queues = 0; uint16_t oversized = 0; size_t vlan_num = 0; + PTP2 ptp2; bool lpe; uint16_t rlpml; int i; memset(rss_info, 0, sizeof(E1000E_RSSInfo)); + *ts = false; if (external_tx) { *external_tx = true; @@ -1028,6 +1050,26 @@ static uint16_t igb_receive_assign(IGBCore *core, const L2Header *l2_header, return queues; } + for (*etqf = 0; *etqf < 8; (*etqf)++) { + if ((core->mac[ETQF0 + *etqf] & E1000_ETQF_FILTER_ENABLE) && + be16_to_cpu(ehdr->h_proto) == (core->mac[ETQF0 + *etqf] & E1000_ETQF_ETYPE_MASK)) { + if ((core->mac[ETQF0 + *etqf] & E1000_ETQF_1588) && + (core->mac[TSYNCRXCTL] & E1000_TSYNCRXCTL_ENABLED) && + !(core->mac[TSYNCRXCTL] & E1000_TSYNCRXCTL_VALID) && + iov_to_buf(iov, iovcnt, iov_ofs + ETH_HLEN, &ptp2, sizeof(ptp2)) >= sizeof(ptp2) && + (ptp2.version_ptp & 15) == 2 && + ptp2.message_id_transport_specific == ((core->mac[TSYNCRXCFG] >> 8) & 255)) { + e1000x_timestamp(core->mac, core->timadj, RXSTMPL, RXSTMPH); + *ts = true; + core->mac[TSYNCRXCTL] |= E1000_TSYNCRXCTL_VALID; + core->mac[RXSATRL] = le32_to_cpu(ptp2.source_uuid_lo); + core->mac[RXSATRH] = le16_to_cpu(ptp2.source_uuid_hi) | + (le16_to_cpu(ptp2.sequence_id) << 16); + } + break; + } + } + if (vlan_num && !e1000x_rx_vlan_filter(core->mac, l2_header->vlan + vlan_num - 1)) { return queues; @@ -1238,7 +1280,7 @@ static void igb_build_rx_metadata(IGBCore *core, struct NetRxPkt *pkt, bool is_eop, - const E1000E_RSSInfo *rss_info, + const E1000E_RSSInfo *rss_info, uint16_t etqf, bool ts, uint16_t *pkt_info, uint16_t *hdr_info, uint32_t *rss, uint32_t *status_flags, @@ -1289,29 +1331,33 @@ igb_build_rx_metadata(IGBCore *core, if (pkt_info) { *pkt_info = rss_info->enabled ? rss_info->type : 0; - if (hasip4) { - *pkt_info |= E1000_ADVRXD_PKT_IP4; - } + if (etqf < 8) { + *pkt_info |= BIT(11) | (etqf << 4); + } else { + if (hasip4) { + *pkt_info |= E1000_ADVRXD_PKT_IP4; + } - if (hasip6) { - *pkt_info |= E1000_ADVRXD_PKT_IP6; - } + if (hasip6) { + *pkt_info |= E1000_ADVRXD_PKT_IP6; + } - switch (l4hdr_proto) { - case ETH_L4_HDR_PROTO_TCP: - *pkt_info |= E1000_ADVRXD_PKT_TCP; - break; + switch (l4hdr_proto) { + case ETH_L4_HDR_PROTO_TCP: + *pkt_info |= E1000_ADVRXD_PKT_TCP; + break; - case ETH_L4_HDR_PROTO_UDP: - *pkt_info |= E1000_ADVRXD_PKT_UDP; - break; + case ETH_L4_HDR_PROTO_UDP: + *pkt_info |= E1000_ADVRXD_PKT_UDP; + break; - case ETH_L4_HDR_PROTO_SCTP: - *pkt_info |= E1000_ADVRXD_PKT_SCTP; - break; + case ETH_L4_HDR_PROTO_SCTP: + *pkt_info |= E1000_ADVRXD_PKT_SCTP; + break; - default: - break; + default: + break; + } } } @@ -1319,6 +1365,10 @@ igb_build_rx_metadata(IGBCore *core, *hdr_info = 0; } + if (ts) { + *status_flags |= BIT(16); + } + /* RX CSO information */ if (hasip6 && (core->mac[RFCTL] & E1000_RFCTL_IPV6_XSUM_DIS)) { trace_e1000e_rx_metadata_ipv6_sum_disabled(); @@ -1374,7 +1424,7 @@ func_exit: static inline void igb_write_lgcy_rx_descr(IGBCore *core, struct e1000_rx_desc *desc, struct NetRxPkt *pkt, - const E1000E_RSSInfo *rss_info, + const E1000E_RSSInfo *rss_info, uint16_t etqf, bool ts, uint16_t length) { uint32_t status_flags, rss; @@ -1385,7 +1435,7 @@ igb_write_lgcy_rx_descr(IGBCore *core, struct e1000_rx_desc *desc, desc->csum = 0; igb_build_rx_metadata(core, pkt, pkt != NULL, - rss_info, + rss_info, etqf, ts, NULL, NULL, &rss, &status_flags, &ip_id, &desc->special); @@ -1396,7 +1446,7 @@ igb_write_lgcy_rx_descr(IGBCore *core, struct e1000_rx_desc *desc, static inline void igb_write_adv_rx_descr(IGBCore *core, union e1000_adv_rx_desc *desc, struct NetRxPkt *pkt, - const E1000E_RSSInfo *rss_info, + const E1000E_RSSInfo *rss_info, uint16_t etqf, bool ts, uint16_t length) { memset(&desc->wb, 0, sizeof(desc->wb)); @@ -1404,7 +1454,7 @@ igb_write_adv_rx_descr(IGBCore *core, union e1000_adv_rx_desc *desc, desc->wb.upper.length = cpu_to_le16(length); igb_build_rx_metadata(core, pkt, pkt != NULL, - rss_info, + rss_info, etqf, ts, &desc->wb.lower.lo_dword.pkt_info, &desc->wb.lower.lo_dword.hdr_info, &desc->wb.lower.hi_dword.rss, @@ -1415,12 +1465,15 @@ igb_write_adv_rx_descr(IGBCore *core, union e1000_adv_rx_desc *desc, static inline void igb_write_rx_descr(IGBCore *core, union e1000_rx_desc_union *desc, -struct NetRxPkt *pkt, const E1000E_RSSInfo *rss_info, uint16_t length) + struct NetRxPkt *pkt, const E1000E_RSSInfo *rss_info, + uint16_t etqf, bool ts, uint16_t length) { if (igb_rx_use_legacy_descriptor(core)) { - igb_write_lgcy_rx_descr(core, &desc->legacy, pkt, rss_info, length); + igb_write_lgcy_rx_descr(core, &desc->legacy, pkt, rss_info, + etqf, ts, length); } else { - igb_write_adv_rx_descr(core, &desc->adv, pkt, rss_info, length); + igb_write_adv_rx_descr(core, &desc->adv, pkt, rss_info, + etqf, ts, length); } } @@ -1497,7 +1550,8 @@ igb_rx_descr_threshold_hit(IGBCore *core, const E1000E_RingInfo *rxi) static void igb_write_packet_to_guest(IGBCore *core, struct NetRxPkt *pkt, const E1000E_RxRing *rxr, - const E1000E_RSSInfo *rss_info) + const E1000E_RSSInfo *rss_info, + uint16_t etqf, bool ts) { PCIDevice *d; dma_addr_t base; @@ -1579,7 +1633,7 @@ igb_write_packet_to_guest(IGBCore *core, struct NetRxPkt *pkt, } igb_write_rx_descr(core, &desc, is_last ? core->rx_pkt : NULL, - rss_info, written); + rss_info, etqf, ts, written); igb_pci_dma_write_rx_desc(core, d, base, &desc, core->rx_desc_len); igb_ring_advance(core, rxi, core->rx_desc_len / E1000_MIN_RX_DESC_LEN); @@ -1634,6 +1688,8 @@ igb_receive_internal(IGBCore *core, const struct iovec *iov, int iovcnt, size_t iov_ofs = 0; E1000E_RxRing rxr; E1000E_RSSInfo rss_info; + uint16_t etqf; + bool ts; size_t total_size; int strip_vlan_index; int i; @@ -1677,8 +1733,9 @@ igb_receive_internal(IGBCore *core, const struct iovec *iov, int iovcnt, get_eth_packet_type(&buf.l2_header.eth)); net_rx_pkt_set_protocols(core->rx_pkt, iov, iovcnt, iov_ofs); - queues = igb_receive_assign(core, &buf.l2_header, size, - &rss_info, external_tx); + queues = igb_receive_assign(core, iov, iovcnt, iov_ofs, + &buf.l2_header, size, + &rss_info, &etqf, &ts, external_tx); if (!queues) { trace_e1000e_rx_flt_dropped(); return orig_size; @@ -1717,7 +1774,7 @@ igb_receive_internal(IGBCore *core, const struct iovec *iov, int iovcnt, causes |= E1000_ICR_RXDW; igb_rx_fix_l4_csum(core, core->rx_pkt); - igb_write_packet_to_guest(core, core->rx_pkt, &rxr, &rss_info); + igb_write_packet_to_guest(core, core->rx_pkt, &rxr, &rss_info, etqf, ts); /* Check if receive descriptor minimum threshold hit */ if (igb_rx_descr_threshold_hit(core, rxr.i)) { @@ -3305,6 +3362,8 @@ static const readops igb_macreg_readops[] = { [EIAM] = igb_mac_readreg, [IVAR0 ... IVAR0 + 7] = igb_mac_readreg, igb_getreg(IVAR_MISC), + igb_getreg(TSYNCRXCFG), + [ETQF0 ... ETQF0 + 7] = igb_mac_readreg, igb_getreg(VT_CTL), [P2VMAILBOX0 ... P2VMAILBOX7] = igb_mac_readreg, [V2PMAILBOX0 ... V2PMAILBOX7] = igb_mac_vfmailbox_read, @@ -3712,6 +3771,8 @@ static const writeops igb_macreg_writeops[] = { [EIMS] = igb_set_eims, [IVAR0 ... IVAR0 + 7] = igb_mac_writereg, igb_putreg(IVAR_MISC), + igb_putreg(TSYNCRXCFG), + [ETQF0 ... ETQF0 + 7] = igb_mac_writereg, igb_putreg(VT_CTL), [P2VMAILBOX0 ... P2VMAILBOX7] = igb_set_pfmailbox, [V2PMAILBOX0 ... V2PMAILBOX7] = igb_set_vfmailbox, From patchwork Wed Apr 26 10:37:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773991 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=z8mPbbwS; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wPM4sk7z23vF for ; Wed, 26 Apr 2023 20:40:23 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcZ2-0000bK-RI; Wed, 26 Apr 2023 06:39:56 -0400 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 1prcZ1-0000Rw-M0 for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:55 -0400 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 1prcYz-0003Pw-3S for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:54 -0400 Received: by mail-pj1-x102c.google.com with SMTP id 98e67ed59e1d1-247399d518dso4563578a91.0 for ; Wed, 26 Apr 2023 03:39:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505592; x=1685097592; 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=aJaHYb5ZBx6mBlkjO3CEFU89Jr/yyywaCiZzfHpn5xE=; b=z8mPbbwSC0TiY7hUVUuIeCn1oPLR0FD/IwYNd5Z9vzKZZZmwlfyjuSJqmH5WFAPrDf OjnD8A88yqsp78z8J5AR4kxDlCuTQs7Gl6cE30WcGmp+Tt3VeF85YNIj+TmTpkKGecXJ DP0ZPo6lLqHO9IWHfkChswXKNQ80klKLAJ1UQYte3HcygrJiXS3zCkAXBNBdd4nI5+MR C78OX7SasiHBlYP4ICrWZBUtee2YmPeDs2pYROVZOwHMAvvNcSxRNq1Gx3nv1A7j5iiO xyi3XRvuJuo2cDXlGfhMpABQh6dGuGG3qM+0xaGqqCp0gBo5OBsAA7FExiErR4u+0l8N 72sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505592; x=1685097592; 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=aJaHYb5ZBx6mBlkjO3CEFU89Jr/yyywaCiZzfHpn5xE=; b=Z4BDzVV5+xYIDeMV+adw3ppjnj4W8sB4GEw07T3TFrMs02B7caJSzla3uGROJwKZ0N xUb+HIFAouBTenRBx+pSQQL/rETha8NzJQlvPB4ExX0sISIal5T1ttQjBR1PwP2EhbpM MYcNdY4OEYykMWT+D3nEo2vqAzji/CrUHACnChFV5Zy6cohv21xBWN7e0fdSUEhk2OjH sBIoA0ipmB+1sRnv0MCy/+X2ewl7HqK1QN04v5PwwbijZFGCC/nUZai8a/pjAHpVhmsq h93PodgO02Gok31RMNt+497oWCijx1G5OnOi48gt/sicXq73BMfZ3FTiBW1tm26K8vQf NkwQ== X-Gm-Message-State: AAQBX9cO91LW2/hKuTVUm4u+fHfVGqcQqBPJAXy32ApU+boleEK9q2GU tfpSBCpWuKXh6FFyK3C+4Zx0KA== X-Google-Smtp-Source: AKy350ZHjs1QrRLgU6v9vUKDDUvDn1TsNnI/paeK13nX3PQWKMJFEpDx7GeS7g4UESRoW045j6RdyA== X-Received: by 2002:a17:90a:bd02:b0:23b:2f4a:57bb with SMTP id y2-20020a17090abd0200b0023b2f4a57bbmr20305000pjr.10.1682505591923; Wed, 26 Apr 2023 03:39:51 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.39.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:39:51 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 42/48] igb: Implement Tx timestamp Date: Wed, 26 Apr 2023 19:37:10 +0900 Message-Id: <20230426103716.26279-43-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::102c; envelope-from=akihiko.odaki@daynix.com; helo=mail-pj1-x102c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Akihiko Odaki Reviewed-by: Sriram Yagnaraman --- hw/net/igb_regs.h | 3 +++ hw/net/igb_core.c | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/hw/net/igb_regs.h b/hw/net/igb_regs.h index 894705599d..82ff195dfc 100644 --- a/hw/net/igb_regs.h +++ b/hw/net/igb_regs.h @@ -322,6 +322,9 @@ union e1000_adv_rx_desc { /* E1000_EITR_CNT_IGNR is only for 82576 and newer */ #define E1000_EITR_CNT_IGNR 0x80000000 /* Don't reset counters on write */ +#define E1000_TSYNCTXCTL_VALID 0x00000001 /* tx timestamp valid */ +#define E1000_TSYNCTXCTL_ENABLED 0x00000010 /* enable tx timestampping */ + /* PCI Express Control */ #define E1000_GCR_CMPL_TMOUT_MASK 0x0000F000 #define E1000_GCR_CMPL_TMOUT_10ms 0x00001000 diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index e0433ae7cf..57973c3ae4 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -659,6 +659,13 @@ igb_process_tx_desc(IGBCore *core, tx->ctx[idx].vlan_macip_lens >> IGB_TX_FLAGS_VLAN_SHIFT, !!(tx->first_cmd_type_len & E1000_TXD_CMD_VLE)); + if ((tx->first_cmd_type_len & E1000_ADVTXD_MAC_TSTAMP) && + (core->mac[TSYNCTXCTL] & E1000_TSYNCTXCTL_ENABLED) && + !(core->mac[TSYNCTXCTL] & E1000_TSYNCTXCTL_VALID)) { + core->mac[TSYNCTXCTL] |= E1000_TSYNCTXCTL_VALID; + e1000x_timestamp(core->mac, core->timadj, TXSTMPL, TXSTMPH); + } + if (igb_tx_pkt_send(core, tx, queue_index)) { igb_on_tx_done_update_stats(core, tx->tx_pkt, queue_index); } From patchwork Wed Apr 26 10:37:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1774014 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=SDl40OnA; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wW26wCQz23vL for ; Wed, 26 Apr 2023 20:45:18 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcZ6-00014z-TI; Wed, 26 Apr 2023 06:40:00 -0400 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 1prcZ4-0000rq-EN for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:58 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcZ2-0003Ms-8t for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:39:58 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-63b620188aeso8234018b3a.0 for ; Wed, 26 Apr 2023 03:39:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505595; x=1685097595; 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=hKSZKscJ+uVcqCex5fIKz0WGp5wTxDvKQEXe6J1ZMnU=; b=SDl40OnAfDz1L3ZrB513UAea48iXij40B0HSflgJ9QKGbgeAZvYF3YjQ0gP6aI1qDz U/qVj4kWfNHyUHs32Vdu4lH3zs2OBCDOpG/4JEqXbopSAyxL+kJ1h7i0sxDVWfqYyFX1 6vptGjQ9pkt+2IzBu9eV2wf5eg+U+AIB2Yi2BMWrudXXLGw862gMZ4tGXJifb9kMQW1D 3ytv0QzK/AlakMY1Fp2VIPjPMh6JjPV5hZQyQ1Z7KY9jaK4JdB/GDgpbnD8/3UKzzouY ZPv9dwwB6ZvNjwK98qdw9RbcnD7rhunMX/1+8trhXC0Jq5iND8cB1pbtDqpiDu1/2IEb ilHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505595; x=1685097595; 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=hKSZKscJ+uVcqCex5fIKz0WGp5wTxDvKQEXe6J1ZMnU=; b=Jgi0KNL1sA+k3kG3aXfD1cO3xelXgCTluCmoGk3TyGDD1iV3v6OApFj8gQqcLy6SuH CDi4ypxp9XKuQasl1uCWpGfhuQFopHvm62vEi5kEooANOYQ7K4cvzRSsDjNsl14mpPxT RFFnNV8lLuRyycErYlO6e3wfCYu6Fg9oiEu9A3OlQZ2eJOQ+EYAv1KJsLTQbKVkoRCBV mHF+strusCgzh9Tf2OMSvK174Dm9kLaqrr7S5NP/SOOmLJoUQIMjqZmJ91oh3JVggpkF R5AMXcg8ZXOGB4OXgTMd9rJpcBRQ+JSBuOfOws6/ZpkgpJRaeOfm+NF0MPDoTnbI4i// w9Ww== X-Gm-Message-State: AAQBX9eT1b028mu/K9J0P+5tFatJi8y/qYJ/PpVXXcLh0nYWtfCpB3LT j4NIZc207EakUVJxDHTuixqqRw== X-Google-Smtp-Source: AKy350bdIx3DLBmLGBBHyeJSZvtVU6N6lzlXRq8IifN0e99HbStR7L8VeMfFQkbLgW1lLyUmtHH0Ow== X-Received: by 2002:a05:6a21:900c:b0:f2:9918:eb73 with SMTP id tq12-20020a056a21900c00b000f29918eb73mr15791440pzb.46.1682505595478; Wed, 26 Apr 2023 03:39:55 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.39.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:39:55 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 43/48] e1000e: Notify only new interrupts Date: Wed, 26 Apr 2023 19:37:11 +0900 Message-Id: <20230426103716.26279-44-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::42c; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org In MSI-X mode, if there are interrupts already notified but not cleared and a new interrupt arrives, e1000e incorrectly notifies the notified ones again along with the new one. To fix this issue, replace e1000e_update_interrupt_state() with two new functions: e1000e_raise_interrupts() and e1000e_lower_interrupts(). These functions don't only raise or lower interrupts, but it also performs register writes which updates the interrupt state. Before it performs a register write, these function determines the interrupts already raised, and compares with the interrupts raised after the register write to determine the interrupts to notify. The introduction of these functions made tracepoints which assumes that the caller of e1000e_update_interrupt_state() performs register writes obsolete. These tracepoints are now removed, and alternative ones are added to the new functions. Signed-off-by: Akihiko Odaki --- hw/net/e1000e_core.h | 2 - hw/net/e1000e_core.c | 153 +++++++++++++++++++------------------------ hw/net/trace-events | 2 + 3 files changed, 69 insertions(+), 88 deletions(-) diff --git a/hw/net/e1000e_core.h b/hw/net/e1000e_core.h index 213a70530d..66b025cc43 100644 --- a/hw/net/e1000e_core.h +++ b/hw/net/e1000e_core.h @@ -111,8 +111,6 @@ struct E1000Core { PCIDevice *owner; void (*owner_start_recv)(PCIDevice *d); - uint32_t msi_causes_pending; - int64_t timadj; }; diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c index d601386992..9f185d099c 100644 --- a/hw/net/e1000e_core.c +++ b/hw/net/e1000e_core.c @@ -165,14 +165,14 @@ e1000e_intrmgr_on_throttling_timer(void *opaque) timer->running = false; - if (msi_enabled(timer->core->owner)) { - trace_e1000e_irq_msi_notify_postponed(); - /* Clear msi_causes_pending to fire MSI eventually */ - timer->core->msi_causes_pending = 0; - e1000e_set_interrupt_cause(timer->core, 0); - } else { - trace_e1000e_irq_legacy_notify_postponed(); - e1000e_set_interrupt_cause(timer->core, 0); + if (timer->core->mac[IMS] & timer->core->mac[ICR]) { + if (msi_enabled(timer->core->owner)) { + trace_e1000e_irq_msi_notify_postponed(); + msi_notify(timer->core->owner, 0); + } else { + trace_e1000e_irq_legacy_notify_postponed(); + e1000e_raise_legacy_irq(timer->core); + } } } @@ -366,10 +366,6 @@ static void e1000e_intrmgr_fire_all_timers(E1000ECore *core) { int i; - uint32_t val = e1000e_intmgr_collect_delayed_causes(core); - - trace_e1000e_irq_adding_delayed_causes(val, core->mac[ICR]); - core->mac[ICR] |= val; if (core->itr.running) { timer_del(core->itr.timer); @@ -1974,13 +1970,6 @@ void(*e1000e_phyreg_writeops[E1000E_PHY_PAGES][E1000E_PHY_PAGE_SIZE]) } }; -static inline void -e1000e_clear_ims_bits(E1000ECore *core, uint32_t bits) -{ - trace_e1000e_irq_clear_ims(bits, core->mac[IMS], core->mac[IMS] & ~bits); - core->mac[IMS] &= ~bits; -} - static inline bool e1000e_postpone_interrupt(E1000IntrDelayTimer *timer) { @@ -2038,7 +2027,6 @@ e1000e_msix_notify_one(E1000ECore *core, uint32_t cause, uint32_t int_cfg) effective_eiac = core->mac[EIAC] & cause; core->mac[ICR] &= ~effective_eiac; - core->msi_causes_pending &= ~effective_eiac; if (!(core->mac[CTRL_EXT] & E1000_CTRL_EXT_IAME)) { core->mac[IMS] &= ~effective_eiac; @@ -2130,33 +2118,17 @@ e1000e_fix_icr_asserted(E1000ECore *core) trace_e1000e_irq_fix_icr_asserted(core->mac[ICR]); } -static void -e1000e_send_msi(E1000ECore *core, bool msix) +static void e1000e_raise_interrupts(E1000ECore *core, + size_t index, uint32_t causes) { - uint32_t causes = core->mac[ICR] & core->mac[IMS] & ~E1000_ICR_ASSERTED; - - core->msi_causes_pending &= causes; - causes ^= core->msi_causes_pending; - if (causes == 0) { - return; - } - core->msi_causes_pending |= causes; + bool is_msix = msix_enabled(core->owner); + uint32_t old_causes = core->mac[IMS] & core->mac[ICR]; + uint32_t raised_causes; - if (msix) { - e1000e_msix_notify(core, causes); - } else { - if (!e1000e_itr_should_postpone(core)) { - trace_e1000e_irq_msi_notify(causes); - msi_notify(core->owner, 0); - } - } -} + trace_e1000e_irq_set(index << 2, + core->mac[index], core->mac[index] | causes); -static void -e1000e_update_interrupt_state(E1000ECore *core) -{ - bool interrupts_pending; - bool is_msix = msix_enabled(core->owner); + core->mac[index] |= causes; /* Set ICR[OTHER] for MSI-X */ if (is_msix) { @@ -2178,40 +2150,58 @@ e1000e_update_interrupt_state(E1000ECore *core) */ core->mac[ICS] = core->mac[ICR]; - interrupts_pending = (core->mac[IMS] & core->mac[ICR]) ? true : false; - if (!interrupts_pending) { - core->msi_causes_pending = 0; - } - trace_e1000e_irq_pending_interrupts(core->mac[ICR] & core->mac[IMS], core->mac[ICR], core->mac[IMS]); - if (is_msix || msi_enabled(core->owner)) { - if (interrupts_pending) { - e1000e_send_msi(core, is_msix); - } - } else { - if (interrupts_pending) { - if (!e1000e_itr_should_postpone(core)) { - e1000e_raise_legacy_irq(core); - } + raised_causes = core->mac[IMS] & core->mac[ICR] & ~old_causes; + if (!raised_causes) { + return; + } + + if (is_msix) { + e1000e_msix_notify(core, raised_causes & ~E1000_ICR_ASSERTED); + } else if (!e1000e_itr_should_postpone(core)) { + if (msi_enabled(core->owner)) { + trace_e1000e_irq_msi_notify(raised_causes); + msi_notify(core->owner, 0); } else { - e1000e_lower_legacy_irq(core); + e1000e_raise_legacy_irq(core); } } } -static void -e1000e_set_interrupt_cause(E1000ECore *core, uint32_t val) +static void e1000e_lower_interrupts(E1000ECore *core, + size_t index, uint32_t causes) { - trace_e1000e_irq_set_cause_entry(val, core->mac[ICR]); + trace_e1000e_irq_clear(index << 2, + core->mac[index], core->mac[index] & ~causes); - val |= e1000e_intmgr_collect_delayed_causes(core); - core->mac[ICR] |= val; + core->mac[index] &= ~causes; - trace_e1000e_irq_set_cause_exit(val, core->mac[ICR]); + /* + * Make sure ICR and ICS registers have the same value. + * The spec says that the ICS register is write-only. However in practice, + * on real hardware ICS is readable, and for reads it has the same value as + * ICR (except that ICS does not have the clear on read behaviour of ICR). + * + * The VxWorks PRO/1000 driver uses this behaviour. + */ + core->mac[ICS] = core->mac[ICR]; + + trace_e1000e_irq_pending_interrupts(core->mac[ICR] & core->mac[IMS], + core->mac[ICR], core->mac[IMS]); - e1000e_update_interrupt_state(core); + if (!(core->mac[IMS] & core->mac[ICR]) && + !msix_enabled(core->owner) && !msi_enabled(core->owner)) { + e1000e_lower_legacy_irq(core); + } +} + +static void +e1000e_set_interrupt_cause(E1000ECore *core, uint32_t val) +{ + val |= e1000e_intmgr_collect_delayed_causes(core); + e1000e_raise_interrupts(core, ICR, val); } static inline void @@ -2477,30 +2467,27 @@ e1000e_set_ics(E1000ECore *core, int index, uint32_t val) static void e1000e_set_icr(E1000ECore *core, int index, uint32_t val) { - uint32_t icr = 0; if ((core->mac[ICR] & E1000_ICR_ASSERTED) && (core->mac[CTRL_EXT] & E1000_CTRL_EXT_IAME)) { trace_e1000e_irq_icr_process_iame(); - e1000e_clear_ims_bits(core, core->mac[IAM]); + e1000e_lower_interrupts(core, IMS, core->mac[IAM]); } - icr = core->mac[ICR] & ~val; /* * Windows driver expects that the "receive overrun" bit and other * ones to be cleared when the "Other" bit (#24) is cleared. */ - icr = (val & E1000_ICR_OTHER) ? (icr & ~E1000_ICR_OTHER_CAUSES) : icr; - trace_e1000e_irq_icr_write(val, core->mac[ICR], icr); - core->mac[ICR] = icr; - e1000e_update_interrupt_state(core); + if (val & E1000_ICR_OTHER) { + val |= E1000_ICR_OTHER_CAUSES; + } + e1000e_lower_interrupts(core, ICR, val); } static void e1000e_set_imc(E1000ECore *core, int index, uint32_t val) { trace_e1000e_irq_ims_clear_set_imc(val); - e1000e_clear_ims_bits(core, val); - e1000e_update_interrupt_state(core); + e1000e_lower_interrupts(core, IMS, val); } static void @@ -2521,9 +2508,6 @@ e1000e_set_ims(E1000ECore *core, int index, uint32_t val) uint32_t valid_val = val & ims_valid_mask; - trace_e1000e_irq_set_ims(val, core->mac[IMS], core->mac[IMS] | valid_val); - core->mac[IMS] |= valid_val; - if ((valid_val & ims_ext_mask) && (core->mac[CTRL_EXT] & E1000_CTRL_EXT_PBA_CLR) && msix_enabled(core->owner)) { @@ -2536,7 +2520,7 @@ e1000e_set_ims(E1000ECore *core, int index, uint32_t val) e1000e_intrmgr_fire_all_timers(core); } - e1000e_update_interrupt_state(core); + e1000e_raise_interrupts(core, IMS, valid_val); } static void @@ -2609,28 +2593,25 @@ static uint32_t e1000e_mac_icr_read(E1000ECore *core, int index) { uint32_t ret = core->mac[ICR]; - trace_e1000e_irq_icr_read_entry(ret); if (core->mac[IMS] == 0) { trace_e1000e_irq_icr_clear_zero_ims(); - core->mac[ICR] = 0; + e1000e_lower_interrupts(core, ICR, 0xffffffff); } if (!msix_enabled(core->owner)) { trace_e1000e_irq_icr_clear_nonmsix_icr_read(); - core->mac[ICR] = 0; + e1000e_lower_interrupts(core, ICR, 0xffffffff); } if ((core->mac[ICR] & E1000_ICR_ASSERTED) && (core->mac[CTRL_EXT] & E1000_CTRL_EXT_IAME)) { trace_e1000e_irq_icr_clear_iame(); - core->mac[ICR] = 0; + e1000e_lower_interrupts(core, ICR, 0xffffffff); trace_e1000e_irq_icr_process_iame(); - e1000e_clear_ims_bits(core, core->mac[IAM]); + e1000e_lower_interrupts(core, IMS, core->mac[IAM]); } - trace_e1000e_irq_icr_read_exit(core->mac[ICR]); - e1000e_update_interrupt_state(core); return ret; } diff --git a/hw/net/trace-events b/hw/net/trace-events index 64d776bc2a..d171dc8179 100644 --- a/hw/net/trace-events +++ b/hw/net/trace-events @@ -205,6 +205,8 @@ e1000e_irq_msix_notify_postponed_vec(int idx) "Sending MSI-X postponed by EITR[% e1000e_irq_legacy_notify(bool level) "IRQ line state: %d" e1000e_irq_msix_notify_vec(uint32_t vector) "MSI-X notify vector 0x%x" e1000e_irq_postponed_by_xitr(uint32_t reg) "Interrupt postponed by [E]ITR register 0x%x" +e1000e_irq_clear(uint32_t offset, uint32_t old, uint32_t new) "Clearing interrupt register 0x%x: 0x%x --> 0x%x" +e1000e_irq_set(uint32_t offset, uint32_t old, uint32_t new) "Setting interrupt register 0x%x: 0x%x --> 0x%x" e1000e_irq_clear_ims(uint32_t bits, uint32_t old_ims, uint32_t new_ims) "Clearing IMS bits 0x%x: 0x%x --> 0x%x" e1000e_irq_set_ims(uint32_t bits, uint32_t old_ims, uint32_t new_ims) "Setting IMS bits 0x%x: 0x%x --> 0x%x" e1000e_irq_fix_icr_asserted(uint32_t new_val) "ICR_ASSERTED bit fixed: 0x%x" From patchwork Wed Apr 26 10:37:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1773996 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=cTkPaEj/; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wQg4pHmz23vF for ; Wed, 26 Apr 2023 20:41:31 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcZA-0001Ej-Hc; Wed, 26 Apr 2023 06:40:04 -0400 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 1prcZ8-0001AH-BP for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:40:02 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcZ5-0003ME-OE for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:40:02 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-63b57c49c4cso5721487b3a.3 for ; Wed, 26 Apr 2023 03:39:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505599; x=1685097599; 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=rWvyFV2WAlTiu9opp40xw99W3WuFDo2TVYRjlolBLt0=; b=cTkPaEj/ElS1JBW6vQYiwSYZn1F3IgzyHijFmykg+pWuCt35wS2l4N+qRhxE0n2Vtm fu6rwBcKeTIzNPQTqZ5Q/RL+gTzR5ySxttBJcqvWaUuROdFmwdFcqL/AQ286UJebLQ/b ed4v0O0lVe1CyGM1zfRfvG5W5eAvcT3NCZ24CaeSUFi57C3ZyUddFwiK7F0ypTdAHbU6 sZK1NuKEpo7PMMudF1yc0bDZjsjmsws9Uf0bs6G679P50hZBc0oq7K5ykBWo1MIjmeKI IWUoeVhT5N24zTipK3DrD06GidodyONb459YBQnNdF0JDz+/itldJkPGoRTsg+wQs1Ae ZZNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505599; x=1685097599; 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=rWvyFV2WAlTiu9opp40xw99W3WuFDo2TVYRjlolBLt0=; b=YRJl0xCZGIIh6IkgdK1SeH1fI02dFoCHZLRRDvQ9VnncpXmPYaSNq18zk1b6RSSABC qd8iNSWkH/lv9n6R3siCT9ao/Y4A1LuZNYsWZrcn5CtkieVpf8FSf/d3JHjviC2ye1td 7pztIvjef+wxsmThF7uPBHTOGA/e3FfPSubI6hm5iJDOmU5CXmlwFGKMbg7SNaiwHdCZ Cm59h+tBXX/cpzEJ0BhcrpBqPPI/2/HV8X/l2cCkWhcJUi2NrZkU9v6aadluu0vk/WSc u6nWNUve7v3V+6thch1vTW1QciDCdiAfViafZ0ZMX0wAg0L+MQrL8afVFCNYhnu9EueA /HSw== X-Gm-Message-State: AC+VfDyp971Y4sktRd7voi+XCH3xyCqPbkSTI+55JCOnanKLk81OVbDl I4K3t6evqITYG1vtJERhiy4FHQ== X-Google-Smtp-Source: ACHHUZ7db3W34lItCLU6YvPMBGOslOnG7PJb0tgVNkZSDelxrcpYGMNlv5+zrixIxmtwlMWPz2q/Nw== X-Received: by 2002:a05:6a21:587:b0:f4:7cbd:c236 with SMTP id lw7-20020a056a21058700b000f47cbdc236mr155303pzb.54.1682505598990; Wed, 26 Apr 2023 03:39:58 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.39.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:39:58 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 44/48] igb: Notify only new interrupts Date: Wed, 26 Apr 2023 19:37:12 +0900 Message-Id: <20230426103716.26279-45-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::434; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x434.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This follows the corresponding change for e1000e. This fixes: tests/avocado/netdev-ethtool.py:NetDevEthtool.test_igb Signed-off-by: Akihiko Odaki Tested-by: Sriram Yagnaraman --- hw/net/igb_core.c | 201 ++++++++---------- hw/net/trace-events | 11 +- .../org.centos/stream/8/x86_64/test-avocado | 1 + tests/avocado/netdev-ethtool.py | 4 - 4 files changed, 87 insertions(+), 130 deletions(-) diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index 57973c3ae4..b68e24c9ee 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -94,10 +94,7 @@ static ssize_t igb_receive_internal(IGBCore *core, const struct iovec *iov, int iovcnt, bool has_vnet, bool *external_tx); -static inline void -igb_set_interrupt_cause(IGBCore *core, uint32_t val); - -static void igb_update_interrupt_state(IGBCore *core); +static void igb_raise_interrupts(IGBCore *core, size_t index, uint32_t causes); static void igb_reset(IGBCore *core, bool sw); static inline void @@ -913,8 +910,8 @@ igb_start_xmit(IGBCore *core, const IGB_TxRing *txr) } if (eic) { - core->mac[EICR] |= eic; - igb_set_interrupt_cause(core, E1000_ICR_TXDW); + igb_raise_interrupts(core, EICR, eic); + igb_raise_interrupts(core, ICR, E1000_ICR_TXDW); } net_tx_pkt_reset(txr->tx->tx_pkt, net_tx_pkt_unmap_frag_pci, d); @@ -1686,6 +1683,7 @@ igb_receive_internal(IGBCore *core, const struct iovec *iov, int iovcnt, { uint16_t queues = 0; uint32_t causes = 0; + uint32_t ecauses = 0; union { L2Header l2_header; uint8_t octets[ETH_ZLEN]; @@ -1788,13 +1786,14 @@ igb_receive_internal(IGBCore *core, const struct iovec *iov, int iovcnt, causes |= E1000_ICS_RXDMT0; } - core->mac[EICR] |= igb_rx_wb_eic(core, rxr.i->idx); + ecauses |= igb_rx_wb_eic(core, rxr.i->idx); trace_e1000e_rx_written_to_guest(rxr.i->idx); } trace_e1000e_rx_interrupt_set(causes); - igb_set_interrupt_cause(core, causes); + igb_raise_interrupts(core, EICR, ecauses); + igb_raise_interrupts(core, ICR, causes); return orig_size; } @@ -1854,7 +1853,7 @@ void igb_core_set_link_status(IGBCore *core) } if (core->mac[STATUS] != old_status) { - igb_set_interrupt_cause(core, E1000_ICR_LSC); + igb_raise_interrupts(core, ICR, E1000_ICR_LSC); } } @@ -1934,13 +1933,6 @@ igb_set_rx_control(IGBCore *core, int index, uint32_t val) } } -static inline void -igb_clear_ims_bits(IGBCore *core, uint32_t bits) -{ - trace_e1000e_irq_clear_ims(bits, core->mac[IMS], core->mac[IMS] & ~bits); - core->mac[IMS] &= ~bits; -} - static inline bool igb_postpone_interrupt(IGBIntrDelayTimer *timer) { @@ -1963,9 +1955,8 @@ igb_eitr_should_postpone(IGBCore *core, int idx) return igb_postpone_interrupt(&core->eitr[idx]); } -static void igb_send_msix(IGBCore *core) +static void igb_send_msix(IGBCore *core, uint32_t causes) { - uint32_t causes = core->mac[EICR] & core->mac[EIMS]; int vector; for (vector = 0; vector < IGB_INTR_NUM; ++vector) { @@ -1988,124 +1979,116 @@ igb_fix_icr_asserted(IGBCore *core) trace_e1000e_irq_fix_icr_asserted(core->mac[ICR]); } -static void -igb_update_interrupt_state(IGBCore *core) +static void igb_raise_interrupts(IGBCore *core, size_t index, uint32_t causes) { - uint32_t icr; - uint32_t causes; + uint32_t old_causes = core->mac[ICR] & core->mac[IMS]; + uint32_t old_ecauses = core->mac[EICR] & core->mac[EIMS]; + uint32_t raised_causes; + uint32_t raised_ecauses; uint32_t int_alloc; - icr = core->mac[ICR] & core->mac[IMS]; + trace_e1000e_irq_set(index << 2, + core->mac[index], core->mac[index] | causes); + + core->mac[index] |= causes; if (core->mac[GPIE] & E1000_GPIE_MSIX_MODE) { - if (icr) { - causes = 0; - if (icr & E1000_ICR_DRSTA) { - int_alloc = core->mac[IVAR_MISC] & 0xff; - if (int_alloc & E1000_IVAR_VALID) { - causes |= BIT(int_alloc & 0x1f); - } + raised_causes = core->mac[ICR] & core->mac[IMS] & ~old_causes; + + if (raised_causes & E1000_ICR_DRSTA) { + int_alloc = core->mac[IVAR_MISC] & 0xff; + if (int_alloc & E1000_IVAR_VALID) { + core->mac[EICR] |= BIT(int_alloc & 0x1f); } - /* Check if other bits (excluding the TCP Timer) are enabled. */ - if (icr & ~E1000_ICR_DRSTA) { - int_alloc = (core->mac[IVAR_MISC] >> 8) & 0xff; - if (int_alloc & E1000_IVAR_VALID) { - causes |= BIT(int_alloc & 0x1f); - } - trace_e1000e_irq_add_msi_other(core->mac[EICR]); + } + /* Check if other bits (excluding the TCP Timer) are enabled. */ + if (raised_causes & ~E1000_ICR_DRSTA) { + int_alloc = (core->mac[IVAR_MISC] >> 8) & 0xff; + if (int_alloc & E1000_IVAR_VALID) { + core->mac[EICR] |= BIT(int_alloc & 0x1f); } - core->mac[EICR] |= causes; } - if ((core->mac[EICR] & core->mac[EIMS])) { - igb_send_msix(core); + raised_ecauses = core->mac[EICR] & core->mac[EIMS] & ~old_ecauses; + if (!raised_ecauses) { + return; } + + igb_send_msix(core, raised_ecauses); } else { igb_fix_icr_asserted(core); - if (icr) { - core->mac[EICR] |= (icr & E1000_ICR_DRSTA) | E1000_EICR_OTHER; - } else { - core->mac[EICR] &= ~E1000_EICR_OTHER; + raised_causes = core->mac[ICR] & core->mac[IMS] & ~old_causes; + if (!raised_causes) { + return; } - trace_e1000e_irq_pending_interrupts(core->mac[ICR] & core->mac[IMS], - core->mac[ICR], core->mac[IMS]); + core->mac[EICR] |= (raised_causes & E1000_ICR_DRSTA) | E1000_EICR_OTHER; if (msix_enabled(core->owner)) { - if (icr) { - trace_e1000e_irq_msix_notify_vec(0); - msix_notify(core->owner, 0); - } + trace_e1000e_irq_msix_notify_vec(0); + msix_notify(core->owner, 0); } else if (msi_enabled(core->owner)) { - if (icr) { - msi_notify(core->owner, 0); - } + trace_e1000e_irq_msi_notify(raised_causes); + msi_notify(core->owner, 0); } else { - if (icr) { - igb_raise_legacy_irq(core); - } else { - igb_lower_legacy_irq(core); - } + igb_raise_legacy_irq(core); } } } -static void -igb_set_interrupt_cause(IGBCore *core, uint32_t val) +static void igb_lower_interrupts(IGBCore *core, size_t index, uint32_t causes) { - trace_e1000e_irq_set_cause_entry(val, core->mac[ICR]); + trace_e1000e_irq_clear(index << 2, + core->mac[index], core->mac[index] & ~causes); + + core->mac[index] &= ~causes; - core->mac[ICR] |= val; + trace_e1000e_irq_pending_interrupts(core->mac[ICR] & core->mac[IMS], + core->mac[ICR], core->mac[IMS]); - trace_e1000e_irq_set_cause_exit(val, core->mac[ICR]); + if (!(core->mac[ICR] & core->mac[IMS]) && + !(core->mac[GPIE] & E1000_GPIE_MSIX_MODE)) { + core->mac[EICR] &= ~E1000_EICR_OTHER; - igb_update_interrupt_state(core); + if (!msix_enabled(core->owner) && !msi_enabled(core->owner)) { + igb_lower_legacy_irq(core); + } + } } static void igb_set_eics(IGBCore *core, int index, uint32_t val) { bool msix = !!(core->mac[GPIE] & E1000_GPIE_MSIX_MODE); + uint32_t mask = msix ? E1000_EICR_MSIX_MASK : E1000_EICR_LEGACY_MASK; trace_igb_irq_write_eics(val, msix); - - core->mac[EICS] |= - val & (msix ? E1000_EICR_MSIX_MASK : E1000_EICR_LEGACY_MASK); - - /* - * TODO: Move to igb_update_interrupt_state if EICS is modified in other - * places. - */ - core->mac[EICR] = core->mac[EICS]; - - igb_update_interrupt_state(core); + igb_raise_interrupts(core, EICR, val & mask); } static void igb_set_eims(IGBCore *core, int index, uint32_t val) { bool msix = !!(core->mac[GPIE] & E1000_GPIE_MSIX_MODE); + uint32_t mask = msix ? E1000_EICR_MSIX_MASK : E1000_EICR_LEGACY_MASK; trace_igb_irq_write_eims(val, msix); - - core->mac[EIMS] |= - val & (msix ? E1000_EICR_MSIX_MASK : E1000_EICR_LEGACY_MASK); - - igb_update_interrupt_state(core); + igb_raise_interrupts(core, EIMS, val & mask); } static void mailbox_interrupt_to_vf(IGBCore *core, uint16_t vfn) { uint32_t ent = core->mac[VTIVAR_MISC + vfn]; + uint32_t causes; if ((ent & E1000_IVAR_VALID)) { - core->mac[EICR] |= (ent & 0x3) << (22 - vfn * IGBVF_MSIX_VEC_NUM); - igb_update_interrupt_state(core); + causes = (ent & 0x3) << (22 - vfn * IGBVF_MSIX_VEC_NUM); + igb_raise_interrupts(core, EICR, causes); } } static void mailbox_interrupt_to_pf(IGBCore *core) { - igb_set_interrupt_cause(core, E1000_ICR_VMMB); + igb_raise_interrupts(core, ICR, E1000_ICR_VMMB); } static void igb_set_pfmailbox(IGBCore *core, int index, uint32_t val) @@ -2196,13 +2179,12 @@ static void igb_w1c(IGBCore *core, int index, uint32_t val) static void igb_set_eimc(IGBCore *core, int index, uint32_t val) { bool msix = !!(core->mac[GPIE] & E1000_GPIE_MSIX_MODE); + uint32_t mask = msix ? E1000_EICR_MSIX_MASK : E1000_EICR_LEGACY_MASK; - /* Interrupts are disabled via a write to EIMC and reflected in EIMS. */ - core->mac[EIMS] &= - ~(val & (msix ? E1000_EICR_MSIX_MASK : E1000_EICR_LEGACY_MASK)); + trace_igb_irq_write_eimc(val, msix); - trace_igb_irq_write_eimc(val, core->mac[EIMS], msix); - igb_update_interrupt_state(core); + /* Interrupts are disabled via a write to EIMC and reflected in EIMS. */ + igb_lower_interrupts(core, EIMS, val & mask); } static void igb_set_eiac(IGBCore *core, int index, uint32_t val) @@ -2242,11 +2224,10 @@ static void igb_set_eicr(IGBCore *core, int index, uint32_t val) * TODO: In IOV mode, only bit zero of this vector is available for the PF * function. */ - core->mac[EICR] &= - ~(val & (msix ? E1000_EICR_MSIX_MASK : E1000_EICR_LEGACY_MASK)); + uint32_t mask = msix ? E1000_EICR_MSIX_MASK : E1000_EICR_LEGACY_MASK; trace_igb_irq_write_eicr(val, msix); - igb_update_interrupt_state(core); + igb_lower_interrupts(core, EICR, val & mask); } static void igb_set_vtctrl(IGBCore *core, int index, uint32_t val) @@ -2346,7 +2327,7 @@ igb_autoneg_timer(void *opaque) igb_update_flowctl_status(core); /* signal link status change to the guest */ - igb_set_interrupt_cause(core, E1000_ICR_LSC); + igb_raise_interrupts(core, ICR, E1000_ICR_LSC); } } @@ -2419,7 +2400,7 @@ igb_set_mdic(IGBCore *core, int index, uint32_t val) core->mac[MDIC] = val | E1000_MDIC_READY; if (val & E1000_MDIC_INT_EN) { - igb_set_interrupt_cause(core, E1000_ICR_MDAC); + igb_raise_interrupts(core, ICR, E1000_ICR_MDAC); } } @@ -2527,28 +2508,23 @@ static void igb_set_ics(IGBCore *core, int index, uint32_t val) { trace_e1000e_irq_write_ics(val); - igb_set_interrupt_cause(core, val); + igb_raise_interrupts(core, ICR, val); } static void igb_set_imc(IGBCore *core, int index, uint32_t val) { trace_e1000e_irq_ims_clear_set_imc(val); - igb_clear_ims_bits(core, val); - igb_update_interrupt_state(core); + igb_lower_interrupts(core, IMS, val); } static void igb_set_ims(IGBCore *core, int index, uint32_t val) { - uint32_t valid_val = val & 0x77D4FBFD; - - trace_e1000e_irq_set_ims(val, core->mac[IMS], core->mac[IMS] | valid_val); - core->mac[IMS] |= valid_val; - igb_update_interrupt_state(core); + igb_raise_interrupts(core, IMS, val & 0x77D4FBFD); } -static void igb_commit_icr(IGBCore *core) +static void igb_nsicr(IGBCore *core) { /* * If GPIE.NSICR = 0, then the clear of IMS will occur only if at @@ -2557,19 +2533,14 @@ static void igb_commit_icr(IGBCore *core) */ if ((core->mac[GPIE] & E1000_GPIE_NSICR) || (core->mac[IMS] && (core->mac[ICR] & E1000_ICR_INT_ASSERTED))) { - igb_clear_ims_bits(core, core->mac[IAM]); + igb_lower_interrupts(core, IMS, core->mac[IAM]); } - - igb_update_interrupt_state(core); } static void igb_set_icr(IGBCore *core, int index, uint32_t val) { - uint32_t icr = core->mac[ICR] & ~val; - - trace_igb_irq_icr_write(val, core->mac[ICR], icr); - core->mac[ICR] = icr; - igb_commit_icr(core); + igb_nsicr(core); + igb_lower_interrupts(core, ICR, val); } static uint32_t @@ -2620,21 +2591,19 @@ static uint32_t igb_mac_icr_read(IGBCore *core, int index) { uint32_t ret = core->mac[ICR]; - trace_e1000e_irq_icr_read_entry(ret); if (core->mac[GPIE] & E1000_GPIE_NSICR) { trace_igb_irq_icr_clear_gpie_nsicr(); - core->mac[ICR] = 0; + igb_lower_interrupts(core, ICR, 0xffffffff); } else if (core->mac[IMS] == 0) { trace_e1000e_irq_icr_clear_zero_ims(); - core->mac[ICR] = 0; + igb_lower_interrupts(core, ICR, 0xffffffff); } else if (!msix_enabled(core->owner)) { trace_e1000e_irq_icr_clear_nonmsix_icr_read(); - core->mac[ICR] = 0; + igb_lower_interrupts(core, ICR, 0xffffffff); } - trace_e1000e_irq_icr_read_exit(core->mac[ICR]); - igb_commit_icr(core); + igb_nsicr(core); return ret; } diff --git a/hw/net/trace-events b/hw/net/trace-events index d171dc8179..e4a98b2c7d 100644 --- a/hw/net/trace-events +++ b/hw/net/trace-events @@ -207,21 +207,14 @@ e1000e_irq_msix_notify_vec(uint32_t vector) "MSI-X notify vector 0x%x" e1000e_irq_postponed_by_xitr(uint32_t reg) "Interrupt postponed by [E]ITR register 0x%x" e1000e_irq_clear(uint32_t offset, uint32_t old, uint32_t new) "Clearing interrupt register 0x%x: 0x%x --> 0x%x" e1000e_irq_set(uint32_t offset, uint32_t old, uint32_t new) "Setting interrupt register 0x%x: 0x%x --> 0x%x" -e1000e_irq_clear_ims(uint32_t bits, uint32_t old_ims, uint32_t new_ims) "Clearing IMS bits 0x%x: 0x%x --> 0x%x" -e1000e_irq_set_ims(uint32_t bits, uint32_t old_ims, uint32_t new_ims) "Setting IMS bits 0x%x: 0x%x --> 0x%x" e1000e_irq_fix_icr_asserted(uint32_t new_val) "ICR_ASSERTED bit fixed: 0x%x" e1000e_irq_add_msi_other(uint32_t new_val) "ICR_OTHER bit added: 0x%x" e1000e_irq_pending_interrupts(uint32_t pending, uint32_t icr, uint32_t ims) "ICR PENDING: 0x%x (ICR: 0x%x, IMS: 0x%x)" -e1000e_irq_set_cause_entry(uint32_t val, uint32_t icr) "Going to set IRQ cause 0x%x, ICR: 0x%x" -e1000e_irq_set_cause_exit(uint32_t val, uint32_t icr) "Set IRQ cause 0x%x, ICR: 0x%x" -e1000e_irq_icr_write(uint32_t bits, uint32_t old_icr, uint32_t new_icr) "Clearing ICR bits 0x%x: 0x%x --> 0x%x" e1000e_irq_write_ics(uint32_t val) "Adding ICR bits 0x%x" e1000e_irq_icr_process_iame(void) "Clearing IMS bits due to IAME" e1000e_irq_read_ics(uint32_t ics) "Current ICS: 0x%x" e1000e_irq_read_ims(uint32_t ims) "Current IMS: 0x%x" e1000e_irq_icr_clear_nonmsix_icr_read(void) "Clearing ICR on read due to non MSI-X int" -e1000e_irq_icr_read_entry(uint32_t icr) "Starting ICR read. Current ICR: 0x%x" -e1000e_irq_icr_read_exit(uint32_t icr) "Ending ICR read. Current ICR: 0x%x" e1000e_irq_icr_clear_zero_ims(void) "Clearing ICR on read due to zero IMS" e1000e_irq_icr_clear_iame(void) "Clearing ICR on read due to IAME" e1000e_irq_iam_clear_eiame(uint32_t iam, uint32_t cause) "Clearing IMS due to EIAME, IAM: 0x%X, cause: 0x%X" @@ -237,7 +230,6 @@ e1000e_irq_tidv_fpd_not_running(void) "FPD written while TIDV was not running" e1000e_irq_eitr_set(uint32_t eitr_num, uint32_t val) "EITR[%u] = %u" e1000e_irq_itr_set(uint32_t val) "ITR = %u" e1000e_irq_fire_all_timers(uint32_t val) "Firing all delay/throttling timers on all interrupts enable (0x%X written to IMS)" -e1000e_irq_adding_delayed_causes(uint32_t val, uint32_t icr) "Merging delayed causes 0x%X to ICR 0x%X" e1000e_irq_msix_pending_clearing(uint32_t cause, uint32_t int_cfg, uint32_t vec) "Clearing MSI-X pending bit for cause 0x%x, IVAR config 0x%x, vector %u" e1000e_wrn_msix_vec_wrong(uint32_t cause, uint32_t cfg) "Invalid configuration for cause 0x%x: 0x%x" @@ -290,12 +282,11 @@ igb_rx_desc_buff_write(uint64_t addr, uint16_t offset, const void* source, uint3 igb_rx_metadata_rss(uint32_t rss) "RSS data: 0x%X" igb_irq_icr_clear_gpie_nsicr(void) "Clearing ICR on read due to GPIE.NSICR enabled" -igb_irq_icr_write(uint32_t bits, uint32_t old_icr, uint32_t new_icr) "Clearing ICR bits 0x%x: 0x%x --> 0x%x" igb_irq_set_iam(uint32_t icr) "Update IAM: 0x%x" igb_irq_read_iam(uint32_t icr) "Current IAM: 0x%x" igb_irq_write_eics(uint32_t val, bool msix) "Update EICS: 0x%x MSI-X: %d" igb_irq_write_eims(uint32_t val, bool msix) "Update EIMS: 0x%x MSI-X: %d" -igb_irq_write_eimc(uint32_t val, uint32_t eims, bool msix) "Update EIMC: 0x%x EIMS: 0x%x MSI-X: %d" +igb_irq_write_eimc(uint32_t val, bool msix) "Update EIMC: 0x%x MSI-X: %d" igb_irq_write_eiac(uint32_t val) "Update EIAC: 0x%x" igb_irq_write_eiam(uint32_t val, bool msix) "Update EIAM: 0x%x MSI-X: %d" igb_irq_write_eicr(uint32_t val, bool msix) "Update EICR: 0x%x MSI-X: %d" diff --git a/scripts/ci/org.centos/stream/8/x86_64/test-avocado b/scripts/ci/org.centos/stream/8/x86_64/test-avocado index a1aa601ee3..e0443fc8ae 100755 --- a/scripts/ci/org.centos/stream/8/x86_64/test-avocado +++ b/scripts/ci/org.centos/stream/8/x86_64/test-avocado @@ -30,6 +30,7 @@ make get-vm-images tests/avocado/cpu_queries.py:QueryCPUModelExpansion.test \ tests/avocado/empty_cpu_model.py:EmptyCPUModel.test \ tests/avocado/hotplug_cpu.py:HotPlugCPU.test \ + tests/avocado/netdev-ethtool.py:NetDevEthtool.test_igb \ tests/avocado/netdev-ethtool.py:NetDevEthtool.test_igb_nomsi \ tests/avocado/info_usernet.py:InfoUsernet.test_hostfwd \ tests/avocado/intel_iommu.py:IntelIOMMU.test_intel_iommu \ diff --git a/tests/avocado/netdev-ethtool.py b/tests/avocado/netdev-ethtool.py index 6da800f62b..5f33288f81 100644 --- a/tests/avocado/netdev-ethtool.py +++ b/tests/avocado/netdev-ethtool.py @@ -67,10 +67,6 @@ def common_test_code(self, netdev, extra_args=None): # no need to gracefully shutdown, just finish self.vm.kill() - # Skip testing for MSI for now. Allegedly it was fixed by: - # 28e96556ba (igb: Allocate MSI-X vector when testing) - # but I'm seeing oops in the kernel - @skip("Kernel bug with MSI enabled") def test_igb(self): """ :avocado: tags=device:igb From patchwork Wed Apr 26 10:37:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1774022 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=DBNI404s; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wYK59Zhz23vH for ; Wed, 26 Apr 2023 20:47:16 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcZD-0001N2-LZ; Wed, 26 Apr 2023 06:40:07 -0400 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 1prcZB-0001FA-A8 for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:40:05 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcZ9-0003Tz-NI for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:40:05 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-63b64a32fd2so8913313b3a.2 for ; Wed, 26 Apr 2023 03:40:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505602; x=1685097602; 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=V0cD7P3pMGkzQqnF3+r3pe1FYP8aalGdf1sSQTiCfaI=; b=DBNI404s8c2VkU6/P2dtQO7EyCq5ICBmPj26OiIE12r0d2q4UBsB+6rYpZc4kvjwgV pnDSjlrANiOI+qLocUOpiFdyZ/6Jv2NEg2BShCXMhZrodas3lCG3fWVaJHYwvnxzmof8 FJFi/1AV4tqqf/d4k7UsGyllBj1MjMJ5DZK+hmNBfWpCGxQzo0op1xl2ykWWaSFcQbOo 1G97lu/jo0VBwow4P8MI5MONjKLBFcrK7JHlBsZnu0M5g2H1el43EwGZ07EacHbIZkOe zyFCUs32aZ8eIQrfQm5bNr7c4Btf656j6RiL3zHycfPuNnskODiyjbP85gKMBq5BUYwy BQSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505602; x=1685097602; 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=V0cD7P3pMGkzQqnF3+r3pe1FYP8aalGdf1sSQTiCfaI=; b=VSaod4aaonR8tS7klnqpJ7o7ebax2XS8nUkLjNmkRaD/jhNFMcrG5dFifTGvRvIf5t zZeWTRXOuJT/0lgjvhQaxuRhasH9zr4c1vXmm5nroW011QmNrlglfZ2HxTFJZoAUklPW JnGlD2zT+LE0Gbs0hu1XhvEsFSiQ/rOekF5sOfFxeUMI9MQQUUIKFKzMofUV9GzMhj3q 98GapXbK1LnBFPO3NaHPvb/Za720q2fM6uv6fKproPMu769Xe1CqZfGyqrvspynnQ4G/ PHM1CH8jsuLXfLU0UwKaao+0Bf+D8RTs0/qQzepd2JdGM5w5H7h3DmEwRnFz/rQ3NHMf 0yHw== X-Gm-Message-State: AAQBX9dzmEZeAb/t0f3s6AindRSFu7qBsGIgB2pWT4RrHfIWe2yAB8j2 2eHiO/+Gj16KUb9mzsFx/k5/dw== X-Google-Smtp-Source: AKy350Y+ylqTtCUqLlUnW/OjtaRiyT94kdL3dC9CZyaNpXVtoid9wN0LP/sv6RmYkdwBHoXAsUFOCQ== X-Received: by 2002:a05:6a20:3d1d:b0:f0:b6e3:90d9 with SMTP id y29-20020a056a203d1d00b000f0b6e390d9mr26440938pzi.44.1682505602558; Wed, 26 Apr 2023 03:40:02 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.39.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:40:02 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 45/48] igb: Clear-on-read ICR when ICR.INTA is set Date: Wed, 26 Apr 2023 19:37:13 +0900 Message-Id: <20230426103716.26279-46-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::432; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x432.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org For GPIE.NSICR, Section 7.3.2.1.2 says: > ICR bits are cleared on register read. If GPIE.NSICR = 0b, then the > clear on read occurs only if no bit is set in the IMS or at least one > bit is set in the IMS and there is a true interrupt as reflected in > ICR.INTA. e1000e does similar though it checks for CTRL_EXT.IAME, which does not exist on igb. Suggested-by: Sriram Yagnaraman Signed-off-by: Akihiko Odaki Reviewed-by: Sriram Yagnaraman --- hw/net/igb_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index b68e24c9ee..29190054c6 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -2598,6 +2598,8 @@ igb_mac_icr_read(IGBCore *core, int index) } else if (core->mac[IMS] == 0) { trace_e1000e_irq_icr_clear_zero_ims(); igb_lower_interrupts(core, ICR, 0xffffffff); + } else if (core->mac[ICR] & E1000_ICR_INT_ASSERTED) { + igb_lower_interrupts(core, ICR, 0xffffffff); } else if (!msix_enabled(core->owner)) { trace_e1000e_irq_icr_clear_nonmsix_icr_read(); igb_lower_interrupts(core, ICR, 0xffffffff); From patchwork Wed Apr 26 10:37:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1774002 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=nWPG0fIa; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wRJ1GP7z23vJ for ; Wed, 26 Apr 2023 20:42:02 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcZG-0001at-8L; Wed, 26 Apr 2023 06:40:10 -0400 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 1prcZF-0001Wg-0g for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:40:09 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcZD-0003fj-8Q for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:40:08 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-63d2ba63dddso5515406b3a.2 for ; Wed, 26 Apr 2023 03:40:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505606; x=1685097606; 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=WhEhy4Jd1mKN670RG/ec6toCTEp/s9C7PmGHjJRti/0=; b=nWPG0fIaXAOok87aZZM5erlTRTPvxxe8r38c5hDXiu/k7n1BgeOee1QfeWuE/CijyK k1YmdoIr6sZ8bjsFt0Ss2R22i4NoJg6cTBWWwPEWw3ldbGbVaHbRkFyrP6In1AxBT5c4 d7/WJusvGLS/kDw1d+zsvQbCMl1eYXD13E7XadGoeAsszbO+THW0sQ0wAwz/G67zaoNB VJMWTT8nmMPuYoi6h/Bs0B7SSoU3wrruotaJ608tlVlOeamQtI4ISlMdJ7wnZjQNgYlQ T1fWntViCNyQWcYaTdI0IRfd2svVxF/AKFfNR5M+JEuiWJminGK8pWmKgFreNscZvu3T vGbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505606; x=1685097606; 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=WhEhy4Jd1mKN670RG/ec6toCTEp/s9C7PmGHjJRti/0=; b=NAByMGMod7kvtiVl48wNUGjs5Frt8tyyPU94ga8M0oGUyw6vt3QZBz/AMUGP08tv/D dZ9PQxDr3FlRf6sMGF6+EcHl50K42ZS9k1+wwZQrRUrDyIbF0SrTmoClWYP0m3zOXR52 SMvib35DT7CkdotuLS7NZJnerc99bSCweBZgyd5UF1s+ya8UzMHKvTKEsM6MYsy3iQA5 tPbyaxPkuebsq4pTvErwSqY8H05lZJiqIROPxeJWGkXwuKcp/X+RDWXAGCj54CZmrYUE INHFEmK5iBFVkSsO5irOCsBaDyQ1a8R4uC9E+O7SXoolu+PJw7GSxilSXlpEREX1tv1V dLGw== X-Gm-Message-State: AAQBX9f6c0rq3QHJzZgGQKRPTVx9E07SPhzNkaRl0yjtcyp/icLCyUMq tlkGCUpPmhOBAgwEsAc6XGUlOw== X-Google-Smtp-Source: AKy350Yrf1PF0xhb24gDL9BwbuSM3lCet104sfFpiWEuEGtX25Z9itgr0fMgqh+177rFjlcYxgOZNg== X-Received: by 2002:a05:6a20:43a8:b0:ef:7d7b:433a with SMTP id i40-20020a056a2043a800b000ef7d7b433amr21540933pzl.47.1682505606161; Wed, 26 Apr 2023 03:40:06 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.40.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:40:05 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 46/48] vmxnet3: Do not depend on PC Date: Wed, 26 Apr 2023 19:37:14 +0900 Message-Id: <20230426103716.26279-47-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::432; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x432.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org vmxnet3 has no dependency on PC, and VMware Fusion actually makes it available on Apple Silicon according to: https://kb.vmware.com/s/article/90364 Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daudé --- hw/net/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/Kconfig b/hw/net/Kconfig index 18c7851efe..98e00be4f9 100644 --- a/hw/net/Kconfig +++ b/hw/net/Kconfig @@ -56,7 +56,7 @@ config RTL8139_PCI config VMXNET3_PCI bool - default y if PCI_DEVICES && PC_PCI + default y if PCI_DEVICES depends on PCI config SMC91C111 From patchwork Wed Apr 26 10:37:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1774021 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=x+6a2c8f; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wXd0q4Rz23vL for ; Wed, 26 Apr 2023 20:46:41 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcZM-0001n3-JL; Wed, 26 Apr 2023 06:40:16 -0400 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 1prcZJ-0001jM-M6 for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:40:13 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcZH-0003ga-VD for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:40:13 -0400 Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-517bb01bac9so4977280a12.0 for ; Wed, 26 Apr 2023 03:40:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505609; x=1685097609; 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=pWOvNuMYZRWoq2fhDorz4NqQl+9mD4GENe1+ycHRxRI=; b=x+6a2c8foxMIXAe6DUo0cXW5/Z6VurrODQVree8oA0mKuC0pGgLn6Uc3sUYZGm4V6I XtYZamyyOtolfL80hsYMlCRD6ao9U+FifrTFHUOvsldBw7qLUBL7SqVbYbVXngoeQsUM jf50Ve3ja8/VLS968PNbIVagLjShmJrOlp0QUlsPChtWFblQiVna8b1unuL7yp19lf4G 4p6IvRehuK6UDAzPGVgF+FooNiNB1VgnWCNKAdYoE+Y60HEMo/qWm4UB3bcIviOIMHwq Wx0eBGNHlKKyHeQdXiWR4x3m90FelmoOh5an9NcyrmM0rfcFWHo9gRKYFFmtYhj4ScrK RZAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505609; x=1685097609; 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=pWOvNuMYZRWoq2fhDorz4NqQl+9mD4GENe1+ycHRxRI=; b=YT+RMs071d2fEjmhnKHjwVh4/xYtONNW0N5ObWCvuXvT2+t9a5xM39snI5EEYSCDWe 4zJUsj5H4LYMRMOooTdGWABrIETevE/W37nPmVMdWka+/Ag+oy7rm3CCDgwCesi9f1oa 1nbnZfSvxseCFUA7cqeIYSiG78sAZH2G02mo2QHJAvig71o4aF0TuKq6lu7DPwTFWjEL iujeFJseEa/74O/xfhQ+ZbcGQFbQ63XG9adm3+EllZj5Z0mAqCQBZFiLsNLAWs84+xwg pxBQgTI4YdSGP+epBbDK+LqMTpelvYVTJbfJymEf0exomETgHcLBkm/DIM2Vspvzsyos ZWEA== X-Gm-Message-State: AAQBX9fu9LK9pciZRifEiLKxF0ftfrJ0wUC0KQN0AEdJH4yR1QAskgNT p0v8M/3NU7mHWSOXdr/pKR8lIg== X-Google-Smtp-Source: AKy350bEtIH//F+o1GMOrzMMHH8uMNzAm4PVz/rZpOV7GORp0CO1P18ca5eWt9IVIS+1iLiQc3j1Iw== X-Received: by 2002:a05:6a20:8e05:b0:f1:c0a1:803f with SMTP id y5-20020a056a208e0500b000f1c0a1803fmr29635929pzj.45.1682505609739; Wed, 26 Apr 2023 03:40:09 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.40.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:40:09 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 47/48] MAINTAINERS: Add a reviewer for network packet abstractions Date: Wed, 26 Apr 2023 19:37:15 +0900 Message-Id: <20230426103716.26279-48-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::531; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x531.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org I have made significant changes for network packet abstractions so add me as a reviewer. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daudé --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index c31d2279ab..8b2ef5943c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2214,6 +2214,7 @@ F: tests/qtest/fuzz-megasas-test.c Network packet abstractions M: Dmitry Fleytman +R: Akihiko Odaki S: Maintained F: include/net/eth.h F: net/eth.c From patchwork Wed Apr 26 10:37:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1774001 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20221208.gappssmtp.com header.i=@daynix-com.20221208.gappssmtp.com header.a=rsa-sha256 header.s=20221208 header.b=vGgetQFe; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wRJ1C3Jz23vF for ; Wed, 26 Apr 2023 20:42:02 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prcZP-00020a-1w; Wed, 26 Apr 2023 06:40:19 -0400 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 1prcZM-0001oG-1S for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:40:16 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prcZK-0003hj-Dm for qemu-devel@nongnu.org; Wed, 26 Apr 2023 06:40:15 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-63d4595d60fso42183195b3a.0 for ; Wed, 26 Apr 2023 03:40:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1682505613; x=1685097613; 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=ILeEC45O4cCOmKoGJEqXwqlDpUW0IKc6Vq1tRoBknx4=; b=vGgetQFezXfg4pWqt8w3rrAMHzjoDXNaBJ5gz21gDW0/HLKFAf+HEUBe2i79s8JviV uO2KuUHjYoOrYJdUZHS4iCSACJAGG2KNTmMw67DQdfQWz1kg0fKfZ1lC0LPclyouH4S6 nFE41ysefOygP+a96sTGLuLYTJRmdBoslJ+5cTTV4l6mVsM5Ab/B2G9UmRbgnyITytFp LN9b6ZnPNuZrjajnOR36oz7IAmHkrXIDv8QiCkBaALwEH3J4A94y3d/jN3VbCbGwKnjf hWRXNYvB5qqF4Ftg7vgcxETANWlnlKwitmqFuUJx5oabxpJFGMg3WsQtw56tSDrS7B3I x1dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682505613; x=1685097613; 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=ILeEC45O4cCOmKoGJEqXwqlDpUW0IKc6Vq1tRoBknx4=; b=hMuTNPCxTM0UsnBPLFhjBc9ECnQ7swOLE28B4vMIoli3C11Si0y3QSIA+qLyCjsxGZ klmaByt6dHxaY9SyQYDN8g+5e45KDc4lP+zmsv8i9N/IddKVBc2RcWOmDE88ktuQTdPv s2cA6rle+Nzc8szRBJcvDgCd0SjWsKAqCld9Zjz/Ohm4ukZJxiXZdERuOkYGsLsgG6rU pqUkzdmHW8usIalZsYsLtcJgvkW/nKNRbwHet/EKHVMigKGqr6OFvdwi98Wdv9B/yH3/ O53IjkE4CiUwP5FZixcZW7h0/KpzVwNOXO3lY9iA0e4T1A/+UhFwI19NJedOW5IY5rxl Lgfw== X-Gm-Message-State: AC+VfDw7L+PwALUbJOSj5pnn4nIyhsWTkAZaRdMjnczd5dCGgX4pDKoY 39bbI21uJ4/PY161pD8TA9OOfw== X-Google-Smtp-Source: ACHHUZ49yAjPsaOLc5slyb3urKzpNHkqmSkSKFiVXIvBvlvQrzEPzN5rYc8N5BOVNN8YrPbTjJ0UlA== X-Received: by 2002:a05:6a20:7490:b0:ee:9647:45fa with SMTP id p16-20020a056a20749000b000ee964745famr2392903pzd.20.1682505613278; Wed, 26 Apr 2023 03:40:13 -0700 (PDT) Received: from alarm.u-tokyo.ac.jp ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id m11-20020a63580b000000b0051322a5aa64sm9317919pgb.3.2023.04.26.03.40.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 03:40:12 -0700 (PDT) From: Akihiko Odaki To: Cc: Sriram Yagnaraman , Jason Wang , Dmitry Fleytman , "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , Laurent Vivier , Paolo Bonzini , qemu-devel@nongnu.org, Tomasz Dzieciol , Akihiko Odaki Subject: [PATCH v4 48/48] docs/system/devices/igb: Note igb is tested for DPDK Date: Wed, 26 Apr 2023 19:37:16 +0900 Message-Id: <20230426103716.26279-49-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426103716.26279-1-akihiko.odaki@daynix.com> References: <20230426103716.26279-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::42b; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Akihiko Odaki --- docs/system/devices/igb.rst | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/system/devices/igb.rst b/docs/system/devices/igb.rst index afe036dad2..60c10bf7c7 100644 --- a/docs/system/devices/igb.rst +++ b/docs/system/devices/igb.rst @@ -14,7 +14,8 @@ Limitations =========== This igb implementation was tested with Linux Test Project [2]_ and Windows HLK -[3]_ during the initial development. The command used when testing with LTP is: +[3]_ during the initial development. Later it was also tested with DPDK Test +Suite [4]_. The command used when testing with LTP is: .. code-block:: shell @@ -22,8 +23,8 @@ This igb implementation was tested with Linux Test Project [2]_ and Windows HLK Be aware that this implementation lacks many functionalities available with the actual hardware, and you may experience various failures if you try to use it -with a different operating system other than Linux and Windows or if you try -functionalities not covered by the tests. +with a different operating system other than DPDK, Linux, and Windows or if you +try functionalities not covered by the tests. Using igb ========= @@ -32,7 +33,7 @@ Using igb should be nothing different from using another network device. See :ref:`pcsys_005fnetwork` in general. However, you may also need to perform additional steps to activate SR-IOV -feature on your guest. For Linux, refer to [4]_. +feature on your guest. For Linux, refer to [5]_. Developing igb ============== @@ -68,4 +69,5 @@ References .. [1] https://www.intel.com/content/dam/www/public/us/en/documents/datasheets/82576eb-gigabit-ethernet-controller-datasheet.pdf .. [2] https://github.com/linux-test-project/ltp .. [3] https://learn.microsoft.com/en-us/windows-hardware/test/hlk/ -.. [4] https://docs.kernel.org/PCI/pci-iov-howto.html +.. [4] https://doc.dpdk.org/dts/gsg/ +.. [5] https://docs.kernel.org/PCI/pci-iov-howto.html