mirror of
https://github.com/mii443/qemu.git
synced 2025-08-22 23:25:48 +00:00
net: checksum: Introduce fine control over checksum type
At present net_checksum_calculate() blindly calculates all types of checksums (IP, TCP, UDP). Some NICs may have a per type setting in their BDs to control what checksum should be offloaded. To support such hardware behavior, introduce a 'csum_flag' parameter to the net_checksum_calculate() API to allow fine control over what type checksum is calculated. Existing users of this API are updated accordingly. Signed-off-by: Bin Meng <bin.meng@windriver.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
@ -114,7 +114,7 @@ static int handle_primary_tcp_pkt(RewriterState *rf,
|
||||
tcp_pkt->th_ack = htonl(ntohl(tcp_pkt->th_ack) + conn->offset);
|
||||
|
||||
net_checksum_calculate((uint8_t *)pkt->data + pkt->vnet_hdr_len,
|
||||
pkt->size - pkt->vnet_hdr_len);
|
||||
pkt->size - pkt->vnet_hdr_len, CSUM_TCP);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -216,7 +216,7 @@ static int handle_secondary_tcp_pkt(RewriterState *rf,
|
||||
tcp_pkt->th_seq = htonl(ntohl(tcp_pkt->th_seq) - conn->offset);
|
||||
|
||||
net_checksum_calculate((uint8_t *)pkt->data + pkt->vnet_hdr_len,
|
||||
pkt->size - pkt->vnet_hdr_len);
|
||||
pkt->size - pkt->vnet_hdr_len, CSUM_TCP);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user