From: Jason Wang <jasowang@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Akihiko Odaki" <akihiko.odaki@daynix.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Jason Wang" <jasowang@redhat.com>
Subject: [PULL 1/6] net: checksum: Convert data to void *
Date: Mon, 25 Nov 2024 14:08:04 +0800 [thread overview]
Message-ID: <20241125060809.15543-2-jasowang@redhat.com> (raw)
In-Reply-To: <20241125060809.15543-1-jasowang@redhat.com>
From: Akihiko Odaki <akihiko.odaki@daynix.com>
Convert the data parameter of net_checksum_calculate() to void * to
save unnecessary casts for callers.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
include/net/checksum.h | 2 +-
net/checksum.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/net/checksum.h b/include/net/checksum.h
index 7dec37e56c..188e4cca0b 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -30,7 +30,7 @@ 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, int csum_flag);
+void net_checksum_calculate(void *data, int length, int csum_flag);
static inline uint32_t
net_checksum_add(int len, uint8_t *buf)
diff --git a/net/checksum.c b/net/checksum.c
index 1a957e4c0b..537457d89d 100644
--- a/net/checksum.c
+++ b/net/checksum.c
@@ -57,7 +57,7 @@ uint16_t net_checksum_tcpudp(uint16_t length, uint16_t proto,
return net_checksum_finish(sum);
}
-void net_checksum_calculate(uint8_t *data, int length, int csum_flag)
+void net_checksum_calculate(void *data, int length, int csum_flag)
{
int mac_hdr_len, ip_len;
struct ip_header *ip;
@@ -101,7 +101,7 @@ void net_checksum_calculate(uint8_t *data, int length, int csum_flag)
return;
}
- ip = (struct ip_header *)(data + mac_hdr_len);
+ ip = (struct ip_header *)((uint8_t *)data + mac_hdr_len);
if (IP_HEADER_VERSION(ip) != IP_HEADER_VERSION_4) {
return; /* not IPv4 */
--
2.42.0
next prev parent reply other threads:[~2024-11-25 6:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-25 6:08 [PULL 0/6] Net patches Jason Wang
2024-11-25 6:08 ` Jason Wang [this message]
2024-11-25 6:08 ` [PULL 2/6] virtio-net: Fix size check in dhclient workaround Jason Wang
2024-11-25 6:08 ` [PULL 3/6] virtio-net: Do not check for the queue before RSS Jason Wang
2024-11-25 6:08 ` [PULL 4/6] virtio-net: Fix hash reporting when the queue changes Jason Wang
2024-11-25 6:08 ` [PULL 5/6] virtio-net: Initialize hash reporting values Jason Wang
2024-11-25 6:08 ` [PULL 6/6] virtio-net: Copy received header to buffer Jason Wang
2024-11-25 11:05 ` [PULL 0/6] Net patches Laurent Vivier
2024-11-26 2:55 ` Jason Wang
2024-11-25 16:27 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241125060809.15543-2-jasowang@redhat.com \
--to=jasowang@redhat.com \
--cc=akihiko.odaki@daynix.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).