net: Use M_HASHTYPE_OPAQUE_HASH if the mbuf flowid has hash properties

Reviewed by:	hps, erj, tuexen
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6688
This commit is contained in:
Sepherosa Ziehau 2016-06-07 04:51:50 +00:00
parent aebdb1e24e
commit 36ad8372d4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=301538
13 changed files with 23 additions and 23 deletions

View File

@ -2900,7 +2900,8 @@ process_responses(adapter_t *adap, struct sge_qset *qs, int budget)
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;
}
}

View File

@ -5154,7 +5154,7 @@ igb_rxeof(struct igb_queue *que, int count, int *done)
default:
/* XXX fallthrough */
M_HASHTYPE_SET(rxr->fmp,
M_HASHTYPE_OPAQUE);
M_HASHTYPE_OPAQUE_HASH);
}
} else {
#ifndef IGB_LEGACY_TX

View File

@ -1300,6 +1300,7 @@ netvsc_recv(struct hv_vmbus_channel *chan, netvsc_packet *packet,
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 @@ netvsc_recv(struct hv_vmbus_channel *chan, netvsc_packet *packet,
}
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 @@ netvsc_recv(struct hv_vmbus_channel *chan, netvsc_packet *packet,
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

View File

@ -1964,7 +1964,7 @@ ixgbe_rxeof(struct ix_queue *que)
#endif
default:
M_HASHTYPE_SET(sendmp,
M_HASHTYPE_OPAQUE);
M_HASHTYPE_OPAQUE_HASH);
}
} else {
sendmp->m_pkthdr.flowid = que->msix;

View File

@ -1453,10 +1453,10 @@ ixl_ptype_to_hash(u8 ptype)
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 @@ ixl_ptype_to_hash(u8 ptype)
}
}
/* We should never get here!! */
return M_HASHTYPE_OPAQUE;
return M_HASHTYPE_OPAQUE_HASH;
}
#endif /* RSS */

View File

@ -222,11 +222,11 @@ mlx5e_build_rx_mbuf(struct mlx5_cqe64 *cqe,
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;

View File

@ -159,7 +159,7 @@ qla_rx_intr(qla_host_t *ha, qla_sgl_rcv_t *sgc, uint32_t sds_idx)
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 @@ qla_lro_intr(qla_host_t *ha, qla_sgl_lro_t *sgc, uint32_t sds_idx)
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);

View File

@ -190,7 +190,7 @@ qls_rx_comp(qla_host_t *ha, uint32_t rxr_idx, uint32_t cq_idx, q81_rx_t *cq_e)
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)) {

View File

@ -689,7 +689,7 @@ flowtable_lookup(sa_family_t sa, struct mbuf *m, struct route *ro)
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;
}

View File

@ -2237,8 +2237,7 @@ vxlan_pick_source_port(struct vxlan_softc *sc, struct mbuf *m)
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,

View File

@ -6236,7 +6236,7 @@ sctp_input(struct mbuf **mp, int *offp, int proto SCTP_UNUSED)
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);

View File

@ -4070,7 +4070,7 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr,
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;
}

View File

@ -619,7 +619,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
/* 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) {