Skip to contentSkip to conversation

Add IP checksuming functions to qemu.

PATCH Superseded Gerd Hoffmann 2 participants 2 messages Jul 29, 2008 Kbuild

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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.

cheers,
Gerd

Quoted 1 line

From 1070650dcedeb966fd9baf499c1f85488a1aa48c 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  |   69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 net.h           |    7 +++++
 3 files changed, 77 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 +69 -0

69 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
#1 lore raw

net-checksum.c

Quoted 42 lines · Gerd Hoffmann

Hi folks,

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

cheers,
Gerd

From 1070650dcedeb966fd9baf499c1f85488a1aa48c 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  |   69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 net.h           |    7 +++++
 3 files changed, 77 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 +0 -0
new file mode 100644
index 0000000..2aefae2
@@ -0,0 +1,69 @@

Can you please add a license/copyright? Since QEMU is mixed licensed, it's important to have a license in every file.

Regards,

Anthony Liguori