PERFORCE change 125093 for review

Kip Macy kmacy at FreeBSD.org
Sun Aug 12 18:07:15 PDT 2007


http://perforce.freebsd.org/chv.cgi?CH=125093

Change 125093 by kmacy at kmacy_home:ethng on 2007/08/13 01:06:28

	rss_hash is a crc of the ip/port 4-tuple used by hardware for choosing 
	a queue
		- add rss_hash to inpcb and mbuf pkthdr
		- initialize to counter value initially for the case where UDP never receives a packet
		  and we just need to pick a tx queue

Affected files ...

.. //depot/projects/ethng/src/sys/kern/kern_mbuf.c#2 edit
.. //depot/projects/ethng/src/sys/netinet/in_pcb.c#2 edit
.. //depot/projects/ethng/src/sys/netinet/in_pcb.h#2 edit
.. //depot/projects/ethng/src/sys/sys/mbuf.h#2 edit

Differences ...

==== //depot/projects/ethng/src/sys/kern/kern_mbuf.c#2 (text+ko) ====

@@ -321,6 +321,7 @@
 		m->m_pkthdr.tso_segsz = 0;
 		m->m_pkthdr.ether_vtag = 0;
 		SLIST_INIT(&m->m_pkthdr.tags);
+		m->m_pkthdr.rss_hash = 0;
 #ifdef MAC
 		/* If the label init fails, fail the alloc */
 		error = mac_init_mbuf(m, how);

==== //depot/projects/ethng/src/sys/netinet/in_pcb.c#2 (text+ko) ====

@@ -175,7 +175,8 @@
 {
 	struct inpcb *inp;
 	int error;
-
+	static int rss_hash = 1;
+	
 	INP_INFO_WLOCK_ASSERT(pcbinfo);
 	error = 0;
 	inp = uma_zalloc(pcbinfo->ipi_zone, M_NOWAIT);
@@ -184,6 +185,7 @@
 	bzero(inp, inp_zero_size);
 	inp->inp_pcbinfo = pcbinfo;
 	inp->inp_socket = so;
+	inp->inp_rss_hash = rss_hash++;
 #ifdef MAC
 	error = mac_init_inpcb(inp, M_NOWAIT);
 	if (error != 0)

==== //depot/projects/ethng/src/sys/netinet/in_pcb.h#2 (text+ko) ====

@@ -168,6 +168,7 @@
 	struct	inpcbport *inp_phd;	/* head of this list */
 #define inp_zero_size offsetof(struct inpcb, inp_gencnt)
 	inp_gen_t	inp_gencnt;	/* generation count of this instance */
+	uint32_t        inp_rss_hash;		  
 	struct mtx	inp_mtx;
 
 #define	in6p_faddr	inp_inc.inc6_faddr

==== //depot/projects/ethng/src/sys/sys/mbuf.h#2 (text+ko) ====

@@ -78,7 +78,7 @@
 #endif /* _KERNEL */
 
 #if defined(__LP64__)
-#define M_HDR_PAD    6
+#define M_HDR_PAD    2
 #else
 #define M_HDR_PAD    2
 #endif
@@ -92,7 +92,7 @@
 	caddr_t		 mh_data;	/* location of data */
 	int		 mh_len;	/* amount of data in this mbuf */
 	int		 mh_flags;	/* flags; see below */
-	short		 mh_type;	/* type of data in this mbuf */
+	short		 mh_type;	/* type of data in this mbuf   */
 	uint8_t          pad[M_HDR_PAD];/* word align                  */
 };
 
@@ -121,6 +121,7 @@
 	u_int16_t	 tso_segsz;	/* TSO segment size */
 	u_int16_t	 ether_vtag;	/* Ethernet 802.1p+q vlan tag */
 	SLIST_HEAD(packet_tags, m_tag) tags; /* list of packet tags */
+	uint32_t         rss_hash;   /* RSS hash for this 4-tuple   */
 };
 
 /*
@@ -161,6 +162,7 @@
 #define	m_flags		m_hdr.mh_flags
 #define	m_nextpkt	m_hdr.mh_nextpkt
 #define	m_act		m_nextpkt
+#define	m_rss_hash	m_hdr.mh_rss_hash
 #define	m_pkthdr	M_dat.MH.MH_pkthdr
 #define	m_ext		M_dat.MH.MH_dat.MH_ext
 #define	m_pktdat	M_dat.MH.MH_dat.MH_databuf


More information about the p4-projects mailing list