On Tue, Mar 01, 2016 at 03:55:48PM +0100, Jiri Pirko wrote:
> Tue, Mar 01, 2016 at 03:24:49PM CET, a...@vadai.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 <a...@vadai.me>
> >Signed-off-by: Or Gerlitz <ogerl...@mellanox.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.
ack

Reply via email to