| 88 | } |
| 89 | |
| 90 | struct tmgr_port * |
| 91 | tmgr_port_create(const char *name, struct tmgr_port_params *params) |
| 92 | { |
| 93 | struct rte_sched_subport_params subport_params; |
| 94 | struct rte_sched_port_params p; |
| 95 | struct tmgr_port *tmgr_port; |
| 96 | struct rte_sched_port *s; |
| 97 | uint32_t i, j; |
| 98 | |
| 99 | /* Check input params */ |
| 100 | if ((name == NULL) || |
| 101 | tmgr_port_find(name) || |
| 102 | (params == NULL) || |
| 103 | (params->n_subports_per_port == 0) || |
| 104 | (params->n_pipes_per_subport == 0) || |
| 105 | (params->cpu_id >= RTE_MAX_NUMA_NODES) || |
| 106 | (n_subport_profiles == 0) || |
| 107 | (n_pipe_profiles == 0)) |
| 108 | return NULL; |
| 109 | |
| 110 | /* Resource create */ |
| 111 | p.name = name; |
| 112 | p.socket = (int) params->cpu_id; |
| 113 | p.rate = params->rate; |
| 114 | p.mtu = params->mtu; |
| 115 | p.frame_overhead = params->frame_overhead; |
| 116 | p.n_subports_per_port = params->n_subports_per_port; |
| 117 | p.n_subport_profiles = n_subport_profiles; |
| 118 | p.subport_profiles = subport_profile; |
| 119 | p.n_max_subport_profiles = TMGR_SUBPORT_PROFILE_MAX; |
| 120 | p.n_pipes_per_subport = params->n_pipes_per_subport; |
| 121 | |
| 122 | |
| 123 | s = rte_sched_port_config(&p); |
| 124 | if (s == NULL) |
| 125 | return NULL; |
| 126 | |
| 127 | memcpy(&subport_params, &subport_params_default, |
| 128 | sizeof(subport_params_default)); |
| 129 | |
| 130 | subport_params.n_pipe_profiles = n_pipe_profiles; |
| 131 | subport_params.n_pipes_per_subport_enabled = |
| 132 | params->n_pipes_per_subport; |
| 133 | |
| 134 | for (i = 0; i < params->n_subports_per_port; i++) { |
| 135 | int status; |
| 136 | |
| 137 | status = rte_sched_subport_config( |
| 138 | s, |
| 139 | i, |
| 140 | &subport_params, |
| 141 | 0); |
| 142 | |
| 143 | if (status) { |
| 144 | rte_sched_port_free(s); |
| 145 | return NULL; |
| 146 | } |
| 147 |
no test coverage detected