summaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorPeter Maydell2020-11-11 15:00:35 +0100
committerPeter Maydell2020-11-11 15:00:35 +0100
commit54cd1213ce1faac196c1b57110a9ee4f18969e6c (patch)
tree1f14c3a4fdbfcbb84a670d6bab9031aa2144f9d3 /hw
parentUpdate version for v5.2.0-rc1 release (diff)
parenthw/net/can/ctucan_core: Use stl_le_p to write to tx_buffers (diff)
downloadqemu-54cd1213ce1faac196c1b57110a9ee4f18969e6c.tar.gz
qemu-54cd1213ce1faac196c1b57110a9ee4f18969e6c.tar.xz
qemu-54cd1213ce1faac196c1b57110a9ee4f18969e6c.zip
Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging
# gpg: Signature made Wed 11 Nov 2020 13:04:02 GMT # gpg: using RSA key EF04965B398D6211 # gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@redhat.com>" [marginal] # 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: hw/net/can/ctucan_core: Use stl_le_p to write to tx_buffers hw/net/can/ctucan_core: Handle big-endian hosts hw/net/can/ctucan: Avoid unused value in ctucan_send_ready_buffers() hw/net/can/ctucan: Don't allow guest to write off end of tx_buffer net/l2tpv3: Remove redundant check in net_init_l2tpv3() net: remove an assert call in eth_get_gso_type net/colo-compare.c: Increase default queued packet scan frequency net/colo-compare.c: Add secondary old packet detection net/colo-compare.c: Change the timer clock type net/colo-compare.c: Fix compare_timeout format issue colo-compare: check mark in mutual exclusion colo-compare: fix missing compare_seq initialization Fix the qemu crash when guest shutdown in COLO mode Reduce the time of checkpoint for COLO Optimize seq_sorter function for colo-compare net/filter-rewriter: destroy g_hash_table in colo_rewriter_cleanup virtio-net: Set mac address to hardware if the peer is vdpa Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/net/can/ctucan_core.c23
-rw-r--r--hw/net/can/ctucan_core.h3
-rw-r--r--hw/net/virtio-net.c6
3 files changed, 14 insertions, 18 deletions
diff --git a/hw/net/can/ctucan_core.c b/hw/net/can/ctucan_core.c
index d20835cd7e..d171c372e0 100644
--- a/hw/net/can/ctucan_core.c
+++ b/hw/net/can/ctucan_core.c
@@ -240,8 +240,6 @@ static void ctucan_send_ready_buffers(CtuCanCoreState *s)
uint8_t *pf;
int buff2tx_idx;
uint32_t tx_prio_max;
- unsigned int buff_st;
- uint32_t buff_st_mask;
if (!s->mode_settings.s.ena) {
return;
@@ -256,10 +254,7 @@ static void ctucan_send_ready_buffers(CtuCanCoreState *s)
for (i = 0; i < CTUCAN_CORE_TXBUF_NUM; i++) {
uint32_t prio;
- buff_st_mask = 0xf << (i * 4);
- buff_st = (s->tx_status.u32 >> (i * 4)) & 0xf;
-
- if (buff_st != TXT_RDY) {
+ if (extract32(s->tx_status.u32, i * 4, 4) != TXT_RDY) {
continue;
}
prio = (s->tx_priority.u32 >> (i * 4)) & 0x7;
@@ -271,10 +266,7 @@ static void ctucan_send_ready_buffers(CtuCanCoreState *s)
if (buff2tx_idx == -1) {
break;
}
- buff_st_mask = 0xf << (buff2tx_idx * 4);
- buff_st = (s->tx_status.u32 >> (buff2tx_idx * 4)) & 0xf;
int_stat.u32 = 0;
- buff_st = TXT_RDY;
pf = s->tx_buffer[buff2tx_idx].data;
ctucan_buff2frame(pf, &frame);
s->status.s.idle = 0;
@@ -283,12 +275,11 @@ static void ctucan_send_ready_buffers(CtuCanCoreState *s)
s->status.s.idle = 1;
s->status.s.txs = 0;
s->tx_fr_ctr.s.tx_fr_ctr_val++;
- buff_st = TXT_TOK;
int_stat.s.txi = 1;
int_stat.s.txbhci = 1;
s->int_stat.u32 |= int_stat.u32 & ~s->int_mask.u32;
- s->tx_status.u32 = (s->tx_status.u32 & ~buff_st_mask) |
- (buff_st << (buff2tx_idx * 4));
+ s->tx_status.u32 = deposit32(s->tx_status.u32,
+ buff2tx_idx * 4, 4, TXT_TOK);
} while (1);
}
@@ -303,7 +294,7 @@ void ctucan_mem_write(CtuCanCoreState *s, hwaddr addr, uint64_t val,
DPRINTF("write 0x%02llx addr 0x%02x\n",
(unsigned long long)val, (unsigned int)addr);
- if (addr > CTUCAN_CORE_MEM_SIZE) {
+ if (addr >= CTUCAN_CORE_MEM_SIZE) {
return;
}
@@ -312,9 +303,9 @@ void ctucan_mem_write(CtuCanCoreState *s, hwaddr addr, uint64_t val,
addr -= CTU_CAN_FD_TXTB1_DATA_1;
buff_num = addr / CTUCAN_CORE_TXBUFF_SPAN;
addr %= CTUCAN_CORE_TXBUFF_SPAN;
- if (buff_num < CTUCAN_CORE_TXBUF_NUM) {
- uint32_t *bufp = (uint32_t *)(s->tx_buffer[buff_num].data + addr);
- *bufp = cpu_to_le32(val);
+ if ((buff_num < CTUCAN_CORE_TXBUF_NUM) &&
+ ((addr + size) <= sizeof(s->tx_buffer[buff_num].data))) {
+ stn_le_p(s->tx_buffer[buff_num].data + addr, size, val);
}
} else {
switch (addr & ~3) {
diff --git a/hw/net/can/ctucan_core.h b/hw/net/can/ctucan_core.h
index f21cb1c5ec..bbc09ae067 100644
--- a/hw/net/can/ctucan_core.h
+++ b/hw/net/can/ctucan_core.h
@@ -31,8 +31,7 @@
#include "exec/hwaddr.h"
#include "net/can_emu.h"
-
-#ifndef __LITTLE_ENDIAN_BITFIELD
+#ifndef HOST_WORDS_BIGENDIAN
#define __LITTLE_ENDIAN_BITFIELD 1
#endif
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 277289d56e..9179013ac4 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -3395,6 +3395,12 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp)
nc = qemu_get_queue(n->nic);
nc->rxfilter_notify_enabled = 1;
+ if (nc->peer && nc->peer->info->type == NET_CLIENT_DRIVER_VHOST_VDPA) {
+ struct virtio_net_config netcfg = {};
+ memcpy(&netcfg.mac, &n->nic_conf.macaddr, ETH_ALEN);
+ vhost_net_set_config(get_vhost_net(nc->peer),
+ (uint8_t *)&netcfg, 0, ETH_ALEN, VHOST_SET_CONFIG_TYPE_MASTER);
+ }
QTAILQ_INIT(&n->rsc_chains);
n->qdev = dev;