svn commit: r281838 - head/sys/dev/e1000

Hiren Panchasara hiren at FreeBSD.org
Tue Apr 21 20:24:16 UTC 2015


Author: hiren
Date: Tue Apr 21 20:24:15 2015
New Revision: 281838
URL: https://svnweb.freebsd.org/changeset/base/281838

Log:
  For igb(4), when we are doing multiqueue, we are all setup to have full 32bit
  RSS hash from the card. We do not need to hide that under "ifdef RSS" and should
  expose that by default so others like lagg(4) can use that and avoid hashing the
  traffic by themselves.
  While here, improve comments and get rid of hidden/unimplemented RSS support
  code for UDP.
  
  Differential Revision:	https://reviews.freebsd.org/D2296
  Reviewed by:	jfv, erj
  Discussed with:	adrian
  Sponsored by:	Limelight Networks

Modified:
  head/sys/dev/e1000/if_igb.c

Modified: head/sys/dev/e1000/if_igb.c
==============================================================================
--- head/sys/dev/e1000/if_igb.c	Tue Apr 21 19:33:30 2015	(r281837)
+++ head/sys/dev/e1000/if_igb.c	Tue Apr 21 20:24:15 2015	(r281838)
@@ -4630,8 +4630,11 @@ igb_initialise_rss_mapping(struct adapte
 
 	/* Now fill in hash table */
 
-	/* XXX This means RSS enable + 8 queues for my igb (82580.) */
-	mrqc = E1000_MRQC_ENABLE_RSS_4Q;
+	/*
+	 * MRQC: Multiple Receive Queues Command
+	 * Set queuing to RSS control, number depends on the device.
+	 */
+	mrqc = E1000_MRQC_ENABLE_RSS_8Q;
 
 #ifdef	RSS
 	/* XXX ew typecasting */
@@ -5139,45 +5142,51 @@ igb_rxeof(struct igb_queue *que, int cou
 				rxr->fmp->m_pkthdr.ether_vtag = vtag;
 				rxr->fmp->m_flags |= M_VLANTAG;
 			}
-#ifdef	RSS
-			/* XXX set flowtype once this works right */
-			rxr->fmp->m_pkthdr.flowid = 
-			    le32toh(cur->wb.lower.hi_dword.rss);
-			switch (pkt_info & E1000_RXDADV_RSSTYPE_MASK) {
-			case E1000_RXDADV_RSSTYPE_IPV4_TCP:
-				M_HASHTYPE_SET(rxr->fmp, M_HASHTYPE_RSS_TCP_IPV4);
-				break;
-			case E1000_RXDADV_RSSTYPE_IPV4:
-				M_HASHTYPE_SET(rxr->fmp, M_HASHTYPE_RSS_IPV4);
-				break;
-			case E1000_RXDADV_RSSTYPE_IPV6_TCP:
-				M_HASHTYPE_SET(rxr->fmp, M_HASHTYPE_RSS_TCP_IPV6);
-				break;
-			case E1000_RXDADV_RSSTYPE_IPV6_EX:
-				M_HASHTYPE_SET(rxr->fmp, M_HASHTYPE_RSS_IPV6_EX);
-				break;
-			case E1000_RXDADV_RSSTYPE_IPV6:
-				M_HASHTYPE_SET(rxr->fmp, M_HASHTYPE_RSS_IPV6);
-				break;
-			case E1000_RXDADV_RSSTYPE_IPV6_TCP_EX:
-				M_HASHTYPE_SET(rxr->fmp, M_HASHTYPE_RSS_TCP_IPV6_EX);
-				break;
-
-			/* XXX no UDP support in RSS just yet */
-#ifdef notyet
-			case E1000_RXDADV_RSSTYPE_IPV4_UDP:
-			case E1000_RXDADV_RSSTYPE_IPV6_UDP:
-			case E1000_RXDADV_RSSTYPE_IPV6_UDP_EX:
-#endif
-			
-			default:
-				/* XXX fallthrough */
+
+			/*
+			 * In case of multiqueue, we have RXCSUM.PCSD bit set
+			 * and never cleared. This means we have RSS hash
+			 * available to be used.
+			 */
+			if (adapter->num_queues > 1) {
+				rxr->fmp->m_pkthdr.flowid = 
+				    le32toh(cur->wb.lower.hi_dword.rss);
+				switch (pkt_info & E1000_RXDADV_RSSTYPE_MASK) {
+					case E1000_RXDADV_RSSTYPE_IPV4_TCP:
+						M_HASHTYPE_SET(rxr->fmp,
+						    M_HASHTYPE_RSS_TCP_IPV4);
+					break;
+					case E1000_RXDADV_RSSTYPE_IPV4:
+						M_HASHTYPE_SET(rxr->fmp,
+						    M_HASHTYPE_RSS_IPV4);
+					break;
+					case E1000_RXDADV_RSSTYPE_IPV6_TCP:
+						M_HASHTYPE_SET(rxr->fmp,
+						    M_HASHTYPE_RSS_TCP_IPV6);
+					break;
+					case E1000_RXDADV_RSSTYPE_IPV6_EX:
+						M_HASHTYPE_SET(rxr->fmp,
+						    M_HASHTYPE_RSS_IPV6_EX);
+					break;
+					case E1000_RXDADV_RSSTYPE_IPV6:
+						M_HASHTYPE_SET(rxr->fmp,
+						    M_HASHTYPE_RSS_IPV6);
+					break;
+					case E1000_RXDADV_RSSTYPE_IPV6_TCP_EX:
+						M_HASHTYPE_SET(rxr->fmp,
+						    M_HASHTYPE_RSS_TCP_IPV6_EX);
+					break;
+					default:
+						/* XXX fallthrough */
+						M_HASHTYPE_SET(rxr->fmp,
+						    M_HASHTYPE_OPAQUE);
+				}
+			} else {
+#ifndef IGB_LEGACY_TX
+				rxr->fmp->m_pkthdr.flowid = que->msix;
 				M_HASHTYPE_SET(rxr->fmp, M_HASHTYPE_OPAQUE);
-			}
-#elif !defined(IGB_LEGACY_TX)
-			rxr->fmp->m_pkthdr.flowid = que->msix;
-			M_HASHTYPE_SET(rxr->fmp, M_HASHTYPE_OPAQUE);
 #endif
+			}
 			sendmp = rxr->fmp;
 			/* Make sure to set M_PKTHDR. */
 			sendmp->m_flags |= M_PKTHDR;


More information about the svn-src-all mailing list