e1000e: Fix the code style

igb implementation first starts off by copying e1000e code. Correct the
code style before that.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
Akihiko Odaki 2023-02-23 19:19:45 +09:00 committed by Jason Wang
parent ee59483267
commit 0eadd56bf5
5 changed files with 168 additions and 158 deletions

View File

@ -808,11 +808,12 @@ receive_filter(E1000State *s, const uint8_t *buf, int size)
if (e1000x_is_vlan_packet(buf, le16_to_cpu(s->mac_reg[VET])) && if (e1000x_is_vlan_packet(buf, le16_to_cpu(s->mac_reg[VET])) &&
e1000x_vlan_rx_filter_enabled(s->mac_reg)) { e1000x_vlan_rx_filter_enabled(s->mac_reg)) {
uint16_t vid = lduw_be_p(buf + 14); uint16_t vid = lduw_be_p(buf + 14);
uint32_t vfta = ldl_le_p((uint32_t*)(s->mac_reg + VFTA) + uint32_t vfta = ldl_le_p((uint32_t *)(s->mac_reg + VFTA) +
((vid >> 5) & 0x7f)); ((vid >> 5) & 0x7f));
if ((vfta & (1 << (vid & 0x1f))) == 0) if ((vfta & (1 << (vid & 0x1f))) == 0) {
return 0; return 0;
} }
}
if (!isbcast && !ismcast && (rctl & E1000_RCTL_UPE)) { /* promiscuous ucast */ if (!isbcast && !ismcast && (rctl & E1000_RCTL_UPE)) { /* promiscuous ucast */
return 1; return 1;
@ -1221,15 +1222,15 @@ static const readops macreg_readops[] = {
[AIT] = mac_low16_read, [AIT] = mac_low16_read,
[CRCERRS ... MPC] = &mac_readreg, [CRCERRS ... MPC] = &mac_readreg,
[IP6AT ... IP6AT+3] = &mac_readreg, [IP4AT ... IP4AT+6] = &mac_readreg, [IP6AT ... IP6AT + 3] = &mac_readreg, [IP4AT ... IP4AT + 6] = &mac_readreg,
[FFLT ... FFLT+6] = &mac_low11_read, [FFLT ... FFLT + 6] = &mac_low11_read,
[RA ... RA+31] = &mac_readreg, [RA ... RA + 31] = &mac_readreg,
[WUPM ... WUPM+31] = &mac_readreg, [WUPM ... WUPM + 31] = &mac_readreg,
[MTA ... MTA+127] = &mac_readreg, [MTA ... MTA + 127] = &mac_readreg,
[VFTA ... VFTA+127] = &mac_readreg, [VFTA ... VFTA + 127] = &mac_readreg,
[FFMT ... FFMT+254] = &mac_low4_read, [FFMT ... FFMT + 254] = &mac_low4_read,
[FFVT ... FFVT+254] = &mac_readreg, [FFVT ... FFVT + 254] = &mac_readreg,
[PBM ... PBM+16383] = &mac_readreg, [PBM ... PBM + 16383] = &mac_readreg,
}; };
enum { NREADOPS = ARRAY_SIZE(macreg_readops) }; enum { NREADOPS = ARRAY_SIZE(macreg_readops) };
@ -1252,14 +1253,14 @@ static const writeops macreg_writeops[] = {
[RDTR] = set_16bit, [RADV] = set_16bit, [TADV] = set_16bit, [RDTR] = set_16bit, [RADV] = set_16bit, [TADV] = set_16bit,
[ITR] = set_16bit, [ITR] = set_16bit,
[IP6AT ... IP6AT+3] = &mac_writereg, [IP4AT ... IP4AT+6] = &mac_writereg, [IP6AT ... IP6AT + 3] = &mac_writereg, [IP4AT ... IP4AT + 6] = &mac_writereg,
[FFLT ... FFLT+6] = &mac_writereg, [FFLT ... FFLT + 6] = &mac_writereg,
[RA ... RA+31] = &mac_writereg, [RA ... RA + 31] = &mac_writereg,
[WUPM ... WUPM+31] = &mac_writereg, [WUPM ... WUPM + 31] = &mac_writereg,
[MTA ... MTA+127] = &mac_writereg, [MTA ... MTA + 127] = &mac_writereg,
[VFTA ... VFTA+127] = &mac_writereg, [VFTA ... VFTA + 127] = &mac_writereg,
[FFMT ... FFMT+254] = &mac_writereg, [FFVT ... FFVT+254] = &mac_writereg, [FFMT ... FFMT + 254] = &mac_writereg, [FFVT ... FFVT + 254] = &mac_writereg,
[PBM ... PBM+16383] = &mac_writereg, [PBM ... PBM + 16383] = &mac_writereg,
}; };
enum { NWRITEOPS = ARRAY_SIZE(macreg_writeops) }; enum { NWRITEOPS = ARRAY_SIZE(macreg_writeops) };

View File

@ -1,37 +1,37 @@
/* /*
* QEMU INTEL 82574 GbE NIC emulation * QEMU INTEL 82574 GbE NIC emulation
* *
* Software developer's manuals: * Software developer's manuals:
* http://www.intel.com/content/dam/doc/datasheet/82574l-gbe-controller-datasheet.pdf * http://www.intel.com/content/dam/doc/datasheet/82574l-gbe-controller-datasheet.pdf
* *
* Copyright (c) 2015 Ravello Systems LTD (http://ravellosystems.com) * Copyright (c) 2015 Ravello Systems LTD (http://ravellosystems.com)
* Developed by Daynix Computing LTD (http://www.daynix.com) * Developed by Daynix Computing LTD (http://www.daynix.com)
* *
* Authors: * Authors:
* Dmitry Fleytman <dmitry@daynix.com> * Dmitry Fleytman <dmitry@daynix.com>
* Leonid Bloch <leonid@daynix.com> * Leonid Bloch <leonid@daynix.com>
* Yan Vugenfirer <yan@daynix.com> * Yan Vugenfirer <yan@daynix.com>
* *
* Based on work done by: * Based on work done by:
* Nir Peleg, Tutis Systems Ltd. for Qumranet Inc. * Nir Peleg, Tutis Systems Ltd. for Qumranet Inc.
* Copyright (c) 2008 Qumranet * Copyright (c) 2008 Qumranet
* Based on work done by: * Based on work done by:
* Copyright (c) 2007 Dan Aloni * Copyright (c) 2007 Dan Aloni
* Copyright (c) 2004 Antony T Curtis * Copyright (c) 2004 Antony T Curtis
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/units.h" #include "qemu/units.h"
@ -239,9 +239,9 @@ static NetClientInfo net_e1000e_info = {
}; };
/* /*
* EEPROM (NVM) contents documented in Table 36, section 6.1 * EEPROM (NVM) contents documented in Table 36, section 6.1
* and generally 6.1.2 Software accessed words. * and generally 6.1.2 Software accessed words.
*/ */
static const uint16_t e1000e_eeprom_template[64] = { static const uint16_t e1000e_eeprom_template[64] = {
/* Address | Compat. | ImVer | Compat. */ /* Address | Compat. | ImVer | Compat. */
0x0000, 0x0000, 0x0000, 0x0420, 0xf746, 0x2010, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0420, 0xf746, 0x2010, 0xffff, 0xffff,

View File

@ -1,37 +1,37 @@
/* /*
* Core code for QEMU e1000e emulation * Core code for QEMU e1000e emulation
* *
* Software developer's manuals: * Software developer's manuals:
* http://www.intel.com/content/dam/doc/datasheet/82574l-gbe-controller-datasheet.pdf * http://www.intel.com/content/dam/doc/datasheet/82574l-gbe-controller-datasheet.pdf
* *
* Copyright (c) 2015 Ravello Systems LTD (http://ravellosystems.com) * Copyright (c) 2015 Ravello Systems LTD (http://ravellosystems.com)
* Developed by Daynix Computing LTD (http://www.daynix.com) * Developed by Daynix Computing LTD (http://www.daynix.com)
* *
* Authors: * Authors:
* Dmitry Fleytman <dmitry@daynix.com> * Dmitry Fleytman <dmitry@daynix.com>
* Leonid Bloch <leonid@daynix.com> * Leonid Bloch <leonid@daynix.com>
* Yan Vugenfirer <yan@daynix.com> * Yan Vugenfirer <yan@daynix.com>
* *
* Based on work done by: * Based on work done by:
* Nir Peleg, Tutis Systems Ltd. for Qumranet Inc. * Nir Peleg, Tutis Systems Ltd. for Qumranet Inc.
* Copyright (c) 2008 Qumranet * Copyright (c) 2008 Qumranet
* Based on work done by: * Based on work done by:
* Copyright (c) 2007 Dan Aloni * Copyright (c) 2007 Dan Aloni
* Copyright (c) 2004 Antony T Curtis * Copyright (c) 2004 Antony T Curtis
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/log.h" #include "qemu/log.h"
@ -49,8 +49,9 @@
#include "trace.h" #include "trace.h"
#define E1000E_MIN_XITR (500) /* No more then 7813 interrupts per /* No more then 7813 interrupts per second according to spec 10.2.4.2 */
second according to spec 10.2.4.2 */ #define E1000E_MIN_XITR (500)
#define E1000E_MAX_TX_FRAGS (64) #define E1000E_MAX_TX_FRAGS (64)
static inline void static inline void
@ -282,14 +283,18 @@ e1000e_intrmgr_delay_rx_causes(E1000ECore *core, uint32_t *causes)
core->delayed_causes |= *causes & delayable_causes; core->delayed_causes |= *causes & delayable_causes;
*causes &= ~delayable_causes; *causes &= ~delayable_causes;
/* Check if delayed RX interrupts disabled by client /*
or if there are causes that cannot be delayed */ * Check if delayed RX interrupts disabled by client
* or if there are causes that cannot be delayed
*/
if ((rdtr == 0) || (*causes != 0)) { if ((rdtr == 0) || (*causes != 0)) {
return false; return false;
} }
/* Check if delayed RX ACK interrupts disabled by client /*
and there is an ACK packet received */ * Check if delayed RX ACK interrupts disabled by client
* and there is an ACK packet received
*/
if ((raid == 0) && (core->delayed_causes & E1000_ICR_ACK)) { if ((raid == 0) && (core->delayed_causes & E1000_ICR_ACK)) {
return false; return false;
} }
@ -2515,7 +2520,8 @@ e1000e_set_icr(E1000ECore *core, int index, uint32_t val)
} }
icr = core->mac[ICR] & ~val; icr = core->mac[ICR] & ~val;
/* Windows driver expects that the "receive overrun" bit and other /*
* Windows driver expects that the "receive overrun" bit and other
* ones to be cleared when the "Other" bit (#24) is cleared. * ones to be cleared when the "Other" bit (#24) is cleared.
*/ */
icr = (val & E1000_ICR_OTHER) ? (icr & ~E1000_ICR_OTHER_CAUSES) : icr; icr = (val & E1000_ICR_OTHER) ? (icr & ~E1000_ICR_OTHER_CAUSES) : icr;
@ -3269,10 +3275,12 @@ enum { E1000E_NWRITEOPS = ARRAY_SIZE(e1000e_macreg_writeops) };
enum { MAC_ACCESS_PARTIAL = 1 }; enum { MAC_ACCESS_PARTIAL = 1 };
/* The array below combines alias offsets of the index values for the /*
* The array below combines alias offsets of the index values for the
* MAC registers that have aliases, with the indication of not fully * MAC registers that have aliases, with the indication of not fully
* implemented registers (lowest bit). This combination is possible * implemented registers (lowest bit). This combination is possible
* because all of the offsets are even. */ * because all of the offsets are even.
*/
static const uint16_t mac_reg_access[E1000E_MAC_SIZE] = { static const uint16_t mac_reg_access[E1000E_MAC_SIZE] = {
/* Alias index offsets */ /* Alias index offsets */
[FCRTL_A] = 0x07fe, [FCRTH_A] = 0x0802, [FCRTL_A] = 0x07fe, [FCRTH_A] = 0x0802,
@ -3557,7 +3565,8 @@ e1000e_core_post_load(E1000ECore *core)
{ {
NetClientState *nc = qemu_get_queue(core->owner_nic); NetClientState *nc = qemu_get_queue(core->owner_nic);
/* nc.link_down can't be migrated, so infer link_down according /*
* nc.link_down can't be migrated, so infer link_down according
* to link status bit in core.mac[STATUS]. * to link status bit in core.mac[STATUS].
*/ */
nc->link_down = (core->mac[STATUS] & E1000_STATUS_LU) == 0; nc->link_down = (core->mac[STATUS] & E1000_STATUS_LU) == 0;

View File

@ -1,37 +1,37 @@
/* /*
* Core code for QEMU e1000e emulation * Core code for QEMU e1000e emulation
* *
* Software developer's manuals: * Software developer's manuals:
* http://www.intel.com/content/dam/doc/datasheet/82574l-gbe-controller-datasheet.pdf * http://www.intel.com/content/dam/doc/datasheet/82574l-gbe-controller-datasheet.pdf
* *
* Copyright (c) 2015 Ravello Systems LTD (http://ravellosystems.com) * Copyright (c) 2015 Ravello Systems LTD (http://ravellosystems.com)
* Developed by Daynix Computing LTD (http://www.daynix.com) * Developed by Daynix Computing LTD (http://www.daynix.com)
* *
* Authors: * Authors:
* Dmitry Fleytman <dmitry@daynix.com> * Dmitry Fleytman <dmitry@daynix.com>
* Leonid Bloch <leonid@daynix.com> * Leonid Bloch <leonid@daynix.com>
* Yan Vugenfirer <yan@daynix.com> * Yan Vugenfirer <yan@daynix.com>
* *
* Based on work done by: * Based on work done by:
* Nir Peleg, Tutis Systems Ltd. for Qumranet Inc. * Nir Peleg, Tutis Systems Ltd. for Qumranet Inc.
* Copyright (c) 2008 Qumranet * Copyright (c) 2008 Qumranet
* Based on work done by: * Based on work done by:
* Copyright (c) 2007 Dan Aloni * Copyright (c) 2007 Dan Aloni
* Copyright (c) 2004 Antony T Curtis * Copyright (c) 2004 Antony T Curtis
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef HW_NET_E1000E_CORE_H #ifndef HW_NET_E1000E_CORE_H
#define HW_NET_E1000E_CORE_H #define HW_NET_E1000E_CORE_H

View File

@ -1,26 +1,26 @@
/* /*
* QEMU e1000(e) emulation - shared code * QEMU e1000(e) emulation - shared code
* *
* Copyright (c) 2008 Qumranet * Copyright (c) 2008 Qumranet
* *
* Based on work done by: * Based on work done by:
* Nir Peleg, Tutis Systems Ltd. for Qumranet Inc. * Nir Peleg, Tutis Systems Ltd. for Qumranet Inc.
* Copyright (c) 2007 Dan Aloni * Copyright (c) 2007 Dan Aloni
* Copyright (c) 2004 Antony T Curtis * Copyright (c) 2004 Antony T Curtis
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef HW_NET_E1000X_COMMON_H #ifndef HW_NET_E1000X_COMMON_H
#define HW_NET_E1000X_COMMON_H #define HW_NET_E1000X_COMMON_H