[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160301145548.GD2098@nanopsycho.orion>
Date: Tue, 1 Mar 2016 15:55:48 +0100
From: Jiri Pirko <jiri@...nulli.us>
To: Amir Vadai <amir@...ai.me>
Cc: "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
Or Gerlitz <ogerlitz@...lanox.com>,
John Fastabend <john.r.fastabend@...el.com>,
Saeed Mahameed <saeedm@...lanox.com>,
Hadar Har-Zion <hadarh@...lanox.com>,
Jiri Pirko <jiri@...lanox.com>
Subject: Re: [PATCH net-next 7/8] net/mlx5e: Support offload cls_flower with
drop action
Tue, Mar 01, 2016 at 03:24:49PM CET, amir@...ai.me wrote:
>Parse tc_cls_flower_offload into device specific commands and program
>the hardware to classify and act accordingly.
>
>For example, to drop ICMP (ip_proto 1) packets from specific smac, dmac,
>src_ip, src_ip, arriving to interface ens9:
>
> # tc qdisc add dev ens9 ingress
>
> # tc filter add dev ens9 protocol ip parent ffff: \
> flower ip_proto 1 \
> dst_mac 7c:fe:90:69:81:62 src_mac 7c:fe:90:69:81:56 \
> dst_ip 11.11.11.11 src_ip 11.11.11.12 indev ens9 \
> action drop
>
>Signed-off-by: Amir Vadai <amir@...ai.me>
>Signed-off-by: Or Gerlitz <ogerlitz@...lanox.com>
>---
> drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 9 +
> drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 287 ++++++++++++++++++++++
> drivers/net/ethernet/mellanox/mlx5/core/en_tc.h | 5 +
> 3 files changed, 301 insertions(+)
>
>diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
>index cb02b4c..1d1da94 100644
>--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
>+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
>@@ -1889,6 +1889,15 @@ static int mlx5e_ndo_setup_tc(struct net_device *dev, u32 handle,
> goto mqprio;
>
> switch (tc->type) {
>+ case TC_SETUP_CLSFLOWER:
>+ switch (tc->cls_flower->command) {
>+ case TC_CLSFLOWER_REPLACE:
>+ return mlx5e_configure_flower(priv, proto, tc->cls_flower);
>+ case TC_CLSFLOWER_DESTROY:
>+ return mlx5e_delete_flower(priv, tc->cls_flower);
>+ default:
>+ return -EINVAL;
No need to default case here is you change "command" to enum as I
suggested it the reply to patch 1.
Powered by blists - more mailing lists