From: Jason Wang <jasowang@redhat.com>
To: peter.maydell@linaro.org
Cc: Yuri Benditovich <yuri.benditovich@daynix.com>,
Jason Wang <jasowang@redhat.com>,
qemu-devel@nongnu.org
Subject: [PULL V2 16/23] NetRxPkt: Introduce support for additional hash types
Date: Tue, 3 Mar 2020 18:10:35 +0800 [thread overview]
Message-ID: <1583230242-14597-17-git-send-email-jasowang@redhat.com> (raw)
In-Reply-To: <1583230242-14597-1-git-send-email-jasowang@redhat.com>
From: Yuri Benditovich <yuri.benditovich@daynix.com>
Add support for following hash types:
IPV6 TCP with extension headers
IPV4 UDP
IPV6 UDP
IPV6 UDP with extension headers
Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
Acked-by: Dmitry Fleytman <dmitry.fleytman@gmail.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
hw/net/net_rx_pkt.c | 42 ++++++++++++++++++++++++++++++++++++++++++
hw/net/net_rx_pkt.h | 6 +++++-
hw/net/trace-events | 4 ++++
3 files changed, 51 insertions(+), 1 deletion(-)
diff --git a/hw/net/net_rx_pkt.c b/hw/net/net_rx_pkt.c
index 98a5030..b2a06bd 100644
--- a/hw/net/net_rx_pkt.c
+++ b/hw/net/net_rx_pkt.c
@@ -307,6 +307,20 @@ _net_rx_rss_prepare_tcp(uint8_t *rss_input,
&tcphdr->th_dport, sizeof(uint16_t));
}
+static inline void
+_net_rx_rss_prepare_udp(uint8_t *rss_input,
+ struct NetRxPkt *pkt,
+ size_t *bytes_written)
+{
+ struct udp_header *udphdr = &pkt->l4hdr_info.hdr.udp;
+
+ _net_rx_rss_add_chunk(rss_input, bytes_written,
+ &udphdr->uh_sport, sizeof(uint16_t));
+
+ _net_rx_rss_add_chunk(rss_input, bytes_written,
+ &udphdr->uh_dport, sizeof(uint16_t));
+}
+
uint32_t
net_rx_pkt_calc_rss_hash(struct NetRxPkt *pkt,
NetRxPktRssType type,
@@ -347,6 +361,34 @@ net_rx_pkt_calc_rss_hash(struct NetRxPkt *pkt,
trace_net_rx_pkt_rss_ip6_ex();
_net_rx_rss_prepare_ip6(&rss_input[0], pkt, true, &rss_length);
break;
+ case NetPktRssIpV6TcpEx:
+ assert(pkt->isip6);
+ assert(pkt->istcp);
+ trace_net_rx_pkt_rss_ip6_ex_tcp();
+ _net_rx_rss_prepare_ip6(&rss_input[0], pkt, true, &rss_length);
+ _net_rx_rss_prepare_tcp(&rss_input[0], pkt, &rss_length);
+ break;
+ case NetPktRssIpV4Udp:
+ assert(pkt->isip4);
+ assert(pkt->isudp);
+ trace_net_rx_pkt_rss_ip4_udp();
+ _net_rx_rss_prepare_ip4(&rss_input[0], pkt, &rss_length);
+ _net_rx_rss_prepare_udp(&rss_input[0], pkt, &rss_length);
+ break;
+ case NetPktRssIpV6Udp:
+ assert(pkt->isip6);
+ assert(pkt->isudp);
+ trace_net_rx_pkt_rss_ip6_udp();
+ _net_rx_rss_prepare_ip6(&rss_input[0], pkt, false, &rss_length);
+ _net_rx_rss_prepare_udp(&rss_input[0], pkt, &rss_length);
+ break;
+ case NetPktRssIpV6UdpEx:
+ assert(pkt->isip6);
+ assert(pkt->isudp);
+ trace_net_rx_pkt_rss_ip6_ex_udp();
+ _net_rx_rss_prepare_ip6(&rss_input[0], pkt, true, &rss_length);
+ _net_rx_rss_prepare_udp(&rss_input[0], pkt, &rss_length);
+ break;
default:
assert(false);
break;
diff --git a/hw/net/net_rx_pkt.h b/hw/net/net_rx_pkt.h
index 7adf0fa..048e346 100644
--- a/hw/net/net_rx_pkt.h
+++ b/hw/net/net_rx_pkt.h
@@ -133,7 +133,11 @@ typedef enum {
NetPktRssIpV4Tcp,
NetPktRssIpV6Tcp,
NetPktRssIpV6,
- NetPktRssIpV6Ex
+ NetPktRssIpV6Ex,
+ NetPktRssIpV6TcpEx,
+ NetPktRssIpV4Udp,
+ NetPktRssIpV6Udp,
+ NetPktRssIpV6UdpEx,
} NetRxPktRssType;
/**
diff --git a/hw/net/trace-events b/hw/net/trace-events
index 42066fc..a1da98a 100644
--- a/hw/net/trace-events
+++ b/hw/net/trace-events
@@ -92,9 +92,13 @@ net_rx_pkt_l3_csum_validate_csum(size_t l3hdr_off, uint32_t csl, uint32_t cntr,
net_rx_pkt_rss_ip4(void) "Calculating IPv4 RSS hash"
net_rx_pkt_rss_ip4_tcp(void) "Calculating IPv4/TCP RSS hash"
+net_rx_pkt_rss_ip4_udp(void) "Calculating IPv4/UDP RSS hash"
net_rx_pkt_rss_ip6_tcp(void) "Calculating IPv6/TCP RSS hash"
+net_rx_pkt_rss_ip6_udp(void) "Calculating IPv6/UDP RSS hash"
net_rx_pkt_rss_ip6(void) "Calculating IPv6 RSS hash"
net_rx_pkt_rss_ip6_ex(void) "Calculating IPv6/EX RSS hash"
+net_rx_pkt_rss_ip6_ex_tcp(void) "Calculating IPv6/EX/TCP RSS hash"
+net_rx_pkt_rss_ip6_ex_udp(void) "Calculating IPv6/EX/UDP RSS hash"
net_rx_pkt_rss_hash(size_t rss_length, uint32_t rss_hash) "RSS hash for %zu bytes: 0x%X"
net_rx_pkt_rss_add_chunk(void* ptr, size_t size, size_t input_offset) "Add RSS chunk %p, %zu bytes, RSS input offset %zu bytes"
--
2.5.0
next prev parent reply other threads:[~2020-03-03 10:20 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-03 10:10 [PULL V2 00/23] Net patches Jason Wang
2020-03-03 10:10 ` [PULL V2 01/23] dp8393x: Mask EOL bit from descriptor addresses Jason Wang
2020-03-03 22:44 ` Finn Thain
2020-03-04 2:43 ` Jason Wang
2020-03-03 10:10 ` [PULL V2 02/23] dp8393x: Always use 32-bit accesses Jason Wang
2020-03-03 10:10 ` [PULL V2 03/23] dp8393x: Clean up endianness hacks Jason Wang
2020-03-03 10:10 ` [PULL V2 04/23] dp8393x: Have dp8393x_receive() return the packet size Jason Wang
2020-03-03 10:10 ` [PULL V2 05/23] dp8393x: Update LLFA and CRDA registers from rx descriptor Jason Wang
2020-03-03 10:10 ` [PULL V2 06/23] dp8393x: Clear RRRA command register bit only when appropriate Jason Wang
2020-03-03 10:10 ` [PULL V2 07/23] dp8393x: Implement packet size limit and RBAE interrupt Jason Wang
2020-03-03 10:10 ` [PULL V2 08/23] dp8393x: Don't clobber packet checksum Jason Wang
2020-03-03 10:10 ` [PULL V2 09/23] dp8393x: Use long-word-aligned RRA pointers in 32-bit mode Jason Wang
2020-03-03 10:10 ` [PULL V2 10/23] dp8393x: Pad frames to word or long word boundary Jason Wang
2020-03-03 10:10 ` [PULL V2 11/23] dp8393x: Clear descriptor in_use field to release packet Jason Wang
2020-03-03 10:10 ` [PULL V2 12/23] dp8393x: Always update RRA pointers and sequence numbers Jason Wang
2020-03-03 10:10 ` [PULL V2 13/23] dp8393x: Don't reset Silicon Revision register Jason Wang
2020-03-03 10:10 ` [PULL V2 14/23] dp8393x: Don't stop reception upon RBE interrupt assertion Jason Wang
2020-03-03 10:10 ` [PULL V2 15/23] e1000e: Avoid hw_error if legacy mode used Jason Wang
2020-03-03 10:10 ` Jason Wang [this message]
2020-03-03 10:10 ` [PULL V2 17/23] NetRxPkt: fix hash calculation of IPV6 TCP Jason Wang
2020-03-03 10:10 ` [PULL V2 18/23] hw: net: cadence_gem: Fix build errors in DB_PRINT() Jason Wang
2020-03-03 10:10 ` [PULL V2 19/23] block/replication.c: Ignore requests after failover Jason Wang
2020-03-03 10:10 ` [PULL V2 20/23] tests/test-replication.c: Add test for for secondary node continuing replication Jason Wang
2020-03-03 10:10 ` [PULL V2 21/23] net/filter.c: Add Options to insert filters anywhere in the filter list Jason Wang
2020-03-03 10:10 ` [PULL V2 22/23] colo: Update Documentation for continuous replication Jason Wang
2020-03-03 10:10 ` [PULL V2 23/23] l2tpv3: fix RFC number typo in qemu-options.hx Jason Wang
2020-03-03 13:45 ` [PULL V2 00/23] Net patches 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=1583230242-14597-17-git-send-email-jasowang@redhat.com \
--to=jasowang@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=yuri.benditovich@daynix.com \
/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).