Re: [PATCH 06/15 net-next,v2] net: sched: add tcf_setup_block_offload()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri,  5 Jul 2019 01:48:34 +0200, Pablo Neira Ayuso wrote:
> Most drivers do the same thing to set up the block, add a helper
> function to do this.
> 
> Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>

> diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
> index 534a545ea51e..003f24a1323f 100644
> --- a/net/sched/cls_api.c
> +++ b/net/sched/cls_api.c
> @@ -922,6 +922,26 @@ static int tcf_block_setup(struct tcf_block *block, struct tc_block_offload *bo)
>  	return err;
>  }
>  
> +int tcf_setup_block_offload(struct tc_block_offload *f, tc_setup_cb_t *cb,
> +			    void *cb_ident, void *cb_priv, bool ingress_only)
> +{
> +	if (ingress_only &&
> +	    f->binder_type != TCF_BLOCK_BINDER_TYPE_CLSACT_INGRESS)
> +		return -EOPNOTSUPP;
> +
> +	switch (f->command) {
> +	case TC_BLOCK_BIND:
> +		return tcf_block_cb_register(f->block, cb, cb_ident, cb_priv,
> +					     f->extack);
> +	case TC_BLOCK_UNBIND:
> +		tcf_block_cb_unregister(f->block, cb, cb_ident);
> +		return 0;
> +	default:
> +		return -EOPNOTSUPP;
> +	}
> +}
> +EXPORT_SYMBOL(tcf_setup_block_offload);
> +
>  static struct rhashtable indr_setup_block_ht;
>  
>  struct tc_indr_block_dev {

This change is pretty much unrelated to the rest of the series, isn't
it?  Can you please post it separately and make the series smaller
this way?

Perhaps tcf_setup_block_offload_simple() would be a good name for this
helper?



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux