From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pascal Mazon Subject: Re: [PATCH 4/4] net/tap: add basic flow API patterns and actions Date: Mon, 6 Mar 2017 15:22:29 +0100 Message-ID: <20170306152229.3f422e21@paques.dev.6wind.com> References: <02914b0e8291777fa74ec6c6b5bb64c0cd7c7513.1488537600.git.pascal.mazon@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" To: "Wiles, Keith" Return-path: Received: from mail-wr0-f174.google.com (mail-wr0-f174.google.com [209.85.128.174]) by dpdk.org (Postfix) with ESMTP id EC0E1108A for ; Mon, 6 Mar 2017 15:22:38 +0100 (CET) Received: by mail-wr0-f174.google.com with SMTP id u108so117602158wrb.3 for ; Mon, 06 Mar 2017 06:22:38 -0800 (PST) In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Fri, 3 Mar 2017 15:47:58 +0000 "Wiles, Keith" wrote: >=20 > > On Mar 3, 2017, at 4:45 AM, Pascal Mazon > > wrote: > >=20 > > 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. > >=20 > > 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. > >=20 > > Supported actions: > > - DROP > > - QUEUE > > - PASSTHRU > >=20 > > 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. > >=20 > > Only IPv4/6 and MAC addresses can use a variable mask. All other > > items need a full mask (exact match). > >=20 > > Support for VLAN requires kernel headers >=3D 4.9, checked using > > auto-config.sh. > >=20 > > Signed-off-by: Pascal Mazon > > Acked-by: Olga Shern > > =E2=80=94 >=20 > =E2=80=A6 >=20 > > /** > > @@ -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 =3D dev->data->dev_private; > > + int ret =3D 0; > > + > > LIST_REMOVE(flow, next); > > + flow->msg.nh.nlmsg_flags =3D NLM_F_REQUEST | NLM_F_ACK; > > + flow->msg.nh.nlmsg_type =3D RTM_DELTFILTER; > > + > > + ret =3D 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 =3D 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; >=20 > This goto is not required. >=20 Indeed! I'll fix that in v2. Regards, Pascal > > + } > > +end: > > rte_free(flow); > > - return 0; > > + return ret; > > } > >=20 > > /** > > 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 > > #include > >=20 > > +/** > > + * 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, > > --=20 > > 2.8.0.rc0 > >=20 >=20 > Regards, > Keith >=20