mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
e1000: Move out code that will be reused in e1000e
Code that will be shared moved to a separate files. Signed-off-by: Dmitry Fleytman <dmitry.fleytman@ravellosystems.com> Signed-off-by: Leonid Bloch <leonid.bloch@ravellosystems.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
committed by
Jason Wang
parent
06e7fa0ad7
commit
093454e21d
@@ -980,6 +980,11 @@ F: hw/acpi/nvdimm.c
|
||||
F: hw/mem/nvdimm.c
|
||||
F: include/hw/mem/nvdimm.h
|
||||
|
||||
e1000x
|
||||
M: Dmitry Fleytman <dmitry@daynix.com>
|
||||
S: Maintained
|
||||
F: hw/net/e1000x*
|
||||
|
||||
Subsystems
|
||||
----------
|
||||
Audio
|
||||
|
||||
@@ -6,7 +6,7 @@ common-obj-$(CONFIG_NE2000_PCI) += ne2000.o
|
||||
common-obj-$(CONFIG_EEPRO100_PCI) += eepro100.o
|
||||
common-obj-$(CONFIG_PCNET_PCI) += pcnet-pci.o
|
||||
common-obj-$(CONFIG_PCNET_COMMON) += pcnet.o
|
||||
common-obj-$(CONFIG_E1000_PCI) += e1000.o
|
||||
common-obj-$(CONFIG_E1000_PCI) += e1000.o e1000x_common.o
|
||||
common-obj-$(CONFIG_RTL8139_PCI) += rtl8139.o
|
||||
common-obj-$(CONFIG_VMXNET3_PCI) += net_tx_pkt.o net_rx_pkt.o
|
||||
common-obj-$(CONFIG_VMXNET3_PCI) += vmxnet3.o
|
||||
|
||||
+95
-322
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,267 @@
|
||||
/*
|
||||
* QEMU e1000(e) emulation - shared code
|
||||
*
|
||||
* Copyright (c) 2008 Qumranet
|
||||
*
|
||||
* Based on work done by:
|
||||
* Nir Peleg, Tutis Systems Ltd. for Qumranet Inc.
|
||||
* Copyright (c) 2007 Dan Aloni
|
||||
* Copyright (c) 2004 Antony T Curtis
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "hw/hw.h"
|
||||
#include "hw/pci/pci.h"
|
||||
#include "net/net.h"
|
||||
|
||||
#include "e1000x_common.h"
|
||||
|
||||
#include "trace.h"
|
||||
|
||||
bool e1000x_rx_ready(PCIDevice *d, uint32_t *mac)
|
||||
{
|
||||
bool link_up = mac[STATUS] & E1000_STATUS_LU;
|
||||
bool rx_enabled = mac[RCTL] & E1000_RCTL_EN;
|
||||
bool pci_master = d->config[PCI_COMMAND] & PCI_COMMAND_MASTER;
|
||||
|
||||
if (!link_up || !rx_enabled || !pci_master) {
|
||||
trace_e1000x_rx_can_recv_disabled(link_up, rx_enabled, pci_master);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool e1000x_is_vlan_packet(const uint8_t *buf, uint16_t vet)
|
||||
{
|
||||
uint16_t eth_proto = be16_to_cpup((uint16_t *)(buf + 12));
|
||||
bool res = (eth_proto == vet);
|
||||
|
||||
trace_e1000x_vlan_is_vlan_pkt(res, eth_proto, vet);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
bool e1000x_rx_group_filter(uint32_t *mac, const uint8_t *buf)
|
||||
{
|
||||
static const int mta_shift[] = { 4, 3, 2, 0 };
|
||||
uint32_t f, ra[2], *rp, rctl = mac[RCTL];
|
||||
|
||||
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, 6)) {
|
||||
trace_e1000x_rx_flt_ucast_match((int)(rp - mac - RA) / 2,
|
||||
MAC_ARG(buf));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
trace_e1000x_rx_flt_ucast_mismatch(MAC_ARG(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;
|
||||
}
|
||||
|
||||
trace_e1000x_rx_flt_inexact_mismatch(MAC_ARG(buf),
|
||||
(rctl >> E1000_RCTL_MO_SHIFT) & 3,
|
||||
f >> 5,
|
||||
mac[MTA + (f >> 5)]);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool e1000x_hw_rx_enabled(uint32_t *mac)
|
||||
{
|
||||
if (!(mac[STATUS] & E1000_STATUS_LU)) {
|
||||
trace_e1000x_rx_link_down(mac[STATUS]);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(mac[RCTL] & E1000_RCTL_EN)) {
|
||||
trace_e1000x_rx_disabled(mac[RCTL]);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool e1000x_is_oversized(uint32_t *mac, size_t size)
|
||||
{
|
||||
/* this is the size past which hardware will
|
||||
drop packets when setting LPE=0 */
|
||||
static const int maximum_ethernet_vlan_size = 1522;
|
||||
/* this is the size past which hardware will
|
||||
drop packets when setting LPE=1 */
|
||||
static const int maximum_ethernet_lpe_size = 16384;
|
||||
|
||||
if ((size > maximum_ethernet_lpe_size ||
|
||||
(size > maximum_ethernet_vlan_size
|
||||
&& !(mac[RCTL] & E1000_RCTL_LPE)))
|
||||
&& !(mac[RCTL] & E1000_RCTL_SBP)) {
|
||||
e1000x_inc_reg_if_not_full(mac, ROC);
|
||||
trace_e1000x_rx_oversized(size);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void e1000x_restart_autoneg(uint32_t *mac, uint16_t *phy, QEMUTimer *timer)
|
||||
{
|
||||
e1000x_update_regs_on_link_down(mac, phy);
|
||||
trace_e1000x_link_negotiation_start();
|
||||
timer_mod(timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 500);
|
||||
}
|
||||
|
||||
void e1000x_reset_mac_addr(NICState *nic, uint32_t *mac_regs,
|
||||
uint8_t *mac_addr)
|
||||
{
|
||||
int i;
|
||||
|
||||
mac_regs[RA] = 0;
|
||||
mac_regs[RA + 1] = E1000_RAH_AV;
|
||||
for (i = 0; i < 4; i++) {
|
||||
mac_regs[RA] |= mac_addr[i] << (8 * i);
|
||||
mac_regs[RA + 1] |=
|
||||
(i < 2) ? mac_addr[i + 4] << (8 * i) : 0;
|
||||
}
|
||||
|
||||
qemu_format_nic_info_str(qemu_get_queue(nic), mac_addr);
|
||||
trace_e1000x_mac_indicate(MAC_ARG(mac_addr));
|
||||
}
|
||||
|
||||
void e1000x_update_regs_on_autoneg_done(uint32_t *mac, uint16_t *phy)
|
||||
{
|
||||
e1000x_update_regs_on_link_up(mac, phy);
|
||||
phy[PHY_LP_ABILITY] |= MII_LPAR_LPACK;
|
||||
phy[PHY_STATUS] |= MII_SR_AUTONEG_COMPLETE;
|
||||
trace_e1000x_link_negotiation_done();
|
||||
}
|
||||
|
||||
void
|
||||
e1000x_core_prepare_eeprom(uint16_t *eeprom,
|
||||
const uint16_t *templ,
|
||||
uint32_t templ_size,
|
||||
uint16_t dev_id,
|
||||
const uint8_t *macaddr)
|
||||
{
|
||||
uint16_t checksum = 0;
|
||||
int i;
|
||||
|
||||
memmove(eeprom, templ, templ_size);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
eeprom[i] = (macaddr[2 * i + 1] << 8) | macaddr[2 * i];
|
||||
}
|
||||
|
||||
eeprom[11] = eeprom[13] = dev_id;
|
||||
|
||||
for (i = 0; i < EEPROM_CHECKSUM_REG; i++) {
|
||||
checksum += eeprom[i];
|
||||
}
|
||||
|
||||
checksum = (uint16_t) EEPROM_SUM - checksum;
|
||||
|
||||
eeprom[EEPROM_CHECKSUM_REG] = checksum;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
e1000x_rxbufsize(uint32_t rctl)
|
||||
{
|
||||
rctl &= E1000_RCTL_BSEX | E1000_RCTL_SZ_16384 | E1000_RCTL_SZ_8192 |
|
||||
E1000_RCTL_SZ_4096 | E1000_RCTL_SZ_2048 | E1000_RCTL_SZ_1024 |
|
||||
E1000_RCTL_SZ_512 | E1000_RCTL_SZ_256;
|
||||
switch (rctl) {
|
||||
case E1000_RCTL_BSEX | E1000_RCTL_SZ_16384:
|
||||
return 16384;
|
||||
case E1000_RCTL_BSEX | E1000_RCTL_SZ_8192:
|
||||
return 8192;
|
||||
case E1000_RCTL_BSEX | E1000_RCTL_SZ_4096:
|
||||
return 4096;
|
||||
case E1000_RCTL_SZ_1024:
|
||||
return 1024;
|
||||
case E1000_RCTL_SZ_512:
|
||||
return 512;
|
||||
case E1000_RCTL_SZ_256:
|
||||
return 256;
|
||||
}
|
||||
return 2048;
|
||||
}
|
||||
|
||||
void
|
||||
e1000x_update_rx_total_stats(uint32_t *mac,
|
||||
size_t data_size,
|
||||
size_t data_fcs_size)
|
||||
{
|
||||
static const int PRCregs[6] = { PRC64, PRC127, PRC255, PRC511,
|
||||
PRC1023, PRC1522 };
|
||||
|
||||
e1000x_increase_size_stats(mac, PRCregs, data_fcs_size);
|
||||
e1000x_inc_reg_if_not_full(mac, TPR);
|
||||
mac[GPRC] = mac[TPR];
|
||||
/* TOR - Total Octets Received:
|
||||
* This register includes bytes received in a packet from the <Destination
|
||||
* Address> field through the <CRC> field, inclusively.
|
||||
* Always include FCS length (4) in size.
|
||||
*/
|
||||
e1000x_grow_8reg_if_not_full(mac, TORL, data_size + 4);
|
||||
mac[GORCL] = mac[TORL];
|
||||
mac[GORCH] = mac[TORH];
|
||||
}
|
||||
|
||||
void
|
||||
e1000x_increase_size_stats(uint32_t *mac, const int *size_regs, int size)
|
||||
{
|
||||
if (size > 1023) {
|
||||
e1000x_inc_reg_if_not_full(mac, size_regs[5]);
|
||||
} else if (size > 511) {
|
||||
e1000x_inc_reg_if_not_full(mac, size_regs[4]);
|
||||
} else if (size > 255) {
|
||||
e1000x_inc_reg_if_not_full(mac, size_regs[3]);
|
||||
} else if (size > 127) {
|
||||
e1000x_inc_reg_if_not_full(mac, size_regs[2]);
|
||||
} else if (size > 64) {
|
||||
e1000x_inc_reg_if_not_full(mac, size_regs[1]);
|
||||
} else if (size == 64) {
|
||||
e1000x_inc_reg_if_not_full(mac, size_regs[0]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
e1000x_read_tx_ctx_descr(struct e1000_context_desc *d,
|
||||
e1000x_txd_props *props)
|
||||
{
|
||||
uint32_t op = le32_to_cpu(d->cmd_and_length);
|
||||
|
||||
props->ipcss = d->lower_setup.ip_fields.ipcss;
|
||||
props->ipcso = d->lower_setup.ip_fields.ipcso;
|
||||
props->ipcse = le16_to_cpu(d->lower_setup.ip_fields.ipcse);
|
||||
props->tucss = d->upper_setup.tcp_fields.tucss;
|
||||
props->tucso = d->upper_setup.tcp_fields.tucso;
|
||||
props->tucse = le16_to_cpu(d->upper_setup.tcp_fields.tucse);
|
||||
props->paylen = op & 0xfffff;
|
||||
props->hdr_len = d->tcp_seg_setup.fields.hdr_len;
|
||||
props->mss = le16_to_cpu(d->tcp_seg_setup.fields.mss);
|
||||
props->ip = (op & E1000_TXD_CMD_IP) ? 1 : 0;
|
||||
props->tcp = (op & E1000_TXD_CMD_TCP) ? 1 : 0;
|
||||
props->tse = (op & E1000_TXD_CMD_TSE) ? 1 : 0;
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
/*
|
||||
* QEMU e1000(e) emulation - shared code
|
||||
*
|
||||
* Copyright (c) 2008 Qumranet
|
||||
*
|
||||
* Based on work done by:
|
||||
* Nir Peleg, Tutis Systems Ltd. for Qumranet Inc.
|
||||
* Copyright (c) 2007 Dan Aloni
|
||||
* Copyright (c) 2004 Antony T Curtis
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include "e1000_regs.h"
|
||||
|
||||
#define defreg(x) x = (E1000_##x >> 2)
|
||||
enum {
|
||||
defreg(CTRL), defreg(EECD), defreg(EERD), defreg(GPRC),
|
||||
defreg(GPTC), defreg(ICR), defreg(ICS), defreg(IMC),
|
||||
defreg(IMS), defreg(LEDCTL), defreg(MANC), defreg(MDIC),
|
||||
defreg(MPC), defreg(PBA), defreg(RCTL), defreg(RDBAH0),
|
||||
defreg(RDBAL0), defreg(RDH0), defreg(RDLEN0), defreg(RDT0),
|
||||
defreg(STATUS), defreg(SWSM), defreg(TCTL), defreg(TDBAH),
|
||||
defreg(TDBAL), defreg(TDH), defreg(TDLEN), defreg(TDT),
|
||||
defreg(TDLEN1), defreg(TDBAL1), defreg(TDBAH1), defreg(TDH1),
|
||||
defreg(TDT1), defreg(TORH), defreg(TORL), defreg(TOTH),
|
||||
defreg(TOTL), defreg(TPR), defreg(TPT), defreg(TXDCTL),
|
||||
defreg(WUFC), defreg(RA), defreg(MTA), defreg(CRCERRS),
|
||||
defreg(VFTA), defreg(VET), defreg(RDTR), defreg(RADV),
|
||||
defreg(TADV), defreg(ITR), defreg(SCC), defreg(ECOL),
|
||||
defreg(MCC), defreg(LATECOL), defreg(COLC), defreg(DC),
|
||||
defreg(TNCRS), defreg(SEC), defreg(CEXTERR), defreg(RLEC),
|
||||
defreg(XONRXC), defreg(XONTXC), defreg(XOFFRXC), defreg(XOFFTXC),
|
||||
defreg(FCRUC), defreg(AIT), defreg(TDFH), defreg(TDFT),
|
||||
defreg(TDFHS), defreg(TDFTS), defreg(TDFPC), defreg(WUC),
|
||||
defreg(WUS), defreg(POEMB), defreg(PBS), defreg(RDFH),
|
||||
defreg(RDFT), defreg(RDFHS), defreg(RDFTS), defreg(RDFPC),
|
||||
defreg(PBM), defreg(IPAV), defreg(IP4AT), defreg(IP6AT),
|
||||
defreg(WUPM), defreg(FFLT), defreg(FFMT), defreg(FFVT),
|
||||
defreg(TARC0), defreg(TARC1), defreg(IAM), defreg(EXTCNF_CTRL),
|
||||
defreg(GCR), defreg(TIMINCA), defreg(EIAC), defreg(CTRL_EXT),
|
||||
defreg(IVAR), defreg(MFUTP01), defreg(MFUTP23), defreg(MANC2H),
|
||||
defreg(MFVAL), defreg(MDEF), defreg(FACTPS), defreg(FTFT),
|
||||
defreg(RUC), defreg(ROC), defreg(RFC), defreg(RJC),
|
||||
defreg(PRC64), defreg(PRC127), defreg(PRC255), defreg(PRC511),
|
||||
defreg(PRC1023), defreg(PRC1522), defreg(PTC64), defreg(PTC127),
|
||||
defreg(PTC255), defreg(PTC511), defreg(PTC1023), defreg(PTC1522),
|
||||
defreg(GORCL), defreg(GORCH), defreg(GOTCL), defreg(GOTCH),
|
||||
defreg(RNBC), defreg(BPRC), defreg(MPRC), defreg(RFCTL),
|
||||
defreg(PSRCTL), defreg(MPTC), defreg(BPTC), defreg(TSCTFC),
|
||||
defreg(IAC), defreg(MGTPRC), defreg(MGTPDC), defreg(MGTPTC),
|
||||
defreg(TSCTC), defreg(RXCSUM), defreg(FUNCTAG), defreg(GSCL_1),
|
||||
defreg(GSCL_2), defreg(GSCL_3), defreg(GSCL_4), defreg(GSCN_0),
|
||||
defreg(GSCN_1), defreg(GSCN_2), defreg(GSCN_3), defreg(GCR2),
|
||||
defreg(RAID), defreg(RSRPD), defreg(TIDV), defreg(EITR),
|
||||
defreg(MRQC), defreg(RETA), defreg(RSSRK), defreg(RDBAH1),
|
||||
defreg(RDBAL1), defreg(RDLEN1), defreg(RDH1), defreg(RDT1),
|
||||
defreg(PBACLR), defreg(FCAL), defreg(FCAH), defreg(FCT),
|
||||
defreg(FCRTH), defreg(FCRTL), defreg(FCTTV), defreg(FCRTV),
|
||||
defreg(FLA), defreg(EEWR), defreg(FLOP), defreg(FLOL),
|
||||
defreg(FLSWCTL), defreg(FLSWCNT), defreg(RXDCTL), defreg(RXDCTL1),
|
||||
defreg(MAVTV0), defreg(MAVTV1), defreg(MAVTV2), defreg(MAVTV3),
|
||||
defreg(TXSTMPL), defreg(TXSTMPH), defreg(SYSTIML), defreg(SYSTIMH),
|
||||
defreg(RXCFGL), defreg(RXUDP), defreg(TIMADJL), defreg(TIMADJH),
|
||||
defreg(RXSTMPH), defreg(RXSTMPL), defreg(RXSATRL), defreg(RXSATRH),
|
||||
defreg(FLASHT), defreg(TIPG), defreg(RDH), defreg(RDT),
|
||||
defreg(RDLEN), defreg(RDBAH), defreg(RDBAL),
|
||||
defreg(TXDCTL1),
|
||||
defreg(FLSWDATA),
|
||||
defreg(CTRL_DUP),
|
||||
defreg(EXTCNF_SIZE),
|
||||
defreg(EEMNGCTL),
|
||||
defreg(EEMNGDATA),
|
||||
defreg(FLMNGCTL),
|
||||
defreg(FLMNGDATA),
|
||||
defreg(FLMNGCNT),
|
||||
defreg(TSYNCRXCTL),
|
||||
defreg(TSYNCTXCTL),
|
||||
|
||||
/* Aliases */
|
||||
defreg(RDH0_A), defreg(RDT0_A), defreg(RDTR_A), defreg(RDFH_A),
|
||||
defreg(RDFT_A), defreg(TDH_A), defreg(TDT_A), defreg(TIDV_A),
|
||||
defreg(TDFH_A), defreg(TDFT_A), defreg(RA_A), defreg(RDBAL0_A),
|
||||
defreg(TDBAL_A), defreg(TDLEN_A), defreg(VFTA_A), defreg(RDLEN0_A),
|
||||
defreg(FCRTL_A), defreg(FCRTH_A)
|
||||
};
|
||||
|
||||
static inline void
|
||||
e1000x_inc_reg_if_not_full(uint32_t *mac, int index)
|
||||
{
|
||||
if (mac[index] != 0xffffffff) {
|
||||
mac[index]++;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
e1000x_grow_8reg_if_not_full(uint32_t *mac, int index, int size)
|
||||
{
|
||||
uint64_t sum = mac[index] | (uint64_t)mac[index + 1] << 32;
|
||||
|
||||
if (sum + size < sum) {
|
||||
sum = ~0ULL;
|
||||
} else {
|
||||
sum += size;
|
||||
}
|
||||
mac[index] = sum;
|
||||
mac[index + 1] = sum >> 32;
|
||||
}
|
||||
|
||||
static inline int
|
||||
e1000x_vlan_enabled(uint32_t *mac)
|
||||
{
|
||||
return ((mac[CTRL] & E1000_CTRL_VME) != 0);
|
||||
}
|
||||
|
||||
static inline int
|
||||
e1000x_is_vlan_txd(uint32_t txd_lower)
|
||||
{
|
||||
return ((txd_lower & E1000_TXD_CMD_VLE) != 0);
|
||||
}
|
||||
|
||||
static inline int
|
||||
e1000x_vlan_rx_filter_enabled(uint32_t *mac)
|
||||
{
|
||||
return ((mac[RCTL] & E1000_RCTL_VFE) != 0);
|
||||
}
|
||||
|
||||
static inline int
|
||||
e1000x_fcs_len(uint32_t *mac)
|
||||
{
|
||||
/* FCS aka Ethernet CRC-32. We don't get it from backends and can't
|
||||
* fill it in, just pad descriptor length by 4 bytes unless guest
|
||||
* told us to strip it off the packet. */
|
||||
return (mac[RCTL] & E1000_RCTL_SECRC) ? 0 : 4;
|
||||
}
|
||||
|
||||
static inline void
|
||||
e1000x_update_regs_on_link_down(uint32_t *mac, uint16_t *phy)
|
||||
{
|
||||
mac[STATUS] &= ~E1000_STATUS_LU;
|
||||
phy[PHY_STATUS] &= ~MII_SR_LINK_STATUS;
|
||||
phy[PHY_STATUS] &= ~MII_SR_AUTONEG_COMPLETE;
|
||||
phy[PHY_LP_ABILITY] &= ~MII_LPAR_LPACK;
|
||||
}
|
||||
|
||||
static inline void
|
||||
e1000x_update_regs_on_link_up(uint32_t *mac, uint16_t *phy)
|
||||
{
|
||||
mac[STATUS] |= E1000_STATUS_LU;
|
||||
phy[PHY_STATUS] |= MII_SR_LINK_STATUS;
|
||||
}
|
||||
|
||||
void e1000x_update_rx_total_stats(uint32_t *mac,
|
||||
size_t data_size,
|
||||
size_t data_fcs_size);
|
||||
|
||||
void e1000x_core_prepare_eeprom(uint16_t *eeprom,
|
||||
const uint16_t *templ,
|
||||
uint32_t templ_size,
|
||||
uint16_t dev_id,
|
||||
const uint8_t *macaddr);
|
||||
|
||||
uint32_t e1000x_rxbufsize(uint32_t rctl);
|
||||
|
||||
bool e1000x_rx_ready(PCIDevice *d, uint32_t *mac);
|
||||
|
||||
bool e1000x_is_vlan_packet(const uint8_t *buf, uint16_t vet);
|
||||
|
||||
bool e1000x_rx_group_filter(uint32_t *mac, const uint8_t *buf);
|
||||
|
||||
bool e1000x_hw_rx_enabled(uint32_t *mac);
|
||||
|
||||
bool e1000x_is_oversized(uint32_t *mac, size_t size);
|
||||
|
||||
void e1000x_restart_autoneg(uint32_t *mac, uint16_t *phy, QEMUTimer *timer);
|
||||
|
||||
void e1000x_reset_mac_addr(NICState *nic, uint32_t *mac_regs,
|
||||
uint8_t *mac_addr);
|
||||
|
||||
void e1000x_update_regs_on_autoneg_done(uint32_t *mac, uint16_t *phy);
|
||||
|
||||
void e1000x_increase_size_stats(uint32_t *mac, const int *size_regs, int size);
|
||||
|
||||
typedef struct e1000x_txd_props {
|
||||
unsigned char sum_needed;
|
||||
uint8_t ipcss;
|
||||
uint8_t ipcso;
|
||||
uint16_t ipcse;
|
||||
uint8_t tucss;
|
||||
uint8_t tucso;
|
||||
uint16_t tucse;
|
||||
uint32_t paylen;
|
||||
uint8_t hdr_len;
|
||||
uint16_t mss;
|
||||
int8_t ip;
|
||||
int8_t tcp;
|
||||
bool tse;
|
||||
bool cptse;
|
||||
} e1000x_txd_props;
|
||||
|
||||
void e1000x_read_tx_ctx_descr(struct e1000_context_desc *d,
|
||||
e1000x_txd_props *props);
|
||||
@@ -1954,3 +1954,16 @@ net_rx_pkt_rss_ip6(void) "Calculating IPv6 RSS hash"
|
||||
net_rx_pkt_rss_ip6_ex(void) "Calculating IPv6/EX RSS hash"
|
||||
net_rx_pkt_rss_hash(size_t rss_length, uint32_t rss_hash) "RSS hash for %zu bytes: 0x%X"
|
||||
net_rx_pkt_rss_add_chunk(void* ptr, size_t size, size_t input_offset) "Add RSS chunk %p, %zu bytes, RSS input offset %zu bytes"
|
||||
|
||||
# hw/net/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_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] %x"
|
||||
e1000x_rx_link_down(uint32_t status_reg) "Received packet dropped because the link is down STATUS = %u"
|
||||
e1000x_rx_disabled(uint32_t rctl_reg) "Received packet dropped because receive is disabled RCTL = %u"
|
||||
e1000x_rx_oversized(size_t size) "Received packet dropped because it was oversized (%zu bytes)"
|
||||
e1000x_mac_indicate(uint8_t b0, uint8_t b1, uint8_t b2, uint8_t b3, uint8_t b4, uint8_t b5) "Indicating MAC to guest: %02x:%02x:%02x:%02x:%02x:%02x"
|
||||
e1000x_link_negotiation_start(void) "Start link auto negotiation"
|
||||
e1000x_link_negotiation_done(void) "Auto negotiation is completed"
|
||||
|
||||
Reference in New Issue
Block a user