Net patches
The following changes since commit 2e02083438962d26ef9dcc7100f3b378104183db:
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2017-11-17 19:08:07 +0000)
are available in the git repository at:
https://github.com/jasowang/qemu.git tags/net-pull-request
for you to fetch changes up to c527e0afcd7d719abc3a5ca5e4c8ac2fe48b999f:
hw/net/vmxnet3: Fix code to work on big endian hosts, too (2017-11-20 11:08:00 +0800)
----------------------------------------------------------------
----------------------------------------------------------------
Ed Swierk (1):
net: Transmit zero UDP checksum as 0xFFFF
Jason Wang (1):
Revert "Add new PCI ID for i82559a"
Mao Zhongyi (1):
colo-compare: fix the dangerous assignment
Stefan Weil (1):
MAINTAINERS: Add missing entry for eepro100 emulation
Thomas Huth (2):
hw/net/eepro100: Fix endianness problem on big endian hosts hw/net/vmxnet3: Fix code to work on big endian hosts, too
MAINTAINERS | 5 ++ hw/net/e1000.c | 2 +- hw/net/eepro100.c | 17 +--- hw/net/net_rx_pkt.c | 2 +- hw/net/net_tx_pkt.c | 2 +- hw/net/vmware_utils.h | 6 ++ hw/net/vmxnet3.c | 49 ++++++++--- hw/net/vmxnet3.h | 230 ++++++++++++++++++++++++++++++------------------- include/hw/compat.h | 4 - include/hw/pci/pci.h | 1 - include/net/checksum.h | 6 ++ net/colo-compare.c | 2 +- qemu-options.hx | 2 +- 13 files changed, 201 insertions(+), 127 deletions(-)
[Qemu-devel] [PULL 1/6] colo-compare: fix the dangerous assignment
From: Mao Zhongyi <[email protected]>
--- net/colo-compare.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/colo-compare.c +1 -1
@@ -179,7 +179,7 @@ static int packet_enqueue(CompareState *s, int mode, Connection **con) "drop packet"); } } - con = &conn; + *con = conn;return 0 ; }
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 2/6] Revert "Add new PCI ID for i82559a"
In reply to Jason WangThis reverts commit 5e89dc01133f8f5e621f6b66b356c6f37d31dafb since:
- we should use ID in the spec instead the one used by OEM
- in the future, we should allow changing id through either property or EEPROM file.
--- hw/net/eepro100.c | 13 ------------- include/hw/compat.h | 4 ---- include/hw/pci/pci.h | 1 - qemu-options.hx | 2 +- 4 files changed, 1 insertion(+), 19 deletions(-)
hw/net/eepro100.c +0 -13
@@ -132,7 +132,6 @@ typedef struct {const char *name;const char *desc;uint16_t device_id; -uint16_t alt_device_id;uint8_t revision;uint16_t subsystem_vendor_id;uint16_t subsystem_id;
@@ -277,7 +276,6 @@ typedef struct {/* Quasi static device properties (no need to save them). */ uint16_t stats_size;bool has_extended_tcb_support; -bool use_alt_device_id; } EEPRO100State;/* Word indices in EEPROM. */
@@ -1857,14 +1855,6 @@ static void e100_nic_realize(PCIDevice *pci_dev, Error **errp)TRACE (OTHER ,logout ("\n" )); -/* By default, the i82559a adapter uses the legacy PCI ID (for the -* i82557). This allows the PCI ID to be changed to the alternate -* i82559 ID if needed. -*/ -if (s->use_alt_device_id &&strcmp (info->name,"i82559a" ) ==0 ) { -pci_config_set_device_id (s->dev.config, info->alt_device_id); - } - s->device = info->device;e100_pci_reset (s, &local_err);
@@ -1984,7 +1974,6 @@ static E100PCIDeviceInfo e100_devices[] = { .desc = "Intel i82559A Ethernet", .device = i82559A, .device_id = PCI_DEVICE_ID_INTEL_82557, - .alt_device_id = PCI_DEVICE_ID_INTEL_82559, .revision = 0x06, .stats_size = 80, .has_extended_tcb_support = true,
@@ -2078,8 +2067,6 @@ static E100PCIDeviceInfo *eepro100_get_class(EEPRO100State *s)static Property e100_properties[] = {DEFINE_NIC_PROPERTIES (EEPRO100State, conf), -DEFINE_PROP_BOOL ("x-use-alt-device-id" , EEPRO100State, use_alt_device_id, - true),DEFINE_PROP_END_OF_LIST (), };
include/hw/compat.h +0 -4
@@ -10,10 +10,6 @@ .driver = "virtio-tablet-device",\ .property = "wheel-axis",\ .value = "false",\ - },{\ - .driver = "i82559a",\ - .property = "x-use-alt-device-id",\ - .value = "false",\ },#define HW_COMPAT_2_9 \
include/hw/pci/pci.h +0 -1
@@ -70,7 +70,6 @@ extern bool pci_available;/* Intel (0x8086) */ #define PCI_DEVICE_ID_INTEL_82551IT 0x1209#define PCI_DEVICE_ID_INTEL_82557 0x1229 -#define PCI_DEVICE_ID_INTEL_82559 0x1030#define PCI_DEVICE_ID_INTEL_82801IR 0x2922/* Red Hat / Qumranet (for QEMU) -- see pci-ids.txt */
qemu-options.hx +1 -1
@@ -2047,7 +2047,7 @@ that the card should have; this option currently only affects virtio cards; set @var{v} = 0 to disable MSI-X. If no @option{-net} option is specified, a single NIC is created. QEMU can emulate several different models of network card. Valid values for @var{type} are -@code{virtio}, @code{i82551}, @code{i82557b}, @code{i82559a}, @code{i82559er}, +@code{virtio}, @code{i82551}, @code{i82557b}, @code{i82559er}, @code{ne2k_pci}, @code{ne2k_isa}, @code{pcnet}, @code{rtl8139}, @code{e1000}, @code{smc91c111}, @code{lance} and @code{mcf_fec}. Not all devices are supported on all targets. Use @code{-net nic,model=help}
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 3/6] hw/net/eepro100: Fix endianness problem on big endian hosts
In reply to Jason WangFrom: Thomas Huth <[email protected]>
Since commit 1865e288a823c764cd4344d ("Fix eepro100 simple transmission mode"), the test/pxe-test is broken for the eepro100 device on big endian hosts. However, it seems like that commit did not introduce the problem, but just uncovered it: The EEPRO100State->tx.tbd_array_addr and EEPRO100State->tx.tcb_bytes fields are already in host byte order, since they have already been byte-swapped in the read_cb() function. Thus byte-swapping them in tx_command() again results in the wrong endianness. Removing the byte-swapping here fixes the pxe-test.
--- hw/net/eepro100.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/net/eepro100.c +2 -2
@@ -754,8 +754,8 @@ static void read_cb(EEPRO100State *s)static void tx_command (EEPRO100State *s) { -uint32_t tbd_array =le32_to_cpu (s->tx.tbd_array_addr); -uint16_t tcb_bytes = (le16_to_cpu (s->tx.tcb_bytes) &0x3fff ); +uint32_t tbd_array = s->tx.tbd_array_addr; +uint16_t tcb_bytes = s->tx.tcb_bytes &0x3fff ;/* Sends larger than MAX_ETH_FRAME_SIZE are allowed, up to 2600 bytes. */ uint8_t buf[2600 ];uint16_t size =0 ;
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 4/6] MAINTAINERS: Add missing entry for eepro100 emulation
In reply to Jason WangFrom: Stefan Weil <[email protected]>
--- MAINTAINERS | 5 +++++ 1 file changed, 5 insertions(+)
MAINTAINERS +5 -0
@@ -1183,6 +1183,11 @@ M: Dmitry Fleytman <[email protected]> S: Maintained F: hw/net/e1000e* +eepro100 +M: Stefan Weil <[email protected]> +S: Maintained +F: hw/net/eepro100.c + Generic Loader M: Alistair Francis <[email protected]> S: Maintained
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 5/6] net: Transmit zero UDP checksum as 0xFFFF
In reply to Jason WangFrom: Ed Swierk <[email protected]>
The checksum algorithm used by IPv4, TCP and UDP allows a zero value to be represented by either 0x0000 and 0xFFFF. But per RFC 768, a zero UDP checksum must be transmitted as 0xFFFF because 0x0000 is a special value meaning no checksum.
Substitute 0xFFFF whenever a checksum is computed as zero when modifying a UDP datagram header. Doing this on IPv4 and TCP checksums is unnecessary but legal. Add a wrapper for net_checksum_finish() that makes the substitution.
(We can't just change net_checksum_finish(), as that function is also used by receivers to verify checksums, and in that case the expected value is always 0x0000.)
--- hw/net/e1000.c | 2 +- hw/net/net_rx_pkt.c | 2 +- hw/net/net_tx_pkt.c | 2 +- hw/net/vmxnet3.c | 3 ++- include/net/checksum.h | 6 ++++++ 5 files changed, 11 insertions(+), 4 deletions(-)
hw/net/e1000.c +1 -1
@@ -503,7 +503,7 @@ putsum(uint8_t *data, uint32_t n, uint32_t sloc, uint32_t css, uint32_t cse) n = cse +1 ;if (sloc < n-1 ) { sum =net_checksum_add (n-css, data+css); -stw_be_p (data + sloc,net_checksum_finish (sum)); +stw_be_p (data + sloc,net_checksum_finish_nozero (sum)); } }
hw/net/net_rx_pkt.c +1 -1
@@ -518,7 +518,7 @@ _net_rx_pkt_calc_l4_csum(struct NetRxPkt *pkt) cntr +=net_checksum_add_iov (pkt->vec, pkt->vec_len, pkt->l4hdr_off, csl, cso); - csum =net_checksum_finish (cntr); + csum =net_checksum_finish_nozero (cntr);trace_net_rx_pkt_l4_csum_calc_csum (pkt->l4hdr_off, csl, cntr, csum);
hw/net/net_tx_pkt.c +1 -1
@@ -486,7 +486,7 @@ static void net_tx_pkt_do_sw_csum(struct NetTxPkt *pkt)net_checksum_add_iov (iov, iov_len, pkt->virt_hdr.csum_start, csl, cso);/* Put the checksum obtained into the packet */ - csum =cpu_to_be16 (net_checksum_finish (csum_cntr)); + csum =cpu_to_be16 (net_checksum_finish_nozero (csum_cntr));iov_from_buf (iov, iov_len, csum_offset, &csum,sizeof csum); }
hw/net/vmxnet3.c +2 -1
@@ -972,7 +972,8 @@ static void vmxnet3_rx_need_csum_calculate(struct NetRxPkt *pkt, data = (uint8_t *)pkt_data + vhdr->csum_start; len = pkt_len - vhdr->csum_start;/* Put the checksum obtained into the packet */ -stw_be_p (data + vhdr->csum_offset,net_raw_checksum (data, len)); +stw_be_p (data + vhdr->csum_offset, +net_checksum_finish_nozero (net_checksum_add (len, data))); vhdr->flags &= ~VIRTIO_NET_HDR_F_NEEDS_CSUM ; vhdr->flags |=VIRTIO_NET_HDR_F_DATA_VALID ;
include/net/checksum.h +6 -0
@@ -34,6 +34,12 @@ net_checksum_add(int len, uint8_t *buf) }static inline uint16_t +net_checksum_finish_nozero (uint32_t sum) +{ +return net_checksum_finish (sum) ?:0xFFFF ; +} + +static inline uint16_t net_raw_checksum (uint8_t *data,int length) {return net_checksum_finish (net_checksum_add (length, data));
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 6/6] hw/net/vmxnet3: Fix code to work on big endian hosts, too
In reply to Jason WangFrom: Thomas Huth <[email protected]>
Since commit ab06ec43577177a442e8 we test the vmxnet3 device in the pxe-tester, too (when running "make check SPEED=slow"). This now revealed that the code is not working there if the host is a big endian machine (for example ppc64 or s390x) - "make check SPEED=slow" is now failing on such hosts.
The vmxnet3 code lacks endianness conversions in a couple of places. Interestingly, the bitfields in the structs in vmxnet3.h already tried to take care of the *bit* endianness of the C compilers - but the code missed to change the *byte* endianness when reading or writing the corresponding structs. So the bitfields are now wrapped into unions which allow to change the byte endianness during runtime with the non-bitfield member of the union. With these changes, "make check SPEED=slow" now properly works on big endian hosts, too.
--- hw/net/vmware_utils.h | 6 ++ hw/net/vmxnet3.c | 46 +++++++--- hw/net/vmxnet3.h | 230 ++++++++++++++++++++++++++++++-------------------- 3 files changed, 181 insertions(+), 101 deletions(-)
hw/net/vmware_utils.h +6 -0
@@ -83,6 +83,7 @@ vmw_shmem_ld16(PCIDevice *d, hwaddr addr) {uint16_t res;pci_dma_read (d, addr, &res,2 ); + res =le16_to_cpu (res);VMW_SHPRN ("SHMEM load16: %" PRIx64" (value 0x%X)" , addr, res);return res; }
@@ -91,6 +92,7 @@ static inline void vmw_shmem_st16(PCIDevice *d, hwaddr addr, uint16_t value) {VMW_SHPRN ("SHMEM store16: %" PRIx64" (value 0x%X)" , addr, value); + value =cpu_to_le16 (value);pci_dma_write (d, addr, &value,2 ); }
@@ -99,6 +101,7 @@ vmw_shmem_ld32(PCIDevice *d, hwaddr addr) {uint32_t res;pci_dma_read (d, addr, &res,4 ); + res =le32_to_cpu (res);VMW_SHPRN ("SHMEM load32: %" PRIx64" (value 0x%X)" , addr, res);return res; }
@@ -107,6 +110,7 @@ static inline void vmw_shmem_st32(PCIDevice *d, hwaddr addr, uint32_t value) {VMW_SHPRN ("SHMEM store32: %" PRIx64" (value 0x%X)" , addr, value); + value =cpu_to_le32 (value);pci_dma_write (d, addr, &value,4 ); }
@@ -115,6 +119,7 @@ vmw_shmem_ld64(PCIDevice *d, hwaddr addr) {uint64_t res;pci_dma_read (d, addr, &res,8 ); + res =le64_to_cpu (res);VMW_SHPRN ("SHMEM load64: %" PRIx64" (value %" PRIx64")" , addr, res);return res; }
@@ -123,6 +128,7 @@ static inline void vmw_shmem_st64(PCIDevice *d, hwaddr addr, uint64_t value) {VMW_SHPRN ("SHMEM store64: %" PRIx64" (value %" PRIx64")" , addr, value); + value =cpu_to_le64 (value);pci_dma_write (d, addr, &value,8 ); }
hw/net/vmxnet3.c +36 -10
122 lines not on this page · raw message
hw/net/vmxnet3.h +139 -91
277 lines not on this page · raw message
Signature · 1 line
2.7.4
This series seems to have some coding style problems. See output below for more information:
Hi,
This series seems to have some coding style problems. See output below for more information:
Subject: [Qemu-devel] [PULL 0/6] Net patches
Type: series
Message-id: [email protected]
=== TEST SCRIPT BEGIN ===
#!/bin/bash
BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0
git config --local diff.renamelimit 0
git config --local diff.renames True
commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))done
exit $failed
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
t [tag update] patchew/[email protected] -> patchew/[email protected]
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'6d998dcb3e hw/net/vmxnet3: Fix code to work on big endian hosts, too e3b7d3045b net: Transmit zero UDP checksum as 0xFFFF 528693e2ba MAINTAINERS: Add missing entry for eepro100 emulation 434d3f0987 hw/net/eepro100: Fix endianness problem on big endian hosts c2e0b52dd7 Revert "Add new PCI ID for i82559a"3e70742c2d colo-compare: fix the dangerous assignment
=== OUTPUT BEGIN ===
Checking PATCH 1/6: colo-compare: fix the dangerous assignment... Checking PATCH 2/6: Revert "Add new PCI ID for i82559a"...
Checking PATCH 3/6: hw/net/eepro100: Fix endianness problem on big endian hosts... Checking PATCH 4/6: MAINTAINERS: Add missing entry for eepro100 emulation... Checking PATCH 5/6: net: Transmit zero UDP checksum as 0xFFFF... Checking PATCH 6/6: hw/net/vmxnet3: Fix code to work on big endian hosts, too...
ERROR: spaces required around that ':' (ctx:VxV)
#237: FILE: hw/net/vmxnet3.h:232:
+ u32 msscof:14; /* MSS, checksum offset, flags */
^
ERROR: spaces required around that ':' (ctx:VxV)
#238: FILE: hw/net/vmxnet3.h:233:
+ u32 ext1:1;
^ERROR: spaces required around that ':' (ctx:VxV)
#239: FILE: hw/net/vmxnet3.h:234:
+ u32 dtype:1; /* descriptor type */
^
ERROR: spaces required around that ':' (ctx:VxV)
#240: FILE: hw/net/vmxnet3.h:235:
+ u32 rsvd:1;
^ERROR: spaces required around that ':' (ctx:VxV)
#241: FILE: hw/net/vmxnet3.h:236:
+ u32 gen:1; /* generation bit */
^
ERROR: spaces required around that ':' (ctx:VxV)
#242: FILE: hw/net/vmxnet3.h:237:
+ u32 len:14;
^ERROR: spaces required around that ':' (ctx:VxV)
#250: FILE: hw/net/vmxnet3.h:239:
+ u32 len:14;
^ERROR: spaces required around that ':' (ctx:VxV)
#251: FILE: hw/net/vmxnet3.h:240:
+ u32 gen:1; /* generation bit */
^
ERROR: spaces required around that ':' (ctx:VxV)
#252: FILE: hw/net/vmxnet3.h:241:
+ u32 rsvd:1;
^ERROR: spaces required around that ':' (ctx:VxV)
#253: FILE: hw/net/vmxnet3.h:242:
+ u32 dtype:1; /* descriptor type */
^
ERROR: spaces required around that ':' (ctx:VxV)
#254: FILE: hw/net/vmxnet3.h:243:
+ u32 ext1:1;
^ERROR: spaces required around that ':' (ctx:VxV)
#255: FILE: hw/net/vmxnet3.h:244:
+ u32 msscof:14; /* MSS, checksum offset, flags */
^
ERROR: trailing whitespace
#261: FILE: hw/net/vmxnet3.h:249:
+ $
WARNING: architecture specific defines should be avoided #310: FILE: hw/net/vmxnet3.h:306:
+#ifdef __BIG_ENDIAN_BITFIELD
WARNING: architecture specific defines should be avoided #328: FILE: hw/net/vmxnet3.h:321:
+#ifdef __BIG_ENDIAN_BITFIELD
total: 13 errors, 2 warnings, 441 lines checked
Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===
Test command exited with code: 1
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]
Quoted 55 lines · On 20.11.2017 04:44, [email protected] wrote:
Hi,
This series seems to have some coding style problems. See output below for more information:
Subject: [Qemu-devel] [PULL 0/6] Net patches
Type: series
Message-id: [email protected]=== TEST SCRIPT BEGIN ===
#!/bin/bashBASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0git config --local diff.renamelimit 0
git config --local diff.renames Truecommits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..." if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then failed=1 echo fi n=$((n+1))done
exit $failed
=== TEST SCRIPT END ===Updating
3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
t [tag update] patchew/[email protected] -> patchew/[email protected]
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'6d998dcb3ehw/net/vmxnet3: Fix code to work on big endian hosts, tooe3b7d3045bnet: Transmit zero UDP checksum as0xFFFF528693e2baMAINTAINERS: Add missing entry for eepro100 emulation434d3f0987hw/net/eepro100: Fix endianness problem on big endian hostsc2e0b52dd7Revert "Add new PCI ID for i82559a"3e70742c2dcolo-compare: fix the dangerous assignment=== OUTPUT BEGIN ===
Checking PATCH 1/6: colo-compare: fix the dangerous assignment... Checking PATCH 2/6: Revert "Add new PCI ID for i82559a"...
Checking PATCH 3/6: hw/net/eepro100: Fix endianness problem on big endian hosts... Checking PATCH 4/6:MAINTAINERS: Add missing entry for eepro100 emulation... Checking PATCH 5/6: net: Transmit zero UDP checksum as0xFFFF... Checking PATCH 6/6: hw/net/vmxnet3: Fix code to work on big endian hosts, too...
ERROR: spaces required around that ':' (ctx:VxV)
#237: FILE:hw/net/vmxnet3.h:232:
+ u32 msscof:14; /* MSS, checksum offset, flags */
Quoted 6 lines
^ERROR: spaces required around that ':' (ctx:VxV)
#238: FILE:hw/net/vmxnet3.h:233:+ u32 ext1:1; ^
Just for the records (again): These errors seem to be false positives from checkpatch. I originally tried to add spaces to all changed bitfields, but then checkpatch suddenly complains that spaces are not allowed there...
Thomas
Peter Maydell
AppliedQuoted 8 lines · Jason Wang
The following changes since commit
2e02083438962d26ef9dcc7100f3b378104183db:Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2017-11-17 19:08:07 +0000)
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
c527e0afcd7d719abc3a5ca5e4c8ac2fe48b999f:hw/net/vmxnet3: Fix code to work on big endian hosts, too (2017-11-20 11:08:00 +0800)
----------------------------------------------------------------
----------------------------------------------------------------
Applied, thanks.
-- PMM