Re: [PATCH v2] net: dsa: drop some VLAs in switch.c

2018-05-08 Thread Salvatore Mesoraca
2018-05-08 11:39 GMT+02:00 David Laight <david.lai...@aculab.com>: > From: Salvatore Mesoraca >> Sent: 07 May 2018 20:03 > ... >> This optimization will save us an allocation when number of ports is >> less than 32 or 64 (depending on arch). >> IMHO it's use

Re: [PATCH v2] net: dsa: drop some VLAs in switch.c

2018-05-08 Thread Salvatore Mesoraca
2018-05-07 21:26 GMT+02:00 Andrew Lunn : >> >> +++ b/include/net/dsa.h >> >> @@ -256,6 +256,9 @@ struct dsa_switch { >> >> /* Number of switch port queues */ >> >> unsigned intnum_tx_queues; >> >> >> >> + unsigned long *bitmap; >> >> +

Re: [PATCH v2] net: dsa: drop some VLAs in switch.c

2018-05-07 Thread Salvatore Mesoraca
2018-05-07 20:14 GMT+02:00 Florian Fainelli <f.faine...@gmail.com>: > On 05/07/2018 08:23 AM, Salvatore Mesoraca wrote: >> We avoid 2 VLAs by using a pre-allocated field in dsa_switch. >> We also try to avoid dynamic allocation whenever possible. >> >> Link: >&

[PATCH v2] net: dsa: drop some VLAs in switch.c

2018-05-07 Thread Salvatore Mesoraca
-by: Salvatore Mesoraca <s.mesorac...@gmail.com> --- include/net/dsa.h | 3 +++ net/dsa/dsa2.c| 14 ++ net/dsa/switch.c | 22 ++ 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/include/net/dsa.h b/include/net/dsa.h index 60fb4ec..576791d

Re: [PATCH] net: dsa: drop some VLAs in switch.c

2018-05-05 Thread Salvatore Mesoraca
2018-03-13 21:06 GMT+01:00 Florian Fainelli <f.faine...@gmail.com>: > On 03/13/2018 12:58 PM, Vivien Didelot wrote: >> Hi Salvatore, >> >> Salvatore Mesoraca <s.mesorac...@gmail.com> writes: >> >>> dsa_switch's num_ports is currently fixed to D

Re: [PATCH] net: dsa: drop some VLAs in switch.c

2018-03-18 Thread Salvatore Mesoraca
2018-03-14 13:48 GMT+01:00 Salvatore Mesoraca <s.mesorac...@gmail.com>: > 2018-03-14 12:24 GMT+01:00 David Laight <david.lai...@aculab.com>: >> Isn't using DECLARE_BITMAP() completely OTT when the maximum size is less >> than the number of bits in a word? > > It al

Re: [PATCH] net: dsa: drop some VLAs in switch.c

2018-03-14 Thread Salvatore Mesoraca
2018-03-14 12:24 GMT+01:00 David Laight : > Isn't using DECLARE_BITMAP() completely OTT when the maximum size is less > than the number of bits in a word? It allocates ceiling(size/8) "unsigned long"s, so yes.

Re: [PATCH] net: dsa: drop some VLAs in switch.c

2018-03-13 Thread Salvatore Mesoraca
2018-03-13 20:58 GMT+01:00 Vivien Didelot <vivien.dide...@savoirfairelinux.com>: > Hi Salvatore, Hi Vivien, > Salvatore Mesoraca <s.mesorac...@gmail.com> writes: > >> dsa_switch's num_ports is currently fixed to DSA_MAX_PORTS. So we avoid >> 2 VLAs[1] by

[PATCH] net: dsa: drop some VLAs in switch.c

2018-03-13 Thread Salvatore Mesoraca
dsa_switch's num_ports is currently fixed to DSA_MAX_PORTS. So we avoid 2 VLAs[1] by using DSA_MAX_PORTS instead of ds->num_ports. [1] https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Salvatore Mesoraca <s.mesorac...@gmail.com> --- net/dsa/switch.c | 4 ++-- 1 file changed, 2 inserti

Re: [PATCH] net: llc: drop VLA in llc_sap_mcast()

2018-03-12 Thread Salvatore Mesoraca
2018-03-12 16:14 GMT+01:00 David Miller <da...@davemloft.net>: > From: Salvatore Mesoraca <s.mesorac...@gmail.com> > Date: Sun, 11 Mar 2018 22:12:04 +0100 > >> Avoid a VLA[1] by using a real constant expression instead of a variable. >> The compiler should be a

Re: [PATCH 1/2] net: rds: drop VLA in rds_for_each_conn_info()

2018-03-12 Thread Salvatore Mesoraca
2018-03-12 8:06 GMT+01:00 santosh.shilim...@oracle.com <santosh.shilim...@oracle.com>: > On 3/11/18 2:07 PM, Salvatore Mesoraca wrote: >> >> Avoid VLA[1] by using an already allocated buffer passed >> by the caller. >> >> [1] https://lkml.org/lkml/2018

[PATCH] net: llc: drop VLA in llc_sap_mcast()

2018-03-11 Thread Salvatore Mesoraca
. [1] https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Salvatore Mesoraca <s.mesorac...@gmail.com> --- net/llc/llc_sap.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net/llc/llc_sap.c b/net/llc/llc_sap.c index d90928f..a7f7b8f 100644 --- a/net/llc/llc_sap.c +++

[PATCH 2/2] net: rds: drop VLA in rds_walk_conn_path_info()

2018-03-11 Thread Salvatore Mesoraca
Avoid VLA[1] by using an already allocated buffer passed by the caller. [1] https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Salvatore Mesoraca <s.mesorac...@gmail.com> --- net/rds/connection.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/rds/connection.c

[PATCH 1/2] net: rds: drop VLA in rds_for_each_conn_info()

2018-03-11 Thread Salvatore Mesoraca
Avoid VLA[1] by using an already allocated buffer passed by the caller. [1] https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Salvatore Mesoraca <s.mesorac...@gmail.com> --- net/rds/connection.c | 2 +- net/rds/ib.c | 3 +++ net/rds/rds.h| 1 + 3 files changed, 5 inse