[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170805145337.17728-5-jiri@resnulli.us>
Date: Sat, 5 Aug 2017 16:53:26 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, jhs@...atatu.com, xiyou.wangcong@...il.com,
daniel@...earbox.net, mlxsw@...lanox.com, andrew@...n.ch,
vivien.didelot@...oirfairelinux.com, f.fainelli@...il.com,
simon.horman@...ronome.com, pieter.jansenvanvuuren@...ronome.com,
dirk.vandermerwe@...ronome.com, alexander.h.duyck@...el.com,
amritha.nambiar@...el.com, oss-drivers@...ronome.com
Subject: [patch net-next 04/15] cxgb4: push cls_u32 setup_tc processing into a separate function
From: Jiri Pirko <jiri@...lanox.com>
Let cxgb_setup_tc be a splitter for specific setup_tc types and push out
cls_u32 specific code into a separate function.
Signed-off-by: Jiri Pirko <jiri@...lanox.com>
---
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 42 +++++++++++++++----------
1 file changed, 26 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index 89d2b0c..6512290 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -2889,6 +2889,26 @@ static int cxgb_set_tx_maxrate(struct net_device *dev, int index, u32 rate)
return err;
}
+static int cxgb_setup_tc_cls_u32(struct net_device *dev,
+ enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 proto,
+ struct tc_cls_u32_offload *cls_u32)
+{
+ if (TC_H_MAJ(handle) != TC_H_MAJ(TC_H_INGRESS) ||
+ chain_index)
+ return -EOPNOTSUPP;
+
+ switch (cls_u32->command) {
+ case TC_CLSU32_NEW_KNODE:
+ case TC_CLSU32_REPLACE_KNODE:
+ return cxgb4_config_knode(dev, proto, cls_u32);
+ case TC_CLSU32_DELETE_KNODE:
+ return cxgb4_delete_knode(dev, proto, cls_u32);
+ default:
+ return -EOPNOTSUPP;
+ }
+}
+
static int cxgb_setup_tc(struct net_device *dev, enum tc_setup_type type,
u32 handle, u32 chain_index, __be16 proto,
struct tc_to_netdev *tc)
@@ -2896,9 +2916,6 @@ static int cxgb_setup_tc(struct net_device *dev, enum tc_setup_type type,
struct port_info *pi = netdev2pinfo(dev);
struct adapter *adap = netdev2adap(dev);
- if (chain_index)
- return -EOPNOTSUPP;
-
if (!(adap->flags & FULL_INIT_DONE)) {
dev_err(adap->pdev_dev,
"Failed to setup tc on port %d. Link Down?\n",
@@ -2906,20 +2923,13 @@ static int cxgb_setup_tc(struct net_device *dev, enum tc_setup_type type,
return -EINVAL;
}
- if (TC_H_MAJ(handle) == TC_H_MAJ(TC_H_INGRESS) &&
- type == TC_SETUP_CLSU32) {
- switch (tc->cls_u32->command) {
- case TC_CLSU32_NEW_KNODE:
- case TC_CLSU32_REPLACE_KNODE:
- return cxgb4_config_knode(dev, proto, tc->cls_u32);
- case TC_CLSU32_DELETE_KNODE:
- return cxgb4_delete_knode(dev, proto, tc->cls_u32);
- default:
- return -EOPNOTSUPP;
- }
+ switch (type) {
+ case TC_SETUP_CLSU32:
+ return cxgb_setup_tc_cls_u32(dev, type, handle, chain_index,
+ proto, tc->cls_u32);
+ default:
+ return -EOPNOTSUPP;
}
-
- return -EOPNOTSUPP;
}
static netdev_features_t cxgb_fix_features(struct net_device *dev,
--
2.9.3
Powered by blists - more mailing lists