Hi @andyfingerhut ,
I encounter a problem with idle_timeout and would like to ask for your advice. I do the test by using p4runtime-shell to add rules with idle_timeout in a bmv2 switch. While all other parts of the rules (e.g., match, action, priority (if relevant)) can be added in the switch successfully, the idle_timeout seems to be never active in the switch. I have checked that in the switch with simple_switch_CLI, and also tried to catch idle_timeout_notification but could not see any. I add some details below to be more clear.
Part of the test_idletimeout.p4 file:
table dmac {
key = {
hdr.ethernet.dstAddr: exact;
}
actions = {
forward;
send_to_cpu;
NoAction;
}
support_timeout = true;
default_action = send_to_cpu;
}
I can compile the above p4 file successfully with the command:
p4c-bm2-ss --p4v 16 --p4runtime-files test_idletimeout.p4info.txt -o test_idletimeout.json test_idletimeout.p4
and run the bmv2 switch with:
sudo simple_switch_grpc -i 1@eth1 -i 2@eth2 -i 3@eth3 -i 4@eth4 -i 5@eth5 --pcap pcaps --nanolog ipc:///tmp/s1-log.ipc --device-id 1 test_idletimeout.json --log-console --thrift-port 9090 -- --grpc-server-addr 172.16.0.51:50051 --cpu-port 255
Then, p4runtime-shell as the controller:
python3 -m p4runtime_sh --grpc-addr 172.16.0.51:50051 --device-id 1 --election-id 0,1 --config test_idletimeout.p4info.txt,test_idletimeout.json
te = TableEntry('dmac')(action='forward')
te.match['dstAddr'] = '00:00:01:01:ff:ff'
te.action['egress_port'] = '3'
te.idle_timeout_ns = 12345
te.insert()
Using simple_switch_CLI, I can see the rule in the switch as follow:
TABLE ENTRIES
**********
Dumping entry 0x0
Match key:
* ethernet.dstAddr : EXACT 00000101ffff
Action entry: MyIngress.forward - 03
==========
Dumping default entry
Action entry: MyIngress.send_to_cpu -
As said, there is no idle_timeout_notification sent from the switch to the control plane at all, also no hint on idle_timeout in the rule shown via simple_switch_CLI.
However, if I set idle_timeout for that entry by simple_switch_CLI command:
table_set_timeout dmac 0 1000
then I can observe the rule in the switch with idle_timeout being set (also with simple_switch_CLI) as below, and also I can catch some idle_timeout_notification in the control plane:
TABLE ENTRIES
**********
Dumping entry 0x0
Match key:
* ethernet.dstAddr : EXACT 00000101ffff
Action entry: MyIngress.forward - 03
Life: 17495ms since hit, timeout is 1000ms
==========
Dumping default entry
Action entry: MyIngress.send_to_cpu -
Therefore, I believe p4runtime-shell has not set idle_timeout successfully in the switch.
Could you please give me some advice on this problem? Have I missed something while using p4runtime-shell to set idle_timeout?
Many thanks.
Cheers!
Cuong