| .. | .. |
|---|
| 90 | 90 | |
|---|
| 91 | 91 | static int arfs_disable(struct mlx5e_priv *priv) |
|---|
| 92 | 92 | { |
|---|
| 93 | | - struct mlx5_flow_destination dest = {}; |
|---|
| 94 | | - struct mlx5e_tir *tir = priv->indir_tir; |
|---|
| 95 | | - int err = 0; |
|---|
| 96 | | - int tt; |
|---|
| 97 | | - int i; |
|---|
| 93 | + int err, i; |
|---|
| 98 | 94 | |
|---|
| 99 | | - dest.type = MLX5_FLOW_DESTINATION_TYPE_TIR; |
|---|
| 100 | 95 | for (i = 0; i < ARFS_NUM_TYPES; i++) { |
|---|
| 101 | | - dest.tir_num = tir[i].tirn; |
|---|
| 102 | | - tt = arfs_get_tt(i); |
|---|
| 103 | | - /* Modify ttc rules destination to bypass the aRFS tables*/ |
|---|
| 104 | | - err = mlx5_modify_rule_destination(priv->fs.ttc.rules[tt], |
|---|
| 105 | | - &dest, NULL); |
|---|
| 96 | + /* Modify ttc rules destination back to their default */ |
|---|
| 97 | + err = mlx5e_ttc_fwd_default_dest(priv, arfs_get_tt(i)); |
|---|
| 106 | 98 | if (err) { |
|---|
| 107 | 99 | netdev_err(priv->netdev, |
|---|
| 108 | | - "%s: modify ttc destination failed\n", |
|---|
| 109 | | - __func__); |
|---|
| 100 | + "%s: modify ttc[%d] default destination failed, err(%d)\n", |
|---|
| 101 | + __func__, arfs_get_tt(i), err); |
|---|
| 110 | 102 | return err; |
|---|
| 111 | 103 | } |
|---|
| 112 | 104 | } |
|---|
| .. | .. |
|---|
| 125 | 117 | int mlx5e_arfs_enable(struct mlx5e_priv *priv) |
|---|
| 126 | 118 | { |
|---|
| 127 | 119 | struct mlx5_flow_destination dest = {}; |
|---|
| 128 | | - int err = 0; |
|---|
| 129 | | - int tt; |
|---|
| 130 | | - int i; |
|---|
| 120 | + int err, i; |
|---|
| 131 | 121 | |
|---|
| 132 | 122 | dest.type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE; |
|---|
| 133 | 123 | for (i = 0; i < ARFS_NUM_TYPES; i++) { |
|---|
| 134 | 124 | dest.ft = priv->fs.arfs.arfs_tables[i].ft.t; |
|---|
| 135 | | - tt = arfs_get_tt(i); |
|---|
| 136 | 125 | /* Modify ttc rules destination to point on the aRFS FTs */ |
|---|
| 137 | | - err = mlx5_modify_rule_destination(priv->fs.ttc.rules[tt], |
|---|
| 138 | | - &dest, NULL); |
|---|
| 126 | + err = mlx5e_ttc_fwd_dest(priv, arfs_get_tt(i), &dest); |
|---|
| 139 | 127 | if (err) { |
|---|
| 140 | 128 | netdev_err(priv->netdev, |
|---|
| 141 | | - "%s: modify ttc destination failed err=%d\n", |
|---|
| 142 | | - __func__, err); |
|---|
| 129 | + "%s: modify ttc[%d] dest to arfs, failed err(%d)\n", |
|---|
| 130 | + __func__, arfs_get_tt(i), err); |
|---|
| 143 | 131 | arfs_disable(priv); |
|---|
| 144 | 132 | return err; |
|---|
| 145 | 133 | } |
|---|
| .. | .. |
|---|
| 175 | 163 | struct mlx5e_tir *tir = priv->indir_tir; |
|---|
| 176 | 164 | struct mlx5_flow_destination dest = {}; |
|---|
| 177 | 165 | MLX5_DECLARE_FLOW_ACT(flow_act); |
|---|
| 178 | | - struct mlx5_flow_spec *spec; |
|---|
| 179 | 166 | enum mlx5e_traffic_types tt; |
|---|
| 180 | 167 | int err = 0; |
|---|
| 181 | | - |
|---|
| 182 | | - spec = kvzalloc(sizeof(*spec), GFP_KERNEL); |
|---|
| 183 | | - if (!spec) { |
|---|
| 184 | | - err = -ENOMEM; |
|---|
| 185 | | - goto out; |
|---|
| 186 | | - } |
|---|
| 187 | 168 | |
|---|
| 188 | 169 | dest.type = MLX5_FLOW_DESTINATION_TYPE_TIR; |
|---|
| 189 | 170 | tt = arfs_get_tt(type); |
|---|
| 190 | 171 | if (tt == -EINVAL) { |
|---|
| 191 | 172 | netdev_err(priv->netdev, "%s: bad arfs_type: %d\n", |
|---|
| 192 | 173 | __func__, type); |
|---|
| 193 | | - err = -EINVAL; |
|---|
| 194 | | - goto out; |
|---|
| 174 | + return -EINVAL; |
|---|
| 195 | 175 | } |
|---|
| 196 | 176 | |
|---|
| 177 | + /* FIXME: Must use mlx5e_ttc_get_default_dest(), |
|---|
| 178 | + * but can't since TTC default is not setup yet ! |
|---|
| 179 | + */ |
|---|
| 197 | 180 | dest.tir_num = tir[tt].tirn; |
|---|
| 198 | | - |
|---|
| 199 | | - arfs_t->default_rule = mlx5_add_flow_rules(arfs_t->ft.t, spec, |
|---|
| 181 | + arfs_t->default_rule = mlx5_add_flow_rules(arfs_t->ft.t, NULL, |
|---|
| 200 | 182 | &flow_act, |
|---|
| 201 | 183 | &dest, 1); |
|---|
| 202 | 184 | if (IS_ERR(arfs_t->default_rule)) { |
|---|
| .. | .. |
|---|
| 205 | 187 | netdev_err(priv->netdev, "%s: add rule failed, arfs type=%d\n", |
|---|
| 206 | 188 | __func__, type); |
|---|
| 207 | 189 | } |
|---|
| 208 | | -out: |
|---|
| 209 | | - kvfree(spec); |
|---|
| 190 | + |
|---|
| 210 | 191 | return err; |
|---|
| 211 | 192 | } |
|---|
| 212 | 193 | |
|---|
| .. | .. |
|---|
| 229 | 210 | sizeof(*ft->g), GFP_KERNEL); |
|---|
| 230 | 211 | in = kvzalloc(inlen, GFP_KERNEL); |
|---|
| 231 | 212 | if (!in || !ft->g) { |
|---|
| 232 | | - kvfree(ft->g); |
|---|
| 213 | + kfree(ft->g); |
|---|
| 233 | 214 | kvfree(in); |
|---|
| 234 | 215 | return -ENOMEM; |
|---|
| 235 | 216 | } |
|---|
| .. | .. |
|---|
| 537 | 518 | rule = mlx5_add_flow_rules(ft, spec, &flow_act, &dest, 1); |
|---|
| 538 | 519 | if (IS_ERR(rule)) { |
|---|
| 539 | 520 | err = PTR_ERR(rule); |
|---|
| 540 | | - netdev_err(priv->netdev, "%s: add rule(filter id=%d, rq idx=%d) failed, err=%d\n", |
|---|
| 541 | | - __func__, arfs_rule->filter_id, arfs_rule->rxq, err); |
|---|
| 521 | + priv->channel_stats[arfs_rule->rxq].rq.arfs_err++; |
|---|
| 522 | + mlx5e_dbg(HW, priv, |
|---|
| 523 | + "%s: add rule(filter id=%d, rq idx=%d, ip proto=0x%x) failed,err=%d\n", |
|---|
| 524 | + __func__, arfs_rule->filter_id, arfs_rule->rxq, |
|---|
| 525 | + tuple->ip_proto, err); |
|---|
| 542 | 526 | } |
|---|
| 543 | 527 | |
|---|
| 544 | 528 | out: |
|---|