Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F160652626
D57434.id180134.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
6 KB
Referenced Files
None
Subscribers
None
D57434.id180134.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
@@ -169,6 +169,8 @@
uint32_t mbox_addr;
struct aq_hw_fw_mbox mbox;
+
+ uint32_t tx_rings_count;
};
#define aq_hw_s aq_hw
@@ -185,6 +187,8 @@
#define HW_ATL_B0_MTU_JUMBO 16352U
#define HW_ATL_B0_TSO_SIZE (160*1024)
#define HW_ATL_B0_RINGS_MAX 32U
+#define HW_ATL_B0_TCS_MAX 4U /* 4-TC mode */
+#define HW_ATL_B0_RINGS_PER_TC (HW_ATL_B0_RINGS_MAX / HW_ATL_B0_TCS_MAX)
#define HW_ATL_B0_LRO_RXD_MAX 16U
#define AQ_HW_FW_SM_RAM 0x2U
@@ -208,6 +212,9 @@
#define AQ_HW_TXBUF_MAX 160U
#define AQ_HW_RXBUF_MAX 320U
+/* pct% of a kb-KB packet buffer, in 32-byte threshold units */
+#define AQ_BUF_THRESHOLD(kb, pct) ((kb) * (1024U / 32U) * (pct) / 100U)
+
#define L2_FILTER_ACTION_DISCARD (0x0)
#define L2_FILTER_ACTION_HOST (0x1)
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
@@ -394,6 +394,7 @@
{
uint32_t tc = 0U;
uint32_t buff_size = 0U;
+ uint32_t n_tcs;
unsigned int i_priority = 0U;
int err = 0;
@@ -409,19 +410,23 @@
tps_tx_pkt_shed_desc_tc_arb_mode_set(hw, 0U);
tps_tx_pkt_shed_data_arb_mode_set(hw, 0U);
- tps_tx_pkt_shed_tc_data_max_credit_set(hw, 0xFFF, 0U);
- tps_tx_pkt_shed_tc_data_weight_set(hw, 0x64, 0U);
- tps_tx_pkt_shed_desc_tc_max_credit_set(hw, 0x50, 0U);
- tps_tx_pkt_shed_desc_tc_weight_set(hw, 0x1E, 0U);
-
- /* Tx buf size */
- buff_size = AQ_HW_TXBUF_MAX;
-
- tpb_tx_pkt_buff_size_per_tc_set(hw, buff_size, tc);
- tpb_tx_buff_hi_threshold_per_tc_set(hw,
- (buff_size * (1024 / 32U) * 66U) / 100U, tc);
- tpb_tx_buff_lo_threshold_per_tc_set(hw,
- (buff_size * (1024 / 32U) * 50U) / 100U, tc);
+ /* 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);
+ buff_size = AQ_HW_TXBUF_MAX / n_tcs;
+
+ for (tc = 0; tc < n_tcs; tc++) {
+ tps_tx_pkt_shed_tc_data_max_credit_set(hw, 0xFFF, tc);
+ tps_tx_pkt_shed_tc_data_weight_set(hw, 0x64, tc);
+ tps_tx_pkt_shed_desc_tc_max_credit_set(hw, 0x50, tc);
+ tps_tx_pkt_shed_desc_tc_weight_set(hw, 0x1E, tc);
+
+ tpb_tx_pkt_buff_size_per_tc_set(hw, buff_size, tc);
+ tpb_tx_buff_hi_threshold_per_tc_set(hw,
+ AQ_BUF_THRESHOLD(buff_size, 66U), tc);
+ tpb_tx_buff_lo_threshold_per_tc_set(hw,
+ AQ_BUF_THRESHOLD(buff_size, 50U), tc);
+ }
/* QoS Rx buf size per TC */
tc = 0;
@@ -429,13 +434,13 @@
rpb_rx_pkt_buff_size_per_tc_set(hw, buff_size, tc);
rpb_rx_buff_hi_threshold_per_tc_set(hw,
- (buff_size * (1024U / 32U) * 66U) / 100U, tc);
+ AQ_BUF_THRESHOLD(buff_size, 66U), tc);
rpb_rx_buff_lo_threshold_per_tc_set(hw,
- (buff_size * (1024U / 32U) * 50U) / 100U, tc);
+ AQ_BUF_THRESHOLD(buff_size, 50U), tc);
/* QoS 802.1p priority -> TC mapping */
for (i_priority = 8U; i_priority--;)
- rpf_rpb_user_priority_tc_map_set(hw, i_priority, 0U);
+ rpf_rpb_user_priority_tc_map_set(hw, i_priority, 0U);
err = aq_hw_err_from_flags(hw);
AQ_DBG_EXIT(err);
diff --git a/sys/dev/aq/aq_irq.c b/sys/dev/aq/aq_irq.c
--- a/sys/dev/aq/aq_irq.c
+++ b/sys/dev/aq/aq_irq.c
@@ -179,7 +179,7 @@
struct aq_hw *hw = &aq_dev->hw;
/* clear interrupt status */
- itr_irq_status_clearlsw_set(hw, aq_dev->msix);
+ itr_irq_status_clearlsw_set(hw, BIT(aq_dev->msix));
iflib_admin_intr_deferred(aq_dev->ctx);
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
@@ -182,6 +182,7 @@
static void aq_if_enable_intr(if_ctx_t ctx);
static void aq_if_disable_intr(if_ctx_t ctx);
static int aq_if_rx_queue_intr_enable(if_ctx_t ctx, uint16_t rxqid);
+static int aq_if_tx_queue_intr_enable(if_ctx_t ctx, uint16_t txqid);
static int aq_if_msix_intr_assign(if_ctx_t ctx, int msix);
/* VLAN support */
@@ -253,7 +254,7 @@
DEVMETHOD(ifdi_intr_enable, aq_if_enable_intr),
DEVMETHOD(ifdi_intr_disable, aq_if_disable_intr),
DEVMETHOD(ifdi_rx_queue_intr_enable, aq_if_rx_queue_intr_enable),
- DEVMETHOD(ifdi_tx_queue_intr_enable, aq_if_rx_queue_intr_enable),
+ DEVMETHOD(ifdi_tx_queue_intr_enable, aq_if_tx_queue_intr_enable),
DEVMETHOD(ifdi_msix_intr_assign, aq_if_msix_intr_assign),
/* VLAN support */
@@ -411,7 +412,7 @@
scctx->isc_rxqsizes[0] = sizeof(aq_rx_desc_t) * scctx->isc_nrxd[0];
scctx->isc_ntxqsets_max = HW_ATL_B0_RINGS_MAX;
- scctx->isc_nrxqsets_max = HW_ATL_B0_RINGS_MAX;
+ scctx->isc_nrxqsets_max = HW_ATL_RSS_INDIRECTION_QUEUES_MAX;
/* iflib will map and release this bar */
scctx->isc_msix_bar = pci_msix_table_bar(softc->dev);
@@ -667,6 +668,8 @@
softc = iflib_get_softc(ctx);
hw = &softc->hw;
+ hw->tx_rings_count = softc->tx_rings_count;
+
err = aq_hw_init(&softc->hw, softc->hw.mac_addr, softc->msix,
softc->scctx->isc_intr == IFLIB_INTR_MSIX);
if (err != EOK) {
@@ -965,6 +968,20 @@
return (0);
}
+static int
+aq_if_tx_queue_intr_enable(if_ctx_t ctx, uint16_t txqid)
+{
+ struct aq_dev *softc = iflib_get_softc(ctx);
+ struct aq_hw *hw = &softc->hw;
+
+ AQ_DBG_ENTER();
+
+ itr_irq_msk_setlsw_set(hw, BIT(softc->tx_rings[txqid]->msix));
+
+ AQ_DBG_EXIT(0);
+ return (0);
+}
+
static int
aq_if_msix_intr_assign(if_ctx_t ctx, int msix)
{
@@ -979,7 +996,7 @@
for (i = 0; i < softc->rx_rings_count; i++, vector++) {
snprintf(irq_name, sizeof(irq_name), "rxq%d", i);
rc = iflib_irq_alloc_generic(ctx, &softc->rx_rings[i]->irq,
- vector + 1, IFLIB_INTR_RX, aq_isr_rx, softc->rx_rings[i],
+ vector + 1, IFLIB_INTR_RXTX, aq_isr_rx, softc->rx_rings[i],
softc->rx_rings[i]->index, irq_name);
device_printf(softc->dev, "Assign IRQ %u to rx ring %u\n",
vector, softc->rx_rings[i]->index);
@@ -995,12 +1012,13 @@
rx_vectors = vector;
- for (i = 0; i < softc->tx_rings_count; i++, vector++) {
+ for (i = 0; i < softc->tx_rings_count; i++) {
snprintf(irq_name, sizeof(irq_name), "txq%d", i);
- iflib_softirq_alloc_generic(ctx, &softc->rx_rings[i]->irq,
- IFLIB_INTR_TX, softc->tx_rings[i], i, irq_name);
-
- softc->tx_rings[i]->msix = (vector % softc->rx_rings_count);
+ softc->tx_rings[i]->msix = (i % softc->rx_rings_count);
+ iflib_softirq_alloc_generic(ctx,
+ &softc->rx_rings[softc->tx_rings[i]->msix]->irq,
+ IFLIB_INTR_TX, softc->tx_rings[i],
+ softc->tx_rings[i]->index, irq_name);
device_printf(softc->dev, "Assign IRQ %u to tx ring %u\n",
softc->tx_rings[i]->msix, softc->tx_rings[i]->index);
}
@@ -1013,7 +1031,7 @@
if (rc) {
device_printf(iflib_get_dev(ctx),
"Failed to register admin handler");
- i = softc->rx_rings_count;
+ i = softc->rx_rings_count - 1;
goto fail;
}
AQ_DBG_EXIT(0);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jun 27, 12:25 PM (17 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34400668
Default Alt Text
D57434.id180134.diff (6 KB)
Attached To
Mode
D57434: aq(4): interrupt model and queue-count correctness
Attached
Detach File
Event Timeline
Log In to Comment