public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: "D. Starke" <daniel.starke@siemens.com>
Cc: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org,
	jirislaby@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] tty: n_gsm: add parameters used with parameter negotiation
Date: Fri, 21 Oct 2022 12:53:32 +0300 (EEST)	[thread overview]
Message-ID: <4519259-1e70-351c-756c-57c1e665e94@linux.intel.com> (raw)
In-Reply-To: <20221021084315.2306-2-daniel.starke@siemens.com>

On Fri, 21 Oct 2022, D. Starke wrote:

> From: Daniel Starke <daniel.starke@siemens.com>
> 
> n_gsm is based on the 3GPP 07.010 and its newer version is the 3GPP 27.010.
> See https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1516
> The changes from 07.010 to 27.010 are non-functional. Therefore, I refer to
> the newer 27.010 here. Chapter 5.4.6.3.1 describes the encoding of the
> parameter negotiation messages.
> 
> Add the parameters used there to 'gsm_mux' and 'gsm_dlci' and initialize both
> according to the value ranges and recommended defaults defined in chapter 5.7.
> 
> Replace the use of the DLC default values from the 'gsm_mux' fields with the DLC
> specific values from the 'gsm_dlci' fields where applicable.
> 
> Signed-off-by: Daniel Starke <daniel.starke@siemens.com>
> ---

> @@ -2075,6 +2085,13 @@ static struct gsm_dlci *gsm_dlci_alloc(struct gsm_mux *gsm, int addr)
>  	dlci->gsm = gsm;
>  	dlci->addr = addr;
>  	dlci->adaption = gsm->adaption;
> +	dlci->mtu = gsm->mtu;
> +	if (addr == 0)
> +		dlci->prio = 0;
> +	else
> +		dlci->prio = ((((addr / 8) + 1) * 8) - 1);

Is this doing roundup(addr, 8) - 1 (in linux/math.h)?

> +	dlci->ftype = gsm->ftype;
> +	dlci->k = gsm->k;
>  	dlci->state = DLCI_CLOSED;
>  	if (addr) {
>  		dlci->data = gsm_dlci_data;
> @@ -2650,7 +2667,9 @@ static struct gsm_mux *gsm_alloc_mux(void)
>  
>  	gsm->t1 = T1;
>  	gsm->t2 = T2;
> +	gsm->t3 = T3;
>  	gsm->n2 = N2;
> +	gsm->k = K;
>  	gsm->ftype = UIH;
>  	gsm->adaption = 1;
>  	gsm->encoding = GSM_ADV_OPT;
> @@ -2691,7 +2710,7 @@ static void gsm_copy_config_values(struct gsm_mux *gsm,
>  	c->initiator = gsm->initiator;
>  	c->t1 = gsm->t1;
>  	c->t2 = gsm->t2;
> -	c->t3 = 0;	/* Not supported */
> +	c->t3 = gsm->t3;
>  	c->n2 = gsm->n2;
>  	if (gsm->ftype == UIH)
>  		c->i = 1;
> @@ -2700,7 +2719,7 @@ static void gsm_copy_config_values(struct gsm_mux *gsm,
>  	pr_debug("Ftype %d i %d\n", gsm->ftype, c->i);
>  	c->mru = gsm->mru;
>  	c->mtu = gsm->mtu;
> -	c->k = 0;
> +	c->k = gsm->k;
>  }
>  
>  static int gsm_config(struct gsm_mux *gsm, struct gsm_config *c)
> @@ -2717,12 +2736,16 @@ static int gsm_config(struct gsm_mux *gsm, struct gsm_config *c)
>  		return -EINVAL;
>  	if (c->mru > MAX_MRU || c->mtu > MAX_MTU)
>  		return -EINVAL;
> +	if (c->t3 > 255)
> +		return -EINVAL;
>  	if (c->n2 > 255)
>  		return -EINVAL;
>  	if (c->encapsulation > 1)	/* Basic, advanced, no I */
>  		return -EINVAL;
>  	if (c->initiator > 1)
>  		return -EINVAL;
> +	if (c->k > 7)

Please don't add non-obvious literal such as this. Is this xx_MAX_WINDOW 
or something along those lines?

-- 
 i.


  reply	other threads:[~2022-10-21  9:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-21  8:43 [PATCH 1/3] tty: n_gsm: introduce macro for minimal unit size D. Starke
2022-10-21  8:43 ` [PATCH 2/3] tty: n_gsm: add parameters used with parameter negotiation D. Starke
2022-10-21  9:53   ` Ilpo Järvinen [this message]
2022-10-21  8:43 ` [PATCH 3/3] tty: n_gsm: add parameter negotiation support D. Starke
2022-10-21 10:09   ` Ilpo Järvinen
2022-10-21  9:40 ` [PATCH 1/3] tty: n_gsm: introduce macro for minimal unit size Ilpo Järvinen

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=4519259-1e70-351c-756c-57c1e665e94@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=daniel.starke@siemens.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /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