summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2020-07-17 06:33:08 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2020-07-17 06:33:08 +0000
commitba1f30842f16bc72dd311f3cf188c0fe2dc94729 (patch)
tree3df94d18ec2729a5c9c44646cbcd2f22c7e35e0c /sys/dev
parent26de37b7bbadd5cd56b3bfe420bcf61fe7fb51bd (diff)
use the system stoeplitz key instead of a random one.
while here, stash the rss hash value from rx descriptors in the mbuf as a flow id.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/files.pci4
-rw-r--r--sys/dev/pci/if_ix.c14
2 files changed, 14 insertions, 4 deletions
diff --git a/sys/dev/pci/files.pci b/sys/dev/pci/files.pci
index f33e54621e7..c3ebbf1b431 100644
--- a/sys/dev/pci/files.pci
+++ b/sys/dev/pci/files.pci
@@ -1,4 +1,4 @@
-# $OpenBSD: files.pci,v 1.351 2020/07/17 06:27:36 dlg Exp $
+# $OpenBSD: files.pci,v 1.352 2020/07/17 06:33:07 dlg Exp $
# $NetBSD: files.pci,v 1.20 1996/09/24 17:47:15 christos Exp $
#
# Config file and device description for machine-independent PCI code.
@@ -343,7 +343,7 @@ file dev/pci/ixgb_ee.c ixgb
file dev/pci/ixgb_hw.c ixgb
# Intel 82598 10GbE
-device ix: ether, ifnet, ifmedia, intrmap
+device ix: ether, ifnet, ifmedia, intrmap, stoeplitz
attach ix at pci
file dev/pci/if_ix.c ix
file dev/pci/ixgbe.c ix
diff --git a/sys/dev/pci/if_ix.c b/sys/dev/pci/if_ix.c
index 5bca3667431..d534e1f0612 100644
--- a/sys/dev/pci/if_ix.c
+++ b/sys/dev/pci/if_ix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ix.c,v 1.168 2020/07/17 06:27:36 dlg Exp $ */
+/* $OpenBSD: if_ix.c,v 1.169 2020/07/17 06:33:07 dlg Exp $ */
/******************************************************************************
@@ -2934,7 +2934,7 @@ ixgbe_initialize_rss_mapping(struct ix_softc *sc)
int i, j, queue_id, table_size, index_mult;
/* set up random bits */
- arc4random_buf(&rss_key, sizeof(rss_key));
+ stoeplitz_to_key(&rss_key, sizeof(rss_key));
/* Set multiplier for RETA setup and table size based on MAC */
index_mult = 0x1;
@@ -3071,6 +3071,8 @@ ixgbe_rxeof(struct rx_ring *rxr)
i = rxr->next_to_check;
while (if_rxr_inuse(&rxr->rx_ring) > 0) {
+ uint32_t hash, hashtype;
+
bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map,
dsize * i, dsize, BUS_DMASYNC_POSTREAD);
@@ -3098,6 +3100,9 @@ ixgbe_rxeof(struct rx_ring *rxr)
IXGBE_RXDADV_PKTTYPE_MASK;
vtag = letoh16(rxdesc->wb.upper.vlan);
eop = ((staterr & IXGBE_RXD_STAT_EOP) != 0);
+ hash = lemtoh32(&rxdesc->wb.lower.hi_dword.rss);
+ hashtype = lemtoh32(&rxdesc->wb.lower.lo_dword.data) &
+ IXGBE_RXDADV_RSSTYPE_MASK;
if (staterr & IXGBE_RXDADV_ERR_FRAME_ERR_MASK) {
sc->dropped_pkts++;
@@ -3172,6 +3177,11 @@ ixgbe_rxeof(struct rx_ring *rxr)
ixgbe_rx_checksum(staterr, sendmp, ptype);
+ if (hashtype != IXGBE_RXDADV_RSSTYPE_NONE) {
+ sendmp->m_pkthdr.ph_flowid = hash;
+ SET(sendmp->m_pkthdr.csum_flags, M_FLOWID);
+ }
+
ml_enqueue(&ml, sendmp);
}
next_desc: