Commit 4fad78ad authored by Cambda Zhu's avatar Cambda Zhu Committed by Jeff Kirsher

ixgbe: Fix calculation of queue with VFs and flow director on interface flap

This patch fixes the calculation of queue when we restore flow director
filters after resetting adapter. In ixgbe_fdir_filter_restore(), filter's
vf may be zero which makes the queue outside of the rx_ring array.

The calculation is changed to the same as ixgbe_add_ethtool_fdir_entry().
Signed-off-by: default avatarCambda Zhu <cambda@linux.alibaba.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent aa604651
...@@ -5239,7 +5239,7 @@ static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter) ...@@ -5239,7 +5239,7 @@ static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter)
struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_hw *hw = &adapter->hw;
struct hlist_node *node2; struct hlist_node *node2;
struct ixgbe_fdir_filter *filter; struct ixgbe_fdir_filter *filter;
u64 action; u8 queue;
spin_lock(&adapter->fdir_perfect_lock); spin_lock(&adapter->fdir_perfect_lock);
...@@ -5248,17 +5248,34 @@ static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter) ...@@ -5248,17 +5248,34 @@ static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter)
hlist_for_each_entry_safe(filter, node2, hlist_for_each_entry_safe(filter, node2,
&adapter->fdir_filter_list, fdir_node) { &adapter->fdir_filter_list, fdir_node) {
action = filter->action; if (filter->action == IXGBE_FDIR_DROP_QUEUE) {
if (action != IXGBE_FDIR_DROP_QUEUE && action != 0) queue = IXGBE_FDIR_DROP_QUEUE;
action = } else {
(action >> ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF) - 1; u32 ring = ethtool_get_flow_spec_ring(filter->action);
u8 vf = ethtool_get_flow_spec_ring_vf(filter->action);
if (!vf && (ring >= adapter->num_rx_queues)) {
e_err(drv, "FDIR restore failed without VF, ring: %u\n",
ring);
continue;
} else if (vf &&
((vf > adapter->num_vfs) ||
ring >= adapter->num_rx_queues_per_pool)) {
e_err(drv, "FDIR restore failed with VF, vf: %hhu, ring: %u\n",
vf, ring);
continue;
}
/* Map the ring onto the absolute queue index */
if (!vf)
queue = adapter->rx_ring[ring]->reg_idx;
else
queue = ((vf - 1) *
adapter->num_rx_queues_per_pool) + ring;
}
ixgbe_fdir_write_perfect_filter_82599(hw, ixgbe_fdir_write_perfect_filter_82599(hw,
&filter->filter, &filter->filter, filter->sw_idx, queue);
filter->sw_idx,
(action == IXGBE_FDIR_DROP_QUEUE) ?
IXGBE_FDIR_DROP_QUEUE :
adapter->rx_ring[action]->reg_idx);
} }
spin_unlock(&adapter->fdir_perfect_lock); spin_unlock(&adapter->fdir_perfect_lock);
......
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