mlx5 updates 2023-08-16
Subsystems (5)
From: Saeed Mahameed <[email protected]>
v1-v2:
- Toss patch #14: Convert PCI error values to generic errnos it will be sent via pci subsystem.
This series provides 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 cb39c35783f26892bb1a72b1115c94fa2e77f4c5:
pds_core: Fix some kernel-doc comments (2023-08-21 07:48:34 +0100)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-updates-2023-08-16
for you to fetch changes up to 7d7c6e8c5fe4e8cceea7f66e93cee1c951670836:
net/mlx5: Devcom, only use devcom after NULL check in mlx5_devcom_send_event() (2023-08-21 10:55:17 -0700)
----------------------------------------------------------------
mlx5-updates-2023-08-16
1) aRFS ethtool stats
Improve aRFS observability by adding new set of counters. Each Rx ring will have this set of counters listed below.
These counters are exposed through ethtool -S.
1.1) arfs_add: number of times a new rule has been created. 1.2) arfs_request_in: number of times a rule was requested to move from
its current Rx ring to a new Rx ring (incremented on the destination Rx ring).
1.3) arfs_request_out: number of times a rule was requested to move out
from its current Rx ring (incremented on source/current Rx ring).
1.4) arfs_expired: number of times a rule has been expired by the
kernel and removed from HW.
1.5) arfs_err: number of times a rule creation or modification has
failed.
2) Supporting inline WQE when possible in SW steering
3) Misc cleanups and fixups to net-next branch
----------------------------------------------------------------
Adham Faris (3):
net/mlx5e: aRFS, Prevent repeated kernel rule migrations requests net/mlx5e: aRFS, Warn if aRFS table does not exist for aRFS rule net/mlx5e: aRFS, Introduce ethtool stats
Colin Ian King (1):
net/mlx5e: Fix spelling mistake "Faided" -> "Failed"
Gal Pressman (1):
net/mlx5: Remove health syndrome enum duplication
Itamar Gozlan (1):
net/mlx5: DR, Supporting inline WQE when possible
Jiri Pirko (3):
net/mlx5: Call mlx5_esw_offloads_rep_load/unload() for uplink port directly net/mlx5: Remove VPORT_UPLINK handling from devlink_port.c net/mlx5: Rename devlink port ops struct for PFs/VFs
Li Zetao (1):
net/mlx5: Devcom, only use devcom after NULL check in mlx5_devcom_send_event()
Rahul Rameshbabu (1):
net/mlx5: Update dead links in Kconfig documentation
Saeed Mahameed (1):
net/mlx5: IRQ, consolidate irq and affinity mask allocation
Yevgeny Kliteynik (2):
net/mlx5: DR, Fix code indentation net/mlx5: DR, Remove unneeded local variable
.../ethernet/mellanox/mlx5/counters.rst | 23 ++++- .../ethernet/mellanox/mlx5/kconfig.rst | 14 +-- Documentation/networking/xfrm_device.rst | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c | 21 +++- drivers/net/ethernet/mellanox/mlx5/core/en_stats.c | 22 +++- drivers/net/ethernet/mellanox/mlx5/core/en_stats.h | 13 ++- .../ethernet/mellanox/mlx5/core/esw/devlink_port.c | 16 +-- .../net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.c | 2 +- .../ethernet/mellanox/mlx5/core/eswitch_offloads.c | 20 ++-- drivers/net/ethernet/mellanox/mlx5/core/health.c | 36 ++----- .../net/ethernet/mellanox/mlx5/core/lib/devcom.c | 3 +- drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c | 14 ++- .../mellanox/mlx5/core/steering/dr_action.c | 1 - .../ethernet/mellanox/mlx5/core/steering/dr_send.c | 115 ++++++++++++++++++--- .../ethernet/mellanox/mlx5/core/steering/fs_dr.c | 2 +- 15 files changed, 208 insertions(+), 95 deletions(-)
PATCH v2 1/14 net/mlx5e: aRFS, Prevent repeated kernel rule migrations requests
From: Adham Faris <[email protected]>
aRFS rule movement requests from one Rx ring to other Rx ring arrive from the kernel to ensure that packets are steered to the right Rx ring. In the time interval until satisfying such a request, several more requests might follow, for the same flow.
This patch detects and prevents repeated aRFS rules movement requests.
In mlx5e_rx_flow_steer() ndo, after finding the aRFS rule that have been requested to move by the kernel, check if it's already requested to move by calling work_busy(&arfs_rule->arfs_work) handler. IOW, if this request is pending to be executed (in the work queue) or it's executing now but hasn't finished yet, return current filter ID and don't issue a new transition work.
--- drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c +1 -1
@@ -740,7 +740,7 @@ int mlx5e_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,spin_lock_bh (&arfs->arfs_lock); arfs_rule =arfs_find_rule (arfs_t, &fk);if (arfs_rule) { -if (arfs_rule->rxq == rxq_index) { +if (arfs_rule->rxq == rxq_index ||work_busy (&arfs_rule->arfs_work)) {spin_unlock_bh (&arfs->arfs_lock);return arfs_rule->filter_id; }
Signature · 1 line
2.41.0
Re: [net-next V2 01/14] net/mlx5e: aRFS, Prevent repeated kernel rule migrations requests
This series was applied to netdev/net-next.git (main) by Saeed Mahameed <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Saeed Mahameed <[email protected]>:
Quoted 8 lines · On Mon, 21 Aug 2023 10:57:26 -0700 you wrote:
From: Adham Faris <[email protected]>
aRFS rule movement requests from one Rx ring to other Rx ring arrive from the kernel to ensure that packets are steered to the right Rx ring. In the time interval until satisfying such a request, several more requests might follow, for the same flow.
[...]
Here is the summary with links:
- [net-next,V2,01/14] net/mlx5e: aRFS, Prevent repeated kernel rule migrations requests
https://git.kernel.org/netdev/net-next/c/7a73cf0bf7f9 - [net-next,V2,02/14] net/mlx5e: aRFS, Warn if aRFS table does not exist for aRFS rule https://git.kernel.org/netdev/net-next/c/7653d8067245 - [net-next,V2,03/14] net/mlx5e: aRFS, Introduce ethtool stats https://git.kernel.org/netdev/net-next/c/f98e51585f2c - [net-next,V2,04/14] net/mlx5e: Fix spelling mistake "Faided" -> "Failed" https://git.kernel.org/netdev/net-next/c/d7cea02a1fac - [net-next,V2,05/14] net/mlx5: IRQ, consolidate irq and affinity mask allocation https://git.kernel.org/netdev/net-next/c/9e9ff54e63b4 - [net-next,V2,06/14] net/mlx5: DR, Fix code indentation https://git.kernel.org/netdev/net-next/c/f83e2d8aef4a - [net-next,V2,07/14] net/mlx5: DR, Remove unneeded local variable https://git.kernel.org/netdev/net-next/c/a15e472f8834 - [net-next,V2,08/14] net/mlx5: Remove health syndrome enum duplication https://git.kernel.org/netdev/net-next/c/ab943e2efd5d - [net-next,V2,09/14] net/mlx5: Update dead links in Kconfig documentation https://git.kernel.org/netdev/net-next/c/6c8f7c434487 - [net-next,V2,10/14] net/mlx5: Call mlx5_esw_offloads_rep_load/unload() for uplink port directly https://git.kernel.org/netdev/net-next/c/ba3d85f008f2 - [net-next,V2,11/14] net/mlx5: Remove VPORT_UPLINK handling from devlink_port.c https://git.kernel.org/netdev/net-next/c/52020903f35c - [net-next,V2,12/14] net/mlx5: Rename devlink port ops struct for PFs/VFs https://git.kernel.org/netdev/net-next/c/df3822f5808d - [net-next,V2,13/14] net/mlx5: DR, Supporting inline WQE when possible https://git.kernel.org/netdev/net-next/c/95c337cce0e1 - [net-next,V2,14/14] net/mlx5: Devcom, only use devcom after NULL check in mlx5_devcom_send_event() https://git.kernel.org/netdev/net-next/c/7d7c6e8c5fe4
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
PATCH v2 2/14 net/mlx5e: aRFS, Warn if aRFS table does not exist for aRFS rule
In reply to Saeed MahameedFrom: Adham Faris <[email protected]>
aRFS tables should be allocated and exist in advance. Driver shouldn't reach a point where it tries to add aRFS rule to table that does not exist.
Add warning if driver encounters such situation.
--- drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c +2 -0
@@ -519,6 +519,8 @@ static struct mlx5_flow_handle *arfs_add_rule(struct mlx5e_priv *priv, ntohs(tuple->etype)); arfs_table =arfs_get_table (arfs, tuple->ip_proto, tuple->etype);if (!arfs_table) { +WARN_ONCE (1 ,"arfs table does not exist for etype %u and ip_proto %u\n" , + tuple->etype, tuple->ip_proto); err = -EINVAL ; goto out; }
Signature · 1 line
2.41.0
PATCH v2 3/14 net/mlx5e: aRFS, Introduce ethtool stats
In reply to Saeed MahameedFrom: Adham Faris <[email protected]>
Improve aRFS observability by adding new set of counters. Each Rx ring will have this set of counters listed below.
These counters are exposed through ethtool -S.
1) arfs_add: number of times a new rule has been created.
2) arfs_request_in: number of times a rule was requested to move from its current Rx ring to a new Rx ring (incremented on the destination Rx ring).
3) arfs_request_out: number of times a rule was requested to move out from its current Rx ring (incremented on source/current Rx ring).
4) arfs_expired: number of times a rule has been expired by the kernel and removed from HW.
5) arfs_err: number of times a rule creation or modification has failed.
This patch removes rx[i]_xsk_arfs_err counter and its documentation in mlx5/counters.rst since aRFS activity does not occur in XSK RQ's.
--- .../ethernet/mellanox/mlx5/counters.rst | 23 +++++++++++++++---- .../net/ethernet/mellanox/mlx5/core/en_arfs.c | 17 +++++++++++--- .../ethernet/mellanox/mlx5/core/en_stats.c | 22 ++++++++++++++---- .../ethernet/mellanox/mlx5/core/en_stats.h | 13 ++++++++++- 4 files changed, 62 insertions(+), 13 deletions(-)
Documentation/networking/device_drivers/ethernet/mellanox/mlx5/counters.rst +18 -5
@@ -346,6 +346,24 @@ the software port. - The number of receive packets with CQE compression on ring i [#accel]_. - Acceleration + * - `rx[i]_arfs_add` + - The number of aRFS flow rules added to the device for direct RQ steering + on ring i [#accel]_. + - Acceleration + + * - `rx[i]_arfs_request_in` + - Number of flow rules that have been requested to move into ring i for + direct RQ steering [#accel]_. + - Acceleration + + * - `rx[i]_arfs_request_out` + - Number of flow rules that have been requested to move out of ring i [#accel]_. + - Acceleration + + * - `rx[i]_arfs_expired` + - Number of flow rules that have been expired and removed [#accel]_. + - Acceleration + * - `rx[i]_arfs_err` - Number of flow rules that failed to be added to the flow table. - Error
@@ -445,11 +463,6 @@ the software port. context. - Error - * - `rx[i]_xsk_arfs_err` - - aRFS (accelerated Receive Flow Steering) does not occur in the XSK RQ - context, so this counter should never increment. - - Error - * - `rx[i]_xdp_tx_xmit` - The number of packets forwarded back to the port due to XDP program `XDP_TX` action (bouncing). these packets are not counted by other
drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c +14 -3
@@ -432,8 +432,10 @@ static void arfs_may_expire_flow(struct mlx5e_priv *priv) }spin_unlock_bh (&arfs->arfs_lock);hlist_for_each_entry_safe (arfs_rule, htmp, &del_list, hlist) { -if (arfs_rule->rule) +if (arfs_rule->rule) {mlx5_del_flow_rules (arfs_rule->rule); + priv->channel_stats[arfs_rule->rxq]->rq.arfs_expired++; + }hlist_del (&arfs_rule->hlist);kfree (arfs_rule); }
@@ -509,6 +511,7 @@ static struct mlx5_flow_handle *arfs_add_rule(struct mlx5e_priv *priv, spec =kvzalloc (sizeof (*spec),GFP_KERNEL );if (!spec) { + priv->channel_stats[arfs_rule->rxq]->rq.arfs_err++; err = -ENOMEM ; goto out; }
@@ -602,9 +605,11 @@ static void arfs_modify_rule_rq(struct mlx5e_priv *priv, dst.type =MLX5_FLOW_DESTINATION_TYPE_TIR ; dst.tir_num =mlx5e_rx_res_get_tirn_direct (priv->rx_res, rxq); err =mlx5_modify_rule_destination (rule, &dst,NULL ); -if (err) +if (err) { + priv->channel_stats[rxq]->rq.arfs_err++;netdev_warn (priv->netdev,"Failed to modify aRFS rule destination to rq=%d\n" , rxq); + } }static void arfs_handle_work (struct work_struct *work)
@@ -634,6 +639,7 @@ static void arfs_handle_work(struct work_struct *work)if (IS_ERR (rule)) goto out; arfs_rule->rule = rule; + priv->channel_stats[arfs_rule->rxq]->rq.arfs_add++; }else {arfs_modify_rule_rq (priv, arfs_rule->rule, arfs_rule->rxq);
@@ -652,8 +658,10 @@ static struct arfs_rule *arfs_alloc_rule(struct mlx5e_priv *priv,struct arfs_tuple *tuple; rule =kzalloc (sizeof (*rule),GFP_ATOMIC ); -if (!rule) +if (!rule) { + priv->channel_stats[rxq]->rq.arfs_err++;return NULL ; + } rule->priv = priv; rule->rxq = rxq;
@@ -746,6 +754,9 @@ int mlx5e_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,spin_unlock_bh (&arfs->arfs_lock);return arfs_rule->filter_id; } + + priv->channel_stats[rxq_index]->rq.arfs_request_in++; + priv->channel_stats[arfs_rule->rxq]->rq.arfs_request_out++; arfs_rule->rxq = rxq_index; }else { arfs_rule =arfs_alloc_rule (priv, arfs_t, &fk, rxq_index, flow_id);
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +18 -4
@@ -180,7 +180,13 @@ static const struct counter_desc sw_stats_desc[] = { { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cqe_compress_blks) }, { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cqe_compress_pkts) }, { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_congst_umr) }, +#ifdef CONFIG_MLX5_EN_ARFS + { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_arfs_add) }, + { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_arfs_request_in) }, + { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_arfs_request_out) }, + { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_arfs_expired) }, { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_arfs_err) }, +#endif { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_recover) }, #ifdef CONFIG_PAGE_POOL_STATS { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_pp_alloc_fast) },
@@ -231,7 +237,6 @@ static const struct counter_desc sw_stats_desc[] = { { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xsk_cqe_compress_blks) }, { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xsk_cqe_compress_pkts) }, { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xsk_congst_umr) }, - { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xsk_arfs_err) }, { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_xsk_xmit) }, { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_xsk_mpwqe) }, { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_xsk_inlnw) },
@@ -321,7 +326,6 @@ static void mlx5e_stats_grp_sw_update_stats_xskrq(struct mlx5e_sw_stats *s, s->rx_xsk_cqe_compress_blks += xskrq_stats->cqe_compress_blks; s->rx_xsk_cqe_compress_pkts += xskrq_stats->cqe_compress_pkts; s->rx_xsk_congst_umr += xskrq_stats->congst_umr; - s->rx_xsk_arfs_err += xskrq_stats->arfs_err; } static void mlx5e_stats_grp_sw_update_stats_rq_stats(struct mlx5e_sw_stats *s,
@@ -354,7 +358,13 @@ static void mlx5e_stats_grp_sw_update_stats_rq_stats(struct mlx5e_sw_stats *s, s->rx_cqe_compress_blks += rq_stats->cqe_compress_blks; s->rx_cqe_compress_pkts += rq_stats->cqe_compress_pkts; s->rx_congst_umr += rq_stats->congst_umr; +#ifdef CONFIG_MLX5_EN_ARFS + s->rx_arfs_add += rq_stats->arfs_add; + s->rx_arfs_request_in += rq_stats->arfs_request_in; + s->rx_arfs_request_out += rq_stats->arfs_request_out; + s->rx_arfs_expired += rq_stats->arfs_expired; s->rx_arfs_err += rq_stats->arfs_err; +#endif s->rx_recover += rq_stats->recover;#ifdef CONFIG_PAGE_POOL_STATS s->rx_pp_alloc_fast += rq_stats->pp_alloc_fast;
@@ -1990,7 +2000,13 @@ static const struct counter_desc rq_stats_desc[] = { { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cqe_compress_blks) }, { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cqe_compress_pkts) }, { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, congst_umr) }, +#ifdef CONFIG_MLX5_EN_ARFS + { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, arfs_add) }, + { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, arfs_request_in) }, + { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, arfs_request_out) }, + { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, arfs_expired) }, { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, arfs_err) }, +#endif { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, recover) }, #ifdef CONFIG_PAGE_POOL_STATS { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, pp_alloc_fast) },
@@ -2092,7 +2108,6 @@ static const struct counter_desc xskrq_stats_desc[] = { { MLX5E_DECLARE_XSKRQ_STAT(struct mlx5e_rq_stats, cqe_compress_blks) }, { MLX5E_DECLARE_XSKRQ_STAT(struct mlx5e_rq_stats, cqe_compress_pkts) }, { MLX5E_DECLARE_XSKRQ_STAT(struct mlx5e_rq_stats, congst_umr) }, - { MLX5E_DECLARE_XSKRQ_STAT(struct mlx5e_rq_stats, arfs_err) }, }; static const struct counter_desc xsksq_stats_desc[] = {
@@ -2168,7 +2183,6 @@ static const struct counter_desc ptp_rq_stats_desc[] = { { MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, cqe_compress_blks) }, { MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, cqe_compress_pkts) }, { MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, congst_umr) }, - { MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, arfs_err) }, { MLX5E_DECLARE_PTP_RQ_STAT(struct mlx5e_rq_stats, recover) }, };
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +12 -1
@@ -194,7 +194,13 @@ struct mlx5e_sw_stats {u64 rx_cqe_compress_blks;u64 rx_cqe_compress_pkts;u64 rx_congst_umr; +#ifdef CONFIG_MLX5_EN_ARFS +u64 rx_arfs_add; +u64 rx_arfs_request_in; +u64 rx_arfs_request_out; +u64 rx_arfs_expired;u64 rx_arfs_err; +#endif u64 rx_recover;u64 ch_events;u64 ch_poll;
@@ -256,7 +262,6 @@ struct mlx5e_sw_stats {u64 rx_xsk_cqe_compress_blks;u64 rx_xsk_cqe_compress_pkts;u64 rx_xsk_congst_umr; -u64 rx_xsk_arfs_err;u64 tx_xsk_xmit;u64 tx_xsk_mpwqe;u64 tx_xsk_inlnw;
@@ -358,7 +363,13 @@ struct mlx5e_rq_stats {u64 cqe_compress_blks;u64 cqe_compress_pkts;u64 congst_umr; +#ifdef CONFIG_MLX5_EN_ARFS +u64 arfs_add; +u64 arfs_request_in; +u64 arfs_request_out; +u64 arfs_expired;u64 arfs_err; +#endif u64 recover;#ifdef CONFIG_PAGE_POOL_STATS u64 pp_alloc_fast;
Signature · 1 line
2.41.0
PATCH v2 4/14 net/mlx5e: Fix spelling mistake "Faided" -> "Failed"
In reply to Saeed MahameedFrom: Colin Ian King <[email protected]>
There is a spelling mistake in a warning message. Fix it.
--- drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.c +1 -1
@@ -316,7 +316,7 @@ void mlx5_esw_ipsec_restore_dest_uplink(struct mlx5_core_dev *mdev) err =mlx5_esw_ipsec_modify_flow_dests (esw, flow);if (err)mlx5_core_warn_once (mdev, -"Faided to modify flow dests for IPsec" ); +"Failed to modify flow dests for IPsec" ); }rhashtable_walk_stop (&iter);rhashtable_walk_exit (&iter);
Signature · 1 line
2.41.0
PATCH v2 5/14 net/mlx5: IRQ, consolidate irq and affinity mask allocation
In reply to Saeed MahameedFrom: Saeed Mahameed <[email protected]>
Consolidate the mlx5_irq and mlx5_irq->mask allocation, to simplify error flows and to match the dealloctation sequence @irq_release for symmetry.
--- drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c +6 -8
@@ -259,8 +259,11 @@ struct mlx5_irq *mlx5_irq_alloc(struct mlx5_irq_pool *pool, int i,int err; irq =kzalloc (sizeof (*irq),GFP_KERNEL ); -if (!irq) +if (!irq || !zalloc_cpumask_var (&irq->mask,GFP_KERNEL )) { +kfree (irq);return ERR_PTR (-ENOMEM ); + } +if (!i || !pci_msix_can_alloc_dyn (dev->pdev)) {/* The vector at index 0 is always statically allocated. If * dynamic irq is not supported all vectors are statically
@@ -297,11 +300,7 @@ struct mlx5_irq *mlx5_irq_alloc(struct mlx5_irq_pool *pool, int i,mlx5_core_err (dev,"Failed to request irq. err = %d\n" , err); goto err_req_irq; } -if (!zalloc_cpumask_var (&irq->mask,GFP_KERNEL )) { -mlx5_core_warn (dev,"zalloc_cpumask_var failed\n" ); - err = -ENOMEM ; - goto err_cpumask; - } +if (af_desc) {cpumask_copy (irq->mask, &af_desc->mask);irq_set_affinity_and_hint (irq->map.virq, irq->mask);
@@ -319,8 +318,6 @@ struct mlx5_irq *mlx5_irq_alloc(struct mlx5_irq_pool *pool, int i, err_xa:if (af_desc)irq_update_affinity_hint (irq->map.virq,NULL ); -free_cpumask_var (irq->mask); -err_cpumask:free_irq (irq->map.virq, &irq->nh); err_req_irq: #ifdef CONFIG_RFS_ACCEL
@@ -333,6 +330,7 @@ struct mlx5_irq *mlx5_irq_alloc(struct mlx5_irq_pool *pool, int i,if (i &&pci_msix_can_alloc_dyn (dev->pdev))pci_msix_free_irq (dev->pdev, irq->map); err_alloc_irq: +free_cpumask_var (irq->mask);kfree (irq);return ERR_PTR (err); }
Signature · 1 line
2.41.0
PATCH v2 6/14 net/mlx5: DR, Fix code indentation
In reply to Saeed MahameedFrom: Yevgeny Kliteynik <[email protected]>
--- drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c +1 -1
@@ -336,7 +336,7 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns,if (fte->action.pkt_reformat->owner ==MLX5_FLOW_RESOURCE_OWNER_FW ) { err = -EINVAL ;mlx5dr_err (domain,"FW-owned reformat can't be used in SW rule\n" ); - goto free_actions; + goto free_actions; } is_decap = fte->action.pkt_reformat->reformat_type ==
Signature · 1 line
2.41.0
PATCH v2 7/14 net/mlx5: DR, Remove unneeded local variable
In reply to Saeed MahameedFrom: Yevgeny Kliteynik <[email protected]>
Remove local variable that is already defined outside of the scope of this block.
--- drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c +0 -1
@@ -1422,7 +1422,6 @@ dr_action_create_reformat_action(struct mlx5dr_domain *dmn,case DR_ACTION_TYP_TNL_L3_TO_L2 : {u8 *hw_actions; -int ret; hw_actions =kzalloc (DR_ACTION_CACHE_LINE_SIZE ,GFP_KERNEL );if (!hw_actions)
Signature · 1 line
2.41.0
PATCH v2 8/14 net/mlx5: Remove health syndrome enum duplication
In reply to Saeed MahameedFrom: Gal Pressman <[email protected]>
Health syndrome enum values were duplicated in mlx5_ifc and health.c, the correct place for them is mlx5_ifc.
--- .../net/ethernet/mellanox/mlx5/core/health.c | 36 ++++++------------- 1 file changed, 11 insertions(+), 25 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/health.c +11 -25
@@ -49,20 +49,6 @@ enum { MAX_MISSES = 3, }; -enum { -MLX5_HEALTH_SYNDR_FW_ERR =0x1 , -MLX5_HEALTH_SYNDR_IRISC_ERR =0x7 , -MLX5_HEALTH_SYNDR_HW_UNRECOVERABLE_ERR =0x8 , -MLX5_HEALTH_SYNDR_CRC_ERR =0x9 , -MLX5_HEALTH_SYNDR_FETCH_PCI_ERR =0xa , -MLX5_HEALTH_SYNDR_HW_FTL_ERR =0xb , -MLX5_HEALTH_SYNDR_ASYNC_EQ_OVERRUN_ERR =0xc , -MLX5_HEALTH_SYNDR_EQ_ERR =0xd , -MLX5_HEALTH_SYNDR_EQ_INV =0xe , -MLX5_HEALTH_SYNDR_FFSER_ERR =0xf , -MLX5_HEALTH_SYNDR_HIGH_TEMP =0x10 -}; -enum {MLX5_DROP_HEALTH_WORK , };
@@ -357,27 +343,27 @@ static int mlx5_health_try_recover(struct mlx5_core_dev *dev)static const char *hsynd_str (u8 synd) {switch (synd) { -case MLX5_HEALTH_SYNDR_FW_ERR : +case MLX5_INITIAL_SEG_HEALTH_SYNDROME_FW_INTERNAL_ERR :return "firmware internal error" ; -case MLX5_HEALTH_SYNDR_IRISC_ERR : +case MLX5_INITIAL_SEG_HEALTH_SYNDROME_DEAD_IRISC :return "irisc not responding" ; -case MLX5_HEALTH_SYNDR_HW_UNRECOVERABLE_ERR : +case MLX5_INITIAL_SEG_HEALTH_SYNDROME_HW_FATAL_ERR :return "unrecoverable hardware error" ; -case MLX5_HEALTH_SYNDR_CRC_ERR : +case MLX5_INITIAL_SEG_HEALTH_SYNDROME_FW_CRC_ERR :return "firmware CRC error" ; -case MLX5_HEALTH_SYNDR_FETCH_PCI_ERR : +case MLX5_INITIAL_SEG_HEALTH_SYNDROME_ICM_FETCH_PCI_ERR :return "ICM fetch PCI error" ; -case MLX5_HEALTH_SYNDR_HW_FTL_ERR : +case MLX5_INITIAL_SEG_HEALTH_SYNDROME_ICM_PAGE_ERR :return "HW fatal error\n" ; -case MLX5_HEALTH_SYNDR_ASYNC_EQ_OVERRUN_ERR : +case MLX5_INITIAL_SEG_HEALTH_SYNDROME_ASYNCHRONOUS_EQ_BUF_OVERRUN :return "async EQ buffer overrun" ; -case MLX5_HEALTH_SYNDR_EQ_ERR : +case MLX5_INITIAL_SEG_HEALTH_SYNDROME_EQ_IN_ERR :return "EQ error" ; -case MLX5_HEALTH_SYNDR_EQ_INV : +case MLX5_INITIAL_SEG_HEALTH_SYNDROME_EQ_INV :return "Invalid EQ referenced" ; -case MLX5_HEALTH_SYNDR_FFSER_ERR : +case MLX5_INITIAL_SEG_HEALTH_SYNDROME_FFSER_ERR :return "FFSER error" ; -case MLX5_HEALTH_SYNDR_HIGH_TEMP : +case MLX5_INITIAL_SEG_HEALTH_SYNDROME_HIGH_TEMP_ERR :return "High temperature" ;default :return "unrecognized error" ;
Signature · 1 line
2.41.0
PATCH v2 9/14 net/mlx5: Update dead links in Kconfig documentation
In reply to Saeed MahameedFrom: Rahul Rameshbabu <[email protected]>
Point to NVIDIA documentation for device specific information now that the Mellanox documentation site is deprecated. Refer to kernel documentation sources for generic information not specific to mlx5 devices.
--- .../ethernet/mellanox/mlx5/kconfig.rst | 14 +++++++------- Documentation/networking/xfrm_device.rst | 1 + 2 files changed, 8 insertions(+), 7 deletions(-)
Documentation/networking/device_drivers/ethernet/mellanox/mlx5/kconfig.rst +7 -7
@@ -36,7 +36,7 @@ Enabling the driver and kconfig options **CONFIG_MLX5_CORE_EN_DCB=(y/n)**: -| Enables `Data Center Bridging (DCB) Support <https://community.mellanox.com/s/article/howto-auto-config-pfc-and-ets-on-connectx-4-via-lldp-dcbx>`_. +| Enables `Data Center Bridging (DCB) Support <https://enterprise-support.nvidia.com/s/article/howto-auto-config-pfc-and-ets-on-connectx-4-via-lldp-dcbx>`_. **CONFIG_MLX5_CORE_IPOIB=(y/n)**
@@ -59,12 +59,12 @@ Enabling the driver and kconfig options **CONFIG_MLX5_EN_ARFS=(y/n)** | Enables Hardware-accelerated receive flow steering (arfs) support, and ntuple filtering. -| https://community.mellanox.com/s/article/howto-configure-arfs-on-connectx-4 +| https://enterprise-support.nvidia.com/s/article/howto-configure-arfs-on-connectx-4 **CONFIG_MLX5_EN_IPSEC=(y/n)** -| Enables `IPSec XFRM cryptography-offload acceleration <https://support.mellanox.com/s/article/ConnectX-6DX-Bluefield-2-IPsec-HW-Full-Offload-Configuration-Guide>`_. +| Enables :ref:`IPSec XFRM cryptography-offload acceleration <xfrm_device>`. **CONFIG_MLX5_EN_MACSEC=(y/n)**
@@ -87,8 +87,8 @@ Enabling the driver and kconfig options | Ethernet SRIOV E-Switch support in ConnectX NIC. E-Switch provides internal SRIOV packet steering | and switching for the enabled VFs and PF in two available modes: -| 1) `Legacy SRIOV mode (L2 mac vlan steering based) <https://community.mellanox.com/s/article/howto-configure-sr-iov-for-connectx-4-connectx-5-with-kvm--ethernet-x>`_. -| 2) `Switchdev mode (eswitch offloads) <https://www.mellanox.com/related-docs/prod_software/ASAP2_Hardware_Offloading_for_vSwitches_User_Manual_v4.4.pdf>`_. +| 1) `Legacy SRIOV mode (L2 mac vlan steering based) <https://enterprise-support.nvidia.com/s/article/HowTo-Configure-SR-IOV-for-ConnectX-4-ConnectX-5-ConnectX-6-with-KVM-Ethernet>`_. +| 2) :ref:`Switchdev mode (eswitch offloads) <switchdev>`. **CONFIG_MLX5_FPGA=(y/n)**
@@ -101,13 +101,13 @@ Enabling the driver and kconfig options **CONFIG_MLX5_INFINIBAND=(y/n/m)** (module mlx5_ib.ko) -| Provides low-level InfiniBand/RDMA and `RoCE <https://community.mellanox.com/s/article/recommended-network-configuration-examples-for-roce-deployment>`_ support. +| Provides low-level InfiniBand/RDMA and `RoCE <https://enterprise-support.nvidia.com/s/article/recommended-network-configuration-examples-for-roce-deployment>`_ support. **CONFIG_MLX5_MPFS=(y/n)** | Ethernet Multi-Physical Function Switch (MPFS) support in ConnectX NIC. -| MPFs is required for when `Multi-Host <http://www.mellanox.com/page/multihost>`_ configuration is enabled to allow passing +| MPFs is required for when `Multi-Host <https://www.nvidia.com/en-us/networking/multi-host/>`_ configuration is enabled to allow passing | user configured unicast MAC addresses to the requesting PF.
Documentation/networking/xfrm_device.rst +1 -0
@@ -1,4 +1,5 @@ .. SPDX-License-Identifier: GPL-2.0 +.. _xfrm_device: =============================================== XFRM device - offloading the IPsec computations
Signature · 1 line
2.41.0
PATCH v2 10/14 net/mlx5: Call mlx5_esw_offloads_rep_load/unload() for uplink port directly
In reply to Saeed MahameedFrom: Jiri Pirko <[email protected]>
For uplink port, mlx5_esw_offloads_load/unload_rep() are currently called. There are 2 check inside, which effectively make the functions a simple wrappers of mlx5_esw_offloads_rep_load/unload() for uplink port. So avoid one check and indirection and call mlx5_esw_offloads_rep_load/unload() for uplink port directly.
--- .../mellanox/mlx5/core/eswitch_offloads.c | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +8 -12
@@ -2542,11 +2542,9 @@ int mlx5_esw_offloads_load_rep(struct mlx5_eswitch *esw, u16 vport_num)if (esw->mode !=MLX5_ESWITCH_OFFLOADS )return 0 ; -if (vport_num !=MLX5_VPORT_UPLINK ) { - err =mlx5_esw_offloads_devlink_port_register (esw, vport_num); -if (err) -return err; - } + err =mlx5_esw_offloads_devlink_port_register (esw, vport_num); +if (err) +return err; err =mlx5_esw_offloads_rep_load (esw, vport_num);if (err)
@@ -2554,8 +2552,7 @@ int mlx5_esw_offloads_load_rep(struct mlx5_eswitch *esw, u16 vport_num)return err; load_err: -if (vport_num !=MLX5_VPORT_UPLINK ) -mlx5_esw_offloads_devlink_port_unregister (esw, vport_num); +mlx5_esw_offloads_devlink_port_unregister (esw, vport_num);return err; }
@@ -2566,8 +2563,7 @@ void mlx5_esw_offloads_unload_rep(struct mlx5_eswitch *esw, u16 vport_num)mlx5_esw_offloads_rep_unload (esw, vport_num); -if (vport_num !=MLX5_VPORT_UPLINK ) -mlx5_esw_offloads_devlink_port_unregister (esw, vport_num); +mlx5_esw_offloads_devlink_port_unregister (esw, vport_num); } static int esw_set_slave_root_fdb(struct mlx5_core_dev *master,
@@ -3471,7 +3467,7 @@ int esw_offloads_enable(struct mlx5_eswitch *esw) vport->info.link_state =MLX5_VPORT_ADMIN_STATE_DOWN ;/* Uplink vport rep must load first. */ - err =mlx5_esw_offloads_load_rep (esw,MLX5_VPORT_UPLINK ); + err =mlx5_esw_offloads_rep_load (esw,MLX5_VPORT_UPLINK );if (err) goto err_uplink;
@@ -3482,7 +3478,7 @@ int esw_offloads_enable(struct mlx5_eswitch *esw)return 0 ; err_vports: -mlx5_esw_offloads_unload_rep (esw,MLX5_VPORT_UPLINK ); +mlx5_esw_offloads_rep_unload (esw,MLX5_VPORT_UPLINK ); err_uplink:esw_offloads_steering_cleanup (esw); err_steering_init:
@@ -3520,7 +3516,7 @@ static int esw_offloads_stop(struct mlx5_eswitch *esw,void esw_offloads_disable (struct mlx5_eswitch *esw) {mlx5_eswitch_disable_pf_vf_vports (esw); -mlx5_esw_offloads_unload_rep (esw,MLX5_VPORT_UPLINK ); +mlx5_esw_offloads_rep_unload (esw,MLX5_VPORT_UPLINK );esw_set_passing_vport_metadata (esw, false);esw_offloads_steering_cleanup (esw);mapping_destroy (esw->offloads.reg_c0_obj_pool);
Signature · 1 line
2.41.0
PATCH v2 11/14 net/mlx5: Remove VPORT_UPLINK handling from devlink_port.c
In reply to Saeed MahameedFrom: Jiri Pirko <[email protected]>
It is not possible that the functions in devlink_port.c are called for uplink port. Remove this leftover code.
--- .../ethernet/mellanox/mlx5/core/esw/devlink_port.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/esw/devlink_port.c +2 -10
@@ -16,8 +16,7 @@ mlx5_esw_get_port_parent_id(struct mlx5_core_dev *dev, struct netdev_phys_item_istatic bool mlx5_esw_devlink_port_supported (struct mlx5_eswitch *esw,u16 vport_num) { -return vport_num ==MLX5_VPORT_UPLINK || - (mlx5_core_is_ecpf (esw->dev) && vport_num ==MLX5_VPORT_PF ) || +return (mlx5_core_is_ecpf (esw->dev) && vport_num ==MLX5_VPORT_PF ) ||mlx5_eswitch_is_vf_vport (esw, vport_num) ||mlx5_core_is_ec_vf_vport (esw->dev, vport_num); }
@@ -25,7 +24,6 @@ static bool mlx5_esw_devlink_port_supported(struct mlx5_eswitch *esw, u16 vport_static struct devlink_port *mlx5_esw_dl_port_alloc (struct mlx5_eswitch *esw,u16 vport_num) {struct mlx5_core_dev *dev = esw->dev; -struct devlink_port_attrs attrs = {};struct netdev_phys_item_id ppid = {};struct devlink_port *dl_port;u32 controller_num =0 ;
@@ -42,13 +40,7 @@ static struct devlink_port *mlx5_esw_dl_port_alloc(struct mlx5_eswitch *esw, u16if (external) controller_num = dev->priv.eswitch->offloads.host_number +1 ; -if (vport_num ==MLX5_VPORT_UPLINK ) { - attrs.flavour =DEVLINK_PORT_FLAVOUR_PHYSICAL ; - attrs.phys.port_number = pfnum; -memcpy (attrs.switch_id.id, ppid.id, ppid.id_len); - attrs.switch_id.id_len = ppid.id_len; -devlink_port_attrs_set (dl_port, &attrs); - }else if (vport_num ==MLX5_VPORT_PF ) { +if (vport_num ==MLX5_VPORT_PF ) {memcpy (dl_port->attrs.switch_id.id, ppid.id, ppid.id_len); dl_port->attrs.switch_id.id_len = ppid.id_len;devlink_port_attrs_pci_pf_set (dl_port, controller_num, pfnum, external);
Signature · 1 line
2.41.0
PATCH v2 12/14 net/mlx5: Rename devlink port ops struct for PFs/VFs
In reply to Saeed MahameedFrom: Jiri Pirko <[email protected]>
As this struct is only used for devlink ports created for PF/VF, add it to the name of the variable to distinguish from the SF related ops struct.
--- drivers/net/ethernet/mellanox/mlx5/core/esw/devlink_port.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/esw/devlink_port.c +2 -2
@@ -63,7 +63,7 @@ static void mlx5_esw_dl_port_free(struct devlink_port *dl_port)kfree (dl_port); } -static const struct devlink_port_ops mlx5_esw_dl_port_ops = { +static const struct devlink_port_ops mlx5_esw_pf_vf_dl_port_ops = { .port_fn_hw_addr_get = mlx5_devlink_port_fn_hw_addr_get, .port_fn_hw_addr_set = mlx5_devlink_port_fn_hw_addr_set, .port_fn_roce_get = mlx5_devlink_port_fn_roce_get,
@@ -95,7 +95,7 @@ int mlx5_esw_offloads_devlink_port_register(struct mlx5_eswitch *esw, u16 vport_ devlink =priv_to_devlink (dev); dl_port_index =mlx5_esw_vport_to_devlink_port_index (dev, vport_num); err =devl_port_register_with_ops (devlink, dl_port, dl_port_index, - &mlx5_esw_dl_port_ops); + &mlx5_esw_pf_vf_dl_port_ops);if (err) goto reg_err;
Signature · 1 line
2.41.0
PATCH v2 13/14 net/mlx5: DR, Supporting inline WQE when possible
In reply to Saeed MahameedFrom: Itamar Gozlan <[email protected]>
In WQE (Work Queue Entry), the two types of data segments memories are pointers and inline data, where inline data is passed directly as part of the WQE.
For software steering, the maximal inline size should be less than 2*MLX5_SEND_WQE_BB, i.e., the potential data must fit with the required inline WQE headers.
Two consecutive blocks (MLX5_SEND_WQE_BB) are not guaranteed to reside on the same memory page. Hence, writes to MLX5_SEND_WQE_BB should be done separately, i.e., each MLX5_SEND_WQE_BB should be obtained using the mlx5_wq_cyc_get_wqe macro.
--- .../mellanox/mlx5/core/steering/dr_send.c | 115 ++++++++++++++++-- 1 file changed, 102 insertions(+), 13 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c +102 -13
@@ -52,6 +52,7 @@ struct dr_qp_init_attr {u32 cqn;u32 pdn;u32 max_send_wr; +u32 max_send_sge;struct mlx5_uars_page *uar; u8 isolate_vl_tc:1; };
@@ -246,6 +247,37 @@ static int dr_poll_cq(struct mlx5dr_cq *dr_cq, int ne)return err ==CQ_POLL_ERR ? err : npolled; } +static int dr_qp_get_args_update_send_wqe_size (struct dr_qp_init_attr *attr) +{ +return roundup_pow_of_two (sizeof (struct mlx5_wqe_ctrl_seg ) + +sizeof (struct mlx5_wqe_flow_update_ctrl_seg ) + +sizeof (struct mlx5_wqe_header_modify_argument_update_seg )); +} + +/* We calculate for specific RC QP with the required functionality */ +static int dr_qp_calc_rc_send_wqe (struct dr_qp_init_attr *attr) +{ +int update_arg_size; +int inl_size =0 ; +int tot_size; +int size; + + update_arg_size =dr_qp_get_args_update_send_wqe_size (attr); + + size =sizeof (struct mlx5_wqe_ctrl_seg ) + +sizeof (struct mlx5_wqe_raddr_seg ); + inl_size = size +ALIGN (sizeof (struct mlx5_wqe_inline_seg ) + +DR_STE_SIZE ,16 ); + + size += attr->max_send_sge *sizeof (struct mlx5_wqe_data_seg ); + + size =max (size, update_arg_size); + + tot_size =max (size, inl_size); + +return ALIGN (tot_size,MLX5_SEND_WQE_BB ); +} +static struct mlx5dr_qp *dr_create_rc_qp (struct mlx5_core_dev *mdev,struct dr_qp_init_attr *attr) {
@@ -253,6 +285,7 @@ static struct mlx5dr_qp *dr_create_rc_qp(struct mlx5_core_dev *mdev,u32 temp_qpc[MLX5_ST_SZ_DW (qpc)] = {};struct mlx5_wq_param wqp;struct mlx5dr_qp *dr_qp; +int wqe_size;int inlen;void *qpc;void *in;
@@ -332,6 +365,15 @@ static struct mlx5dr_qp *dr_create_rc_qp(struct mlx5_core_dev *mdev,if (err) goto err_in; dr_qp->uar = attr->uar; + wqe_size =dr_qp_calc_rc_send_wqe (attr); + dr_qp->max_inline_data =min (wqe_size - + (sizeof (struct mlx5_wqe_ctrl_seg ) + +sizeof (struct mlx5_wqe_raddr_seg ) + +sizeof (struct mlx5_wqe_inline_seg )), + (2 *MLX5_SEND_WQE_BB - + (sizeof (struct mlx5_wqe_ctrl_seg ) + +sizeof (struct mlx5_wqe_raddr_seg ) + +sizeof (struct mlx5_wqe_inline_seg ))));return dr_qp;
@@ -395,8 +437,48 @@ dr_rdma_handle_flow_access_arg_segments(struct mlx5_wqe_ctrl_seg *wq_ctrl,MLX5_SEND_WQE_DS ; } +static int dr_set_data_inl_seg (struct mlx5dr_qp *dr_qp, +struct dr_data_seg *data_seg,void *wqe) +{ +int inline_header_size =sizeof (struct mlx5_wqe_ctrl_seg ) + +sizeof (struct mlx5_wqe_raddr_seg ) + +sizeof (struct mlx5_wqe_inline_seg ); +struct mlx5_wqe_inline_seg *seg; +int left_space; +int inl =0 ; +void *addr; +int len; +int idx; + + seg = wqe; + wqe +=sizeof (*seg); + addr = (void *)(unsigned long )(data_seg->addr); + len = data_seg->length; + inl += len; + left_space =MLX5_SEND_WQE_BB - inline_header_size; + +if (likely (len > left_space)) { +memcpy (wqe, addr, left_space); + len -= left_space; + addr += left_space; + idx = (dr_qp->sq.pc +1 ) & (dr_qp->sq.wqe_cnt -1 ); + wqe =mlx5_wq_cyc_get_wqe (&dr_qp->wq.sq, idx); + } + +memcpy (wqe, addr, len); + +if (likely (inl)) { + seg->byte_count =cpu_to_be32 (inl |MLX5_INLINE_SEG ); +return DIV_ROUND_UP (inl +sizeof (seg->byte_count), +MLX5_SEND_WQE_DS ); + }else { +return 0 ; + } +} + static void -dr_rdma_handle_icm_write_segments(struct mlx5_wqe_ctrl_seg *wq_ctrl, +dr_rdma_handle_icm_write_segments(struct mlx5dr_qp *dr_qp, + struct mlx5_wqe_ctrl_seg *wq_ctrl, u64 remote_addr, u32 rkey, struct dr_data_seg *data_seg,
@@ -412,15 +494,17 @@ dr_rdma_handle_icm_write_segments(struct mlx5_wqe_ctrl_seg *wq_ctrl, wq_raddr->reserved =0 ; wq_dseg = (void *)(wq_raddr +1 ); +/* WQE ctrl segment + WQE remote addr segment */ + *size = (sizeof (*wq_ctrl) +sizeof (*wq_raddr)) /MLX5_SEND_WQE_DS ; - wq_dseg->byte_count =cpu_to_be32 (data_seg->length); - wq_dseg->lkey =cpu_to_be32 (data_seg->lkey); - wq_dseg->addr =cpu_to_be64 (data_seg->addr); - - *size = (sizeof (*wq_ctrl) +/* WQE ctrl segment */ -sizeof (*wq_dseg) +/* WQE data segment */ -sizeof (*wq_raddr)) //* WQE remote addr segment */ -MLX5_SEND_WQE_DS ; +if (data_seg->send_flags &IB_SEND_INLINE ) { + *size +=dr_set_data_inl_seg (dr_qp, data_seg, wq_dseg); + }else { + wq_dseg->byte_count =cpu_to_be32 (data_seg->length); + wq_dseg->lkey =cpu_to_be32 (data_seg->lkey); + wq_dseg->addr =cpu_to_be64 (data_seg->addr); + *size +=sizeof (*wq_dseg) /MLX5_SEND_WQE_DS ;/* WQE data segment */ + } } static void dr_set_ctrl_seg(struct mlx5_wqe_ctrl_seg *wq_ctrl,
@@ -451,7 +535,7 @@ static void dr_rdma_segments(struct mlx5dr_qp *dr_qp, u64 remote_addr,switch (opcode) {case MLX5_OPCODE_RDMA_READ :case MLX5_OPCODE_RDMA_WRITE : -dr_rdma_handle_icm_write_segments (wq_ctrl, remote_addr, +dr_rdma_handle_icm_write_segments (dr_qp, wq_ctrl, remote_addr, rkey, data_seg, &size);break ;case MLX5_OPCODE_FLOW_TBL_ACCESS :
@@ -572,7 +656,7 @@ static void dr_fill_write_args_segs(struct mlx5dr_send_ring *send_ring,if (send_ring->pending_wqe % send_ring->signal_th ==0 ) send_info->write.send_flags |=IB_SEND_SIGNALED ;else - send_info->write.send_flags =0 ; + send_info->write.send_flags &= ~IB_SEND_SIGNALED ; } static void dr_fill_write_icm_segs(struct mlx5dr_domain *dmn,
@@ -596,9 +680,13 @@ static void dr_fill_write_icm_segs(struct mlx5dr_domain *dmn, } send_ring->pending_wqe++; +if (!send_info->write.lkey) + send_info->write.send_flags |=IB_SEND_INLINE ;if (send_ring->pending_wqe % send_ring->signal_th ==0 ) send_info->write.send_flags |=IB_SEND_SIGNALED ; +else + send_info->write.send_flags &= ~IB_SEND_SIGNALED ; send_ring->pending_wqe++; send_info->read.length = send_info->write.length;
@@ -608,9 +696,9 @@ static void dr_fill_write_icm_segs(struct mlx5dr_domain *dmn, send_info->read.lkey = send_ring->sync_mr->mkey;if (send_ring->pending_wqe % send_ring->signal_th ==0 ) - send_info->read.send_flags =IB_SEND_SIGNALED ; + send_info->read.send_flags |=IB_SEND_SIGNALED ;else - send_info->read.send_flags =0 ; + send_info->read.send_flags &= ~IB_SEND_SIGNALED ; } static void dr_fill_data_segs(struct mlx5dr_domain *dmn,
@@ -1257,6 +1345,7 @@ int mlx5dr_send_ring_alloc(struct mlx5dr_domain *dmn) dmn->send_ring->cq->qp = dmn->send_ring->qp; dmn->info.max_send_wr =QUEUE_SIZE ; + init_attr.max_send_sge =1 ; dmn->info.max_inline_size =min (dmn->send_ring->qp->max_inline_data,DR_STE_SIZE );
Signature · 1 line
2.41.0
PATCH v2 14/14 net/mlx5: Devcom, only use devcom after NULL check in mlx5_devcom_send_event()
In reply to Saeed MahameedFrom: Li Zetao <[email protected]>
There is a warning reported by kernel test robot:
smatch warnings:drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.c:264
mlx5_devcom_send_event() warn: variable dereferenced before
IS_ERR check devcom (see line 259)
The reason for the warning is that the pointer is used before check, put the assignment to comp after devcom check to silence the warning.
--- drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.c +2 -1
@@ -256,14 +256,15 @@ int mlx5_devcom_send_event(struct mlx5_devcom_comp_dev *devcom, int event, int rollback_event, void *event_data) { - struct mlx5_devcom_comp *comp = devcom->comp; struct mlx5_devcom_comp_dev *pos; +struct mlx5_devcom_comp *comp;int err =0 ;void *data;if (IS_ERR_OR_NULL (devcom))return -ENODEV ; + comp = devcom->comp;down_write (&comp->sem);list_for_each_entry (pos, &comp->comp_dev_list_head, list) { data =rcu_dereference_protected (pos->data,lockdep_is_held (&comp->sem));
Signature · 1 line
2.41.0