Hi VPP fellows: Recently I try to do the qos rate limit based on loop port(used for ESP/VxLAN encapspulation). But I found that "l2-policer-classify" node wouldn't hit the packet, by contrast, acl match can work fine.So I track the source code for "l2-policer-classify" node fucntion "policer_classify_inline", it use "h0 = b0->data;" to do some match action, however I think it should use "h0 = (u8 *) vlib_buffer_get_current (b0);" to do corresponding match action. By the way, "l2-input-acl" node function "l2_in_out_acl_node_fn" also use "h0 = (u8 *) vlib_buffer_get_current (b0);" to do corresponding match action. So I modified the "policer_classify_inline" function source code as below, Then it work fine. *So I wonder this is a bug or I didn't configure the VPP Qos use the correct step? Hope get a reply from VPP fellows.*
1.Qos Limit rate to 800kbps configuration: configure policer name policy1 cir 800 cb 90000 rate kbps round closest type 1r2c conform-action transmit exceed-action drop classify table mask l3 ip4 src proto classify session policer-hit-next policy1 exceed-color table-index 0 match l3 ip4 src 10.100.0.176 proto 50 set policer classify interface loop48 l2-table 0 2. ACL Deny configuration classify table mask l3 ip4 src proto classify session acl-hit-next deny table-index 1 match l3 ip4 src 10.100.0.176 proto 50 set int input acl intfc loop48 l2-table 1 3.show interface features loop48 l2-input: POLICER_CLAS (l2-policer-classify) ACL (l2-input-acl) FWD (l2-fwd) UU_FLOOD (l2-flood) ARP_TERM (arp-term-l2bd) FLOOD (l2-flood) 4. "policer_classify_inline" source code modification: diff --git a/src/vnet/policer/node_funcs.c b/src/vnet/policer/node_funcs.c index fd7f197e9..bdbb17087 100644 --- a/src/vnet/policer/node_funcs.c +++ b/src/vnet/policer/node_funcs.c @@ -559,11 +559,17 @@ policer_classify_inline (vlib_main_t * vm, bi0 = from[0]; b0 = vlib_get_buffer (vm, bi0); - h0 = b0->data; bi1 = from[1]; b1 = vlib_get_buffer (vm, bi1); + +#if 0 /* modified by liuman for policer match */ + h0 = b0->data; h1 = b1->data; +#else + h0 = (u8 *) vlib_buffer_get_current (b0); + h1 = (u8 *) vlib_buffer_get_current (b1); +#endif sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_RX]; table_index0 = @@ -606,7 +612,11 @@ policer_classify_inline (vlib_main_t * vm, bi0 = from[0]; b0 = vlib_get_buffer (vm, bi0); +#if 0 /* modified by liuman for policer match */ h0 = b0->data; +#else + h0 = (u8 *) vlib_buffer_get_current (b0); +#endif sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_RX]; table_index0 = @@ -673,7 +683,11 @@ policer_classify_inline (vlib_main_t * vm, n_left_to_next -= 1; b0 = vlib_get_buffer (vm, bi0); - h0 = b0->data; +#if 0 /* modified by liuman for policer match */ + h0 = b0->data; +#else + h0 = (u8 *) vlib_buffer_get_current (b0); +#endif table_index0 = vnet_buffer (b0)->l2_classify.table_index; e0 = 0; t0 = 0;
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#20511): https://lists.fd.io/g/vpp-dev/message/20511 Mute This Topic: https://lists.fd.io/mt/87137335/21656 Mute #vpp_qos:https://lists.fd.io/g/vpp-dev/mutehashtag/vpp_qos Group Owner: vpp-dev+ow...@lists.fd.io Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-