Hello,

Skip_n_vectors is 0 as the mask (as well as match value) is already shifted by 
one vector in PAPI:
VAT mask:          
0000000000000000000000000000ffffffff0000000000000000000000000000
PAPI mask:         
00000000000000000000000000000000ffffffff000000000000000000000000

But there was identified another differecne by checking api trace dumps – 
match_len in classify_add_del_session api call:
VAT
---------- trace 30 -----------
vl_api_classify_add_del_session_t:
_vl_msg_id: 644
client_index: 0
context: 0
is_add: 1
table_index: 0
hit_next_index: 0
opaque_index: 1
advance: 0
action: 0
metadata: 0
match_len: 48

PAPI
---------- trace 8 -----------
vl_api_classify_add_del_session_t:
_vl_msg_id: 644
client_index: 2147483649
context: 891
is_add: 1
table_index: 0
hit_next_index: 0
opaque_index: 1
advance: 0
action: 0
metadata: 0
match_len: 32

but it should not be a root cause of not setting policer_index.

Regards,
Jan

Hera are complete classify tables data:

VAT
sudo vppctl sh classify tables verbose
  TableIdx  Sessions   NextTbl  NextNode
         0         1        -1        -1
  Heap: total: 32.06M, used: 1.31K, free: 32.06M, trimmable: 32.06M
  nbuckets 2, skip 1 match 2 flag 0 offset 0
  mask 0000000000000000000000000000ffffffff0000000000000000000000000000
  mask 00000000000000000000000000000000ffffffff000000000000000000000000
  linear-search buckets 0

[1]: heap offset 1200, elts 2, normal
    0: [1200]: next_index 0 advance 0 opaque 1 action 0 metadata 0
        k: 0000000000000000000000000000141414020000000000000000000000000000
        hits 0, last_heard 0.00

    1 active elements
    1 free lists
    0 linear-search buckets
         1         1        -1        -1
  Heap: total: 32.06M, used: 1.31K, free: 32.06M, trimmable: 32.06M
  nbuckets 2, skip 1 match 2 flag 0 offset 0
  mask 0000000000000000000000000000ffffffff0000000000000000000000000000
  linear-search buckets 0

[1]: heap offset 1200, elts 2, normal
    0: [1200]: next_index 1 advance 0 opaque 1 action 0 metadata 0
        k: 0000000000000000000000000000141414020000000000000000000000000000
        hits 0, last_heard 0.00

    1 active elements
    1 free lists
    0 linear-search buckets

PAPI
cli_inband (10.30.51.50 - /run/vpp/api.sock):
  TableIdx  Sessions   NextTbl  NextNode
         0         1        -1        -1
  Heap: total: 2.06M, used: 1.31K, free: 2.06M, trimmable: 2.06M
  nbuckets 2, skip 0 match 2 flag 0 offset 0
  mask 00000000000000000000000000000000ffffffff000000000000000000000000
  linear-search buckets 0

[1]: heap offset 1200, elts 2, normal
    0: [1200]: next_index 0 advance 0 opaque 1 action 0 metadata 0
        k: 0000000000000000000000000000000014141402000000000000000000000000
        hits 0, last_heard 0.00

    1 active elements
    1 free lists
    0 linear-search buckets
         1         1        -1        -1
  Heap: total: 2.06M, used: 1.31K, free: 2.06M, trimmable: 2.06M
  nbuckets 2, skip 0 match 2 flag 0 offset 0
  mask 00000000000000000000000000000000ffffffff000000000000000000000000
  linear-search buckets 0

[1]: heap offset 1200, elts 2, normal
    0: [1200]: next_index 1 advance 0 opaque 1 action 0 metadata 0
        k: 000000000000000000000000000000000a0a0a02000000000000000000000000
        hits 0, last_heard 0.00

    1 active elements
    1 free lists
    0 linear-search buckets

From: Vratko Polak -X (vrpolak - PANTHEON TECHNOLOGIES at Cisco) 
<vrpo...@cisco.com>
Sent: Wednesday, September 18, 2019 4:12 PM
To: Jan Gelety -X (jgelety - PANTHEON TECHNOLOGIES at Cisco) 
<jgel...@cisco.com>; vpp-dev@lists.fd.io
Cc: csit-...@lists.fd.io
Subject: RE: VAT to PAPI issue with policer

VAT classify_add_del_session contains "skip_n 1",
but PAPI classify_add_del_session does not contain
"skip_n_vectors" argument, (so the default 0 is used).

Not sure whether that is causing the different behavior,
but there may be other differences.

Vratko.

From: csit-...@lists.fd.io<mailto:csit-...@lists.fd.io> 
<csit-...@lists.fd.io<mailto:csit-...@lists.fd.io>> On Behalf Of Jan Gelety via 
Lists.Fd.Io
Sent: Wednesday, September 18, 2019 10:30 AM
To: vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io>
Cc: csit-...@lists.fd.io<mailto:csit-...@lists.fd.io>
Subject: [csit-dev] VAT to PAPI issue with policer

Hello vpp-dev,

We are converting CSIT Policer.py library to use PAPI instead of VAT commands. 
Unfortunately policer functional
test is failing with „Invalid DSCP: 0, should be 20 “ in case of configuration 
via PAPI.

The root cause seems to be that policer_index  is not set for policer-classify 
as reported in packet trace:

00:00:17:623180: ip4-policer-classify
  POLICER_CLASSIFY: sw_if_index 1 next 1 table 0 offset -1 policer_index -1
00:00:17:623185: ip4-lookup
  fib 0 dpo-idx 1 flow hash: 0x00000000
  TCP: 10.10.10.2 -> 20.20.20.2
    tos 0x00, ttl 64, length 40, checksum 0x3eae
    fragment id 0x0001
  TCP: 20 -> 80
    seq. 0x00000000 ack 0x00000000
    flags 0x02 SYN, tcp header: 20 bytes
    window 8192, checksum 0x535d
00:00:17:623194: ip4-rewrite
  tx_sw_if_index 2 dpo-idx 1 : ipv4 via 20.20.20.2 
VirtualFunctionEthernet3b/a/3: mtu:9200 face00000203face000006030800 flow hash: 
0x00000000
  00000000: face00000203face00000603080045000028000100003f063fae0a0a0a021414
  00000020: 140200140050000000000000000050022000535d0000000000000000
00:00:17:623205: VirtualFunctionEthernet3b/a/3-output

While in case of configuration via VAT policer_index is set correctly:

00:00:16:770119: ip4-input-no-checksum
  TCP: 10.10.10.2 -> 20.20.20.2
    tos 0x00, ttl 64, length 40, checksum 0x3eae
    fragment id 0x0001
  TCP: 20 -> 80
    seq. 0x00000000 ack 0x00000000
    flags 0x02 SYN, tcp header: 20 bytes
    window 8192, checksum 0x535d
00:00:16:770128: ip4-policer-classify
  POLICER_CLASSIFY: sw_if_index 1 next 1 table 0 offset 1200 policer_index 0
00:00:16:770132: ip4-lookup
  fib 0 dpo-idx 1 flow hash: 0x00000000
  TCP: 10.10.10.2 -> 20.20.20.2
    tos 0x50, ttl 64, length 40, checksum 0x3e5e
    fragment id 0x0001
  TCP: 20 -> 80
    seq. 0x00000000 ack 0x00000000
    flags 0x02 SYN, tcp header: 20 bytes
    window 8192, checksum 0x535d
00:00:16:770140: ip4-rewrite
  tx_sw_if_index 2 dpo-idx 1 : ipv4 via 20.20.20.2 
VirtualFunctionEthernet3b/a/3: mtu:9200 badc0ffe0203badc0ffe06030800 flow hash: 
0x00000000
  00000000: badc0ffe0203badc0ffe0603080045500028000100003f063f5e0a0a0a021414
  00000020: 140200140050000000000000000050022000535d0000000000000000
00:00:16:770146: VirtualFunctionEthernet3b/a/3-output


VAT configuration

policer_add_del name policer1  cir 100 eir 150 cb 64 eb 64 rate_type pps 
round_type closest type 2r3c-2698 conform_action transmit exceed_action 
mark-and-transmit AF22 violate_action transmit color-aware
classify_add_del_table mask l3 ip4 dst
classify_add_del_session policer-hit-next 0 exceed-color table-index 0 skip_n 1 
match_n 2 match l3 ip4 dst 20.20.20.2
policer_classify_set_interface sw_if_index 1 ip4-table 0

have been converted to PAPI configuration

policer_add_del(conform_action_type=1,eir=150,name='policer1',cb=64,is_add=1,rate_type=1,eb=64,cir=100,violate_action_type=1,exceed_dscp=20,violate_dscp=0,color_aware=1,conform_dscp=0,type=2,exceed_action_type=2,round_type=0)
classify_add_del_table(next_table_index=4294967295,miss_next_index=4294967295,mask_len=32,match_n_vectors=2,mask='\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',current_data_offset=0,memory_size=2097152,table_index=4294967295,nbuckets=2,skip_n_vectors=0,is_add=1,current_data_flag=0)
classify_add_del_session(advance=0,match_len=32,is_add=1,opaque_index=1,hit_next_index=0,table_index=0,action=0,match='\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x14\x14\x14\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',metadata=0)
policer_classify_set_interface(ip6_table_index=4294967295,ip4_table_index=0,l2_table_index=4294967295,is_add=1,sw_if_index=1)

based on the corresponding VAT code in api_format.c file, that means

-        policer_index returned by policer_add_del API function has been used 
for parameter hit_next_index of classify_add_del_session API function
-        new_table_index returned by classify_add_del_table API function has 
been used for parameter table_index of classify_add_del_session API function
-        value of opaque_index parameter of classify_add_del_session API 
function has been set based on required pre-color setting (exceed-color in this 
case)

Can somebody help us to fix the issue, please?

Test log: 
https://logs.fd.io/production/vex-yul-rot-jenkins-1/csit-vpp-device-master-ubuntu1804-1n-skx/3683/archives/log.html.gz#s1-s1-s1-s4-s5-t1
Tested on Ubuntu bionic system with vpp build 20.01-rc0~174-g3d1ef873d~b3588.

Thanks,
Jan
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#14016): https://lists.fd.io/g/vpp-dev/message/14016
Mute This Topic: https://lists.fd.io/mt/34185745/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-
  • ... Jan Gelety via Lists.Fd.Io
    • ... Ole Troan
    • ... Vratko Polak -X (vrpolak - PANTHEON TECHNOLOGIES at Cisco) via Lists.Fd.Io
      • ... Jan Gelety via Lists.Fd.Io

Reply via email to