Message ID | 20210608040241.10658-8-ryazanov.s.a@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 72eedfc4bbc7480ea8fb38d5aebb57eafc03c8d5 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: WWAN subsystem improvements | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Guessed tree name to be net-next |
netdev/subject_prefix | warning | Target tree name not specified in the subject |
netdev/cc_maintainers | warning | 1 maintainers not CCed: leon@kernel.org |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | warning | CHECK: Prefer using the BIT macro |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
On Tue, 8 Jun 2021 at 06:02, Sergey Ryazanov <ryazanov.s.a@gmail.com> wrote: > > Currently, we limit the total ports number to 256. It is quite common > for PBX or SMS gateway to be equipped with a lot of modems. In now days, > a modem could have 2-4 control ports or even more, what only accelerates > the ports exhausing rate. > > To avoid facing the port number limitation issue reports, increase the > limit up the maximum number of minors (i.e. up to 1 << MINORBITS). > > Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com> Reviewed-by: Loic Poulain <loic.poulain@linaro.org>
diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c index 2844b17a724c..9346b2661eb3 100644 --- a/drivers/net/wwan/wwan_core.c +++ b/drivers/net/wwan/wwan_core.c @@ -14,7 +14,8 @@ #include <linux/types.h> #include <linux/wwan.h> -#define WWAN_MAX_MINORS 256 /* 256 minors allowed with register_chrdev() */ +/* Maximum number of minors in use */ +#define WWAN_MAX_MINORS (1 << MINORBITS) static DEFINE_MUTEX(wwan_register_lock); /* WWAN device create|remove lock */ static DEFINE_IDA(minors); /* minors for WWAN port chardevs */ @@ -634,7 +635,8 @@ static int __init wwan_init(void) return PTR_ERR(wwan_class); /* chrdev used for wwan ports */ - wwan_major = register_chrdev(0, "wwan_port", &wwan_port_fops); + wwan_major = __register_chrdev(0, 0, WWAN_MAX_MINORS, "wwan_port", + &wwan_port_fops); if (wwan_major < 0) { class_destroy(wwan_class); return wwan_major; @@ -645,7 +647,7 @@ static int __init wwan_init(void) static void __exit wwan_exit(void) { - unregister_chrdev(wwan_major, "wwan_port"); + __unregister_chrdev(wwan_major, 0, WWAN_MAX_MINORS, "wwan_port"); class_destroy(wwan_class); }
Currently, we limit the total ports number to 256. It is quite common for PBX or SMS gateway to be equipped with a lot of modems. In now days, a modem could have 2-4 control ports or even more, what only accelerates the ports exhausing rate. To avoid facing the port number limitation issue reports, increase the limit up the maximum number of minors (i.e. up to 1 << MINORBITS). Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com> --- drivers/net/wwan/wwan_core.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)