| 641 | } |
| 642 | |
| 643 | static uint32_t |
| 644 | gre_flowid(struct gre_softc *sc, struct mbuf *m, uint32_t af) |
| 645 | { |
| 646 | uint32_t flowid; |
| 647 | |
| 648 | if ((sc->gre_options & GRE_UDPENCAP) == 0 || sc->gre_port != 0) |
| 649 | return (0); |
| 650 | #ifndef RSS |
| 651 | switch (af) { |
| 652 | #ifdef INET |
| 653 | case AF_INET: |
| 654 | flowid = mtod(m, struct ip *)->ip_src.s_addr ^ |
| 655 | mtod(m, struct ip *)->ip_dst.s_addr; |
| 656 | break; |
| 657 | #endif |
| 658 | #ifdef INET6 |
| 659 | case AF_INET6: |
| 660 | flowid = mtod(m, struct ip6_hdr *)->ip6_src.s6_addr32[3] ^ |
| 661 | mtod(m, struct ip6_hdr *)->ip6_dst.s6_addr32[3]; |
| 662 | break; |
| 663 | #endif |
| 664 | default: |
| 665 | flowid = 0; |
| 666 | } |
| 667 | #else /* RSS */ |
| 668 | switch (af) { |
| 669 | #ifdef INET |
| 670 | case AF_INET: |
| 671 | flowid = rss_hash_ip4_2tuple(mtod(m, struct ip *)->ip_src, |
| 672 | mtod(m, struct ip *)->ip_dst); |
| 673 | break; |
| 674 | #endif |
| 675 | #ifdef INET6 |
| 676 | case AF_INET6: |
| 677 | flowid = rss_hash_ip6_2tuple( |
| 678 | &mtod(m, struct ip6_hdr *)->ip6_src, |
| 679 | &mtod(m, struct ip6_hdr *)->ip6_dst); |
| 680 | break; |
| 681 | #endif |
| 682 | default: |
| 683 | flowid = 0; |
| 684 | } |
| 685 | #endif |
| 686 | return (flowid); |
| 687 | } |
| 688 | |
| 689 | #define MTAG_GRE 1307983903 |
| 690 | static int |
no test coverage detected