diff options
| author | Nick Price <nick@spun.io> | 2026-07-19 16:41:37 +0000 |
|---|---|---|
| committer | Adrian Chadd <adrian@FreeBSD.org> | 2026-07-19 16:41:37 +0000 |
| commit | 9b4585afd31384573fcebd156d0e4af32bcddf9e (patch) | |
| tree | 3240e3d38244ce5ada74432d5a6376d9fb5ed603 | |
| parent | 73cd4048807dc0b3a5329bfc9a80ea4bf2d975fd (diff) | |
| -rw-r--r-- | sys/dev/aq/aq_hw.c | 14 | ||||
| -rw-r--r-- | sys/dev/aq/aq_hw.h | 1 | ||||
| -rw-r--r-- | sys/dev/aq/aq_main.c | 36 |
3 files changed, 36 insertions, 15 deletions
diff --git a/sys/dev/aq/aq_hw.c b/sys/dev/aq/aq_hw.c index 1ad9d2e15ed7..e610f8b27ba7 100644 --- 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 @@ aq_hw_qos_set(struct aq_hw *hw) 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 @@ aq_hw_qos_set(struct aq_hw *hw) 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_hw.h b/sys/dev/aq/aq_hw.h index 339c7cb7bea0..0619910d012c 100644 --- a/sys/dev/aq/aq_hw.h +++ b/sys/dev/aq/aq_hw.h @@ -370,5 +370,6 @@ int aq_hw_rss_hash_set(struct aq_hw *hw, uint8_t rss_key[HW_ATL_RSS_HASHKEY_SIZE 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_main.c b/sys/dev/aq/aq_main.c index 5d2d9061c548..4c06447b55d3 100644 --- a/sys/dev/aq/aq_main.c +++ b/sys/dev/aq/aq_main.c @@ -286,15 +286,18 @@ static struct if_shared_ctx aq_sctx_init = { .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_if_attach_post(if_ctx_t ctx) 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_init(if_ctx_t ctx) 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); /* iflib does not replay filter state after init; aq_hw_init() clears it. */ |
