diff options
author | Akihiko Odaki <akihiko.odaki@daynix.com> | 2023-05-23 11:43:22 +0900 |
---|---|---|
committer | Jason Wang <jasowang@redhat.com> | 2023-05-23 15:20:15 +0800 |
commit | aaa8a15c96a8a7341a3667dcc932f8c5f227d6af (patch) | |
tree | 9597d186e23ba931b8a55b22ad18e60ef56505c2 /hw/net | |
parent | 85427bf3884f42626208865f3fe594b3919566fb (diff) | |
download | qemu-aaa8a15c96a8a7341a3667dcc932f8c5f227d6af.zip qemu-aaa8a15c96a8a7341a3667dcc932f8c5f227d6af.tar.gz qemu-aaa8a15c96a8a7341a3667dcc932f8c5f227d6af.tar.bz2 |
net/eth: Always add VLAN tag
It is possible to have another VLAN tag even if the packet is already
tagged.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'hw/net')
-rw-r--r-- | hw/net/net_tx_pkt.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c index ce6b102..af8f77a 100644 --- a/hw/net/net_tx_pkt.c +++ b/hw/net/net_tx_pkt.c @@ -40,7 +40,10 @@ struct NetTxPkt { struct iovec *vec; - uint8_t l2_hdr[ETH_MAX_L2_HDR_LEN]; + struct { + struct eth_header eth; + struct vlan_header vlan[3]; + } l2_hdr; union { struct ip_header ip; struct ip6_header ip6; @@ -365,18 +368,13 @@ bool net_tx_pkt_build_vheader(struct NetTxPkt *pkt, bool tso_enable, void net_tx_pkt_setup_vlan_header_ex(struct NetTxPkt *pkt, uint16_t vlan, uint16_t vlan_ethtype) { - bool is_new; assert(pkt); eth_setup_vlan_headers(pkt->vec[NET_TX_PKT_L2HDR_FRAG].iov_base, - vlan, vlan_ethtype, &is_new); + &pkt->vec[NET_TX_PKT_L2HDR_FRAG].iov_len, + vlan, vlan_ethtype); - /* update l2hdrlen */ - if (is_new) { - pkt->hdr_len += sizeof(struct vlan_header); - pkt->vec[NET_TX_PKT_L2HDR_FRAG].iov_len += - sizeof(struct vlan_header); - } + pkt->hdr_len += sizeof(struct vlan_header); } bool net_tx_pkt_add_raw_fragment(struct NetTxPkt *pkt, void *base, size_t len) |