[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZxYfLMIahzR9cpMw@gauss3.secunet.de>
Date: Mon, 21 Oct 2024 11:30:20 +0200
From: Steffen Klassert <steffen.klassert@...unet.com>
To: Christian Hopps <chopps@...pps.org>
CC: <devel@...ux-ipsec.org>, <netdev@...r.kernel.org>, Florian Westphal
<fw@...len.de>, Sabrina Dubroca <sd@...asysnail.net>, Simon Horman
<horms@...nel.org>, Antony Antony <antony@...nome.org>, Christian Hopps
<chopps@...n.net>
Subject: Re: [PATCH ipsec-next v12 08/16] xfrm: iptfs: add user packet
(tunnel ingress) handling
On Mon, Oct 07, 2024 at 09:59:20AM -0400, Christian Hopps wrote:
> From: Christian Hopps <chopps@...n.net>
> @@ -77,8 +609,11 @@ static int iptfs_user_init(struct net *net, struct xfrm_state *x,
> {
> struct xfrm_iptfs_data *xtfs = x->mode_data;
> struct xfrm_iptfs_config *xc;
> + u64 q;
>
> xc = &xtfs->cfg;
> + xc->max_queue_size = IPTFS_DEFAULT_MAX_QUEUE_SIZE;
> + xtfs->init_delay_ns = IPTFS_DEFAULT_INIT_DELAY_USECS * NSECS_IN_USEC;
>
> if (attrs[XFRMA_IPTFS_PKT_SIZE]) {
> xc->pkt_size = nla_get_u32(attrs[XFRMA_IPTFS_PKT_SIZE]);
> @@ -92,6 +627,17 @@ static int iptfs_user_init(struct net *net, struct xfrm_state *x,
> return -EINVAL;
> }
> }
> + if (attrs[XFRMA_IPTFS_MAX_QSIZE])
> + xc->max_queue_size = nla_get_u32(attrs[XFRMA_IPTFS_MAX_QSIZE]);
> + if (attrs[XFRMA_IPTFS_INIT_DELAY])
> + xtfs->init_delay_ns =
> + (u64)nla_get_u32(attrs[XFRMA_IPTFS_INIT_DELAY]) *
> + NSECS_IN_USEC;
> +
> + q = (u64)xc->max_queue_size * 95;
> + (void)do_div(q, 100);
This cast is not need.
> + xtfs->ecn_queue_size = (u32)q;
> +
> return 0;
> }
>
> @@ -101,8 +647,11 @@ static unsigned int iptfs_sa_len(const struct xfrm_state *x)
> struct xfrm_iptfs_config *xc = &xtfs->cfg;
> unsigned int l = 0;
>
> - if (x->dir == XFRM_SA_DIR_OUT)
> + if (x->dir == XFRM_SA_DIR_OUT) {
> + l += nla_total_size(sizeof(u32)); /* init delay usec */
> + l += nla_total_size(sizeof(xc->max_queue_size));
> l += nla_total_size(sizeof(xc->pkt_size));
> + }
>
> return l;
> }
> @@ -112,9 +661,22 @@ static int iptfs_copy_to_user(struct xfrm_state *x, struct sk_buff *skb)
> struct xfrm_iptfs_data *xtfs = x->mode_data;
> struct xfrm_iptfs_config *xc = &xtfs->cfg;
> int ret = 0;
> + u64 q;
> +
> + if (x->dir == XFRM_SA_DIR_OUT) {
> + q = xtfs->init_delay_ns;
> + (void)do_div(q, NSECS_IN_USEC);
Same here.
Powered by blists - more mailing lists