Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tty: n_gsm: Don't block input queue by waiting MSC

Currently gsm_queue() processes incoming frames and when opening
a DLC channel it calls gsm_dlci_open() which calls gsm_modem_update().
If basic mode is used it calls gsm_modem_upd_via_msc() and it
cannot block the input queue by waiting the response to come
into the same input queue.

Instead allow sending Modem Status Command without waiting for remote
end to respond. Define a new function gsm_modem_send_initial_msc()
for this purpose. As MSC is only valid for basic encoding, it does
not do anything for advanced or when convergence layer type 2 is used.

Fixes: 48473802506d ("tty: n_gsm: fix missing update of modem controls after DLCI open")
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Link: https://lore.kernel.org/r/20250827123221.1148666-1-seppo.takalo@nordicsemi.no
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Seppo Takalo and committed by
Greg Kroah-Hartman
3cf0b3c2 94fcae6c

+24 -1
+24 -1
drivers/tty/n_gsm.c
··· 461 461 static struct gsm_dlci *gsm_dlci_alloc(struct gsm_mux *gsm, int addr); 462 462 static void gsmld_write_trigger(struct gsm_mux *gsm); 463 463 static void gsmld_write_task(struct work_struct *work); 464 + static int gsm_modem_send_initial_msc(struct gsm_dlci *dlci); 464 465 465 466 /** 466 467 * gsm_fcs_add - update FCS ··· 2175 2174 pr_debug("DLCI %d goes open.\n", dlci->addr); 2176 2175 /* Send current modem state */ 2177 2176 if (dlci->addr) { 2178 - gsm_modem_update(dlci, 0); 2177 + gsm_modem_send_initial_msc(dlci); 2179 2178 } else { 2180 2179 /* Start keep-alive control */ 2181 2180 gsm->ka_num = 0; ··· 4160 4159 if (ctrl == NULL) 4161 4160 return -ENOMEM; 4162 4161 return gsm_control_wait(dlci->gsm, ctrl); 4162 + } 4163 + 4164 + /** 4165 + * gsm_modem_send_initial_msc - Send initial modem status message 4166 + * 4167 + * @dlci channel 4168 + * 4169 + * Send an initial MSC message after DLCI open to set the initial 4170 + * modem status lines. This is only done for basic mode. 4171 + * Does not wait for a response as we cannot block the input queue 4172 + * processing. 4173 + */ 4174 + static int gsm_modem_send_initial_msc(struct gsm_dlci *dlci) 4175 + { 4176 + u8 modembits[2]; 4177 + 4178 + if (dlci->adaption != 1 || dlci->gsm->encoding != GSM_BASIC_OPT) 4179 + return 0; 4180 + 4181 + modembits[0] = (dlci->addr << 2) | 2 | EA; /* DLCI, Valid, EA */ 4182 + modembits[1] = (gsm_encode_modem(dlci) << 1) | EA; 4183 + return gsm_control_command(dlci->gsm, CMD_MSC, (const u8 *)&modembits, 2); 4163 4184 } 4164 4185 4165 4186 /**