Commit fd786b7b authored by Alexander Duyck's avatar Alexander Duyck Committed by Jeff Kirsher

ixgbe: Add function for setting XPS queue mapping

This change adds support for ixgbe to configure the XPS queue mapping on
load.  The result of this change is that on open we will now be resetting
the number of Tx queues, and then setting the default configuration for XPS
based on if ATR is enabled or disabled.
Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@intel.com>
Reviewed-by: default avatarJohn Fastabend <john.r.fastabend@intel.com>
Tested-by: default avatarPhil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent d3cb9869
...@@ -201,6 +201,7 @@ struct ixgbe_rx_queue_stats { ...@@ -201,6 +201,7 @@ struct ixgbe_rx_queue_stats {
enum ixgbe_ring_state_t { enum ixgbe_ring_state_t {
__IXGBE_TX_FDIR_INIT_DONE, __IXGBE_TX_FDIR_INIT_DONE,
__IXGBE_TX_XPS_INIT_DONE,
__IXGBE_TX_DETECT_HANG, __IXGBE_TX_DETECT_HANG,
__IXGBE_HANG_CHECK_ARMED, __IXGBE_HANG_CHECK_ARMED,
__IXGBE_RX_RSC_ENABLED, __IXGBE_RX_RSC_ENABLED,
......
...@@ -771,19 +771,23 @@ static int ixgbe_alloc_q_vector(struct ixgbe_adapter *adapter, ...@@ -771,19 +771,23 @@ static int ixgbe_alloc_q_vector(struct ixgbe_adapter *adapter,
{ {
struct ixgbe_q_vector *q_vector; struct ixgbe_q_vector *q_vector;
struct ixgbe_ring *ring; struct ixgbe_ring *ring;
int node = -1; int node = NUMA_NO_NODE;
int cpu = -1; int cpu = -1;
int ring_count, size; int ring_count, size;
u8 tcs = netdev_get_num_tc(adapter->netdev);
ring_count = txr_count + rxr_count; ring_count = txr_count + rxr_count;
size = sizeof(struct ixgbe_q_vector) + size = sizeof(struct ixgbe_q_vector) +
(sizeof(struct ixgbe_ring) * ring_count); (sizeof(struct ixgbe_ring) * ring_count);
/* customize cpu for Flow Director mapping */ /* customize cpu for Flow Director mapping */
if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) { if ((tcs <= 1) && !(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) {
if (cpu_online(v_idx)) { u16 rss_i = adapter->ring_feature[RING_F_RSS].indices;
cpu = v_idx; if (rss_i > 1 && adapter->atr_sample_rate) {
node = cpu_to_node(cpu); if (cpu_online(v_idx)) {
cpu = v_idx;
node = cpu_to_node(cpu);
}
} }
} }
......
...@@ -2813,6 +2813,16 @@ void ixgbe_configure_tx_ring(struct ixgbe_adapter *adapter, ...@@ -2813,6 +2813,16 @@ void ixgbe_configure_tx_ring(struct ixgbe_adapter *adapter,
ring->atr_sample_rate = 0; ring->atr_sample_rate = 0;
} }
/* initialize XPS */
if (!test_and_set_bit(__IXGBE_TX_XPS_INIT_DONE, &ring->state)) {
struct ixgbe_q_vector *q_vector = ring->q_vector;
if (q_vector)
netif_set_xps_queue(adapter->netdev,
&q_vector->affinity_mask,
ring->queue_index);
}
clear_bit(__IXGBE_HANG_CHECK_ARMED, &ring->state); clear_bit(__IXGBE_HANG_CHECK_ARMED, &ring->state);
/* enable queue */ /* enable queue */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment