mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	net: sched: cls_u32: no need to call tcf_exts_change for newly allocated struct
As the n struct was allocated right before u32_set_parms call, no need to use tcf_exts_change to do atomic change, and we can just fill-up the unused exts struct directly by tcf_exts_validate. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									8c98d571bb
								
							
						
					
					
						commit
						705c709126
					
				
					 1 changed files with 4 additions and 14 deletions
				
			
		| 
						 | 
					@ -723,29 +723,24 @@ static int u32_set_parms(struct net *net, struct tcf_proto *tp,
 | 
				
			||||||
			 struct tc_u_knode *n, struct nlattr **tb,
 | 
								 struct tc_u_knode *n, struct nlattr **tb,
 | 
				
			||||||
			 struct nlattr *est, bool ovr)
 | 
								 struct nlattr *est, bool ovr)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct tcf_exts e;
 | 
					 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = tcf_exts_init(&e, TCA_U32_ACT, TCA_U32_POLICE);
 | 
						err = tcf_exts_validate(net, tp, tb, est, &n->exts, ovr);
 | 
				
			||||||
	if (err < 0)
 | 
						if (err < 0)
 | 
				
			||||||
		return err;
 | 
							return err;
 | 
				
			||||||
	err = tcf_exts_validate(net, tp, tb, est, &e, ovr);
 | 
					 | 
				
			||||||
	if (err < 0)
 | 
					 | 
				
			||||||
		goto errout;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = -EINVAL;
 | 
					 | 
				
			||||||
	if (tb[TCA_U32_LINK]) {
 | 
						if (tb[TCA_U32_LINK]) {
 | 
				
			||||||
		u32 handle = nla_get_u32(tb[TCA_U32_LINK]);
 | 
							u32 handle = nla_get_u32(tb[TCA_U32_LINK]);
 | 
				
			||||||
		struct tc_u_hnode *ht_down = NULL, *ht_old;
 | 
							struct tc_u_hnode *ht_down = NULL, *ht_old;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (TC_U32_KEY(handle))
 | 
							if (TC_U32_KEY(handle))
 | 
				
			||||||
			goto errout;
 | 
								return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (handle) {
 | 
							if (handle) {
 | 
				
			||||||
			ht_down = u32_lookup_ht(ht->tp_c, handle);
 | 
								ht_down = u32_lookup_ht(ht->tp_c, handle);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (ht_down == NULL)
 | 
								if (ht_down == NULL)
 | 
				
			||||||
				goto errout;
 | 
									return -EINVAL;
 | 
				
			||||||
			ht_down->refcnt++;
 | 
								ht_down->refcnt++;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -765,16 +760,11 @@ static int u32_set_parms(struct net *net, struct tcf_proto *tp,
 | 
				
			||||||
		int ret;
 | 
							int ret;
 | 
				
			||||||
		ret = tcf_change_indev(net, tb[TCA_U32_INDEV]);
 | 
							ret = tcf_change_indev(net, tb[TCA_U32_INDEV]);
 | 
				
			||||||
		if (ret < 0)
 | 
							if (ret < 0)
 | 
				
			||||||
			goto errout;
 | 
								return -EINVAL;
 | 
				
			||||||
		n->ifindex = ret;
 | 
							n->ifindex = ret;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	tcf_exts_change(tp, &n->exts, &e);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
errout:
 | 
					 | 
				
			||||||
	tcf_exts_destroy(&e);
 | 
					 | 
				
			||||||
	return err;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void u32_replace_knode(struct tcf_proto *tp, struct tc_u_common *tp_c,
 | 
					static void u32_replace_knode(struct tcf_proto *tp, struct tc_u_common *tp_c,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue