Limit Upcall Traffic to All Representors
testpmd> add port meter profile srtcm_rfc2697 0 17 5000 1250 0 1
testpmd> add port meter policy 0 1 g_actions jump group 1001 / end y_actions end r_actions drop / end
testpmd> create port meter 0 1 17 1 yes 0xffff 1 0
testpmd> flow create 0 priority 0 ingress transfer group 1000 pattern eth / end actions meter mtr_id 1 / end
testpmd> flow create 0 priority 0 ingress transfer group 1000 pattern eth / port_id id is 1 / end actions meter mtr_id 1 / end
testpmd> flow create 0 priority 0 ingress transfer group 1000 pattern eth / port_id id is 2 / end actions meter mtr_id 1 / end
int add_port_meter_profile_srtcm(uint16_t port_id, uint32_t profile_id,
uint64_t cir, uint64_t cbs,
uint64_t ebs, int packet_mode,
struct rte_mtr_error *error)
{
struct rte_mtr_meter_profile mp;
/* Private shaper profile params */
memset(&mp, 0, sizeof(struct rte_mtr_meter_profile));
mp.alg = RTE_MTR_SRTCM_RFC2697;
mp.srtcm_rfc2697.cir = cir;
mp.srtcm_rfc2697.cbs = cbs;
mp.srtcm_rfc2697.ebs = ebs;
mp.packet_mode = packet_mode;
return rte_mtr_meter_profile_add(port_id, profile_id, &mp, error);
}
int port_meter_policy_add(portid_t port_id, uint32_t policy_id,
const struct rte_flow_action *actions,
struct rte_mtr_error *error)
{
struct rte_mtr_error error;
const struct rte_flow_action *act = actions;
const struct rte_flow_action *start;
struct rte_mtr_meter_policy_params policy;
uint32_t i = 0, act_n;
int ret;
for (i = 0; i < RTE_COLORS; i++) {
for (act_n = 0, start = act; act->type != RTE_FLOW_ACTION_TYPE_END; act++)
act_n++;
if (act_n && act->type == RTE_FLOW_ACTION_TYPE_END)
policy.actions[i] = start;
else
policy.actions[i] = NULL;
act++;
}
return rte_mtr_meter_policy_add(port_id, policy_id, &policy, error);
}
static void create_port_meter(uint16_t port_id, uint32_t mtr_id, uint32_t shared,
uint32_t profile_id, int use_prev_mtr_color,
int meter_enable, uint64_t stats_mask,
uint32_t policy_id, struct rte_mtr_error *error)
{
struct rte_mtr_params params;
int ret;
/* Meter params */
memset(ms, 0, sizeof(struct rte_mtr_params));
params.meter_profile_id = profile_id;
params.use_prev_mtr_color = use_prev_mtr_color;
params.meter_enable = meter_enable;
params.stats_mask = stats_mask;
params.meter_policy_id = policy_id;
return rte_mtr_create(port_id, mtr_id, ms, shared, error);
}