Lines Matching defs:flow_cfg
33 static void otx2_clear_ntuple_flow_info(struct otx2_nic *pfvf, struct otx2_flow_config *flow_cfg)
35 devm_kfree(pfvf->dev, flow_cfg->flow_ent);
36 flow_cfg->flow_ent = NULL;
37 flow_cfg->max_flows = 0;
42 struct otx2_flow_config *flow_cfg = pfvf->flow_cfg;
46 if (!flow_cfg->max_flows)
50 for (ent = 0; ent < flow_cfg->max_flows; ent++) {
55 req->entry = flow_cfg->flow_ent[ent];
63 otx2_clear_ntuple_flow_info(pfvf, flow_cfg);
69 struct otx2_flow_config *flow_cfg = pfvf->flow_cfg;
80 flow_cfg->flow_ent = devm_kmalloc_array(pfvf->dev, count,
82 if (!flow_cfg->flow_ent) {
108 req->ref_entry = flow_cfg->def_ent[0];
121 flow_cfg->flow_ent[ent + allocated] = rsp->entry_list[ent];
138 sort(&flow_cfg->flow_ent[0], allocated,
139 sizeof(flow_cfg->flow_ent[0]), mcam_entry_cmp, NULL);
144 flow_cfg->max_flows = allocated;
161 struct otx2_flow_config *flow_cfg = pfvf->flow_cfg;
170 count = flow_cfg->ucast_flt_cnt +
173 flow_cfg->def_ent = devm_kmalloc_array(pfvf->dev, count,
175 if (!flow_cfg->def_ent)
206 devm_kfree(pfvf->dev, flow_cfg->def_ent);
211 flow_cfg->def_ent[ent] = rsp->entry_list[ent];
213 flow_cfg->vf_vlan_offset = 0;
214 flow_cfg->unicast_offset = vf_vlan_max_flows;
215 flow_cfg->rx_vlan_offset = flow_cfg->unicast_offset +
216 flow_cfg->ucast_flt_cnt;
250 count = otx2_alloc_mcam_entries(pfvf, flow_cfg->ntuple_cnt);
252 otx2_clear_ntuple_flow_info(pfvf, flow_cfg);
258 refcount_set(&flow_cfg->mark_flows, 1);
268 struct otx2_flow_config *flow_cfg;
270 pfvf->flow_cfg = devm_kzalloc(pfvf->dev,
273 if (!pfvf->flow_cfg)
276 pfvf->flow_cfg->dmacflt_bmap = devm_kcalloc(pfvf->dev,
279 if (!pfvf->flow_cfg->dmacflt_bmap)
282 flow_cfg = pfvf->flow_cfg;
283 INIT_LIST_HEAD(&flow_cfg->flow_list);
284 INIT_LIST_HEAD(&flow_cfg->flow_list_tc);
285 flow_cfg->max_flows = 0;
295 pf->flow_cfg = devm_kzalloc(pf->dev, sizeof(struct otx2_flow_config),
297 if (!pf->flow_cfg)
300 pf->flow_cfg->dmacflt_bmap = devm_kcalloc(pf->dev,
303 if (!pf->flow_cfg->dmacflt_bmap)
306 INIT_LIST_HEAD(&pf->flow_cfg->flow_list);
307 INIT_LIST_HEAD(&pf->flow_cfg->flow_list_tc);
309 pf->flow_cfg->ucast_flt_cnt = OTX2_DEFAULT_UNICAST_FLOWS;
310 pf->flow_cfg->ntuple_cnt = OTX2_DEFAULT_FLOWCOUNT;
324 * pf->flow_cfg->ucast_flt_cnt, GFP_KERNEL);
331 if (!pf->flow_cfg->dmacflt_max_flows)
334 pf->flow_cfg->bmap_to_dmacindex =
336 pf->flow_cfg->dmacflt_max_flows,
339 if (!pf->flow_cfg->bmap_to_dmacindex)
358 struct otx2_flow_config *flow_cfg = pf->flow_cfg;
366 if (netdev_uc_count(pf->netdev) > pf->flow_cfg->ucast_flt_cnt)
377 for (i = 0; i < pf->flow_cfg->ucast_flt_cnt; i++) {
383 flow_cfg->def_ent[i + flow_cfg->unicast_offset];
406 if (!bitmap_empty(pf->flow_cfg->dmacflt_bmap,
407 pf->flow_cfg->dmacflt_max_flows))
420 for (i = 0; i < pf->flow_cfg->ucast_flt_cnt; i++) {
461 list_for_each_entry(iter, &pfvf->flow_cfg->flow_list, list) {
471 struct list_head *head = &pfvf->flow_cfg->flow_list;
474 list_for_each_entry(iter, &pfvf->flow_cfg->flow_list, list) {
483 int otx2_get_maxflows(struct otx2_flow_config *flow_cfg)
485 if (!flow_cfg)
488 if (flow_cfg->nr_flows == flow_cfg->max_flows ||
489 !bitmap_empty(flow_cfg->dmacflt_bmap,
490 flow_cfg->dmacflt_max_flows))
491 return flow_cfg->max_flows + flow_cfg->dmacflt_max_flows;
493 return flow_cfg->max_flows;
502 if (location >= otx2_get_maxflows(pfvf->flow_cfg))
505 list_for_each_entry(iter, &pfvf->flow_cfg->flow_list, list) {
524 nfc->data = otx2_get_maxflows(pfvf->flow_cfg);
1072 pf_mac->location = pfvf->flow_cfg->max_flows;
1085 pfvf->flow_cfg->nr_flows++;
1086 set_bit(0, pfvf->flow_cfg->dmacflt_bmap);
1093 struct otx2_flow_config *flow_cfg = pfvf->flow_cfg;
1102 if (!flow_cfg->max_flows) {
1129 if (fsp->location >= otx2_get_maxflows(flow_cfg))
1138 flow->entry = flow_cfg->flow_ent[flow->location];
1155 if (bitmap_full(flow_cfg->dmacflt_bmap,
1156 flow_cfg->dmacflt_max_flows)) {
1160 flow_cfg->dmacflt_max_flows,
1161 flow_cfg->dmacflt_max_flows);
1169 if (!test_bit(0, flow_cfg->dmacflt_bmap))
1173 flow->entry = find_first_zero_bit(flow_cfg->dmacflt_bmap,
1174 flow_cfg->dmacflt_max_flows);
1175 fsp->location = flow_cfg->max_flows + flow->entry;
1179 set_bit(flow->entry, flow_cfg->dmacflt_bmap);
1183 if (flow->location >= pfvf->flow_cfg->max_flows) {
1187 flow_cfg->max_flows - 1);
1205 flow_cfg->nr_flows++;
1242 list_for_each_entry(iter, &pfvf->flow_cfg->flow_list, list) {
1248 clear_bit(0, pfvf->flow_cfg->dmacflt_bmap);
1263 pfvf->flow_cfg->nr_flows--;
1269 struct otx2_flow_config *flow_cfg = pfvf->flow_cfg;
1273 if (location >= otx2_get_maxflows(flow_cfg))
1289 clear_bit(flow->entry, flow_cfg->dmacflt_bmap);
1294 if (bitmap_weight(flow_cfg->dmacflt_bmap,
1295 flow_cfg->dmacflt_max_flows) == 1)
1313 flow_cfg->nr_flows--;
1323 list_for_each_entry_safe(flow, tmp, &pfvf->flow_cfg->flow_list, list) {
1336 struct otx2_flow_config *flow_cfg = pfvf->flow_cfg;
1344 if (!flow_cfg->max_flows)
1354 req->start = flow_cfg->flow_ent[0];
1355 req->end = flow_cfg->flow_ent[flow_cfg->max_flows - 1];
1359 list_for_each_entry_safe(iter, tmp, &flow_cfg->flow_list, list) {
1362 flow_cfg->nr_flows--;
1369 struct otx2_flow_config *flow_cfg = pfvf->flow_cfg;
1382 list_for_each_entry_safe(iter, tmp, &flow_cfg->flow_list, list) {
1385 flow_cfg->nr_flows--;
1404 flow_cfg->max_flows = 0;
1412 struct otx2_flow_config *flow_cfg = pfvf->flow_cfg;
1423 req->entry = flow_cfg->def_ent[flow_cfg->rx_vlan_offset];
1441 struct otx2_flow_config *flow_cfg = pfvf->flow_cfg;
1452 req->entry = flow_cfg->def_ent[flow_cfg->rx_vlan_offset];
1514 list_for_each_entry(iter, &pf->flow_cfg->flow_list, list) {