summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-01-25 15:56:13 +0000
committerPeter Maydell <peter.maydell@linaro.org>2021-01-25 15:56:13 +0000
commit31ee895047bdcf7387e3570cbd2a473c6f744b08 (patch)
treebc28163f54b4f2729bcb8a87e4d37a4f7a94fd99 /include
parent3dcfd4e3f285cd69d7cf581d3a688e421d28e07e (diff)
parentf574633529926697ced51b6865e5c50bbb78bf1b (diff)
Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging
# gpg: Signature made Mon 25 Jan 2021 09:05:51 GMT # gpg: using RSA key EF04965B398D6211 # gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@redhat.com>" [marginal] # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 215D 46F4 8246 689E C77F 3562 EF04 965B 398D 6211 * remotes/jasowang/tags/net-pull-request: net: checksum: Introduce fine control over checksum type net: checksum: Add IP header checksum calculation net: checksum: Skip fragmented IP packets net: Fix handling of id in netdev_add and netdev_del Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/net/checksum.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/net/checksum.h b/include/net/checksum.h
index 05a0d273fe..7dec37e56c 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -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)