0

OS:CentOS 7.3

DPDK:19.08

I use one X710 NIC, create 2 VFs in kernel driver i40e, and bind vfio-pci driver on VF 0 and Start a DPDK PMD application.

Then I try to create a Flow Rule use rte_flow, but it returns -38, Function not implemented when I called rte_flow_validate().

Does it means this VF doesn't support rte_flow API? or there are some configure or flags need to be set on VF?

my zhu
  • 21
  • 2
  • Please share the code snippet to understand which functionality are you trying to offload from VF NIC? – Vipin Varghese Sep 17 '21 at 12:30
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Sep 25 '21 at 05:05

1 Answers1

0

DPDK RTE_FLOW are supported on both PF and VF for X710 (Fortville) NIC, with actions like

  1. RTE_FLOW_ACTION_TYPE_QUEUE
  2. RTE_FLOW_ACTION_TYPE_DROP
  3. RTE_FLOW_ACTION_TYPE_PASSTHRU
  4. RTE_FLOW_ACTION_TYPE_MARK
  5. RTE_FLOW_ACTION_TYPE_RSS

The return value -38 for DPDK API is not Function not implemented, but actually I40E_ERR_OPCODE_MISMATCH. This means either Lookup parameters or match cases are improperly configured. Code Snippet that works on X710 VF, shared below

/* configure for 2 RX queues */

struct rte_flow_attr attr = { .ingress = 1 };
struct rte_flow_item pattern[10];
struct rte_flow_action actions[10];
struct rte_flow_item_eth eth;
struct rte_flow_item_eth eth_mask;
struct rte_flow_item_vlan vlan;
struct rte_flow_item_vlan vlan_mask;
struct rte_flow_item_ipv4 ipv4;
struct rte_flow_item_ipv4 ipv4_mask;
struct rte_flow *flow;
struct rte_flow_action_mark mark = { .id = 0xdeadbeef };
struct rte_flow_action_queue queue = { .index = 0x3 };

memset(&pattern, 0, sizeof(pattern));
memset(&actions, 0, sizeof(actions));
memset(&attr, 0, sizeof(attr));
attr.group = 0;
attr.priority = 0;
attr.ingress = 1;
attr.egress = 0;

memset(&eth_mask, 0, sizeof(struct rte_flow_item_eth));
pattern[0].type = RTE_FLOW_ITEM_TYPE_ETH;
pattern[0].spec = ð
pattern[0].last = NULL;
pattern[0].mask = NULL;

memset(&vlan_mask, 0, sizeof(struct rte_flow_item_vlan));
pattern[1].type = RTE_FLOW_ITEM_TYPE_VLAN;
pattern[1].spec = &vlan;
pattern[1].last = NULL;
pattern[1].mask = NULL;


/* set the dst ipv4 packet to the required value */
pattern[1].type = RTE_FLOW_ITEM_TYPE_IPV4;
pattern[1].spec = NULL;
pattern[1].last = NULL;
pattern[1].mask = NULL;

pattern[2].type = RTE_FLOW_ITEM_TYPE_UDP;
pattern[2].spec = NULL;
pattern[2].last = NULL;
pattern[2].mask = NULL;

/* end the pattern array */
pattern[3].type = RTE_FLOW_ITEM_TYPE_END;

/* create the drop action */
actions[0].type = RTE_FLOW_ACTION_TYPE_MARK;
actions[0].conf = &mark;
actions[1].type = RTE_FLOW_ACTION_TYPE_END;

note: request @myzhu in comments to share the actual code snippet to root cause the issue too.

Vipin Varghese
  • 4,540
  • 2
  • 9
  • 25
  • Thank you , varghese. I just use the dpdk example – my zhu Sep 23 '21 at 09:31
  • Example :Flow_filtering and change nothing. It works once today, but never works now – my zhu Sep 23 '21 at 09:39
  • @myzhu are you saying the example code-shared by me works once and then it did not work? If yes, there is something wrong in VF usage. Can we do alive debug? – Vipin Varghese Sep 23 '21 at 10:48
  • No, @ Vipin Varghese, I mean the RTE_FLOW example in DPDK source code----`flow_filtering`. I create VF in kernel mode and use `dpdk-devbind.py` bind one VF in vfio-pci, and Run `flow_filtering` on it. I up the pf before i use the vf and set VF trust on. – my zhu Sep 24 '21 at 02:25
  • ahh ok, @myzhu you are stating, with the example code given in the answer you are able to make flow filtering working. Is that right? If not, I am happy to check (live debug) / The same code snippet works with VF on X710. – Vipin Varghese Sep 24 '21 at 02:29
  • It works once ,and it failed till now. I tryed reboot the server,but doesn't work. It return `-38` and output the log `Function not implemented` . I don't know if the NIC register or flags or something others not set correctly. – my zhu Sep 24 '21 at 02:32
  • My company develop environment can't connect to Internet, Maybe we can't debug alive, But I will try your code right now. – my zhu Sep 24 '21 at 02:34
  • hmm, this looks liek more of hardware or firmware or configuration issues. Can we live debug? – Vipin Varghese Sep 24 '21 at 02:34
  • can you find the NIC firmware version? – Vipin Varghese Sep 24 '21 at 02:36
  • Firmware version : 6.01 0x800035cf 1.1747.0 – my zhu Sep 24 '21 at 02:42
  • recommended Firmware version: 7.00 0x80004cdb. Please update and retry – Vipin Varghese Sep 24 '21 at 02:44
  • But it can run correctly on pf. – my zhu Sep 24 '21 at 02:55
  • @myzhu with the right firmware version and dpdk version I am able to get RTE_FLOW working with X710 with VF and PF alike. Since there is no live debug shared and limited information about your setup, I can also suggest the issue could be firmware for VF. the same code works on VF x710 without any issues. – Vipin Varghese Sep 24 '21 at 02:58
  • I update the firmware to latest 8.40, it does not work. – my zhu Sep 24 '21 at 08:50
  • @myzhu live debug? surprise why rte_flow_validate is failing on your system – Vipin Varghese Sep 24 '21 at 08:59
  • @myzhu as shared multiple times I am open to help in live debug to understand why rte_flow_validate is failing on vf on your setup most times and passes a few times. Aer you able to come for live debug? – Vipin Varghese Sep 24 '21 at 09:19
  • sorry,our environment is isolated from the Internet physically,so we cannot debug alive. Our PF uses driver i40e, not the igb_uio. Does affect the result? – my zhu Sep 26 '21 at 00:13
  • @myzhu the question I am asking again and again is `you have mentioned rte_flow, but it returns -38, Function not implemented when I called rte_flow_validate()`. With the code snippet on my environment with PF (Linux driver i40e) and VF (igb_uio) returns without error. So the question is `are you still getting return as -38 for rte_flow_validate?` – Vipin Varghese Sep 26 '21 at 05:56
  • Yes, the return value from rte_flow_validate is still -38. – my zhu Sep 26 '21 at 07:50
  • Is there anything special in port init in your code? – my zhu Sep 26 '21 at 08:17
  • @myzhu none there is no special port init. Same code works on VF X710. Hence please share 1) `your code snippet which fails` 2) `lshw -c net -businfo` 3) `ethtool -i [VF kernel interface]` 4) `sudo lspci -vnks [PCIe BDF of the VF]` – Vipin Varghese Sep 27 '21 at 02:53
  • I add some logs in `rte_flow_validate()` and find it return in `return -rte_error;` which means ops is NULL and `rte_flow_ops *ops = rte_flow_ops_get(portid, error)` not success. – my zhu Sep 27 '21 at 07:57