From nobody Fri May 17 10:13:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1622017676; cv=none; d=zohomail.com; s=zohoarc; b=LNzpeGtTBloyrh95h45TSpqA40vyYvjzZCQUTC8LdM3dmSaePAlt1cPj3I3hLE2kDZyJEiJ0ouTH3m9UBeMflZSLD3eKVg+3MQYmEAQjMUDFjhDLj+npmrL3uRxAJ3gWTUOKnAjJWijR/wBblTQRudVYsefR1qLf74DWxPLTwHE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622017676; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tu3xj+P5G+P+qA7gb1FXdnImzi6Dqow/Zz0ymRZgnAo=; b=PHzqExE95ieHBmL6OBsc9f+xY92aludinZ5AtsKuGY+Ifdjs0f3Z9nHcU+oZF1IqtUDEwTrryFjq9zRFBnjioulPTCg1+ex1hTShWTVoLWckN2AwQBHjc8MWlUoHnyBf9RO/ps0K35n506eNT6V+UOkE0UUKSI5TnjRluBJz6Lg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1622017676924961.5864508167158; Wed, 26 May 2021 01:27:56 -0700 (PDT) Received: from localhost ([::1]:40612 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llotO-0008Lv-T7 for importer@patchew.org; Wed, 26 May 2021 04:27:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46004) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lloqo-0002ov-7s for qemu-devel@nongnu.org; Wed, 26 May 2021 04:25:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:53863) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lloqm-0006ww-Bg for qemu-devel@nongnu.org; Wed, 26 May 2021 04:25:13 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-21-Ak6aAR6hM5-geOTY6I2olg-1; Wed, 26 May 2021 04:24:59 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 422BA6A2A0; Wed, 26 May 2021 08:24:58 +0000 (UTC) Received: from jason-ThinkPad-T430s.redhat.com (ovpn-13-159.pek2.redhat.com [10.72.13.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id 328FD60875; Wed, 26 May 2021 08:24:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622017511; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tu3xj+P5G+P+qA7gb1FXdnImzi6Dqow/Zz0ymRZgnAo=; b=NGvyyy1IVaFF5+Q5HYgA4u34JtFimmDBfo0pIeN7OqtGW0MKKBmQUC1JrbDWh8XN6BQheY ZV/goCqOGc9XmcjVlCLwHI6DB6dlZhasyj07wQvMx7kargUATzUyHZ+mr2FLO7Ox+W2ogz reme6xYbSfYoOn5dT3F8Ajg+3i5GURU= X-MC-Unique: Ak6aAR6hM5-geOTY6I2olg-1 From: Jason Wang To: peter.maydell@linaro.org Subject: [PULL 1/3] hw/net/imx_fec: return 0xffff when accessing non-existing PHY Date: Wed, 26 May 2021 16:24:50 +0800 Message-Id: <1622017492-7770-2-git-send-email-jasowang@redhat.com> In-Reply-To: <1622017492-7770-1-git-send-email-jasowang@redhat.com> References: <1622017492-7770-1-git-send-email-jasowang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jasowang@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=jasowang@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.371, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jason Wang , qemu-devel@nongnu.org, Guenter Roeck , Jean-Christophe Dubois Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Guenter Roeck If a PHY does not exist, attempts to read from it should return 0xffff. Otherwise the Linux kernel will believe that a PHY is there and select the non-existing PHY. This in turn will result in network errors later on since the real PHY is not selected or configured. Since reading from or writing to a non-existing PHY is not an emulation error, replace guest error messages with traces. Fixes: 461c51ad4275 ("Add a phy-num property to the i.MX FEC emulator") Cc: Jean-Christophe Dubois Reviewed-by: Bin Meng Tested-by: Bin Meng Reviewed-by: Philippe Mathieu-Daud=E8=8C=85 Signed-off-by: Guenter Roeck Signed-off-by: Jason Wang --- hw/net/imx_fec.c | 8 +++----- hw/net/trace-events | 2 ++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c index f03450c..9c7035b 100644 --- a/hw/net/imx_fec.c +++ b/hw/net/imx_fec.c @@ -283,9 +283,8 @@ static uint32_t imx_phy_read(IMXFECState *s, int reg) uint32_t phy =3D reg / 32; =20 if (phy !=3D s->phy_num) { - qemu_log_mask(LOG_GUEST_ERROR, "[%s.phy]%s: Bad phy num %u\n", - TYPE_IMX_FEC, __func__, phy); - return 0; + trace_imx_phy_read_num(phy, s->phy_num); + return 0xffff; } =20 reg %=3D 32; @@ -345,8 +344,7 @@ static void imx_phy_write(IMXFECState *s, int reg, uint= 32_t val) uint32_t phy =3D reg / 32; =20 if (phy !=3D s->phy_num) { - qemu_log_mask(LOG_GUEST_ERROR, "[%s.phy]%s: Bad phy num %u\n", - TYPE_IMX_FEC, __func__, phy); + trace_imx_phy_write_num(phy, s->phy_num); return; } =20 diff --git a/hw/net/trace-events b/hw/net/trace-events index baf25ff..78e8566 100644 --- a/hw/net/trace-events +++ b/hw/net/trace-events @@ -414,7 +414,9 @@ i82596_channel_attention(void *s) "%p: Received CHANNEL= ATTENTION" =20 # imx_fec.c imx_phy_read(uint32_t val, int phy, int reg) "0x%04"PRIx32" <=3D phy[%d].r= eg[%d]" +imx_phy_read_num(int phy, int configured) "read request from unconfigured = phy %d (configured %d)" imx_phy_write(uint32_t val, int phy, int reg) "0x%04"PRIx32" =3D> phy[%d].= reg[%d]" +imx_phy_write_num(int phy, int configured) "write request to unconfigured = phy %d (configured %d)" imx_phy_update_link(const char *s) "%s" imx_phy_reset(void) "" imx_fec_read_bd(uint64_t addr, int flags, int len, int data) "tx_bd 0x%"PR= Ix64" flags 0x%04x len %d data 0x%08x" --=20 2.7.4 From nobody Fri May 17 10:13:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1622017591; cv=none; d=zohomail.com; s=zohoarc; b=PpbjakiqmGou5jP81cT+9aH6JtiouVQcanoPHKqbYftPkDI46pnHvLG/2KLx/vp1s2CkBjEvlkzTBtR0bR9pLZgmKuhHJ+MfpTcLA5AA7UweR/2+rmAv62prWTY9DJodAkF4SOrHrBvJVuhMGwpD9P4m4oEnyrgMTJxNaVI/1uE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622017591; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=NGxnL58cZ7J0FpLILJVl5iGWIs/UZR1ZMuS4cpTk2M0=; b=aFH3qtVJWEtz0ETada7acQtjLZNOf0mJUo/86p4YcWmk77rpoQUeu/sOdceCdUYWUqYTGfJXXskyVvuI918quXIQIGEOSHFP0wQJG+5SyYkIdUmSzyvlBon5A/3PqdgtFwxuyp5ZKfp4x07keXbS/dz+uUdhyeQ1tI6q9ng54RU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1622017591470576.232384988556; Wed, 26 May 2021 01:26:31 -0700 (PDT) Received: from localhost ([::1]:35724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llos2-00054H-6j for importer@patchew.org; Wed, 26 May 2021 04:26:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45956) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lloqj-0002gg-5u for qemu-devel@nongnu.org; Wed, 26 May 2021 04:25:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:21842) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lloqg-0006ri-CD for qemu-devel@nongnu.org; Wed, 26 May 2021 04:25:08 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-245-oKAXSK2YNj-qCJfZ7Fuovg-1; Wed, 26 May 2021 04:25:01 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6675C180FD77; Wed, 26 May 2021 08:25:00 +0000 (UTC) Received: from jason-ThinkPad-T430s.redhat.com (ovpn-13-159.pek2.redhat.com [10.72.13.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id C984C6A046; Wed, 26 May 2021 08:24:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622017505; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type:in-reply-to:in-reply-to: references:references; bh=NGxnL58cZ7J0FpLILJVl5iGWIs/UZR1ZMuS4cpTk2M0=; b=eygNGUm4n4kI7ZMna0cXQwP7PUIthsVdfV+iOhear+PZHfMTLaWSNXimGQ8QDBJ/4kT54G SHY4vcA2yCEuzr8UfMJCX443zACUhCImkiCxQlfOtF1la/yGMcYP9fGKFkfQHujK+1lXZ9 FyBikv5B7MJbqTnABBCAPssBTP9QWrg= X-MC-Unique: oKAXSK2YNj-qCJfZ7Fuovg-1 From: Jason Wang To: peter.maydell@linaro.org Subject: [PULL 2/3] virtio-net: failover: add missing remove_migration_state_change_notifier() Date: Wed, 26 May 2021 16:24:51 +0800 Message-Id: <1622017492-7770-3-git-send-email-jasowang@redhat.com> In-Reply-To: <1622017492-7770-1-git-send-email-jasowang@redhat.com> References: <1622017492-7770-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jasowang@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=jasowang@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.371, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Jason Wang , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Laurent Vivier In the failover case configuration, virtio_net_device_realize() uses an add_migration_state_change_notifier() to add a state notifier, but this notifier is not removed by the unrealize function when the virtio-net card is unplugged. If the card is unplugged and a migration is started, the notifier is called and as it is not valid anymore QEMU crashes. This patch fixes the problem by adding the remove_migration_state_change_notifier() in virtio_net_device_unrealize(). The problem can be reproduced with: $ qemu-system-x86_64 -enable-kvm -m 1g -M q35 \ -device pcie-root-port,slot=3D4,id=3Droot1 \ -device pcie-root-port,slot=3D5,id=3Droot2 \ -device virtio-net-pci,id=3Dnet1,mac=3D52:54:00:6f:55:cc,failover=3Don,= bus=3Droot1 \ -monitor stdio disk.qcow2 (qemu) device_del net1 (qemu) migrate "exec:gzip -c > STATEFILE.gz" Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault. 0x0000000000000000 in ?? () (gdb) bt #0 0x0000000000000000 in () #1 0x0000555555d726d7 in notifier_list_notify (...) at .../util/notify.c:39 #2 0x0000555555842c1a in migrate_fd_connect (...) at .../migration/migration.c:3975 #3 0x0000555555950f7d in migration_channel_connect (...) error@entry=3D0x0) at .../migration/channel.c:107 #4 0x0000555555910922 in exec_start_outgoing_migration (...) at .../migration/exec.c:42 Reported-by: Igor Mammedov Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Michael S. Tsirkin Signed-off-by: Laurent Vivier Signed-off-by: Jason Wang --- hw/net/virtio-net.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 66b9ff4..914051f 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -3373,6 +3373,7 @@ static void virtio_net_device_unrealize(DeviceState *= dev) =20 if (n->failover) { device_listener_unregister(&n->primary_listener); + remove_migration_state_change_notifier(&n->migration_state); } =20 max_queues =3D n->multiqueue ? n->max_queues : 1; --=20 2.7.4 From nobody Fri May 17 10:13:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1622017598; cv=none; d=zohomail.com; s=zohoarc; b=Fdq6dogwxObdIX7ERwkBnfCn/EzNPakSn2DqFn60tBlp4Sy8AS8teWNUc3t5GzLnO7uBJb0iECurr2wkNeU2EXOu2u/oaWN/BBLoagGzUE3Q+zjdOHHVdtA8ZbesnOukEsrmGG8LS2gGhG10qRPwZsJJrdBNXmcZasDnOdG9b1M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622017598; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=HPynzdeO8BdRoN5xpoq7ZjQTmKMhksHSADXDDdIjYWc=; b=lR040A9hgCb7lVkAC5rkzSRt/wWaL3yAjA66lWHCjnE9IFtS7NeWN22aG8K1bzEvwB/E6IXwdDGYoa1qP6AR+LE2oLfQXFl/L3VdFABct19s8pfktJWG42+CQIWGjvDFm9cHnVXkft3VMzZpgnCtVGZXwVXjQcydLkHvmmTkfIs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1622017598168460.4501065972745; Wed, 26 May 2021 01:26:38 -0700 (PDT) Received: from localhost ([::1]:36374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llos9-0005Y9-41 for importer@patchew.org; Wed, 26 May 2021 04:26:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46006) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lloqp-0002rs-3d for qemu-devel@nongnu.org; Wed, 26 May 2021 04:25:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:50781) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lloqm-0006xb-UH for qemu-devel@nongnu.org; Wed, 26 May 2021 04:25:14 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-101-jJbJsnL-P_29IPSJVgllpQ-1; Wed, 26 May 2021 04:25:09 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 91781108BD12; Wed, 26 May 2021 08:25:02 +0000 (UTC) Received: from jason-ThinkPad-T430s.redhat.com (ovpn-13-159.pek2.redhat.com [10.72.13.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id E6DF4687FF; Wed, 26 May 2021 08:25:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622017512; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type:in-reply-to:in-reply-to: references:references; bh=HPynzdeO8BdRoN5xpoq7ZjQTmKMhksHSADXDDdIjYWc=; b=btMeADQnBNvs5IY3EoDOYgHoafPZWxQAw+G/XQ1EObWG7qf+IIp0aiCEtui9yLNqwr5rUi ZJKNgL+668+h5sFcBdmGn4gFgg1S32WBLwRESEEzatMzwBu6xxFyGZaL39kyQ7wprMx8u/ cmHY0RBYqQAS3VYgPMvFGGE8aQcVCRU= X-MC-Unique: jJbJsnL-P_29IPSJVgllpQ-1 From: Jason Wang To: peter.maydell@linaro.org Subject: [PULL 3/3] tap-bsd: Remove special casing for older OpenBSD releases Date: Wed, 26 May 2021 16:24:52 +0800 Message-Id: <1622017492-7770-4-git-send-email-jasowang@redhat.com> In-Reply-To: <1622017492-7770-1-git-send-email-jasowang@redhat.com> References: <1622017492-7770-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jasowang@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=jasowang@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.371, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jason Wang , qemu-devel@nongnu.org, Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Brad Smith OpenBSD added support for tap(4) 10 releases ago. Remove the special casing for older releases. Signed-off-by: Brad Smith Signed-off-by: Jason Wang --- net/tap-bsd.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/net/tap-bsd.c b/net/tap-bsd.c index 77aaf67..59dfcdf 100644 --- a/net/tap-bsd.c +++ b/net/tap-bsd.c @@ -35,10 +35,6 @@ #include #endif =20 -#if defined(__OpenBSD__) -#include -#endif - #ifndef __FreeBSD__ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required, int mq_required, Error **errp) @@ -59,11 +55,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hd= r, if (*ifname) { snprintf(dname, sizeof dname, "/dev/%s", ifname); } else { -#if defined(__OpenBSD__) && OpenBSD < 201605 - snprintf(dname, sizeof dname, "/dev/tun%d", i); -#else snprintf(dname, sizeof dname, "/dev/tap%d", i); -#endif } TFR(fd =3D open(dname, O_RDWR)); if (fd >=3D 0) { --=20 2.7.4