qemu/include/hw/net/ftgmac100.h
Cédric Le Goater cd679a76a0 ftgmac100: compute maximum frame size depending on the protocol
The maximum frame size includes the CRC and depends if a VLAN tag is
inserted or not. Adjust the frame size limit in the transmit handler
using on the FTGMAC100State buffer size and in the receive handler use
the packet protocol.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20180530061711.23673-2-clg@kaod.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-06-08 13:15:32 +01:00

70 lines
1.3 KiB
C

/*
* Faraday FTGMAC100 Gigabit Ethernet
*
* Copyright (C) 2016-2017, IBM Corporation.
*
* This code is licensed under the GPL version 2 or later. See the
* COPYING file in the top-level directory.
*/
#ifndef FTGMAC100_H
#define FTGMAC100_H
#define TYPE_FTGMAC100 "ftgmac100"
#define FTGMAC100(obj) OBJECT_CHECK(FTGMAC100State, (obj), TYPE_FTGMAC100)
#include "hw/sysbus.h"
#include "net/net.h"
/*
* Max frame size for the receiving buffer
*/
#define FTGMAC100_MAX_FRAME_SIZE 9220
typedef struct FTGMAC100State {
/*< private >*/
SysBusDevice parent_obj;
/*< public >*/
NICState *nic;
NICConf conf;
qemu_irq irq;
MemoryRegion iomem;
uint8_t frame[FTGMAC100_MAX_FRAME_SIZE];
uint32_t irq_state;
uint32_t isr;
uint32_t ier;
uint32_t rx_enabled;
uint32_t rx_ring;
uint32_t rx_descriptor;
uint32_t tx_ring;
uint32_t tx_descriptor;
uint32_t math[2];
uint32_t rbsr;
uint32_t itc;
uint32_t aptcr;
uint32_t dblac;
uint32_t revr;
uint32_t fear1;
uint32_t tpafcr;
uint32_t maccr;
uint32_t phycr;
uint32_t phydata;
uint32_t fcr;
uint32_t phy_status;
uint32_t phy_control;
uint32_t phy_advertise;
uint32_t phy_int;
uint32_t phy_int_mask;
bool aspeed;
uint32_t txdes0_edotr;
uint32_t rxdes0_edorr;
} FTGMAC100State;
#endif