MCPcopy Create free account
hub / github.com/F-Stack/f-stack / bnxt_vnic_prep

Function bnxt_vnic_prep

dpdk/drivers/net/bnxt/bnxt_flow.c:886–962  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

884}
885
886static int bnxt_vnic_prep(struct bnxt *bp, struct bnxt_vnic_info *vnic,
887 const struct rte_flow_action *act,
888 struct rte_flow_error *error)
889{
890 struct rte_eth_conf *dev_conf = &bp->eth_dev->data->dev_conf;
891 uint64_t rx_offloads = dev_conf->rxmode.offloads;
892 int rc;
893
894 if (bp->nr_vnics > bp->max_vnics - 1)
895 return rte_flow_error_set(error, EINVAL,
896 RTE_FLOW_ERROR_TYPE_ATTR_GROUP,
897 NULL,
898 "Group id is invalid");
899
900 rc = bnxt_vnic_grp_alloc(bp, vnic);
901 if (rc)
902 return rte_flow_error_set(error, -rc,
903 RTE_FLOW_ERROR_TYPE_ACTION,
904 act,
905 "Failed to alloc VNIC group");
906
907 /* populate the fw group table */
908 bnxt_vnic_ring_grp_populate(bp, vnic);
909 bnxt_vnic_rules_init(vnic);
910
911 rc = bnxt_hwrm_vnic_alloc(bp, vnic);
912 if (rc) {
913 rte_flow_error_set(error, -rc,
914 RTE_FLOW_ERROR_TYPE_ACTION,
915 act,
916 "Failed to alloc VNIC");
917 goto ret;
918 }
919
920 /* RSS context is required only when there is more than one RSS ring */
921 if (vnic->rx_queue_cnt > 1) {
922 rc = bnxt_hwrm_vnic_ctx_alloc(bp, vnic, 0);
923 if (rc) {
924 rte_flow_error_set(error, -rc,
925 RTE_FLOW_ERROR_TYPE_ACTION,
926 act,
927 "Failed to alloc VNIC context");
928 goto ret;
929 }
930 }
931
932 if (rx_offloads & RTE_ETH_RX_OFFLOAD_VLAN_STRIP)
933 vnic->vlan_strip = true;
934 else
935 vnic->vlan_strip = false;
936
937 rc = bnxt_hwrm_vnic_cfg(bp, vnic);
938 if (rc) {
939 rte_flow_error_set(error, -rc,
940 RTE_FLOW_ERROR_TYPE_ACTION,
941 act,
942 "Failed to configure VNIC");
943 goto ret;

Callers 1

Calls 9

rte_flow_error_setFunction · 0.85
bnxt_vnic_grp_allocFunction · 0.85
bnxt_vnic_rules_initFunction · 0.85
bnxt_hwrm_vnic_allocFunction · 0.85
bnxt_hwrm_vnic_ctx_allocFunction · 0.85
bnxt_hwrm_vnic_cfgFunction · 0.85
bnxt_vnic_cleanupFunction · 0.85

Tested by

no test coverage detected