Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Jun 2016 04:52:10 +0000
From:      Phabricator <phabric-noreply@FreeBSD.org>
To:        freebsd-net@freebsd.org
Subject:   [Differential] D6688: net: Use M_HASHTYPE_OPAQUE_HASH if the mbuf flowid has hash properties
Message-ID:  <13c301ad4f2573b4a89a66923335b8a3@localhost.localdomain>
In-Reply-To: <differential-rev-PHID-DREV-v6plyu4q2zxdlctwe6wn-req@FreeBSD.org>
References:  <differential-rev-PHID-DREV-v6plyu4q2zxdlctwe6wn-req@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
This revision was automatically updated to reflect the committed changes.
Closed by commit rS301538: net: Use M_HASHTYPE_OPAQUE_HASH if the mbuf flowid has hash properties (authored by sephe).

CHANGED PRIOR TO COMMIT
  https://reviews.freebsd.org/D6688?vs=17213&id=17373#toc

REPOSITORY
  rS FreeBSD src repository

CHANGES SINCE LAST UPDATE
  https://reviews.freebsd.org/D6688?vs=17213&id=17373

REVISION DETAIL
  https://reviews.freebsd.org/D6688

AFFECTED FILES
  head/sys/dev/cxgb/cxgb_sge.c
  head/sys/dev/e1000/if_igb.c
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  head/sys/dev/ixgbe/ix_txrx.c
  head/sys/dev/ixl/ixl_txrx.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
  head/sys/dev/qlxgbe/ql_isr.c
  head/sys/dev/qlxge/qls_isr.c
  head/sys/net/flowtable.c
  head/sys/net/if_vxlan.c
  head/sys/netinet/sctp_input.c
  head/sys/netinet/sctp_pcb.c
  head/sys/ofed/drivers/net/mlx4/en_rx.c

EMAIL PREFERENCES
  https://reviews.freebsd.org/settings/panel/emailpreferences/

To: sepherosa_gmail.com, rrs, gallatin, glebius, rwatson, gnn, adrian, delphij, bryanv, kmacy, davidcs, bz, np, sbruno, hselasky, tuexen, #intel_networking, erj
Cc: freebsd-net-list

[-- Attachment #2 --]
diff --git a/head/sys/ofed/drivers/net/mlx4/en_rx.c b/head/sys/ofed/drivers/net/mlx4/en_rx.c
--- a/head/sys/ofed/drivers/net/mlx4/en_rx.c
+++ b/head/sys/ofed/drivers/net/mlx4/en_rx.c
@@ -619,7 +619,7 @@
 
 		/* forward Toeplitz compatible hash value */
 		mb->m_pkthdr.flowid = be32_to_cpu(cqe->immed_rss_invalid);
-		M_HASHTYPE_SET(mb, M_HASHTYPE_OPAQUE);
+		M_HASHTYPE_SET(mb, M_HASHTYPE_OPAQUE_HASH);
 		mb->m_pkthdr.rcvif = dev;
 		if (be32_to_cpu(cqe->vlan_my_qpn) &
 		    MLX4_CQE_VLAN_PRESENT_MASK) {
diff --git a/head/sys/netinet/sctp_pcb.c b/head/sys/netinet/sctp_pcb.c
--- a/head/sys/netinet/sctp_pcb.c
+++ b/head/sys/netinet/sctp_pcb.c
@@ -4070,7 +4070,7 @@
 	net->flowid = stcb->asoc.my_vtag ^
 	    ntohs(stcb->rport) ^
 	    ntohs(stcb->sctp_ep->sctp_lport);
-	net->flowtype = M_HASHTYPE_OPAQUE;
+	net->flowtype = M_HASHTYPE_OPAQUE_HASH;
 	if (netp) {
 		*netp = net;
 	}
diff --git a/head/sys/netinet/sctp_input.c b/head/sys/netinet/sctp_input.c
--- a/head/sys/netinet/sctp_input.c
+++ b/head/sys/netinet/sctp_input.c
@@ -6236,7 +6236,7 @@
 			tag = htonl(sh->v_tag);
 			flowid = tag ^ ntohs(sh->dest_port) ^ ntohs(sh->src_port);
 			m->m_pkthdr.flowid = flowid;
-			M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE);
+			M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE_HASH);
 		}
 		cpu_to_use = sctp_cpuarry[flowid % mp_ncpus];
 		sctp_queue_to_mcore(m, off, cpu_to_use);
diff --git a/head/sys/net/if_vxlan.c b/head/sys/net/if_vxlan.c
--- a/head/sys/net/if_vxlan.c
+++ b/head/sys/net/if_vxlan.c
@@ -2237,8 +2237,7 @@
 	range = sc->vxl_max_port - sc->vxl_min_port + 1;
 
 	/* check if flowid is set and not opaque */
-	if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE &&
-	    M_HASHTYPE_GET(m) != M_HASHTYPE_OPAQUE)
+	if (M_HASHTYPE_ISHASH(m))
 		hash = m->m_pkthdr.flowid;
 	else
 		hash = jenkins_hash(m->m_data, ETHER_HDR_LEN,
diff --git a/head/sys/net/flowtable.c b/head/sys/net/flowtable.c
--- a/head/sys/net/flowtable.c
+++ b/head/sys/net/flowtable.c
@@ -689,7 +689,7 @@
 		return (EHOSTUNREACH);
 
 	if (M_HASHTYPE_GET(m) == M_HASHTYPE_NONE) {
-		M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE);
+		M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE_HASH);
 		m->m_pkthdr.flowid = fle->f_hash;
 	}
 
diff --git a/head/sys/dev/qlxge/qls_isr.c b/head/sys/dev/qlxge/qls_isr.c
--- a/head/sys/dev/qlxge/qls_isr.c
+++ b/head/sys/dev/qlxge/qls_isr.c
@@ -190,7 +190,7 @@
 			if ((cq_e->flags1 & Q81_RX_FLAGS1_RSS_MATCH_MASK)) {
 				rxr->rss_int++;
 				mp->m_pkthdr.flowid = cq_e->rss;
-				M_HASHTYPE_SET(mp, M_HASHTYPE_OPAQUE);
+				M_HASHTYPE_SET(mp, M_HASHTYPE_OPAQUE_HASH);
 			}
 			if (cq_e->flags0 & (Q81_RX_FLAGS0_TE |
 				Q81_RX_FLAGS0_NU | Q81_RX_FLAGS0_IE)) {
diff --git a/head/sys/dev/qlxgbe/ql_isr.c b/head/sys/dev/qlxgbe/ql_isr.c
--- a/head/sys/dev/qlxgbe/ql_isr.c
+++ b/head/sys/dev/qlxgbe/ql_isr.c
@@ -159,7 +159,7 @@
 	if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
 
 	mpf->m_pkthdr.flowid = sgc->rss_hash;
-	M_HASHTYPE_SET(mpf, M_HASHTYPE_OPAQUE);
+	M_HASHTYPE_SET(mpf, M_HASHTYPE_OPAQUE_HASH);
 
 	(*ifp->if_input)(ifp, mpf);
 
@@ -324,7 +324,7 @@
 	mpf->m_pkthdr.csum_data = 0xFFFF;
 
 	mpf->m_pkthdr.flowid = sgc->rss_hash;
-	M_HASHTYPE_SET(mpf, M_HASHTYPE_OPAQUE);
+	M_HASHTYPE_SET(mpf, M_HASHTYPE_OPAQUE_HASH);
 
 	if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
 
diff --git a/head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c b/head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
--- a/head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
+++ b/head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
@@ -222,11 +222,11 @@
 			M_HASHTYPE_SET(mb, M_HASHTYPE_RSS_IPV6);
 			break;
 		default:	/* Other */
-			M_HASHTYPE_SET(mb, M_HASHTYPE_OPAQUE);
+			M_HASHTYPE_SET(mb, M_HASHTYPE_OPAQUE_HASH);
 			break;
 		}
 #else
-		M_HASHTYPE_SET(mb, M_HASHTYPE_OPAQUE);
+		M_HASHTYPE_SET(mb, M_HASHTYPE_OPAQUE_HASH);
 #endif
 	} else {
 		mb->m_pkthdr.flowid = rq->ix;
diff --git a/head/sys/dev/ixl/ixl_txrx.c b/head/sys/dev/ixl/ixl_txrx.c
--- a/head/sys/dev/ixl/ixl_txrx.c
+++ b/head/sys/dev/ixl/ixl_txrx.c
@@ -1453,10 +1453,10 @@
 	ex = decoded.outer_frag;
 
 	if (!decoded.known)
-		return M_HASHTYPE_OPAQUE;
+		return M_HASHTYPE_OPAQUE_HASH;
 
 	if (decoded.outer_ip == I40E_RX_PTYPE_OUTER_L2) 
-		return M_HASHTYPE_OPAQUE;
+		return M_HASHTYPE_OPAQUE_HASH;
 
 	/* Note: anything that gets to this point is IP */
         if (decoded.outer_ip_ver == I40E_RX_PTYPE_OUTER_IPV6) { 
@@ -1492,7 +1492,7 @@
 		}
 	}
 	/* We should never get here!! */
-	return M_HASHTYPE_OPAQUE;
+	return M_HASHTYPE_OPAQUE_HASH;
 }
 #endif /* RSS */
 
diff --git a/head/sys/dev/ixgbe/ix_txrx.c b/head/sys/dev/ixgbe/ix_txrx.c
--- a/head/sys/dev/ixgbe/ix_txrx.c
+++ b/head/sys/dev/ixgbe/ix_txrx.c
@@ -1964,7 +1964,7 @@
 #endif
                                     default:
                                         M_HASHTYPE_SET(sendmp,
-                                            M_HASHTYPE_OPAQUE);
+                                            M_HASHTYPE_OPAQUE_HASH);
                                 }
                         } else {
                                 sendmp->m_pkthdr.flowid = que->msix;
diff --git a/head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c b/head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
--- a/head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
+++ b/head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
@@ -1300,6 +1300,7 @@
 	struct ifnet *ifp = rxr->hn_ifp;
 	struct mbuf *m_new;
 	int size, do_lro = 0, do_csum = 1;
+	int hash_type = M_HASHTYPE_OPAQUE_HASH;
 
 	if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
 		return (0);
@@ -1430,8 +1431,6 @@
 	}
 
 	if (hash_info != NULL && hash_value != NULL) {
-		int hash_type = M_HASHTYPE_OPAQUE;
-
 		rxr->hn_rss_pkts++;
 		m_new->m_pkthdr.flowid = hash_value->hash_value;
 		if ((hash_info->hash_info & NDIS_HASH_FUNCTION_MASK) ==
@@ -1465,14 +1464,15 @@
 				break;
 			}
 		}
-		M_HASHTYPE_SET(m_new, hash_type);
 	} else {
-		if (hash_value != NULL)
+		if (hash_value != NULL) {
 			m_new->m_pkthdr.flowid = hash_value->hash_value;
-		else
+		} else {
 			m_new->m_pkthdr.flowid = rxr->hn_rx_idx;
-		M_HASHTYPE_SET(m_new, M_HASHTYPE_OPAQUE);
+			hash_type = M_HASHTYPE_OPAQUE;
+		}
 	}
+	M_HASHTYPE_SET(m_new, hash_type);
 
 	/*
 	 * Note:  Moved RX completion back to hv_nv_on_receive() so all
diff --git a/head/sys/dev/e1000/if_igb.c b/head/sys/dev/e1000/if_igb.c
--- a/head/sys/dev/e1000/if_igb.c
+++ b/head/sys/dev/e1000/if_igb.c
@@ -5154,7 +5154,7 @@
 					default:
 						/* XXX fallthrough */
 						M_HASHTYPE_SET(rxr->fmp,
-						    M_HASHTYPE_OPAQUE);
+						    M_HASHTYPE_OPAQUE_HASH);
 				}
 			} else {
 #ifndef IGB_LEGACY_TX
diff --git a/head/sys/dev/cxgb/cxgb_sge.c b/head/sys/dev/cxgb/cxgb_sge.c
--- a/head/sys/dev/cxgb/cxgb_sge.c
+++ b/head/sys/dev/cxgb/cxgb_sge.c
@@ -2900,7 +2900,8 @@
 			eop = get_packet(adap, drop_thresh, qs, mh, r);
 			if (eop) {
 				if (r->rss_hdr.hash_type && !adap->timestamp) {
-					M_HASHTYPE_SET(mh->mh_head, M_HASHTYPE_OPAQUE);
+					M_HASHTYPE_SET(mh->mh_head,
+					    M_HASHTYPE_OPAQUE_HASH);
 					mh->mh_head->m_pkthdr.flowid = rss_hash;
 				}
 			}


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