-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1 iQEcBAABAgAGBQJWREdzAAoJEO8Ells5jWIRI18H/0CEDVwj7AJHLEpAv07hX2iS jfq6Osgj5hDChv43+66Clz3owog3m9NfPKWxBMvIw5c/Q1mFvNuxZcUaVOzX2dT4 E+IwIsZxXOANIGPYtCxOhARz1zNSDxJxgYPMVuIDZ+uZVJqYeCjdduMGzgy8wt8H qiquUCI2sktg97AntZqzp8iWfZZIN5w6uNbf3FvgwIffWDxGRPt8wY6dlwgIpsx2 uFd9PMwtj7lJyV9guy36FdrS7MhVTCF5/5GIerPj2nN1ByJp9vu5InzPAlmZNRSZ KxKcBnmkLsnT3nDN86ZS6ajDyjeEgWSVdrQS9MHDURfinADuuqjbJkhME/UhG+g= =vRNP -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging # gpg: Signature made Thu 12 Nov 2015 08:01:55 GMT using RSA key ID 398D6211 # gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@redhat.com>" # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 215D 46F4 8246 689E C77F 3562 EF04 965B 398D 6211 * remotes/jasowang/tags/net-pull-request: net: netmap: use error_setg() helpers in place of error_report() net: netmap: Fix compilation issue e1000: Introducing backward compatibility command line parameter e1000: Implementing various counters e1000: Fixing the packet address filtering procedure e1000: Fixing the received/transmitted octets' counters e1000: Fixing the received/transmitted packets' counters e1000: Trivial implementation of various MAC registers e1000: Introduced an array to control the access to the MAC registers e1000: Add support for migrating the entire MAC registers' array e1000: Cosmetic and alignment fixes slirp: Fix type casts and format strings in debug code Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
17e50a72a3
474
hw/net/e1000.c
474
hw/net/e1000.c
|
@ -37,24 +37,26 @@
|
||||||
|
|
||||||
#include "e1000_regs.h"
|
#include "e1000_regs.h"
|
||||||
|
|
||||||
|
static const uint8_t bcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
||||||
|
|
||||||
#define E1000_DEBUG
|
#define E1000_DEBUG
|
||||||
|
|
||||||
#ifdef E1000_DEBUG
|
#ifdef E1000_DEBUG
|
||||||
enum {
|
enum {
|
||||||
DEBUG_GENERAL, DEBUG_IO, DEBUG_MMIO, DEBUG_INTERRUPT,
|
DEBUG_GENERAL, DEBUG_IO, DEBUG_MMIO, DEBUG_INTERRUPT,
|
||||||
DEBUG_RX, DEBUG_TX, DEBUG_MDIC, DEBUG_EEPROM,
|
DEBUG_RX, DEBUG_TX, DEBUG_MDIC, DEBUG_EEPROM,
|
||||||
DEBUG_UNKNOWN, DEBUG_TXSUM, DEBUG_TXERR, DEBUG_RXERR,
|
DEBUG_UNKNOWN, DEBUG_TXSUM, DEBUG_TXERR, DEBUG_RXERR,
|
||||||
DEBUG_RXFILTER, DEBUG_PHY, DEBUG_NOTYET,
|
DEBUG_RXFILTER, DEBUG_PHY, DEBUG_NOTYET,
|
||||||
};
|
};
|
||||||
#define DBGBIT(x) (1<<DEBUG_##x)
|
#define DBGBIT(x) (1<<DEBUG_##x)
|
||||||
static int debugflags = DBGBIT(TXERR) | DBGBIT(GENERAL);
|
static int debugflags = DBGBIT(TXERR) | DBGBIT(GENERAL);
|
||||||
|
|
||||||
#define DBGOUT(what, fmt, ...) do { \
|
#define DBGOUT(what, fmt, ...) do { \
|
||||||
if (debugflags & DBGBIT(what)) \
|
if (debugflags & DBGBIT(what)) \
|
||||||
fprintf(stderr, "e1000: " fmt, ## __VA_ARGS__); \
|
fprintf(stderr, "e1000: " fmt, ## __VA_ARGS__); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#else
|
#else
|
||||||
#define DBGOUT(what, fmt, ...) do {} while (0)
|
#define DBGOUT(what, fmt, ...) do {} while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define IOPORT_SIZE 0x40
|
#define IOPORT_SIZE 0x40
|
||||||
|
@ -118,7 +120,7 @@ typedef struct E1000State_st {
|
||||||
} tx;
|
} tx;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
uint32_t val_in; // shifted in from guest driver
|
uint32_t val_in; /* shifted in from guest driver */
|
||||||
uint16_t bitnum_in;
|
uint16_t bitnum_in;
|
||||||
uint16_t bitnum_out;
|
uint16_t bitnum_out;
|
||||||
uint16_t reading;
|
uint16_t reading;
|
||||||
|
@ -135,11 +137,15 @@ typedef struct E1000State_st {
|
||||||
/* Compatibility flags for migration to/from qemu 1.3.0 and older */
|
/* Compatibility flags for migration to/from qemu 1.3.0 and older */
|
||||||
#define E1000_FLAG_AUTONEG_BIT 0
|
#define E1000_FLAG_AUTONEG_BIT 0
|
||||||
#define E1000_FLAG_MIT_BIT 1
|
#define E1000_FLAG_MIT_BIT 1
|
||||||
|
#define E1000_FLAG_MAC_BIT 2
|
||||||
#define E1000_FLAG_AUTONEG (1 << E1000_FLAG_AUTONEG_BIT)
|
#define E1000_FLAG_AUTONEG (1 << E1000_FLAG_AUTONEG_BIT)
|
||||||
#define E1000_FLAG_MIT (1 << E1000_FLAG_MIT_BIT)
|
#define E1000_FLAG_MIT (1 << E1000_FLAG_MIT_BIT)
|
||||||
|
#define E1000_FLAG_MAC (1 << E1000_FLAG_MAC_BIT)
|
||||||
uint32_t compat_flags;
|
uint32_t compat_flags;
|
||||||
} E1000State;
|
} E1000State;
|
||||||
|
|
||||||
|
#define chkflag(x) (s->compat_flags & E1000_FLAG_##x)
|
||||||
|
|
||||||
typedef struct E1000BaseClass {
|
typedef struct E1000BaseClass {
|
||||||
PCIDeviceClass parent_class;
|
PCIDeviceClass parent_class;
|
||||||
uint16_t phy_id2;
|
uint16_t phy_id2;
|
||||||
|
@ -155,20 +161,36 @@ typedef struct E1000BaseClass {
|
||||||
#define E1000_DEVICE_GET_CLASS(obj) \
|
#define E1000_DEVICE_GET_CLASS(obj) \
|
||||||
OBJECT_GET_CLASS(E1000BaseClass, (obj), TYPE_E1000_BASE)
|
OBJECT_GET_CLASS(E1000BaseClass, (obj), TYPE_E1000_BASE)
|
||||||
|
|
||||||
#define defreg(x) x = (E1000_##x>>2)
|
#define defreg(x) x = (E1000_##x>>2)
|
||||||
enum {
|
enum {
|
||||||
defreg(CTRL), defreg(EECD), defreg(EERD), defreg(GPRC),
|
defreg(CTRL), defreg(EECD), defreg(EERD), defreg(GPRC),
|
||||||
defreg(GPTC), defreg(ICR), defreg(ICS), defreg(IMC),
|
defreg(GPTC), defreg(ICR), defreg(ICS), defreg(IMC),
|
||||||
defreg(IMS), defreg(LEDCTL), defreg(MANC), defreg(MDIC),
|
defreg(IMS), defreg(LEDCTL), defreg(MANC), defreg(MDIC),
|
||||||
defreg(MPC), defreg(PBA), defreg(RCTL), defreg(RDBAH),
|
defreg(MPC), defreg(PBA), defreg(RCTL), defreg(RDBAH),
|
||||||
defreg(RDBAL), defreg(RDH), defreg(RDLEN), defreg(RDT),
|
defreg(RDBAL), defreg(RDH), defreg(RDLEN), defreg(RDT),
|
||||||
defreg(STATUS), defreg(SWSM), defreg(TCTL), defreg(TDBAH),
|
defreg(STATUS), defreg(SWSM), defreg(TCTL), defreg(TDBAH),
|
||||||
defreg(TDBAL), defreg(TDH), defreg(TDLEN), defreg(TDT),
|
defreg(TDBAL), defreg(TDH), defreg(TDLEN), defreg(TDT),
|
||||||
defreg(TORH), defreg(TORL), defreg(TOTH), defreg(TOTL),
|
defreg(TORH), defreg(TORL), defreg(TOTH), defreg(TOTL),
|
||||||
defreg(TPR), defreg(TPT), defreg(TXDCTL), defreg(WUFC),
|
defreg(TPR), defreg(TPT), defreg(TXDCTL), defreg(WUFC),
|
||||||
defreg(RA), defreg(MTA), defreg(CRCERRS),defreg(VFTA),
|
defreg(RA), defreg(MTA), defreg(CRCERRS), defreg(VFTA),
|
||||||
defreg(VET), defreg(RDTR), defreg(RADV), defreg(TADV),
|
defreg(VET), defreg(RDTR), defreg(RADV), defreg(TADV),
|
||||||
defreg(ITR),
|
defreg(ITR), defreg(FCRUC), defreg(TDFH), defreg(TDFT),
|
||||||
|
defreg(TDFHS), defreg(TDFTS), defreg(TDFPC), defreg(RDFH),
|
||||||
|
defreg(RDFT), defreg(RDFHS), defreg(RDFTS), defreg(RDFPC),
|
||||||
|
defreg(IPAV), defreg(WUC), defreg(WUS), defreg(AIT),
|
||||||
|
defreg(IP6AT), defreg(IP4AT), defreg(FFLT), defreg(FFMT),
|
||||||
|
defreg(FFVT), defreg(WUPM), defreg(PBM), 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(RFC), defreg(RJC), defreg(RNBC),
|
||||||
|
defreg(TSCTFC), defreg(MGTPRC), defreg(MGTPDC), defreg(MGTPTC),
|
||||||
|
defreg(RUC), defreg(ROC), defreg(GORCL), defreg(GORCH),
|
||||||
|
defreg(GOTCL), defreg(GOTCH), defreg(BPRC), defreg(MPRC),
|
||||||
|
defreg(TSCTC), 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(MPTC), defreg(BPTC)
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -193,8 +215,7 @@ e1000_link_up(E1000State *s)
|
||||||
static bool
|
static bool
|
||||||
have_autoneg(E1000State *s)
|
have_autoneg(E1000State *s)
|
||||||
{
|
{
|
||||||
return (s->compat_flags & E1000_FLAG_AUTONEG) &&
|
return chkflag(AUTONEG) && (s->phy_reg[PHY_CTRL] & MII_CR_AUTO_NEG_EN);
|
||||||
(s->phy_reg[PHY_CTRL] & MII_CR_AUTO_NEG_EN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -226,18 +247,18 @@ enum { NPHYWRITEOPS = ARRAY_SIZE(phyreg_writeops) };
|
||||||
|
|
||||||
enum { PHY_R = 1, PHY_W = 2, PHY_RW = PHY_R | PHY_W };
|
enum { PHY_R = 1, PHY_W = 2, PHY_RW = PHY_R | PHY_W };
|
||||||
static const char phy_regcap[0x20] = {
|
static const char phy_regcap[0x20] = {
|
||||||
[PHY_STATUS] = PHY_R, [M88E1000_EXT_PHY_SPEC_CTRL] = PHY_RW,
|
[PHY_STATUS] = PHY_R, [M88E1000_EXT_PHY_SPEC_CTRL] = PHY_RW,
|
||||||
[PHY_ID1] = PHY_R, [M88E1000_PHY_SPEC_CTRL] = PHY_RW,
|
[PHY_ID1] = PHY_R, [M88E1000_PHY_SPEC_CTRL] = PHY_RW,
|
||||||
[PHY_CTRL] = PHY_RW, [PHY_1000T_CTRL] = PHY_RW,
|
[PHY_CTRL] = PHY_RW, [PHY_1000T_CTRL] = PHY_RW,
|
||||||
[PHY_LP_ABILITY] = PHY_R, [PHY_1000T_STATUS] = PHY_R,
|
[PHY_LP_ABILITY] = PHY_R, [PHY_1000T_STATUS] = PHY_R,
|
||||||
[PHY_AUTONEG_ADV] = PHY_RW, [M88E1000_RX_ERR_CNTR] = PHY_R,
|
[PHY_AUTONEG_ADV] = PHY_RW, [M88E1000_RX_ERR_CNTR] = PHY_R,
|
||||||
[PHY_ID2] = PHY_R, [M88E1000_PHY_SPEC_STATUS] = PHY_R,
|
[PHY_ID2] = PHY_R, [M88E1000_PHY_SPEC_STATUS] = PHY_R,
|
||||||
[PHY_AUTONEG_EXP] = PHY_R,
|
[PHY_AUTONEG_EXP] = PHY_R,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* PHY_ID2 documented in 8254x_GBe_SDM.pdf, pp. 250 */
|
/* PHY_ID2 documented in 8254x_GBe_SDM.pdf, pp. 250 */
|
||||||
static const uint16_t phy_reg_init[] = {
|
static const uint16_t phy_reg_init[] = {
|
||||||
[PHY_CTRL] = MII_CR_SPEED_SELECT_MSB |
|
[PHY_CTRL] = MII_CR_SPEED_SELECT_MSB |
|
||||||
MII_CR_FULL_DUPLEX |
|
MII_CR_FULL_DUPLEX |
|
||||||
MII_CR_AUTO_NEG_EN,
|
MII_CR_AUTO_NEG_EN,
|
||||||
|
|
||||||
|
@ -264,15 +285,15 @@ static const uint16_t phy_reg_init[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint32_t mac_reg_init[] = {
|
static const uint32_t mac_reg_init[] = {
|
||||||
[PBA] = 0x00100030,
|
[PBA] = 0x00100030,
|
||||||
[LEDCTL] = 0x602,
|
[LEDCTL] = 0x602,
|
||||||
[CTRL] = E1000_CTRL_SWDPIN2 | E1000_CTRL_SWDPIN0 |
|
[CTRL] = E1000_CTRL_SWDPIN2 | E1000_CTRL_SWDPIN0 |
|
||||||
E1000_CTRL_SPD_1000 | E1000_CTRL_SLU,
|
E1000_CTRL_SPD_1000 | E1000_CTRL_SLU,
|
||||||
[STATUS] = 0x80000000 | E1000_STATUS_GIO_MASTER_ENABLE |
|
[STATUS] = 0x80000000 | E1000_STATUS_GIO_MASTER_ENABLE |
|
||||||
E1000_STATUS_ASDV | E1000_STATUS_MTXCKOK |
|
E1000_STATUS_ASDV | E1000_STATUS_MTXCKOK |
|
||||||
E1000_STATUS_SPEED_1000 | E1000_STATUS_FD |
|
E1000_STATUS_SPEED_1000 | E1000_STATUS_FD |
|
||||||
E1000_STATUS_LU,
|
E1000_STATUS_LU,
|
||||||
[MANC] = E1000_MANC_EN_MNG2HOST | E1000_MANC_RCV_TCO_EN |
|
[MANC] = E1000_MANC_EN_MNG2HOST | E1000_MANC_RCV_TCO_EN |
|
||||||
E1000_MANC_ARP_EN | E1000_MANC_0298_EN |
|
E1000_MANC_ARP_EN | E1000_MANC_0298_EN |
|
||||||
E1000_MANC_RMCP_EN,
|
E1000_MANC_RMCP_EN,
|
||||||
};
|
};
|
||||||
|
@ -319,7 +340,7 @@ set_interrupt_cause(E1000State *s, int index, uint32_t val)
|
||||||
if (s->mit_timer_on) {
|
if (s->mit_timer_on) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (s->compat_flags & E1000_FLAG_MIT) {
|
if (chkflag(MIT)) {
|
||||||
/* Compute the next mitigation delay according to pending
|
/* Compute the next mitigation delay according to pending
|
||||||
* interrupts and the current values of RADV (provided
|
* interrupts and the current values of RADV (provided
|
||||||
* RDTR!=0), TADV and ITR.
|
* RDTR!=0), TADV and ITR.
|
||||||
|
@ -510,17 +531,19 @@ set_eecd(E1000State *s, int index, uint32_t val)
|
||||||
|
|
||||||
s->eecd_state.old_eecd = val & (E1000_EECD_SK | E1000_EECD_CS |
|
s->eecd_state.old_eecd = val & (E1000_EECD_SK | E1000_EECD_CS |
|
||||||
E1000_EECD_DI|E1000_EECD_FWE_MASK|E1000_EECD_REQ);
|
E1000_EECD_DI|E1000_EECD_FWE_MASK|E1000_EECD_REQ);
|
||||||
if (!(E1000_EECD_CS & val)) // CS inactive; nothing to do
|
if (!(E1000_EECD_CS & val)) { /* CS inactive; nothing to do */
|
||||||
return;
|
|
||||||
if (E1000_EECD_CS & (val ^ oldval)) { // CS rise edge; reset state
|
|
||||||
s->eecd_state.val_in = 0;
|
|
||||||
s->eecd_state.bitnum_in = 0;
|
|
||||||
s->eecd_state.bitnum_out = 0;
|
|
||||||
s->eecd_state.reading = 0;
|
|
||||||
}
|
|
||||||
if (!(E1000_EECD_SK & (val ^ oldval))) // no clock edge
|
|
||||||
return;
|
return;
|
||||||
if (!(E1000_EECD_SK & val)) { // falling edge
|
}
|
||||||
|
if (E1000_EECD_CS & (val ^ oldval)) { /* CS rise edge; reset state */
|
||||||
|
s->eecd_state.val_in = 0;
|
||||||
|
s->eecd_state.bitnum_in = 0;
|
||||||
|
s->eecd_state.bitnum_out = 0;
|
||||||
|
s->eecd_state.reading = 0;
|
||||||
|
}
|
||||||
|
if (!(E1000_EECD_SK & (val ^ oldval))) { /* no clock edge */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!(E1000_EECD_SK & val)) { /* falling edge */
|
||||||
s->eecd_state.bitnum_out++;
|
s->eecd_state.bitnum_out++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -565,6 +588,56 @@ putsum(uint8_t *data, uint32_t n, uint32_t sloc, uint32_t css, uint32_t cse)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
inc_reg_if_not_full(E1000State *s, int index)
|
||||||
|
{
|
||||||
|
if (s->mac_reg[index] != 0xffffffff) {
|
||||||
|
s->mac_reg[index]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
inc_tx_bcast_or_mcast_count(E1000State *s, const unsigned char *arr)
|
||||||
|
{
|
||||||
|
if (!memcmp(arr, bcast, sizeof bcast)) {
|
||||||
|
inc_reg_if_not_full(s, BPTC);
|
||||||
|
} else if (arr[0] & 1) {
|
||||||
|
inc_reg_if_not_full(s, MPTC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
grow_8reg_if_not_full(E1000State *s, int index, int size)
|
||||||
|
{
|
||||||
|
uint64_t sum = s->mac_reg[index] | (uint64_t)s->mac_reg[index+1] << 32;
|
||||||
|
|
||||||
|
if (sum + size < sum) {
|
||||||
|
sum = ~0ULL;
|
||||||
|
} else {
|
||||||
|
sum += size;
|
||||||
|
}
|
||||||
|
s->mac_reg[index] = sum;
|
||||||
|
s->mac_reg[index+1] = sum >> 32;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
increase_size_stats(E1000State *s, const int *size_regs, int size)
|
||||||
|
{
|
||||||
|
if (size > 1023) {
|
||||||
|
inc_reg_if_not_full(s, size_regs[5]);
|
||||||
|
} else if (size > 511) {
|
||||||
|
inc_reg_if_not_full(s, size_regs[4]);
|
||||||
|
} else if (size > 255) {
|
||||||
|
inc_reg_if_not_full(s, size_regs[3]);
|
||||||
|
} else if (size > 127) {
|
||||||
|
inc_reg_if_not_full(s, size_regs[2]);
|
||||||
|
} else if (size > 64) {
|
||||||
|
inc_reg_if_not_full(s, size_regs[1]);
|
||||||
|
} else if (size == 64) {
|
||||||
|
inc_reg_if_not_full(s, size_regs[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
vlan_enabled(E1000State *s)
|
vlan_enabled(E1000State *s)
|
||||||
{
|
{
|
||||||
|
@ -602,40 +675,49 @@ fcs_len(E1000State *s)
|
||||||
static void
|
static void
|
||||||
e1000_send_packet(E1000State *s, const uint8_t *buf, int size)
|
e1000_send_packet(E1000State *s, const uint8_t *buf, int size)
|
||||||
{
|
{
|
||||||
|
static const int PTCregs[6] = { PTC64, PTC127, PTC255, PTC511,
|
||||||
|
PTC1023, PTC1522 };
|
||||||
|
|
||||||
NetClientState *nc = qemu_get_queue(s->nic);
|
NetClientState *nc = qemu_get_queue(s->nic);
|
||||||
if (s->phy_reg[PHY_CTRL] & MII_CR_LOOPBACK) {
|
if (s->phy_reg[PHY_CTRL] & MII_CR_LOOPBACK) {
|
||||||
nc->info->receive(nc, buf, size);
|
nc->info->receive(nc, buf, size);
|
||||||
} else {
|
} else {
|
||||||
qemu_send_packet(nc, buf, size);
|
qemu_send_packet(nc, buf, size);
|
||||||
}
|
}
|
||||||
|
inc_tx_bcast_or_mcast_count(s, buf);
|
||||||
|
increase_size_stats(s, PTCregs, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xmit_seg(E1000State *s)
|
xmit_seg(E1000State *s)
|
||||||
{
|
{
|
||||||
uint16_t len, *sp;
|
uint16_t len, *sp;
|
||||||
unsigned int frames = s->tx.tso_frames, css, sofar, n;
|
unsigned int frames = s->tx.tso_frames, css, sofar;
|
||||||
struct e1000_tx *tp = &s->tx;
|
struct e1000_tx *tp = &s->tx;
|
||||||
|
|
||||||
if (tp->tse && tp->cptse) {
|
if (tp->tse && tp->cptse) {
|
||||||
css = tp->ipcss;
|
css = tp->ipcss;
|
||||||
DBGOUT(TXSUM, "frames %d size %d ipcss %d\n",
|
DBGOUT(TXSUM, "frames %d size %d ipcss %d\n",
|
||||||
frames, tp->size, css);
|
frames, tp->size, css);
|
||||||
if (tp->ip) { // IPv4
|
if (tp->ip) { /* IPv4 */
|
||||||
stw_be_p(tp->data+css+2, tp->size - css);
|
stw_be_p(tp->data+css+2, tp->size - css);
|
||||||
stw_be_p(tp->data+css+4,
|
stw_be_p(tp->data+css+4,
|
||||||
be16_to_cpup((uint16_t *)(tp->data+css+4))+frames);
|
be16_to_cpup((uint16_t *)(tp->data+css+4))+frames);
|
||||||
} else // IPv6
|
} else { /* IPv6 */
|
||||||
stw_be_p(tp->data+css+4, tp->size - css);
|
stw_be_p(tp->data+css+4, tp->size - css);
|
||||||
|
}
|
||||||
css = tp->tucss;
|
css = tp->tucss;
|
||||||
len = tp->size - css;
|
len = tp->size - css;
|
||||||
DBGOUT(TXSUM, "tcp %d tucss %d len %d\n", tp->tcp, css, len);
|
DBGOUT(TXSUM, "tcp %d tucss %d len %d\n", tp->tcp, css, len);
|
||||||
if (tp->tcp) {
|
if (tp->tcp) {
|
||||||
sofar = frames * tp->mss;
|
sofar = frames * tp->mss;
|
||||||
stl_be_p(tp->data+css+4, ldl_be_p(tp->data+css+4)+sofar); /* seq */
|
stl_be_p(tp->data+css+4, ldl_be_p(tp->data+css+4)+sofar); /* seq */
|
||||||
if (tp->paylen - sofar > tp->mss)
|
if (tp->paylen - sofar > tp->mss) {
|
||||||
tp->data[css + 13] &= ~9; // PSH, FIN
|
tp->data[css + 13] &= ~9; /* PSH, FIN */
|
||||||
} else // UDP
|
} else if (frames) {
|
||||||
|
inc_reg_if_not_full(s, TSCTC);
|
||||||
|
}
|
||||||
|
} else /* UDP */
|
||||||
stw_be_p(tp->data+css+4, len);
|
stw_be_p(tp->data+css+4, len);
|
||||||
if (tp->sum_needed & E1000_TXD_POPTS_TXSM) {
|
if (tp->sum_needed & E1000_TXD_POPTS_TXSM) {
|
||||||
unsigned int phsum;
|
unsigned int phsum;
|
||||||
|
@ -657,13 +739,15 @@ xmit_seg(E1000State *s)
|
||||||
memmove(tp->data, tp->data + 4, 8);
|
memmove(tp->data, tp->data + 4, 8);
|
||||||
memcpy(tp->data + 8, tp->vlan_header, 4);
|
memcpy(tp->data + 8, tp->vlan_header, 4);
|
||||||
e1000_send_packet(s, tp->vlan, tp->size + 4);
|
e1000_send_packet(s, tp->vlan, tp->size + 4);
|
||||||
} else
|
} else {
|
||||||
e1000_send_packet(s, tp->data, tp->size);
|
e1000_send_packet(s, tp->data, tp->size);
|
||||||
s->mac_reg[TPT]++;
|
}
|
||||||
s->mac_reg[GPTC]++;
|
|
||||||
n = s->mac_reg[TOTL];
|
inc_reg_if_not_full(s, TPT);
|
||||||
if ((s->mac_reg[TOTL] += s->tx.size) < n)
|
grow_8reg_if_not_full(s, TOTL, s->tx.size);
|
||||||
s->mac_reg[TOTH]++;
|
s->mac_reg[GPTC] = s->mac_reg[TPT];
|
||||||
|
s->mac_reg[GOTCL] = s->mac_reg[TOTL];
|
||||||
|
s->mac_reg[GOTCH] = s->mac_reg[TOTH];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -679,7 +763,7 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
|
||||||
struct e1000_tx *tp = &s->tx;
|
struct e1000_tx *tp = &s->tx;
|
||||||
|
|
||||||
s->mit_ide |= (txd_lower & E1000_TXD_CMD_IDE);
|
s->mit_ide |= (txd_lower & E1000_TXD_CMD_IDE);
|
||||||
if (dtype == E1000_TXD_CMD_DEXT) { // context descriptor
|
if (dtype == E1000_TXD_CMD_DEXT) { /* context descriptor */
|
||||||
op = le32_to_cpu(xp->cmd_and_length);
|
op = le32_to_cpu(xp->cmd_and_length);
|
||||||
tp->ipcss = xp->lower_setup.ip_fields.ipcss;
|
tp->ipcss = xp->lower_setup.ip_fields.ipcss;
|
||||||
tp->ipcso = xp->lower_setup.ip_fields.ipcso;
|
tp->ipcso = xp->lower_setup.ip_fields.ipcso;
|
||||||
|
@ -694,7 +778,7 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
|
||||||
tp->tcp = (op & E1000_TXD_CMD_TCP) ? 1 : 0;
|
tp->tcp = (op & E1000_TXD_CMD_TCP) ? 1 : 0;
|
||||||
tp->tse = (op & E1000_TXD_CMD_TSE) ? 1 : 0;
|
tp->tse = (op & E1000_TXD_CMD_TSE) ? 1 : 0;
|
||||||
tp->tso_frames = 0;
|
tp->tso_frames = 0;
|
||||||
if (tp->tucso == 0) { // this is probably wrong
|
if (tp->tucso == 0) { /* this is probably wrong */
|
||||||
DBGOUT(TXSUM, "TCP/UDP: cso 0!\n");
|
DBGOUT(TXSUM, "TCP/UDP: cso 0!\n");
|
||||||
tp->tucso = tp->tucss + (tp->tcp ? 16 : 6);
|
tp->tucso = tp->tucss + (tp->tcp ? 16 : 6);
|
||||||
}
|
}
|
||||||
|
@ -831,9 +915,9 @@ start_xmit(E1000State *s)
|
||||||
static int
|
static int
|
||||||
receive_filter(E1000State *s, const uint8_t *buf, int size)
|
receive_filter(E1000State *s, const uint8_t *buf, int size)
|
||||||
{
|
{
|
||||||
static const uint8_t bcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
|
||||||
static const int mta_shift[] = {4, 3, 2, 0};
|
static const int mta_shift[] = {4, 3, 2, 0};
|
||||||
uint32_t f, rctl = s->mac_reg[RCTL], ra[2], *rp;
|
uint32_t f, rctl = s->mac_reg[RCTL], ra[2], *rp;
|
||||||
|
int isbcast = !memcmp(buf, bcast, sizeof bcast), ismcast = (buf[0] & 1);
|
||||||
|
|
||||||
if (is_vlan_packet(s, buf) && vlan_rx_filter_enabled(s)) {
|
if (is_vlan_packet(s, buf) && vlan_rx_filter_enabled(s)) {
|
||||||
uint16_t vid = be16_to_cpup((uint16_t *)(buf + 14));
|
uint16_t vid = be16_to_cpup((uint16_t *)(buf + 14));
|
||||||
|
@ -843,14 +927,19 @@ receive_filter(E1000State *s, const uint8_t *buf, int size)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rctl & E1000_RCTL_UPE) // promiscuous
|
if (!isbcast && !ismcast && (rctl & E1000_RCTL_UPE)) { /* promiscuous ucast */
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if ((buf[0] & 1) && (rctl & E1000_RCTL_MPE)) // promiscuous mcast
|
if (ismcast && (rctl & E1000_RCTL_MPE)) { /* promiscuous mcast */
|
||||||
|
inc_reg_if_not_full(s, MPRC);
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if ((rctl & E1000_RCTL_BAM) && !memcmp(buf, bcast, sizeof bcast))
|
if (isbcast && (rctl & E1000_RCTL_BAM)) { /* broadcast enabled */
|
||||||
|
inc_reg_if_not_full(s, BPRC);
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
for (rp = s->mac_reg + RA; rp < s->mac_reg + RA + 32; rp += 2) {
|
for (rp = s->mac_reg + RA; rp < s->mac_reg + RA + 32; rp += 2) {
|
||||||
if (!(rp[1] & E1000_RAH_AV))
|
if (!(rp[1] & E1000_RAH_AV))
|
||||||
|
@ -870,8 +959,10 @@ receive_filter(E1000State *s, const uint8_t *buf, int size)
|
||||||
|
|
||||||
f = mta_shift[(rctl >> E1000_RCTL_MO_SHIFT) & 3];
|
f = mta_shift[(rctl >> E1000_RCTL_MO_SHIFT) & 3];
|
||||||
f = (((buf[5] << 8) | buf[4]) >> f) & 0xfff;
|
f = (((buf[5] << 8) | buf[4]) >> f) & 0xfff;
|
||||||
if (s->mac_reg[MTA + (f >> 5)] & (1 << (f & 0x1f)))
|
if (s->mac_reg[MTA + (f >> 5)] & (1 << (f & 0x1f))) {
|
||||||
|
inc_reg_if_not_full(s, MPRC);
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
DBGOUT(RXFILTER,
|
DBGOUT(RXFILTER,
|
||||||
"dropping, inexact filter mismatch: %02x:%02x:%02x:%02x:%02x:%02x MO %d MTA[%d] %x\n",
|
"dropping, inexact filter mismatch: %02x:%02x:%02x:%02x:%02x:%02x MO %d MTA[%d] %x\n",
|
||||||
buf[0], buf[1], buf[2], buf[3], buf[4], buf[5],
|
buf[0], buf[1], buf[2], buf[3], buf[4], buf[5],
|
||||||
|
@ -960,6 +1051,8 @@ e1000_receive_iov(NetClientState *nc, const struct iovec *iov, int iovcnt)
|
||||||
size_t desc_offset;
|
size_t desc_offset;
|
||||||
size_t desc_size;
|
size_t desc_size;
|
||||||
size_t total_size;
|
size_t total_size;
|
||||||
|
static const int PRCregs[6] = { PRC64, PRC127, PRC255, PRC511,
|
||||||
|
PRC1023, PRC1522 };
|
||||||
|
|
||||||
if (!(s->mac_reg[STATUS] & E1000_STATUS_LU)) {
|
if (!(s->mac_reg[STATUS] & E1000_STATUS_LU)) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -973,6 +1066,7 @@ e1000_receive_iov(NetClientState *nc, const struct iovec *iov, int iovcnt)
|
||||||
if (size < sizeof(min_buf)) {
|
if (size < sizeof(min_buf)) {
|
||||||
iov_to_buf(iov, iovcnt, 0, min_buf, size);
|
iov_to_buf(iov, iovcnt, 0, min_buf, size);
|
||||||
memset(&min_buf[size], 0, sizeof(min_buf) - size);
|
memset(&min_buf[size], 0, sizeof(min_buf) - size);
|
||||||
|
inc_reg_if_not_full(s, RUC);
|
||||||
min_iov.iov_base = filter_buf = min_buf;
|
min_iov.iov_base = filter_buf = min_buf;
|
||||||
min_iov.iov_len = size = sizeof(min_buf);
|
min_iov.iov_len = size = sizeof(min_buf);
|
||||||
iovcnt = 1;
|
iovcnt = 1;
|
||||||
|
@ -988,6 +1082,7 @@ e1000_receive_iov(NetClientState *nc, const struct iovec *iov, int iovcnt)
|
||||||
(size > MAXIMUM_ETHERNET_VLAN_SIZE
|
(size > MAXIMUM_ETHERNET_VLAN_SIZE
|
||||||
&& !(s->mac_reg[RCTL] & E1000_RCTL_LPE)))
|
&& !(s->mac_reg[RCTL] & E1000_RCTL_LPE)))
|
||||||
&& !(s->mac_reg[RCTL] & E1000_RCTL_SBP)) {
|
&& !(s->mac_reg[RCTL] & E1000_RCTL_SBP)) {
|
||||||
|
inc_reg_if_not_full(s, ROC);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1073,16 +1168,17 @@ e1000_receive_iov(NetClientState *nc, const struct iovec *iov, int iovcnt)
|
||||||
}
|
}
|
||||||
} while (desc_offset < total_size);
|
} while (desc_offset < total_size);
|
||||||
|
|
||||||
s->mac_reg[GPRC]++;
|
increase_size_stats(s, PRCregs, total_size);
|
||||||
s->mac_reg[TPR]++;
|
inc_reg_if_not_full(s, TPR);
|
||||||
|
s->mac_reg[GPRC] = s->mac_reg[TPR];
|
||||||
/* TOR - Total Octets Received:
|
/* TOR - Total Octets Received:
|
||||||
* This register includes bytes received in a packet from the <Destination
|
* This register includes bytes received in a packet from the <Destination
|
||||||
* Address> field through the <CRC> field, inclusively.
|
* Address> field through the <CRC> field, inclusively.
|
||||||
|
* Always include FCS length (4) in size.
|
||||||
*/
|
*/
|
||||||
n = s->mac_reg[TORL] + size + /* Always include FCS length. */ 4;
|
grow_8reg_if_not_full(s, TORL, size+4);
|
||||||
if (n < s->mac_reg[TORL])
|
s->mac_reg[GORCL] = s->mac_reg[TORL];
|
||||||
s->mac_reg[TORH]++;
|
s->mac_reg[GORCH] = s->mac_reg[TORH];
|
||||||
s->mac_reg[TORL] = n;
|
|
||||||
|
|
||||||
n = E1000_ICS_RXT0;
|
n = E1000_ICS_RXT0;
|
||||||
if ((rdt = s->mac_reg[RDT]) < s->mac_reg[RDH])
|
if ((rdt = s->mac_reg[RDT]) < s->mac_reg[RDH])
|
||||||
|
@ -1113,6 +1209,30 @@ mac_readreg(E1000State *s, int index)
|
||||||
return s->mac_reg[index];
|
return s->mac_reg[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint32_t
|
||||||
|
mac_low4_read(E1000State *s, int index)
|
||||||
|
{
|
||||||
|
return s->mac_reg[index] & 0xf;
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint32_t
|
||||||
|
mac_low11_read(E1000State *s, int index)
|
||||||
|
{
|
||||||
|
return s->mac_reg[index] & 0x7ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint32_t
|
||||||
|
mac_low13_read(E1000State *s, int index)
|
||||||
|
{
|
||||||
|
return s->mac_reg[index] & 0x1fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint32_t
|
||||||
|
mac_low16_read(E1000State *s, int index)
|
||||||
|
{
|
||||||
|
return s->mac_reg[index] & 0xffff;
|
||||||
|
}
|
||||||
|
|
||||||
static uint32_t
|
static uint32_t
|
||||||
mac_icr_read(E1000State *s, int index)
|
mac_icr_read(E1000State *s, int index)
|
||||||
{
|
{
|
||||||
|
@ -1206,46 +1326,144 @@ set_ims(E1000State *s, int index, uint32_t val)
|
||||||
set_ics(s, 0, 0);
|
set_ics(s, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define getreg(x) [x] = mac_readreg
|
#define getreg(x) [x] = mac_readreg
|
||||||
static uint32_t (*macreg_readops[])(E1000State *, int) = {
|
static uint32_t (*macreg_readops[])(E1000State *, int) = {
|
||||||
getreg(PBA), getreg(RCTL), getreg(TDH), getreg(TXDCTL),
|
getreg(PBA), getreg(RCTL), getreg(TDH), getreg(TXDCTL),
|
||||||
getreg(WUFC), getreg(TDT), getreg(CTRL), getreg(LEDCTL),
|
getreg(WUFC), getreg(TDT), getreg(CTRL), getreg(LEDCTL),
|
||||||
getreg(MANC), getreg(MDIC), getreg(SWSM), getreg(STATUS),
|
getreg(MANC), getreg(MDIC), getreg(SWSM), getreg(STATUS),
|
||||||
getreg(TORL), getreg(TOTL), getreg(IMS), getreg(TCTL),
|
getreg(TORL), getreg(TOTL), getreg(IMS), getreg(TCTL),
|
||||||
getreg(RDH), getreg(RDT), getreg(VET), getreg(ICS),
|
getreg(RDH), getreg(RDT), getreg(VET), getreg(ICS),
|
||||||
getreg(TDBAL), getreg(TDBAH), getreg(RDBAH), getreg(RDBAL),
|
getreg(TDBAL), getreg(TDBAH), getreg(RDBAH), getreg(RDBAL),
|
||||||
getreg(TDLEN), getreg(RDLEN), getreg(RDTR), getreg(RADV),
|
getreg(TDLEN), getreg(RDLEN), getreg(RDTR), getreg(RADV),
|
||||||
getreg(TADV), getreg(ITR),
|
getreg(TADV), getreg(ITR), getreg(FCRUC), getreg(IPAV),
|
||||||
|
getreg(WUC), getreg(WUS), getreg(SCC), getreg(ECOL),
|
||||||
|
getreg(MCC), getreg(LATECOL), getreg(COLC), getreg(DC),
|
||||||
|
getreg(TNCRS), getreg(SEC), getreg(CEXTERR), getreg(RLEC),
|
||||||
|
getreg(XONRXC), getreg(XONTXC), getreg(XOFFRXC), getreg(XOFFTXC),
|
||||||
|
getreg(RFC), getreg(RJC), getreg(RNBC), getreg(TSCTFC),
|
||||||
|
getreg(MGTPRC), getreg(MGTPDC), getreg(MGTPTC), getreg(GORCL),
|
||||||
|
getreg(GOTCL),
|
||||||
|
|
||||||
[TOTH] = mac_read_clr8, [TORH] = mac_read_clr8, [GPRC] = mac_read_clr4,
|
[TOTH] = mac_read_clr8, [TORH] = mac_read_clr8,
|
||||||
[GPTC] = mac_read_clr4, [TPR] = mac_read_clr4, [TPT] = mac_read_clr4,
|
[GOTCH] = mac_read_clr8, [GORCH] = mac_read_clr8,
|
||||||
[ICR] = mac_icr_read, [EECD] = get_eecd, [EERD] = flash_eerd_read,
|
[PRC64] = mac_read_clr4, [PRC127] = mac_read_clr4,
|
||||||
[CRCERRS ... MPC] = &mac_readreg,
|
[PRC255] = mac_read_clr4, [PRC511] = mac_read_clr4,
|
||||||
[RA ... RA+31] = &mac_readreg,
|
[PRC1023] = mac_read_clr4, [PRC1522] = mac_read_clr4,
|
||||||
[MTA ... MTA+127] = &mac_readreg,
|
[PTC64] = mac_read_clr4, [PTC127] = mac_read_clr4,
|
||||||
|
[PTC255] = mac_read_clr4, [PTC511] = mac_read_clr4,
|
||||||
|
[PTC1023] = mac_read_clr4, [PTC1522] = mac_read_clr4,
|
||||||
|
[GPRC] = mac_read_clr4, [GPTC] = mac_read_clr4,
|
||||||
|
[TPT] = mac_read_clr4, [TPR] = mac_read_clr4,
|
||||||
|
[RUC] = mac_read_clr4, [ROC] = mac_read_clr4,
|
||||||
|
[BPRC] = mac_read_clr4, [MPRC] = mac_read_clr4,
|
||||||
|
[TSCTC] = mac_read_clr4, [BPTC] = mac_read_clr4,
|
||||||
|
[MPTC] = mac_read_clr4,
|
||||||
|
[ICR] = mac_icr_read, [EECD] = get_eecd,
|
||||||
|
[EERD] = flash_eerd_read,
|
||||||
|
[RDFH] = mac_low13_read, [RDFT] = mac_low13_read,
|
||||||
|
[RDFHS] = mac_low13_read, [RDFTS] = mac_low13_read,
|
||||||
|
[RDFPC] = mac_low13_read,
|
||||||
|
[TDFH] = mac_low11_read, [TDFT] = mac_low11_read,
|
||||||
|
[TDFHS] = mac_low13_read, [TDFTS] = mac_low13_read,
|
||||||
|
[TDFPC] = mac_low13_read,
|
||||||
|
[AIT] = mac_low16_read,
|
||||||
|
|
||||||
|
[CRCERRS ... MPC] = &mac_readreg,
|
||||||
|
[IP6AT ... IP6AT+3] = &mac_readreg, [IP4AT ... IP4AT+6] = &mac_readreg,
|
||||||
|
[FFLT ... FFLT+6] = &mac_low11_read,
|
||||||
|
[RA ... RA+31] = &mac_readreg,
|
||||||
|
[WUPM ... WUPM+31] = &mac_readreg,
|
||||||
|
[MTA ... MTA+127] = &mac_readreg,
|
||||||
[VFTA ... VFTA+127] = &mac_readreg,
|
[VFTA ... VFTA+127] = &mac_readreg,
|
||||||
|
[FFMT ... FFMT+254] = &mac_low4_read,
|
||||||
|
[FFVT ... FFVT+254] = &mac_readreg,
|
||||||
|
[PBM ... PBM+16383] = &mac_readreg,
|
||||||
};
|
};
|
||||||
enum { NREADOPS = ARRAY_SIZE(macreg_readops) };
|
enum { NREADOPS = ARRAY_SIZE(macreg_readops) };
|
||||||
|
|
||||||
#define putreg(x) [x] = mac_writereg
|
#define putreg(x) [x] = mac_writereg
|
||||||
static void (*macreg_writeops[])(E1000State *, int, uint32_t) = {
|
static void (*macreg_writeops[])(E1000State *, int, uint32_t) = {
|
||||||
putreg(PBA), putreg(EERD), putreg(SWSM), putreg(WUFC),
|
putreg(PBA), putreg(EERD), putreg(SWSM), putreg(WUFC),
|
||||||
putreg(TDBAL), putreg(TDBAH), putreg(TXDCTL), putreg(RDBAH),
|
putreg(TDBAL), putreg(TDBAH), putreg(TXDCTL), putreg(RDBAH),
|
||||||
putreg(RDBAL), putreg(LEDCTL), putreg(VET),
|
putreg(RDBAL), putreg(LEDCTL), putreg(VET), putreg(FCRUC),
|
||||||
[TDLEN] = set_dlen, [RDLEN] = set_dlen, [TCTL] = set_tctl,
|
putreg(TDFH), putreg(TDFT), putreg(TDFHS), putreg(TDFTS),
|
||||||
[TDT] = set_tctl, [MDIC] = set_mdic, [ICS] = set_ics,
|
putreg(TDFPC), putreg(RDFH), putreg(RDFT), putreg(RDFHS),
|
||||||
[TDH] = set_16bit, [RDH] = set_16bit, [RDT] = set_rdt,
|
putreg(RDFTS), putreg(RDFPC), putreg(IPAV), putreg(WUC),
|
||||||
[IMC] = set_imc, [IMS] = set_ims, [ICR] = set_icr,
|
putreg(WUS), putreg(AIT),
|
||||||
[EECD] = set_eecd, [RCTL] = set_rx_control, [CTRL] = set_ctrl,
|
|
||||||
[RDTR] = set_16bit, [RADV] = set_16bit, [TADV] = set_16bit,
|
[TDLEN] = set_dlen, [RDLEN] = set_dlen, [TCTL] = set_tctl,
|
||||||
[ITR] = set_16bit,
|
[TDT] = set_tctl, [MDIC] = set_mdic, [ICS] = set_ics,
|
||||||
[RA ... RA+31] = &mac_writereg,
|
[TDH] = set_16bit, [RDH] = set_16bit, [RDT] = set_rdt,
|
||||||
[MTA ... MTA+127] = &mac_writereg,
|
[IMC] = set_imc, [IMS] = set_ims, [ICR] = set_icr,
|
||||||
|
[EECD] = set_eecd, [RCTL] = set_rx_control, [CTRL] = set_ctrl,
|
||||||
|
[RDTR] = set_16bit, [RADV] = set_16bit, [TADV] = set_16bit,
|
||||||
|
[ITR] = set_16bit,
|
||||||
|
|
||||||
|
[IP6AT ... IP6AT+3] = &mac_writereg, [IP4AT ... IP4AT+6] = &mac_writereg,
|
||||||
|
[FFLT ... FFLT+6] = &mac_writereg,
|
||||||
|
[RA ... RA+31] = &mac_writereg,
|
||||||
|
[WUPM ... WUPM+31] = &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,
|
||||||
|
[PBM ... PBM+16383] = &mac_writereg,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum { NWRITEOPS = ARRAY_SIZE(macreg_writeops) };
|
enum { NWRITEOPS = ARRAY_SIZE(macreg_writeops) };
|
||||||
|
|
||||||
|
enum { MAC_ACCESS_PARTIAL = 1, MAC_ACCESS_FLAG_NEEDED = 2 };
|
||||||
|
|
||||||
|
#define markflag(x) ((E1000_FLAG_##x << 2) | MAC_ACCESS_FLAG_NEEDED)
|
||||||
|
/* In the array below the meaning of the bits is: [f|f|f|f|f|f|n|p]
|
||||||
|
* f - flag bits (up to 6 possible flags)
|
||||||
|
* 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),
|
||||||
|
[ECOL] = markflag(MAC), [MCC] = markflag(MAC),
|
||||||
|
[DC] = markflag(MAC), [TNCRS] = markflag(MAC),
|
||||||
|
[RLEC] = markflag(MAC), [XONRXC] = markflag(MAC),
|
||||||
|
[XOFFTXC] = markflag(MAC), [RFC] = markflag(MAC),
|
||||||
|
[TSCTFC] = markflag(MAC), [MGTPRC] = markflag(MAC),
|
||||||
|
[WUS] = markflag(MAC), [AIT] = markflag(MAC),
|
||||||
|
[FFLT] = markflag(MAC), [FFMT] = markflag(MAC),
|
||||||
|
[SCC] = markflag(MAC), [FCRUC] = markflag(MAC),
|
||||||
|
[LATECOL] = markflag(MAC), [COLC] = markflag(MAC),
|
||||||
|
[SEC] = markflag(MAC), [CEXTERR] = markflag(MAC),
|
||||||
|
[XONTXC] = markflag(MAC), [XOFFRXC] = markflag(MAC),
|
||||||
|
[RJC] = markflag(MAC), [RNBC] = markflag(MAC),
|
||||||
|
[MGTPDC] = markflag(MAC), [MGTPTC] = markflag(MAC),
|
||||||
|
[RUC] = markflag(MAC), [ROC] = markflag(MAC),
|
||||||
|
[GORCL] = markflag(MAC), [GORCH] = markflag(MAC),
|
||||||
|
[GOTCL] = markflag(MAC), [GOTCH] = markflag(MAC),
|
||||||
|
[BPRC] = markflag(MAC), [MPRC] = markflag(MAC),
|
||||||
|
[TSCTC] = markflag(MAC), [PRC64] = markflag(MAC),
|
||||||
|
[PRC127] = markflag(MAC), [PRC255] = markflag(MAC),
|
||||||
|
[PRC511] = markflag(MAC), [PRC1023] = markflag(MAC),
|
||||||
|
[PRC1522] = markflag(MAC), [PTC64] = markflag(MAC),
|
||||||
|
[PTC127] = markflag(MAC), [PTC255] = markflag(MAC),
|
||||||
|
[PTC511] = markflag(MAC), [PTC1023] = markflag(MAC),
|
||||||
|
[PTC1522] = markflag(MAC), [MPTC] = markflag(MAC),
|
||||||
|
[BPTC] = markflag(MAC),
|
||||||
|
|
||||||
|
[TDFH] = markflag(MAC) | MAC_ACCESS_PARTIAL,
|
||||||
|
[TDFT] = markflag(MAC) | MAC_ACCESS_PARTIAL,
|
||||||
|
[TDFHS] = markflag(MAC) | MAC_ACCESS_PARTIAL,
|
||||||
|
[TDFTS] = markflag(MAC) | MAC_ACCESS_PARTIAL,
|
||||||
|
[TDFPC] = markflag(MAC) | MAC_ACCESS_PARTIAL,
|
||||||
|
[RDFH] = markflag(MAC) | MAC_ACCESS_PARTIAL,
|
||||||
|
[RDFT] = markflag(MAC) | MAC_ACCESS_PARTIAL,
|
||||||
|
[RDFHS] = markflag(MAC) | MAC_ACCESS_PARTIAL,
|
||||||
|
[RDFTS] = markflag(MAC) | MAC_ACCESS_PARTIAL,
|
||||||
|
[RDFPC] = markflag(MAC) | MAC_ACCESS_PARTIAL,
|
||||||
|
[PBM] = markflag(MAC) | MAC_ACCESS_PARTIAL,
|
||||||
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
e1000_mmio_write(void *opaque, hwaddr addr, uint64_t val,
|
e1000_mmio_write(void *opaque, hwaddr addr, uint64_t val,
|
||||||
unsigned size)
|
unsigned size)
|
||||||
|
@ -1254,9 +1472,20 @@ e1000_mmio_write(void *opaque, hwaddr addr, uint64_t val,
|
||||||
unsigned int index = (addr & 0x1ffff) >> 2;
|
unsigned int index = (addr & 0x1ffff) >> 2;
|
||||||
|
|
||||||
if (index < NWRITEOPS && macreg_writeops[index]) {
|
if (index < NWRITEOPS && macreg_writeops[index]) {
|
||||||
macreg_writeops[index](s, index, val);
|
if (!(mac_reg_access[index] & MAC_ACCESS_FLAG_NEEDED)
|
||||||
|
|| (s->compat_flags & (mac_reg_access[index] >> 2))) {
|
||||||
|
if (mac_reg_access[index] & MAC_ACCESS_PARTIAL) {
|
||||||
|
DBGOUT(GENERAL, "Writing to register at offset: 0x%08x. "
|
||||||
|
"It is not fully implemented.\n", index<<2);
|
||||||
|
}
|
||||||
|
macreg_writeops[index](s, index, val);
|
||||||
|
} else { /* "flag needed" bit is set, but the flag is not active */
|
||||||
|
DBGOUT(MMIO, "MMIO write attempt to disabled reg. addr=0x%08x\n",
|
||||||
|
index<<2);
|
||||||
|
}
|
||||||
} else if (index < NREADOPS && macreg_readops[index]) {
|
} else if (index < NREADOPS && macreg_readops[index]) {
|
||||||
DBGOUT(MMIO, "e1000_mmio_writel RO %x: 0x%04"PRIx64"\n", index<<2, val);
|
DBGOUT(MMIO, "e1000_mmio_writel RO %x: 0x%04"PRIx64"\n",
|
||||||
|
index<<2, val);
|
||||||
} else {
|
} else {
|
||||||
DBGOUT(UNKNOWN, "MMIO unknown write addr=0x%08x,val=0x%08"PRIx64"\n",
|
DBGOUT(UNKNOWN, "MMIO unknown write addr=0x%08x,val=0x%08"PRIx64"\n",
|
||||||
index<<2, val);
|
index<<2, val);
|
||||||
|
@ -1269,11 +1498,21 @@ e1000_mmio_read(void *opaque, hwaddr addr, unsigned size)
|
||||||
E1000State *s = opaque;
|
E1000State *s = opaque;
|
||||||
unsigned int index = (addr & 0x1ffff) >> 2;
|
unsigned int index = (addr & 0x1ffff) >> 2;
|
||||||
|
|
||||||
if (index < NREADOPS && macreg_readops[index])
|
if (index < NREADOPS && macreg_readops[index]) {
|
||||||
{
|
if (!(mac_reg_access[index] & MAC_ACCESS_FLAG_NEEDED)
|
||||||
return macreg_readops[index](s, index);
|
|| (s->compat_flags & (mac_reg_access[index] >> 2))) {
|
||||||
|
if (mac_reg_access[index] & MAC_ACCESS_PARTIAL) {
|
||||||
|
DBGOUT(GENERAL, "Reading register at offset: 0x%08x. "
|
||||||
|
"It is not fully implemented.\n", index<<2);
|
||||||
|
}
|
||||||
|
return macreg_readops[index](s, index);
|
||||||
|
} else { /* "flag needed" bit is set, but the flag is not active */
|
||||||
|
DBGOUT(MMIO, "MMIO read attempt of disabled reg. addr=0x%08x\n",
|
||||||
|
index<<2);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
DBGOUT(UNKNOWN, "MMIO unknown read addr=0x%08x\n", index<<2);
|
||||||
}
|
}
|
||||||
DBGOUT(UNKNOWN, "MMIO unknown read addr=0x%08x\n", index<<2);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1340,7 +1579,7 @@ static int e1000_post_load(void *opaque, int version_id)
|
||||||
E1000State *s = opaque;
|
E1000State *s = opaque;
|
||||||
NetClientState *nc = qemu_get_queue(s->nic);
|
NetClientState *nc = qemu_get_queue(s->nic);
|
||||||
|
|
||||||
if (!(s->compat_flags & E1000_FLAG_MIT)) {
|
if (!chkflag(MIT)) {
|
||||||
s->mac_reg[ITR] = s->mac_reg[RDTR] = s->mac_reg[RADV] =
|
s->mac_reg[ITR] = s->mac_reg[RDTR] = s->mac_reg[RADV] =
|
||||||
s->mac_reg[TADV] = 0;
|
s->mac_reg[TADV] = 0;
|
||||||
s->mit_irq_level = false;
|
s->mit_irq_level = false;
|
||||||
|
@ -1367,7 +1606,14 @@ static bool e1000_mit_state_needed(void *opaque)
|
||||||
{
|
{
|
||||||
E1000State *s = opaque;
|
E1000State *s = opaque;
|
||||||
|
|
||||||
return s->compat_flags & E1000_FLAG_MIT;
|
return chkflag(MIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool e1000_full_mac_needed(void *opaque)
|
||||||
|
{
|
||||||
|
E1000State *s = opaque;
|
||||||
|
|
||||||
|
return chkflag(MAC);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const VMStateDescription vmstate_e1000_mit_state = {
|
static const VMStateDescription vmstate_e1000_mit_state = {
|
||||||
|
@ -1385,6 +1631,17 @@ static const VMStateDescription vmstate_e1000_mit_state = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const VMStateDescription vmstate_e1000_full_mac_state = {
|
||||||
|
.name = "e1000/full_mac_state",
|
||||||
|
.version_id = 1,
|
||||||
|
.minimum_version_id = 1,
|
||||||
|
.needed = e1000_full_mac_needed,
|
||||||
|
.fields = (VMStateField[]) {
|
||||||
|
VMSTATE_UINT32_ARRAY(mac_reg, E1000State, 0x8000),
|
||||||
|
VMSTATE_END_OF_LIST()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
static const VMStateDescription vmstate_e1000 = {
|
static const VMStateDescription vmstate_e1000 = {
|
||||||
.name = "e1000",
|
.name = "e1000",
|
||||||
.version_id = 2,
|
.version_id = 2,
|
||||||
|
@ -1464,6 +1721,7 @@ static const VMStateDescription vmstate_e1000 = {
|
||||||
},
|
},
|
||||||
.subsections = (const VMStateDescription*[]) {
|
.subsections = (const VMStateDescription*[]) {
|
||||||
&vmstate_e1000_mit_state,
|
&vmstate_e1000_mit_state,
|
||||||
|
&vmstate_e1000_full_mac_state,
|
||||||
NULL
|
NULL
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1596,6 +1854,8 @@ static Property e1000_properties[] = {
|
||||||
compat_flags, E1000_FLAG_AUTONEG_BIT, true),
|
compat_flags, E1000_FLAG_AUTONEG_BIT, true),
|
||||||
DEFINE_PROP_BIT("mitigation", E1000State,
|
DEFINE_PROP_BIT("mitigation", E1000State,
|
||||||
compat_flags, E1000_FLAG_MIT_BIT, true),
|
compat_flags, E1000_FLAG_MIT_BIT, true),
|
||||||
|
DEFINE_PROP_BIT("extra_mac_registers", E1000State,
|
||||||
|
compat_flags, E1000_FLAG_MAC_BIT, true),
|
||||||
DEFINE_PROP_END_OF_LIST(),
|
DEFINE_PROP_END_OF_LIST(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -158,7 +158,8 @@
|
||||||
#define E1000_PHY_CTRL 0x00F10 /* PHY Control Register in CSR */
|
#define E1000_PHY_CTRL 0x00F10 /* PHY Control Register in CSR */
|
||||||
#define FEXTNVM_SW_CONFIG 0x0001
|
#define FEXTNVM_SW_CONFIG 0x0001
|
||||||
#define E1000_PBA 0x01000 /* Packet Buffer Allocation - RW */
|
#define E1000_PBA 0x01000 /* Packet Buffer Allocation - RW */
|
||||||
#define E1000_PBS 0x01008 /* Packet Buffer Size */
|
#define E1000_PBM 0x10000 /* Packet Buffer Memory - RW */
|
||||||
|
#define E1000_PBS 0x01008 /* Packet Buffer Size - RW */
|
||||||
#define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */
|
#define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */
|
||||||
#define E1000_FLASH_UPDATES 1000
|
#define E1000_FLASH_UPDATES 1000
|
||||||
#define E1000_EEARBC 0x01024 /* EEPROM Auto Read Bus Control */
|
#define E1000_EEARBC 0x01024 /* EEPROM Auto Read Bus Control */
|
||||||
|
@ -191,6 +192,11 @@
|
||||||
#define E1000_RAID 0x02C08 /* Receive Ack Interrupt Delay - RW */
|
#define E1000_RAID 0x02C08 /* Receive Ack Interrupt Delay - RW */
|
||||||
#define E1000_TXDMAC 0x03000 /* TX DMA Control - RW */
|
#define E1000_TXDMAC 0x03000 /* TX DMA Control - RW */
|
||||||
#define E1000_KABGTXD 0x03004 /* AFE Band Gap Transmit Ref Data */
|
#define E1000_KABGTXD 0x03004 /* AFE Band Gap Transmit Ref Data */
|
||||||
|
#define E1000_RDFH 0x02410 /* Receive Data FIFO Head Register - RW */
|
||||||
|
#define E1000_RDFT 0x02418 /* Receive Data FIFO Tail Register - RW */
|
||||||
|
#define E1000_RDFHS 0x02420 /* Receive Data FIFO Head Saved Register - RW */
|
||||||
|
#define E1000_RDFTS 0x02428 /* Receive Data FIFO Tail Saved Register - RW */
|
||||||
|
#define E1000_RDFPC 0x02430 /* Receive Data FIFO Packet Count - RW */
|
||||||
#define E1000_TDFH 0x03410 /* TX Data FIFO Head - RW */
|
#define E1000_TDFH 0x03410 /* TX Data FIFO Head - RW */
|
||||||
#define E1000_TDFT 0x03418 /* TX Data FIFO Tail - RW */
|
#define E1000_TDFT 0x03418 /* TX Data FIFO Tail - RW */
|
||||||
#define E1000_TDFHS 0x03420 /* TX Data FIFO Head Saved - RW */
|
#define E1000_TDFHS 0x03420 /* TX Data FIFO Head Saved - RW */
|
||||||
|
|
|
@ -6,7 +6,11 @@
|
||||||
.driver = "virtio-blk-device",\
|
.driver = "virtio-blk-device",\
|
||||||
.property = "scsi",\
|
.property = "scsi",\
|
||||||
.value = "true",\
|
.value = "true",\
|
||||||
},
|
},{\
|
||||||
|
.driver = "e1000",\
|
||||||
|
.property = "extra_mac_registers",\
|
||||||
|
.value = "off",\
|
||||||
|
},
|
||||||
|
|
||||||
#define HW_COMPAT_2_3 \
|
#define HW_COMPAT_2_3 \
|
||||||
{\
|
{\
|
||||||
|
|
24
net/netmap.c
24
net/netmap.c
|
@ -90,7 +90,7 @@ pkt_copy(const void *_src, void *_dst, int l)
|
||||||
* Open a netmap device. We assume there is only one queue
|
* Open a netmap device. We assume there is only one queue
|
||||||
* (which is the case for the VALE bridge).
|
* (which is the case for the VALE bridge).
|
||||||
*/
|
*/
|
||||||
static int netmap_open(NetmapPriv *me)
|
static void netmap_open(NetmapPriv *me, Error **errp)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
int err;
|
int err;
|
||||||
|
@ -99,9 +99,8 @@ static int netmap_open(NetmapPriv *me)
|
||||||
|
|
||||||
me->fd = fd = open(me->fdname, O_RDWR);
|
me->fd = fd = open(me->fdname, O_RDWR);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
error_report("Unable to open netmap device '%s' (%s)",
|
error_setg_file_open(errp, errno, me->fdname);
|
||||||
me->fdname, strerror(errno));
|
return;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
memset(&req, 0, sizeof(req));
|
memset(&req, 0, sizeof(req));
|
||||||
pstrcpy(req.nr_name, sizeof(req.nr_name), me->ifname);
|
pstrcpy(req.nr_name, sizeof(req.nr_name), me->ifname);
|
||||||
|
@ -109,15 +108,14 @@ static int netmap_open(NetmapPriv *me)
|
||||||
req.nr_version = NETMAP_API;
|
req.nr_version = NETMAP_API;
|
||||||
err = ioctl(fd, NIOCREGIF, &req);
|
err = ioctl(fd, NIOCREGIF, &req);
|
||||||
if (err) {
|
if (err) {
|
||||||
error_report("Unable to register %s: %s", me->ifname, strerror(errno));
|
error_setg_errno(errp, errno, "Unable to register %s", me->ifname);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
l = me->memsize = req.nr_memsize;
|
l = me->memsize = req.nr_memsize;
|
||||||
|
|
||||||
me->mem = mmap(0, l, PROT_WRITE | PROT_READ, MAP_SHARED, fd, 0);
|
me->mem = mmap(0, l, PROT_WRITE | PROT_READ, MAP_SHARED, fd, 0);
|
||||||
if (me->mem == MAP_FAILED) {
|
if (me->mem == MAP_FAILED) {
|
||||||
error_report("Unable to mmap netmap shared memory: %s",
|
error_setg_errno(errp, errno, "Unable to mmap netmap shared memory");
|
||||||
strerror(errno));
|
|
||||||
me->mem = NULL;
|
me->mem = NULL;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -125,11 +123,11 @@ static int netmap_open(NetmapPriv *me)
|
||||||
me->nifp = NETMAP_IF(me->mem, req.nr_offset);
|
me->nifp = NETMAP_IF(me->mem, req.nr_offset);
|
||||||
me->tx = NETMAP_TXRING(me->nifp, 0);
|
me->tx = NETMAP_TXRING(me->nifp, 0);
|
||||||
me->rx = NETMAP_RXRING(me->nifp, 0);
|
me->rx = NETMAP_RXRING(me->nifp, 0);
|
||||||
return 0;
|
|
||||||
|
return;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
close(me->fd);
|
close(me->fd);
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void netmap_send(void *opaque);
|
static void netmap_send(void *opaque);
|
||||||
|
@ -438,9 +436,9 @@ static NetClientInfo net_netmap_info = {
|
||||||
int net_init_netmap(const NetClientOptions *opts,
|
int net_init_netmap(const NetClientOptions *opts,
|
||||||
const char *name, NetClientState *peer, Error **errp)
|
const char *name, NetClientState *peer, Error **errp)
|
||||||
{
|
{
|
||||||
/* FIXME error_setg(errp, ...) on failure */
|
const NetdevNetmapOptions *netmap_opts = opts->u.netmap;
|
||||||
const NetdevNetmapOptions *netmap_opts = opts->netmap;
|
|
||||||
NetClientState *nc;
|
NetClientState *nc;
|
||||||
|
Error *err = NULL;
|
||||||
NetmapPriv me;
|
NetmapPriv me;
|
||||||
NetmapState *s;
|
NetmapState *s;
|
||||||
|
|
||||||
|
@ -448,7 +446,9 @@ int net_init_netmap(const NetClientOptions *opts,
|
||||||
netmap_opts->has_devname ? netmap_opts->devname : "/dev/netmap");
|
netmap_opts->has_devname ? netmap_opts->devname : "/dev/netmap");
|
||||||
/* Set default name for the port if not supplied. */
|
/* Set default name for the port if not supplied. */
|
||||||
pstrcpy(me.ifname, sizeof(me.ifname), netmap_opts->ifname);
|
pstrcpy(me.ifname, sizeof(me.ifname), netmap_opts->ifname);
|
||||||
if (netmap_open(&me)) {
|
netmap_open(&me, &err);
|
||||||
|
if (err) {
|
||||||
|
error_propagate(errp, err);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* Create the object. */
|
/* Create the object. */
|
||||||
|
|
|
@ -23,6 +23,12 @@
|
||||||
*/
|
*/
|
||||||
#include <slirp.h>
|
#include <slirp.h>
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
/* Windows ntohl() returns an u_long value.
|
||||||
|
* Add a type cast to match the format strings. */
|
||||||
|
# define ntohl(n) ((uint32_t)ntohl(n))
|
||||||
|
#endif
|
||||||
|
|
||||||
/* XXX: only DHCP is supported */
|
/* XXX: only DHCP is supported */
|
||||||
|
|
||||||
#define LEASE_TIME (24 * 3600)
|
#define LEASE_TIME (24 * 3600)
|
||||||
|
@ -155,7 +161,7 @@ static void bootp_reply(Slirp *slirp, const struct bootp_t *bp)
|
||||||
dhcp_decode(bp, &dhcp_msg_type, &preq_addr);
|
dhcp_decode(bp, &dhcp_msg_type, &preq_addr);
|
||||||
DPRINTF("bootp packet op=%d msgtype=%d", bp->bp_op, dhcp_msg_type);
|
DPRINTF("bootp packet op=%d msgtype=%d", bp->bp_op, dhcp_msg_type);
|
||||||
if (preq_addr.s_addr != htonl(0L))
|
if (preq_addr.s_addr != htonl(0L))
|
||||||
DPRINTF(" req_addr=%08x\n", ntohl(preq_addr.s_addr));
|
DPRINTF(" req_addr=%08" PRIx32 "\n", ntohl(preq_addr.s_addr));
|
||||||
else
|
else
|
||||||
DPRINTF("\n");
|
DPRINTF("\n");
|
||||||
|
|
||||||
|
@ -234,7 +240,7 @@ static void bootp_reply(Slirp *slirp, const struct bootp_t *bp)
|
||||||
q += 4;
|
q += 4;
|
||||||
|
|
||||||
if (bc) {
|
if (bc) {
|
||||||
DPRINTF("%s addr=%08x\n",
|
DPRINTF("%s addr=%08" PRIx32 "\n",
|
||||||
(dhcp_msg_type == DHCPDISCOVER) ? "offered" : "ack'ed",
|
(dhcp_msg_type == DHCPDISCOVER) ? "offered" : "ack'ed",
|
||||||
ntohl(daddr.sin_addr.s_addr));
|
ntohl(daddr.sin_addr.s_addr));
|
||||||
|
|
||||||
|
@ -302,7 +308,7 @@ static void bootp_reply(Slirp *slirp, const struct bootp_t *bp)
|
||||||
} else {
|
} else {
|
||||||
static const char nak_msg[] = "requested address not available";
|
static const char nak_msg[] = "requested address not available";
|
||||||
|
|
||||||
DPRINTF("nak'ed addr=%08x\n", ntohl(preq_addr.s_addr));
|
DPRINTF("nak'ed addr=%08" PRIx32 "\n", ntohl(preq_addr.s_addr));
|
||||||
|
|
||||||
*q++ = RFC2132_MSG_TYPE;
|
*q++ = RFC2132_MSG_TYPE;
|
||||||
*q++ = 1;
|
*q++ = 1;
|
||||||
|
|
|
@ -53,8 +53,8 @@ if_output(struct socket *so, struct mbuf *ifm)
|
||||||
int on_fastq = 1;
|
int on_fastq = 1;
|
||||||
|
|
||||||
DEBUG_CALL("if_output");
|
DEBUG_CALL("if_output");
|
||||||
DEBUG_ARG("so = %lx", (long)so);
|
DEBUG_ARG("so = %p", so);
|
||||||
DEBUG_ARG("ifm = %lx", (long)ifm);
|
DEBUG_ARG("ifm = %p", ifm);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* First remove the mbuf from m_usedlist,
|
* First remove the mbuf from m_usedlist,
|
||||||
|
|
|
@ -125,7 +125,7 @@ icmp_input(struct mbuf *m, int hlen)
|
||||||
Slirp *slirp = m->slirp;
|
Slirp *slirp = m->slirp;
|
||||||
|
|
||||||
DEBUG_CALL("icmp_input");
|
DEBUG_CALL("icmp_input");
|
||||||
DEBUG_ARG("m = %lx", (long )m);
|
DEBUG_ARG("m = %p", m);
|
||||||
DEBUG_ARG("m_len = %d", m->m_len);
|
DEBUG_ARG("m_len = %d", m->m_len);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -252,7 +252,7 @@ icmp_error(struct mbuf *msrc, u_char type, u_char code, int minsize,
|
||||||
register struct mbuf *m;
|
register struct mbuf *m;
|
||||||
|
|
||||||
DEBUG_CALL("icmp_error");
|
DEBUG_CALL("icmp_error");
|
||||||
DEBUG_ARG("msrc = %lx", (long )msrc);
|
DEBUG_ARG("msrc = %p", msrc);
|
||||||
DEBUG_ARG("msrc_len = %d", msrc->m_len);
|
DEBUG_ARG("msrc_len = %d", msrc->m_len);
|
||||||
|
|
||||||
if(type!=ICMP_UNREACH && type!=ICMP_TIMXCEED) goto end_error;
|
if(type!=ICMP_UNREACH && type!=ICMP_TIMXCEED) goto end_error;
|
||||||
|
|
|
@ -80,7 +80,7 @@ ip_input(struct mbuf *m)
|
||||||
int hlen;
|
int hlen;
|
||||||
|
|
||||||
DEBUG_CALL("ip_input");
|
DEBUG_CALL("ip_input");
|
||||||
DEBUG_ARG("m = %lx", (long)m);
|
DEBUG_ARG("m = %p", m);
|
||||||
DEBUG_ARG("m_len = %d", m->m_len);
|
DEBUG_ARG("m_len = %d", m->m_len);
|
||||||
|
|
||||||
if (m->m_len < sizeof (struct ip)) {
|
if (m->m_len < sizeof (struct ip)) {
|
||||||
|
@ -232,9 +232,9 @@ ip_reass(Slirp *slirp, struct ip *ip, struct ipq *fp)
|
||||||
int i, next;
|
int i, next;
|
||||||
|
|
||||||
DEBUG_CALL("ip_reass");
|
DEBUG_CALL("ip_reass");
|
||||||
DEBUG_ARG("ip = %lx", (long)ip);
|
DEBUG_ARG("ip = %p", ip);
|
||||||
DEBUG_ARG("fp = %lx", (long)fp);
|
DEBUG_ARG("fp = %p", fp);
|
||||||
DEBUG_ARG("m = %lx", (long)m);
|
DEBUG_ARG("m = %p", m);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Presence of header sizes in mbufs
|
* Presence of header sizes in mbufs
|
||||||
|
@ -400,7 +400,7 @@ static void
|
||||||
ip_enq(register struct ipasfrag *p, register struct ipasfrag *prev)
|
ip_enq(register struct ipasfrag *p, register struct ipasfrag *prev)
|
||||||
{
|
{
|
||||||
DEBUG_CALL("ip_enq");
|
DEBUG_CALL("ip_enq");
|
||||||
DEBUG_ARG("prev = %lx", (long)prev);
|
DEBUG_ARG("prev = %p", prev);
|
||||||
p->ipf_prev = prev;
|
p->ipf_prev = prev;
|
||||||
p->ipf_next = prev->ipf_next;
|
p->ipf_next = prev->ipf_next;
|
||||||
((struct ipasfrag *)(prev->ipf_next))->ipf_prev = p;
|
((struct ipasfrag *)(prev->ipf_next))->ipf_prev = p;
|
||||||
|
|
|
@ -60,8 +60,8 @@ ip_output(struct socket *so, struct mbuf *m0)
|
||||||
int len, off, error = 0;
|
int len, off, error = 0;
|
||||||
|
|
||||||
DEBUG_CALL("ip_output");
|
DEBUG_CALL("ip_output");
|
||||||
DEBUG_ARG("so = %lx", (long)so);
|
DEBUG_ARG("so = %p", so);
|
||||||
DEBUG_ARG("m0 = %lx", (long)m0);
|
DEBUG_ARG("m0 = %p", m0);
|
||||||
|
|
||||||
ip = mtod(m, struct ip *);
|
ip = mtod(m, struct ip *);
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -94,7 +94,7 @@ m_get(Slirp *slirp)
|
||||||
m->arp_requested = false;
|
m->arp_requested = false;
|
||||||
m->expiration_date = (uint64_t)-1;
|
m->expiration_date = (uint64_t)-1;
|
||||||
end_error:
|
end_error:
|
||||||
DEBUG_ARG("m = %lx", (long )m);
|
DEBUG_ARG("m = %p", m);
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ m_free(struct mbuf *m)
|
||||||
{
|
{
|
||||||
|
|
||||||
DEBUG_CALL("m_free");
|
DEBUG_CALL("m_free");
|
||||||
DEBUG_ARG("m = %lx", (long )m);
|
DEBUG_ARG("m = %p", m);
|
||||||
|
|
||||||
if(m) {
|
if(m) {
|
||||||
/* Remove from m_usedlist */
|
/* Remove from m_usedlist */
|
||||||
|
@ -221,7 +221,7 @@ dtom(Slirp *slirp, void *dat)
|
||||||
struct mbuf *m;
|
struct mbuf *m;
|
||||||
|
|
||||||
DEBUG_CALL("dtom");
|
DEBUG_CALL("dtom");
|
||||||
DEBUG_ARG("dat = %lx", (long )dat);
|
DEBUG_ARG("dat = %p", dat);
|
||||||
|
|
||||||
/* bug corrected for M_EXT buffers */
|
/* bug corrected for M_EXT buffers */
|
||||||
for (m = slirp->m_usedlist.m_next; m != &slirp->m_usedlist;
|
for (m = slirp->m_usedlist.m_next; m != &slirp->m_usedlist;
|
||||||
|
|
|
@ -123,9 +123,9 @@ fork_exec(struct socket *so, const char *ex, int do_pty)
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
DEBUG_CALL("fork_exec");
|
DEBUG_CALL("fork_exec");
|
||||||
DEBUG_ARG("so = %lx", (long)so);
|
DEBUG_ARG("so = %p", so);
|
||||||
DEBUG_ARG("ex = %lx", (long)ex);
|
DEBUG_ARG("ex = %p", ex);
|
||||||
DEBUG_ARG("do_pty = %lx", (long)do_pty);
|
DEBUG_ARG("do_pty = %x", do_pty);
|
||||||
|
|
||||||
if (do_pty == 2) {
|
if (do_pty == 2) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -72,8 +72,8 @@ sbappend(struct socket *so, struct mbuf *m)
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
DEBUG_CALL("sbappend");
|
DEBUG_CALL("sbappend");
|
||||||
DEBUG_ARG("so = %lx", (long)so);
|
DEBUG_ARG("so = %p", so);
|
||||||
DEBUG_ARG("m = %lx", (long)m);
|
DEBUG_ARG("m = %p", m);
|
||||||
DEBUG_ARG("m->m_len = %d", m->m_len);
|
DEBUG_ARG("m->m_len = %d", m->m_len);
|
||||||
|
|
||||||
/* Shouldn't happen, but... e.g. foreign host closes connection */
|
/* Shouldn't happen, but... e.g. foreign host closes connection */
|
||||||
|
|
|
@ -91,7 +91,7 @@ size_t sopreprbuf(struct socket *so, struct iovec *iov, int *np)
|
||||||
int mss = so->so_tcpcb->t_maxseg;
|
int mss = so->so_tcpcb->t_maxseg;
|
||||||
|
|
||||||
DEBUG_CALL("sopreprbuf");
|
DEBUG_CALL("sopreprbuf");
|
||||||
DEBUG_ARG("so = %lx", (long )so);
|
DEBUG_ARG("so = %p", so);
|
||||||
|
|
||||||
if (len <= 0)
|
if (len <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -155,7 +155,7 @@ soread(struct socket *so)
|
||||||
struct iovec iov[2];
|
struct iovec iov[2];
|
||||||
|
|
||||||
DEBUG_CALL("soread");
|
DEBUG_CALL("soread");
|
||||||
DEBUG_ARG("so = %lx", (long )so);
|
DEBUG_ARG("so = %p", so);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* No need to check if there's enough room to read.
|
* No need to check if there's enough room to read.
|
||||||
|
@ -215,7 +215,7 @@ int soreadbuf(struct socket *so, const char *buf, int size)
|
||||||
struct iovec iov[2];
|
struct iovec iov[2];
|
||||||
|
|
||||||
DEBUG_CALL("soreadbuf");
|
DEBUG_CALL("soreadbuf");
|
||||||
DEBUG_ARG("so = %lx", (long )so);
|
DEBUG_ARG("so = %p", so);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* No need to check if there's enough room to read.
|
* No need to check if there's enough room to read.
|
||||||
|
@ -263,7 +263,7 @@ sorecvoob(struct socket *so)
|
||||||
struct tcpcb *tp = sototcpcb(so);
|
struct tcpcb *tp = sototcpcb(so);
|
||||||
|
|
||||||
DEBUG_CALL("sorecvoob");
|
DEBUG_CALL("sorecvoob");
|
||||||
DEBUG_ARG("so = %lx", (long)so);
|
DEBUG_ARG("so = %p", so);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We take a guess at how much urgent data has arrived.
|
* We take a guess at how much urgent data has arrived.
|
||||||
|
@ -293,7 +293,7 @@ sosendoob(struct socket *so)
|
||||||
int n, len;
|
int n, len;
|
||||||
|
|
||||||
DEBUG_CALL("sosendoob");
|
DEBUG_CALL("sosendoob");
|
||||||
DEBUG_ARG("so = %lx", (long)so);
|
DEBUG_ARG("so = %p", so);
|
||||||
DEBUG_ARG("sb->sb_cc = %d", sb->sb_cc);
|
DEBUG_ARG("sb->sb_cc = %d", sb->sb_cc);
|
||||||
|
|
||||||
if (so->so_urgc > 2048)
|
if (so->so_urgc > 2048)
|
||||||
|
@ -351,7 +351,7 @@ sowrite(struct socket *so)
|
||||||
struct iovec iov[2];
|
struct iovec iov[2];
|
||||||
|
|
||||||
DEBUG_CALL("sowrite");
|
DEBUG_CALL("sowrite");
|
||||||
DEBUG_ARG("so = %lx", (long)so);
|
DEBUG_ARG("so = %p", so);
|
||||||
|
|
||||||
if (so->so_urgc) {
|
if (so->so_urgc) {
|
||||||
sosendoob(so);
|
sosendoob(so);
|
||||||
|
@ -441,7 +441,7 @@ sorecvfrom(struct socket *so)
|
||||||
socklen_t addrlen = sizeof(struct sockaddr_in);
|
socklen_t addrlen = sizeof(struct sockaddr_in);
|
||||||
|
|
||||||
DEBUG_CALL("sorecvfrom");
|
DEBUG_CALL("sorecvfrom");
|
||||||
DEBUG_ARG("so = %lx", (long)so);
|
DEBUG_ARG("so = %p", so);
|
||||||
|
|
||||||
if (so->so_type == IPPROTO_ICMP) { /* This is a "ping" reply */
|
if (so->so_type == IPPROTO_ICMP) { /* This is a "ping" reply */
|
||||||
char buff[256];
|
char buff[256];
|
||||||
|
@ -543,8 +543,8 @@ sosendto(struct socket *so, struct mbuf *m)
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
|
|
||||||
DEBUG_CALL("sosendto");
|
DEBUG_CALL("sosendto");
|
||||||
DEBUG_ARG("so = %lx", (long)so);
|
DEBUG_ARG("so = %p", so);
|
||||||
DEBUG_ARG("m = %lx", (long)m);
|
DEBUG_ARG("m = %p", m);
|
||||||
|
|
||||||
addr.sin_family = AF_INET;
|
addr.sin_family = AF_INET;
|
||||||
if ((so->so_faddr.s_addr & slirp->vnetwork_mask.s_addr) ==
|
if ((so->so_faddr.s_addr & slirp->vnetwork_mask.s_addr) ==
|
||||||
|
|
|
@ -231,8 +231,8 @@ tcp_input(struct mbuf *m, int iphlen, struct socket *inso)
|
||||||
Slirp *slirp;
|
Slirp *slirp;
|
||||||
|
|
||||||
DEBUG_CALL("tcp_input");
|
DEBUG_CALL("tcp_input");
|
||||||
DEBUG_ARGS((dfd, " m = %8lx iphlen = %2d inso = %lx\n",
|
DEBUG_ARGS((dfd, " m = %p iphlen = %2d inso = %p\n",
|
||||||
(long )m, iphlen, (long )inso ));
|
m, iphlen, inso));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If called with m == 0, then we're continuing the connect
|
* If called with m == 0, then we're continuing the connect
|
||||||
|
@ -923,8 +923,8 @@ trimthenstep6:
|
||||||
|
|
||||||
if (SEQ_LEQ(ti->ti_ack, tp->snd_una)) {
|
if (SEQ_LEQ(ti->ti_ack, tp->snd_una)) {
|
||||||
if (ti->ti_len == 0 && tiwin == tp->snd_wnd) {
|
if (ti->ti_len == 0 && tiwin == tp->snd_wnd) {
|
||||||
DEBUG_MISC((dfd, " dup ack m = %lx so = %lx\n",
|
DEBUG_MISC((dfd, " dup ack m = %p so = %p\n",
|
||||||
(long )m, (long )so));
|
m, so));
|
||||||
/*
|
/*
|
||||||
* If we have outstanding data (other than
|
* If we have outstanding data (other than
|
||||||
* a window probe), this is a completely
|
* a window probe), this is a completely
|
||||||
|
@ -1302,7 +1302,7 @@ tcp_dooptions(struct tcpcb *tp, u_char *cp, int cnt, struct tcpiphdr *ti)
|
||||||
int opt, optlen;
|
int opt, optlen;
|
||||||
|
|
||||||
DEBUG_CALL("tcp_dooptions");
|
DEBUG_CALL("tcp_dooptions");
|
||||||
DEBUG_ARGS((dfd, " tp = %lx cnt=%i\n", (long)tp, cnt));
|
DEBUG_ARGS((dfd, " tp = %p cnt=%i\n", tp, cnt));
|
||||||
|
|
||||||
for (; cnt > 0; cnt -= optlen, cp += optlen) {
|
for (; cnt > 0; cnt -= optlen, cp += optlen) {
|
||||||
opt = cp[0];
|
opt = cp[0];
|
||||||
|
@ -1383,7 +1383,7 @@ tcp_xmit_timer(register struct tcpcb *tp, int rtt)
|
||||||
register short delta;
|
register short delta;
|
||||||
|
|
||||||
DEBUG_CALL("tcp_xmit_timer");
|
DEBUG_CALL("tcp_xmit_timer");
|
||||||
DEBUG_ARG("tp = %lx", (long)tp);
|
DEBUG_ARG("tp = %p", tp);
|
||||||
DEBUG_ARG("rtt = %d", rtt);
|
DEBUG_ARG("rtt = %d", rtt);
|
||||||
|
|
||||||
if (tp->t_srtt != 0) {
|
if (tp->t_srtt != 0) {
|
||||||
|
@ -1471,7 +1471,7 @@ tcp_mss(struct tcpcb *tp, u_int offer)
|
||||||
int mss;
|
int mss;
|
||||||
|
|
||||||
DEBUG_CALL("tcp_mss");
|
DEBUG_CALL("tcp_mss");
|
||||||
DEBUG_ARG("tp = %lx", (long)tp);
|
DEBUG_ARG("tp = %p", tp);
|
||||||
DEBUG_ARG("offer = %d", offer);
|
DEBUG_ARG("offer = %d", offer);
|
||||||
|
|
||||||
mss = min(IF_MTU, IF_MRU) - sizeof(struct tcpiphdr);
|
mss = min(IF_MTU, IF_MRU) - sizeof(struct tcpiphdr);
|
||||||
|
|
|
@ -66,7 +66,7 @@ tcp_output(struct tcpcb *tp)
|
||||||
int idle, sendalot;
|
int idle, sendalot;
|
||||||
|
|
||||||
DEBUG_CALL("tcp_output");
|
DEBUG_CALL("tcp_output");
|
||||||
DEBUG_ARG("tp = %lx", (long )tp);
|
DEBUG_ARG("tp = %p", tp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determine length of data that should be transmitted,
|
* Determine length of data that should be transmitted,
|
||||||
|
|
|
@ -224,7 +224,7 @@ tcp_newtcpcb(struct socket *so)
|
||||||
struct tcpcb *tcp_drop(struct tcpcb *tp, int err)
|
struct tcpcb *tcp_drop(struct tcpcb *tp, int err)
|
||||||
{
|
{
|
||||||
DEBUG_CALL("tcp_drop");
|
DEBUG_CALL("tcp_drop");
|
||||||
DEBUG_ARG("tp = %lx", (long)tp);
|
DEBUG_ARG("tp = %p", tp);
|
||||||
DEBUG_ARG("errno = %d", errno);
|
DEBUG_ARG("errno = %d", errno);
|
||||||
|
|
||||||
if (TCPS_HAVERCVDSYN(tp->t_state)) {
|
if (TCPS_HAVERCVDSYN(tp->t_state)) {
|
||||||
|
@ -249,7 +249,7 @@ tcp_close(struct tcpcb *tp)
|
||||||
register struct mbuf *m;
|
register struct mbuf *m;
|
||||||
|
|
||||||
DEBUG_CALL("tcp_close");
|
DEBUG_CALL("tcp_close");
|
||||||
DEBUG_ARG("tp = %lx", (long )tp);
|
DEBUG_ARG("tp = %p", tp);
|
||||||
|
|
||||||
/* free the reassembly queue, if any */
|
/* free the reassembly queue, if any */
|
||||||
t = tcpfrag_list_first(tp);
|
t = tcpfrag_list_first(tp);
|
||||||
|
@ -290,7 +290,7 @@ tcp_sockclosed(struct tcpcb *tp)
|
||||||
{
|
{
|
||||||
|
|
||||||
DEBUG_CALL("tcp_sockclosed");
|
DEBUG_CALL("tcp_sockclosed");
|
||||||
DEBUG_ARG("tp = %lx", (long)tp);
|
DEBUG_ARG("tp = %p", tp);
|
||||||
|
|
||||||
switch (tp->t_state) {
|
switch (tp->t_state) {
|
||||||
|
|
||||||
|
@ -330,7 +330,7 @@ int tcp_fconnect(struct socket *so)
|
||||||
int ret=0;
|
int ret=0;
|
||||||
|
|
||||||
DEBUG_CALL("tcp_fconnect");
|
DEBUG_CALL("tcp_fconnect");
|
||||||
DEBUG_ARG("so = %lx", (long )so);
|
DEBUG_ARG("so = %p", so);
|
||||||
|
|
||||||
if( (ret = so->s = qemu_socket(AF_INET,SOCK_STREAM,0)) >= 0) {
|
if( (ret = so->s = qemu_socket(AF_INET,SOCK_STREAM,0)) >= 0) {
|
||||||
int opt, s=so->s;
|
int opt, s=so->s;
|
||||||
|
@ -393,7 +393,7 @@ void tcp_connect(struct socket *inso)
|
||||||
int s, opt;
|
int s, opt;
|
||||||
|
|
||||||
DEBUG_CALL("tcp_connect");
|
DEBUG_CALL("tcp_connect");
|
||||||
DEBUG_ARG("inso = %lx", (long)inso);
|
DEBUG_ARG("inso = %p", inso);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If it's an SS_ACCEPTONCE socket, no need to socreate()
|
* If it's an SS_ACCEPTONCE socket, no need to socreate()
|
||||||
|
@ -564,8 +564,8 @@ tcp_emu(struct socket *so, struct mbuf *m)
|
||||||
char *bptr;
|
char *bptr;
|
||||||
|
|
||||||
DEBUG_CALL("tcp_emu");
|
DEBUG_CALL("tcp_emu");
|
||||||
DEBUG_ARG("so = %lx", (long)so);
|
DEBUG_ARG("so = %p", so);
|
||||||
DEBUG_ARG("m = %lx", (long)m);
|
DEBUG_ARG("m = %p", m);
|
||||||
|
|
||||||
switch(so->so_emu) {
|
switch(so->so_emu) {
|
||||||
int x, i;
|
int x, i;
|
||||||
|
@ -900,7 +900,7 @@ int tcp_ctl(struct socket *so)
|
||||||
int do_pty;
|
int do_pty;
|
||||||
|
|
||||||
DEBUG_CALL("tcp_ctl");
|
DEBUG_CALL("tcp_ctl");
|
||||||
DEBUG_ARG("so = %lx", (long )so);
|
DEBUG_ARG("so = %p", so);
|
||||||
|
|
||||||
if (so->so_faddr.s_addr != slirp->vhost_addr.s_addr) {
|
if (so->so_faddr.s_addr != slirp->vhost_addr.s_addr) {
|
||||||
/* Check if it's pty_exec */
|
/* Check if it's pty_exec */
|
||||||
|
|
|
@ -72,7 +72,7 @@ udp_input(register struct mbuf *m, int iphlen)
|
||||||
struct socket *so;
|
struct socket *so;
|
||||||
|
|
||||||
DEBUG_CALL("udp_input");
|
DEBUG_CALL("udp_input");
|
||||||
DEBUG_ARG("m = %lx", (long)m);
|
DEBUG_ARG("m = %p", m);
|
||||||
DEBUG_ARG("iphlen = %d", iphlen);
|
DEBUG_ARG("iphlen = %d", iphlen);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -241,8 +241,8 @@ int udp_output2(struct socket *so, struct mbuf *m,
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
DEBUG_CALL("udp_output");
|
DEBUG_CALL("udp_output");
|
||||||
DEBUG_ARG("so = %lx", (long)so);
|
DEBUG_ARG("so = %p", so);
|
||||||
DEBUG_ARG("m = %lx", (long)m);
|
DEBUG_ARG("m = %p", m);
|
||||||
DEBUG_ARG("saddr = %lx", (long)saddr->sin_addr.s_addr);
|
DEBUG_ARG("saddr = %lx", (long)saddr->sin_addr.s_addr);
|
||||||
DEBUG_ARG("daddr = %lx", (long)daddr->sin_addr.s_addr);
|
DEBUG_ARG("daddr = %lx", (long)daddr->sin_addr.s_addr);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue