Subject: Re: [PATCH iproute2-next] ip-xfrm: add pcpu-num support

From: Sabrina Dubroca <[email-masked]>
Date: Tue, 4 Nov 2025 14:27:22 +0100

2025-11-03, 09:47:09 -0700, David Ahern wrote:
> On 10/29/25 5:06 AM, Sabrina Dubroca wrote:
> > The kernel supports passing the XFRMA_SA_PCPU attribute when creating
> > a state (via NEWSA or ALLOCSPI). Add a "pcpu-num" argument, and print
> > XFRMA_SA_PCPU when the kernel provides it.
> > 
> > Signed-off-by: Sabrina Dubroca <[email-masked]>
> > ---
> >  ip/ipxfrm.c        |  6 ++++++
> >  ip/xfrm_state.c    | 20 ++++++++++++++++++--
> >  man/man8/ip-xfrm.8 |  4 ++++
> >  3 files changed, 28 insertions(+), 2 deletions(-)
> > 
> 
> ...
> 
> > @@ -309,6 +309,7 @@ static int xfrm_state_modify(int cmd, unsigned int flags, int argc, char **argv)
> >  	bool is_if_id_set = false;
> >  	__u32 if_id = 0;
> >  	__u32 tfcpad = 0;
> > +	__u32 pcpu_num = -1;
> >  
> >  	while (argc > 0) {
> >  		if (strcmp(*argv, "mode") == 0) {
> 
> ...
> 
> > @@ -797,6 +805,7 @@ static int xfrm_state_allocspi(int argc, char **argv)
> >  	struct xfrm_mark mark = {0, 0};
> >  	struct nlmsghdr *answer;
> >  	__u8 dir = 0;
> > +	__u32 pcpu_num = -1;
> 
> 
> iproute2 follows net-next with reverse xmas tree ordering. I realize
> that is a bit hard for some of the code -- like ipxfrm.c.

Right, it wasn't obvious just looking at those functions in isolation.

> I fixed up these 2 to that ordering at least in the local scope and
> applied to iproute2-next

Thanks!

-- 
Sabrina