aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-02-23 10:43:11 -0500
committerDavid S. Miller <davem@davemloft.net>2017-02-23 10:43:11 -0500
commit79873fb6348a35634b3edb60e21798ae716da824 (patch)
treed9bf7529f24cc817b4f514e081d77162bb284f62
parenteee2faabc63d863a129000b698a2bca54dff643d (diff)
parent36154be40a28e4afaa0416da2681d80b7e2ca319 (diff)
Merge branch 'mlx5-fixes'
Saeed Mahameed says: ==================== Mellanox mlx5e fixes for 4.11-rc1 This series includes some important bug fixes for mlx5e driver. Three misc fixes: From Mohamad, compilation fix on s390 system From Me, A fix for driver unload when switchdev mode is on. From Tariq, HW LRO frag size optimization for when build_skb is not used (striding RQ mode). Three CQE compression related fixes: Two fixes from Tariq and I, to correctly setup CQE compression parameters on driver load and on arbitrary user modifications. Last patch, fixes a very critical issue that was originally reported by Tom, where the driver reported csum errors or even page ref issues for when cqe compression is enabled and rapidly active. For your convenience this series was generated on top of net-next branch: 005c3490e9db ('Revert "ath10k: Search SMBIOS for OEM board file extension"') for -stable: net/mlx5e: Register/unregister vport representors on interface (for kernel >= 4.9) net/mlx5e: Do not reduce LRO WQE size when not using build_skb (for kernel >= 4.9) net/mlx5e: Fix broken CQE compression initialization (for kernel >= 4.9) net/mlx5e: Update MPWQE stride size when modifying CQE compress state (for kernel >= 4.7) net/mlx5e: Fix wrong CQE decompression (for kernel >= 4.7) ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en.h1
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_main.c40
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_rx.c15
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c1
5 files changed, 35 insertions, 23 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index 95ca03c0d9f5..f6a6ded204f6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -816,6 +816,7 @@ int mlx5e_get_max_linkspeed(struct mlx5_core_dev *mdev, u32 *speed);
816 816
817void mlx5e_set_rx_cq_mode_params(struct mlx5e_params *params, 817void mlx5e_set_rx_cq_mode_params(struct mlx5e_params *params,
818 u8 cq_period_mode); 818 u8 cq_period_mode);
819void mlx5e_set_rq_type_params(struct mlx5e_priv *priv, u8 rq_type);
819 820
820static inline void mlx5e_tx_notify_hw(struct mlx5e_sq *sq, 821static inline void mlx5e_tx_notify_hw(struct mlx5e_sq *sq,
821 struct mlx5_wqe_ctrl_seg *ctrl, int bf_sz) 822 struct mlx5_wqe_ctrl_seg *ctrl, int bf_sz)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index cc80522b5854..a004a5a1a4c2 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -1487,6 +1487,7 @@ static int set_pflag_rx_cqe_compress(struct net_device *netdev,
1487 1487
1488 mlx5e_modify_rx_cqe_compression_locked(priv, enable); 1488 mlx5e_modify_rx_cqe_compression_locked(priv, enable);
1489 priv->params.rx_cqe_compress_def = enable; 1489 priv->params.rx_cqe_compress_def = enable;
1490 mlx5e_set_rq_type_params(priv, priv->params.rq_wq_type);
1490 1491
1491 return 0; 1492 return 0;
1492} 1493}
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 3cce6281e075..8ef64c4db2c2 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -79,9 +79,10 @@ static bool mlx5e_check_fragmented_striding_rq_cap(struct mlx5_core_dev *mdev)
79 MLX5_CAP_ETH(mdev, reg_umr_sq); 79 MLX5_CAP_ETH(mdev, reg_umr_sq);
80} 80}
81 81
82static void mlx5e_set_rq_type_params(struct mlx5e_priv *priv, u8 rq_type) 82void mlx5e_set_rq_type_params(struct mlx5e_priv *priv, u8 rq_type)
83{ 83{
84 priv->params.rq_wq_type = rq_type; 84 priv->params.rq_wq_type = rq_type;
85 priv->params.lro_wqe_sz = MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ;
85 switch (priv->params.rq_wq_type) { 86 switch (priv->params.rq_wq_type) {
86 case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ: 87 case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:
87 priv->params.log_rq_size = is_kdump_kernel() ? 88 priv->params.log_rq_size = is_kdump_kernel() ?
@@ -98,6 +99,10 @@ static void mlx5e_set_rq_type_params(struct mlx5e_priv *priv, u8 rq_type)
98 priv->params.log_rq_size = is_kdump_kernel() ? 99 priv->params.log_rq_size = is_kdump_kernel() ?
99 MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE : 100 MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE :
100 MLX5E_PARAMS_DEFAULT_LOG_RQ_SIZE; 101 MLX5E_PARAMS_DEFAULT_LOG_RQ_SIZE;
102
103 /* Extra room needed for build_skb */
104 priv->params.lro_wqe_sz -= MLX5_RX_HEADROOM +
105 SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
101 } 106 }
102 priv->params.min_rx_wqes = mlx5_min_rx_wqes(priv->params.rq_wq_type, 107 priv->params.min_rx_wqes = mlx5_min_rx_wqes(priv->params.rq_wq_type,
103 BIT(priv->params.log_rq_size)); 108 BIT(priv->params.log_rq_size));
@@ -3521,6 +3526,9 @@ static void mlx5e_build_nic_netdev_priv(struct mlx5_core_dev *mdev,
3521 cqe_compress_heuristic(link_speed, pci_bw); 3526 cqe_compress_heuristic(link_speed, pci_bw);
3522 } 3527 }
3523 3528
3529 MLX5E_SET_PFLAG(priv, MLX5E_PFLAG_RX_CQE_COMPRESS,
3530 priv->params.rx_cqe_compress_def);
3531
3524 mlx5e_set_rq_priv_params(priv); 3532 mlx5e_set_rq_priv_params(priv);
3525 if (priv->params.rq_wq_type == MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ) 3533 if (priv->params.rq_wq_type == MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ)
3526 priv->params.lro_en = true; 3534 priv->params.lro_en = true;
@@ -3547,16 +3555,9 @@ static void mlx5e_build_nic_netdev_priv(struct mlx5_core_dev *mdev,
3547 mlx5e_build_default_indir_rqt(mdev, priv->params.indirection_rqt, 3555 mlx5e_build_default_indir_rqt(mdev, priv->params.indirection_rqt,
3548 MLX5E_INDIR_RQT_SIZE, profile->max_nch(mdev)); 3556 MLX5E_INDIR_RQT_SIZE, profile->max_nch(mdev));
3549 3557
3550 priv->params.lro_wqe_sz =
3551 MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ -
3552 /* Extra room needed for build_skb */
3553 MLX5_RX_HEADROOM -
3554 SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
3555
3556 /* Initialize pflags */ 3558 /* Initialize pflags */
3557 MLX5E_SET_PFLAG(priv, MLX5E_PFLAG_RX_CQE_BASED_MODER, 3559 MLX5E_SET_PFLAG(priv, MLX5E_PFLAG_RX_CQE_BASED_MODER,
3558 priv->params.rx_cq_period_mode == MLX5_CQ_PERIOD_MODE_START_FROM_CQE); 3560 priv->params.rx_cq_period_mode == MLX5_CQ_PERIOD_MODE_START_FROM_CQE);
3559 MLX5E_SET_PFLAG(priv, MLX5E_PFLAG_RX_CQE_COMPRESS, priv->params.rx_cqe_compress_def);
3560 3561
3561 mutex_init(&priv->state_lock); 3562 mutex_init(&priv->state_lock);
3562 3563
@@ -3970,6 +3971,19 @@ static void mlx5e_register_vport_rep(struct mlx5_core_dev *mdev)
3970 } 3971 }
3971} 3972}
3972 3973
3974static void mlx5e_unregister_vport_rep(struct mlx5_core_dev *mdev)
3975{
3976 struct mlx5_eswitch *esw = mdev->priv.eswitch;
3977 int total_vfs = MLX5_TOTAL_VPORTS(mdev);
3978 int vport;
3979
3980 if (!MLX5_CAP_GEN(mdev, vport_group_manager))
3981 return;
3982
3983 for (vport = 1; vport < total_vfs; vport++)
3984 mlx5_eswitch_unregister_vport_rep(esw, vport);
3985}
3986
3973void mlx5e_detach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev) 3987void mlx5e_detach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev)
3974{ 3988{
3975 struct mlx5e_priv *priv = netdev_priv(netdev); 3989 struct mlx5e_priv *priv = netdev_priv(netdev);
@@ -4016,6 +4030,7 @@ static int mlx5e_attach(struct mlx5_core_dev *mdev, void *vpriv)
4016 return err; 4030 return err;
4017 } 4031 }
4018 4032
4033 mlx5e_register_vport_rep(mdev);
4019 return 0; 4034 return 0;
4020} 4035}
4021 4036
@@ -4027,6 +4042,7 @@ static void mlx5e_detach(struct mlx5_core_dev *mdev, void *vpriv)
4027 if (!netif_device_present(netdev)) 4042 if (!netif_device_present(netdev))
4028 return; 4043 return;
4029 4044
4045 mlx5e_unregister_vport_rep(mdev);
4030 mlx5e_detach_netdev(mdev, netdev); 4046 mlx5e_detach_netdev(mdev, netdev);
4031 mlx5e_destroy_mdev_resources(mdev); 4047 mlx5e_destroy_mdev_resources(mdev);
4032} 4048}
@@ -4045,8 +4061,6 @@ static void *mlx5e_add(struct mlx5_core_dev *mdev)
4045 if (err) 4061 if (err)
4046 return NULL; 4062 return NULL;
4047 4063
4048 mlx5e_register_vport_rep(mdev);
4049
4050 if (MLX5_CAP_GEN(mdev, vport_group_manager)) 4064 if (MLX5_CAP_GEN(mdev, vport_group_manager))
4051 ppriv = &esw->offloads.vport_reps[0]; 4065 ppriv = &esw->offloads.vport_reps[0];
4052 4066
@@ -4098,13 +4112,7 @@ void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, struct mlx5e_priv *priv)
4098 4112
4099static void mlx5e_remove(struct mlx5_core_dev *mdev, void *vpriv) 4113static void mlx5e_remove(struct mlx5_core_dev *mdev, void *vpriv)
4100{ 4114{
4101 struct mlx5_eswitch *esw = mdev->priv.eswitch;
4102 int total_vfs = MLX5_TOTAL_VPORTS(mdev);
4103 struct mlx5e_priv *priv = vpriv; 4115 struct mlx5e_priv *priv = vpriv;
4104 int vport;
4105
4106 for (vport = 1; vport < total_vfs; vport++)
4107 mlx5_eswitch_unregister_vport_rep(esw, vport);
4108 4116
4109 unregister_netdev(priv->netdev); 4117 unregister_netdev(priv->netdev);
4110 mlx5e_detach(mdev, vpriv); 4118 mlx5e_detach(mdev, vpriv);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index b039b87742a6..3d371688fbbb 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -30,6 +30,7 @@
30 * SOFTWARE. 30 * SOFTWARE.
31 */ 31 */
32 32
33#include <linux/prefetch.h>
33#include <linux/ip.h> 34#include <linux/ip.h>
34#include <linux/ipv6.h> 35#include <linux/ipv6.h>
35#include <linux/tcp.h> 36#include <linux/tcp.h>
@@ -93,19 +94,18 @@ static inline void mlx5e_cqes_update_owner(struct mlx5e_cq *cq, u32 cqcc, int n)
93static inline void mlx5e_decompress_cqe(struct mlx5e_rq *rq, 94static inline void mlx5e_decompress_cqe(struct mlx5e_rq *rq,
94 struct mlx5e_cq *cq, u32 cqcc) 95 struct mlx5e_cq *cq, u32 cqcc)
95{ 96{
96 u16 wqe_cnt_step;
97
98 cq->title.byte_cnt = cq->mini_arr[cq->mini_arr_idx].byte_cnt; 97 cq->title.byte_cnt = cq->mini_arr[cq->mini_arr_idx].byte_cnt;
99 cq->title.check_sum = cq->mini_arr[cq->mini_arr_idx].checksum; 98 cq->title.check_sum = cq->mini_arr[cq->mini_arr_idx].checksum;
100 cq->title.op_own &= 0xf0; 99 cq->title.op_own &= 0xf0;
101 cq->title.op_own |= 0x01 & (cqcc >> cq->wq.log_sz); 100 cq->title.op_own |= 0x01 & (cqcc >> cq->wq.log_sz);
102 cq->title.wqe_counter = cpu_to_be16(cq->decmprs_wqe_counter); 101 cq->title.wqe_counter = cpu_to_be16(cq->decmprs_wqe_counter);
103 102
104 wqe_cnt_step = 103 if (rq->wq_type == MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ)
105 rq->wq_type == MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ ? 104 cq->decmprs_wqe_counter +=
106 mpwrq_get_cqe_consumed_strides(&cq->title) : 1; 105 mpwrq_get_cqe_consumed_strides(&cq->title);
107 cq->decmprs_wqe_counter = 106 else
108 (cq->decmprs_wqe_counter + wqe_cnt_step) & rq->wq.sz_m1; 107 cq->decmprs_wqe_counter =
108 (cq->decmprs_wqe_counter + 1) & rq->wq.sz_m1;
109} 109}
110 110
111static inline void mlx5e_decompress_cqe_no_hash(struct mlx5e_rq *rq, 111static inline void mlx5e_decompress_cqe_no_hash(struct mlx5e_rq *rq,
@@ -171,6 +171,7 @@ void mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool val)
171 mlx5e_close_locked(priv->netdev); 171 mlx5e_close_locked(priv->netdev);
172 172
173 MLX5E_SET_PFLAG(priv, MLX5E_PFLAG_RX_CQE_COMPRESS, val); 173 MLX5E_SET_PFLAG(priv, MLX5E_PFLAG_RX_CQE_COMPRESS, val);
174 mlx5e_set_rq_type_params(priv, priv->params.rq_wq_type);
174 175
175 if (was_opened) 176 if (was_opened)
176 mlx5e_open_locked(priv->netdev); 177 mlx5e_open_locked(priv->netdev);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c b/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c
index 65442c36a6e1..31e3cb7ee5fe 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c
@@ -30,6 +30,7 @@
30 * SOFTWARE. 30 * SOFTWARE.
31 */ 31 */
32 32
33#include <linux/prefetch.h>
33#include <linux/ip.h> 34#include <linux/ip.h>
34#include <linux/udp.h> 35#include <linux/udp.h>
35#include <net/udp.h> 36#include <net/udp.h>