> -----Original Message----- > From: Darrell Ball [mailto:db...@vmware.com] > Sent: Tuesday, September 19, 2017 9:05 AM > To: Fischetti, Antonio <antonio.fische...@intel.com>; d...@openvswitch.org > Subject: Re: [ovs-dev] [PATCH 2/5] conntrack: r/w upper limit value for > connections. > > > > On 9/18/17, 3:22 AM, "ovs-dev-boun...@openvswitch.org on behalf of > antonio.fische...@intel.com" <ovs-dev-boun...@openvswitch.org on behalf of > antonio.fische...@intel.com> wrote: > > Read/Write the upper limit value for connections. > > Example: > # set a new upper limit > ovs-appctl dpctl/ct-set maxconn=1000000 > > # display cur upper limit > ovs-appctl dpctl/ct-get maxconn > > Signed-off-by: Antonio Fischetti <antonio.fische...@intel.com> > --- > lib/conntrack.c | 22 +++++++++++++++++++++- > 1 file changed, 21 insertions(+), 1 deletion(-) > > diff --git a/lib/conntrack.c b/lib/conntrack.c > index 0642cc8..6d86625 100644 > --- a/lib/conntrack.c > +++ b/lib/conntrack.c > @@ -2398,8 +2398,28 @@ conntrack_flush(struct conntrack *ct, const > uint16_t > *zone) > return 0; > } > > +/* Set a new value for the upper limit of connections. */ > +static int > +wr_max_conn(struct conntrack *ct, uint32_t new_val) { > + atomic_init(&ct->n_conn_limit, new_val); > + VLOG_DBG("Set conn upper limit to %d", new_val); > > [Darrell] really needed ?
[Antonio] ok will remove > > + return 0; > +} > + > +/* Read the current upper limit of connections. */ > +static int > +rd_max_conn(struct conntrack *ct, uint32_t *cur_val) { > + atomic_read_relaxed(&ct->n_conn_limit, cur_val); > + return 0; > +} > > [Darrell] I realize you are trying to generalize the function pointer, but I > think > it may be nicer to use different function pointers in these cases ? > Name probably should have ct_ ? [Antonio] ok will add ct_ prefix > > + > +/* List of managed parameters. */ > +#define CT_RW_MAX_CONN "maxconn" > + > /* List of parameters that can be read/written at run-time. */ > -struct ct_wk_params wk_params[] = {}; > +struct ct_wk_params wk_params[] = { > + {CT_RW_MAX_CONN, wr_max_conn, rd_max_conn}, > +}; > > int > conntrack_set_param(struct conntrack *ct, > -- > 2.4.11 > > _______________________________________________ > dev mailing list > d...@openvswitch.org > https://urldefense.proofpoint.com/v2/url?u=https- > 3A__mail.openvswitch.org_mailman_listinfo_ovs- > 2Ddev&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=BVhFA09CGX7JQ5Ih- > uZnsw&m=KK4qOk1HsuyVz- > TJdOC9uBkoCN1hDN4I7UOmuCDr4ps&s=67tSYBejIuWlKYg0rQazrtErrRHWkL42TvEJUfd3iuU&e= > _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev