> On Mar 3, 2017, at 4:45 AM, Pascal Mazon <pascal.ma...@6wind.com> wrote: > > Supported flow rules are now mapped to TC rules on the tap netdevice. > The netlink message used for creating the TC rule is stored in struct > rte_flow. That way, by simply changing a metadata in it, we can require > for the rule deletion without further parsing. > > Supported items: > - eth: src and dst (with variable masks), and eth_type (0xffff mask). > - vlan: vid, pcp, tpid, but not eid. > - ipv4/6: src and dst (with variable masks), and ip_proto (0xffff mask). > - udp/tcp: src and dst port (0xffff) mask. > > Supported actions: > - DROP > - QUEUE > - PASSTHRU > > It is generally not possible to provide a "last" item. However, if the > "last" item, once masked, is identical to the masked spec, then it is > supported. > > Only IPv4/6 and MAC addresses can use a variable mask. All other > items need a full mask (exact match). > > Support for VLAN requires kernel headers >= 4.9, checked using > auto-config.sh. > > Signed-off-by: Pascal Mazon <pascal.ma...@6wind.com> > Acked-by: Olga Shern <ol...@mellanox.com> > —
… > /** > @@ -120,13 +965,33 @@ tap_flow_create(struct rte_eth_dev *dev, > * @see rte_flow_ops > */ > static int > -tap_flow_destroy(struct rte_eth_dev *dev __rte_unused, > +tap_flow_destroy(struct rte_eth_dev *dev, > struct rte_flow *flow, > - struct rte_flow_error *error __rte_unused) > + struct rte_flow_error *error) > { > + struct pmd_internals *pmd = dev->data->dev_private; > + int ret = 0; > + > LIST_REMOVE(flow, next); > + flow->msg.nh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK; > + flow->msg.nh.nlmsg_type = RTM_DELTFILTER; > + > + ret = nl_send(pmd->nlsk_fd, &flow->msg.nh); > + if (ret < 0) { > + rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE, > + NULL, "couldn't send request to kernel"); > + goto end; > + } > + ret = nl_recv_ack(pmd->nlsk_fd); > + if (ret < 0) { > + rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE, > + NULL, > + "couldn't receive kernel ack to our > request"); > + goto end; This goto is not required. > + } > +end: > rte_free(flow); > - return 0; > + return ret; > } > > /** > diff --git a/drivers/net/tap/tap_flow.h b/drivers/net/tap/tap_flow.h > index 377a9f7b758a..a05e945df523 100644 > --- a/drivers/net/tap/tap_flow.h > +++ b/drivers/net/tap/tap_flow.h > @@ -37,6 +37,18 @@ > #include <rte_flow.h> > #include <rte_flow_driver.h> > > +/** > + * In TC, priority 0 means we require the kernel to allocate one for us. > + * In rte_flow, however, we want the priority 0 to be the most important one. > + * Use an offset to have the most important priority being 1 in TC. > + */ > +#define PRIORITY_OFFSET 1 > +#define PRIORITY_MASK (0xfff) > +#define MAX_PRIORITY (PRIORITY_MASK - PRIORITY_OFFSET) > +#define GROUP_MASK (0xf) > +#define GROUP_SHIFT 12 > +#define MAX_GROUP GROUP_MASK > + > int tap_dev_filter_ctrl(struct rte_eth_dev *dev, > enum rte_filter_type filter_type, > enum rte_filter_op filter_op, > -- > 2.8.0.rc0 > Regards, Keith