Date: Sun, 14 Jun 2015 03:05:03 GMT From: btw@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r287063 - soc2015/btw/head/tools/tools/mq-testing/vme Message-ID: <201506140305.t5E353GF098924@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: btw Date: Sun Jun 14 03:05:03 2015 New Revision: 287063 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=287063 Log: Add the supports for hashing the IPv6 packets to vme. Modified: soc2015/btw/head/tools/tools/mq-testing/vme/if_vme.c Modified: soc2015/btw/head/tools/tools/mq-testing/vme/if_vme.c ============================================================================== --- soc2015/btw/head/tools/tools/mq-testing/vme/if_vme.c Sun Jun 14 02:21:19 2015 (r287062) +++ soc2015/btw/head/tools/tools/mq-testing/vme/if_vme.c Sun Jun 14 03:05:03 2015 (r287063) @@ -73,9 +73,12 @@ #include <netinet/in.h> #include <netinet/in_rss.h> #include <netinet/ip.h> +#include <netinet/ip6.h> #include <netinet/tcp.h> #include <netinet/udp.h> +#include <netinet6/in6_rss.h> + #include "if_vme.h" /* @@ -1111,6 +1114,8 @@ if (m->m_pkthdr.len < hdrlen || (m->m_len < hdrlen && (m = m_pullup(m, hdrlen)) == NULL)) return; + eh = mtod(m, struct ether_header *); + ip = (const struct ip *)(eh + 1); uh = (const struct udphdr *)((c_caddr_t)ip + iphlen); rss_proto_software_hash_v4(ip->ip_src, ip->ip_dst, uh->uh_sport, uh->uh_dport, proto, hashval, @@ -1121,6 +1126,8 @@ if (m->m_pkthdr.len < hdrlen || (m->m_len < hdrlen && (m = m_pullup(m, hdrlen)) == NULL)) return; + eh = mtod(m, struct ether_header *); + ip = (const struct ip *)(eh + 1); th = (const struct tcphdr *)((c_caddr_t)ip + iphlen); rss_proto_software_hash_v4(ip->ip_src, ip->ip_dst, th->th_sport, th->th_dport, proto, hashval, @@ -1137,6 +1144,54 @@ static void vmersshash_v6(struct mbuf *m, uint32_t *hashval, uint32_t *hashtype) { + const struct ether_header *eh; + const struct ip6_hdr *ip6; + const struct tcphdr *th; + const struct udphdr *uh; + int hdrlen; + uint8_t proto; + + hdrlen = sizeof(*eh) + sizeof(*ip6); + + if (m->m_pkthdr.len < hdrlen || (m->m_len < hdrlen && + (m = m_pullup(m, hdrlen)) == NULL)) + return; + + eh = mtod(m, struct ether_header *); + ip6 = (const struct ip6_hdr *)(eh + 1); + proto = ip6->ip6_nxt; + + if ((rss_gethashconfig() & RSS_HASHTYPE_RSS_UDP_IPV6) && + (proto == IPPROTO_UDP)) { + hdrlen += sizeof(*uh); + if (m->m_pkthdr.len < hdrlen || (m->m_len < hdrlen && + (m = m_pullup(m, hdrlen)) == NULL)) + return; + eh = mtod(m, struct ether_header *); + ip6 = (const struct ip6_hdr *)(eh + 1); + uh = (const struct udphdr *)(ip6 + 1); + rss_proto_software_hash_v6(&ip6->ip6_src, &ip6->ip6_dst, + uh->uh_sport, uh->uh_dport, proto, hashval, + hashtype); + } else if ((rss_gethashconfig() & RSS_HASHTYPE_RSS_TCP_IPV6) && + (proto == IPPROTO_TCP)) { + hdrlen += sizeof(*th); + if (m->m_pkthdr.len < hdrlen || (m->m_len < hdrlen && + (m = m_pullup(m, hdrlen)) == NULL)) + return; + eh = mtod(m, struct ether_header *); + ip6 = (const struct ip6_hdr *)(eh + 1); + th = (const struct tcphdr *)(ip6 + 1); + rss_proto_software_hash_v6(&ip6->ip6_src, &ip6->ip6_dst, + th->th_sport, th->th_dport, proto, hashval, + hashtype); + } else if (rss_gethashconfig() & RSS_HASHTYPE_RSS_IPV6) { + rss_proto_software_hash_v6(&ip6->ip6_src, &ip6->ip6_dst, + 0 /* src port */, 0 /* dst port */, 0 /* proto */, + hashval, hashtype); + } else { + printf("%s: no available hashtypes!\n", __func__); + } } static void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201506140305.t5E353GF098924>