Skip to content

Commit 42a928c

Browse files
committed
Merge tag 'mlx5-fixes-2017-05-12-V2' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== Mellanox, mlx5 fixes 2017-05-12 This series contains some mlx5 fixes for net. Please pull and let me know if there's any problem. For -stable: ("net/mlx5e: Fix ethtool pause support and advertise reporting") kernels >= 4.8 ("net/mlx5e: Use the correct pause values for ethtool advertising") kernels >= 4.8 v1->v2: Dropped statistics spinlock patch, it needs some extra work. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 66eb9f8 + 5085411 commit 42a928c

File tree

10 files changed

+49
-23
lines changed

10 files changed

+49
-23
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ int mlx5e_create_direct_tirs(struct mlx5e_priv *priv);
10031003
void mlx5e_destroy_direct_tirs(struct mlx5e_priv *priv);
10041004
void mlx5e_destroy_rqt(struct mlx5e_priv *priv, struct mlx5e_rqt *rqt);
10051005

1006-
int mlx5e_create_ttc_table(struct mlx5e_priv *priv, u32 underlay_qpn);
1006+
int mlx5e_create_ttc_table(struct mlx5e_priv *priv);
10071007
void mlx5e_destroy_ttc_table(struct mlx5e_priv *priv);
10081008

10091009
int mlx5e_create_tis(struct mlx5_core_dev *mdev, int tc,

drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,6 @@ static void get_supported(u32 eth_proto_cap,
794794
ptys2ethtool_supported_port(link_ksettings, eth_proto_cap);
795795
ptys2ethtool_supported_link(supported, eth_proto_cap);
796796
ethtool_link_ksettings_add_link_mode(link_ksettings, supported, Pause);
797-
ethtool_link_ksettings_add_link_mode(link_ksettings, supported, Asym_Pause);
798797
}
799798

800799
static void get_advertising(u32 eth_proto_cap, u8 tx_pause,
@@ -804,7 +803,7 @@ static void get_advertising(u32 eth_proto_cap, u8 tx_pause,
804803
unsigned long *advertising = link_ksettings->link_modes.advertising;
805804

806805
ptys2ethtool_adver_link(advertising, eth_proto_cap);
807-
if (tx_pause)
806+
if (rx_pause)
808807
ethtool_link_ksettings_add_link_mode(link_ksettings, advertising, Pause);
809808
if (tx_pause ^ rx_pause)
810809
ethtool_link_ksettings_add_link_mode(link_ksettings, advertising, Asym_Pause);
@@ -849,6 +848,8 @@ static int mlx5e_get_link_ksettings(struct net_device *netdev,
849848
struct mlx5e_priv *priv = netdev_priv(netdev);
850849
struct mlx5_core_dev *mdev = priv->mdev;
851850
u32 out[MLX5_ST_SZ_DW(ptys_reg)] = {0};
851+
u32 rx_pause = 0;
852+
u32 tx_pause = 0;
852853
u32 eth_proto_cap;
853854
u32 eth_proto_admin;
854855
u32 eth_proto_lp;
@@ -871,11 +872,13 @@ static int mlx5e_get_link_ksettings(struct net_device *netdev,
871872
an_disable_admin = MLX5_GET(ptys_reg, out, an_disable_admin);
872873
an_status = MLX5_GET(ptys_reg, out, an_status);
873874

875+
mlx5_query_port_pause(mdev, &rx_pause, &tx_pause);
876+
874877
ethtool_link_ksettings_zero_link_mode(link_ksettings, supported);
875878
ethtool_link_ksettings_zero_link_mode(link_ksettings, advertising);
876879

877880
get_supported(eth_proto_cap, link_ksettings);
878-
get_advertising(eth_proto_admin, 0, 0, link_ksettings);
881+
get_advertising(eth_proto_admin, tx_pause, rx_pause, link_ksettings);
879882
get_speed_duplex(netdev, eth_proto_oper, link_ksettings);
880883

881884
eth_proto_oper = eth_proto_oper ? eth_proto_oper : eth_proto_cap;

drivers/net/ethernet/mellanox/mlx5/core/en_fs.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ void mlx5e_destroy_ttc_table(struct mlx5e_priv *priv)
800800
mlx5e_destroy_flow_table(&ttc->ft);
801801
}
802802

803-
int mlx5e_create_ttc_table(struct mlx5e_priv *priv, u32 underlay_qpn)
803+
int mlx5e_create_ttc_table(struct mlx5e_priv *priv)
804804
{
805805
struct mlx5e_ttc_table *ttc = &priv->fs.ttc;
806806
struct mlx5_flow_table_attr ft_attr = {};
@@ -810,7 +810,6 @@ int mlx5e_create_ttc_table(struct mlx5e_priv *priv, u32 underlay_qpn)
810810
ft_attr.max_fte = MLX5E_TTC_TABLE_SIZE;
811811
ft_attr.level = MLX5E_TTC_FT_LEVEL;
812812
ft_attr.prio = MLX5E_NIC_PRIO;
813-
ft_attr.underlay_qpn = underlay_qpn;
814813

815814
ft->t = mlx5_create_flow_table(priv->fs.ns, &ft_attr);
816815
if (IS_ERR(ft->t)) {
@@ -1147,7 +1146,7 @@ int mlx5e_create_flow_steering(struct mlx5e_priv *priv)
11471146
priv->netdev->hw_features &= ~NETIF_F_NTUPLE;
11481147
}
11491148

1150-
err = mlx5e_create_ttc_table(priv, 0);
1149+
err = mlx5e_create_ttc_table(priv);
11511150
if (err) {
11521151
netdev_err(priv->netdev, "Failed to create ttc table, err=%d\n",
11531152
err);

drivers/net/ethernet/mellanox/mlx5/core/en_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2976,7 +2976,7 @@ static int mlx5e_setup_tc(struct net_device *netdev, u8 tc)
29762976
new_channels.params = priv->channels.params;
29772977
new_channels.params.num_tc = tc ? tc : 1;
29782978

2979-
if (test_bit(MLX5E_STATE_OPENED, &priv->state)) {
2979+
if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) {
29802980
priv->channels.params = new_channels.params;
29812981
goto out;
29822982
}

drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,28 +40,25 @@
4040
#include "eswitch.h"
4141

4242
int mlx5_cmd_update_root_ft(struct mlx5_core_dev *dev,
43-
struct mlx5_flow_table *ft)
43+
struct mlx5_flow_table *ft, u32 underlay_qpn)
4444
{
4545
u32 in[MLX5_ST_SZ_DW(set_flow_table_root_in)] = {0};
4646
u32 out[MLX5_ST_SZ_DW(set_flow_table_root_out)] = {0};
4747

4848
if ((MLX5_CAP_GEN(dev, port_type) == MLX5_CAP_PORT_TYPE_IB) &&
49-
ft->underlay_qpn == 0)
49+
underlay_qpn == 0)
5050
return 0;
5151

5252
MLX5_SET(set_flow_table_root_in, in, opcode,
5353
MLX5_CMD_OP_SET_FLOW_TABLE_ROOT);
5454
MLX5_SET(set_flow_table_root_in, in, table_type, ft->type);
5555
MLX5_SET(set_flow_table_root_in, in, table_id, ft->id);
56+
MLX5_SET(set_flow_table_root_in, in, underlay_qpn, underlay_qpn);
5657
if (ft->vport) {
5758
MLX5_SET(set_flow_table_root_in, in, vport_number, ft->vport);
5859
MLX5_SET(set_flow_table_root_in, in, other_vport, 1);
5960
}
6061

61-
if ((MLX5_CAP_GEN(dev, port_type) == MLX5_CAP_PORT_TYPE_IB) &&
62-
ft->underlay_qpn != 0)
63-
MLX5_SET(set_flow_table_root_in, in, underlay_qpn, ft->underlay_qpn);
64-
6562
return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
6663
}
6764

drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ int mlx5_cmd_delete_fte(struct mlx5_core_dev *dev,
7171
unsigned int index);
7272

7373
int mlx5_cmd_update_root_ft(struct mlx5_core_dev *dev,
74-
struct mlx5_flow_table *ft);
74+
struct mlx5_flow_table *ft,
75+
u32 underlay_qpn);
7576

7677
int mlx5_cmd_fc_alloc(struct mlx5_core_dev *dev, u16 *id);
7778
int mlx5_cmd_fc_free(struct mlx5_core_dev *dev, u16 id);

drivers/net/ethernet/mellanox/mlx5/core/fs_core.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ static int update_root_ft_create(struct mlx5_flow_table *ft, struct fs_prio
650650
if (ft->level >= min_level)
651651
return 0;
652652

653-
err = mlx5_cmd_update_root_ft(root->dev, ft);
653+
err = mlx5_cmd_update_root_ft(root->dev, ft, root->underlay_qpn);
654654
if (err)
655655
mlx5_core_warn(root->dev, "Update root flow table of id=%u failed\n",
656656
ft->id);
@@ -818,8 +818,6 @@ static struct mlx5_flow_table *__mlx5_create_flow_table(struct mlx5_flow_namespa
818818
goto unlock_root;
819819
}
820820

821-
ft->underlay_qpn = ft_attr->underlay_qpn;
822-
823821
tree_init_node(&ft->node, 1, del_flow_table);
824822
log_table_sz = ft->max_fte ? ilog2(ft->max_fte) : 0;
825823
next_ft = find_next_chained_ft(fs_prio);
@@ -1489,7 +1487,8 @@ static int update_root_ft_destroy(struct mlx5_flow_table *ft)
14891487

14901488
new_root_ft = find_next_ft(ft);
14911489
if (new_root_ft) {
1492-
int err = mlx5_cmd_update_root_ft(root->dev, new_root_ft);
1490+
int err = mlx5_cmd_update_root_ft(root->dev, new_root_ft,
1491+
root->underlay_qpn);
14931492

14941493
if (err) {
14951494
mlx5_core_warn(root->dev, "Update root flow table of id=%u failed\n",
@@ -2062,3 +2061,21 @@ int mlx5_init_fs(struct mlx5_core_dev *dev)
20622061
mlx5_cleanup_fs(dev);
20632062
return err;
20642063
}
2064+
2065+
int mlx5_fs_add_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn)
2066+
{
2067+
struct mlx5_flow_root_namespace *root = dev->priv.steering->root_ns;
2068+
2069+
root->underlay_qpn = underlay_qpn;
2070+
return 0;
2071+
}
2072+
EXPORT_SYMBOL(mlx5_fs_add_rx_underlay_qpn);
2073+
2074+
int mlx5_fs_remove_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn)
2075+
{
2076+
struct mlx5_flow_root_namespace *root = dev->priv.steering->root_ns;
2077+
2078+
root->underlay_qpn = 0;
2079+
return 0;
2080+
}
2081+
EXPORT_SYMBOL(mlx5_fs_remove_rx_underlay_qpn);

drivers/net/ethernet/mellanox/mlx5/core/fs_core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ struct mlx5_flow_table {
118118
/* FWD rules that point on this flow table */
119119
struct list_head fwd_rules;
120120
u32 flags;
121-
u32 underlay_qpn;
122121
};
123122

124123
struct mlx5_fc_cache {
@@ -195,6 +194,7 @@ struct mlx5_flow_root_namespace {
195194
struct mlx5_flow_table *root_ft;
196195
/* Should be held when chaining flow tables */
197196
struct mutex chain_lock;
197+
u32 underlay_qpn;
198198
};
199199

200200
int mlx5_init_fc_stats(struct mlx5_core_dev *dev);

drivers/net/ethernet/mellanox/mlx5/core/ipoib.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ static void mlx5i_init(struct mlx5_core_dev *mdev,
6666

6767
mlx5e_build_nic_params(mdev, &priv->channels.params, profile->max_nch(mdev));
6868

69+
/* Override RQ params as IPoIB supports only LINKED LIST RQ for now */
70+
mlx5e_set_rq_type_params(mdev, &priv->channels.params, MLX5_WQ_TYPE_LINKED_LIST);
71+
priv->channels.params.lro_en = false;
72+
6973
mutex_init(&priv->state_lock);
7074

7175
netdev->hw_features |= NETIF_F_SG;
@@ -156,6 +160,8 @@ static int mlx5i_create_underlay_qp(struct mlx5_core_dev *mdev, struct mlx5_core
156160

157161
static void mlx5i_destroy_underlay_qp(struct mlx5_core_dev *mdev, struct mlx5_core_qp *qp)
158162
{
163+
mlx5_fs_remove_rx_underlay_qpn(mdev, qp->qpn);
164+
159165
mlx5_core_destroy_qp(mdev, qp);
160166
}
161167

@@ -170,6 +176,8 @@ static int mlx5i_init_tx(struct mlx5e_priv *priv)
170176
return err;
171177
}
172178

179+
mlx5_fs_add_rx_underlay_qpn(priv->mdev, ipriv->qp.qpn);
180+
173181
err = mlx5e_create_tis(priv->mdev, 0 /* tc */, ipriv->qp.qpn, &priv->tisn[0]);
174182
if (err) {
175183
mlx5_core_warn(priv->mdev, "create tis failed, %d\n", err);
@@ -189,7 +197,6 @@ static void mlx5i_cleanup_tx(struct mlx5e_priv *priv)
189197

190198
static int mlx5i_create_flow_steering(struct mlx5e_priv *priv)
191199
{
192-
struct mlx5i_priv *ipriv = priv->ppriv;
193200
int err;
194201

195202
priv->fs.ns = mlx5_get_flow_namespace(priv->mdev,
@@ -205,7 +212,7 @@ static int mlx5i_create_flow_steering(struct mlx5e_priv *priv)
205212
priv->netdev->hw_features &= ~NETIF_F_NTUPLE;
206213
}
207214

208-
err = mlx5e_create_ttc_table(priv, ipriv->qp.qpn);
215+
err = mlx5e_create_ttc_table(priv);
209216
if (err) {
210217
netdev_err(priv->netdev, "Failed to create ttc table, err=%d\n",
211218
err);

include/linux/mlx5/fs.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ struct mlx5_flow_table_attr {
109109
int max_fte;
110110
u32 level;
111111
u32 flags;
112-
u32 underlay_qpn;
113112
};
114113

115114
struct mlx5_flow_table *
@@ -167,4 +166,7 @@ struct mlx5_fc *mlx5_fc_create(struct mlx5_core_dev *dev, bool aging);
167166
void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter);
168167
void mlx5_fc_query_cached(struct mlx5_fc *counter,
169168
u64 *bytes, u64 *packets, u64 *lastuse);
169+
int mlx5_fs_add_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn);
170+
int mlx5_fs_remove_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn);
171+
170172
#endif

0 commit comments

Comments
 (0)