Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Jul 2015 09:13:19 +0000 (UTC)
From:      Hiren Panchasara <hiren@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r285528 - head/sys/dev/ixgbe
Message-ID:  <201507140913.t6E9DJ7c071487@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hiren
Date: Tue Jul 14 09:13:18 2015
New Revision: 285528
URL: https://svnweb.freebsd.org/changeset/base/285528

Log:
  Expose full 32bit RSS hash from card regardless of whether RSS is defined or
  not. When 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, delete the FreeBSD version check and use of deprecated M_FLOWID.
  
  Reviewed by:	adrian, erj
  MFC after:	1 week
  Sponsored by:	Limelight Networks

Modified:
  head/sys/dev/ixgbe/ix_txrx.c

Modified: head/sys/dev/ixgbe/ix_txrx.c
==============================================================================
--- head/sys/dev/ixgbe/ix_txrx.c	Tue Jul 14 08:02:05 2015	(r285527)
+++ head/sys/dev/ixgbe/ix_txrx.c	Tue Jul 14 09:13:18 2015	(r285528)
@@ -1910,53 +1910,60 @@ ixgbe_rxeof(struct ix_queue *que)
 			}
 			if ((ifp->if_capenable & IFCAP_RXCSUM) != 0)
 				ixgbe_rx_checksum(staterr, sendmp, ptype);
-#if __FreeBSD_version >= 800000
-#ifdef RSS
-			sendmp->m_pkthdr.flowid =
-			    le32toh(cur->wb.lower.hi_dword.rss);
-#if __FreeBSD_version < 1100054
-			sendmp->m_flags |= M_FLOWID;
-#endif
-			switch (pkt_info & IXGBE_RXDADV_RSSTYPE_MASK) {
-			case IXGBE_RXDADV_RSSTYPE_IPV4_TCP:
-				M_HASHTYPE_SET(sendmp, M_HASHTYPE_RSS_TCP_IPV4);
-				break;
-			case IXGBE_RXDADV_RSSTYPE_IPV4:
-				M_HASHTYPE_SET(sendmp, M_HASHTYPE_RSS_IPV4);
-				break;
-			case IXGBE_RXDADV_RSSTYPE_IPV6_TCP:
-				M_HASHTYPE_SET(sendmp, M_HASHTYPE_RSS_TCP_IPV6);
-				break;
-			case IXGBE_RXDADV_RSSTYPE_IPV6_EX:
-				M_HASHTYPE_SET(sendmp, M_HASHTYPE_RSS_IPV6_EX);
-				break;
-			case IXGBE_RXDADV_RSSTYPE_IPV6:
-				M_HASHTYPE_SET(sendmp, M_HASHTYPE_RSS_IPV6);
-				break;
-			case IXGBE_RXDADV_RSSTYPE_IPV6_TCP_EX:
-				M_HASHTYPE_SET(sendmp, M_HASHTYPE_RSS_TCP_IPV6_EX);
-				break;
-			case IXGBE_RXDADV_RSSTYPE_IPV4_UDP:
-				M_HASHTYPE_SET(sendmp, M_HASHTYPE_RSS_UDP_IPV4);
-				break;
-			case IXGBE_RXDADV_RSSTYPE_IPV6_UDP:
-				M_HASHTYPE_SET(sendmp, M_HASHTYPE_RSS_UDP_IPV6);
-				break;
-			case IXGBE_RXDADV_RSSTYPE_IPV6_UDP_EX:
-				M_HASHTYPE_SET(sendmp, M_HASHTYPE_RSS_UDP_IPV6_EX);
-				break;
-			default:
+
+                        /*
+                         * 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) {
+                                sendmp->m_pkthdr.flowid =
+                                    le32toh(cur->wb.lower.hi_dword.rss);
+                                switch (pkt_info & IXGBE_RXDADV_RSSTYPE_MASK) {  
+                                    case IXGBE_RXDADV_RSSTYPE_IPV4_TCP:
+                                        M_HASHTYPE_SET(sendmp,
+                                            M_HASHTYPE_RSS_TCP_IPV4);
+                                        break;
+                                    case IXGBE_RXDADV_RSSTYPE_IPV4:
+                                        M_HASHTYPE_SET(sendmp,
+                                            M_HASHTYPE_RSS_IPV4);
+                                        break;
+                                    case IXGBE_RXDADV_RSSTYPE_IPV6_TCP:
+                                        M_HASHTYPE_SET(sendmp,
+                                            M_HASHTYPE_RSS_TCP_IPV6);
+                                        break;
+                                    case IXGBE_RXDADV_RSSTYPE_IPV6_EX:
+                                        M_HASHTYPE_SET(sendmp,
+                                            M_HASHTYPE_RSS_IPV6_EX);
+                                        break;
+                                    case IXGBE_RXDADV_RSSTYPE_IPV6:
+                                        M_HASHTYPE_SET(sendmp,
+                                            M_HASHTYPE_RSS_IPV6);
+                                        break;
+                                    case IXGBE_RXDADV_RSSTYPE_IPV6_TCP_EX:
+                                        M_HASHTYPE_SET(sendmp,
+                                            M_HASHTYPE_RSS_TCP_IPV6_EX);
+                                        break;
+                                    case IXGBE_RXDADV_RSSTYPE_IPV4_UDP:
+                                        M_HASHTYPE_SET(sendmp,
+                                            M_HASHTYPE_RSS_UDP_IPV4);
+                                        break;
+                                    case IXGBE_RXDADV_RSSTYPE_IPV6_UDP:
+                                        M_HASHTYPE_SET(sendmp,
+                                            M_HASHTYPE_RSS_UDP_IPV6);
+                                        break;
+                                    case IXGBE_RXDADV_RSSTYPE_IPV6_UDP_EX:
+                                        M_HASHTYPE_SET(sendmp,
+                                            M_HASHTYPE_RSS_UDP_IPV6_EX);
+                                        break;
+                                    default:
+                                        M_HASHTYPE_SET(sendmp,
+                                            M_HASHTYPE_OPAQUE);
+                                }
+                        } else {
+                                sendmp->m_pkthdr.flowid = que->msix;
 				M_HASHTYPE_SET(sendmp, M_HASHTYPE_OPAQUE);
 			}
-#else /* RSS */
-			sendmp->m_pkthdr.flowid = que->msix;
-#if __FreeBSD_version >= 1100054
-			M_HASHTYPE_SET(sendmp, M_HASHTYPE_OPAQUE);
-#else
-			sendmp->m_flags |= M_FLOWID;
-#endif
-#endif /* RSS */
-#endif /* FreeBSD_version */
 		}
 next_desc:
 		bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201507140913.t6E9DJ7c071487>