Skip to content

Commit 064a189

Browse files
committed
Merge tag 'mlx5-fixes-2019-11-20' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== Mellanox, mlx5 fixes 2019-11-20 This series introduces some fixes to mlx5 driver. Please pull and let me know if there is any problem. For -stable v4.9: ('net/mlx5e: Fix set vf link state error flow') For -stable v4.14 ('net/mlxfw: Verify FSM error code translation doesn't exceed array size') For -stable v4.19 ('net/mlx5: Fix auto group size calculation') For -stable v5.3 ('net/mlx5e: Fix error flow cleanup in mlx5e_tc_tun_create_header_ipv4/6') ('net/mlx5e: Do not use non-EXT link modes in EXT mode') ('net/mlx5: Update the list of the PCI supported devices') ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 8481141 + 30e9e05 commit 064a189

File tree

12 files changed

+67
-56
lines changed

12 files changed

+67
-56
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,15 @@ int mlx5e_tc_tun_create_header_ipv4(struct mlx5e_priv *priv,
239239
if (max_encap_size < ipv4_encap_size) {
240240
mlx5_core_warn(priv->mdev, "encap size %d too big, max supported is %d\n",
241241
ipv4_encap_size, max_encap_size);
242-
return -EOPNOTSUPP;
242+
err = -EOPNOTSUPP;
243+
goto out;
243244
}
244245

245246
encap_header = kzalloc(ipv4_encap_size, GFP_KERNEL);
246-
if (!encap_header)
247-
return -ENOMEM;
247+
if (!encap_header) {
248+
err = -ENOMEM;
249+
goto out;
250+
}
248251

249252
/* used by mlx5e_detach_encap to lookup a neigh hash table
250253
* entry in the neigh hash table when a user deletes a rule
@@ -355,12 +358,15 @@ int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
355358
if (max_encap_size < ipv6_encap_size) {
356359
mlx5_core_warn(priv->mdev, "encap size %d too big, max supported is %d\n",
357360
ipv6_encap_size, max_encap_size);
358-
return -EOPNOTSUPP;
361+
err = -EOPNOTSUPP;
362+
goto out;
359363
}
360364

361365
encap_header = kzalloc(ipv6_encap_size, GFP_KERNEL);
362-
if (!encap_header)
363-
return -ENOMEM;
366+
if (!encap_header) {
367+
err = -ENOMEM;
368+
goto out;
369+
}
364370

365371
/* used by mlx5e_detach_encap to lookup a neigh hash table
366372
* entry in the neigh hash table when a user deletes a rule

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -708,9 +708,9 @@ static int get_fec_supported_advertised(struct mlx5_core_dev *dev,
708708

709709
static void ptys2ethtool_supported_advertised_port(struct ethtool_link_ksettings *link_ksettings,
710710
u32 eth_proto_cap,
711-
u8 connector_type)
711+
u8 connector_type, bool ext)
712712
{
713-
if (!connector_type || connector_type >= MLX5E_CONNECTOR_TYPE_NUMBER) {
713+
if ((!connector_type && !ext) || connector_type >= MLX5E_CONNECTOR_TYPE_NUMBER) {
714714
if (eth_proto_cap & (MLX5E_PROT_MASK(MLX5E_10GBASE_CR)
715715
| MLX5E_PROT_MASK(MLX5E_10GBASE_SR)
716716
| MLX5E_PROT_MASK(MLX5E_40GBASE_CR4)
@@ -842,9 +842,9 @@ static int ptys2connector_type[MLX5E_CONNECTOR_TYPE_NUMBER] = {
842842
[MLX5E_PORT_OTHER] = PORT_OTHER,
843843
};
844844

845-
static u8 get_connector_port(u32 eth_proto, u8 connector_type)
845+
static u8 get_connector_port(u32 eth_proto, u8 connector_type, bool ext)
846846
{
847-
if (connector_type && connector_type < MLX5E_CONNECTOR_TYPE_NUMBER)
847+
if ((connector_type || ext) && connector_type < MLX5E_CONNECTOR_TYPE_NUMBER)
848848
return ptys2connector_type[connector_type];
849849

850850
if (eth_proto &
@@ -945,9 +945,9 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv,
945945
eth_proto_oper = eth_proto_oper ? eth_proto_oper : eth_proto_cap;
946946

947947
link_ksettings->base.port = get_connector_port(eth_proto_oper,
948-
connector_type);
948+
connector_type, ext);
949949
ptys2ethtool_supported_advertised_port(link_ksettings, eth_proto_admin,
950-
connector_type);
950+
connector_type, ext);
951951
get_lp_advertising(mdev, eth_proto_lp, link_ksettings);
952952

953953
if (an_status == MLX5_AN_COMPLETE)

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4252,9 +4252,12 @@ static netdev_features_t mlx5e_tunnel_features_check(struct mlx5e_priv *priv,
42524252

42534253
switch (proto) {
42544254
case IPPROTO_GRE:
4255+
return features;
42554256
case IPPROTO_IPIP:
42564257
case IPPROTO_IPV6:
4257-
return features;
4258+
if (mlx5e_tunnel_proto_supported(priv->mdev, IPPROTO_IPIP))
4259+
return features;
4260+
break;
42584261
case IPPROTO_UDP:
42594262
udph = udp_hdr(skb);
42604263
port = be16_to_cpu(udph->dest);

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

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3268,7 +3268,20 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv,
32683268

32693269
action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST |
32703270
MLX5_FLOW_CONTEXT_ACTION_COUNT;
3271-
if (netdev_port_same_parent_id(priv->netdev, out_dev)) {
3271+
if (encap) {
3272+
parse_attr->mirred_ifindex[attr->out_count] =
3273+
out_dev->ifindex;
3274+
parse_attr->tun_info[attr->out_count] = dup_tun_info(info);
3275+
if (!parse_attr->tun_info[attr->out_count])
3276+
return -ENOMEM;
3277+
encap = false;
3278+
attr->dests[attr->out_count].flags |=
3279+
MLX5_ESW_DEST_ENCAP;
3280+
attr->out_count++;
3281+
/* attr->dests[].rep is resolved when we
3282+
* handle encap
3283+
*/
3284+
} else if (netdev_port_same_parent_id(priv->netdev, out_dev)) {
32723285
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
32733286
struct net_device *uplink_dev = mlx5_eswitch_uplink_get_proto_dev(esw, REP_ETH);
32743287
struct net_device *uplink_upper;
@@ -3310,19 +3323,6 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv,
33103323
attr->dests[attr->out_count].rep = rpriv->rep;
33113324
attr->dests[attr->out_count].mdev = out_priv->mdev;
33123325
attr->out_count++;
3313-
} else if (encap) {
3314-
parse_attr->mirred_ifindex[attr->out_count] =
3315-
out_dev->ifindex;
3316-
parse_attr->tun_info[attr->out_count] = dup_tun_info(info);
3317-
if (!parse_attr->tun_info[attr->out_count])
3318-
return -ENOMEM;
3319-
encap = false;
3320-
attr->dests[attr->out_count].flags |=
3321-
MLX5_ESW_DEST_ENCAP;
3322-
attr->out_count++;
3323-
/* attr->dests[].rep is resolved when we
3324-
* handle encap
3325-
*/
33263326
} else if (parse_attr->filter_dev != priv->netdev) {
33273327
/* All mlx5 devices are called to configure
33283328
* high level device filters. Therefore, the
@@ -4000,9 +4000,8 @@ int mlx5e_tc_configure_matchall(struct mlx5e_priv *priv,
40004000
struct tc_cls_matchall_offload *ma)
40014001
{
40024002
struct netlink_ext_ack *extack = ma->common.extack;
4003-
int prio = TC_H_MAJ(ma->common.prio) >> 16;
40044003

4005-
if (prio != 1) {
4004+
if (ma->common.prio != 1) {
40064005
NL_SET_ERR_MSG_MOD(extack, "only priority 1 is supported");
40074006
return -EINVAL;
40084007
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2117,7 +2117,7 @@ int mlx5_eswitch_set_vport_state(struct mlx5_eswitch *esw,
21172117

21182118
unlock:
21192119
mutex_unlock(&esw->state_lock);
2120-
return 0;
2120+
return err;
21212121
}
21222122

21232123
int mlx5_eswitch_get_vport_config(struct mlx5_eswitch *esw,

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ static void del_sw_flow_group(struct fs_node *node)
579579

580580
rhashtable_destroy(&fg->ftes_hash);
581581
ida_destroy(&fg->fte_allocator);
582-
if (ft->autogroup.active)
582+
if (ft->autogroup.active && fg->max_ftes == ft->autogroup.group_size)
583583
ft->autogroup.num_groups--;
584584
err = rhltable_remove(&ft->fgs_hash,
585585
&fg->hash,
@@ -1126,6 +1126,8 @@ mlx5_create_auto_grouped_flow_table(struct mlx5_flow_namespace *ns,
11261126

11271127
ft->autogroup.active = true;
11281128
ft->autogroup.required_groups = max_num_groups;
1129+
/* We save place for flow groups in addition to max types */
1130+
ft->autogroup.group_size = ft->max_fte / (max_num_groups + 1);
11291131

11301132
return ft;
11311133
}
@@ -1328,8 +1330,7 @@ static struct mlx5_flow_group *alloc_auto_flow_group(struct mlx5_flow_table *ft
13281330
return ERR_PTR(-ENOENT);
13291331

13301332
if (ft->autogroup.num_groups < ft->autogroup.required_groups)
1331-
/* We save place for flow groups in addition to max types */
1332-
group_size = ft->max_fte / (ft->autogroup.required_groups + 1);
1333+
group_size = ft->autogroup.group_size;
13331334

13341335
/* ft->max_fte == ft->autogroup.max_types */
13351336
if (group_size == 0)
@@ -1356,7 +1357,8 @@ static struct mlx5_flow_group *alloc_auto_flow_group(struct mlx5_flow_table *ft
13561357
if (IS_ERR(fg))
13571358
goto out;
13581359

1359-
ft->autogroup.num_groups++;
1360+
if (group_size == ft->autogroup.group_size)
1361+
ft->autogroup.num_groups++;
13601362

13611363
out:
13621364
return fg;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ struct mlx5_flow_table {
162162
struct {
163163
bool active;
164164
unsigned int required_groups;
165+
unsigned int group_size;
165166
unsigned int num_groups;
166167
} autogroup;
167168
/* Protect fwd_rules */

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,6 +1566,7 @@ static const struct pci_device_id mlx5_core_pci_table[] = {
15661566
{ PCI_VDEVICE(MELLANOX, 0x101c), MLX5_PCI_DEV_IS_VF}, /* ConnectX-6 VF */
15671567
{ PCI_VDEVICE(MELLANOX, 0x101d) }, /* ConnectX-6 Dx */
15681568
{ PCI_VDEVICE(MELLANOX, 0x101e), MLX5_PCI_DEV_IS_VF}, /* ConnectX Family mlx5Gen Virtual Function */
1569+
{ PCI_VDEVICE(MELLANOX, 0x101f) }, /* ConnectX-6 LX */
15691570
{ PCI_VDEVICE(MELLANOX, 0xa2d2) }, /* BlueField integrated ConnectX-5 network controller */
15701571
{ PCI_VDEVICE(MELLANOX, 0xa2d3), MLX5_PCI_DEV_IS_VF}, /* BlueField integrated ConnectX-5 network controller VF */
15711572
{ PCI_VDEVICE(MELLANOX, 0xa2d6) }, /* BlueField-2 integrated ConnectX-6 Dx network controller */

drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,18 @@ static void dr_rule_clean_rule_members(struct mlx5dr_rule *rule,
595595
}
596596
}
597597

598+
static u16 dr_get_bits_per_mask(u16 byte_mask)
599+
{
600+
u16 bits = 0;
601+
602+
while (byte_mask) {
603+
byte_mask = byte_mask & (byte_mask - 1);
604+
bits++;
605+
}
606+
607+
return bits;
608+
}
609+
598610
static bool dr_rule_need_enlarge_hash(struct mlx5dr_ste_htbl *htbl,
599611
struct mlx5dr_domain *dmn,
600612
struct mlx5dr_domain_rx_tx *nic_dmn)
@@ -607,6 +619,9 @@ static bool dr_rule_need_enlarge_hash(struct mlx5dr_ste_htbl *htbl,
607619
if (!ctrl->may_grow)
608620
return false;
609621

622+
if (dr_get_bits_per_mask(htbl->byte_mask) * BITS_PER_BYTE <= htbl->chunk_size)
623+
return false;
624+
610625
if (ctrl->num_of_collisions >= ctrl->increase_threshold &&
611626
(ctrl->num_of_valid_entries - ctrl->num_of_collisions) >= ctrl->increase_threshold)
612627
return true;

drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,7 @@ static struct mlx5dr_cq *dr_create_cq(struct mlx5_core_dev *mdev,
700700
unsigned int irqn;
701701
void *cqc, *in;
702702
__be64 *pas;
703+
int vector;
703704
u32 i;
704705

705706
cq = kzalloc(sizeof(*cq), GFP_KERNEL);
@@ -728,7 +729,8 @@ static struct mlx5dr_cq *dr_create_cq(struct mlx5_core_dev *mdev,
728729
if (!in)
729730
goto err_cqwq;
730731

731-
err = mlx5_vector2eqn(mdev, smp_processor_id(), &eqn, &irqn);
732+
vector = smp_processor_id() % mlx5_comp_vectors_count(mdev);
733+
err = mlx5_vector2eqn(mdev, vector, &eqn, &irqn);
732734
if (err) {
733735
kvfree(in);
734736
goto err_cqwq;

0 commit comments

Comments
 (0)