On 03/31/2015 09:50 PM, Rosenboim, Leonid wrote:
Taras,
I am sorry that it did not help. Please let me try again.
This time, I have coded the same policy that I had earlier drafted as
pseud-code, using current ODP PMR/CoS API.
Namely, the policy will drop all UDP traffic that is not RTP or
local-to-local DNS,
will send RTP (preumed VoIP) at high priority, local-to-local DNS at mid
priority.
All other IP and Ethernet packets (TCP, ARP, packets with VLAN tags) are
passed
with best-effort (low) priority.
RTP carrier as IPv6 is treated the same as IPv4, but IPv6 DNS is dropped.
The rule set is not perfect by any measure, but it may help illustrate
how I have
intended this API to be used.
What I would like you to do, is to try and express this same policy with
the API
changes you propose, and see if the result is reasonable.
#include <classification.h>
static udp_cos_t cos[8];
static odp_pmr_t pmr[8];
extern odp_queue_t queue_drop, queue_best_effort, queue_mid_pri,
queue_high_pri;
void ingress_setup_pmrs(void)
{
cos[0] = odp_cos_create("Ether");
odp_cos_set_queue(cos[0], queue_best_effort);
cos[1] = odp_cos_create("IP");
odp_cos_set_queue(cos[0], queue_best_effort);
cos[2] = odp_cos_create("UDP-1");
odp_cos_set_queue(cos[0], queue_drop);
cos[3] = odp_cos_create("UDP"-2);
odp_cos_set_queue(cos[0], queue_drop);
cos[4] = odp_cos_create("RTP");
odp_cos_set_queue(cos[0], queue_high_pri);
cos[5] = odp_cos_create("DNS-1");
odp_cos_set_queue(cos[0], queue_drop);
cos[6] = odp_cos_create("DNS-2");
odp_cos_set_queue(cos[0], queue_drop);
cos[7] = odp_cos_create("DNS-Fin");
odp_cos_set_queue(cos[0], queue_mid_pri);
pmr[0] = odp_pmr_create_match( ODP_PMR_ETHTYPE_0, 0x800,
0xffff, sizeof(uint16_t));
odp_cos_pmr_cos(pmr[0], cos[0], cos[1]);
pmr[1] = odp_pmr_create_match( ODP_PMR_ETHTYPE_0, 0x86dd,
0xffff, sizeof(uint16_t));
odp_cos_pmr_cos(pmr[1], cos[0], cos[1]);
/* This PMR is imlied by the subsequent PMRs - is it needed ? */
pmr[2] = odp_pmr_create_match( ODP_PMR_IPPROTO,, 17, 0xff,
sizeof(uint8_t));
odp_cos_pmr_cos(pmr[2], cos[1], cos[2]);
/* Match UDP even src_port range 15384 .. 32766 */
pmr[3] = odp_pmr_create_match( ODP_PMR_UDP_SPORT, 0x4000,
0xc001, sizeof(uint16_t));
odp_cos_pmr_cos(pmr[3], cos[2], cos[4]);
/* Match UDP even src_port range 32768 .. 65534 */
pmr[4] = odp_pmr_create_match( ODP_PMR_UDP_SPORT, 0x8000,
0x8001, sizeof(uint16_t));
odp_cos_pmr_cos(pmr[4], cos[2], cos[4]);
pmr[5] = odp_pmr_create_match( ODP_PMR_UDP_SPORT, 53, 0xffff,
sizeof(uint16_t));
odp_cos_pmr_cos(pmr[5], cos[2], cos[5]);
/* Match src ip to be 192.168.0.0/16 - local address */
pmr[6] = odp_pmr_create_match( ODP_PMR_SIP_ADDR, 0xc0a80000,
0xffff0000, sizeof(uint32_t));
odp_cos_pmr_cos(pmr[6], cos[5], cos[6]);
/* Match dst ip to be 192.168.0.0/16 - local address */
pmr[7] = odp_pmr_create_match( ODP_PMR_DIP_ADDR, 0xc0a80000,
0xffff0000, sizeof(uint32_t));
odp_cos_pmr_cos(pmr[7], cos[6], cos[7]);
/* Allow only local-local DNS packets through at mid-priority */
}
/* Called for each port for appying above rules */
void ingress_setup_pktio(odp_pktio_t pktio)
{
odp_pktio_pmr_cos(pmr[0], pktio, cos[0]);
}
Hmm. I'm really frustrated now. Are we discussing patch 2/2?
Have you really looked into it?
The code will look absolutely the same. Nothing is changed for 'single
PMR' in patch #2.
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp