Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F162637914
D57240.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D57240.diff
View Options
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
@@ -197,6 +197,8 @@
#define HW_ATL_RSS_INDIRECTION_TABLE_MAX 64U
#define HW_ATL_RSS_HASHKEY_SIZE 40U
+#define HW_ATL_RSS_INDIRECTION_QUEUES_MAX 8U
+#define HW_ATL_RSS_INDIRECTION_ENTRY_BITS 3U
/* PCI core control register */
#define AQ_HW_PCI_REG_CONTROL_6_ADR 0x1014U
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
@@ -878,8 +878,16 @@
memset(bitary, 0, sizeof(bitary));
for (i = HW_ATL_RSS_INDIRECTION_TABLE_MAX; i--;) {
- (*(uint32_t *)(bitary + ((i * 3U) / 16U))) |=
- ((rss_table[i]) << ((i * 3U) & 0xFU));
+ uint32_t bit_pos = i * HW_ATL_RSS_INDIRECTION_ENTRY_BITS;
+ uint32_t word = bit_pos / 16U;
+ uint32_t shift = bit_pos % 16U;
+ uint32_t field = (uint32_t)(rss_table[i] &
+ (HW_ATL_RSS_INDIRECTION_QUEUES_MAX - 1U)) << shift;
+
+ bitary[word] |= (uint16_t)field;
+ if (shift + HW_ATL_RSS_INDIRECTION_ENTRY_BITS > 16U &&
+ word + 1U < ARRAY_SIZE(bitary))
+ bitary[word + 1U] |= (uint16_t)(field >> 16);
}
for (i = ARRAY_SIZE(bitary); i--;) {
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
@@ -466,8 +466,9 @@
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 = ARRAY_SIZE(softc->rss_table); i--;){
- softc->rss_table[i] = i & (softc->rx_rings_count - 1);
+ softc->rss_table[i] = i % rss_qs;
}
exit:
AQ_DBG_EXIT(rc);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 16, 7:23 AM (18 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35117497
Default Alt Text
D57240.diff (1 KB)
Attached To
Mode
D57240: aq(4): Fix RSS indirection table OOB write and queue distribution
Attached
Detach File
Event Timeline
Log In to Comment