Skip to content

Commit 4856413

Browse files
matanb10davem330
authored andcommitted
net/mlx4_core: Demote simple multicast and broadcast flow steering rules
In SRIOV, when simple (i.e - Ethernet L2 only) flow steering rules are created, always create them at MLX4_DOMAIN_NIC priority (instead of the real priority the function created them at). This is done in order to let multiple functions add broadcast/multicast rules without affecting other functions, which is necessary for DPDK in SRIOV. Signed-off-by: Matan Barak <[email protected]> Signed-off-by: Or Gerlitz <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9d52bf0 commit 4856413

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

drivers/infiniband/hw/mlx4/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ static int __mlx4_ib_create_flow(struct ib_qp *qp, struct ib_flow_attr *flow_att
10901090

10911091
ret = mlx4_cmd_imm(mdev->dev, mailbox->dma, reg_id, size >> 2, 0,
10921092
MLX4_QP_FLOW_STEERING_ATTACH, MLX4_CMD_TIME_CLASS_A,
1093-
MLX4_CMD_NATIVE);
1093+
MLX4_CMD_WRAPPED);
10941094
if (ret == -ENOMEM)
10951095
pr_err("mcg table is full. Fail to register network rule.\n");
10961096
else if (ret == -ENXIO)
@@ -1107,7 +1107,7 @@ static int __mlx4_ib_destroy_flow(struct mlx4_dev *dev, u64 reg_id)
11071107
int err;
11081108
err = mlx4_cmd(dev, reg_id, 0, 0,
11091109
MLX4_QP_FLOW_STEERING_DETACH, MLX4_CMD_TIME_CLASS_A,
1110-
MLX4_CMD_NATIVE);
1110+
MLX4_CMD_WRAPPED);
11111111
if (err)
11121112
pr_err("Fail to detach network rule. registration id = 0x%llx\n",
11131113
reg_id);

drivers/net/ethernet/mellanox/mlx4/resource_tracker.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3973,6 +3973,22 @@ static int validate_eth_header_mac(int slave, struct _rule_hw *eth_header,
39733973
return 0;
39743974
}
39753975

3976+
static void handle_eth_header_mcast_prio(struct mlx4_net_trans_rule_hw_ctrl *ctrl,
3977+
struct _rule_hw *eth_header)
3978+
{
3979+
if (is_multicast_ether_addr(eth_header->eth.dst_mac) ||
3980+
is_broadcast_ether_addr(eth_header->eth.dst_mac)) {
3981+
struct mlx4_net_trans_rule_hw_eth *eth =
3982+
(struct mlx4_net_trans_rule_hw_eth *)eth_header;
3983+
struct _rule_hw *next_rule = (struct _rule_hw *)(eth + 1);
3984+
bool last_rule = next_rule->size == 0 && next_rule->id == 0 &&
3985+
next_rule->rsvd == 0;
3986+
3987+
if (last_rule)
3988+
ctrl->prio = cpu_to_be16(MLX4_DOMAIN_NIC);
3989+
}
3990+
}
3991+
39763992
/*
39773993
* In case of missing eth header, append eth header with a MAC address
39783994
* assigned to the VF.
@@ -4125,6 +4141,12 @@ int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
41254141
rule_header = (struct _rule_hw *)(ctrl + 1);
41264142
header_id = map_hw_to_sw_id(be16_to_cpu(rule_header->id));
41274143

4144+
if (header_id == MLX4_NET_TRANS_RULE_ID_ETH)
4145+
handle_eth_header_mcast_prio(ctrl, rule_header);
4146+
4147+
if (slave == dev->caps.function)
4148+
goto execute;
4149+
41284150
switch (header_id) {
41294151
case MLX4_NET_TRANS_RULE_ID_ETH:
41304152
if (validate_eth_header_mac(slave, rule_header, rlist)) {
@@ -4151,6 +4173,7 @@ int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
41514173
goto err_put;
41524174
}
41534175

4176+
execute:
41544177
err = mlx4_cmd_imm(dev, inbox->dma, &vhcr->out_param,
41554178
vhcr->in_modifier, 0,
41564179
MLX4_QP_FLOW_STEERING_ATTACH, MLX4_CMD_TIME_CLASS_A,

0 commit comments

Comments
 (0)