Skip to contentSkip to conversation

Add IP checksuming functions to qemu.

PATCH New Gerd Hoffmann 1 participant 1 message Jul 29, 2008 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Add IP checksuming functions to qemu.

Hi folks,

This patch adds IP checksumming functions to qemu, so not every nic driver needs do to it on its own.

This time with copyright & license as requested by Anthony.

cheers,
Gerd

Quoted 1 line

From 3ecf2b734d2d1c6e4362d752c23f5ec1ccc50bdc Mon Sep 17 00:00:00 2001

From: Gerd Hoffmann <[email protected]>
Date: Tue, 29 Jul 2008 13:25:12 +0200
Subject: [PATCH 04/22] Add IP checksumming functions to qemu.

---
 Makefile.target |    2 +-
 net-checksum.c  |   87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 net.h           |    7 ++++
 3 files changed, 95 insertions(+), 1 deletions(-)
 create mode 100644 net-checksum.c
Makefile.target +1 -1
index ff105c1..42162c3 100644
@@ -472,7 +472,7 @@ endif #CONFIG_DARWIN_USER
 # System emulator target
 ifndef CONFIG_USER_ONLY
 
-OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o
+OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o net-checksum.o
 ifdef CONFIG_WIN32
 OBJS+=block-raw-win32.o
 else
net-checksum.c new file +87 -0

87 lines not on this page · raw message

net.h +7 -0
index d00910f..5212b48 100644
@@ -48,4 +48,11 @@ struct NICInfo {
 extern int nb_nics;
 extern NICInfo nd_table[MAX_NICS];
 
+/* checksumming functions (net-checksum.c) */
+uint32_t net_checksum_add(int len, uint8_t *buf);
+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);
+
 #endif
Signature · 1 line
1.5.4.1