| 1014 | } |
| 1015 | |
| 1016 | static int __cxgbe_flow_create(struct rte_eth_dev *dev, struct rte_flow *flow) |
| 1017 | { |
| 1018 | struct ch_filter_specification *fs = &flow->fs; |
| 1019 | struct adapter *adap = ethdev2adap(dev); |
| 1020 | struct tid_info *t = &adap->tids; |
| 1021 | struct filter_ctx ctx; |
| 1022 | unsigned int fidx; |
| 1023 | int err; |
| 1024 | |
| 1025 | if (cxgbe_get_fidx(flow, &fidx)) |
| 1026 | return -ENOMEM; |
| 1027 | if (cxgbe_verify_fidx(flow, fidx, 0)) |
| 1028 | return -1; |
| 1029 | |
| 1030 | t4_init_completion(&ctx.completion); |
| 1031 | /* go create the filter */ |
| 1032 | err = cxgbe_set_filter(dev, fidx, fs, &ctx); |
| 1033 | if (err) { |
| 1034 | dev_err(adap, "Error %d while creating filter.\n", err); |
| 1035 | return err; |
| 1036 | } |
| 1037 | |
| 1038 | /* Poll the FW for reply */ |
| 1039 | err = cxgbe_poll_for_completion(&adap->sge.fw_evtq, |
| 1040 | CXGBE_FLOW_POLL_MS, |
| 1041 | CXGBE_FLOW_POLL_CNT, |
| 1042 | &ctx.completion); |
| 1043 | if (err) { |
| 1044 | dev_err(adap, "Filter set operation timed out (%d)\n", err); |
| 1045 | return err; |
| 1046 | } |
| 1047 | if (ctx.result) { |
| 1048 | dev_err(adap, "Hardware error %d while creating the filter.\n", |
| 1049 | ctx.result); |
| 1050 | return ctx.result; |
| 1051 | } |
| 1052 | |
| 1053 | if (fs->cap) { /* to destroy the filter */ |
| 1054 | flow->fidx = ctx.tid; |
| 1055 | flow->f = lookup_tid(t, ctx.tid); |
| 1056 | } else { |
| 1057 | flow->fidx = fidx; |
| 1058 | flow->f = &adap->tids.ftid_tab[fidx]; |
| 1059 | } |
| 1060 | |
| 1061 | return 0; |
| 1062 | } |
| 1063 | |
| 1064 | static struct rte_flow * |
| 1065 | cxgbe_flow_create(struct rte_eth_dev *dev, |
no test coverage detected