Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Jan 2017 23:12:03 +0000 (UTC)
From:      Sean Bruno <sbruno@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r312786 - head/sys/dev/e1000
Message-ID:  <201701252312.v0PNC3H5062964@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sbruno
Date: Wed Jan 25 23:12:03 2017
New Revision: 312786
URL: https://svnweb.freebsd.org/changeset/base/312786

Log:
  Implement RSS queue tagging for em(4) class devices from a copy and massage
  of functions from igb(4).  This enables 2 queue routing on 82574L class
  devices again.

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

Modified: head/sys/dev/e1000/em_txrx.c
==============================================================================
--- head/sys/dev/e1000/em_txrx.c	Wed Jan 25 22:52:57 2017	(r312785)
+++ head/sys/dev/e1000/em_txrx.c	Wed Jan 25 23:12:03 2017	(r312786)
@@ -62,6 +62,7 @@ static int lem_isc_rxd_pkt_get(void *arg
 
 static void lem_receive_checksum(int status, int errors, if_rxd_info_t ri);
 static void em_receive_checksum(uint32_t status, if_rxd_info_t ri);
+static int em_determine_rsstype(u32 pkt_info);
 extern int em_intr(void *arg);
 
 struct if_txrx em_txrx  = {
@@ -645,6 +646,7 @@ em_isc_rxd_pkt_get(void *arg, if_rxd_inf
 	union e1000_rx_desc_extended *rxd;
 
 	u16                      len; 
+	u32                      pkt_info;
 	u32                      staterr = 0;
 	bool                     eop;
 	int                      i, cidx, vtag;
@@ -655,6 +657,7 @@ em_isc_rxd_pkt_get(void *arg, if_rxd_inf
 	do {
 		rxd = &rxr->rx_base[cidx];
 		staterr = le32toh(rxd->wb.upper.status_error);	
+		pkt_info = le32toh(rxd->wb.lower.mrq);
 	
 		/* Error Checking then decrement count */
 		MPASS ((staterr & E1000_RXD_STAT_DD) != 0);
@@ -690,10 +693,14 @@ em_isc_rxd_pkt_get(void *arg, if_rxd_inf
 	} 
 	
 	ri->iri_vtag = vtag;
-	ri->iri_nfrags = i;
 	if (vtag)
 		ri->iri_flags |= M_VLANTAG;
 		
+        ri->iri_flowid =
+                le32toh(rxd->wb.lower.hi_dword.rss);
+        ri->iri_rsstype = em_determine_rsstype(pkt_info);
+
+	ri->iri_nfrags = i;
 	return (0);
 }
 
@@ -721,6 +728,31 @@ lem_receive_checksum(int status, int err
 	}
 }
 
+/********************************************************************
+ *
+ *  Parse the packet type to determine the appropriate hash
+ *
+ ******************************************************************/
+static int
+em_determine_rsstype(u32 pkt_info)
+{
+        switch (pkt_info & E1000_RXDADV_RSSTYPE_MASK) {
+        case E1000_RXDADV_RSSTYPE_IPV4_TCP:
+                return M_HASHTYPE_RSS_TCP_IPV4;
+        case E1000_RXDADV_RSSTYPE_IPV4:
+                return M_HASHTYPE_RSS_IPV4;
+        case E1000_RXDADV_RSSTYPE_IPV6_TCP:
+                return M_HASHTYPE_RSS_TCP_IPV6;
+        case E1000_RXDADV_RSSTYPE_IPV6_EX: 
+                return M_HASHTYPE_RSS_IPV6_EX;
+        case E1000_RXDADV_RSSTYPE_IPV6:
+                return M_HASHTYPE_RSS_IPV6;
+        case E1000_RXDADV_RSSTYPE_IPV6_TCP_EX:
+                return M_HASHTYPE_RSS_TCP_IPV6_EX;
+        default:
+                return M_HASHTYPE_OPAQUE;
+        }
+}
 static void
 em_receive_checksum(uint32_t status, if_rxd_info_t ri)
 {



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