RE: [PATCH 1/1] tty: n_gsm: make n_gsm line number configurable

From: Starke, Daniel
Date: Thu Oct 13 2022 - 07:09:23 EST


> > Currently, the n_gsm line number and its derived virtual ttys are
> > assigned in the order of allocations with no means to change this.
>
> Which is fine, why do you need this to be changed? What relies on specific
> line numbers in userspace that can not handle things correctly with the
> normal userspace tools we have for this type of thing?
>
> > Introduce additional ioctl parameters numValid and num to configure
> > the line number to allow predictable virtual tty allocation and numbering.
> > Especially when using multiple n_gsm instances at the same time.
>
> Ick, please no. That should never be needed, the kernel number and name
> can be anything random (and people have suggested that we do make them
> random at times). Don't hard-code numbers in your userspace tools, that
> is just wrong.

Thank you for your feedback and review. I understand your points.
Please discard this patch.

> > --- a/include/uapi/linux/gsmmux.h
> > +++ b/include/uapi/linux/gsmmux.h
> > @@ -19,7 +19,9 @@ struct gsm_config
> > unsigned int mtu;
> > unsigned int k;
> > unsigned int i;
> > - unsigned int unused[8]; /* Padding for expansion without
> > + unsigned short numValid;
> > + unsigned short num;
>
> This would never work anyway (hint "short" is not a valid uapi data
> type...)

I am surprised about this as gsm_netconfig already uses unsigned short.

Best regards,
Daniel Starke