[P4-discuss] table_modify ternary table is not working in BMV2 runtime_CLI

Thambi Sreedharan thambisree at gmail.com
Fri Oct 7 21:29:08 EDT 2016


Hi Antionin

thanks it worked.

RuntimeCmd: table_modify ternary_1 setport  1 7

Modifying entry 1 for ternary match table ternary_1

RuntimeCmd: table_dump_entry ternary_1 1

Dumping entry 0x1

Match key:

* ethernet.dstAddr    : TERNARY   000000000000 &&& 000000000001

Priority: 0

Action entry: setport - 07

thanks

Thambi




On Fri, Oct 7, 2016 at 6:17 PM, Antonin Bas <antonin at barefootnetworks.com>
wrote:

> I'm afraid I don't understand your command. If you are trying to modify
> the entry, why are you providing the match key again?
> The documentation for the command states that it should be sued as follows:
> table_modify <table name> <action name> <entry handle> [action parameters]
> so maybe "table_modify ternary_1 setport 1 7" ?
>
> On Fri, Oct 7, 2016 at 6:06 PM, Thambi Sreedharan <thambisree at gmail.com>
> wrote:
>
>> HI Antonin
>>
>> Thanks for fast the reply
>>
>> I tried and I got the same error:
>>
>> RuntimeCmd:  table_modify ternary_1 setport  1 aa:bb:cc:dd:dd:02&&&01 => 7
>>
>> Error: Action setport needs 1 parameters
>>
>> thambi
>>
>> On Fri, Oct 7, 2016 at 4:41 PM, Antonin Bas <antonin at barefootnetworks.com
>> > wrote:
>>
>>> Hi Thambi,
>>>
>>> The priority is considered to be part of the key, so you cannot modify
>>> it with table_modify. If you omit the "0" after the "7" in your CLI command
>>> it should work.
>>>
>>> On Fri, Oct 7, 2016 at 4:37 PM, Thambi Sreedharan <thambisree at gmail.com>
>>> wrote:
>>>
>>>> Hi
>>>>
>>>> I am new to P4,
>>>>
>>>> trying to modify ternary table entry and I getting error
>>>>
>>>> P4 code:
>>>>
>>>> header_type ethernet_t {
>>>>
>>>>     fields {
>>>>
>>>>         dstAddr : 48;
>>>>
>>>>         srcAddr : 48;
>>>>
>>>>         etherType : 16;
>>>>
>>>>     }
>>>>
>>>> }
>>>>
>>>>
>>>> parser start {
>>>>
>>>>     return parse_ethernet;
>>>>
>>>> }
>>>>
>>>> header_type imd_t {
>>>>
>>>> fields {
>>>>
>>>> myport : 5;
>>>>
>>>> }
>>>>
>>>>
>>>> }
>>>>
>>>> header ethernet_t ethernet;
>>>>
>>>> metadata imd_t imd;
>>>>
>>>>
>>>> parser parse_ethernet {
>>>>
>>>>     extract(ethernet);
>>>>
>>>>     return ingress;
>>>>
>>>> }
>>>>
>>>>
>>>> action _nop() { }
>>>>
>>>>
>>>> action setport(port) {
>>>>
>>>> modify_field(imd.myport, port);
>>>>
>>>> }
>>>>
>>>>
>>>> table ternary_1 {
>>>>
>>>>     reads {
>>>>
>>>>         ethernet.dstAddr : ternary;
>>>>
>>>>     }
>>>>
>>>>     actions { _nop;setport; }
>>>>
>>>>     size : 65536;
>>>>
>>>> }
>>>>
>>>>
>>>> table ternary_2 {
>>>>
>>>>     reads {
>>>>
>>>>         ethernet.srcAddr : ternary;
>>>>
>>>>     }
>>>>
>>>>     actions { _nop; }
>>>>
>>>>     size : 65536;
>>>>
>>>> }
>>>>
>>>>
>>>> table ternary_3 {
>>>>
>>>>     reads {
>>>>
>>>>         ethernet.srcAddr : ternary;
>>>>
>>>>         ethernet.dstAddr : ternary;
>>>>
>>>>     }
>>>>
>>>>     actions { _nop; }
>>>>
>>>>     size : 65536;
>>>>
>>>> }
>>>>
>>>>
>>>> control ingress {
>>>>
>>>>     apply(ternary_1);
>>>>
>>>>     apply(ternary_2);
>>>>
>>>>     apply(ternary_3);
>>>>
>>>> }
>>>>
>>>>
>>>> control egress { }
>>>>
>>>>
>>>> use the p4c-bm to compile and got json file
>>>>
>>>> started the BMV2 with json
>>>>
>>>> ran $BMV2_PATH/tools/runtime_CLI.py
>>>>
>>>> added entry as follows
>>>>
>>>> RuntimeCmd: table_add ternary_1 setport aa:bb:cc:dd:dd:02&&&01 => 6 0
>>>>
>>>> Adding entry to ternary match table ternary_1
>>>>
>>>> match key:           TERNARY-aa:bb:cc:dd:dd:02 &&& 00:00:00:00:00:01
>>>>
>>>> action:              setport
>>>>
>>>> runtime data:        06
>>>>
>>>> Entry has been added with handle 1
>>>>
>>>> want to modify the entry and did as follows
>>>>
>>>>
>>>> RuntimeCmd: table_modify ternary_1 setport  1 aa:bb:cc:dd:dd:02&&&01 =>
>>>> 7 0
>>>>
>>>> Error: Action setport needs 1 parameters
>>>>
>>>> Please let me know how to modify a ternary table ?
>>>>
>>>>
>>>> Thanks
>>>>
>>>> Thambi
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> P4-discuss mailing list
>>>> P4-discuss at lists.p4.org
>>>> http://lists.p4.org/mailman/listinfo/p4-discuss_lists.p4.org
>>>>
>>>
>>>
>>>
>>> --
>>> Antonin
>>>
>>
>>
>
>
> --
> Antonin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-discuss_lists.p4.org/attachments/20161007/b57087b7/attachment-0002.html>


More information about the P4-discuss mailing list