Messages in this thread | | | Date | Thu, 3 Aug 2023 19:55:51 +0200 | From | Simon Horman <> | Subject | Re: [RFC PATCH net-next 4/6] net/smc: support max connections per lgr negotiation |
| |
On Thu, Aug 03, 2023 at 09:24:20PM +0800, Guangguan Wang wrote: > Support max connections per lgr negotiation for SMCR v2.1, > which is one of smc v2.1 features. > > Signed-off-by: Guangguan Wang <guangguan.wang@linux.alibaba.com> > Reviewed-by: Tony Lu <tonylu@linux.alibaba.com>
...
Hi Guangguan Wang,
> int smc_clc_cli_v2x_features_validate(struct smc_clc_first_contact_ext *fce, > struct smc_init_info *ini) > { > + struct smc_clc_first_contact_ext_v2x *fce_v2x = > + (struct smc_clc_first_contact_ext_v2x *)fce; > + > if (ini->release_ver < SMC_RELEASE_1) > return 0; > > + if (!ini->is_smcd) { > + if (fce_v2x->max_conns > SMC_CONN_PER_LGR_MAX)
The type of the max_cons field is u8. The value of SMC_CONN_PER_LGR_MAX is 255 (in another patch of this series), the maximum value that the max_cons field can be assigned. So it seems that this condition cannot ever be true.
As flagged by Smatch.
> + return SMC_CLC_DECL_MAXCONNERR; > + ini->max_conns = fce_v2x->max_conns; > + } > + > return 0; > }
...
> diff --git a/net/smc/smc_clc.h b/net/smc/smc_clc.h
...
> @@ -236,7 +238,8 @@ struct smc_clc_first_contact_ext { > > struct smc_clc_first_contact_ext_v2x { > struct smc_clc_first_contact_ext fce_v20; > - u8 reserved3[4]; > + u8 max_conns; /* for SMC-R only */ > + u8 reserved3[3]; > __be32 vendor_exp_options; > u8 reserved4[8]; > } __packed; /* format defined in
...
> diff --git a/net/smc/smc_core.h b/net/smc/smc_core.h > index 1a97fef39127..065369dc6584 100644 > --- a/net/smc/smc_core.h > +++ b/net/smc/smc_core.h > @@ -22,6 +22,7 @@ > #include "smc_ib.h" > > #define SMC_RMBS_PER_LGR_MAX 255 /* max. # of RMBs per link group */ > +#define SMC_CONN_PER_LGR_MAX 255 /* max. # of connections per link group */ > > struct smc_lgr_list { /* list of link group definition */ > struct list_head list;
| |