From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=WH/oY2z3LtcApzjBPufYgFLdfa7QHF773jvBQLt+O8E=; b=uLTNb2sGlWuJmCROO/eTRrurtjGi3x34FeFxPNsrtrFtYUl/cE64pq0aGSQodE5wCz 7um5MUHjmRryUpXH0XiLgPVK7H7/TAZTQ4kyu2d8IeepXLALMYs/PjYAp+xwwDmZasUp CoD8Aq7pk2rOnxAsoOyAd0be8JjhOsBtjaGQIPoZ8Bl4UfRLGxLCo8aS4dx5+NPs4zXV m2vNGMOqKGzO35fYy8W8SO9nRXQ2MKVAUbBh4UdLQBnNoDU9RYGI4NU7H3VXpaYpcRZq 6rSRIiSIPMeJM8ezVjWRIMizd25y8mN4ZO/ctAB8iXOtk9Hn4cWby6XdimuX7khV4+W3 q1Vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=WH/oY2z3LtcApzjBPufYgFLdfa7QHF773jvBQLt+O8E=; b=tCdwhDivgONCV5PM/QTGntZVQ/8GiMnTvMauHu3byfQpEp9zO9Uz4WT3MYwI6NPkMD jRF5yb2xfWT58YUxv0ef6VXeQWHutNfCLEm7IoGkqmqsl20BnbyNyfsPDASR8060Ykdp WKX5CuF14IUk9Lv9TykAQylZSJx2ajWDZFT//3ri4Qso4bhFZrtw13PaePVXbZBLLBQQ psUwIocpju1D40yQYPjqMgRQp7qOIbU9JQr5+UA3q62ZmwDdF1KAEcQe9i4/lTSOaeNl shTKsTZET7UJMZ6uIgFgRtJ4PYkfdcPWGuBzCtYxLOgBvQ4b3LT+qWjnTw8UUPcc3vnH tPgw== X-Gm-Message-State: AMke39lndlxuC0XO61wk+W6e1yUCyOEKadpCIWJhg62/NQuzhNUQ5BK7/Ec7JY+Wa97sz5wR X-Received: by 10.223.150.15 with SMTP id b15mr14318887wra.191.1488810158669; Mon, 06 Mar 2017 06:22:38 -0800 (PST) Received: from paques.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id e16sm27286002wra.36.2017.03.06.06.22.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Mar 2017 06:22:38 -0800 (PST) Date: Mon, 6 Mar 2017 15:22:29 +0100 From: Pascal Mazon To: "Wiles, Keith" Cc: "dev@dpdk.org" Message-ID: <20170306152229.3f422e21@paques.dev.6wind.com> In-Reply-To: References: <02914b0e8291777fa74ec6c6b5bb64c0cd7c7513.1488537600.git.pascal.mazon@6wind.com> Organization: 6WIND X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH 4/4] net/tap: add basic flow API patterns and actions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Mar 2017 14:22:39 -0000 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