Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177744845
D60974.1795184972.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
6 KB
Referenced Files
None
Subscribers
None
D60974.1795184972.diff
View Options
diff --git a/sys/dev/ixl/ixl.h b/sys/dev/ixl/ixl.h
--- a/sys/dev/ixl/ixl.h
+++ b/sys/dev/ixl/ixl.h
@@ -421,6 +421,9 @@
u16 vsi_num;
bool link_active;
+ /* UDP is hashed on the addresses only: report it as an IP hash. */
+ bool rss_udp4_addrs;
+ bool rss_udp6_addrs;
u16 seid;
u16 uplink_seid;
u16 downlink_seid;
diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c
--- a/sys/dev/ixl/ixl_pf_main.c
+++ b/sys/dev/ixl/ixl_pf_main.c
@@ -1121,6 +1121,35 @@
}
}
+/*
+ * Make a packet classifier type hash on the L4 ports (and, for SCTP, the
+ * verification tag) or only on the addresses. The hash input sets are
+ * global to the device and are left alone when it is partitioned (NPAR or
+ * Flex-10), as the other partitions share them; the return value says
+ * whether the input set was written.
+ */
+static bool
+ixl_set_rss_pctype_ports(struct i40e_hw *hw, enum i40e_filter_pctype pctype,
+ bool ports)
+{
+ u64 inset;
+
+ if (hw->func_caps.npar_enable != 0 || hw->func_caps.flex10_enable)
+ return (false);
+
+ inset = (u64)i40e_read_rx_ctl(hw, I40E_GLQF_HASH_INSET(0, pctype)) |
+ ((u64)i40e_read_rx_ctl(hw, I40E_GLQF_HASH_INSET(1, pctype)) << 32);
+ if (ports)
+ inset |= I40E_L4_SRC_MASK | I40E_L4_DST_MASK;
+ else
+ inset &= ~(I40E_L4_SRC_MASK | I40E_L4_DST_MASK |
+ I40E_VERIFY_TAG_MASK);
+ i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(0, pctype), (u32)inset);
+ i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(1, pctype),
+ (u32)(inset >> 32));
+ return (true);
+}
+
/*
* Configure enabled PCTYPES for RSS.
*/
@@ -1128,31 +1157,92 @@
ixl_set_rss_pctypes(struct ixl_pf *pf)
{
struct i40e_hw *hw = &pf->hw;
- u64 set_hena = 0, hena;
-
+ struct ixl_vsi *vsi = &pf->vsi;
+ u64 set_hena = 0, hena, udp4 = 0, udp6 = 0, addrs = 0;
u32 rss_hash_config;
+ bool x722 = hw->mac.type == I40E_MAC_X722, ports;
+ int i;
rss_hash_config = rss_gethashconfig();
- if (rss_hash_config & RSS_HASHTYPE_RSS_IPV4)
- set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV4_OTHER);
- if (rss_hash_config & RSS_HASHTYPE_RSS_TCP_IPV4)
- set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV4_TCP);
- if (rss_hash_config & RSS_HASHTYPE_RSS_UDP_IPV4)
- set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV4_UDP);
- if (rss_hash_config & RSS_HASHTYPE_RSS_IPV6)
- set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER);
- if (rss_hash_config & RSS_HASHTYPE_RSS_IPV6_EX)
- set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_FRAG_IPV6);
- if (rss_hash_config & RSS_HASHTYPE_RSS_TCP_IPV6)
- set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV6_TCP);
- if (rss_hash_config & RSS_HASHTYPE_RSS_UDP_IPV6)
- set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV6_UDP);
+ vsi->rss_udp4_addrs = vsi->rss_udp6_addrs = false;
+
+ /*
+ * The IPv4 and IPv6 types cover neither TCP, UDP nor SCTP, nor
+ * fragments; each has packet classifier types of its own, and the
+ * X722 has more of them. The kernel has no hash type for SCTP and
+ * hashes UDP on the addresses unless asked for the ports, so those
+ * get the address-only hash of the IP types (the ports come out of
+ * their input sets below).
+ */
+ if (rss_hash_config & RSS_HASHTYPE_RSS_IPV4) {
+ set_hena |= BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_OTHER) |
+ BIT_ULL(I40E_FILTER_PCTYPE_FRAG_IPV4);
+ addrs |= BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_SCTP);
+ }
+ if (rss_hash_config & RSS_HASHTYPE_RSS_TCP_IPV4) {
+ set_hena |= BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_TCP);
+ if (x722)
+ set_hena |=
+ BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK);
+ }
+ if (rss_hash_config &
+ (RSS_HASHTYPE_RSS_IPV6 | RSS_HASHTYPE_RSS_IPV6_EX)) {
+ set_hena |= BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_OTHER) |
+ BIT_ULL(I40E_FILTER_PCTYPE_FRAG_IPV6);
+ addrs |= BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_SCTP);
+ }
+ if (rss_hash_config &
+ (RSS_HASHTYPE_RSS_TCP_IPV6 | RSS_HASHTYPE_RSS_TCP_IPV6_EX)) {
+ set_hena |= BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_TCP);
+ if (x722)
+ set_hena |=
+ BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK);
+ }
+ if (rss_hash_config &
+ (RSS_HASHTYPE_RSS_UDP_IPV4 | RSS_HASHTYPE_RSS_IPV4)) {
+ udp4 = BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_UDP);
+ if (x722)
+ udp4 |=
+ BIT_ULL(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP) |
+ BIT_ULL(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP);
+ }
+ if (rss_hash_config & (RSS_HASHTYPE_RSS_UDP_IPV6 |
+ RSS_HASHTYPE_RSS_UDP_IPV6_EX | RSS_HASHTYPE_RSS_IPV6 |
+ RSS_HASHTYPE_RSS_IPV6_EX)) {
+ udp6 = BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_UDP);
+ if (x722)
+ udp6 |=
+ BIT_ULL(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP) |
+ BIT_ULL(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP);
+ }
+
+ /*
+ * Where the ports leave a UDP input set, the receive path reports
+ * the hash as an IP hash, so the stack uses it rather than hashing
+ * again in software. In partitioned mode the input sets stay as
+ * they are, and so does the label.
+ */
+ ports = (rss_hash_config & RSS_HASHTYPE_RSS_UDP_IPV4) != 0;
+ for (i = 0; i < 64; i++)
+ if ((udp4 & BIT_ULL(i)) != 0 &&
+ ixl_set_rss_pctype_ports(hw, i, ports) && !ports)
+ vsi->rss_udp4_addrs = true;
+ ports = (rss_hash_config &
+ (RSS_HASHTYPE_RSS_UDP_IPV6 | RSS_HASHTYPE_RSS_UDP_IPV6_EX)) != 0;
+ for (i = 0; i < 64; i++)
+ if ((udp6 & BIT_ULL(i)) != 0 &&
+ ixl_set_rss_pctype_ports(hw, i, ports) && !ports)
+ vsi->rss_udp6_addrs = true;
+ for (i = 0; i < 64; i++)
+ if ((addrs & BIT_ULL(i)) != 0)
+ (void)ixl_set_rss_pctype_ports(hw, i, false);
+ set_hena |= udp4 | udp6 | addrs;
+
hena = (u64)i40e_read_rx_ctl(hw, I40E_PFQF_HENA(0)) |
((u64)i40e_read_rx_ctl(hw, I40E_PFQF_HENA(1)) << 32);
hena |= set_hena;
i40e_write_rx_ctl(hw, I40E_PFQF_HENA(0), (u32)hena);
i40e_write_rx_ctl(hw, I40E_PFQF_HENA(1), (u32)(hena >> 32));
-
}
/*
diff --git a/sys/dev/ixl/ixl_txrx.c b/sys/dev/ixl/ixl_txrx.c
--- a/sys/dev/ixl/ixl_txrx.c
+++ b/sys/dev/ixl/ixl_txrx.c
@@ -709,6 +709,13 @@
I40E_RX_DESC_FLTSTAT_RSS_HASH) {
ri->iri_flowid = le32toh(cur->wb.qword0.hi_dword.rss);
ri->iri_rsstype = ixl_ptype_to_hash(ptype);
+ /* Hashed on the addresses only: say so. */
+ if (ri->iri_rsstype == M_HASHTYPE_RSS_UDP_IPV4 &&
+ vsi->rss_udp4_addrs)
+ ri->iri_rsstype = M_HASHTYPE_RSS_IPV4;
+ else if (ri->iri_rsstype == M_HASHTYPE_RSS_UDP_IPV6 &&
+ vsi->rss_udp6_addrs)
+ ri->iri_rsstype = M_HASHTYPE_RSS_IPV6;
}
if (status & (1 << I40E_RX_DESC_STATUS_L2TAG1P_SHIFT)) {
ri->iri_vtag = le16toh(cur->wb.qword0.lo_dword.l2tag1);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 20, 2:29 PM (12 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41869402
Default Alt Text
D60974.1795184972.diff (6 KB)
Attached To
Mode
D60974: ixl: Hash UDP, SCTP and fragments across the receive queues
Attached
Detach File
Event Timeline