mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
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>
This commit is contained in:
parent
85427bf388
commit
aaa8a15c96
3 changed files with 15 additions and 27 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue