aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2018-07-09 12:19:43 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2018-07-09 15:27:52 -0400
commit58b0b3ed4c226f62fcdf82df366d644b7a2226ca (patch)
treec1ea98e0c2402d2e77c7ee3385539310d85f57c6 /drivers/net
parentffcfe25bb50f27395e15fa999f1a7eb769f55360 (diff)
ixgbe: Add code to populate and use macvlan TC to Tx queue map
This patch makes it so that we use the tc_to_txq mapping in the macvlan device in order to select the Tx queue for outgoing packets. The idea here is to try and move away from using ixgbe_select_queue and to come up with a generic way to make this work for devices going forward. By encoding this information in the netdev this can become something that can be used generically as a solution for similar setups going forward. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c44
1 files changed, 38 insertions, 6 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index a8e21becb619..80225af2acb1 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -5275,6 +5275,8 @@ static void ixgbe_clean_rx_ring(struct ixgbe_ring *rx_ring)
5275static int ixgbe_fwd_ring_up(struct ixgbe_adapter *adapter, 5275static int ixgbe_fwd_ring_up(struct ixgbe_adapter *adapter,
5276 struct ixgbe_fwd_adapter *accel) 5276 struct ixgbe_fwd_adapter *accel)
5277{ 5277{
5278 u16 rss_i = adapter->ring_feature[RING_F_RSS].indices;
5279 int num_tc = netdev_get_num_tc(adapter->netdev);
5278 struct net_device *vdev = accel->netdev; 5280 struct net_device *vdev = accel->netdev;
5279 int i, baseq, err; 5281 int i, baseq, err;
5280 5282
@@ -5286,6 +5288,11 @@ static int ixgbe_fwd_ring_up(struct ixgbe_adapter *adapter,
5286 accel->rx_base_queue = baseq; 5288 accel->rx_base_queue = baseq;
5287 accel->tx_base_queue = baseq; 5289 accel->tx_base_queue = baseq;
5288 5290
5291 /* record configuration for macvlan interface in vdev */
5292 for (i = 0; i < num_tc; i++)
5293 netdev_bind_sb_channel_queue(adapter->netdev, vdev,
5294 i, rss_i, baseq + (rss_i * i));
5295
5289 for (i = 0; i < adapter->num_rx_queues_per_pool; i++) 5296 for (i = 0; i < adapter->num_rx_queues_per_pool; i++)
5290 adapter->rx_ring[baseq + i]->netdev = vdev; 5297 adapter->rx_ring[baseq + i]->netdev = vdev;
5291 5298
@@ -5310,6 +5317,10 @@ static int ixgbe_fwd_ring_up(struct ixgbe_adapter *adapter,
5310 5317
5311 netdev_err(vdev, "L2FW offload disabled due to L2 filter error\n"); 5318 netdev_err(vdev, "L2FW offload disabled due to L2 filter error\n");
5312 5319
5320 /* unbind the queues and drop the subordinate channel config */
5321 netdev_unbind_sb_channel(adapter->netdev, vdev);
5322 netdev_set_sb_channel(vdev, 0);
5323
5313 clear_bit(accel->pool, adapter->fwd_bitmask); 5324 clear_bit(accel->pool, adapter->fwd_bitmask);
5314 kfree(accel); 5325 kfree(accel);
5315 5326
@@ -8201,18 +8212,22 @@ static u16 ixgbe_select_queue(struct net_device *dev, struct sk_buff *skb,
8201 void *accel_priv, select_queue_fallback_t fallback) 8212 void *accel_priv, select_queue_fallback_t fallback)
8202{ 8213{
8203 struct ixgbe_fwd_adapter *fwd_adapter = accel_priv; 8214 struct ixgbe_fwd_adapter *fwd_adapter = accel_priv;
8204 struct ixgbe_adapter *adapter;
8205 int txq;
8206#ifdef IXGBE_FCOE 8215#ifdef IXGBE_FCOE
8216 struct ixgbe_adapter *adapter;
8207 struct ixgbe_ring_feature *f; 8217 struct ixgbe_ring_feature *f;
8208#endif 8218#endif
8219 int txq;
8209 8220
8210 if (fwd_adapter) { 8221 if (fwd_adapter) {
8211 adapter = netdev_priv(dev); 8222 u8 tc = netdev_get_num_tc(dev) ?
8212 txq = reciprocal_scale(skb_get_hash(skb), 8223 netdev_get_prio_tc_map(dev, skb->priority) : 0;
8213 adapter->num_rx_queues_per_pool); 8224 struct net_device *vdev = fwd_adapter->netdev;
8225
8226 txq = vdev->tc_to_txq[tc].offset;
8227 txq += reciprocal_scale(skb_get_hash(skb),
8228 vdev->tc_to_txq[tc].count);
8214 8229
8215 return txq + fwd_adapter->tx_base_queue; 8230 return txq;
8216 } 8231 }
8217 8232
8218#ifdef IXGBE_FCOE 8233#ifdef IXGBE_FCOE
@@ -8766,6 +8781,11 @@ static int ixgbe_reassign_macvlan_pool(struct net_device *vdev, void *data)
8766 /* if we cannot find a free pool then disable the offload */ 8781 /* if we cannot find a free pool then disable the offload */
8767 netdev_err(vdev, "L2FW offload disabled due to lack of queue resources\n"); 8782 netdev_err(vdev, "L2FW offload disabled due to lack of queue resources\n");
8768 macvlan_release_l2fw_offload(vdev); 8783 macvlan_release_l2fw_offload(vdev);
8784
8785 /* unbind the queues and drop the subordinate channel config */
8786 netdev_unbind_sb_channel(adapter->netdev, vdev);
8787 netdev_set_sb_channel(vdev, 0);
8788
8769 kfree(accel); 8789 kfree(accel);
8770 8790
8771 return 0; 8791 return 0;
@@ -9769,6 +9789,13 @@ static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev)
9769 if (!macvlan_supports_dest_filter(vdev)) 9789 if (!macvlan_supports_dest_filter(vdev))
9770 return ERR_PTR(-EMEDIUMTYPE); 9790 return ERR_PTR(-EMEDIUMTYPE);
9771 9791
9792 /* We need to lock down the macvlan to be a single queue device so that
9793 * we can reuse the tc_to_txq field in the macvlan netdev to represent
9794 * the queue mapping to our netdev.
9795 */
9796 if (netif_is_multiqueue(vdev))
9797 return ERR_PTR(-ERANGE);
9798
9772 pool = find_first_zero_bit(adapter->fwd_bitmask, adapter->num_rx_pools); 9799 pool = find_first_zero_bit(adapter->fwd_bitmask, adapter->num_rx_pools);
9773 if (pool == adapter->num_rx_pools) { 9800 if (pool == adapter->num_rx_pools) {
9774 u16 used_pools = adapter->num_vfs + adapter->num_rx_pools; 9801 u16 used_pools = adapter->num_vfs + adapter->num_rx_pools;
@@ -9825,6 +9852,7 @@ static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev)
9825 return ERR_PTR(-ENOMEM); 9852 return ERR_PTR(-ENOMEM);
9826 9853
9827 set_bit(pool, adapter->fwd_bitmask); 9854 set_bit(pool, adapter->fwd_bitmask);
9855 netdev_set_sb_channel(vdev, pool);
9828 accel->pool = pool; 9856 accel->pool = pool;
9829 accel->netdev = vdev; 9857 accel->netdev = vdev;
9830 9858
@@ -9866,6 +9894,10 @@ static void ixgbe_fwd_del(struct net_device *pdev, void *priv)
9866 ring->netdev = NULL; 9894 ring->netdev = NULL;
9867 } 9895 }
9868 9896
9897 /* unbind the queues and drop the subordinate channel config */
9898 netdev_unbind_sb_channel(pdev, accel->netdev);
9899 netdev_set_sb_channel(accel->netdev, 0);
9900
9869 clear_bit(accel->pool, adapter->fwd_bitmask); 9901 clear_bit(accel->pool, adapter->fwd_bitmask);
9870 kfree(accel); 9902 kfree(accel);
9871} 9903}