Net patches
Subsystems (2)
The following changes since commit 32c7e0ab755745e961f1772e95cac381cc68769d:
Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20170421' into staging (2017-04-21 15:59:27 +0100)
are available in the git repository at:
https://github.com/jasowang/qemu.git tags/net-pull-request
for you to fetch changes up to 049f6d8237dd0b14dee02e4c22b20114c43cecff:
COLO-compare: Optimize tcp compare trace event (2017-04-24 11:30:36 +0800)
----------------------------------------------------------------
----------------------------------------------------------------
Cédric Le Goater (5):
hw/net: add MII definitions
net: add FTGMAC100 support
net/ftgmac100: add a 'aspeed' property
aspeed: add a FTGMAC100 nic
slirp: add a fake NC-SI backend
Zhang Chen (3):
colo-compare: Fix old packet check bug.
COLO-compare: Optimize tcp compare for option field
COLO-compare: Optimize tcp compare trace event
default-configs/arm-softmmu.mak | 1 + hw/arm/aspeed_soc.c | 21 + hw/net/Makefile.objs | 1 + hw/net/ftgmac100.c | 1016 +++++++++++++++++++++++++++++++++++++++ include/hw/arm/aspeed_soc.h | 2 + include/hw/net/ftgmac100.h | 64 +++ include/hw/net/mii.h | 71 ++- include/net/eth.h | 1 + net/colo-compare.c | 69 ++- net/trace-events | 3 +- slirp/Makefile.objs | 2 +- slirp/ncsi-pkt.h | 419 ++++++++++++++++ slirp/ncsi.c | 130 +++++ slirp/slirp.c | 4 + slirp/slirp.h | 3 + 15 files changed, 1770 insertions(+), 37 deletions(-) create mode 100644 hw/net/ftgmac100.c create mode 100644 include/hw/net/ftgmac100.h create mode 100644 slirp/ncsi-pkt.h create mode 100644 slirp/ncsi.c
[Qemu-devel] [PULL 1/8] colo-compare: Fix old packet check bug.
From: Zhang Chen <[email protected]>
If colo-compare find one old packet,we can notify colo-frame do checkpoint, no need continue find more old packet here.
--- net/colo-compare.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
net/colo-compare.c +11 -4
@@ -372,10 +372,9 @@ static int colo_old_packet_check_one(Packet *pkt, int64_t *check_time) } } -static void colo_old_packet_check_one_conn (void *opaque, -void *user_data) +static int colo_old_packet_check_one_conn (Connection *conn, +void *user_data) { -Connection *conn = opaque;GList *result =NULL ;int64_t check_time =REGULAR_PACKET_CHECK_MS ;
@@ -386,7 +385,10 @@ static void colo_old_packet_check_one_conn(void *opaque,if (result) {/* do checkpoint will flush old packet */ /* TODO: colo_notify_checkpoint();*/ +return 0 ; } + +return 1 ; }/*
@@ -398,7 +400,12 @@ static void colo_old_packet_check(void *opaque) {CompareState *s = opaque; -g_queue_foreach (&s->conn_list, colo_old_packet_check_one_conn,NULL ); +/* +* If we find one old packet, stop finding job and notify +* COLO frame do checkpoint. +*/ +g_queue_find_custom (&s->conn_list,NULL , + (GCompareFunc )colo_old_packet_check_one_conn); }/*
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 2/8] hw/net: add MII definitions
In reply to Jason WangFrom: Cédric Le Goater <[email protected]>
This adds comments on the Basic mode control and status registers bit definitions. It also adds a couple of bits for 1000BASE-T and the RealTek 8211E PHY for the FTGMAC100 model to use.
--- include/hw/net/mii.h | 71 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 53 insertions(+), 18 deletions(-)
include/hw/net/mii.h +53 -18
@@ -22,13 +22,20 @@#define MII_H /* PHY registers */ -#define MII_BMCR 0 -#define MII_BMSR 1 -#define MII_PHYID1 2 -#define MII_PHYID2 3 -#define MII_ANAR 4 -#define MII_ANLPAR 5 -#define MII_ANER 6 +#define MII_BMCR 0/* Basic mode control register */ +#define MII_BMSR 1/* Basic mode status register */ +#define MII_PHYID1 2/* ID register 1 */ +#define MII_PHYID2 3/* ID register 2 */ +#define MII_ANAR 4/* Autonegotiation advertisement */ +#define MII_ANLPAR 5/* Autonegotiation lnk partner abilities */ +#define MII_ANER 6/* Autonegotiation expansion */ +#define MII_ANNP 7/* Autonegotiation next page */ +#define MII_ANLPRNP 8/* Autonegotiation link partner rx next page */ +#define MII_CTRL1000 9/* 1000BASE-T control */ +#define MII_STAT1000 10/* 1000BASE-T status */ +#define MII_MDDACR 13/* MMD access control */ +#define MII_MDDAADR 14/* MMD access address data */ +#define MII_EXTSTAT 15/* Extended Status */ #define MII_NSR 16#define MII_LBREMR 17#define MII_REC 18
@@ -38,19 +45,33 @@/* PHY registers fields */ #define MII_BMCR_RESET (1 << 15)#define MII_BMCR_LOOPBACK (1 << 14) -#define MII_BMCR_SPEED (1 << 13) -#define MII_BMCR_AUTOEN (1 << 12) -#define MII_BMCR_FD (1 << 8) +#define MII_BMCR_SPEED100 (1 << 13)/* LSB of Speed (100) */ +#define MII_BMCR_SPEED MII_BMCR_SPEED100 +#define MII_BMCR_AUTOEN (1 << 12)/* Autonegotiation enable */ +#define MII_BMCR_PDOWN (1 << 11)/* Enable low power state */ +#define MII_BMCR_ISOLATE (1 << 10)/* Isolate data paths from MII */ +#define MII_BMCR_ANRESTART (1 << 9)/* Auto negotiation restart */ +#define MII_BMCR_FD (1 << 8)/* Set duplex mode */ +#define MII_BMCR_CTST (1 << 7)/* Collision test */ +#define MII_BMCR_SPEED1000 (1 << 6)/* MSB of Speed (1000) */ -#define MII_BMSR_100TX_FD (1 << 14) -#define MII_BMSR_100TX_HD (1 << 13) -#define MII_BMSR_10T_FD (1 << 12) -#define MII_BMSR_10T_HD (1 << 11) -#define MII_BMSR_MFPS (1 << 6) -#define MII_BMSR_AN_COMP (1 << 5) -#define MII_BMSR_AUTONEG (1 << 3) -#define MII_BMSR_LINK_ST (1 << 2) +#define MII_BMSR_100TX_FD (1 << 14)/* Can do 100mbps, full-duplex */ +#define MII_BMSR_100TX_HD (1 << 13)/* Can do 100mbps, half-duplex */ +#define MII_BMSR_10T_FD (1 << 12)/* Can do 10mbps, full-duplex */ +#define MII_BMSR_10T_HD (1 << 11)/* Can do 10mbps, half-duplex */ +#define MII_BMSR_100T2_FD (1 << 10)/* Can do 100mbps T2, full-duplex */ +#define MII_BMSR_100T2_HD (1 << 9)/* Can do 100mbps T2, half-duplex */ +#define MII_BMSR_EXTSTAT (1 << 8)/* Extended status in register 15 */ +#define MII_BMSR_MFPS (1 << 6)/* MII Frame Preamble Suppression */ +#define MII_BMSR_AN_COMP (1 << 5)/* Auto-negotiation complete */ +#define MII_BMSR_RFAULT (1 << 4)/* Remote fault */ +#define MII_BMSR_AUTONEG (1 << 3)/* Able to do auto-negotiation */ +#define MII_BMSR_LINK_ST (1 << 2)/* Link status */ +#define MII_BMSR_JABBER (1 << 1)/* Jabber detected */ +#define MII_BMSR_EXTCAP (1 << 0)/* Ext-reg capability */ +#define MII_ANAR_PAUSE_ASYM (1 << 11)/* Try for asymetric pause */ +#define MII_ANAR_PAUSE (1 << 10)/* Try for pause */ #define MII_ANAR_TXFD (1 << 8)#define MII_ANAR_TX (1 << 7)#define MII_ANAR_10FD (1 << 6)
@@ -58,17 +79,31 @@#define MII_ANAR_CSMACD (1 << 0)#define MII_ANLPAR_ACK (1 << 14) +#define MII_ANLPAR_PAUSEASY (1 << 11)/* can pause asymmetrically */ +#define MII_ANLPAR_PAUSE (1 << 10)/* can pause */ #define MII_ANLPAR_TXFD (1 << 8)#define MII_ANLPAR_TX (1 << 7)#define MII_ANLPAR_10FD (1 << 6)#define MII_ANLPAR_10 (1 << 5)#define MII_ANLPAR_CSMACD (1 << 0) +#define MII_ANER_NWAY (1 << 0)/* Can do N-way auto-nego */ + +#define MII_CTRL1000_FULL (1 << 9)/* 1000BASE-T full duplex */ +#define MII_CTRL1000_HALF (1 << 8)/* 1000BASE-T half duplex */ + +#define MII_STAT1000_FULL (1 << 11)/* 1000BASE-T full duplex */ +#define MII_STAT1000_HALF (1 << 10)/* 1000BASE-T half duplex */ +/* List of vendor identifiers */ /* RealTek 8201 */ #define RTL8201CP_PHYID1 0x0000#define RTL8201CP_PHYID2 0x8201 +/* RealTek 8211E */ +#define RTL8211E_PHYID1 0x001c +#define RTL8211E_PHYID2 0xc915 +/* National Semiconductor DP83848 */ #define DP83848_PHYID1 0x2000#define DP83848_PHYID2 0x5c90
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 4/8] net/ftgmac100: add a 'aspeed' property
In reply to Jason WangFrom: Cédric Le Goater <[email protected]>
The Aspeed SoCs have a different definition of the end of the ring buffer bit. Add a property to specify which set of bits should be used by the NIC.
--- hw/net/ftgmac100.c | 17 +++++++++++++++-- include/hw/net/ftgmac100.h | 4 ++++ 2 files changed, 19 insertions(+), 2 deletions(-)
hw/net/ftgmac100.c +15 -2
@@ -126,6 +126,7 @@#define FTGMAC100_TXDES0_CRC_ERR (1 << 19)#define FTGMAC100_TXDES0_LTS (1 << 28)#define FTGMAC100_TXDES0_FTS (1 << 29) +#define FTGMAC100_TXDES0_EDOTR_ASPEED (1 << 30)#define FTGMAC100_TXDES0_TXDMA_OWN (1 << 31)#define FTGMAC100_TXDES1_VLANTAG_CI (x) ((x) & 0xffff)
@@ -154,6 +155,7 @@#define FTGMAC100_RXDES0_PAUSE_FRAME (1 << 25)#define FTGMAC100_RXDES0_LRS (1 << 28)#define FTGMAC100_RXDES0_FRS (1 << 29) +#define FTGMAC100_RXDES0_EDORR_ASPEED (1 << 30)#define FTGMAC100_RXDES0_RXPKT_RDY (1 << 31)#define FTGMAC100_RXDES1_VLANTAG_CI 0xffff
@@ -462,7 +464,7 @@ static void ftgmac100_do_tx(FTGMAC100State *s, uint32_t tx_ring,/* Write back the modified descriptor. */ ftgmac100_write_bd (&bd, addr);/* Advance to the next descriptor. */ -if (bd.des0 &FTGMAC100_TXDES0_EDOTR ) { +if (bd.des0 & s->txdes0_edotr) { addr = tx_ring; }else { addr +=sizeof (FTGMAC100Desc);
@@ -880,7 +882,7 @@ static ssize_t ftgmac100_receive(NetClientState *nc, const uint8_t *buf, s->isr |=FTGMAC100_INT_RPKT_FIFO ; }ftgmac100_write_bd (&bd, addr); -if (bd.des0 &FTGMAC100_RXDES0_EDORR ) { +if (bd.des0 & s->rxdes0_edorr) { addr = s->rx_ring; }else { addr +=sizeof (FTGMAC100Desc);
@@ -921,6 +923,14 @@ static void ftgmac100_realize(DeviceState *dev, Error **errp)FTGMAC100State *s =FTGMAC100 (dev);SysBusDevice *sbd =SYS_BUS_DEVICE (dev); +if (s->aspeed) { + s->txdes0_edotr =FTGMAC100_TXDES0_EDOTR_ASPEED ; + s->rxdes0_edorr =FTGMAC100_RXDES0_EDORR_ASPEED ; + }else { + s->txdes0_edotr =FTGMAC100_TXDES0_EDOTR ; + s->rxdes0_edorr =FTGMAC100_RXDES0_EDORR ; + } +memory_region_init_io (&s->iomem,OBJECT (dev), &ftgmac100_ops, s,TYPE_FTGMAC100 ,0x2000 );sysbus_init_mmio (sbd, &s->iomem);
@@ -967,11 +977,14 @@ static const VMStateDescription vmstate_ftgmac100 = {VMSTATE_UINT32 (phy_advertise, FTGMAC100State),VMSTATE_UINT32 (phy_int, FTGMAC100State),VMSTATE_UINT32 (phy_int_mask, FTGMAC100State), +VMSTATE_UINT32 (txdes0_edotr, FTGMAC100State), +VMSTATE_UINT32 (rxdes0_edorr, FTGMAC100State), VMSTATE_END_OF_LIST() } };static Property ftgmac100_properties[] = { +DEFINE_PROP_BOOL ("aspeed" , FTGMAC100State, aspeed, false),DEFINE_NIC_PROPERTIES (FTGMAC100State, conf),DEFINE_PROP_END_OF_LIST (), };
include/hw/net/ftgmac100.h +4 -0
@@ -55,6 +55,10 @@ typedef struct FTGMAC100State {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
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 3/8] net: add FTGMAC100 support
In reply to Jason WangFrom: Cédric Le Goater <[email protected]>
The FTGMAC100 device is an Ethernet controller with DMA function that can be found on Aspeed SoCs (which include NCSI).
It is fully compliant with IEEE 802.3 specification for 10/100 Mbps Ethernet and IEEE 802.3z specification for 1000 Mbps Ethernet and includes Reduced Media Independent Interface (RMII) and Reduced Gigabit Media Independent Interface (RGMII) interfaces. It adopts an AHB bus interface and integrates a link list DMA engine with direct M-Bus accesses for transmitting and receiving packets. It has independent TX/RX fifos, supports half and full duplex (1000 Mbps mode only supports full duplex), flow control for full duplex and backpressure for half duplex.
The FTGMAC100 also implements IP, TCP, UDP checksum offloads and supports IEEE 802.1Q VLAN tag insertion and removal. It offers high-priority transmit queue for QoS and CoS applications
This model is backed with a RealTek 8211E PHY which is the chip found on the AST2500 EVB. It is complete enough to satisfy two different Linux drivers and a U-Boot driver. Not supported features are :
- IEEE 802.1Q VLAN
- High Priority Transmit Queue
- Wake-On-LAN functions
The code is based on the Coldfire Fast Ethernet Controller model.
--- default-configs/arm-softmmu.mak | 1 + hw/net/Makefile.objs | 1 + hw/net/ftgmac100.c | 1003 +++++++++++++++++++++++++++++++++++++++ include/hw/net/ftgmac100.h | 60 +++ 4 files changed, 1065 insertions(+) create mode 100644 hw/net/ftgmac100.c create mode 100644 include/hw/net/ftgmac100.h
default-configs/arm-softmmu.mak +1 -0
@@ -29,6 +29,7 @@ CONFIG_LAN9118=y CONFIG_SMC91C111=y CONFIG_ALLWINNER_EMAC=y CONFIG_IMX_FEC=y +CONFIG_FTGMAC100=y CONFIG_DS1338=y CONFIG_PFLASH_CFI01=y CONFIG_PFLASH_CFI02=y
hw/net/Makefile.objs +1 -0
@@ -26,6 +26,7 @@ common-obj-$(CONFIG_IMX_FEC) += imx_fec.o common-obj-$(CONFIG_CADENCE) += cadence_gem.o common-obj-$(CONFIG_STELLARIS_ENET) += stellaris_enet.o common-obj-$(CONFIG_LANCE) += lance.o +common-obj-$(CONFIG_FTGMAC100) += ftgmac100.o obj-$(CONFIG_ETRAXFS) += etraxfs_eth.o obj-$(CONFIG_COLDFIRE) += mcf_fec.o
hw/net/ftgmac100.c new file +1003 -0
1,003 lines not on this page · raw message
include/hw/net/ftgmac100.h new file +60 -0
60 lines not on this page · raw message
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 5/8] aspeed: add a FTGMAC100 nic
In reply to Jason WangFrom: Cédric Le Goater <[email protected]>
There is a second NIC but we do not use it for the moment. We use the 'aspeed' property to tune the definition of the end of ring buffer bit for the Aspeed SoCs.
--- hw/arm/aspeed_soc.c | 21 +++++++++++++++++++++ include/hw/arm/aspeed_soc.h | 2 ++ 2 files changed, 23 insertions(+)
hw/arm/aspeed_soc.c +21 -0
@@ -19,6 +19,7 @@#include "hw/char/serial.h" #include "qemu/log.h" #include "hw/i2c/aspeed_i2c.h" +#include "net/net.h" #define ASPEED_SOC_UART_5_BASE 0x00184000#define ASPEED_SOC_IOMEM_SIZE 0x00200000
@@ -33,6 +34,8 @@#define ASPEED_SOC_TIMER_BASE 0x1E782000#define ASPEED_SOC_WDT_BASE 0x1E785000#define ASPEED_SOC_I2C_BASE 0x1E78A000 +#define ASPEED_SOC_ETH1_BASE 0x1E660000 +#define ASPEED_SOC_ETH2_BASE 0x1E680000static const int uart_irqs[] = {9 ,32 ,33 ,34 ,10 };static const int timer_irqs[] = {16 ,17 ,18 ,35 ,36 ,37 ,38 ,39 , };
@@ -175,6 +178,10 @@ static void aspeed_soc_init(Object *obj)object_initialize (&s->wdt,sizeof (s->wdt),TYPE_ASPEED_WDT );object_property_add_child (obj,"wdt" ,OBJECT (&s->wdt),NULL );qdev_set_parent_bus (DEVICE (&s->wdt),sysbus_get_default ()); + +object_initialize (&s->ftgmac100,sizeof (s->ftgmac100),TYPE_FTGMAC100 ); +object_property_add_child (obj,"ftgmac100" ,OBJECT (&s->ftgmac100),NULL ); +qdev_set_parent_bus (DEVICE (&s->ftgmac100),sysbus_get_default ()); }static void aspeed_soc_realize (DeviceState *dev,Error **errp)
@@ -299,6 +306,20 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)return ; }sysbus_mmio_map (SYS_BUS_DEVICE (&s->wdt),0 ,ASPEED_SOC_WDT_BASE ); + +/* Net */ +qdev_set_nic_properties (DEVICE (&s->ftgmac100), &nd_table[0 ]); +object_property_set_bool (OBJECT (&s->ftgmac100), true,"aspeed" , &err); +object_property_set_bool (OBJECT (&s->ftgmac100), true,"realized" , + &local_err); +error_propagate (&err, local_err); +if (err) { +error_propagate (errp, err); +return ; + } +sysbus_mmio_map (SYS_BUS_DEVICE (&s->ftgmac100),0 ,ASPEED_SOC_ETH1_BASE ); +sysbus_connect_irq (SYS_BUS_DEVICE (&s->ftgmac100),0 , +qdev_get_gpio_in (DEVICE (&s->vic),2 )); }static void aspeed_soc_class_init (ObjectClass *oc,void *data)
include/hw/arm/aspeed_soc.h +2 -0
@@ -20,6 +20,7 @@#include "hw/i2c/aspeed_i2c.h" #include "hw/ssi/aspeed_smc.h" #include "hw/watchdog/wdt_aspeed.h" +#include "hw/net/ftgmac100.h" #define ASPEED_SPIS_NUM 2
@@ -39,6 +40,7 @@ typedef struct AspeedSoCState {AspeedSMCState spi[ASPEED_SPIS_NUM ];AspeedSDMCState sdmc;AspeedWDTState wdt; +FTGMAC100State ftgmac100; } AspeedSoCState;#define TYPE_ASPEED_SOC "aspeed-soc"
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 6/8] slirp: add a fake NC-SI backend
In reply to Jason WangFrom: Cédric Le Goater <[email protected]>
NC-SI (Network Controller Sideband Interface) enables a BMC to manage a set of NICs on a system. This model takes the simplest approach and reverses the NC-SI packets to pretend a NIC is present and exercise the Linux driver.
The NCSI header file <ncsi-pkt.h> comes from mainline Linux and was untabified.
--- include/net/eth.h | 1 + slirp/Makefile.objs | 2 +- slirp/ncsi-pkt.h | 419 ++++++++++++++++++++++++++++++++++++++++++++++++++++ slirp/ncsi.c | 130 ++++++++++++++++ slirp/slirp.c | 4 + slirp/slirp.h | 3 + 6 files changed, 558 insertions(+), 1 deletion(-) create mode 100644 slirp/ncsi-pkt.h create mode 100644 slirp/ncsi.c
include/net/eth.h +1 -0
@@ -209,6 +209,7 @@ struct tcp_hdr {#define ETH_P_IPV6 (0x86dd)#define ETH_P_VLAN (0x8100)#define ETH_P_DVLAN (0x88a8) +#define ETH_P_NCSI (0x88f8)#define ETH_P_UNKNOWN (0xffff)#define VLAN_VID_MASK 0x0fff#define IP_HEADER_VERSION_4 (4)
slirp/Makefile.objs +1 -1
@@ -2,4 +2,4 @@ common-obj-y = cksum.o if.o ip_icmp.o ip6_icmp.o ip6_input.o ip6_output.o \ ip_input.o ip_output.o dnssearch.o dhcpv6.o common-obj-y += slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o common-obj-y += tcp_subr.o tcp_timer.o udp.o udp6.o bootp.o tftp.o arp_table.o \ - ndp_table.o + ndp_table.o ncsi.o
slirp/ncsi-pkt.h new file +419 -0
419 lines not on this page · raw message
slirp/ncsi.c new file +130 -0
130 lines not on this page · raw message
slirp/slirp.c +4 -0
@@ -870,6 +870,10 @@ void slirp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len) }break ; +case ETH_P_NCSI : +ncsi_input (slirp, pkt, pkt_len); +break ; +default :break ; }
slirp/slirp.h +3 -0
@@ -231,6 +231,9 @@ extern Slirp *slirp_instance;void if_start (Slirp *); +/* ncsi.c */ +void ncsi_input (Slirp *slirp,const uint8_t *pkt,int pkt_len); +#ifndef _WIN32#include <netdb.h> #endif
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 7/8] COLO-compare: Optimize tcp compare for option field
In reply to Jason WangFrom: Zhang Chen <[email protected]>
In this patch we support packet that have tcp options field. Add tcp options field check, If the packet have options field we just skip it and compare tcp payload, Avoid unnecessary checkpoint, optimize performance.
--- net/colo-compare.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
net/colo-compare.c +26 -1
@@ -233,7 +233,32 @@ static int colo_packet_compare_tcp(Packet *spkt, Packet *ppkt) spkt->ip->ip_sum = ppkt->ip->ip_sum; } -if (ptcp->th_sum == stcp->th_sum) { +/* +* Check tcp header length for tcp option field. +* th_off > 5 means this tcp packet have options field. +* The tcp options maybe always different. +* for example: +* From RFC 7323. +* TCP Timestamps option (TSopt): +* Kind: 8 +* +* Length: 10 bytes +* +* +-------+-------+---------------------+---------------------+ +* |Kind=8 | 10 | TS Value (TSval) |TS Echo Reply (TSecr)| +* +-------+-------+---------------------+---------------------+ +* 1 1 4 4 +* +* In this case the primary guest's timestamp always different with +* the secondary guest's timestamp. COLO just focus on payload, +* so we just need skip this field. +*/ +if (ptcp->th_off >5 ) { +ptrdiff_t tcp_offset; + tcp_offset = ppkt->transport_header - (uint8_t *)ppkt->data + + (ptcp->th_off *4 ); + res =colo_packet_compare_common (ppkt, spkt, tcp_offset); + }else if (ptcp->th_sum == stcp->th_sum) { res =colo_packet_compare_common (ppkt, spkt,ETH_HLEN ); }else { res =-1 ;
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 8/8] COLO-compare: Optimize tcp compare trace event
In reply to Jason WangFrom: Zhang Chen <[email protected]>
Optimize two trace events as one, adjust print format make it easy to read. rename trace_colo_compare_pkt_info_src/dst to trace_colo_compare_tcp_info.
--- net/colo-compare.c | 29 +++++++++++++++++------------ net/trace-events | 3 +-- 2 files changed, 18 insertions(+), 14 deletions(-)
net/colo-compare.c +17 -12
@@ -264,18 +264,23 @@ static int colo_packet_compare_tcp(Packet *spkt, Packet *ppkt) res =-1 ; } -if (res !=0 &&trace_event_get_state (TRACE_COLO_COMPARE_MISCOMPARE )) { -trace_colo_compare_pkt_info_src (inet_ntoa (ppkt->ip->ip_src), -ntohl (stcp->th_seq), -ntohl (stcp->th_ack), - res, stcp->th_flags, - spkt->size); - -trace_colo_compare_pkt_info_dst (inet_ntoa (ppkt->ip->ip_dst), -ntohl (ptcp->th_seq), -ntohl (ptcp->th_ack), - res, ptcp->th_flags, - ppkt->size); +if (res &&trace_event_get_state (TRACE_COLO_COMPARE_MISCOMPARE )) { +char ip_src[20 ], ip_dst[20 ]; + +strcpy (ip_src,inet_ntoa (ppkt->ip->ip_src)); +strcpy (ip_dst,inet_ntoa (ppkt->ip->ip_dst)); + +trace_colo_compare_tcp_info (ip_src, + ip_dst, +ntohl (ptcp->th_seq), +ntohl (stcp->th_seq), +ntohl (ptcp->th_ack), +ntohl (stcp->th_ack), + res, + ptcp->th_flags, + stcp->th_flags, + ppkt->size, + spkt->size);qemu_hexdump ((char *)ppkt->data, stderr,"colo-compare ppkt" , ppkt->size);
net/trace-events +1 -2
@@ -13,8 +13,7 @@ colo_compare_icmp_miscompare(const char *sta, int size) ": %s = %d" colo_compare_ip_info(int psize, const char *sta, const char *stb, int ssize, const char *stc, const char *std) "ppkt size = %d, ip_src = %s, ip_dst = %s, spkt size = %d, ip_src = %s, ip_dst = %s" colo_old_packet_check_found(int64_t old_time) "%" PRId64 colo_compare_miscompare(void) "" -colo_compare_pkt_info_src(const char *src, uint32_t sseq, uint32_t sack, int res, uint32_t sflag, int ssize) "src/dst: %s s: seq/ack=%u/%u res=%d flags=%x spkt_size: %d\n" -colo_compare_pkt_info_dst(const char *dst, uint32_t dseq, uint32_t dack, int res, uint32_t dflag, int dsize) "src/dst: %s d: seq/ack=%u/%u res=%d flags=%x dpkt_size: %d\n" +colo_compare_tcp_info(const char *src, const char *dst, uint32_t pseq, uint32_t sseq, uint32_t pack, uint32_t sack, int res, uint32_t pflag, uint32_t sflag, int psize, int ssize) "src/dst: %s/%s pseq/sseq:%u/%u pack/sack:%u/%u res=%d pflags/sflag:%x/%x psize/ssize:%d/%d \n" # net/filter-rewriter.c colo_filter_rewriter_debug(void) ""
Signature · 1 line
2.7.4
Quoted 8 lines · Jason Wang
The following changes since commit
32c7e0ab755745e961f1772e95cac381cc68769d:Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20170421' into staging (2017-04-21 15:59:27 +0100)
are available in the git repository at:
https://github.com/jasowang/qemu.git tags/net-pull-request
Quoted 7 lines
for you to fetch changes up to
049f6d8237dd0b14dee02e4c22b20114c43cecff:COLO-compare: Optimize tcp compare trace event (2017-04-24 11:30:36 +0800)
----------------------------------------------------------------
----------------------------------------------------------------
Hi. Clang picks up what looks like a typo:
/Users/pm215/src/qemu-for-merges/hw/net/ftgmac100.c:809:33: error: use of logical '&&' with constant operand [-Werror,-Wconstant-logical-operand]
if (size < 64 && !(s->maccr && FTGMAC100_MACCR_RX_RUNT)) {
^ ~~~~~~~~~~~~~~~~~~~~~~~
/Users/pm215/src/qemu-for-merges/hw/net/ftgmac100.c:809:33: note: use
'&' for a bitwise operation
if (size < 64 && !(s->maccr && FTGMAC100_MACCR_RX_RUNT)) {
^~
&
/Users/pm215/src/qemu-for-merges/hw/net/ftgmac100.c:809:33: note:
remove constant to silence this warning
if (size < 64 && !(s->maccr && FTGMAC100_MACCR_RX_RUNT)) {
~^~~~~~~~~~~~~~~~~~~~~~~~~~1 error generated.
thanks
-- PMM
Quoted 22 lines · Peter Maydell
Quoted 8 lines · Jason Wang
The following changes since commit
32c7e0ab755745e961f1772e95cac381cc68769d:Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20170421' into staging (2017-04-21 15:59:27 +0100)
are available in the git repository at:
https://github.com/jasowang/qemu.git tags/net-pull-request
Quoted 7 lines
for you to fetch changes up to
049f6d8237dd0b14dee02e4c22b20114c43cecff:COLO-compare: Optimize tcp compare trace event (2017-04-24 11:30:36 +0800)
----------------------------------------------------------------
----------------------------------------------------------------
Hi. Clang picks up what looks like a typo:
/Users/pm215/src/qemu-for-merges/hw/net/ftgmac100.c:809:33: error: use of logical '&&' with constant operand [-Werror,-Wconstant-logical-operand]
Quoted 11 lines
if (size < 64 && !(s->maccr && FTGMAC100_MACCR_RX_RUNT)) {
^ ~~~~~~~~~~~~~~~~~~~~~~~
/Users/pm215/src/qemu-for-merges/hw/net/ftgmac100.c:809:33: note: use
'&' for a bitwise operation
if (size < 64 && !(s->maccr && FTGMAC100_MACCR_RX_RUNT)) {
^~
&
/Users/pm215/src/qemu-for-merges/hw/net/ftgmac100.c:809:33: note:
remove constant to silence this warning
if (size < 64 && !(s->maccr && FTGMAC100_MACCR_RX_RUNT)) {
~^~~~~~~~~~~~~~~~~~~~~~~~~~Jason,
How do you want to handle that ? A resend of the patch or a fix ?
Thanks,
C.
Quoted 33 lines · Cédric Le Goater
Quoted 21 lines · Peter Maydell
Quoted 8 lines · Jason Wang
The following changes since commit
32c7e0ab755745e961f1772e95cac381cc68769d:Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20170421' into staging (2017-04-21 15:59:27 +0100)are available in the git repository at:
https://github.com/jasowang/qemu.git tags/net-pull-request
Quoted 7 lines
for you to fetch changes up to
049f6d8237dd0b14dee02e4c22b20114c43cecff:COLO-compare: Optimize tcp compare trace event (2017-04-24 11:30:36 +0800)----------------------------------------------------------------
----------------------------------------------------------------
Hi. Clang picks up what looks like a typo:
/Users/pm215/src/qemu-for-merges/hw/net/ftgmac100.c:809:33: error: use of logical '&&' with constant operand [-Werror,-Wconstant-logical-operand]
Quoted 11 lines
if (size < 64 && !(s->maccr && FTGMAC100_MACCR_RX_RUNT)) { ^ ~~~~~~~~~~~~~~~~~~~~~~~ /Users/pm215/src/qemu-for-merges/hw/net/ftgmac100.c:809:33: note: use '&' for a bitwise operation if (size < 64 && !(s->maccr && FTGMAC100_MACCR_RX_RUNT)) { ^~ & /Users/pm215/src/qemu-for-merges/hw/net/ftgmac100.c:809:33: note: remove constant to silence this warning if (size < 64 && !(s->maccr && FTGMAC100_MACCR_RX_RUNT)) { ~^~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 8 lines
Jason,
How do you want to handle that ? A resend of the patch or a fix ?
Thanks,
C.
The fix looks trivial, let me fix it.
Thanks
Quoted 38 lines · Jason Wang
Quoted 35 lines · Cédric Le Goater
Quoted 21 lines · Peter Maydell
Quoted 8 lines · Jason Wang
The following changes since commit
32c7e0ab755745e961f1772e95cac381cc68769d:Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20170421' into staging (2017-04-21 15:59:27 +0100)are available in the git repository at:
https://github.com/jasowang/qemu.git tags/net-pull-request
Quoted 7 lines
for you to fetch changes up to
049f6d8237dd0b14dee02e4c22b20114c43cecff:COLO-compare: Optimize tcp compare trace event (2017-04-24 11:30:36 +0800)----------------------------------------------------------------
----------------------------------------------------------------
Hi. Clang picks up what looks like a typo:
/Users/pm215/src/qemu-for-merges/hw/net/ftgmac100.c:809:33: error: use of logical '&&' with constant operand [-Werror,-Wconstant-logical-operand]
Quoted 11 lines
if (size < 64 && !(s->maccr && FTGMAC100_MACCR_RX_RUNT)) { ^ ~~~~~~~~~~~~~~~~~~~~~~~ /Users/pm215/src/qemu-for-merges/hw/net/ftgmac100.c:809:33: note: use '&' for a bitwise operation if (size < 64 && !(s->maccr && FTGMAC100_MACCR_RX_RUNT)) { ^~ & /Users/pm215/src/qemu-for-merges/hw/net/ftgmac100.c:809:33: note: remove constant to silence this warning if (size < 64 && !(s->maccr && FTGMAC100_MACCR_RX_RUNT)) { ~^~~~~~~~~~~~~~~~~~~~~~~~~~Jason,
Quoted 8 lines
Quoted 6 lines
How do you want to handle that ? A resend of the patch or a fix ?
Thanks,
C.
The fix looks trivial, let me fix it.
OK. Thanks,
C.