服务器已安装好VFIO驱动、DPDK,进行大页内存配置,且正确启动dpdk-testpmd进程。
启动dpdk-testpmd进程:
dpdk-testpmd --iova-mode=pa -a 0000:98:00.0 -a 0000:98:00.1 -c 0xffff -n 7 -- --rxq=8 --txq=8 --rxd=1024 --txd=1024 -i --nb-cores=7
--iova-mode=pa:在no-iommu的情况下,强制使用PA;-a 0000:98:00.0:网卡的PCI地址。
flow create port_id ingress pattern eth / {ipv4|ipv6} {src is|dst is} ip_address / {udp|tcp|vxlan} {src is|dst is} port / end actions queue index queue_id / end
参数 |
参数说明 |
---|---|
port_id |
流规则应用的端口ID。 |
{ipv4|ipv6} |
流规则的IP地址。
|
{src is|dst is} |
规则地址。
|
ip_address |
IPv4或者IPv6的地址。 |
{udp|tcp|vxlan} |
规则的三种模式。
|
port |
端口号。
|
queue_id |
规则的index。 |
1 2 3 | flow create 0 ingress pattern eth / ipv4 src is 2.2.2.3 dst is 2.2.2.5 / udp src is 32 dst is 32 / end actions queue index 1 / end flow create 0 ingress pattern eth / ipv4 dst is 192.169.1.143 / tcp / end actions queue index 0 / end flow create 0 ingress pattern eth / ipv6 src is fec0:1111:2222:3333:0200:0000:c055:0001 dst is aec0:a111:a222:a333:a200:a000:a055:a001 / udp / vxlan / tcp dst is 179 / end actions queue index 0 / end |
1 2 3 | testpmd> flow list 0 ID Group Prio Attr Rule 0 0 0 i-- ETH IPV4 UDP => QUEUE |
hinicadm3 table -i device -t 9 -x ID
参数 |
参数说明 |
---|---|
device |
设备名。例如:hinic0。 |
ID |
规则序号ID。 |
查询fdir流表规则。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | [root@localhost ~]# hinicadm3 table -i hinic0 -t 9 -x 0 fdir tcam ipv4 table: index:0 ---------key---------- key_mask:function_id=0x7fff key_info:function_id=0x7fff key_mask:protocol=0xff key_info:protocol=0x11 key_mask:tunnel_flag=0xf key_info:tunnel_flag=0x0 key_mask:sip=0xffffffff key_info:sip=2.2.2.3 key_mask:dip=0xffffffff key_info:dip=2.2.2.5 key_mask:src_port=0xffff key_info:src_port=0x20 key_mask:dst_port=0xffff key_info:dst_port=0x20 key_mask:ext_dip=0x00 key_info:ext_dip=0.0.0.0 key_mask:vlan_flag=0x0 key_info:vlan_flag=0x0 key_mask:vlan_id=0x0 key_info:vlan_id=0x0 ---------action---------- fdir q_id=0x1 action:rsvd=0x80800040 |
1 2 3 | testpmd> flow destroy 0 rule 0 sp6: begin to del tcam filter sp6: Del fdir_tcam_dynamic_rule function_id: 0x40, tcam_block_id: 0, local_index: 0, global_index: 0, local_rules_nums: 0, global_rule_nums: 0 succeed |
flow create port_id ingress pattern eth / {ipv4|ipv6} {src is|dst is} ip_address / {udp|tcp|vxlan} {src is|dst is} port / end actions rss queues queue_num end /end
参数 |
参数说明 |
---|---|
port_id |
流规则应用的端口ID。 |
{ipv4|ipv6} |
流规则的IP地址。
|
{src is|dst is} |
规则地址。
|
ip_address |
IPv4或者IPv6的地址。 |
{udp|tcp|vxlan} |
规则的三种模式。
|
port |
端口号。
|
queue_num |
连续队列,例如:0 1 2 3。 |
1 | flow create 1 ingress pattern eth / ipv4 src is 192.168.55.5 dst is 192.168.55.2 / tcp src is 1234 dst is 5678 / end actions rss queues 0 1 2 3 end / end |
1 2 3 | testpmd> flow list 0 ID Group Prio Attr Rule 0 0 0 i-- ETH IPV4 TCP => RSS |
hinicadm3 table -i device -t 9 -x ID
参数 |
参数说明 |
---|---|
device |
设备名。例如:hinic0。 |
ID |
规则序号ID。 |
查询RSS流表规则。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | [root@localhost ~]# hinicadm3 table -i hinic0 -t 9 -x 0 fdir tcam ipv4 table: index:0 ---------key---------- key_mask:function_id=0x7fff key_info:function_id=0x7fff key_mask:protocol=0xff key_info:protocol=0x6 key_mask:tunnel_flag=0xf key_info:tunnel_flag=0x0 key_mask:sip=0xffffffff key_info:sip=192.168.55.5 key_mask:dip=0xffffffff key_info:dip=192.168.55.2 key_mask:src_port=0xffff key_info:src_port=0x4d2 key_mask:dst_port=0xffff key_info:dst_port=0x162e key_mask:ext_dip=0x00 key_info:ext_dip=0.0.0.0 key_mask:vlan_flag=0x0 key_info:vlan_flag=0x0 key_mask:vlan_id=0x0 key_info:vlan_id=0x0 ---------action---------- rss queues=[0 1 2 3] action:rsvd=0x82000040 |