[Patch]: Nokia: make hopping a user changeable parameter

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Holger Hans Peter Freyther holger at freyther.de
Sun Feb 8 08:43:39 UTC 2015


On Sat, Feb 07, 2015 at 06:33:30PM +0100, Sipos Csaba wrote:
> Dear Holger,

Hi!

> It builds against the latest version of OpenBSC master.

what is preferred is if you could already make a git commit
and then use git send-email/git format-patch. Then I don't
have to come up with a commit message. :)

> -				wait_reset:1;
> +				wait_reset:1,
> +				hopping_type:1;

What is the reasoning for the bitfield here? Do we want to
save memory? Is it a packed structure on the network? I think
I raised a point like this with the previous commit.

> +		vty_out(vty, "  nokia_site hopping-type %d%s", bts->nokia.hopping_type, VTY_NEWLINE);

In more recent times I prefer to go with string names instead
of 0/1. E.g "hopping", "synthesizer".

> +DEFUN(cfg_bts_nokia_site_hopping_type,
> +      cfg_bts_nokia_site_hopping_type_cmd,
> +      "nokia_site hopping-type (0|1)",
> +      NOKIA_STR
> +      "Set the hopping type. 0=Baseband hopping, 1=Synthesizer (RF) hopping\n")

This is likely to cause a failure with the python end to end
test. For the above command you need to write documentation
for "nokia_site" "hopping-type" "0" "1". This means the help
string needs to have four topics that end with a \n. I think
the documentation for "0" and "1" is missing.

>  	memcpy(fu_config + len, bts_config_2, sizeof(bts_config_2));
>  	/* set hopping mode (Baseband and RF hopping work for the MetroSite) */
> -	if (need_hopping)
> -		fu_config[len + 2 + 1] = 1;	/* 0: no hopping, 1: Baseband hopping, 2: RF hopping */
> +	if (need_hopping) {
> +		if(hopping_type != 1){
> +			LOGP(DNM, LOGL_NOTICE, "Baseband hopping selected!\n");
> +			fu_config[len + 2 + 1] = 1;	/* 0: no hopping, 1: Baseband hopping, 2: RF hopping */
> +		}
> +		else
> +		{
> +			LOGP(DNM, LOGL_NOTICE, "Synthesizer (RF) hopping selected!\n");
> +			fu_config[len + 2 + 1] = 2;	/* 0: no hopping, 1: Baseband hopping, 2: RF hopping */
> +		}
> +	}


Maybe use an enum to represent the two hopping options. This
way you can put the semantic/description into the enum and
don't need to write it twice. If you go with names for configuring
you can even directly map the values of the enum to "1" and "2"
which will allow you to remove the branch.

For all of this please have a look at the value_string struct
and how we go from string to number and number to string.




More information about the OpenBSC mailing list