Page MenuHomeFreeBSD

D58137.diff
No OneTemporary

D58137.diff

diff --git a/sys/dev/aq/aq_hw.h b/sys/dev/aq/aq_hw.h
--- a/sys/dev/aq/aq_hw.h
+++ b/sys/dev/aq/aq_hw.h
@@ -370,5 +370,6 @@
int aq_hw_rss_hash_get(struct aq_hw *hw, uint8_t rss_key[HW_ATL_RSS_HASHKEY_SIZE]);
int aq_hw_rss_set(struct aq_hw *hw, uint8_t rss_table[HW_ATL_RSS_INDIRECTION_TABLE_MAX]);
int aq_hw_udp_rss_enable(struct aq_hw *hw, bool enable);
+u_int aq_rss_hashconfig(void);
#endif // _AQ_HW_H_
diff --git a/sys/dev/aq/aq_hw.c b/sys/dev/aq/aq_hw.c
--- a/sys/dev/aq/aq_hw.c
+++ b/sys/dev/aq/aq_hw.c
@@ -46,6 +46,7 @@
#define AQ_HW_FW_SM_RAM 0x2U
#define AQ_CFG_FW_MIN_VER_EXPECTED 0x01050006U
+static uint32_t aq_hw_active_tcs(struct aq_hw *hw);
int
aq_hw_err_from_flags(struct aq_hw *hw)
@@ -406,8 +407,7 @@
tps_tx_pkt_shed_data_arb_mode_set(hw, 0U);
/* One TC per active 8-ring group; share the buffer across them. */
- n_tcs = howmany(hw->tx_rings_count, HW_ATL_B0_RINGS_PER_TC);
- n_tcs = MIN(MAX(n_tcs, 1U), HW_ATL_B0_TCS_MAX);
+ n_tcs = aq_hw_active_tcs(hw);
buff_size = AQ_HW_TXBUF_MAX / n_tcs;
for (tc = 0; tc < n_tcs; tc++) {
@@ -442,6 +442,16 @@
return (err);
}
+/* Tx traffic classes currently provisioned (one per active 8-ring group). */
+static uint32_t
+aq_hw_active_tcs(struct aq_hw *hw)
+{
+ uint32_t n = howmany(MAX(hw->tx_rings_count, 1U),
+ HW_ATL_B0_RINGS_PER_TC);
+
+ return (MIN(n, HW_ATL_B0_TCS_MAX));
+}
+
static int
aq_hw_offload_set(struct aq_hw *hw)
{
diff --git a/sys/dev/aq/aq_main.c b/sys/dev/aq/aq_main.c
--- a/sys/dev/aq/aq_main.c
+++ b/sys/dev/aq/aq_main.c
@@ -286,15 +286,18 @@
.isc_ntxd_default = {PAGE_SIZE / sizeof(volatile union aq_txc_desc) * 4},
};
-/*
- * TUNEABLE PARAMETERS:
- */
-
-static SYSCTL_NODE(_hw, OID_AUTO, aq, CTLFLAG_RD, 0, "Atlantic driver parameters");
-/* UDP Receive-Side Scaling */
-static int aq_enable_rss_udp = 1;
-SYSCTL_INT(_hw_aq, OID_AUTO, enable_rss_udp, CTLFLAG_RDTUN, &aq_enable_rss_udp,
- 0, "Enable Receive-Side Scaling (RSS) for UDP");
+/* RSS hash types; honor the kernel policy (UDP 4-tuple off by default). */
+u_int
+aq_rss_hashconfig(void)
+{
+#ifdef RSS
+ return (rss_gethashconfig());
+#else
+ return (RSS_HASHTYPE_RSS_IPV4 | RSS_HASHTYPE_RSS_TCP_IPV4 |
+ RSS_HASHTYPE_RSS_IPV6 | RSS_HASHTYPE_RSS_TCP_IPV6 |
+ RSS_HASHTYPE_RSS_IPV6_EX | RSS_HASHTYPE_RSS_TCP_IPV6_EX);
+#endif
+}
/*
@@ -450,11 +453,16 @@
aq_add_stats_sysctls(softc);
/* RSS */
- arc4rand(softc->rss_key, HW_ATL_RSS_HASHKEY_SIZE, 0);
uint32_t rss_qs = MIN(softc->rx_rings_count, HW_ATL_RSS_INDIRECTION_QUEUES_MAX);
- for (int i = nitems(softc->rss_table); i--;){
+#ifdef RSS
+ rss_getkey(softc->rss_key);
+ for (int i = nitems(softc->rss_table); i--;)
+ softc->rss_table[i] = rss_get_indirection_to_bucket(i) % rss_qs;
+#else
+ arc4rand(softc->rss_key, HW_ATL_RSS_HASHKEY_SIZE, 0);
+ for (int i = nitems(softc->rss_table); i--;)
softc->rss_table[i] = i % rss_qs;
- }
+#endif
exit:
AQ_DBG_EXIT(rc);
return (rc);
@@ -738,7 +746,9 @@
aq_if_enable_intr(ctx);
aq_hw_rss_hash_set(&softc->hw, softc->rss_key);
aq_hw_rss_set(&softc->hw, softc->rss_table);
- aq_hw_udp_rss_enable(hw, aq_enable_rss_udp);
+ aq_hw_udp_rss_enable(hw, (aq_rss_hashconfig() &
+ (RSS_HASHTYPE_RSS_UDP_IPV4 | RSS_HASHTYPE_RSS_UDP_IPV6 |
+ RSS_HASHTYPE_RSS_UDP_IPV6_EX)) != 0);
aq_hw_set_link_speed(hw, hw->link_rate);
AQ_DBG_EXIT(0);

File Metadata

Mime Type
text/plain
Expires
Mon, Jul 13, 11:30 PM (13 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35048764
Default Alt Text
D58137.diff (3 KB)

Event Timeline