mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
hw/net/net_rx_pkt: Remove net_rx_pkt_has_virt_hdr
When virtio-net header is not set, net_rx_pkt_get_vhdr() returns zero-filled virtio_net_hdr, which is actually valid. In fact, tap device uses zero-filled virtio_net_hdr when virtio-net header is not provided by the peer. Therefore, we can just remove net_rx_pkt_has_virt_hdr() and always assume NetTxPkt has a valid virtio-net header. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
parent
55daf493f7
commit
aac8f89dba
6 changed files with 9 additions and 45 deletions
|
@ -851,10 +851,6 @@ static void vmxnet3_rx_need_csum_calculate(struct NetRxPkt *pkt,
|
|||
uint8_t *data;
|
||||
int len;
|
||||
|
||||
if (!net_rx_pkt_has_virt_hdr(pkt)) {
|
||||
return;
|
||||
}
|
||||
|
||||
vhdr = net_rx_pkt_get_vhdr(pkt);
|
||||
if (!VMXNET_FLAG_IS_SET(vhdr->flags, VIRTIO_NET_HDR_F_NEEDS_CSUM)) {
|
||||
return;
|
||||
|
@ -898,10 +894,6 @@ static void vmxnet3_rx_update_descr(struct NetRxPkt *pkt,
|
|||
rxcd->tci = net_rx_pkt_get_vlan_tag(pkt);
|
||||
}
|
||||
|
||||
if (!net_rx_pkt_has_virt_hdr(pkt)) {
|
||||
goto nocsum;
|
||||
}
|
||||
|
||||
vhdr = net_rx_pkt_get_vhdr(pkt);
|
||||
/*
|
||||
* Checksum is valid when lower level tell so or when lower level
|
||||
|
@ -1522,7 +1514,7 @@ static void vmxnet3_activate_device(VMXNET3State *s)
|
|||
/* Preallocate TX packet wrapper */
|
||||
VMW_CFPRN("Max TX fragments is %u", s->max_tx_frags);
|
||||
net_tx_pkt_init(&s->tx_pkt, PCI_DEVICE(s), s->max_tx_frags);
|
||||
net_rx_pkt_init(&s->rx_pkt, s->peer_has_vhdr);
|
||||
net_rx_pkt_init(&s->rx_pkt);
|
||||
|
||||
/* Read rings memory locations for RX queues */
|
||||
for (i = 0; i < s->rxq_num; i++) {
|
||||
|
@ -2402,7 +2394,7 @@ static int vmxnet3_post_load(void *opaque, int version_id)
|
|||
VMXNET3State *s = opaque;
|
||||
|
||||
net_tx_pkt_init(&s->tx_pkt, PCI_DEVICE(s), s->max_tx_frags);
|
||||
net_rx_pkt_init(&s->rx_pkt, s->peer_has_vhdr);
|
||||
net_rx_pkt_init(&s->rx_pkt);
|
||||
|
||||
if (s->msix_used) {
|
||||
vmxnet3_use_msix_vectors(s, VMXNET3_MAX_INTRS);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue