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.
Unified · Split
| @@ -2532,6 +2532,8 @@ static int gsm_dlci_config(struct gsm_dlci *dlci, struct gsm_dlci_config *dc, in · 2531 unmodified lines | |||
| 2532 | return -EINVAL; | 2532 | return -EINVAL; |
| 2533 | if (dc->k > 7) | 2533 | if (dc->k > 7) |
| 2534 | return -EINVAL; | 2534 | return -EINVAL; |
| 2535 | if (dc->flags & ~GSM_FL_RESTART) /* allow future extensions */ | ||
| 2536 | return -EINVAL; | ||
| 2535 | 2537 | ||
| 2536 | /* | 2538 | /* |
| 2537 | * See what is needed for reconfiguration | 2539 | * 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 | |||
| 2546 | /* Requires care */ | 2548 | /* Requires care */ |
| 2547 | if (dc->priority != dlci->prio) | 2549 | if (dc->priority != dlci->prio) |
| 2548 | need_restart = true; | 2550 | need_restart = true; |
| 2551 | if (dc->flags & GSM_FL_RESTART) | ||
| 2552 | need_restart = true; | ||
| 2549 | 2553 | ||
| 2550 | if ((open && gsm->wait_config) || need_restart) | 2554 | if ((open && gsm->wait_config) || need_restart) |
| 2551 | need_open = true; | 2555 | need_open = true; |
| @@ -2,10 +2,22 @@ · 1 unmodified line | |||
| 2 | #ifndef _LINUX_GSMMUX_H | 2 | #ifndef _LINUX_GSMMUX_H |
| 3 | #define _LINUX_GSMMUX_H | 3 | #define _LINUX_GSMMUX_H |
| 4 | 4 | ||
| 5 | #include <linux/const.h> | ||
| 5 | #include <linux/if.h> | 6 | #include <linux/if.h> |
| 6 | #include <linux/ioctl.h> | 7 | #include <linux/ioctl.h> |
| 7 | #include <linux/types.h> | 8 | #include <linux/types.h> |
| 8 | 9 | ||
| 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 | |||
| 9 | struct gsm_config | 21 | struct gsm_config |
| 10 | { | 22 | { |
| 11 | unsigned int adaption; | 23 | unsigned int adaption; |
| @@ -58,7 +70,8 @@ struct gsm_dlci_config { · 46 unmodified lines | |||
| 58 | __u32 priority; /* Priority (0 for default value) */ | 70 | __u32 priority; /* Priority (0 for default value) */ |
| 59 | __u32 i; /* Frame type (1 = UIH, 2 = UI) */ | 71 | __u32 i; /* Frame type (1 = UIH, 2 = UI) */ |
| 60 | __u32 k; /* Window size (0 for default value) */ | 72 | __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 */ | ||
| 62 | }; | 75 | }; |
| 63 | 76 | ||
| 64 | #define GSMIOC_GETCONF_DLCI _IOWR('G', 7, struct gsm_dlci_config) | 77 | #define GSMIOC_GETCONF_DLCI _IOWR('G', 7, struct gsm_dlci_config) |