Project

General

Profile

Feature #2987 » src-dst_fanout.patch

Sašo Kiselkov, 2012-07-10 02:34 PM

View differences:

new/usr/src/uts/common/io/mac/mac_sched.c Fri Jul 6 18:41:48 2012
516 516

  
517 517
#define	MAC_FANOUT_DEFAULT	0
518 518
#define	MAC_FANOUT_RND_ROBIN	1
519
#define	MAC_FANOUT_SRC_DST	2
519 520
int mac_fanout_type = MAC_FANOUT_DEFAULT;
520 521

  
521 522
#define	MAX_SR_TYPES	3
......
779 780
	uint16_t	remlen;
780 781
	uint8_t		nexthdr;
781 782
	uint16_t	hdr_len;
782
	uint32_t	src_val;
783
	uint32_t	src_val, dst_val;
783 784
	boolean_t	modifiable = B_TRUE, v6;
784 785

  
785 786
	ASSERT(MBLKL(mp) >= hdrsize);
......
849 850
		remlen = ntohs(ip6h->ip6_plen);
850 851
		nexthdr = ip6h->ip6_nxt;
851 852
		src_val = V4_PART_OF_V6(ip6h->ip6_src);
853
		dst_val = V4_PART_OF_V6(ip6h->ip6_dst);
852 854
		/*
853 855
		 * Do src based fanout if below tunable is set to B_TRUE or
854 856
		 * when mac_ip_hdr_length_v6() fails because of malformed
......
864 866
		remlen = ntohs(ipha->ipha_length) - hdr_len;
865 867
		nexthdr = ipha->ipha_protocol;
866 868
		src_val = (uint32_t)ipha->ipha_src;
869
		dst_val = (uint32_t)ipha->ipha_dst;
867 870
		/*
868 871
		 * Catch IPv4 fragment case here.  IPv6 has nexthdr == FRAG
869 872
		 * for its version.
......
909 912
			hash = HASH_ADDR(src_val, *(uint32_t *)whereptr);
910 913
			*indx = COMPUTE_INDEX(hash,
911 914
			    mac_srs->srs_udp_ring_count);
915
		} else if (mac_fanout_type == MAC_FANOUT_SRC_DST) {
916
			hash = HASH_ADDR(src_val + dst_val, *(uint32_t *)whereptr);
917
			*indx = COMPUTE_INDEX(hash,
918
			    mac_srs->srs_udp_ring_count);
912 919
		} else {
913 920
			*indx = mac_srs->srs_ind % mac_srs->srs_udp_ring_count;
914 921
			mac_srs->srs_ind++;
......
1203 1210
				hash = HASH_ADDR(ipha->ipha_src,
1204 1211
				    *(uint32_t *)(mp->b_rptr + ports_offset));
1205 1212
				indx = COMPUTE_INDEX(hash,
1213
				    mac_srs->srs_udp_ring_count);
1214
			} else if (mac_fanout_type == MAC_FANOUT_SRC_DST) {
1215
				hash = HASH_ADDR(ipha->ipha_src + ipha->ipha_dst,
1216
				    *(uint32_t *)(mp->b_rptr + ports_offset));
1217
				indx = COMPUTE_INDEX(hash,
1206 1218
				    mac_srs->srs_udp_ring_count);
1207 1219
			} else {
1208 1220
				indx = mac_srs->srs_ind %
    (1-1/1)