linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Firo Yang <firo.yang@suse.com>
Cc: marcelo.leitner@gmail.com, vyasevich@gmail.com,
	nhorman@tuxdriver.com, mkubecek@suse.com, davem@davemloft.net,
	edumazet@google.com, pabeni@redhat.com,
	linux-sctp@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, firogm@gmail.com
Subject: Re: [PATCH v2 1/1] sctp: sysctl: make extra pointers netns aware
Date: Tue, 29 Nov 2022 20:48:18 -0800	[thread overview]
Message-ID: <20221129204818.7d8204b4@kernel.org> (raw)
In-Reply-To: <20221125121127.40815-1-firo.yang@suse.com>

On Fri, 25 Nov 2022 20:11:27 +0800 Firo Yang wrote:
> +#define SCTP_RTO_MIN_IDX       1
> +#define SCTP_RTO_MAX_IDX       2
> +#define SCTP_PF_RETRANS_IDX    3
> +#define SCTP_PS_RETRANS_IDX    4

Use these to index the entries, please, like this:

struct bla table[] = {
	[MY_INDEX_ONE] = {
		.whatever = 1,
	},
	[MY_INDEX_TWO] = {
		.fields = 2,
	},
	{
		.there = 3,
	},
	{
		.are = 4,
	},
};

I think that works even without all entries in the table having the
index.. ?

>  static struct ctl_table sctp_net_table[] = {
>  	{
>  		.procname	= "rto_initial",
> @@ -112,6 +122,24 @@ static struct ctl_table sctp_net_table[] = {
>  		.extra1         = &init_net.sctp.rto_min,
>  		.extra2         = &timer_max
>  	},
> +	{
> +		.procname	= "pf_retrans",
> +		.data		= &init_net.sctp.pf_retrans,
> +		.maxlen		= sizeof(int),
> +		.mode		= 0644,
> +		.proc_handler	= proc_dointvec_minmax,
> +		.extra1		= SYSCTL_ZERO,
> +		.extra2		= &init_net.sctp.ps_retrans,
> +	},
> +	{
> +		.procname	= "ps_retrans",
> +		.data		= &init_net.sctp.ps_retrans,
> +		.maxlen		= sizeof(int),
> +		.mode		= 0644,
> +		.proc_handler	= proc_dointvec_minmax,
> +		.extra1		= &init_net.sctp.pf_retrans,
> +		.extra2		= &ps_retrans_max,
> +	},

  parent reply	other threads:[~2022-11-30  4:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-25 12:11 [PATCH v2 1/1] sctp: sysctl: make extra pointers netns aware Firo Yang
2022-11-25 12:22 ` Marcelo Ricardo Leitner
2022-11-30  4:48 ` Jakub Kicinski [this message]
2022-12-01  4:11   ` Firo Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221129204818.7d8204b4@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=firo.yang@suse.com \
    --cc=firogm@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sctp@vger.kernel.org \
    --cc=marcelo.leitner@gmail.com \
    --cc=mkubecek@suse.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=pabeni@redhat.com \
    --cc=vyasevich@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).