Lines Matching refs:bp

50 	struct bnxt *bp;  in bnxt_flow_get_dst_fid()  local
63 bp = netdev_priv(dev); in bnxt_flow_get_dst_fid()
64 return bp->pf.fw_fid; in bnxt_flow_get_dst_fid()
67 static int bnxt_tc_parse_redir(struct bnxt *bp, in bnxt_tc_parse_redir() argument
74 netdev_info(bp->dev, "no dev in mirred action\n"); in bnxt_tc_parse_redir()
83 static int bnxt_tc_parse_vlan(struct bnxt *bp, in bnxt_tc_parse_vlan() argument
102 static int bnxt_tc_parse_tunnel_set(struct bnxt *bp, in bnxt_tc_parse_tunnel_set() argument
110 netdev_info(bp->dev, "only IPv4 tunnel-encap is supported\n"); in bnxt_tc_parse_tunnel_set()
183 bnxt_tc_parse_pedit(struct bnxt *bp, struct bnxt_tc_actions *actions, in bnxt_tc_parse_pedit() argument
200 netdev_err(bp->dev, in bnxt_tc_parse_pedit()
220 netdev_err(bp->dev, in bnxt_tc_parse_pedit()
226 netdev_dbg(bp->dev, "nat.src_xlate = %d src IP: %pI4 dst ip : %pI4\n", in bnxt_tc_parse_pedit()
249 netdev_err(bp->dev, in bnxt_tc_parse_pedit()
261 netdev_err(bp->dev, in bnxt_tc_parse_pedit()
269 netdev_dbg(bp->dev, "actions->nat.sport = %d dport = %d\n", in bnxt_tc_parse_pedit()
274 netdev_err(bp->dev, "%s: Unsupported pedit hdr type\n", in bnxt_tc_parse_pedit()
281 static int bnxt_tc_parse_actions(struct bnxt *bp, in bnxt_tc_parse_actions() argument
300 netdev_info(bp->dev, "no actions\n"); in bnxt_tc_parse_actions()
313 rc = bnxt_tc_parse_redir(bp, actions, act); in bnxt_tc_parse_actions()
320 rc = bnxt_tc_parse_vlan(bp, actions, act); in bnxt_tc_parse_actions()
325 rc = bnxt_tc_parse_tunnel_set(bp, actions, act); in bnxt_tc_parse_actions()
334 rc = bnxt_tc_parse_pedit(bp, actions, act, i, in bnxt_tc_parse_actions()
355 actions->dst_fid = bp->pf.fw_fid; in bnxt_tc_parse_actions()
359 bnxt_flow_get_dst_fid(bp, actions->dst_dev); in bnxt_tc_parse_actions()
368 static int bnxt_tc_parse_flow(struct bnxt *bp, in bnxt_tc_parse_flow() argument
378 netdev_info(bp->dev, "cannot form TC key: used_keys = 0x%llx\n", in bnxt_tc_parse_flow()
499 return bnxt_tc_parse_actions(bp, &flow->actions, &rule->action, in bnxt_tc_parse_flow()
503 static int bnxt_hwrm_cfa_flow_free(struct bnxt *bp, in bnxt_hwrm_cfa_flow_free() argument
509 rc = hwrm_req_init(bp, req, HWRM_CFA_FLOW_FREE); in bnxt_hwrm_cfa_flow_free()
511 if (bp->fw_cap & BNXT_FW_CAP_OVS_64BIT_HANDLE) in bnxt_hwrm_cfa_flow_free()
516 rc = hwrm_req_send(bp, req); in bnxt_hwrm_cfa_flow_free()
519 netdev_info(bp->dev, "%s: Error rc=%d\n", __func__, rc); in bnxt_hwrm_cfa_flow_free()
585 static int bnxt_hwrm_cfa_flow_alloc(struct bnxt *bp, struct bnxt_tc_flow *flow, in bnxt_hwrm_cfa_flow_alloc() argument
598 rc = hwrm_req_init(bp, req, HWRM_CFA_FLOW_ALLOC); in bnxt_hwrm_cfa_flow_alloc()
640 netdev_dbg(bp->dev, in bnxt_hwrm_cfa_flow_alloc()
668 netdev_dbg(bp->dev, in bnxt_hwrm_cfa_flow_alloc()
767 resp = hwrm_req_hold(bp, req); in bnxt_hwrm_cfa_flow_alloc()
768 rc = hwrm_req_send_silent(bp, req); in bnxt_hwrm_cfa_flow_alloc()
780 if (bp->fw_cap & BNXT_FW_CAP_OVS_64BIT_HANDLE) { in bnxt_hwrm_cfa_flow_alloc()
785 hwrm_req_drop(bp, req); in bnxt_hwrm_cfa_flow_alloc()
789 static int hwrm_cfa_decap_filter_alloc(struct bnxt *bp, in hwrm_cfa_decap_filter_alloc() argument
801 rc = hwrm_req_init(bp, req, HWRM_CFA_DECAP_FILTER_ALLOC); in hwrm_cfa_decap_filter_alloc()
850 resp = hwrm_req_hold(bp, req); in hwrm_cfa_decap_filter_alloc()
851 rc = hwrm_req_send_silent(bp, req); in hwrm_cfa_decap_filter_alloc()
854 hwrm_req_drop(bp, req); in hwrm_cfa_decap_filter_alloc()
857 netdev_info(bp->dev, "%s: Error rc=%d\n", __func__, rc); in hwrm_cfa_decap_filter_alloc()
862 static int hwrm_cfa_decap_filter_free(struct bnxt *bp, in hwrm_cfa_decap_filter_free() argument
868 rc = hwrm_req_init(bp, req, HWRM_CFA_DECAP_FILTER_FREE); in hwrm_cfa_decap_filter_free()
871 rc = hwrm_req_send(bp, req); in hwrm_cfa_decap_filter_free()
874 netdev_info(bp->dev, "%s: Error rc=%d\n", __func__, rc); in hwrm_cfa_decap_filter_free()
879 static int hwrm_cfa_encap_record_alloc(struct bnxt *bp, in hwrm_cfa_encap_record_alloc() argument
890 rc = hwrm_req_init(bp, req, HWRM_CFA_ENCAP_RECORD_ALLOC); in hwrm_cfa_encap_record_alloc()
916 resp = hwrm_req_hold(bp, req); in hwrm_cfa_encap_record_alloc()
917 rc = hwrm_req_send_silent(bp, req); in hwrm_cfa_encap_record_alloc()
920 hwrm_req_drop(bp, req); in hwrm_cfa_encap_record_alloc()
923 netdev_info(bp->dev, "%s: Error rc=%d\n", __func__, rc); in hwrm_cfa_encap_record_alloc()
928 static int hwrm_cfa_encap_record_free(struct bnxt *bp, in hwrm_cfa_encap_record_free() argument
934 rc = hwrm_req_init(bp, req, HWRM_CFA_ENCAP_RECORD_FREE); in hwrm_cfa_encap_record_free()
937 rc = hwrm_req_send(bp, req); in hwrm_cfa_encap_record_free()
940 netdev_info(bp->dev, "%s: Error rc=%d\n", __func__, rc); in hwrm_cfa_encap_record_free()
945 static int bnxt_tc_put_l2_node(struct bnxt *bp, in bnxt_tc_put_l2_node() argument
949 struct bnxt_tc_info *tc_info = bp->tc_info; in bnxt_tc_put_l2_node()
958 netdev_err(bp->dev, in bnxt_tc_put_l2_node()
967 bnxt_tc_get_l2_node(struct bnxt *bp, struct rhashtable *l2_table, in bnxt_tc_get_l2_node() argument
987 netdev_err(bp->dev, in bnxt_tc_get_l2_node()
1001 bnxt_tc_get_ref_flow_handle(struct bnxt *bp, struct bnxt_tc_flow *flow, in bnxt_tc_get_ref_flow_handle() argument
1005 struct bnxt_tc_info *tc_info = bp->tc_info; in bnxt_tc_get_ref_flow_handle()
1009 l2_node = bnxt_tc_get_l2_node(bp, &tc_info->l2_table, in bnxt_tc_get_ref_flow_handle()
1041 static bool bnxt_tc_can_offload(struct bnxt *bp, struct bnxt_tc_flow *flow) in bnxt_tc_can_offload() argument
1047 netdev_info(bp->dev, "Cannot offload non-TCP/UDP (%d) ports\n", in bnxt_tc_can_offload()
1055 netdev_info(bp->dev, "Wildcard match unsupported for Source MAC\n"); in bnxt_tc_can_offload()
1060 netdev_info(bp->dev, "Wildcard match unsupported for Dest MAC\n"); in bnxt_tc_can_offload()
1069 netdev_info(bp->dev, "Unsupported VLAN TCI\n"); in bnxt_tc_can_offload()
1076 netdev_info(bp->dev, "Wildcard match unsupported for VLAN TPID\n"); in bnxt_tc_can_offload()
1083 netdev_info(bp->dev, "Wildcard match unsupported for Ethertype\n"); in bnxt_tc_can_offload()
1093 static int bnxt_tc_put_tunnel_node(struct bnxt *bp, in bnxt_tc_put_tunnel_node() argument
1104 netdev_err(bp->dev, "rhashtable_remove_fast rc=%d\n", rc); in bnxt_tc_put_tunnel_node()
1118 bnxt_tc_get_tunnel_node(struct bnxt *bp, struct rhashtable *tunnel_table, in bnxt_tc_get_tunnel_node() argument
1145 netdev_info(bp->dev, "error rc=%d\n", rc); in bnxt_tc_get_tunnel_node()
1149 static int bnxt_tc_get_ref_decap_handle(struct bnxt *bp, in bnxt_tc_get_ref_decap_handle() argument
1155 struct bnxt_tc_info *tc_info = bp->tc_info; in bnxt_tc_get_ref_decap_handle()
1159 decap_l2_node = bnxt_tc_get_l2_node(bp, &tc_info->decap_l2_table, in bnxt_tc_get_ref_decap_handle()
1189 static void bnxt_tc_put_decap_l2_node(struct bnxt *bp, in bnxt_tc_put_decap_l2_node() argument
1193 struct bnxt_tc_info *tc_info = bp->tc_info; in bnxt_tc_put_decap_l2_node()
1203 netdev_err(bp->dev, "rhashtable_remove_fast rc=%d\n", rc); in bnxt_tc_put_decap_l2_node()
1208 static void bnxt_tc_put_decap_handle(struct bnxt *bp, in bnxt_tc_put_decap_handle() argument
1212 struct bnxt_tc_info *tc_info = bp->tc_info; in bnxt_tc_put_decap_handle()
1216 bnxt_tc_put_decap_l2_node(bp, flow_node); in bnxt_tc_put_decap_handle()
1218 rc = bnxt_tc_put_tunnel_node(bp, &tc_info->decap_table, in bnxt_tc_put_decap_handle()
1222 hwrm_cfa_decap_filter_free(bp, decap_handle); in bnxt_tc_put_decap_handle()
1225 static int bnxt_tc_resolve_tunnel_hdrs(struct bnxt *bp, in bnxt_tc_resolve_tunnel_hdrs() argument
1230 struct net_device *real_dst_dev = bp->dev; in bnxt_tc_resolve_tunnel_hdrs()
1243 netdev_info(bp->dev, "no route to %pI4b\n", &flow.daddr); in bnxt_tc_resolve_tunnel_hdrs()
1256 netdev_info(bp->dev, in bnxt_tc_resolve_tunnel_hdrs()
1268 netdev_info(bp->dev, in bnxt_tc_resolve_tunnel_hdrs()
1278 netdev_info(bp->dev, "can't lookup neighbor for %pI4b\n", in bnxt_tc_resolve_tunnel_hdrs()
1300 static int bnxt_tc_get_decap_handle(struct bnxt *bp, struct bnxt_tc_flow *flow, in bnxt_tc_get_decap_handle() argument
1305 struct bnxt_tc_info *tc_info = bp->tc_info; in bnxt_tc_get_decap_handle()
1319 decap_node = bnxt_tc_get_tunnel_node(bp, &tc_info->decap_table, in bnxt_tc_get_decap_handle()
1336 rc = bnxt_tc_resolve_tunnel_hdrs(bp, &tun_key, &l2_info); in bnxt_tc_get_decap_handle()
1355 rc = bnxt_tc_get_ref_decap_handle(bp, flow, decap_l2_info, flow_node, in bnxt_tc_get_decap_handle()
1361 rc = hwrm_cfa_decap_filter_alloc(bp, flow, decap_l2_info, in bnxt_tc_get_decap_handle()
1372 bnxt_tc_put_decap_l2_node(bp, flow_node); in bnxt_tc_get_decap_handle()
1374 bnxt_tc_put_tunnel_node(bp, &tc_info->decap_table, in bnxt_tc_get_decap_handle()
1380 static void bnxt_tc_put_encap_handle(struct bnxt *bp, in bnxt_tc_put_encap_handle() argument
1384 struct bnxt_tc_info *tc_info = bp->tc_info; in bnxt_tc_put_encap_handle()
1387 rc = bnxt_tc_put_tunnel_node(bp, &tc_info->encap_table, in bnxt_tc_put_encap_handle()
1390 hwrm_cfa_encap_record_free(bp, encap_handle); in bnxt_tc_put_encap_handle()
1398 static int bnxt_tc_get_encap_handle(struct bnxt *bp, struct bnxt_tc_flow *flow, in bnxt_tc_get_encap_handle() argument
1403 struct bnxt_tc_info *tc_info = bp->tc_info; in bnxt_tc_get_encap_handle()
1411 encap_node = bnxt_tc_get_tunnel_node(bp, &tc_info->encap_table, in bnxt_tc_get_encap_handle()
1422 rc = bnxt_tc_resolve_tunnel_hdrs(bp, encap_key, &encap_node->l2_info); in bnxt_tc_get_encap_handle()
1427 rc = hwrm_cfa_encap_record_alloc(bp, encap_key, &encap_node->l2_info, in bnxt_tc_get_encap_handle()
1437 bnxt_tc_put_tunnel_node(bp, &tc_info->encap_table, in bnxt_tc_get_encap_handle()
1442 static void bnxt_tc_put_tunnel_handle(struct bnxt *bp, in bnxt_tc_put_tunnel_handle() argument
1447 bnxt_tc_put_decap_handle(bp, flow_node); in bnxt_tc_put_tunnel_handle()
1449 bnxt_tc_put_encap_handle(bp, flow_node->encap_node); in bnxt_tc_put_tunnel_handle()
1452 static int bnxt_tc_get_tunnel_handle(struct bnxt *bp, in bnxt_tc_get_tunnel_handle() argument
1458 return bnxt_tc_get_decap_handle(bp, flow, flow_node, in bnxt_tc_get_tunnel_handle()
1461 return bnxt_tc_get_encap_handle(bp, flow, flow_node, in bnxt_tc_get_tunnel_handle()
1466 static int __bnxt_tc_del_flow(struct bnxt *bp, in __bnxt_tc_del_flow() argument
1469 struct bnxt_tc_info *tc_info = bp->tc_info; in __bnxt_tc_del_flow()
1473 bnxt_hwrm_cfa_flow_free(bp, flow_node); in __bnxt_tc_del_flow()
1478 bnxt_tc_put_tunnel_handle(bp, &flow_node->flow, flow_node); in __bnxt_tc_del_flow()
1481 bnxt_tc_put_l2_node(bp, flow_node); in __bnxt_tc_del_flow()
1488 netdev_err(bp->dev, "Error: %s: rhashtable_remove_fast rc=%d\n", in __bnxt_tc_del_flow()
1495 static void bnxt_tc_set_flow_dir(struct bnxt *bp, struct bnxt_tc_flow *flow, in bnxt_tc_set_flow_dir() argument
1498 flow->l2_key.dir = (bp->pf.fw_fid == src_fid) ? BNXT_DIR_RX : BNXT_DIR_TX; in bnxt_tc_set_flow_dir()
1501 static void bnxt_tc_set_src_fid(struct bnxt *bp, struct bnxt_tc_flow *flow, in bnxt_tc_set_src_fid() argument
1505 flow->src_fid = bp->pf.fw_fid; in bnxt_tc_set_src_fid()
1523 static int bnxt_tc_add_flow(struct bnxt *bp, u16 src_fid, in bnxt_tc_add_flow() argument
1527 struct bnxt_tc_info *tc_info = bp->tc_info; in bnxt_tc_add_flow()
1542 rc = bnxt_tc_parse_flow(bp, tc_flow_cmd, flow); in bnxt_tc_add_flow()
1546 bnxt_tc_set_src_fid(bp, flow, src_fid); in bnxt_tc_add_flow()
1547 bnxt_tc_set_flow_dir(bp, flow, flow->src_fid); in bnxt_tc_add_flow()
1549 if (!bnxt_tc_can_offload(bp, flow)) { in bnxt_tc_add_flow()
1560 __bnxt_tc_del_flow(bp, old_node); in bnxt_tc_add_flow()
1566 rc = bnxt_tc_get_ref_flow_handle(bp, flow, new_node, &ref_flow_handle); in bnxt_tc_add_flow()
1571 rc = bnxt_tc_get_tunnel_handle(bp, flow, new_node, &tunnel_handle); in bnxt_tc_add_flow()
1576 rc = bnxt_hwrm_cfa_flow_alloc(bp, flow, ref_flow_handle, in bnxt_tc_add_flow()
1593 bnxt_hwrm_cfa_flow_free(bp, new_node); in bnxt_tc_add_flow()
1595 bnxt_tc_put_tunnel_handle(bp, flow, new_node); in bnxt_tc_add_flow()
1597 bnxt_tc_put_l2_node(bp, new_node); in bnxt_tc_add_flow()
1603 netdev_err(bp->dev, "Error: %s: cookie=0x%lx error=%d\n", in bnxt_tc_add_flow()
1608 static int bnxt_tc_del_flow(struct bnxt *bp, in bnxt_tc_del_flow() argument
1611 struct bnxt_tc_info *tc_info = bp->tc_info; in bnxt_tc_del_flow()
1620 return __bnxt_tc_del_flow(bp, flow_node); in bnxt_tc_del_flow()
1623 static int bnxt_tc_get_flow_stats(struct bnxt *bp, in bnxt_tc_get_flow_stats() argument
1627 struct bnxt_tc_info *tc_info = bp->tc_info; in bnxt_tc_get_flow_stats()
1654 static void bnxt_fill_cfa_stats_req(struct bnxt *bp, in bnxt_fill_cfa_stats_req() argument
1660 if (bp->fw_cap & BNXT_FW_CAP_OVS_64BIT_HANDLE) { in bnxt_fill_cfa_stats_req()
1681 bnxt_hwrm_cfa_flow_stats_get(struct bnxt *bp, int num_flows, in bnxt_hwrm_cfa_flow_stats_get() argument
1690 rc = hwrm_req_init(bp, req, HWRM_CFA_FLOW_STATS); in bnxt_hwrm_cfa_flow_stats_get()
1701 bnxt_fill_cfa_stats_req(bp, flow_node, in bnxt_hwrm_cfa_flow_stats_get()
1705 resp = hwrm_req_hold(bp, req); in bnxt_hwrm_cfa_flow_stats_get()
1706 rc = hwrm_req_send(bp, req); in bnxt_hwrm_cfa_flow_stats_get()
1721 hwrm_req_drop(bp, req); in bnxt_hwrm_cfa_flow_stats_get()
1724 netdev_info(bp->dev, "error rc=%d\n", rc); in bnxt_hwrm_cfa_flow_stats_get()
1757 bnxt_tc_flow_stats_batch_update(struct bnxt *bp, int num_flows, in bnxt_tc_flow_stats_batch_update() argument
1760 struct bnxt_tc_info *tc_info = bp->tc_info; in bnxt_tc_flow_stats_batch_update()
1763 rc = bnxt_hwrm_cfa_flow_stats_get(bp, num_flows, stats_batch); in bnxt_tc_flow_stats_batch_update()
1783 bnxt_tc_flow_stats_batch_prep(struct bnxt *bp, in bnxt_tc_flow_stats_batch_prep() argument
1787 struct bnxt_tc_info *tc_info = bp->tc_info; in bnxt_tc_flow_stats_batch_prep()
1819 void bnxt_tc_flow_stats_work(struct bnxt *bp) in bnxt_tc_flow_stats_work() argument
1821 struct bnxt_tc_info *tc_info = bp->tc_info; in bnxt_tc_flow_stats_work()
1831 rc = bnxt_tc_flow_stats_batch_prep(bp, tc_info->stats_batch, in bnxt_tc_flow_stats_work()
1842 bnxt_tc_flow_stats_batch_update(bp, num_flows, in bnxt_tc_flow_stats_work()
1849 int bnxt_tc_setup_flower(struct bnxt *bp, u16 src_fid, in bnxt_tc_setup_flower() argument
1854 return bnxt_tc_add_flow(bp, src_fid, cls_flower); in bnxt_tc_setup_flower()
1856 return bnxt_tc_del_flow(bp, cls_flower); in bnxt_tc_setup_flower()
1858 return bnxt_tc_get_flow_stats(bp, cls_flower); in bnxt_tc_setup_flower()
1869 struct bnxt *bp = priv->bp; in bnxt_tc_setup_indr_block_cb() local
1871 if (!tc_cls_can_offload_and_chain0(bp->dev, type_data)) in bnxt_tc_setup_indr_block_cb()
1876 return bnxt_tc_setup_flower(bp, bp->pf.fw_fid, flower); in bnxt_tc_setup_indr_block_cb()
1883 bnxt_tc_indr_block_cb_lookup(struct bnxt *bp, struct net_device *netdev) in bnxt_tc_indr_block_cb_lookup() argument
1887 list_for_each_entry(cb_priv, &bp->tc_indr_block_list, list) in bnxt_tc_indr_block_cb_lookup()
1902 static int bnxt_tc_setup_indr_block(struct net_device *netdev, struct Qdisc *sch, struct bnxt *bp, in bnxt_tc_setup_indr_block() argument
1919 cb_priv->bp = bp; in bnxt_tc_setup_indr_block()
1920 list_add(&cb_priv->list, &bp->tc_indr_block_list); in bnxt_tc_setup_indr_block()
1925 netdev, sch, data, bp, cleanup); in bnxt_tc_setup_indr_block()
1936 cb_priv = bnxt_tc_indr_block_cb_lookup(bp, netdev); in bnxt_tc_setup_indr_block()
2009 int bnxt_init_tc(struct bnxt *bp) in bnxt_init_tc() argument
2014 if (bp->hwrm_spec_code < 0x10803) in bnxt_init_tc()
2055 bp->dev->hw_features |= NETIF_F_HW_TC; in bnxt_init_tc()
2056 bp->dev->features |= NETIF_F_HW_TC; in bnxt_init_tc()
2057 bp->tc_info = tc_info; in bnxt_init_tc()
2060 INIT_LIST_HEAD(&bp->tc_indr_block_list); in bnxt_init_tc()
2062 rc = flow_indr_dev_register(bnxt_tc_setup_indr_cb, bp); in bnxt_init_tc()
2078 bp->tc_info = NULL; in bnxt_init_tc()
2082 void bnxt_shutdown_tc(struct bnxt *bp) in bnxt_shutdown_tc() argument
2084 struct bnxt_tc_info *tc_info = bp->tc_info; in bnxt_shutdown_tc()
2086 if (!bnxt_tc_flower_enabled(bp)) in bnxt_shutdown_tc()
2089 flow_indr_dev_unregister(bnxt_tc_setup_indr_cb, bp, in bnxt_shutdown_tc()
2097 bp->tc_info = NULL; in bnxt_shutdown_tc()