Mellanox, mlx5 updates 2020-02-25
Subsystems (5)
Hi Dave,
This series adds misc updates to mlx5 driver.
For more information please see tag log below.
Please pull and let me know if there is any problem.
Thanks,
Saeed.
---
The following changes since commit f13e4415d2715145017cbdc35f33634acf935a6f:
Merge branch 'mlxsw-Implement-ACL-dropped-packets-identification' (2020-02-25 11:05:55 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-updates-2020-02-25
for you to fetch changes up to 586ee9e8a3b00757836787d91b4c369bc36d7928:
net/mlx5: sparse: warning: Using plain integer as NULL pointer (2020-02-25 17:06:21 -0800)
----------------------------------------------------------------
mlx5-updates-2020-02-25
The following series provides some misc updates to mlx5 driver:
1) From Maxim, Refactoring for mlx5e netdev channels recreation flow.
- Add error handling
- Add context to the preactivate hook
- Use preactivate hook with context where it can be used and subsequently unify channel recreation flow everywhere.
- Fix XPS cpumask to not reset upon channel recreation.
2) From Tariq:
- Use indirect calls wrapper on RX.
- Check LRO capability bit
3) Multiple small cleanups
----------------------------------------------------------------
Eran Ben Elisha (1):
net/mlx5e: Define one flow for TXQ selection when TCs are configured
Hans Wippel (1):
Documentation: fix vxlan typo in mlx5.rst
Maxim Mikityanskiy (8):
net/mlx5e: Encapsulate updating netdev queues into a function net/mlx5e: Rename hw_modify to preactivate
net/mlx5e: Use preactivate hook to set the indirection table net/mlx5e: Fix configuration of XPS cpumasks and netdev queues in corner cases net/mlx5e: Remove unneeded netif_set_real_num_tx_queues net/mlx5e: Allow mlx5e_switch_priv_channels to fail and recover net/mlx5e: Add context to the preactivate hook
net/mlx5e: Change inline mode correctly when changing trust state
Nathan Chancellor (1):
net/mlx5: Fix header guard in rsc_dump.h
Saeed Mahameed (2):
net/mlx5: sparse: warning: incorrect type in assignment net/mlx5: sparse: warning: Using plain integer as NULL pointer
Tariq Toukan (3):
net/mlx5e: Add missing LRO cap check
net/mlx5e: RX, Use indirect calls wrapper for posting descriptors net/mlx5e: RX, Use indirect calls wrapper for handling compressed completions
.../networking/device_drivers/mellanox/mlx5.rst | 2 +- .../ethernet/mellanox/mlx5/core/diag/fw_tracer.c | 2 +- .../ethernet/mellanox/mlx5/core/diag/rsc_dump.h | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en.h | 29 ++- drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c | 55 +++--- .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 23 +-- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 195 +++++++++++++-------- drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 6 +- drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 13 +- drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c | 11 +- .../net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/lib/dm.c | 2 +- 13 files changed, 216 insertions(+), 128 deletions(-)
PATCH 1/16 net/mlx5e: Define one flow for TXQ selection when TCs are configured
From: Eran Ben Elisha <[email protected]>
We shall always extract channel index out of the txq, regardless of the relation between txq_ix and num channels. The extraction is always valid, as if txq is smaller than number of channels, txq_ix == priv->txq2sq[txq_ix]->ch_ix.
By doing so, we can remove an if clause from the select queue method, and have one flow for all packets.
--- drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +6 -7
@@ -72,8 +72,8 @@ u16 mlx5e_select_queue(struct net_device *dev, struct sk_buff *skb, {int txq_ix =netdev_pick_tx (dev, skb,NULL );struct mlx5e_priv *priv =netdev_priv (dev); -u16 num_channels;int up =0 ; +int ch_ix;if (!netdev_get_num_tc (dev))return txq_ix;
@@ -86,14 +86,13 @@ u16 mlx5e_select_queue(struct net_device *dev, struct sk_buff *skb,if (skb_vlan_tag_present (skb)) up =skb_vlan_tag_get_prio (skb); -/* txq_ix can be larger than num_channels since -* dev->num_real_tx_queues = num_channels * num_tc +/* Normalize any picked txq_ix to [0, num_channels), +* So we can return a txq_ix that matches the channel and +* packet UP. */ - num_channels = priv->channels.params.num_channels; -if (txq_ix >= num_channels) - txq_ix = priv->txq2sq[txq_ix]->ch_ix; + ch_ix = priv->txq2sq[txq_ix]->ch_ix; -return priv->channel_tc2realtxq[txq_ix][up]; +return priv->channel_tc2realtxq[ch_ix][up]; }static inline int mlx5e_skb_l2_header_offset (struct sk_buff *skb)
Signature · 1 line
2.24.1
PATCH 2/16 net/mlx5e: Add missing LRO cap check
In reply to Saeed MahameedFrom: Tariq Toukan <[email protected]>
The LRO boolean state in params->lro_en must not be set in case the NIC is not capable.
Enforce this check and remove the TODO comment.
--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +2 -3
@@ -4770,9 +4770,8 @@ void mlx5e_build_nic_params(struct mlx5e_priv *priv,mlx5e_build_rq_params (mdev, params);/* HW LRO */ - -/* TODO: && MLX5_CAP_ETH(mdev, lro_cap) */ -if (params->rq_wq_type ==MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ ) { +if (MLX5_CAP_ETH (mdev, lro_cap) && + params->rq_wq_type ==MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ ) {/* No XSK params: checking the availability of striding RQ in general. */ if (!mlx5e_rx_mpwqe_is_linear_skb (mdev, params,NULL )) params->lro_en = !slow_pci_heuristic (mdev);
Signature · 1 line
2.24.1
PATCH 3/16 net/mlx5e: Encapsulate updating netdev queues into a function
In reply to Saeed MahameedFrom: Maxim Mikityanskiy <[email protected]>
As a preparation for one of the following commits, create a function to encapsulate the code that notifies the kernel about the new amount of RX and TX queues. The code will be called multiple times in the next commit.
--- .../net/ethernet/mellanox/mlx5/core/en_main.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +12 -7
@@ -2869,6 +2869,17 @@ static void mlx5e_netdev_set_tcs(struct net_device *netdev)netdev_set_tc_queue (netdev, tc, nch,0 ); } +static void mlx5e_update_netdev_queues (struct mlx5e_priv *priv) +{ +int num_txqs = priv->channels.num * priv->channels.params.num_tc; +int num_rxqs = priv->channels.num * priv->profile->rq_groups; +struct net_device *netdev = priv->netdev; + +mlx5e_netdev_set_tcs (netdev); +netif_set_real_num_tx_queues (netdev, num_txqs); +netif_set_real_num_rx_queues (netdev, num_rxqs); +} +static void mlx5e_build_txq_maps (struct mlx5e_priv *priv) {int i, ch;
@@ -2890,13 +2901,7 @@ static void mlx5e_build_txq_maps(struct mlx5e_priv *priv)void mlx5e_activate_priv_channels (struct mlx5e_priv *priv) { -int num_txqs = priv->channels.num * priv->channels.params.num_tc; -int num_rxqs = priv->channels.num * priv->profile->rq_groups; -struct net_device *netdev = priv->netdev; - -mlx5e_netdev_set_tcs (netdev); -netif_set_real_num_tx_queues (netdev, num_txqs); -netif_set_real_num_rx_queues (netdev, num_rxqs); +mlx5e_update_netdev_queues (priv);mlx5e_build_txq_maps (priv);mlx5e_activate_channels (&priv->channels);
Signature · 1 line
2.24.1
Jakub Kicinski
maintainerRe: [net-next 03/16] net/mlx5e: Encapsulate updating netdev queues into a function
Quoted 38 lines · On Tue, 25 Feb 2020 17:12:33 -0800 Saeed Mahameed wrote:
From: Maxim Mikityanskiy <[email protected]>
As a preparation for one of the following commits, create a function to encapsulate the code that notifies the kernel about the new amount of RX and TX queues. The code will be called multiple times in the next commit.
Signed-off-by Maxim Mikityanskiy <[email protected]>Reviewed-by Tariq Toukan <[email protected]>Signed-off-by Saeed Mahameed <[email protected]>--- .../net/ethernet/mellanox/mlx5/core/en_main.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)drivers/net/ethernet/mellanox/mlx5/core/en_main.c +11
-0@@ -2869,6 +2869,17 @@ static void mlx5e_netdev_set_tcs(struct net_device *netdev)netdev_set_tc_queue (netdev, tc, nch,0 ); } +static void mlx5e_update_netdev_queues (struct mlx5e_priv *priv) +{ +int num_txqs = priv->channels.num * priv->channels.params.num_tc; +int num_rxqs = priv->channels.num * priv->profile->rq_groups; +struct net_device *netdev = priv->netdev; + +mlx5e_netdev_set_tcs (netdev); +netif_set_real_num_tx_queues (netdev, num_txqs); +netif_set_real_num_rx_queues (netdev, num_rxqs); +} +static void mlx5e_build_txq_maps (struct mlx5e_priv *priv) {int i, ch;@@ -2890,13 +2901,7 @@ static void mlx5e_build_txq_maps(struct mlx5e_priv *priv)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c static void mlx5e_build_txq_maps(struct mlx5e_priv *priv) · line 2904
Quoted 10 lines
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +1
-7void mlx5e_activate_priv_channels (struct mlx5e_priv *priv) { -int num_txqs = priv->channels.num * priv->channels.params.num_tc; -int num_rxqs = priv->channels.num * priv->profile->rq_groups; -struct net_device *netdev = priv->netdev; - -mlx5e_netdev_set_tcs (netdev); -netif_set_real_num_tx_queues (netdev, num_txqs); -netif_set_real_num_rx_queues (netdev, num_rxqs); +mlx5e_update_netdev_queues (priv);
Not sure where we stand on just moving bad code, but set_real_num_ _queues can fail, Dave just pointed this out to someone recently in review.
Quoted 3 lines
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +0
-0mlx5e_build_txq_maps (priv);mlx5e_activate_channels (&priv->channels);
Re: [net-next 03/16] net/mlx5e: Encapsulate updating netdev queues into a function
Quoted 51 lines · Jakub Kicinski
Quoted 50 lines · On Tue, 25 Feb 2020 17:12:33 -0800 Saeed Mahameed wrote:
From: Maxim Mikityanskiy <[email protected]>
As a preparation for one of the following commits, create a function to
encapsulate the code that notifies the kernel about the new amount of
RX and TX queues. The code will be called multiple times in the next
commit.Signed-off-by Maxim Mikityanskiy <[email protected]>Reviewed-by Tariq Toukan <[email protected]>Signed-off-by Saeed Mahameed <[email protected]>--- .../net/ethernet/mellanox/mlx5/core/en_main.c | 19 ++++++++++++--- ---- 1 file changed, 12 insertions(+), 7 deletions(-)drivers/net/ethernet/mellanox/mlx5/core/en_main.c +11
-0@@ -2869,6 +2869,17 @@ static void mlx5e_netdev_set_tcs(struct net_device *netdev) netdev_set_tc_queue(netdev, tc, nch, 0); } +static void mlx5e_update_netdev_queues(struct mlx5e_priv *priv) +{ + int num_txqs = priv->channels.num * priv- >channels.params.num_tc; + int num_rxqs = priv->channels.num * priv->profile->rq_groups; + struct net_device *netdev = priv->netdev; + + mlx5e_netdev_set_tcs(netdev); + netif_set_real_num_tx_queues(netdev, num_txqs); + netif_set_real_num_rx_queues(netdev, num_rxqs); +} + static void mlx5e_build_txq_maps(struct mlx5e_priv *priv){
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +0
-1int i, ch;@@ -2890,13 +2901,7 @@ static void mlx5e_build_txq_maps(struct mlx5e_priv *priv)void mlx5e_activate_priv_channels (struct mlx5e_priv *priv) { -int num_txqs = priv->channels.num * priv- >channels.params.num_tc;
Quoted 12 lines
drivers/net/ethernet/mellanox/mlx5/core/en_main.c static void mlx5e_build_txq_maps(struct mlx5e_priv *priv) · line 2904
Quoted 7 lines
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +1
-6-int num_rxqs = priv->channels.num * priv->profile->rq_groups; -struct net_device *netdev = priv->netdev; - -mlx5e_netdev_set_tcs (netdev); -netif_set_real_num_tx_queues (netdev, num_txqs); -netif_set_real_num_rx_queues (netdev, num_rxqs); +mlx5e_update_netdev_queues (priv);Not sure where we stand on just moving bad code, but
set_real_num__queuescan fail, Dave just pointed this out to someone recently in review.
good point, but likewise not sure if this patch is the place to fix the issue, the good thing is that now it is fixable since maxim added the ability to allow failing mlx5_switch_channels() and roll back.
in patch 6 of this series;
net/mlx5e: Fix configuration of XPS cpumasks and netdev queues in corner cases
you can see that Maxim is using the new function introduced in this patch as a hook that is allowed to fail and bail out when switching between channels:
err = mlx5e_safe_switch_channels(priv, &new_channels, mlx5e_num_channels_changed);
so all we need is to not ignore the return value of netif_set_real_num_tx_queues() and abort mlx5e_num_channels_changed() in case of failure which will abort mlx5e_safe_switch_channels() and old channels will keep working.
I guess this should be an incremental oneliner patch after this series.
Thanks,
Saeed.
Quoted 3 lines
Quoted 3 lines
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +0
-0mlx5e_build_txq_maps (priv);
mlx5e_activate_channels(&priv->channels);
PATCH 4/16 net/mlx5e: Rename hw_modify to preactivate
In reply to Saeed MahameedFrom: Maxim Mikityanskiy <[email protected]>
mlx5e_safe_switch_channels accepts a callback to be called before activating new channels. It is intended to configure some hardware parameters in cases where channels are recreated because some configuration has changed.
Recently, this callback has started being used to update the driver's internal MLX5E_STATE_XDP_OPEN flag, and the following patches also intend to use this callback for software preparations. This patch renames the hw_modify callback to preactivate, so that the name fits better.
--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 6 +++--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 14 ++++++++------ 2 files changed, 11 insertions(+), 9 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +3 -3
@@ -1035,14 +1035,14 @@ int mlx5e_open_channels(struct mlx5e_priv *priv, struct mlx5e_channels *chs);void mlx5e_close_channels (struct mlx5e_channels *chs); -/* Function pointer to be used to modify WH settings while +/* Function pointer to be used to modify HW or kernel settings while * switching channels */ -typedef int (*mlx5e_fp_hw_modify )(struct mlx5e_priv *priv); +typedef int (*mlx5e_fp_preactivate )(struct mlx5e_priv *priv);int mlx5e_safe_reopen_channels (struct mlx5e_priv *priv);int mlx5e_safe_switch_channels (struct mlx5e_priv *priv,struct mlx5e_channels *new_chs, -mlx5e_fp_hw_modify hw_modify); +mlx5e_fp_preactivate preactivate);void mlx5e_activate_priv_channels (struct mlx5e_priv *priv);void mlx5e_deactivate_priv_channels (struct mlx5e_priv *priv);
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +8 -6
@@ -2937,7 +2937,7 @@ void mlx5e_deactivate_priv_channels(struct mlx5e_priv *priv)static void mlx5e_switch_priv_channels (struct mlx5e_priv *priv,struct mlx5e_channels *new_chs, -mlx5e_fp_hw_modify hw_modify) +mlx5e_fp_preactivate preactivate) {struct net_device *netdev = priv->netdev;int new_num_txqs;
@@ -2956,9 +2956,11 @@ static void mlx5e_switch_priv_channels(struct mlx5e_priv *priv, priv->channels = *new_chs; -/* New channels are ready to roll, modify HW settings if needed */ -if (hw_modify) -hw_modify (priv); +/* New channels are ready to roll, call the preactivate hook if needed +* to modify HW settings or update kernel parameters. +*/ +if (preactivate) +preactivate (priv); priv->profile->update_rx (priv);mlx5e_activate_priv_channels (priv);
@@ -2970,7 +2972,7 @@ static void mlx5e_switch_priv_channels(struct mlx5e_priv *priv,int mlx5e_safe_switch_channels (struct mlx5e_priv *priv,struct mlx5e_channels *new_chs, -mlx5e_fp_hw_modify hw_modify) +mlx5e_fp_preactivate preactivate) {int err;
@@ -2978,7 +2980,7 @@ int mlx5e_safe_switch_channels(struct mlx5e_priv *priv,if (err)return err; -mlx5e_switch_priv_channels (priv, new_chs, hw_modify); +mlx5e_switch_priv_channels (priv, new_chs, preactivate);return 0 ; }
Signature · 1 line
2.24.1
PATCH 5/16 net/mlx5e: Use preactivate hook to set the indirection table
In reply to Saeed MahameedFrom: Maxim Mikityanskiy <[email protected]>
mlx5e_ethtool_set_channels updates the indirection table before switching to the new channels. If the switch fails, the indirection table is new, but the channels are old, which is wrong. Fix it by using the preactivate hook of mlx5e_safe_switch_channels to update the indirection table at the stage when nothing can fail anymore.
As the code that updates the indirection table is now encapsulated into a new function, use that function in the attach flow when the driver has to reduce the number of channels, and prepare the code for the next commit.
--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 1 + .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 10 ++-------- .../net/ethernet/mellanox/mlx5/core/en_main.c | 16 ++++++++++++++-- 3 files changed, 17 insertions(+), 10 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +1 -0
@@ -1043,6 +1043,7 @@ int mlx5e_safe_reopen_channels(struct mlx5e_priv *priv);int mlx5e_safe_switch_channels (struct mlx5e_priv *priv,struct mlx5e_channels *new_chs,mlx5e_fp_preactivate preactivate); +int mlx5e_num_channels_changed (struct mlx5e_priv *priv);void mlx5e_activate_priv_channels (struct mlx5e_priv *priv);void mlx5e_deactivate_priv_channels (struct mlx5e_priv *priv);
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +2 -8
@@ -432,9 +432,7 @@ int mlx5e_ethtool_set_channels(struct mlx5e_priv *priv,if (!test_bit (MLX5E_STATE_OPENED , &priv->state)) { *cur_params = new_channels.params; -if (!netif_is_rxfh_configured (priv->netdev)) -mlx5e_build_default_indir_rqt (priv->rss_params.indirection_rqt, -MLX5E_INDIR_RQT_SIZE , count); +mlx5e_num_channels_changed (priv); goto out; }
@@ -442,12 +440,8 @@ int mlx5e_ethtool_set_channels(struct mlx5e_priv *priv,if (arfs_enabled)mlx5e_arfs_disable (priv); -if (!netif_is_rxfh_configured (priv->netdev)) -mlx5e_build_default_indir_rqt (priv->rss_params.indirection_rqt, -MLX5E_INDIR_RQT_SIZE , count); -/* Switch to new channels, set new parameters and close old ones */ - err =mlx5e_safe_switch_channels (priv, &new_channels,NULL ); + err =mlx5e_safe_switch_channels (priv, &new_channels, mlx5e_num_channels_changed);if (arfs_enabled) {int err2 =mlx5e_arfs_enable (priv);
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +14 -2
@@ -2880,6 +2880,17 @@ static void mlx5e_update_netdev_queues(struct mlx5e_priv *priv)netif_set_real_num_rx_queues (netdev, num_rxqs); } +int mlx5e_num_channels_changed (struct mlx5e_priv *priv) +{ +u16 count = priv->channels.params.num_channels; + +if (!netif_is_rxfh_configured (priv->netdev)) +mlx5e_build_default_indir_rqt (priv->rss_params.indirection_rqt, +MLX5E_INDIR_RQT_SIZE , count); + +return 0 ; +} +static void mlx5e_build_txq_maps (struct mlx5e_priv *priv) {int i, ch;
@@ -5288,9 +5299,10 @@ int mlx5e_attach_netdev(struct mlx5e_priv *priv) max_nch =mlx5e_get_max_num_channels (priv->mdev);if (priv->channels.params.num_channels > max_nch) {mlx5_core_warn (priv->mdev,"MLX5E: Reducing number of channels to %d\n" , max_nch); +/* Reducing the number of channels - RXFH has to be reset. */ + priv->netdev->priv_flags &= ~IFF_RXFH_CONFIGURED ; priv->channels.params.num_channels = max_nch; -mlx5e_build_default_indir_rqt (priv->rss_params.indirection_rqt, -MLX5E_INDIR_RQT_SIZE , max_nch); +mlx5e_num_channels_changed (priv); } err = profile->init_tx (priv);
Signature · 1 line
2.24.1
PATCH 6/16 net/mlx5e: Fix configuration of XPS cpumasks and netdev queues in corner cases
In reply to Saeed MahameedFrom: Maxim Mikityanskiy <[email protected]>
Currently, mlx5e notifies the kernel about the number of queues and sets the default XPS cpumasks when channels are activated. This implementation has several corner cases, in which the kernel may not be updated on time, or XPS cpumasks may be reset when not directly touched by the user.
This commit fixes these corner cases to match the following expected behavior:
1. The number of queues always corresponds to the number of channels configured.
2. XPS cpumasks are set to driver's defaults on netdev attach.
3. XPS cpumasks set by user are not reset, unless the number of channels changes. If the number of channels changes, they are reset to driver's defaults. (In general case, when the number of channels increases or decreases, it's not possible to guess how to convert the current XPS cpumasks to work with the new number of channels, so we let the user reconfigure it if they change the number of channels.)
XPS cpumasks are no longer stored per channel. Only one temporary cpumask is used. The old stored cpumasks didn't reflect the user's changes and were not used after applying them.
A scratchpad area is added to struct mlx5e_priv. As cpumask_var_t requires allocation, and the preactivate hook can't fail, we need to preallocate the temporary cpumask in advance. It's stored in the scratchpad.
--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 11 ++- .../net/ethernet/mellanox/mlx5/core/en_main.c | 95 +++++++++++-------- 2 files changed, 65 insertions(+), 41 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +10 -1
@@ -737,7 +737,6 @@ struct mlx5e_channel {DECLARE_BITMAP (state,MLX5E_CHANNEL_NUM_STATES );int ix;int cpu; -cpumask_var_t xps_cpumask; };struct mlx5e_channels {
@@ -813,6 +812,15 @@ struct mlx5e_xsk {bool ever_used; }; +/* Temporary storage for variables that are allocated when struct mlx5e_priv is +* initialized, and used where we can't allocate them because that functions +* must not fail. Use with care and make sure the same variable is not used +* simultaneously by multiple users. +*/ +struct mlx5e_scratchpad { +cpumask_var_t cpumask; +}; +struct mlx5e_priv {/* priv data path fields - start */ struct mlx5e_txqsq *txq2sq[MLX5E_MAX_NUM_CHANNELS *MLX5E_MAX_NUM_TC ];
@@ -876,6 +884,7 @@ struct mlx5e_priv {#if IS_ENABLED (CONFIG_PCI_HYPERV_INTERFACE )struct mlx5e_hv_vhca_stats_agent stats_agent;#endif +struct mlx5e_scratchpad scratchpad; };struct mlx5e_profile {
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +55 -40
193 lines not on this page · raw message
Signature · 1 line
2.24.1
PATCH 7/16 net/mlx5e: Remove unneeded netif_set_real_num_tx_queues
In reply to Saeed MahameedFrom: Maxim Mikityanskiy <[email protected]>
The number of queues is now updated by mlx5e_update_netdev_queues in a centralized way, when no channels are active. Remove an extra occurrence of netif_set_real_num_tx_queues to prepare it for the next commit.
--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +0 -6
@@ -2942,17 +2942,11 @@ static void mlx5e_switch_priv_channels(struct mlx5e_priv *priv, mlx5e_fp_preactivate preactivate) {struct net_device *netdev = priv->netdev; -int new_num_txqs;int carrier_ok; - new_num_txqs = new_chs->num * new_chs->params.num_tc; - carrier_ok =netif_carrier_ok (netdev);netif_carrier_off (netdev); -if (new_num_txqs < netdev->real_num_tx_queues) -netif_set_real_num_tx_queues (netdev, new_num_txqs); -mlx5e_deactivate_priv_channels (priv);mlx5e_close_channels (&priv->channels);
Signature · 1 line
2.24.1
PATCH 8/16 net/mlx5e: Allow mlx5e_switch_priv_channels to fail and recover
In reply to Saeed MahameedFrom: Maxim Mikityanskiy <[email protected]>
Currently mlx5e_switch_priv_channels expects that the preactivate hook doesn't fail, however, it can fail, because it may set hardware parameters. This commit addresses this issue and provides a way to recover from failures of the preactivate hook: the old channels are not closed until the point where nothing can fail anymore, so in case preactivate fails, the driver can roll back the old channels and activate them again.
--- .../net/ethernet/mellanox/mlx5/core/en_main.c | 34 +++++++++++++++---- 1 file changed, 27 insertions(+), 7 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +27 -7
@@ -2937,33 +2937,45 @@ void mlx5e_deactivate_priv_channels(struct mlx5e_priv *priv)mlx5e_deactivate_channels (&priv->channels); } -static void mlx5e_switch_priv_channels (struct mlx5e_priv *priv, -struct mlx5e_channels *new_chs, -mlx5e_fp_preactivate preactivate) +static int mlx5e_switch_priv_channels (struct mlx5e_priv *priv, +struct mlx5e_channels *new_chs, +mlx5e_fp_preactivate preactivate) {struct net_device *netdev = priv->netdev; +struct mlx5e_channels old_chs;int carrier_ok; +int err =0 ; carrier_ok =netif_carrier_ok (netdev);netif_carrier_off (netdev);mlx5e_deactivate_priv_channels (priv); -mlx5e_close_channels (&priv->channels); + old_chs = priv->channels; priv->channels = *new_chs;/* New channels are ready to roll, call the preactivate hook if needed * to modify HW settings or update kernel parameters. */ -if (preactivate) -preactivate (priv); +if (preactivate) { + err =preactivate (priv); +if (err) { + priv->channels = old_chs; + goto out; + } + } +mlx5e_close_channels (&old_chs); priv->profile->update_rx (priv); + +out:mlx5e_activate_priv_channels (priv);/* return carrier back if needed */ if (carrier_ok)netif_carrier_on (netdev); + +return err; } int mlx5e_safe_switch_channels(struct mlx5e_priv *priv,
@@ -2976,8 +2988,16 @@ int mlx5e_safe_switch_channels(struct mlx5e_priv *priv,if (err)return err; -mlx5e_switch_priv_channels (priv, new_chs, preactivate); + err =mlx5e_switch_priv_channels (priv, new_chs, preactivate); +if (err) + goto err_close; +return 0 ; + +err_close: +mlx5e_close_channels (new_chs); + +return err; }int mlx5e_safe_reopen_channels (struct mlx5e_priv *priv)
Signature · 1 line
2.24.1
PATCH 9/16 net/mlx5e: Add context to the preactivate hook
In reply to Saeed MahameedFrom: Maxim Mikityanskiy <[email protected]>
Sometimes the preactivate hook of mlx5e_safe_switch_channels needs more parameters than just struct mlx5e_priv *. For such cases, a new parameter (void *context) is added to preactivate hooks.
Some of the existing normal functions are currently used as preactivate callbacks. To avoid adding an extra unused parameter, they are wrapped in an automatic way using the MLX5E_DEFINE_PREACTIVATE_WRAPPER_CTX macro.
--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 15 +++++--- .../ethernet/mellanox/mlx5/core/en_dcbnl.c | 2 +- .../ethernet/mellanox/mlx5/core/en_ethtool.c | 15 ++++---- .../net/ethernet/mellanox/mlx5/core/en_main.c | 36 ++++++++++++------- .../net/ethernet/mellanox/mlx5/core/en_rep.c | 2 +- .../ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 2 +- 6 files changed, 45 insertions(+), 27 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +11 -4
@@ -1047,12 +1047,19 @@ void mlx5e_close_channels(struct mlx5e_channels *chs);/* Function pointer to be used to modify HW or kernel settings while * switching channels */ -typedef int (*mlx5e_fp_preactivate )(struct mlx5e_priv *priv); +typedef int (*mlx5e_fp_preactivate )(struct mlx5e_priv *priv,void *context); +#define MLX5E_DEFINE_PREACTIVATE_WRAPPER_CTX (fn) \ +int fn##_ctx(struct mlx5e_priv *priv, void *context) \ +{ \ + return fn(priv); \ +}int mlx5e_safe_reopen_channels (struct mlx5e_priv *priv);int mlx5e_safe_switch_channels (struct mlx5e_priv *priv,struct mlx5e_channels *new_chs, -mlx5e_fp_preactivate preactivate); +mlx5e_fp_preactivate preactivate, +void *context);int mlx5e_num_channels_changed (struct mlx5e_priv *priv); +int mlx5e_num_channels_changed_ctx (struct mlx5e_priv *priv,void *context);void mlx5e_activate_priv_channels (struct mlx5e_priv *priv);void mlx5e_deactivate_priv_channels (struct mlx5e_priv *priv);
@@ -1132,10 +1139,10 @@ void mlx5e_update_ndo_stats(struct mlx5e_priv *priv);void mlx5e_queue_update_stats (struct mlx5e_priv *priv);int mlx5e_bits_invert (unsigned long a,int size); -typedef int (*change_hw_mtu_cb )(struct mlx5e_priv *priv);int mlx5e_set_dev_port_mtu (struct mlx5e_priv *priv); +int mlx5e_set_dev_port_mtu_ctx (struct mlx5e_priv *priv,void *context);int mlx5e_change_mtu (struct net_device *netdev,int new_mtu, -change_hw_mtu_cb set_mtu_cb); +mlx5e_fp_preactivate preactivate);/* ethtool helpers */ void mlx5e_ethtool_get_drvinfo(struct mlx5e_priv *priv,
drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c +1 -1
@@ -1126,7 +1126,7 @@ static void mlx5e_trust_update_sq_inline_mode(struct mlx5e_priv *priv) priv->channels.params.tx_min_inline_mode) goto out; -mlx5e_safe_switch_channels (priv, &new_channels,NULL ); +mlx5e_safe_switch_channels (priv, &new_channels,NULL ,NULL ); out:mutex_unlock (&priv->state_lock);
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +8 -7
@@ -357,7 +357,7 @@ int mlx5e_ethtool_set_ringparam(struct mlx5e_priv *priv, goto unlock; } - err =mlx5e_safe_switch_channels (priv, &new_channels,NULL ); + err =mlx5e_safe_switch_channels (priv, &new_channels,NULL ,NULL ); unlock:mutex_unlock (&priv->state_lock);
@@ -441,7 +441,8 @@ int mlx5e_ethtool_set_channels(struct mlx5e_priv *priv,mlx5e_arfs_disable (priv);/* Switch to new channels, set new parameters and close old ones */ - err =mlx5e_safe_switch_channels (priv, &new_channels, mlx5e_num_channels_changed); + err =mlx5e_safe_switch_channels (priv, &new_channels, + mlx5e_num_channels_changed_ctx,NULL );if (arfs_enabled) {int err2 =mlx5e_arfs_enable (priv);
@@ -574,7 +575,7 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv, goto out; } - err =mlx5e_safe_switch_channels (priv, &new_channels,NULL ); + err =mlx5e_safe_switch_channels (priv, &new_channels,NULL ,NULL ); out:mutex_unlock (&priv->state_lock);
@@ -1742,7 +1743,7 @@ static int set_pflag_cqe_based_moder(struct net_device *netdev, bool enable,return 0 ; } -return mlx5e_safe_switch_channels (priv, &new_channels,NULL ); +return mlx5e_safe_switch_channels (priv, &new_channels,NULL ,NULL ); }static int set_pflag_tx_cqe_based_moder (struct net_device *netdev,bool enable)
@@ -1775,7 +1776,7 @@ int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool new_valreturn 0 ; } - err =mlx5e_safe_switch_channels (priv, &new_channels,NULL ); + err =mlx5e_safe_switch_channels (priv, &new_channels,NULL ,NULL );if (err)return err;
@@ -1832,7 +1833,7 @@ static int set_pflag_rx_striding_rq(struct net_device *netdev, bool enable)return 0 ; } -return mlx5e_safe_switch_channels (priv, &new_channels,NULL ); +return mlx5e_safe_switch_channels (priv, &new_channels,NULL ,NULL ); }static int set_pflag_rx_no_csum_complete (struct net_device *netdev,bool enable)
@@ -1876,7 +1877,7 @@ static int set_pflag_xdp_tx_mpwqe(struct net_device *netdev, bool enable)return 0 ; } - err =mlx5e_safe_switch_channels (priv, &new_channels,NULL ); + err =mlx5e_safe_switch_channels (priv, &new_channels,NULL ,NULL );return err; }
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +23 -13
@@ -2753,6 +2753,8 @@ static int mlx5e_modify_tirs_lro(struct mlx5e_priv *priv)return err; } +static MLX5E_DEFINE_PREACTIVATE_WRAPPER_CTX (mlx5e_modify_tirs_lro); +static int mlx5e_set_mtu (struct mlx5_core_dev *mdev,struct mlx5e_params *params,u16 mtu) {
@@ -2802,6 +2804,8 @@ int mlx5e_set_dev_port_mtu(struct mlx5e_priv *priv)return 0 ; } +MLX5E_DEFINE_PREACTIVATE_WRAPPER_CTX (mlx5e_set_dev_port_mtu); +void mlx5e_set_netdev_mtu_boundaries (struct mlx5e_priv *priv) {struct mlx5e_params *params = &priv->channels.params;
@@ -2884,6 +2888,8 @@ int mlx5e_num_channels_changed(struct mlx5e_priv *priv)return 0 ; } +MLX5E_DEFINE_PREACTIVATE_WRAPPER_CTX (mlx5e_num_channels_changed); +static void mlx5e_build_txq_maps (struct mlx5e_priv *priv) {int i, ch;
@@ -2939,7 +2945,8 @@ void mlx5e_deactivate_priv_channels(struct mlx5e_priv *priv)static int mlx5e_switch_priv_channels (struct mlx5e_priv *priv,struct mlx5e_channels *new_chs, -mlx5e_fp_preactivate preactivate) +mlx5e_fp_preactivate preactivate, +void *context) {struct net_device *netdev = priv->netdev;struct mlx5e_channels old_chs;
@@ -2958,7 +2965,7 @@ static int mlx5e_switch_priv_channels(struct mlx5e_priv *priv,* to modify HW settings or update kernel parameters. */ if (preactivate) { - err =preactivate (priv); + err =preactivate (priv, context);if (err) { priv->channels = old_chs; goto out;
@@ -2980,7 +2987,8 @@ static int mlx5e_switch_priv_channels(struct mlx5e_priv *priv,int mlx5e_safe_switch_channels (struct mlx5e_priv *priv,struct mlx5e_channels *new_chs, -mlx5e_fp_preactivate preactivate) +mlx5e_fp_preactivate preactivate, +void *context) {int err;
@@ -2988,7 +2996,7 @@ int mlx5e_safe_switch_channels(struct mlx5e_priv *priv,if (err)return err; - err =mlx5e_switch_priv_channels (priv, new_chs, preactivate); + err =mlx5e_switch_priv_channels (priv, new_chs, preactivate, context);if (err) goto err_close;
@@ -3005,7 +3013,7 @@ int mlx5e_safe_reopen_channels(struct mlx5e_priv *priv)struct mlx5e_channels new_channels = {}; new_channels.params = priv->channels.params; -return mlx5e_safe_switch_channels (priv, &new_channels,NULL ); +return mlx5e_safe_switch_channels (priv, &new_channels,NULL ,NULL ); }void mlx5e_timestamp_init (struct mlx5e_priv *priv)
@@ -3454,7 +3462,8 @@ static int mlx5e_setup_tc_mqprio(struct mlx5e_priv *priv, goto out; } - err =mlx5e_safe_switch_channels (priv, &new_channels, mlx5e_num_channels_changed); + err =mlx5e_safe_switch_channels (priv, &new_channels, + mlx5e_num_channels_changed_ctx,NULL );if (err) goto out;
@@ -3667,7 +3676,8 @@ static int set_feature_lro(struct net_device *netdev, bool enable) goto out; } - err =mlx5e_safe_switch_channels (priv, &new_channels, mlx5e_modify_tirs_lro); + err =mlx5e_safe_switch_channels (priv, &new_channels, + mlx5e_modify_tirs_lro_ctx,NULL ); out:mutex_unlock (&priv->state_lock);return err;
@@ -3886,7 +3896,7 @@ static bool mlx5e_xsk_validate_mtu(struct net_device *netdev, }int mlx5e_change_mtu (struct net_device *netdev,int new_mtu, -change_hw_mtu_cb set_mtu_cb) +mlx5e_fp_preactivate preactivate) {struct mlx5e_priv *priv =netdev_priv (netdev);struct mlx5e_channels new_channels = {};
@@ -3935,13 +3945,13 @@ int mlx5e_change_mtu(struct net_device *netdev, int new_mtu,if (!reset) { params->sw_mtu = new_mtu; -if (set_mtu_cb) -set_mtu_cb (priv); +if (preactivate) +preactivate (priv,NULL ); netdev->mtu = params->sw_mtu; goto out; } - err =mlx5e_safe_switch_channels (priv, &new_channels, set_mtu_cb); + err =mlx5e_safe_switch_channels (priv, &new_channels, preactivate,NULL );if (err) goto out;
@@ -3954,7 +3964,7 @@ int mlx5e_change_mtu(struct net_device *netdev, int new_mtu,static int mlx5e_change_nic_mtu (struct net_device *netdev,int new_mtu) { -return mlx5e_change_mtu (netdev, new_mtu, mlx5e_set_dev_port_mtu); +return mlx5e_change_mtu (netdev, new_mtu, mlx5e_set_dev_port_mtu_ctx); }int mlx5e_hwstamp_set (struct mlx5e_priv *priv,struct ifreq *ifr)
@@ -4415,7 +4425,7 @@ static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog)mlx5e_set_rq_type (priv->mdev, &new_channels.params); old_prog = priv->channels.params.xdp_prog; - err =mlx5e_safe_switch_channels (priv, &new_channels,NULL ); + err =mlx5e_safe_switch_channels (priv, &new_channels,NULL ,NULL );if (err) goto unlock; }else {
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +1 -1
@@ -1396,7 +1396,7 @@ static int mlx5e_rep_change_mtu(struct net_device *netdev, int new_mtu)static int mlx5e_uplink_rep_change_mtu (struct net_device *netdev,int new_mtu) { -return mlx5e_change_mtu (netdev, new_mtu, mlx5e_set_dev_port_mtu); +return mlx5e_change_mtu (netdev, new_mtu, mlx5e_set_dev_port_mtu_ctx); }static int mlx5e_uplink_rep_set_mac (struct net_device *netdev,void *addr)
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c +1 -1
@@ -483,7 +483,7 @@ static int mlx5i_change_mtu(struct net_device *netdev, int new_mtu) new_channels.params = *params; new_channels.params.sw_mtu = new_mtu; - err =mlx5e_safe_switch_channels (priv, &new_channels,NULL ); + err =mlx5e_safe_switch_channels (priv, &new_channels,NULL ,NULL );if (err) goto out;
Signature · 1 line
2.24.1
PATCH 10/16 net/mlx5e: Change inline mode correctly when changing trust state
In reply to Saeed MahameedFrom: Maxim Mikityanskiy <[email protected]>
The current steps that are performed when the trust state changes, if the channels are active:
1. The trust state is changed in hardware.
2. The new inline mode is calculated.
3. If the new inline mode is different, the channels are recreated using the new inline mode.
This approach has some issues:
1. There is a time gap between changing trust state in hardware and starting sending enough inline headers (the latter happens after recreation of channels). It leads to failed transmissions and error CQEs.
2. If the new channels fail to open, we'll be left with the old ones, but the hardware will be configured for the new trust state, so the interval when we can see TX errors never ends.
This patch fixes the issues above by moving the trust state change into the preactivate hook that runs during the recreation of the channels when no channels are active, so it eliminates the gap of partially applied configuration. If the inline mode doesn't change with the change of the trust state, the channels won't be recreated, just like before this patch.
--- .../ethernet/mellanox/mlx5/core/en_dcbnl.c | 55 +++++++++++-------- 1 file changed, 33 insertions(+), 22 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c +33 -22
@@ -1098,49 +1098,59 @@ void mlx5e_dcbnl_delete_app(struct mlx5e_priv *priv)mlx5e_dcbnl_dscp_app (priv,DELETE ); } -static void mlx5e_trust_update_tx_min_inline_mode (struct mlx5e_priv *priv, -struct mlx5e_params *params) +static void mlx5e_params_calc_trust_tx_min_inline_mode (struct mlx5_core_dev *mdev, +struct mlx5e_params *params, +u8 trust_state) { -mlx5_query_min_inline (priv->mdev, ¶ms->tx_min_inline_mode); -if (priv->dcbx_dp.trust_state ==MLX5_QPTS_TRUST_DSCP && +mlx5_query_min_inline (mdev, ¶ms->tx_min_inline_mode); +if (trust_state ==MLX5_QPTS_TRUST_DSCP && params->tx_min_inline_mode ==MLX5_INLINE_MODE_L2 ) params->tx_min_inline_mode =MLX5_INLINE_MODE_IP ; } -static void mlx5e_trust_update_sq_inline_mode (struct mlx5e_priv *priv) +static int mlx5e_update_trust_state_hw (struct mlx5e_priv *priv,void *context) +{ +u8 *trust_state = context; +int err; + + err =mlx5_set_trust_state (priv->mdev, *trust_state); +if (err) +return err; + priv->dcbx_dp.trust_state = *trust_state; + +return 0 ; +} + +static int mlx5e_set_trust_state (struct mlx5e_priv *priv,u8 trust_state) {struct mlx5e_channels new_channels = {}; +bool reset_channels = true; +int err =0 ;mutex_lock (&priv->state_lock); new_channels.params = priv->channels.params; -mlx5e_trust_update_tx_min_inline_mode (priv, &new_channels.params); +mlx5e_params_calc_trust_tx_min_inline_mode (priv->mdev, &new_channels.params, + trust_state);if (!test_bit (MLX5E_STATE_OPENED , &priv->state)) { priv->channels.params = new_channels.params; - goto out; + reset_channels = false; }/* Skip if tx_min_inline is the same */ if (new_channels.params.tx_min_inline_mode == priv->channels.params.tx_min_inline_mode) - goto out; + reset_channels = false; -mlx5e_safe_switch_channels (priv, &new_channels,NULL ,NULL ); +if (reset_channels) + err =mlx5e_safe_switch_channels (priv, &new_channels, + mlx5e_update_trust_state_hw, + &trust_state); +else + err =mlx5e_update_trust_state_hw (priv, &trust_state); -out:mutex_unlock (&priv->state_lock); -} - -static int mlx5e_set_trust_state (struct mlx5e_priv *priv,u8 trust_state) -{ -int err; - - err =mlx5_set_trust_state (priv->mdev, trust_state); -if (err) -return err; - priv->dcbx_dp.trust_state = trust_state; -mlx5e_trust_update_sq_inline_mode (priv);return err; }
@@ -1171,7 +1181,8 @@ static int mlx5e_trust_initialize(struct mlx5e_priv *priv)if (err)return err; -mlx5e_trust_update_tx_min_inline_mode (priv, &priv->channels.params); +mlx5e_params_calc_trust_tx_min_inline_mode (priv->mdev, &priv->channels.params, + priv->dcbx_dp.trust_state); err =mlx5_query_dscp2prio (priv->mdev, priv->dcbx_dp.dscp2prio);if (err)
Signature · 1 line
2.24.1
PATCH 11/16 net/mlx5e: RX, Use indirect calls wrapper for posting descriptors
In reply to Saeed MahameedFrom: Tariq Toukan <[email protected]>
We can avoid an indirect call per NAPI cycle wrapping the RX descriptors posting call with the appropriate helper.
--- drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c +9 -2
@@ -31,6 +31,7 @@*/ #include <linux/irq.h> +#include <linux/indirect_call_wrapper.h> #include "en.h" #include "en/xdp.h" #include "en/xsk/rx.h"
@@ -99,7 +100,10 @@ static bool mlx5e_napi_xsk_post(struct mlx5e_xdpsq *xsksq, struct mlx5e_rq *xskr busy_xsk |=mlx5e_xsk_tx (xsksq,MLX5E_TX_XSK_POLL_BUDGET );mlx5e_xsk_update_tx_wakeup (xsksq); - xsk_rx_alloc_err = xskrq->post_wqes (xskrq); + xsk_rx_alloc_err =INDIRECT_CALL_2 (xskrq->post_wqes, + mlx5e_post_rx_mpwqes, + mlx5e_post_rx_wqes, + xskrq); busy_xsk |=mlx5e_xsk_update_rx_wakeup (xskrq, xsk_rx_alloc_err);return busy_xsk;
@@ -142,7 +146,10 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)mlx5e_poll_ico_cq (&c->icosq.cq); - busy |= rq->post_wqes (rq); + busy |=INDIRECT_CALL_2 (rq->post_wqes, + mlx5e_post_rx_mpwqes, + mlx5e_post_rx_wqes, + rq);if (xsk_open) {mlx5e_poll_ico_cq (&c->xskicosq.cq); busy |=mlx5e_poll_xdpsq_cq (&xsksq->cq);
Signature · 1 line
2.24.1
PATCH 12/16 net/mlx5e: RX, Use indirect calls wrapper for handling compressed completions
In reply to Saeed MahameedFrom: Tariq Toukan <[email protected]>
We can avoid an indirect call per compressed completion wrapping the completion handling call with the appropriate helper.
--- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +4 -2
@@ -158,7 +158,8 @@ static inline u32 mlx5e_decompress_cqes_cont(struct mlx5e_rq *rq,mlx5e_read_mini_arr_slot (wq, cqd, cqcc);mlx5e_decompress_cqe_no_hash (rq, wq, cqcc); - rq->handle_rx_cqe (rq, &cqd->title); +INDIRECT_CALL_2 (rq->handle_rx_cqe, mlx5e_handle_rx_cqe_mpwrq, + mlx5e_handle_rx_cqe, rq, &cqd->title); }mlx5e_cqes_update_owner (wq, cqcc - wq->cc); wq->cc = cqcc;
@@ -178,7 +179,8 @@ static inline u32 mlx5e_decompress_cqes_start(struct mlx5e_rq *rq,mlx5e_read_title_slot (rq, wq, cc);mlx5e_read_mini_arr_slot (wq, cqd, cc +1 );mlx5e_decompress_cqe (rq, wq, cc); - rq->handle_rx_cqe (rq, &cqd->title); +INDIRECT_CALL_2 (rq->handle_rx_cqe, mlx5e_handle_rx_cqe_mpwrq, + mlx5e_handle_rx_cqe, rq, &cqd->title); cqd->mini_arr_idx++;return mlx5e_decompress_cqes_cont (rq, wq,1 , budget_rem) -1 ;
Signature · 1 line
2.24.1
PATCH 13/16 Documentation: fix vxlan typo in mlx5.rst
In reply to Saeed MahameedFrom: Hans Wippel <[email protected]>
Fix a vxlan typo in the mlx5 driver documentation.
--- Documentation/networking/device_drivers/mellanox/mlx5.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/networking/device_drivers/mellanox/mlx5.rst +1 -1
@@ -101,7 +101,7 @@ Enabling the driver and kconfig options **External options** ( Choose if the corresponding mlx5 feature is required ) - CONFIG_PTP_1588_CLOCK: When chosen, mlx5 ptp support will be enabled -- CONFIG_VXLAN: When chosen, mlx5 vxaln support will be enabled. +- CONFIG_VXLAN: When chosen, mlx5 vxlan support will be enabled. - CONFIG_MLXFW: When chosen, mlx5 firmware flashing support will be enabled (via devlink and ethtool). Devlink info
Signature · 1 line
2.24.1
PATCH 14/16 net/mlx5: Fix header guard in rsc_dump.h
In reply to Saeed MahameedFrom: Nathan Chancellor <[email protected]>
Clang warns:
In file included from ../drivers/net/ethernet/mellanox/mlx5/core/main.c:73:
../drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.h:4:9: warning:
'__MLX5_RSC_DUMP_H' is used as a header guard here, followed by #define of a different macro [-Wheader-guard]
#ifndef __MLX5_RSC_DUMP_H
^~~~~~~~~~~~~~~~~
../drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.h:5:9: note:
'__MLX5_RSC_DUMP__H' is defined here; did you mean '__MLX5_RSC_DUMP_H'?
#define __MLX5_RSC_DUMP__H
^~~~~~~~~~~~~~~~~~
__MLX5_RSC_DUMP_H1 warning generated.
Make them match to get the intended behavior and remove the warning.
--- drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.h +1 -1
@@ -2,7 +2,7 @@/* Copyright (c) 2019 Mellanox Technologies. */ #ifndef __MLX5_RSC_DUMP_H -#define __MLX5_RSC_DUMP__H +#define __MLX5_RSC_DUMP_H#include <linux/mlx5/driver.h> #include "mlx5_core.h"
Signature · 1 line
2.24.1
PATCH 15/16 net/mlx5: sparse: warning: incorrect type in assignment
In reply to Saeed Mahameeddrivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c:191:13:
sparse: warning: incorrect type in assignment (different base types)
--- drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c +1 -1
@@ -188,7 +188,7 @@ static int mlx5_fw_tracer_create_mkey(struct mlx5_fw_tracer *tracer)MLX5_SET (create_mkey_in, in, translations_octword_actual_size,DIV_ROUND_UP (TRACER_BUFFER_PAGE_NUM ,2 )); - mtt = (u64 *)MLX5_ADDR_OF (create_mkey_in, in, klm_pas_mtt); + mtt = (__be64 *)MLX5_ADDR_OF (create_mkey_in, in, klm_pas_mtt);for (i =0 ; i <TRACER_BUFFER_PAGE_NUM ; i++) mtt[i] =cpu_to_be64 (tracer->buff.dma + i *PAGE_SIZE );
Signature · 1 line
2.24.1
PATCH 16/16 net/mlx5: sparse: warning: Using plain integer as NULL pointer
In reply to Saeed MahameedReturn NULL instead of 0.
--- drivers/net/ethernet/mellanox/mlx5/core/lib/dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/lib/dm.c +1 -1
@@ -21,7 +21,7 @@ struct mlx5_dm *mlx5_dm_create(struct mlx5_core_dev *dev)struct mlx5_dm *dm;if (!(MLX5_CAP_GEN_64 (dev, general_obj_types) &MLX5_GENERAL_OBJ_TYPES_CAP_SW_ICM )) -return 0 ; +return NULL ; dm =kzalloc (sizeof (*dm),GFP_KERNEL );if (!dm)
Signature · 1 line
2.24.1
David Miller
maintainerFrom: Saeed Mahameed <[email protected]>
Date: Tue, 25 Feb 2020 17:12:30 -0800
Quoted 5 lines
This series adds misc updates to mlx5 driver.
For more information please see tag log below.
Please pull and let me know if there is any problem.
Pulled, thanks Saeed.