History

net/mlx5: Pass flow steering objects to fs_cmd

Pass the flow steering objects instead of their attributes to fs_cmd in order to decrease number of arguments and in addition it will be used to update object fields. Pass the flow steering root namespace instead of the device so will have context to the namespace in the fs_cmd layer.

Maor Gottlieb committed 7 years ago

Commit ae288a41 parent 72c6f524 files · +128 −132Browse files

Unified · Split

4 files
  1. drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c +45 −41
  2. drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c +50 −49
  3. drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.h +15 −18
  4. drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +18 −24
drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c+45−41
@@ -989,32 +989,33 @@ static enum fs_flow_table_type egress_to_fs_ft(bool egress) · 988 unmodified lines
989 return egress ? FS_FT_NIC_TX : FS_FT_NIC_RX;989 return egress ? FS_FT_NIC_TX : FS_FT_NIC_RX;
990}990}
991 991
992static int fpga_ipsec_fs_create_flow_group(struct mlx5_core_dev *dev,992static int fpga_ipsec_fs_create_flow_group(struct mlx5_flow_root_namespace *ns,
993 struct mlx5_flow_table *ft,993 struct mlx5_flow_table *ft,
994 u32 *in,994 u32 *in,
995 unsigned int *group_id,995 struct mlx5_flow_group *fg,
996 bool is_egress)996 bool is_egress)
997{997{
998 int (*create_flow_group)(struct mlx5_core_dev *dev,998 int (*create_flow_group)(struct mlx5_flow_root_namespace *ns,
999 struct mlx5_flow_table *ft, u32 *in,999 struct mlx5_flow_table *ft, u32 *in,
1000 unsigned int *group_id) =1000 struct mlx5_flow_group *fg) =
1001 mlx5_fs_cmd_get_default(egress_to_fs_ft(is_egress))->create_flow_group;1001 mlx5_fs_cmd_get_default(egress_to_fs_ft(is_egress))->create_flow_group;
1002 char *misc_params_c = MLX5_ADDR_OF(create_flow_group_in, in,1002 char *misc_params_c = MLX5_ADDR_OF(create_flow_group_in, in,
1003 match_criteria.misc_parameters);1003 match_criteria.misc_parameters);
1004 struct mlx5_core_dev *dev = ns->dev;
1004 u32 saved_outer_esp_spi_mask;1005 u32 saved_outer_esp_spi_mask;
1005 u8 match_criteria_enable;1006 u8 match_criteria_enable;
1006 int ret;1007 int ret;
1007 1008
1008 if (MLX5_CAP_FLOWTABLE(dev,1009 if (MLX5_CAP_FLOWTABLE(dev,
1009 flow_table_properties_nic_receive.ft_field_support.outer_esp_spi))1010 flow_table_properties_nic_receive.ft_field_support.outer_esp_spi))
1010 return create_flow_group(dev, ft, in, group_id);1011 return create_flow_group(ns, ft, in, fg);
1011 1012
1012 match_criteria_enable =1013 match_criteria_enable =
1013 MLX5_GET(create_flow_group_in, in, match_criteria_enable);1014 MLX5_GET(create_flow_group_in, in, match_criteria_enable);
1014 saved_outer_esp_spi_mask =1015 saved_outer_esp_spi_mask =
1015 MLX5_GET(fte_match_set_misc, misc_params_c, outer_esp_spi);1016 MLX5_GET(fte_match_set_misc, misc_params_c, outer_esp_spi);
1016 if (!match_criteria_enable || !saved_outer_esp_spi_mask)1017 if (!match_criteria_enable || !saved_outer_esp_spi_mask)
1017 return create_flow_group(dev, ft, in, group_id);1018 return create_flow_group(ns, ft, in, fg);
1018 1019
1019 MLX5_SET(fte_match_set_misc, misc_params_c, outer_esp_spi, 0);1020 MLX5_SET(fte_match_set_misc, misc_params_c, outer_esp_spi, 0);
1020 1021
@@ -1023,7 +1024,7 @@ static int fpga_ipsec_fs_create_flow_group(struct mlx5_core_dev *dev, · 2 unmodified lines
1023 MLX5_SET(create_flow_group_in, in, match_criteria_enable,1024 MLX5_SET(create_flow_group_in, in, match_criteria_enable,
1024 match_criteria_enable & ~MLX5_MATCH_MISC_PARAMETERS);1025 match_criteria_enable & ~MLX5_MATCH_MISC_PARAMETERS);
1025 1026
1026 ret = create_flow_group(dev, ft, in, group_id);1027 ret = create_flow_group(ns, ft, in, fg);
1027 1028
1028 MLX5_SET(fte_match_set_misc, misc_params_c, outer_esp_spi, saved_outer_esp_spi_mask);1029 MLX5_SET(fte_match_set_misc, misc_params_c, outer_esp_spi, saved_outer_esp_spi_mask);
1029 MLX5_SET(create_flow_group_in, in, match_criteria_enable, match_criteria_enable);1030 MLX5_SET(create_flow_group_in, in, match_criteria_enable, match_criteria_enable);
@@ -1031,17 +1032,18 @@ static int fpga_ipsec_fs_create_flow_group(struct mlx5_core_dev *dev, · 1 unmodified line
1031 return ret;1032 return ret;
1032}1033}
1033 1034
1034static int fpga_ipsec_fs_create_fte(struct mlx5_core_dev *dev,1035static int fpga_ipsec_fs_create_fte(struct mlx5_flow_root_namespace *ns,
1035 struct mlx5_flow_table *ft,1036 struct mlx5_flow_table *ft,
1036 struct mlx5_flow_group *fg,1037 struct mlx5_flow_group *fg,
1037 struct fs_fte *fte,1038 struct fs_fte *fte,
1038 bool is_egress)1039 bool is_egress)
1039{1040{
1040 int (*create_fte)(struct mlx5_core_dev *dev,1041 int (*create_fte)(struct mlx5_flow_root_namespace *ns,
1041 struct mlx5_flow_table *ft,1042 struct mlx5_flow_table *ft,
1042 struct mlx5_flow_group *fg,1043 struct mlx5_flow_group *fg,
1043 struct fs_fte *fte) =1044 struct fs_fte *fte) =
1044 mlx5_fs_cmd_get_default(egress_to_fs_ft(is_egress))->create_fte;1045 mlx5_fs_cmd_get_default(egress_to_fs_ft(is_egress))->create_fte;
1046 struct mlx5_core_dev *dev = ns->dev;
1045 struct mlx5_fpga_device *fdev = dev->fpga;1047 struct mlx5_fpga_device *fdev = dev->fpga;
1046 struct mlx5_fpga_ipsec *fipsec = fdev->ipsec;1048 struct mlx5_fpga_ipsec *fipsec = fdev->ipsec;
1047 struct mlx5_fpga_ipsec_rule *rule;1049 struct mlx5_fpga_ipsec_rule *rule;
@@ -1053,7 +1055,7 @@ static int fpga_ipsec_fs_create_fte(struct mlx5_core_dev *dev, · 5 unmodified lines
1053 !(fte->action.action &1055 !(fte->action.action &
1054 (MLX5_FLOW_CONTEXT_ACTION_ENCRYPT |1056 (MLX5_FLOW_CONTEXT_ACTION_ENCRYPT |
1055 MLX5_FLOW_CONTEXT_ACTION_DECRYPT)))1057 MLX5_FLOW_CONTEXT_ACTION_DECRYPT)))
1056 return create_fte(dev, ft, fg, fte);1058 return create_fte(ns, ft, fg, fte);
1057 1059
1058 rule = kzalloc(sizeof(*rule), GFP_KERNEL);1060 rule = kzalloc(sizeof(*rule), GFP_KERNEL);
1059 if (!rule)1061 if (!rule)
@@ -1070,7 +1072,7 @@ static int fpga_ipsec_fs_create_fte(struct mlx5_core_dev *dev, · 10 unmodified lines
1070 WARN_ON(rule_insert(fipsec, rule));1072 WARN_ON(rule_insert(fipsec, rule));
1071 1073
1072 modify_spec_mailbox(dev, fte, &mbox_mod);1074 modify_spec_mailbox(dev, fte, &mbox_mod);
1073 ret = create_fte(dev, ft, fg, fte);1075 ret = create_fte(ns, ft, fg, fte);
1074 restore_spec_mailbox(fte, &mbox_mod);1076 restore_spec_mailbox(fte, &mbox_mod);
1075 if (ret) {1077 if (ret) {
1076 _rule_delete(fipsec, rule);1078 _rule_delete(fipsec, rule);
@@ -1081,19 +1083,20 @@ static int fpga_ipsec_fs_create_fte(struct mlx5_core_dev *dev, · 4 unmodified lines
1081 return ret;1083 return ret;
1082}1084}
1083 1085
1084static int fpga_ipsec_fs_update_fte(struct mlx5_core_dev *dev,1086static int fpga_ipsec_fs_update_fte(struct mlx5_flow_root_namespace *ns,
1085 struct mlx5_flow_table *ft,1087 struct mlx5_flow_table *ft,
1086 unsigned int group_id,1088 struct mlx5_flow_group *fg,
1087 int modify_mask,1089 int modify_mask,
1088 struct fs_fte *fte,1090 struct fs_fte *fte,
1089 bool is_egress)1091 bool is_egress)
1090{1092{
1091 int (*update_fte)(struct mlx5_core_dev *dev,1093 int (*update_fte)(struct mlx5_flow_root_namespace *ns,
1092 struct mlx5_flow_table *ft,1094 struct mlx5_flow_table *ft,
1093 unsigned int group_id,1095 struct mlx5_flow_group *fg,
1094 int modify_mask,1096 int modify_mask,
1095 struct fs_fte *fte) =1097 struct fs_fte *fte) =
1096 mlx5_fs_cmd_get_default(egress_to_fs_ft(is_egress))->update_fte;1098 mlx5_fs_cmd_get_default(egress_to_fs_ft(is_egress))->update_fte;
1099 struct mlx5_core_dev *dev = ns->dev;
1097 bool is_esp = fte->action.esp_id;1100 bool is_esp = fte->action.esp_id;
1098 struct mailbox_mod mbox_mod;1101 struct mailbox_mod mbox_mod;
1099 int ret;1102 int ret;
@@ -1102,24 +1105,25 @@ static int fpga_ipsec_fs_update_fte(struct mlx5_core_dev *dev, · 2 unmodified lines
1102 !(fte->action.action &1105 !(fte->action.action &
1103 (MLX5_FLOW_CONTEXT_ACTION_ENCRYPT |1106 (MLX5_FLOW_CONTEXT_ACTION_ENCRYPT |
1104 MLX5_FLOW_CONTEXT_ACTION_DECRYPT)))1107 MLX5_FLOW_CONTEXT_ACTION_DECRYPT)))
1105 return update_fte(dev, ft, group_id, modify_mask, fte);1108 return update_fte(ns, ft, fg, modify_mask, fte);
1106 1109
1107 modify_spec_mailbox(dev, fte, &mbox_mod);1110 modify_spec_mailbox(dev, fte, &mbox_mod);
1108 ret = update_fte(dev, ft, group_id, modify_mask, fte);1111 ret = update_fte(ns, ft, fg, modify_mask, fte);
1109 restore_spec_mailbox(fte, &mbox_mod);1112 restore_spec_mailbox(fte, &mbox_mod);
1110 1113
1111 return ret;1114 return ret;
1112}1115}
1113 1116
1114static int fpga_ipsec_fs_delete_fte(struct mlx5_core_dev *dev,1117static int fpga_ipsec_fs_delete_fte(struct mlx5_flow_root_namespace *ns,
1115 struct mlx5_flow_table *ft,1118 struct mlx5_flow_table *ft,
1116 struct fs_fte *fte,1119 struct fs_fte *fte,
1117 bool is_egress)1120 bool is_egress)
1118{1121{
1119 int (*delete_fte)(struct mlx5_core_dev *dev,1122 int (*delete_fte)(struct mlx5_flow_root_namespace *ns,
1120 struct mlx5_flow_table *ft,1123 struct mlx5_flow_table *ft,
1121 struct fs_fte *fte) =1124 struct fs_fte *fte) =
1122 mlx5_fs_cmd_get_default(egress_to_fs_ft(is_egress))->delete_fte;1125 mlx5_fs_cmd_get_default(egress_to_fs_ft(is_egress))->delete_fte;
1126 struct mlx5_core_dev *dev = ns->dev;
1123 struct mlx5_fpga_device *fdev = dev->fpga;1127 struct mlx5_fpga_device *fdev = dev->fpga;
1124 struct mlx5_fpga_ipsec *fipsec = fdev->ipsec;1128 struct mlx5_fpga_ipsec *fipsec = fdev->ipsec;
1125 struct mlx5_fpga_ipsec_rule *rule;1129 struct mlx5_fpga_ipsec_rule *rule;
@@ -1131,7 +1135,7 @@ static int fpga_ipsec_fs_delete_fte(struct mlx5_core_dev *dev, · 5 unmodified lines
1131 !(fte->action.action &1135 !(fte->action.action &
1132 (MLX5_FLOW_CONTEXT_ACTION_ENCRYPT |1136 (MLX5_FLOW_CONTEXT_ACTION_ENCRYPT |
1133 MLX5_FLOW_CONTEXT_ACTION_DECRYPT)))1137 MLX5_FLOW_CONTEXT_ACTION_DECRYPT)))
1134 return delete_fte(dev, ft, fte);1138 return delete_fte(ns, ft, fte);
1135 1139
1136 rule = rule_search(fipsec, fte);1140 rule = rule_search(fipsec, fte);
1137 if (!rule)1141 if (!rule)
@@ -1141,84 +1145,84 @@ static int fpga_ipsec_fs_delete_fte(struct mlx5_core_dev *dev, · 3 unmodified lines
1141 rule_delete(fipsec, rule);1145 rule_delete(fipsec, rule);
1142 1146
1143 modify_spec_mailbox(dev, fte, &mbox_mod);1147 modify_spec_mailbox(dev, fte, &mbox_mod);
1144 ret = delete_fte(dev, ft, fte);1148 ret = delete_fte(ns, ft, fte);
1145 restore_spec_mailbox(fte, &mbox_mod);1149 restore_spec_mailbox(fte, &mbox_mod);
1146 1150
1147 return ret;1151 return ret;
1148}1152}
1149 1153
1150static int1154static int
1151mlx5_fpga_ipsec_fs_create_flow_group_egress(struct mlx5_core_dev *dev,1155mlx5_fpga_ipsec_fs_create_flow_group_egress(struct mlx5_flow_root_namespace *ns,
1152 struct mlx5_flow_table *ft,1156 struct mlx5_flow_table *ft,
1153 u32 *in,1157 u32 *in,
1154 unsigned int *group_id)1158 struct mlx5_flow_group *fg)
1155{1159{
1156 return fpga_ipsec_fs_create_flow_group(dev, ft, in, group_id, true);1160 return fpga_ipsec_fs_create_flow_group(ns, ft, in, fg, true);
1157}1161}
1158 1162
1159static int1163static int
1160mlx5_fpga_ipsec_fs_create_fte_egress(struct mlx5_core_dev *dev,1164mlx5_fpga_ipsec_fs_create_fte_egress(struct mlx5_flow_root_namespace *ns,
1161 struct mlx5_flow_table *ft,1165 struct mlx5_flow_table *ft,
1162 struct mlx5_flow_group *fg,1166 struct mlx5_flow_group *fg,
1163 struct fs_fte *fte)1167 struct fs_fte *fte)
1164{1168{
1165 return fpga_ipsec_fs_create_fte(dev, ft, fg, fte, true);1169 return fpga_ipsec_fs_create_fte(ns, ft, fg, fte, true);
1166}1170}
1167 1171
1168static int1172static int
1169mlx5_fpga_ipsec_fs_update_fte_egress(struct mlx5_core_dev *dev,1173mlx5_fpga_ipsec_fs_update_fte_egress(struct mlx5_flow_root_namespace *ns,
1170 struct mlx5_flow_table *ft,1174 struct mlx5_flow_table *ft,
1171 unsigned int group_id,1175 struct mlx5_flow_group *fg,
1172 int modify_mask,1176 int modify_mask,
1173 struct fs_fte *fte)1177 struct fs_fte *fte)
1174{1178{
1175 return fpga_ipsec_fs_update_fte(dev, ft, group_id, modify_mask, fte,1179 return fpga_ipsec_fs_update_fte(ns, ft, fg, modify_mask, fte,
1176 true);1180 true);
1177}1181}
1178 1182
1179static int1183static int
1180mlx5_fpga_ipsec_fs_delete_fte_egress(struct mlx5_core_dev *dev,1184mlx5_fpga_ipsec_fs_delete_fte_egress(struct mlx5_flow_root_namespace *ns,
1181 struct mlx5_flow_table *ft,1185 struct mlx5_flow_table *ft,
1182 struct fs_fte *fte)1186 struct fs_fte *fte)
1183{1187{
1184 return fpga_ipsec_fs_delete_fte(dev, ft, fte, true);1188 return fpga_ipsec_fs_delete_fte(ns, ft, fte, true);
1185}1189}
1186 1190
1187static int1191static int
1188mlx5_fpga_ipsec_fs_create_flow_group_ingress(struct mlx5_core_dev *dev,1192mlx5_fpga_ipsec_fs_create_flow_group_ingress(struct mlx5_flow_root_namespace *ns,
1189 struct mlx5_flow_table *ft,1193 struct mlx5_flow_table *ft,
1190 u32 *in,1194 u32 *in,
1191 unsigned int *group_id)1195 struct mlx5_flow_group *fg)
1192{1196{
1193 return fpga_ipsec_fs_create_flow_group(dev, ft, in, group_id, false);1197 return fpga_ipsec_fs_create_flow_group(ns, ft, in, fg, false);
1194}1198}
1195 1199
1196static int1200static int
1197mlx5_fpga_ipsec_fs_create_fte_ingress(struct mlx5_core_dev *dev,1201mlx5_fpga_ipsec_fs_create_fte_ingress(struct mlx5_flow_root_namespace *ns,
1198 struct mlx5_flow_table *ft,1202 struct mlx5_flow_table *ft,
1199 struct mlx5_flow_group *fg,1203 struct mlx5_flow_group *fg,
1200 struct fs_fte *fte)1204 struct fs_fte *fte)
1201{1205{
1202 return fpga_ipsec_fs_create_fte(dev, ft, fg, fte, false);1206 return fpga_ipsec_fs_create_fte(ns, ft, fg, fte, false);
1203}1207}
1204 1208
1205static int1209static int
1206mlx5_fpga_ipsec_fs_update_fte_ingress(struct mlx5_core_dev *dev,1210mlx5_fpga_ipsec_fs_update_fte_ingress(struct mlx5_flow_root_namespace *ns,
1207 struct mlx5_flow_table *ft,1211 struct mlx5_flow_table *ft,
1208 unsigned int group_id,1212 struct mlx5_flow_group *fg,
1209 int modify_mask,1213 int modify_mask,
1210 struct fs_fte *fte)1214 struct fs_fte *fte)
1211{1215{
1212 return fpga_ipsec_fs_update_fte(dev, ft, group_id, modify_mask, fte,1216 return fpga_ipsec_fs_update_fte(ns, ft, fg, modify_mask, fte,
1213 false);1217 false);
1214}1218}
1215 1219
1216static int1220static int
1217mlx5_fpga_ipsec_fs_delete_fte_ingress(struct mlx5_core_dev *dev,1221mlx5_fpga_ipsec_fs_delete_fte_ingress(struct mlx5_flow_root_namespace *ns,
1218 struct mlx5_flow_table *ft,1222 struct mlx5_flow_table *ft,
1219 struct fs_fte *fte)1223 struct fs_fte *fte)
1220{1224{
1221 return fpga_ipsec_fs_delete_fte(dev, ft, fte, false);1225 return fpga_ipsec_fs_delete_fte(ns, ft, fte, false);
1222}1226}
1223 1227
1224static struct mlx5_flow_cmds fpga_ipsec_ingress;1228static struct mlx5_flow_cmds fpga_ipsec_ingress;
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c+50−49
@@ -39,7 +39,7 @@ · 38 unmodified lines
39#include "mlx5_core.h"39#include "mlx5_core.h"
40#include "eswitch.h"40#include "eswitch.h"
41 41
42static int mlx5_cmd_stub_update_root_ft(struct mlx5_core_dev *dev,42static int mlx5_cmd_stub_update_root_ft(struct mlx5_flow_root_namespace *ns,
43 struct mlx5_flow_table *ft,43 struct mlx5_flow_table *ft,
44 u32 underlay_qpn,44 u32 underlay_qpn,
45 bool disconnect)45 bool disconnect)
@@ -47,47 +47,43 @@ static int mlx5_cmd_stub_update_root_ft(struct mlx5_core_dev *dev, · 1 unmodified line
47 return 0;47 return 0;
48}48}
49 49
50static int mlx5_cmd_stub_create_flow_table(struct mlx5_core_dev *dev,50static int mlx5_cmd_stub_create_flow_table(struct mlx5_flow_root_namespace *ns,
51 u16 vport,51 struct mlx5_flow_table *ft,
52 enum fs_flow_table_op_mod op_mod,
53 enum fs_flow_table_type type,
54 unsigned int level,
55 unsigned int log_size,52 unsigned int log_size,
56 struct mlx5_flow_table *next_ft,53 struct mlx5_flow_table *next_ft)
57 unsigned int *table_id, u32 flags)
58{54{
59 return 0;55 return 0;
60}56}
61 57
62static int mlx5_cmd_stub_destroy_flow_table(struct mlx5_core_dev *dev,58static int mlx5_cmd_stub_destroy_flow_table(struct mlx5_flow_root_namespace *ns,
63 struct mlx5_flow_table *ft)59 struct mlx5_flow_table *ft)
64{60{
65 return 0;61 return 0;
66}62}
67 63
68static int mlx5_cmd_stub_modify_flow_table(struct mlx5_core_dev *dev,64static int mlx5_cmd_stub_modify_flow_table(struct mlx5_flow_root_namespace *ns,
69 struct mlx5_flow_table *ft,65 struct mlx5_flow_table *ft,
70 struct mlx5_flow_table *next_ft)66 struct mlx5_flow_table *next_ft)
71{67{
72 return 0;68 return 0;
73}69}
74 70
75static int mlx5_cmd_stub_create_flow_group(struct mlx5_core_dev *dev,71static int mlx5_cmd_stub_create_flow_group(struct mlx5_flow_root_namespace *ns,
76 struct mlx5_flow_table *ft,72 struct mlx5_flow_table *ft,
77 u32 *in,73 u32 *in,
78 unsigned int *group_id)74 struct mlx5_flow_group *fg)
79{75{
80 return 0;76 return 0;
81}77}
82 78
83static int mlx5_cmd_stub_destroy_flow_group(struct mlx5_core_dev *dev,79static int mlx5_cmd_stub_destroy_flow_group(struct mlx5_flow_root_namespace *ns,
84 struct mlx5_flow_table *ft,80 struct mlx5_flow_table *ft,
85 unsigned int group_id)81 struct mlx5_flow_group *fg)
86{82{
87 return 0;83 return 0;
88}84}
89 85
90static int mlx5_cmd_stub_create_fte(struct mlx5_core_dev *dev,86static int mlx5_cmd_stub_create_fte(struct mlx5_flow_root_namespace *ns,
91 struct mlx5_flow_table *ft,87 struct mlx5_flow_table *ft,
92 struct mlx5_flow_group *group,88 struct mlx5_flow_group *group,
93 struct fs_fte *fte)89 struct fs_fte *fte)
@@ -95,28 +91,29 @@ static int mlx5_cmd_stub_create_fte(struct mlx5_core_dev *dev, · 1 unmodified line
95 return 0;91 return 0;
96}92}
97 93
98static int mlx5_cmd_stub_update_fte(struct mlx5_core_dev *dev,94static int mlx5_cmd_stub_update_fte(struct mlx5_flow_root_namespace *ns,
99 struct mlx5_flow_table *ft,95 struct mlx5_flow_table *ft,
100 unsigned int group_id,96 struct mlx5_flow_group *group,
101 int modify_mask,97 int modify_mask,
102 struct fs_fte *fte)98 struct fs_fte *fte)
103{99{
104 return -EOPNOTSUPP;100 return -EOPNOTSUPP;
105}101}
106 102
107static int mlx5_cmd_stub_delete_fte(struct mlx5_core_dev *dev,103static int mlx5_cmd_stub_delete_fte(struct mlx5_flow_root_namespace *ns,
108 struct mlx5_flow_table *ft,104 struct mlx5_flow_table *ft,
109 struct fs_fte *fte)105 struct fs_fte *fte)
110{106{
111 return 0;107 return 0;
112}108}
113 109
114static int mlx5_cmd_update_root_ft(struct mlx5_core_dev *dev,110static int mlx5_cmd_update_root_ft(struct mlx5_flow_root_namespace *ns,
115 struct mlx5_flow_table *ft, u32 underlay_qpn,111 struct mlx5_flow_table *ft, u32 underlay_qpn,
116 bool disconnect)112 bool disconnect)
117{113{
118 u32 in[MLX5_ST_SZ_DW(set_flow_table_root_in)] = {0};114 u32 in[MLX5_ST_SZ_DW(set_flow_table_root_in)] = {0};
119 u32 out[MLX5_ST_SZ_DW(set_flow_table_root_out)] = {0};115 u32 out[MLX5_ST_SZ_DW(set_flow_table_root_out)] = {0};
116 struct mlx5_core_dev *dev = ns->dev;
120 117
121 if ((MLX5_CAP_GEN(dev, port_type) == MLX5_CAP_PORT_TYPE_IB) &&118 if ((MLX5_CAP_GEN(dev, port_type) == MLX5_CAP_PORT_TYPE_IB) &&
122 underlay_qpn == 0)119 underlay_qpn == 0)
@@ -143,29 +140,26 @@ static int mlx5_cmd_update_root_ft(struct mlx5_core_dev *dev, · 20 unmodified lines
143 return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));140 return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
144}141}
145 142
146static int mlx5_cmd_create_flow_table(struct mlx5_core_dev *dev,143static int mlx5_cmd_create_flow_table(struct mlx5_flow_root_namespace *ns,
147 u16 vport,144 struct mlx5_flow_table *ft,
148 enum fs_flow_table_op_mod op_mod,
149 enum fs_flow_table_type type,
150 unsigned int level,
151 unsigned int log_size,145 unsigned int log_size,
152 struct mlx5_flow_table *next_ft,146 struct mlx5_flow_table *next_ft)
153 unsigned int *table_id, u32 flags)
154{147{
155 int en_encap = !!(flags & MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT);148 int en_encap = !!(ft->flags & MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT);
156 int en_decap = !!(flags & MLX5_FLOW_TABLE_TUNNEL_EN_DECAP);149 int en_decap = !!(ft->flags & MLX5_FLOW_TABLE_TUNNEL_EN_DECAP);
157 u32 out[MLX5_ST_SZ_DW(create_flow_table_out)] = {0};150 u32 out[MLX5_ST_SZ_DW(create_flow_table_out)] = {0};
158 u32 in[MLX5_ST_SZ_DW(create_flow_table_in)] = {0};151 u32 in[MLX5_ST_SZ_DW(create_flow_table_in)] = {0};
152 struct mlx5_core_dev *dev = ns->dev;
159 int err;153 int err;
160 154
161 MLX5_SET(create_flow_table_in, in, opcode,155 MLX5_SET(create_flow_table_in, in, opcode,
162 MLX5_CMD_OP_CREATE_FLOW_TABLE);156 MLX5_CMD_OP_CREATE_FLOW_TABLE);
163 157
164 MLX5_SET(create_flow_table_in, in, table_type, type);158 MLX5_SET(create_flow_table_in, in, table_type, ft->type);
165 MLX5_SET(create_flow_table_in, in, flow_table_context.level, level);159 MLX5_SET(create_flow_table_in, in, flow_table_context.level, ft->level);
166 MLX5_SET(create_flow_table_in, in, flow_table_context.log_size, log_size);160 MLX5_SET(create_flow_table_in, in, flow_table_context.log_size, log_size);
167 if (vport) {161 if (ft->vport) {
168 MLX5_SET(create_flow_table_in, in, vport_number, vport);162 MLX5_SET(create_flow_table_in, in, vport_number, ft->vport);
169 MLX5_SET(create_flow_table_in, in, other_vport, 1);163 MLX5_SET(create_flow_table_in, in, other_vport, 1);
170 }164 }
171 165
@@ -174,7 +168,7 @@ static int mlx5_cmd_create_flow_table(struct mlx5_core_dev *dev, · 2 unmodified lines
174 MLX5_SET(create_flow_table_in, in, flow_table_context.reformat_en,168 MLX5_SET(create_flow_table_in, in, flow_table_context.reformat_en,
175 en_encap);169 en_encap);
176 170
177 switch (op_mod) {171 switch (ft->op_mod) {
178 case FS_FT_OP_MOD_NORMAL:172 case FS_FT_OP_MOD_NORMAL:
179 if (next_ft) {173 if (next_ft) {
180 MLX5_SET(create_flow_table_in, in,174 MLX5_SET(create_flow_table_in, in,
@@ -195,16 +189,17 @@ static int mlx5_cmd_create_flow_table(struct mlx5_core_dev *dev, · 14 unmodified lines
195 189
196 err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));190 err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
197 if (!err)191 if (!err)
198 *table_id = MLX5_GET(create_flow_table_out, out,192 ft->id = MLX5_GET(create_flow_table_out, out,
199 table_id);193 table_id);
200 return err;194 return err;
201}195}
202 196
203static int mlx5_cmd_destroy_flow_table(struct mlx5_core_dev *dev,197static int mlx5_cmd_destroy_flow_table(struct mlx5_flow_root_namespace *ns,
204 struct mlx5_flow_table *ft)198 struct mlx5_flow_table *ft)
205{199{
206 u32 in[MLX5_ST_SZ_DW(destroy_flow_table_in)] = {0};200 u32 in[MLX5_ST_SZ_DW(destroy_flow_table_in)] = {0};
207 u32 out[MLX5_ST_SZ_DW(destroy_flow_table_out)] = {0};201 u32 out[MLX5_ST_SZ_DW(destroy_flow_table_out)] = {0};
202 struct mlx5_core_dev *dev = ns->dev;
208 203
209 MLX5_SET(destroy_flow_table_in, in, opcode,204 MLX5_SET(destroy_flow_table_in, in, opcode,
210 MLX5_CMD_OP_DESTROY_FLOW_TABLE);205 MLX5_CMD_OP_DESTROY_FLOW_TABLE);
@@ -218,12 +213,13 @@ static int mlx5_cmd_destroy_flow_table(struct mlx5_core_dev *dev, · 7 unmodified lines
218 return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));213 return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
219}214}
220 215
221static int mlx5_cmd_modify_flow_table(struct mlx5_core_dev *dev,216static int mlx5_cmd_modify_flow_table(struct mlx5_flow_root_namespace *ns,
222 struct mlx5_flow_table *ft,217 struct mlx5_flow_table *ft,
223 struct mlx5_flow_table *next_ft)218 struct mlx5_flow_table *next_ft)
224{219{
225 u32 in[MLX5_ST_SZ_DW(modify_flow_table_in)] = {0};220 u32 in[MLX5_ST_SZ_DW(modify_flow_table_in)] = {0};
226 u32 out[MLX5_ST_SZ_DW(modify_flow_table_out)] = {0};221 u32 out[MLX5_ST_SZ_DW(modify_flow_table_out)] = {0};
222 struct mlx5_core_dev *dev = ns->dev;
227 223
228 MLX5_SET(modify_flow_table_in, in, opcode,224 MLX5_SET(modify_flow_table_in, in, opcode,
229 MLX5_CMD_OP_MODIFY_FLOW_TABLE);225 MLX5_CMD_OP_MODIFY_FLOW_TABLE);
@@ -263,13 +259,14 @@ static int mlx5_cmd_modify_flow_table(struct mlx5_core_dev *dev, · 33 unmodified lines
263 return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));259 return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
264}260}
265 261
266static int mlx5_cmd_create_flow_group(struct mlx5_core_dev *dev,262static int mlx5_cmd_create_flow_group(struct mlx5_flow_root_namespace *ns,
267 struct mlx5_flow_table *ft,263 struct mlx5_flow_table *ft,
268 u32 *in,264 u32 *in,
269 unsigned int *group_id)265 struct mlx5_flow_group *fg)
270{266{
271 u32 out[MLX5_ST_SZ_DW(create_flow_group_out)] = {0};267 u32 out[MLX5_ST_SZ_DW(create_flow_group_out)] = {0};
272 int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in);268 int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in);
269 struct mlx5_core_dev *dev = ns->dev;
273 int err;270 int err;
274 271
275 MLX5_SET(create_flow_group_in, in, opcode,272 MLX5_SET(create_flow_group_in, in, opcode,
@@ -283,23 +280,24 @@ static int mlx5_cmd_create_flow_group(struct mlx5_core_dev *dev, · 7 unmodified lines
283 280
284 err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out));281 err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out));
285 if (!err)282 if (!err)
286 *group_id = MLX5_GET(create_flow_group_out, out,283 fg->id = MLX5_GET(create_flow_group_out, out,
287 group_id);284 group_id);
288 return err;285 return err;
289}286}
290 287
291static int mlx5_cmd_destroy_flow_group(struct mlx5_core_dev *dev,288static int mlx5_cmd_destroy_flow_group(struct mlx5_flow_root_namespace *ns,
292 struct mlx5_flow_table *ft,289 struct mlx5_flow_table *ft,
293 unsigned int group_id)290 struct mlx5_flow_group *fg)
294{291{
295 u32 out[MLX5_ST_SZ_DW(destroy_flow_group_out)] = {0};292 u32 out[MLX5_ST_SZ_DW(destroy_flow_group_out)] = {0};
296 u32 in[MLX5_ST_SZ_DW(destroy_flow_group_in)] = {0};293 u32 in[MLX5_ST_SZ_DW(destroy_flow_group_in)] = {0};
294 struct mlx5_core_dev *dev = ns->dev;
297 295
298 MLX5_SET(destroy_flow_group_in, in, opcode,296 MLX5_SET(destroy_flow_group_in, in, opcode,
299 MLX5_CMD_OP_DESTROY_FLOW_GROUP);297 MLX5_CMD_OP_DESTROY_FLOW_GROUP);
300 MLX5_SET(destroy_flow_group_in, in, table_type, ft->type);298 MLX5_SET(destroy_flow_group_in, in, table_type, ft->type);
301 MLX5_SET(destroy_flow_group_in, in, table_id, ft->id);299 MLX5_SET(destroy_flow_group_in, in, table_id, ft->id);
302 MLX5_SET(destroy_flow_group_in, in, group_id, group_id);300 MLX5_SET(destroy_flow_group_in, in, group_id, fg->id);
303 if (ft->vport) {301 if (ft->vport) {
304 MLX5_SET(destroy_flow_group_in, in, vport_number, ft->vport);302 MLX5_SET(destroy_flow_group_in, in, vport_number, ft->vport);
305 MLX5_SET(destroy_flow_group_in, in, other_vport, 1);303 MLX5_SET(destroy_flow_group_in, in, other_vport, 1);
@@ -505,23 +503,25 @@ err_out: · 199 unmodified lines
505 return err;503 return err;
506}504}
507 505
508static int mlx5_cmd_create_fte(struct mlx5_core_dev *dev,506static int mlx5_cmd_create_fte(struct mlx5_flow_root_namespace *ns,
509 struct mlx5_flow_table *ft,507 struct mlx5_flow_table *ft,
510 struct mlx5_flow_group *group,508 struct mlx5_flow_group *group,
511 struct fs_fte *fte)509 struct fs_fte *fte)
512{510{
511 struct mlx5_core_dev *dev = ns->dev;
513 unsigned int group_id = group->id;512 unsigned int group_id = group->id;
514 513
515 return mlx5_cmd_set_fte(dev, 0, 0, ft, group_id, fte);514 return mlx5_cmd_set_fte(dev, 0, 0, ft, group_id, fte);
516}515}
517 516
518static int mlx5_cmd_update_fte(struct mlx5_core_dev *dev,517static int mlx5_cmd_update_fte(struct mlx5_flow_root_namespace *ns,
519 struct mlx5_flow_table *ft,518 struct mlx5_flow_table *ft,
520 unsigned int group_id,519 struct mlx5_flow_group *fg,
521 int modify_mask,520 int modify_mask,
522 struct fs_fte *fte)521 struct fs_fte *fte)
523{522{
524 int opmod;523 int opmod;
524 struct mlx5_core_dev *dev = ns->dev;
525 int atomic_mod_cap = MLX5_CAP_FLOWTABLE(dev,525 int atomic_mod_cap = MLX5_CAP_FLOWTABLE(dev,
526 flow_table_properties_nic_receive.526 flow_table_properties_nic_receive.
527 flow_modify_en);527 flow_modify_en);
@@ -529,15 +529,16 @@ static int mlx5_cmd_update_fte(struct mlx5_core_dev *dev, · 1 unmodified line
529 return -EOPNOTSUPP;529 return -EOPNOTSUPP;
530 opmod = 1;530 opmod = 1;
531 531
532 return mlx5_cmd_set_fte(dev, opmod, modify_mask, ft, group_id, fte);532 return mlx5_cmd_set_fte(dev, opmod, modify_mask, ft, fg->id, fte);
533}533}
534 534
535static int mlx5_cmd_delete_fte(struct mlx5_core_dev *dev,535static int mlx5_cmd_delete_fte(struct mlx5_flow_root_namespace *ns,
536 struct mlx5_flow_table *ft,536 struct mlx5_flow_table *ft,
537 struct fs_fte *fte)537 struct fs_fte *fte)
538{538{
539 u32 out[MLX5_ST_SZ_DW(delete_fte_out)] = {0};539 u32 out[MLX5_ST_SZ_DW(delete_fte_out)] = {0};
540 u32 in[MLX5_ST_SZ_DW(delete_fte_in)] = {0};540 u32 in[MLX5_ST_SZ_DW(delete_fte_in)] = {0};
541 struct mlx5_core_dev *dev = ns->dev;
541 542
542 MLX5_SET(delete_fte_in, in, opcode, MLX5_CMD_OP_DELETE_FLOW_TABLE_ENTRY);543 MLX5_SET(delete_fte_in, in, opcode, MLX5_CMD_OP_DELETE_FLOW_TABLE_ENTRY);
543 MLX5_SET(delete_fte_in, in, table_type, ft->type);544 MLX5_SET(delete_fte_in, in, table_type, ft->type);
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.h+15−18
@@ -36,45 +36,42 @@ · 35 unmodified lines
36#include "fs_core.h"36#include "fs_core.h"
37 37
38struct mlx5_flow_cmds {38struct mlx5_flow_cmds {
39 int (*create_flow_table)(struct mlx5_core_dev *dev,39 int (*create_flow_table)(struct mlx5_flow_root_namespace *ns,
40 u16 vport,40 struct mlx5_flow_table *ft,
41 enum fs_flow_table_op_mod op_mod,41 unsigned int log_size,
42 enum fs_flow_table_type type,42 struct mlx5_flow_table *next_ft);
43 unsigned int level, unsigned int log_size,43 int (*destroy_flow_table)(struct mlx5_flow_root_namespace *ns,
44 struct mlx5_flow_table *next_ft,
45 unsigned int *table_id, u32 flags);
46 int (*destroy_flow_table)(struct mlx5_core_dev *dev,
47 struct mlx5_flow_table *ft);44 struct mlx5_flow_table *ft);
48 45
49 int (*modify_flow_table)(struct mlx5_core_dev *dev,46 int (*modify_flow_table)(struct mlx5_flow_root_namespace *ns,
50 struct mlx5_flow_table *ft,47 struct mlx5_flow_table *ft,
51 struct mlx5_flow_table *next_ft);48 struct mlx5_flow_table *next_ft);
52 49
53 int (*create_flow_group)(struct mlx5_core_dev *dev,50 int (*create_flow_group)(struct mlx5_flow_root_namespace *ns,
54 struct mlx5_flow_table *ft,51 struct mlx5_flow_table *ft,
55 u32 *in,52 u32 *in,
56 unsigned int *group_id);53 struct mlx5_flow_group *fg);
57 54
58 int (*destroy_flow_group)(struct mlx5_core_dev *dev,55 int (*destroy_flow_group)(struct mlx5_flow_root_namespace *ns,
59 struct mlx5_flow_table *ft,56 struct mlx5_flow_table *ft,
60 unsigned int group_id);57 struct mlx5_flow_group *fg);
61 58
62 int (*create_fte)(struct mlx5_core_dev *dev,59 int (*create_fte)(struct mlx5_flow_root_namespace *ns,
63 struct mlx5_flow_table *ft,60 struct mlx5_flow_table *ft,
64 struct mlx5_flow_group *fg,61 struct mlx5_flow_group *fg,
65 struct fs_fte *fte);62 struct fs_fte *fte);
66 63
67 int (*update_fte)(struct mlx5_core_dev *dev,64 int (*update_fte)(struct mlx5_flow_root_namespace *ns,
68 struct mlx5_flow_table *ft,65 struct mlx5_flow_table *ft,
69 unsigned int group_id,66 struct mlx5_flow_group *fg,
70 int modify_mask,67 int modify_mask,
71 struct fs_fte *fte);68 struct fs_fte *fte);
72 69
73 int (*delete_fte)(struct mlx5_core_dev *dev,70 int (*delete_fte)(struct mlx5_flow_root_namespace *ns,
74 struct mlx5_flow_table *ft,71 struct mlx5_flow_table *ft,
75 struct fs_fte *fte);72 struct fs_fte *fte);
76 73
77 int (*update_root_ft)(struct mlx5_core_dev *dev,74 int (*update_root_ft)(struct mlx5_flow_root_namespace *ns,
78 struct mlx5_flow_table *ft,75 struct mlx5_flow_table *ft,
79 u32 underlay_qpn,76 u32 underlay_qpn,
80 bool disconnect);77 bool disconnect);
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c+18−24
@@ -403,7 +403,7 @@ static void del_hw_flow_table(struct fs_node *node) · 402 unmodified lines
403 trace_mlx5_fs_del_ft(ft);403 trace_mlx5_fs_del_ft(ft);
404 404
405 if (node->active) {405 if (node->active) {
406 err = root->cmds->destroy_flow_table(dev, ft);406 err = root->cmds->destroy_flow_table(root, ft);
407 if (err)407 if (err)
408 mlx5_core_warn(dev, "flow steering can't destroy ft\n");408 mlx5_core_warn(dev, "flow steering can't destroy ft\n");
409 }409 }
@@ -435,7 +435,7 @@ static void modify_fte(struct fs_fte *fte) · 25 unmodified lines
435 dev = get_dev(&fte->node);435 dev = get_dev(&fte->node);
436 436
437 root = find_root(&ft->node);437 root = find_root(&ft->node);
438 err = root->cmds->update_fte(dev, ft, fg->id, fte->modify_mask, fte);438 err = root->cmds->update_fte(root, ft, fg, fte->modify_mask, fte);
439 if (err)439 if (err)
440 mlx5_core_warn(dev,440 mlx5_core_warn(dev,
441 "%s can't del rule fg id=%d fte_index=%d\n",441 "%s can't del rule fg id=%d fte_index=%d\n",
@@ -492,7 +492,7 @@ static void del_hw_fte(struct fs_node *node) · 50 unmodified lines
492 dev = get_dev(&ft->node);492 dev = get_dev(&ft->node);
493 root = find_root(&ft->node);493 root = find_root(&ft->node);
494 if (node->active) {494 if (node->active) {
495 err = root->cmds->delete_fte(dev, ft, fte);495 err = root->cmds->delete_fte(root, ft, fte);
496 if (err)496 if (err)
497 mlx5_core_warn(dev,497 mlx5_core_warn(dev,
498 "flow steering can't delete fte in index %d of flow group id %d\n",498 "flow steering can't delete fte in index %d of flow group id %d\n",
@@ -532,7 +532,7 @@ static void del_hw_flow_group(struct fs_node *node) · 33 unmodified lines
532 trace_mlx5_fs_del_fg(fg);532 trace_mlx5_fs_del_fg(fg);
533 533
534 root = find_root(&ft->node);534 root = find_root(&ft->node);
535 if (fg->node.active && root->cmds->destroy_flow_group(dev, ft, fg->id))535 if (fg->node.active && root->cmds->destroy_flow_group(root, ft, fg))
536 mlx5_core_warn(dev, "flow steering can't destroy fg %d of ft %d\n",536 mlx5_core_warn(dev, "flow steering can't destroy fg %d of ft %d\n",
537 fg->id, ft->id);537 fg->id, ft->id);
538}538}
@@ -783,7 +783,7 @@ static int connect_fts_in_prio(struct mlx5_core_dev *dev, · 244 unmodified lines
783 783
784 fs_for_each_ft(iter, prio) {784 fs_for_each_ft(iter, prio) {
785 i++;785 i++;
786 err = root->cmds->modify_flow_table(dev, iter, ft);786 err = root->cmds->modify_flow_table(root, iter, ft);
787 if (err) {787 if (err) {
788 mlx5_core_warn(dev, "Failed to modify flow table %d\n",788 mlx5_core_warn(dev, "Failed to modify flow table %d\n",
789 iter->id);789 iter->id);
@@ -831,11 +831,11 @@ static int update_root_ft_create(struct mlx5_flow_table *ft, struct fs_prio · 41 unmodified lines
831 if (list_empty(&root->underlay_qpns)) {831 if (list_empty(&root->underlay_qpns)) {
832 /* Don't set any QPN (zero) in case QPN list is empty */832 /* Don't set any QPN (zero) in case QPN list is empty */
833 qpn = 0;833 qpn = 0;
834 err = root->cmds->update_root_ft(root->dev, ft, qpn, false);834 err = root->cmds->update_root_ft(root, ft, qpn, false);
835 } else {835 } else {
836 list_for_each_entry(uqp, &root->underlay_qpns, list) {836 list_for_each_entry(uqp, &root->underlay_qpns, list) {
837 qpn = uqp->qpn;837 qpn = uqp->qpn;
838 err = root->cmds->update_root_ft(root->dev, ft,838 err = root->cmds->update_root_ft(root, ft,
839 qpn, false);839 qpn, false);
840 if (err)840 if (err)
841 break;841 break;
@@ -871,7 +871,7 @@ static int _mlx5_modify_rule_destination(struct mlx5_flow_rule *rule, · 29 unmodified lines
871 871
872 memcpy(&rule->dest_attr, dest, sizeof(*dest));872 memcpy(&rule->dest_attr, dest, sizeof(*dest));
873 root = find_root(&ft->node);873 root = find_root(&ft->node);
874 err = root->cmds->update_fte(get_dev(&ft->node), ft, fg->id,874 err = root->cmds->update_fte(root, ft, fg,
875 modify_mask, fte);875 modify_mask, fte);
876 up_write_ref_node(&fte->node, false);876 up_write_ref_node(&fte->node, false);
877 877
@@ -1013,9 +1013,7 @@ static struct mlx5_flow_table *__mlx5_create_flow_table(struct mlx5_flow_namespa · 135 unmodified lines
1013 tree_init_node(&ft->node, del_hw_flow_table, del_sw_flow_table);1013 tree_init_node(&ft->node, del_hw_flow_table, del_sw_flow_table);
1014 log_table_sz = ft->max_fte ? ilog2(ft->max_fte) : 0;1014 log_table_sz = ft->max_fte ? ilog2(ft->max_fte) : 0;
1015 next_ft = find_next_chained_ft(fs_prio);1015 next_ft = find_next_chained_ft(fs_prio);
1016 err = root->cmds->create_flow_table(root->dev, ft->vport, ft->op_mod,1016 err = root->cmds->create_flow_table(root, ft, log_table_sz, next_ft);
1017 ft->type, ft->level, log_table_sz,
1018 next_ft, &ft->id, ft->flags);
1019 if (err)1017 if (err)
1020 goto free_ft;1018 goto free_ft;
1021 1019
@@ -1032,7 +1030,7 @@ static struct mlx5_flow_table *__mlx5_create_flow_table(struct mlx5_flow_namespa · 10 unmodified lines
1032 trace_mlx5_fs_add_ft(ft);1030 trace_mlx5_fs_add_ft(ft);
1033 return ft;1031 return ft;
1034destroy_ft:1032destroy_ft:
1035 root->cmds->destroy_flow_table(root->dev, ft);1033 root->cmds->destroy_flow_table(root, ft);
1036free_ft:1034free_ft:
1037 kfree(ft);1035 kfree(ft);
1038unlock_root:1036unlock_root:
@@ -1114,7 +1112,6 @@ struct mlx5_flow_group *mlx5_create_flow_group(struct mlx5_flow_table *ft, · 75 unmodified lines
1114 start_flow_index);1112 start_flow_index);
1115 int end_index = MLX5_GET(create_flow_group_in, fg_in,1113 int end_index = MLX5_GET(create_flow_group_in, fg_in,
1116 end_flow_index);1114 end_flow_index);
1117 struct mlx5_core_dev *dev = get_dev(&ft->node);
1118 struct mlx5_flow_group *fg;1115 struct mlx5_flow_group *fg;
1119 int err;1116 int err;
1120 1117
@@ -1129,7 +1126,7 @@ struct mlx5_flow_group *mlx5_create_flow_group(struct mlx5_flow_table *ft, · 8 unmodified lines
1129 if (IS_ERR(fg))1126 if (IS_ERR(fg))
1130 return fg;1127 return fg;
1131 1128
1132 err = root->cmds->create_flow_group(dev, ft, fg_in, &fg->id);1129 err = root->cmds->create_flow_group(root, ft, fg_in, fg);
1133 if (err) {1130 if (err) {
1134 tree_put_node(&fg->node, false);1131 tree_put_node(&fg->node, false);
1135 return ERR_PTR(err);1132 return ERR_PTR(err);
@@ -1269,11 +1266,9 @@ add_rule_fte(struct fs_fte *fte, · 133 unmodified lines
1269 fs_get_obj(ft, fg->node.parent);1266 fs_get_obj(ft, fg->node.parent);
1270 root = find_root(&fg->node);1267 root = find_root(&fg->node);
1271 if (!(fte->status & FS_FTE_STATUS_EXISTING))1268 if (!(fte->status & FS_FTE_STATUS_EXISTING))
1272 err = root->cmds->create_fte(get_dev(&ft->node),1269 err = root->cmds->create_fte(root, ft, fg, fte);
1273 ft, fg, fte);
1274 else1270 else
1275 err = root->cmds->update_fte(get_dev(&ft->node), ft, fg->id,1271 err = root->cmds->update_fte(root, ft, fg, modify_mask, fte);
1276 modify_mask, fte);
1277 if (err)1272 if (err)
1278 goto free_handle;1273 goto free_handle;
1279 1274
@@ -1339,7 +1334,6 @@ static int create_auto_flow_group(struct mlx5_flow_table *ft, · 59 unmodified lines
1339 struct mlx5_flow_group *fg)1334 struct mlx5_flow_group *fg)
1340{1335{
1341 struct mlx5_flow_root_namespace *root = find_root(&ft->node);1336 struct mlx5_flow_root_namespace *root = find_root(&ft->node);
1342 struct mlx5_core_dev *dev = get_dev(&ft->node);
1343 int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in);1337 int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in);
1344 void *match_criteria_addr;1338 void *match_criteria_addr;
1345 u8 src_esw_owner_mask_on;1339 u8 src_esw_owner_mask_on;
@@ -1369,7 +1363,7 @@ static int create_auto_flow_group(struct mlx5_flow_table *ft, · 23 unmodified lines
1369 memcpy(match_criteria_addr, fg->mask.match_criteria,1363 memcpy(match_criteria_addr, fg->mask.match_criteria,
1370 sizeof(fg->mask.match_criteria));1364 sizeof(fg->mask.match_criteria));
1371 1365
1372 err = root->cmds->create_flow_group(dev, ft, in, &fg->id);1366 err = root->cmds->create_flow_group(root, ft, in, fg);
1373 if (!err) {1367 if (!err) {
1374 fg->node.active = true;1368 fg->node.active = true;
1375 trace_mlx5_fs_add_fg(fg);1369 trace_mlx5_fs_add_fg(fg);
@@ -1941,12 +1935,12 @@ static int update_root_ft_destroy(struct mlx5_flow_table *ft) · 565 unmodified lines
1941 if (list_empty(&root->underlay_qpns)) {1935 if (list_empty(&root->underlay_qpns)) {
1942 /* Don't set any QPN (zero) in case QPN list is empty */1936 /* Don't set any QPN (zero) in case QPN list is empty */
1943 qpn = 0;1937 qpn = 0;
1944 err = root->cmds->update_root_ft(root->dev, new_root_ft,1938 err = root->cmds->update_root_ft(root, new_root_ft,
1945 qpn, false);1939 qpn, false);
1946 } else {1940 } else {
1947 list_for_each_entry(uqp, &root->underlay_qpns, list) {1941 list_for_each_entry(uqp, &root->underlay_qpns, list) {
1948 qpn = uqp->qpn;1942 qpn = uqp->qpn;
1949 err = root->cmds->update_root_ft(root->dev,1943 err = root->cmds->update_root_ft(root,
1950 new_root_ft, qpn,1944 new_root_ft, qpn,
1951 false);1945 false);
1952 if (err)1946 if (err)
@@ -2762,7 +2756,7 @@ int mlx5_fs_add_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn) · 809 unmodified lines
2762 goto update_ft_fail;2756 goto update_ft_fail;
2763 }2757 }
2764 2758
2765 err = root->cmds->update_root_ft(dev, root->root_ft, underlay_qpn,2759 err = root->cmds->update_root_ft(root, root->root_ft, underlay_qpn,
2766 false);2760 false);
2767 if (err) {2761 if (err) {
2768 mlx5_core_warn(dev, "Failed adding underlay QPN (%u) to root FT err(%d)\n",2762 mlx5_core_warn(dev, "Failed adding underlay QPN (%u) to root FT err(%d)\n",
@@ -2806,7 +2800,7 @@ int mlx5_fs_remove_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn) · 37 unmodified lines
2806 goto out;2800 goto out;
2807 }2801 }
2808 2802
2809 err = root->cmds->update_root_ft(dev, root->root_ft, underlay_qpn,2803 err = root->cmds->update_root_ft(root, root->root_ft, underlay_qpn,
2810 true);2804 true);
2811 if (err)2805 if (err)
2812 mlx5_core_warn(dev, "Failed removing underlay QPN (%u) from root FT err(%d)\n",2806 mlx5_core_warn(dev, "Failed removing underlay QPN (%u) from root FT err(%d)\n",

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t