History

tty: n_gsm: add restart flag to DLC specific ioctl config

Currently, changing the parameters of a DLCI gives no direct control to the user whether this should trigger a channel reset or not. The decision is solely made by the driver based on the assumption which parameter changes are compatible or not. Therefore, the user has no means to perform an automatic channel reset after parameter configuration for non-conflicting changes. Add the parameter 'flags' to 'gsm_dlci_config' to force a channel reset after ioctl setting regardless of whether the changes made require this or not by setting this to 'GSM_FL_RESTART'. Note that 'GSM_FL_RESTART' is currently the only allow flag to allow additions here.

Daniel Starke committed 3 years ago

Commit a031c771 parent 54b45ee2 files · +18 −1Browse files

Unified · Split

2 files
  1. drivers/tty/n_gsm.c +4 −0
  2. include/uapi/linux/gsmmux.h +14 −1
drivers/tty/n_gsm.c+4−0
@@ -2532,6 +2532,8 @@ static int gsm_dlci_config(struct gsm_dlci *dlci, struct gsm_dlci_config *dc, in · 2531 unmodified lines
25322532 return -EINVAL;
25332533 if (dc->k > 7)
25342534 return -EINVAL;
2535+ if (dc->flags & ~GSM_FL_RESTART) /* allow future extensions */
2536+ return -EINVAL;
25352537
25362538 /*
25372539 * See what is needed for reconfiguration
@@ -2546,6 +2548,8 @@ static int gsm_dlci_config(struct gsm_dlci *dlci, struct gsm_dlci_config *dc, in · 8 unmodified lines
25462548 /* Requires care */
25472549 if (dc->priority != dlci->prio)
25482550 need_restart = true;
2551+ if (dc->flags & GSM_FL_RESTART)
2552+ need_restart = true;
25492553
25502554 if ((open && gsm->wait_config) || need_restart)
25512555 need_open = true;
include/uapi/linux/gsmmux.h+14−1
@@ -2,10 +2,22 @@ · 1 unmodified line
22 #ifndef _LINUX_GSMMUX_H
33 #define _LINUX_GSMMUX_H
44
5+#include <linux/const.h>
56 #include <linux/if.h>
67 #include <linux/ioctl.h>
78 #include <linux/types.h>
89
10+/*
11+ * flags definition for n_gsm
12+ *
13+ * Used by:
14+ * struct gsm_dlci_config.flags
15+ */
16+/* Forces a DLCI reset if set. Otherwise, a DLCI reset is only done if
17+ * incompatible settings were provided. Always cleared on retrieval.
18+ */
19+#define GSM_FL_RESTART _BITUL(0)
20+
921 struct gsm_config
1022 {
1123 unsigned int adaption;
@@ -58,7 +70,8 @@ struct gsm_dlci_config { · 46 unmodified lines
5870 __u32 priority; /* Priority (0 for default value) */
5971 __u32 i; /* Frame type (1 = UIH, 2 = UI) */
6072 __u32 k; /* Window size (0 for default value) */
61− __u32 reserved[8]; /* For future use, must be initialized to zero */
73+ __u32 flags; /* DLCI specific flags. */
74+ __u32 reserved[7]; /* For future use, must be initialized to zero */
6275 };
6376
6477 #define GSMIOC_GETCONF_DLCI _IOWR('G', 7, struct gsm_dlci_config)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t