[PATCH net-next 04/10] net: microchip: sparx5: Use chain ids without offsets when enabling rules

Dan Carpenter error27 at gmail.com
Mon Feb 13 03:05:50 PST 2023


On Mon, Feb 13, 2023 at 10:24:20AM +0100, Steen Hegelund wrote:
> diff --git a/drivers/net/ethernet/microchip/vcap/vcap_api.c b/drivers/net/ethernet/microchip/vcap/vcap_api.c
> index 68e04d47f6fd..9ca0cb855c3c 100644
> --- a/drivers/net/ethernet/microchip/vcap/vcap_api.c
> +++ b/drivers/net/ethernet/microchip/vcap/vcap_api.c
> @@ -1568,6 +1568,18 @@ static int vcap_write_counter(struct vcap_rule_internal *ri,
>  	return 0;
>  }
>  
> +/* Return the chain id rounded down to nearest lookup */
> +static int vcap_round_down_chain(int cid)
> +{
> +	return cid - (cid % VCAP_CID_LOOKUP_SIZE);
> +}
> +
> +/* Return the chain id rounded up to nearest lookup */
> +static int vcap_round_up_chain(int cid)
> +{
> +	return vcap_round_down_chain(cid + VCAP_CID_LOOKUP_SIZE);

Just use the round_up/down() macros.


> +}
> +

regards,
dan carpenter




More information about the linux-arm-kernel mailing list