From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, jhs@mojatatu.com, xiyou.wangcong@gmail.com,
daniel@iogearbox.net, mlxsw@mellanox.com, andrew@lunn.ch,
vivien.didelot@savoirfairelinux.com, f.fainelli@gmail.com,
simon.horman@netronome.com, pieter.jansenvanvuuren@netronome.com,
dirk.vandermerwe@netronome.com, alexander.h.duyck@intel.com,
amritha.nambiar@intel.com, oss-drivers@netronome.com,
yisen.zhuang@huawei.com, salil.mehta@huawei.com
Subject: [patch net-next v2 05/16] ixgbe: push cls_u32 and mqprio setup_tc processing into separate functions
Date: Mon, 7 Aug 2017 10:15:21 +0200 [thread overview]
Message-ID: <20170807081532.32760-6-jiri@resnulli.us> (raw)
In-Reply-To: <20170807081532.32760-1-jiri@resnulli.us>
From: Jiri Pirko <jiri@mellanox.com>
Let __ixgbe_setup_tc be a splitter for specific setup_tc types and push out
cls_u32 and mqprio specific codes into separate functions. Also change
the return values so they are the same as in the rest of the drivers.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 67 ++++++++++++++++-----------
1 file changed, 39 insertions(+), 28 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index d39db97..35db198 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -9226,42 +9226,53 @@ static int ixgbe_configure_clsu32(struct ixgbe_adapter *adapter,
return err;
}
-static int __ixgbe_setup_tc(struct net_device *dev, enum tc_setup_type type,
- u32 handle, u32 chain_index, __be16 proto,
- struct tc_to_netdev *tc)
+static int ixgbe_setup_tc_cls_u32(struct net_device *dev,
+ u32 handle, u32 chain_index, __be16 proto,
+ struct tc_cls_u32_offload *cls_u32)
{
struct ixgbe_adapter *adapter = netdev_priv(dev);
- if (chain_index)
+ if (TC_H_MAJ(handle) != TC_H_MAJ(TC_H_INGRESS) ||
+ chain_index)
return -EOPNOTSUPP;
- 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 ixgbe_configure_clsu32(adapter,
- proto, tc->cls_u32);
- case TC_CLSU32_DELETE_KNODE:
- return ixgbe_delete_clsu32(adapter, tc->cls_u32);
- case TC_CLSU32_NEW_HNODE:
- case TC_CLSU32_REPLACE_HNODE:
- return ixgbe_configure_clsu32_add_hnode(adapter, proto,
- tc->cls_u32);
- case TC_CLSU32_DELETE_HNODE:
- return ixgbe_configure_clsu32_del_hnode(adapter,
- tc->cls_u32);
- default:
- return -EINVAL;
- }
+ switch (cls_u32->command) {
+ case TC_CLSU32_NEW_KNODE:
+ case TC_CLSU32_REPLACE_KNODE:
+ return ixgbe_configure_clsu32(adapter, proto, cls_u32);
+ case TC_CLSU32_DELETE_KNODE:
+ return ixgbe_delete_clsu32(adapter, cls_u32);
+ case TC_CLSU32_NEW_HNODE:
+ case TC_CLSU32_REPLACE_HNODE:
+ return ixgbe_configure_clsu32_add_hnode(adapter, proto,
+ cls_u32);
+ case TC_CLSU32_DELETE_HNODE:
+ return ixgbe_configure_clsu32_del_hnode(adapter, cls_u32);
+ default:
+ return -EOPNOTSUPP;
}
+}
- if (type != TC_SETUP_MQPRIO)
- return -EINVAL;
-
- tc->mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS;
+static int ixgbe_setup_tc_mqprio(struct net_device *dev,
+ struct tc_mqprio_qopt *mqprio)
+{
+ mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS;
+ return ixgbe_setup_tc(dev, mqprio->num_tc);
+}
- return ixgbe_setup_tc(dev, tc->mqprio->num_tc);
+static int __ixgbe_setup_tc(struct net_device *dev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 proto,
+ struct tc_to_netdev *tc)
+{
+ switch (type) {
+ case TC_SETUP_CLSU32:
+ return ixgbe_setup_tc_cls_u32(dev, handle, chain_index, proto,
+ tc->cls_u32);
+ case TC_SETUP_MQPRIO:
+ return ixgbe_setup_tc_mqprio(dev, tc->mqprio);
+ default:
+ return -EOPNOTSUPP;
+ }
}
#ifdef CONFIG_PCI_IOV
--
2.9.3
next prev parent reply other threads:[~2017-08-07 8:15 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-07 8:15 [patch net-next v2 00/16] net: sched: summer cleanup part 2, ndo_setup_tc Jiri Pirko
2017-08-07 8:15 ` [patch net-next v2 01/16] net: sched: make type an argument for ndo_setup_tc Jiri Pirko
2017-08-07 8:15 ` [patch net-next v2 02/16] net: sched: rename TC_SETUP_MATCHALL to TC_SETUP_CLSMATCHALL Jiri Pirko
2017-08-07 8:15 ` [patch net-next v2 03/16] net: sched: make egress_dev flag part of flower offload struct Jiri Pirko
2017-08-07 8:15 ` [patch net-next v2 04/16] cxgb4: push cls_u32 setup_tc processing into a separate function Jiri Pirko
2017-08-07 8:15 ` Jiri Pirko [this message]
2017-08-07 8:15 ` [patch net-next v2 06/16] mlx5e: push cls_flower and mqprio setup_tc processing into separate functions Jiri Pirko
2017-08-07 8:15 ` [patch net-next v2 07/16] mlx5e_rep: push cls_flower setup_tc processing into a separate function Jiri Pirko
2017-08-07 8:15 ` [patch net-next v2 08/16] mlxsw: spectrum: push cls_flower and cls_matchall setup_tc processing into separate functions Jiri Pirko
2017-08-07 8:15 ` [patch net-next v2 09/16] mlxsw: spectrum: rename cls arg in matchall processing Jiri Pirko
2017-08-07 8:15 ` [patch net-next v2 10/16] dsa: push cls_matchall setup_tc processing into a separate function Jiri Pirko
2017-08-07 8:15 ` [patch net-next v2 11/16] nfp: change flows in apps that offload ndo_setup_tc Jiri Pirko
2017-08-07 8:15 ` [patch net-next v2 12/16] hns3pf: don't check handle during mqprio offload Jiri Pirko
2017-08-07 8:15 ` [patch net-next v2 13/16] net: sched: push cls related args into cls_common structure Jiri Pirko
2017-08-07 8:15 ` [patch net-next v2 14/16] net: sched: move prio into cls_common Jiri Pirko
2017-08-07 8:15 ` [patch net-next v2 15/16] net: sched: change return value of ndo_setup_tc for driver supporting mqprio only Jiri Pirko
2017-08-07 8:15 ` [patch net-next v2 16/16] net: sched: get rid of struct tc_to_netdev Jiri Pirko
2017-08-07 16:43 ` [patch net-next v2 00/16] net: sched: summer cleanup part 2, ndo_setup_tc David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170807081532.32760-6-jiri@resnulli.us \
--to=jiri@resnulli.us \
--cc=alexander.h.duyck@intel.com \
--cc=amritha.nambiar@intel.com \
--cc=andrew@lunn.ch \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dirk.vandermerwe@netronome.com \
--cc=f.fainelli@gmail.com \
--cc=jhs@mojatatu.com \
--cc=mlxsw@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=oss-drivers@netronome.com \
--cc=pieter.jansenvanvuuren@netronome.com \
--cc=salil.mehta@huawei.com \
--cc=simon.horman@netronome.com \
--cc=vivien.didelot@savoirfairelinux.com \
--cc=xiyou.wangcong@gmail.com \
--cc=yisen.zhuang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox