mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06: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:
parent
d97f11590a
commit
f574633529
10 changed files with 55 additions and 33 deletions
|
@ -21,11 +21,16 @@
|
|||
#include "qemu/bswap.h"
|
||||
struct iovec;
|
||||
|
||||
#define CSUM_IP 0x01
|
||||
#define CSUM_TCP 0x02
|
||||
#define CSUM_UDP 0x04
|
||||
#define CSUM_ALL (CSUM_IP | CSUM_TCP | CSUM_UDP)
|
||||
|
||||
uint32_t net_checksum_add_cont(int len, uint8_t *buf, int seq);
|
||||
uint16_t net_checksum_finish(uint32_t sum);
|
||||
uint16_t net_checksum_tcpudp(uint16_t length, uint16_t proto,
|
||||
uint8_t *addrs, uint8_t *buf);
|
||||
void net_checksum_calculate(uint8_t *data, int length);
|
||||
void net_checksum_calculate(uint8_t *data, int length, int csum_flag);
|
||||
|
||||
static inline uint32_t
|
||||
net_checksum_add(int len, uint8_t *buf)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue