Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 244cd96a authored by Cong Wang's avatar Cong Wang Committed by David S. Miller
Browse files

net_sched: remove list_head from tc_action



After commit 90b73b77, list_head is no longer needed.
Now we just need to convert the list iteration to array
iteration for drivers.

Fixes: 90b73b77 ("net: sched: change action API to use array of pointers to actions")
Cc: Jiri Pirko <jiri@mellanox.com>
Cc: Vlad Buslov <vladbu@mellanox.com>
Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7d485c45
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -110,16 +110,14 @@ static int bnxt_tc_parse_actions(struct bnxt *bp,
				 struct tcf_exts *tc_exts)
{
	const struct tc_action *tc_act;
	LIST_HEAD(tc_actions);
	int rc;
	int i, rc;

	if (!tcf_exts_has_actions(tc_exts)) {
		netdev_info(bp->dev, "no actions");
		return -EINVAL;
	}

	tcf_exts_to_list(tc_exts, &tc_actions);
	list_for_each_entry(tc_act, &tc_actions, list) {
	tcf_exts_for_each_action(i, tc_act, tc_exts) {
		/* Drop action */
		if (is_tcf_gact_shot(tc_act)) {
			actions->flags |= BNXT_TC_ACTION_FLAG_DROP;
+4 −6
Original line number Diff line number Diff line
@@ -417,10 +417,9 @@ static void cxgb4_process_flow_actions(struct net_device *in,
				       struct ch_filter_specification *fs)
{
	const struct tc_action *a;
	LIST_HEAD(actions);
	int i;

	tcf_exts_to_list(cls->exts, &actions);
	list_for_each_entry(a, &actions, list) {
	tcf_exts_for_each_action(i, a, cls->exts) {
		if (is_tcf_gact_ok(a)) {
			fs->action = FILTER_PASS;
		} else if (is_tcf_gact_shot(a)) {
@@ -591,10 +590,9 @@ static int cxgb4_validate_flow_actions(struct net_device *dev,
	bool act_redir = false;
	bool act_pedit = false;
	bool act_vlan = false;
	LIST_HEAD(actions);
	int i;

	tcf_exts_to_list(cls->exts, &actions);
	list_for_each_entry(a, &actions, list) {
	tcf_exts_for_each_action(i, a, cls->exts) {
		if (is_tcf_gact_ok(a)) {
			/* Do nothing */
		} else if (is_tcf_gact_shot(a)) {
+2 −3
Original line number Diff line number Diff line
@@ -93,14 +93,13 @@ static int fill_action_fields(struct adapter *adap,
	unsigned int num_actions = 0;
	const struct tc_action *a;
	struct tcf_exts *exts;
	LIST_HEAD(actions);
	int i;

	exts = cls->knode.exts;
	if (!tcf_exts_has_actions(exts))
		return -EINVAL;

	tcf_exts_to_list(exts, &actions);
	list_for_each_entry(a, &actions, list) {
	tcf_exts_for_each_action(i, a, exts) {
		/* Don't allow more than one action per rule. */
		if (num_actions)
			return -EINVAL;
+2 −4
Original line number Diff line number Diff line
@@ -9171,14 +9171,12 @@ static int parse_tc_actions(struct ixgbe_adapter *adapter,
			    struct tcf_exts *exts, u64 *action, u8 *queue)
{
	const struct tc_action *a;
	LIST_HEAD(actions);
	int i;

	if (!tcf_exts_has_actions(exts))
		return -EINVAL;

	tcf_exts_to_list(exts, &actions);
	list_for_each_entry(a, &actions, list) {

	tcf_exts_for_each_action(i, a, exts) {
		/* Drop action */
		if (is_tcf_gact_shot(a)) {
			*action = IXGBE_FDIR_DROP_QUEUE;
+9 −10
Original line number Diff line number Diff line
@@ -1982,14 +1982,15 @@ static bool modify_header_match_supported(struct mlx5_flow_spec *spec,
		goto out_ok;

	modify_ip_header = false;
	tcf_exts_to_list(exts, &actions);
	list_for_each_entry(a, &actions, list) {
	tcf_exts_for_each_action(i, a, exts) {
		int k;

		if (!is_tcf_pedit(a))
			continue;

		nkeys = tcf_pedit_nkeys(a);
		for (i = 0; i < nkeys; i++) {
			htype = tcf_pedit_htype(a, i);
		for (k = 0; k < nkeys; k++) {
			htype = tcf_pedit_htype(a, k);
			if (htype == TCA_PEDIT_KEY_EX_HDR_TYPE_IP4 ||
			    htype == TCA_PEDIT_KEY_EX_HDR_TYPE_IP6) {
				modify_ip_header = true;
@@ -2053,15 +2054,14 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
	const struct tc_action *a;
	LIST_HEAD(actions);
	u32 action = 0;
	int err;
	int err, i;

	if (!tcf_exts_has_actions(exts))
		return -EINVAL;

	attr->flow_tag = MLX5_FS_DEFAULT_FLOW_TAG;

	tcf_exts_to_list(exts, &actions);
	list_for_each_entry(a, &actions, list) {
	tcf_exts_for_each_action(i, a, exts) {
		if (is_tcf_gact_shot(a)) {
			action |= MLX5_FLOW_CONTEXT_ACTION_DROP;
			if (MLX5_CAP_FLOWTABLE(priv->mdev,
@@ -2666,7 +2666,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
	LIST_HEAD(actions);
	bool encap = false;
	u32 action = 0;
	int err;
	int err, i;

	if (!tcf_exts_has_actions(exts))
		return -EINVAL;
@@ -2674,8 +2674,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
	attr->in_rep = rpriv->rep;
	attr->in_mdev = priv->mdev;

	tcf_exts_to_list(exts, &actions);
	list_for_each_entry(a, &actions, list) {
	tcf_exts_for_each_action(i, a, exts) {
		if (is_tcf_gact_shot(a)) {
			action |= MLX5_FLOW_CONTEXT_ACTION_DROP |
				  MLX5_FLOW_CONTEXT_ACTION_COUNT;
Loading