diff options
author | Yishai Hadas <yishaih@mellanox.com> | 2016-03-30 18:39:18 +0300 |
---|---|---|
committer | Yishai Hadas <yishaih@mellanox.com> | 2016-05-17 16:40:17 +0300 |
commit | 46cdea5373dea4ea5972189cba18347388f4811f (patch) | |
tree | f859fe3fa6ae97068762442ff60827a29f742f7f | |
parent | 69042c660f0622b8804729169ea455e6738af124 (diff) | |
download | libibverbs-46cdea5373dea4ea5972189cba18347388f4811f.tar.gz |
Add an example to ibv_create_flow man page
Add an example rule to show typical usage of
the API.
Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r-- | man/ibv_create_flow.3 | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/man/ibv_create_flow.3 b/man/ibv_create_flow.3 index 4ba6ee7..df6ddd3 100644 --- a/man/ibv_create_flow.3 +++ b/man/ibv_create_flow.3 @@ -103,6 +103,68 @@ IBV_DEVICE_MANAGED_FLOW_STEERING and only for QPs of Transport Service Type or .BR IBV_QPT_RAW_PACKET .PP +.SH EXAMPLE +.br +Below flow_attr defines a rule in priority 0 to match a destination +mac address and a source ipv4 address. For that, L2 and L3 specs are used. +.br +If there is a hit on this rule, means the +received packet has destination mac: 66:11:22:33:44:55 and source ip: 0x0B86C806, +the packet is steered to its attached qp. +.sp +.nf +struct raw_eth_flow_attr { +.in +8 +struct ibv_flow_attr attr; +struct ibv_flow_spec_eth spec_eth; +struct ibv_flow_spec_ipv4 spec_ipv4; +.in -8 +} __attribute__((packed)); +.sp +.nf +struct raw_eth_flow_attr flow_attr = { +.in +8 + .attr = { + .comp_mask = 0, + .type = IBV_FLOW_ATTR_NORMAL, + .size = sizeof(flow_attr), + .priority = 0, + .num_of_specs = 2, + .port = 1, + .flags = 0, + }, + .spec_eth = { + .type = IBV_FLOW_SPEC_ETH, + .size = sizeof(struct ibv_flow_spec_eth), + .val = { + .dst_mac = {0x66, 0x11, 0x22, 0x33, 0x44, 0x55}, + .src_mac = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + .ether_type = 0, + .vlan_tag = 0, + }, + .mask = { + .dst_mac = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, + .src_mac = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, + .ether_type = 0, + .vlan_tag = 0, + } + }, + .spec_ipv4 = { + .type = IBV_FLOW_SPEC_IPV4, + .size = sizeof(struct ibv_flow_spec_ipv4), + .val = { + .src_ip = 0x0B86C806, + .dst_ip = 0, + }, + .mask = { + .src_ip = 0xFFFFFFFF, + .dst_ip = 0, + } + } +.in -8 +}; +.sp +.nf .SH "AUTHORS" .TP Hadar Hen Zion <hadarh@mellanox.com> |