From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [PULL 03/24] e1000: remove old compatibility code
Date: Tue, 3 Oct 2023 10:30:20 +0200 [thread overview]
Message-ID: <20231003083042.110065-4-pbonzini@redhat.com> (raw)
In-Reply-To: <20231003083042.110065-1-pbonzini@redhat.com>
This code is not needed anymore in the supported machine types.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/net/e1000.c | 79 +++++++++++++++++---------------------------------
1 file changed, 27 insertions(+), 52 deletions(-)
diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index 093c2d45315..548bcabcbba 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -127,13 +127,9 @@ struct E1000State_st {
QEMUTimer *flush_queue_timer;
/* Compatibility flags for migration to/from qemu 1.3.0 and older */
-#define E1000_FLAG_AUTONEG_BIT 0
-#define E1000_FLAG_MIT_BIT 1
#define E1000_FLAG_MAC_BIT 2
#define E1000_FLAG_TSO_BIT 3
#define E1000_FLAG_VET_BIT 4
-#define E1000_FLAG_AUTONEG (1 << E1000_FLAG_AUTONEG_BIT)
-#define E1000_FLAG_MIT (1 << E1000_FLAG_MIT_BIT)
#define E1000_FLAG_MAC (1 << E1000_FLAG_MAC_BIT)
#define E1000_FLAG_TSO (1 << E1000_FLAG_TSO_BIT)
#define E1000_FLAG_VET (1 << E1000_FLAG_VET_BIT)
@@ -180,7 +176,7 @@ e1000_autoneg_done(E1000State *s)
static bool
have_autoneg(E1000State *s)
{
- return chkflag(AUTONEG) && (s->phy_reg[MII_BMCR] & MII_BMCR_AUTOEN);
+ return (s->phy_reg[MII_BMCR] & MII_BMCR_AUTOEN);
}
static void
@@ -308,35 +304,34 @@ set_interrupt_cause(E1000State *s, int index, uint32_t val)
if (s->mit_timer_on) {
return;
}
- if (chkflag(MIT)) {
- /* Compute the next mitigation delay according to pending
- * interrupts and the current values of RADV (provided
- * RDTR!=0), TADV and ITR.
- * Then rearm the timer.
- */
- mit_delay = 0;
- if (s->mit_ide &&
- (pending_ints & (E1000_ICR_TXQE | E1000_ICR_TXDW))) {
- mit_update_delay(&mit_delay, s->mac_reg[TADV] * 4);
- }
- if (s->mac_reg[RDTR] && (pending_ints & E1000_ICS_RXT0)) {
- mit_update_delay(&mit_delay, s->mac_reg[RADV] * 4);
- }
- mit_update_delay(&mit_delay, s->mac_reg[ITR]);
- /*
- * According to e1000 SPEC, the Ethernet controller guarantees
- * a maximum observable interrupt rate of 7813 interrupts/sec.
- * Thus if mit_delay < 500 then the delay should be set to the
- * minimum delay possible which is 500.
- */
- mit_delay = (mit_delay < 500) ? 500 : mit_delay;
-
- s->mit_timer_on = 1;
- timer_mod(s->mit_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
- mit_delay * 256);
- s->mit_ide = 0;
+ /* Compute the next mitigation delay according to pending
+ * interrupts and the current values of RADV (provided
+ * RDTR!=0), TADV and ITR.
+ * Then rearm the timer.
+ */
+ mit_delay = 0;
+ if (s->mit_ide &&
+ (pending_ints & (E1000_ICR_TXQE | E1000_ICR_TXDW))) {
+ mit_update_delay(&mit_delay, s->mac_reg[TADV] * 4);
}
+ if (s->mac_reg[RDTR] && (pending_ints & E1000_ICS_RXT0)) {
+ mit_update_delay(&mit_delay, s->mac_reg[RADV] * 4);
+ }
+ mit_update_delay(&mit_delay, s->mac_reg[ITR]);
+
+ /*
+ * According to e1000 SPEC, the Ethernet controller guarantees
+ * a maximum observable interrupt rate of 7813 interrupts/sec.
+ * Thus if mit_delay < 500 then the delay should be set to the
+ * minimum delay possible which is 500.
+ */
+ mit_delay = (mit_delay < 500) ? 500 : mit_delay;
+
+ s->mit_timer_on = 1;
+ timer_mod(s->mit_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
+ mit_delay * 256);
+ s->mit_ide = 0;
}
s->mit_irq_level = (pending_ints != 0);
@@ -1223,9 +1218,6 @@ enum { MAC_ACCESS_PARTIAL = 1, MAC_ACCESS_FLAG_NEEDED = 2 };
* n - flag needed
* p - partially implenented */
static const uint8_t mac_reg_access[0x8000] = {
- [RDTR] = markflag(MIT), [TADV] = markflag(MIT),
- [RADV] = markflag(MIT), [ITR] = markflag(MIT),
-
[IPAV] = markflag(MAC), [WUC] = markflag(MAC),
[IP6AT] = markflag(MAC), [IP4AT] = markflag(MAC),
[FFVT] = markflag(MAC), [WUPM] = markflag(MAC),
@@ -1394,11 +1386,6 @@ static int e1000_post_load(void *opaque, int version_id)
E1000State *s = opaque;
NetClientState *nc = qemu_get_queue(s->nic);
- if (!chkflag(MIT)) {
- s->mac_reg[ITR] = s->mac_reg[RDTR] = s->mac_reg[RADV] =
- s->mac_reg[TADV] = 0;
- s->mit_irq_level = false;
- }
s->mit_ide = 0;
s->mit_timer_on = true;
timer_mod(s->mit_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 1);
@@ -1432,13 +1419,6 @@ static int e1000_tx_tso_post_load(void *opaque, int version_id)
return 0;
}
-static bool e1000_mit_state_needed(void *opaque)
-{
- E1000State *s = opaque;
-
- return chkflag(MIT);
-}
-
static bool e1000_full_mac_needed(void *opaque)
{
E1000State *s = opaque;
@@ -1457,7 +1437,6 @@ static const VMStateDescription vmstate_e1000_mit_state = {
.name = "e1000/mit_state",
.version_id = 1,
.minimum_version_id = 1,
- .needed = e1000_mit_state_needed,
.fields = (VMStateField[]) {
VMSTATE_UINT32(mac_reg[RDTR], E1000State),
VMSTATE_UINT32(mac_reg[RADV], E1000State),
@@ -1699,10 +1678,6 @@ static void pci_e1000_realize(PCIDevice *pci_dev, Error **errp)
static Property e1000_properties[] = {
DEFINE_NIC_PROPERTIES(E1000State, conf),
- DEFINE_PROP_BIT("autonegotiation", E1000State,
- compat_flags, E1000_FLAG_AUTONEG_BIT, true),
- DEFINE_PROP_BIT("mitigation", E1000State,
- compat_flags, E1000_FLAG_MIT_BIT, true),
DEFINE_PROP_BIT("extra_mac_registers", E1000State,
compat_flags, E1000_FLAG_MAC_BIT, true),
DEFINE_PROP_BIT("migrate_tso_props", E1000State,
--
2.41.0
next prev parent reply other threads:[~2023-10-03 8:37 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-03 8:30 [PULL 00/24] Audio, build system, misc fixes for 2023-10-03 Paolo Bonzini
2023-10-03 8:30 ` [PULL 01/24] optionrom: Remove build-id section Paolo Bonzini
2023-10-03 10:04 ` Michael Tokarev
2023-10-03 8:30 ` [PULL 02/24] accel/kvm/kvm-all: Handle register access errors Paolo Bonzini
2023-10-03 8:30 ` Paolo Bonzini [this message]
2023-10-03 8:30 ` [PULL 04/24] pc: remove short_root_bus property Paolo Bonzini
2023-10-03 8:30 ` [PULL 05/24] make-release: do not ship dtc sources Paolo Bonzini
2023-10-03 8:30 ` [PULL 06/24] meson: clean up static_library keyword arguments Paolo Bonzini
2023-10-03 8:30 ` [PULL 07/24] Makefile: build plugins before running TCG tests Paolo Bonzini
2023-10-03 8:30 ` [PULL 08/24] esp: use correct type for esp_dma_enable() in sysbus_esp_gpio_demux() Paolo Bonzini
2023-10-03 8:30 ` [PULL 09/24] esp: restrict non-DMA transfer length to that of available data Paolo Bonzini
2023-10-03 8:30 ` [PULL 10/24] scsi-disk: ensure that FORMAT UNIT commands are terminated Paolo Bonzini
2023-10-03 8:30 ` [PULL 11/24] crypto: only include tls-cipher-suites in emulators Paolo Bonzini
2023-10-03 8:30 ` [PULL 12/24] ui/vnc: Require audiodev= to enable audio Paolo Bonzini
2023-10-03 8:30 ` [PULL 13/24] audio: Require AudioState in AUD_add_capture Paolo Bonzini
2023-10-03 8:30 ` [PULL 14/24] audio: allow returning an error from the driver init Paolo Bonzini
2023-10-03 8:30 ` [PULL 15/24] audio: return Error ** from audio_state_by_name Paolo Bonzini
2023-10-03 8:30 ` [PULL 16/24] audio: commonize voice initialization Paolo Bonzini
2023-10-03 8:30 ` [PULL 17/24] audio: simplify flow in audio_init Paolo Bonzini
2023-10-03 8:30 ` [PULL 18/24] audio: remove QEMU_AUDIO_* and -audio-help support Paolo Bonzini
2023-10-03 8:30 ` [PULL 19/24] Introduce machine property "audiodev" Paolo Bonzini
2023-10-03 8:30 ` [PULL 20/24] hw/arm: Support machine-default audiodev with fallback Paolo Bonzini
2023-10-03 8:30 ` [PULL 21/24] hw/ppc: " Paolo Bonzini
2023-10-03 8:30 ` [PULL 22/24] vt82c686 machines: " Paolo Bonzini
2023-10-03 8:30 ` [PULL 23/24] audio: propagate Error * out of audio_init Paolo Bonzini
2023-10-03 8:30 ` [PULL 24/24] audio: forbid default audiodev backend with -nodefaults Paolo Bonzini
2023-10-03 14:43 ` [PULL 00/24] Audio, build system, misc fixes for 2023-10-03 Stefan Hajnoczi
2023-10-03 15:36 ` Michael Tokarev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231003083042.110065-4-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).