aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShay Agroskin <shayag@mellanox.com>2019-04-28 03:14:23 -0400
committerSaeed Mahameed <saeedm@mellanox.com>2019-06-07 17:40:37 -0400
commit57c70d8740f740498a52f9c0c0d7295829b944de (patch)
treecc309b729e2ee9d678adca239c208a015fb1c5c8
parentd3cbd4254df881777e2efb68ee10ede0d9dc0647 (diff)
net/mlx5e: Replace reciprocal_scale in TX select queue function
The TX queue index returned by the fallback function ranges between [0,NUM CHANNELS - 1] if QoS isn't set and [0, (NUM CHANNELS)*(NUM TCs) -1] otherwise. Our HW uses different TC mapping than the fallback function (which is denoted as 'up', user priority) so we only need to extract a channel number out of the returned value. Since (NUM CHANNELS)*(NUM TCs) is a relatively small number, using reciprocal scale almost always returns zero. We instead access the 'txq2sq' table to extract the sq (and with it the channel number) associated with the tx queue, thus getting a more evenly distributed channel number. Perf: Rx/Tx side with Intel(R) Xeon(R) Silver 4108 CPU @ 1.80GHz and ConnectX-5. Used 'iperf' UDP traffic, 10 threads, and priority 5. Before: 0.566Mpps After: 2.37Mpps As expected, releasing the existing bottleneck of steering all traffic to TX queue zero significantly improves transmission rates. Fixes: 7ccdd0841b30 ("net/mlx5e: Fix select queue callback") Signed-off-by: Shay Agroskin <shayag@mellanox.com> Reviewed-by: Tariq Toukan <tariqt@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en.h1
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_main.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_tx.c12
3 files changed, 8 insertions, 6 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index ab027f57725c..cc6797e24571 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -385,6 +385,7 @@ struct mlx5e_txqsq {
385 /* control path */ 385 /* control path */
386 struct mlx5_wq_ctrl wq_ctrl; 386 struct mlx5_wq_ctrl wq_ctrl;
387 struct mlx5e_channel *channel; 387 struct mlx5e_channel *channel;
388 int ch_ix;
388 int txq_ix; 389 int txq_ix;
389 u32 rate_limit; 390 u32 rate_limit;
390 struct work_struct recover_work; 391 struct work_struct recover_work;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index cd490ae330d8..564692227c16 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -1082,6 +1082,7 @@ static int mlx5e_alloc_txqsq(struct mlx5e_channel *c,
1082 sq->clock = &mdev->clock; 1082 sq->clock = &mdev->clock;
1083 sq->mkey_be = c->mkey_be; 1083 sq->mkey_be = c->mkey_be;
1084 sq->channel = c; 1084 sq->channel = c;
1085 sq->ch_ix = c->ix;
1085 sq->txq_ix = txq_ix; 1086 sq->txq_ix = txq_ix;
1086 sq->uar_map = mdev->mlx5e_res.bfreg.map; 1087 sq->uar_map = mdev->mlx5e_res.bfreg.map;
1087 sq->min_inline_mode = params->tx_min_inline_mode; 1088 sq->min_inline_mode = params->tx_min_inline_mode;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
index 195a7d903cec..701e5dc75bb0 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
@@ -113,13 +113,13 @@ static inline int mlx5e_get_dscp_up(struct mlx5e_priv *priv, struct sk_buff *skb
113u16 mlx5e_select_queue(struct net_device *dev, struct sk_buff *skb, 113u16 mlx5e_select_queue(struct net_device *dev, struct sk_buff *skb,
114 struct net_device *sb_dev) 114 struct net_device *sb_dev)
115{ 115{
116 int channel_ix = netdev_pick_tx(dev, skb, NULL); 116 int txq_ix = netdev_pick_tx(dev, skb, NULL);
117 struct mlx5e_priv *priv = netdev_priv(dev); 117 struct mlx5e_priv *priv = netdev_priv(dev);
118 u16 num_channels; 118 u16 num_channels;
119 int up = 0; 119 int up = 0;
120 120
121 if (!netdev_get_num_tc(dev)) 121 if (!netdev_get_num_tc(dev))
122 return channel_ix; 122 return txq_ix;
123 123
124#ifdef CONFIG_MLX5_CORE_EN_DCB 124#ifdef CONFIG_MLX5_CORE_EN_DCB
125 if (priv->dcbx_dp.trust_state == MLX5_QPTS_TRUST_DSCP) 125 if (priv->dcbx_dp.trust_state == MLX5_QPTS_TRUST_DSCP)
@@ -129,14 +129,14 @@ u16 mlx5e_select_queue(struct net_device *dev, struct sk_buff *skb,
129 if (skb_vlan_tag_present(skb)) 129 if (skb_vlan_tag_present(skb))
130 up = skb_vlan_tag_get_prio(skb); 130 up = skb_vlan_tag_get_prio(skb);
131 131
132 /* channel_ix can be larger than num_channels since 132 /* txq_ix can be larger than num_channels since
133 * dev->num_real_tx_queues = num_channels * num_tc 133 * dev->num_real_tx_queues = num_channels * num_tc
134 */ 134 */
135 num_channels = priv->channels.params.num_channels; 135 num_channels = priv->channels.params.num_channels;
136 if (channel_ix >= num_channels) 136 if (txq_ix >= num_channels)
137 channel_ix = reciprocal_scale(channel_ix, num_channels); 137 txq_ix = priv->txq2sq[txq_ix]->ch_ix;
138 138
139 return priv->channel_tc2txq[channel_ix][up]; 139 return priv->channel_tc2txq[txq_ix][up];
140} 140}
141 141
142static inline int mlx5e_skb_l2_header_offset(struct sk_buff *skb) 142static inline int mlx5e_skb_l2_header_offset(struct sk_buff *skb)