Packet Per Second (PPS) on Meter with rte_flow API
This capability is available and supported only when using ConnectX-6 Dx adapter Cards
packet_mode flag is added to the meter profile parameters data structure so that it can meter traffic by packet per second. When packet_mode is 0, the profile rates and bucket sizes are specified in bytes per second and bytes. When packet_mode is not 0, the profile rates and bucket sizes are specified in packets and packets per second.
To add the new meter, run: “add port meter profile srtcm_rfc2697 (port_id) (profile_id) (cir) (cbs) (ebs) (packet_mode)”
testpmd> add port meter profile srtcm_rfc2697 0 24 2000 1000 0 1
testpmd> add port meter policy 0 25 g_actions end y_actions end r_actions drop / end
testpmd> create port meter 0 1 24 25 yes 0xffff 1 0
testpmd> flow create 0 priority 3 group 1 ingress pattern eth / end actions meter mtr_id 1 / queue index 0 / end
static void 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_meter_profile mp;
struct rte_mtr_error error;
int ret; /* 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;
ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
if (ret != 0) {
print_err_msg(&error);
return;
}
}