[PATCH] net: fixup type in netdev_start_xmit()

2018-11-24 Thread Alexey Dobriyan
Return code should be formally "netdev_tx_t". Signed-off-by: Alexey Dobriyan --- include/linux/netdevice.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -4373,7 +4373,7 @@ static inline netdev_tx_t netdev_

Re: simplify procfs code for seq_file instances V2

2018-05-09 Thread Alexey Dobriyan
On Sun, May 06, 2018 at 06:45:31PM +0100, Al Viro wrote: > On Sun, May 06, 2018 at 08:19:49PM +0300, Alexey Dobriyan wrote: > > @@ -62,9 +62,9 @@ struct proc_dir_entry { > > umode_t mode; > > u8 namelen; > > #ifdef CONFIG_64BIT > > -#define SI

Re: simplify procfs code for seq_file instances V2

2018-05-06 Thread Alexey Dobriyan
On Wed, Apr 25, 2018 at 05:47:47PM +0200, Christoph Hellwig wrote: > Changes since V1: > - open code proc_create_data to avoid setting not fully initialized >entries live > - use unsigned int for state_size Need this to maintain sizeof(struct proc_dir_entry): Otherwise ACK fs/proc/ part.

Re: simplify procfs code for seq_file instances

2018-04-25 Thread Alexey Dobriyan
On Tue, Apr 24, 2018 at 06:06:53PM +0200, Christoph Hellwig wrote: > On Tue, Apr 24, 2018 at 08:19:16AM -0700, Andrew Morton wrote: > > > > I want to ask if it is time to start using poorman function overloading > > > > with _b_c_e(). There are millions of allocation functions for example, > > > >

Re: simplify procfs code for seq_file instances

2018-04-19 Thread Alexey Dobriyan
> git://git.infradead.org/users/hch/misc.git proc_create I want to ask if it is time to start using poorman function overloading with _b_c_e(). There are millions of allocation functions for example, all slightly difference, and people will add more. Seeing /proc interfaces doubled like this

Re: [PATCH 03/39] proc: introduce proc_create_seq_private

2018-04-19 Thread Alexey Dobriyan
On Thu, Apr 19, 2018 at 02:41:04PM +0200, Christoph Hellwig wrote: > Variant of proc_create_data that directly take a struct seq_operations > --- a/fs/proc/internal.h > +++ b/fs/proc/internal.h > @@ -45,6 +45,7 @@ struct proc_dir_entry { > const struct inode_operations *proc_iops; >

Re: [PATCH 14/39] proc: introduce proc_create_net_single

2018-04-19 Thread Alexey Dobriyan
On Thu, Apr 19, 2018 at 02:41:15PM +0200, Christoph Hellwig wrote: > Variant of proc_create_data that directly take a seq_file show > +struct proc_dir_entry *proc_create_net_single(const char *name, umode_t mode, > + struct proc_dir_entry *parent, > + int (*show)(struct

Re: [PATCH 02/39] proc: introduce proc_create_seq{,_data}

2018-04-19 Thread Alexey Dobriyan
On Thu, Apr 19, 2018 at 02:41:03PM +0200, Christoph Hellwig wrote: > Variants of proc_create{,_data} that directly take a struct seq_operations > argument and drastically reduces the boilerplate code in the callers. > +static int proc_seq_open(struct inode *inode, struct file *file) > +{ > +

[PATCH 21/25] slab: make usercopy region 32-bit

2018-03-05 Thread Alexey Dobriyan
If kmem case sizes are 32-bit, then usecopy region should be too. Cc: netdev@vger.kernel.org Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- include/linux/slab.h | 2 +- include/linux/slab_def.h | 4 ++-- include/linux/slub_def.h | 4 ++-- include/net/sock.h | 4 ++

[PATCH] xfrm: mark kmem_caches as __ro_after_init

2018-02-24 Thread Alexey Dobriyan
Kmem caches aren't relocated once set up. Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- net/xfrm/xfrm_input.c |3 ++- net/xfrm/xfrm_policy.c |2 +- 2 files changed, 3 insertions(+), 2 deletions(-) --- a/net/xfrm/xfrm_input.c +++ b/net/xfrm/xfrm_input.c @@ -9,

[PATCH] net: make kmem caches as __ro_after_init

2018-02-24 Thread Alexey Dobriyan
All kmem caches aren't reallocated once set up. Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- net/core/net_namespace.c |2 +- net/core/skbuff.c|4 ++-- net/ipv4/fib_trie.c |5 +++-- net/ipv4/inetpeer.c |3 ++- net/ipv4/ipmr.c |3 ++

Re: [PATCH] net: Allow mac_pton() to work on non-NULL terminated strings

2018-02-23 Thread Alexey Dobriyan
/* Don't dirty result unless string is valid MAC. */ > for (i = 0; i < ETH_ALEN; i++) { > if (!isxdigit(s[i * 3]) || !isxdigit(s[i * 3 + 1])) Short string will bail in the loop, indeed. Reviewed-by: Alexey Dobriyan <adobri...@gmail.com>

Re: [PATCH v2] net: delete /proc THIS_MODULE references

2018-01-15 Thread Alexey Dobriyan
On Mon, Jan 15, 2018 at 02:18:00PM -0800, Stephen Hemminger wrote: > On Tue, 16 Jan 2018 00:42:40 +0300 > Alexey Dobriyan <adobri...@gmail.com> wrote: > > > /proc has been ignoring struct file_operations::owner field for 10 years. > > Specifica

[PATCH v2] net: delete /proc THIS_MODULE references

2018-01-15 Thread Alexey Dobriyan
inode->i_fop = _reg_file_ops; + else + inode->i_fop = de->proc_fops; + } VFS stopped pinning module at this point. Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- net/8021q/vlanproc.c

Re: [PATCH] net: delete /proc THIS_MODULE references

2018-01-15 Thread Alexey Dobriyan
On Mon, Jan 15, 2018 at 02:50:12PM -0500, David Miller wrote: > From: Alexey Dobriyan <adobri...@gmail.com> > Date: Sat, 13 Jan 2018 20:11:52 +0300 > > > /proc has been ignoring struct file_operations::owner field for ages. > > > > Signed-off-by: Alexey Dobriya

[PATCH] net: delete /proc THIS_MODULE references

2018-01-13 Thread Alexey Dobriyan
/proc has been ignoring struct file_operations::owner field for ages. Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- net/8021q/vlanproc.c |2 -- net/appletalk/aarp.c |1 - net/appletalk/atalk_proc.c |3 --- net/atm/br

[PATCH 2/3] net: dst: switch to 8-bit dst->flags

2017-12-06 Thread Alexey Dobriyan
66 61 -5 Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- include/net/dst.h | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/include/net/dst.h b/include/net/dst.h index 0f0905bda423..25decfa4e14a 100644 --- a/include/net/dst.h +++ b/i

[PATCH 1/3] net: dst: add and use dst_flags_t

2017-12-06 Thread Alexey Dobriyan
Typedef dst->flags for checking with sparse. Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- drivers/net/vrf.c | 2 +- include/net/dst.h | 23 --- include/net/ip6_route.h | 2 +- net/core/dst.c | 4 ++-- net/ipv6/route.c|

Re: [PATCH v3 01/21] grace: replace BUG_ON by WARN_ONCE in exit_net hook

2017-11-07 Thread Alexey Dobriyan
> - BUG_ON(!list_empty(grace_list)); > + WARN_ONCE(!list_empty(grace_list), > + "net %x %s: grace_list is not empty\n", > + net->ns.inum, __func__); * printing __func__ is unnecessary as it will be on top of the stacktrace anyway, * message duplicates

[PATCH 2/2] slab, slub, slob: convert slab_flags_t to 32-bit

2017-10-21 Thread Alexey Dobriyan
function old new delta sysfs_slab_add 720 719 -1 ... check_object 699 676 -23 Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> ---

[PATCH 1/2] slab, slub, slob: add slab_flags_t

2017-10-21 Thread Alexey Dobriyan
Add sparse-checked slab_flags_t for struct kmem_cache::flags (SLAB_POISON, etc). SLAB is bloated temporarily by switching to "unsigned long", but only temporarily. Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- fs/ecryptfs/main.c |2 - fs/xfs/kmem.h

[PATCH] net: make ->ndo_get_phys_port_name accept 32-bit len

2017-10-07 Thread Alexey Dobriyan
nfp_port_get_phys_port_name 180 170 -10 Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- drivers/net/ethernet/broadcom/bnxt/bnxt.c|2 +- drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c|2 +- drivers/net/ethernet/mellanox/mlx5/core/en_rep.c

[PATCH] arp: make arp_hdr_len() return unsigned int

2017-09-26 Thread Alexey Dobriyan
-by: Alexey Dobriyan <adobri...@gmail.com> --- drivers/net/bonding/bond_main.c |3 ++- include/linux/if_arp.h |2 +- 2 files changed, 3 insertions(+), 2 deletions(-) --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -2491,7 +2491,8 @@ int bond_arp_rcv

[PATCH 2/2] neigh: make strucrt neigh_table::entry_size unsigned int

2017-09-23 Thread Alexey Dobriyan
11041103 -1 __pneigh_lookup 69 68 -1 __neigh_create 24522451 -1 Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- drivers/net/ethernet/chelsio/cxgb4/l2t.c

[PATCH 1/2] neigh: make struct neigh_table::entry_size unsigned int

2017-09-23 Thread Alexey Dobriyan
152 151 -1 clip_ioctl 14751474 -1 clip_constructor 93 92 -1 __neigh_create 24552452 -3 Signed-off-by: Alexey Dobriyan <ado

[PATCH 5/5] xfrm: eradicate size_t

2017-09-21 Thread Alexey Dobriyan
edness and flip some "int" to "unsigned int" as well. This is preparation to switching nlmsg_new() to "unsigned int". Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- net/xfrm/xfrm_user.c | 44 +++- 1 fi

[PATCH 4/5] xfrm: make xfrm_replay_state_esn_len() return unsigned int

2017-09-21 Thread Alexey Dobriyan
349 337 -12 xfrm_replay_notify_bmp 345 333 -12 Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- include/net/xfrm.h |2 +- net/xfrm/xfrm_user.c | 10 +- 2 files changed, 6 insertions(+), 6 deletions(-) --- a/inclu

[PATCH 2/5] xfrm: make xfrm_alg_len() return unsigned int

2017-09-21 Thread Alexey Dobriyan
Key lengths can't be negative. Comparison with nla_len() is left signed just in case negative value can sneak in there. Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- include/net/xfrm.h |2 +- net/xfrm/xfrm_user.c |2 +- 2 files changed, 2 insertions(+), 2 del

[PATCH 3/5] xfrm: make xfrm_alg_auth_len() return unsigned int

2017-09-21 Thread Alexey Dobriyan
Key lengths can't be negative. Comparison with nla_len() is left signed just in case negative value can sneak in there. Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- include/net/xfrm.h |2 +- net/xfrm/xfrm_user.c |2 +- 2 files changed, 2 insertions(+), 2 del

[PATCH 1/5] xfrm: make aead_len() return unsigned int

2017-09-21 Thread Alexey Dobriyan
Key lengths can't be negative. Comparison with nla_len() is left signed just in case negative value can sneak in there. Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- include/net/xfrm.h |2 +- net/xfrm/xfrm_user.c |2 +- 2 files changed, 2 insertions(+), 2 del

[PATCH] net: use 32-bit arithmetic while allocating net device

2017-09-21 Thread Alexey Dobriyan
-off-by: Alexey Dobriyan <adobri...@gmail.com> --- net/core/dev.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/core/dev.c +++ b/net/core/dev.c @@ -7989,7 +7989,7 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, unsigned in

Re: [PATCH] net: Convert int functions to bool

2017-09-13 Thread Alexey Dobriyan
> Global function ipv6_rcv_saddr_equal and static functions > ipv6_rcv_saddr_equal and ipv4_rcv_saddr_equal currently return int. > > bool is slightly more descriptive for these functions so change > their return type from int to bool. >From code generation POV "int" is better for non-inlined

Re: [patch net-next 1/3] idr: Use unsigned long instead of int

2017-08-16 Thread Alexey Dobriyan
[CC trimmed] On Tue, Aug 15, 2017 at 10:12:16PM -0400, Chris Mi wrote: > IDR uses internally radix tree which uses unsigned long. It doesn't > makes sense to have index as signed value. It doesn't. But it makes sense to use "unsigned int" because it generates smaller code on x86_64.

Re: [PATCH net-next] net: ndisc.c: reduce size of __ndisc_fill_addr_option()

2017-05-27 Thread Alexey Dobriyan
> --- a/net/ipv6/ndisc.c > +++ b/net/ipv6/ndisc.c > @@ -148,17 +148,18 @@ void __ndisc_fill_addr_option(struct sk_buff *skb, int > type, void *data, > space -= data_len; > - if (space > 0) > - memset(opt, 0, space); > + > + memset(opt, 0, space); This can't be right.

[PATCH] net: make struct request_sock_ops::obj_size unsigned

2017-05-22 Thread Alexey Dobriyan
This field is sizeof of corresponding kmem_cache so it can't be negative. Space will be saved after 32-bit kmem_cache_create() patch. Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- include/net/request_sock.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/inclu

[PATCH net-next] net: make struct inet_frags::qsize unsigned

2017-05-22 Thread Alexey Dobriyan
This field is sizeof of corresponding kmem_cache so it can't be negative. Prepare for 32-bit kmem_cache_create(). Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- include/net/inet_frag.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/net/inet_frag.h

[PATCH net-next] net: make struct dst_entry::dev first member

2017-05-17 Thread Alexey Dobriyan
30523045 -7 callforward_do_filter659 651 -8 dst_gc_task 571 549 -22 Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- include/net/dst.h |2 +- 1 file chan

[PATCH net-next] net: make struct net_device::tx_queue_len unsigned int

2017-05-17 Thread Alexey Dobriyan
810 799 -11 transmit 719 698 -21 Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- drivers/net/wan/hdlc_raw_eth.c |3 ++- include/linux/netdevice.h |2 +- net/core/net-sysfs.c |8 ++-

Re: [PATCH] net: move padding in struct skb_shared_info

2017-04-11 Thread Alexey Dobriyan
On Mon, Apr 10, 2017 at 5:43 PM, Eric Dumazet <eric.duma...@gmail.com> wrote: > On Mon, 2017-04-10 at 11:07 +0300, Alexey Dobriyan wrote: >> struct skb_shared_info { >> - unsigned short _unused; >> unsigned char nr_frags; >> __u8

[PATCH] net: make struct net_device::min_header_len 8-bit

2017-04-10 Thread Alexey Dobriyan
169 164 -5 ether_setup 148 143 -5 Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- include/linux/netdevice.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/linux/netdevice.h

[PATCH] net: neigh: make ->hh_len 32-bit

2017-04-10 Thread Alexey Dobriyan
put 14131409 -4 ip_finish_output2 16271623 -4 Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- include/linux/netdevice.h |3 +-- include/net/neighbour.h |4 ++-- 2 files changed, 3 inserti

[PATCH] net: move padding in struct skb_shared_info

2017-04-10 Thread Alexey Dobriyan
Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- include/linux/skbuff.h |1 - 1 file changed, 1 deletion(-) --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -413,7 +413,6 @@ struct ubuf_info { * the end of the header data, ie. at skb->end. */ struct skb_shared_info

Re: [PATCH net-next 0/1 v2] skbuff: Extend gso_type to unsigned int.

2017-04-09 Thread Alexey Dobriyan
> struct skb_shared_info { > + unsigned short _unused; > unsigned char nr_frags; This makes _all_ fields to be accessed with offset, but if you move padding down, at least ->nr_frags will enjoy clean and simple [R64] addressing. On allyesconfig-ish kernel: before: +542 =

Re: [PATCH] soreuseport: use "unsigned int" in __reuseport_alloc()

2017-04-04 Thread Alexey Dobriyan
On Mon, Apr 3, 2017 at 4:56 PM, Craig Gallek <kraigatg...@gmail.com> wrote: > On Sun, Apr 2, 2017 at 6:18 PM, Alexey Dobriyan <adobri...@gmail.com> wrote: >> Number of sockets is limited by 16-bit, so 64-bit allocation will never >> happen. >> >> 16-

[PATCH] soreuseport: use "unsigned int" in __reuseport_alloc()

2017-04-02 Thread Alexey Dobriyan
old new delta reuseport_add_sock 539 536 -3 Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- net/core/sock_reuseport.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/core/sock_reuseport.c +++ b/ne

[PATCH v2 3/3] flowcache: more "unsigned int"

2017-04-02 Thread Alexey Dobriyan
Make ->hash_count, ->low_watermark and ->high_watermark unsigned int and propagate unsignedness to other variables. This change doesn't change code generation because these fields aren't used in 64-bit contexts but make it anyway: these fields can't be negative numbers. Signed-off-b

[PATCH v2 2/3] flowcache: make flow_cache_hash_size() return "unsigned int"

2017-04-02 Thread Alexey Dobriyan
_cache_flush_tasklet 362 365 +3 __flow_cache_shrink 333 336 +3 flow_cache_cpu_up_prep 178 171 -7 flow_cache_lookup 11591148 -11 Signed-off-by: Ale

[PATCH v2 1/3] flowcache: make flow_key_size() return "unsigned int"

2017-04-02 Thread Alexey Dobriyan
11631159 -4 CSWTCH 75997 75953 -44 Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- include/net/flow.h |2 +- net/core/flow.c|6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) --- a/include/net/flow.h

Re: [PATCH v2] xfrm: branchless addr4_match() on 64-bit

2017-03-27 Thread Alexey Dobriyan
On Mon, Mar 27, 2017 at 1:37 PM, Steffen Klassert <steffen.klass...@secunet.com> wrote: > On Sat, Mar 25, 2017 at 07:41:17PM +0300, Alexey Dobriyan wrote: >> After (no branches): >> >> movr8d,0x20 >> movrdx,0x >&g

[PATCH v2] xfrm: branchless addr4_match() on 64-bit

2017-03-25 Thread Alexey Dobriyan
esi,DWORD PTR [rbx] movrdi,rdx xoreax,eax shlrdi,cl bswap edi Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- include/net/xfrm.h |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/include/net/xfrm.h +++ b/include/net/xfrm

Re: [PATCH] xfrm: branchless addr4_match() on 64-bit

2017-03-25 Thread Alexey Dobriyan
On Fri, Mar 24, 2017 at 05:16:44PM +, David Laight wrote: > From: Alexey Dobriyan > > Sent: 23 March 2017 23:33 > > Current addr4_match() code has special test for /0 prefixes because of > > standard required undefined behaviour. However, it is possible to omit >

[PATCH] xfrm: branchless addr4_match() on 64-bit

2017-03-23 Thread Alexey Dobriyan
,DWORD PTR [rbx] movrdi,rdx xoreax,eax shlrdi,cl bswap edi Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- include/net/xfrm.h |5 + 1 file changed, 5 insertions(+) --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -84

[PATCH] xfrm: use "unsigned int" in addr_match()

2017-03-23 Thread Alexey Dobriyan
xfrm_state_walk 708 696 -12 xfrm_selector_match 918 906 -12 Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- include/net/xfrm.h |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ---

[PATCH] xfrm: use "unsigned int" in __xfrm6_pref_hash()

2017-03-23 Thread Alexey Dobriyan
xfrm_hash_resize27522743 -9 policy_hash_bysel985 973 -12 policy_hash_direct 1036 999 -37 Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- net/xfrm/xfrm_hash.h |4 ++-- 1 file c

[PATCH] xfrm: remove unused struct xfrm_mgr::id

2017-03-23 Thread Alexey Dobriyan
Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- include/net/xfrm.h |1 - net/key/af_key.c |1 - net/xfrm/xfrm_user.c |1 - 3 files changed, 3 deletions(-) --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -586,7 +586,6 @@ struct xfrm_migrate { struct xf

[PATCH] net: make in_aton() 32-bit internally

2017-03-23 Thread Alexey Dobriyan
Converting IPv4 address doesn't need 64-bit arithmetic. Space savings: 10 bytes! add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-10 (-10) function old new delta in_aton96 86 -10 Signed-off-by: Alexey

Re: [PATCH 3/4] flowcache: make struct flow_cache_percpu::hash_rnd_recalc bool

2017-03-22 Thread Alexey Dobriyan
On Wed, Mar 22, 2017 at 5:09 AM, David Miller <da...@davemloft.net> wrote: > From: Alexey Dobriyan <adobri...@gmail.com> > Date: Mon, 20 Mar 2017 01:27:43 +0300 > >> ->hash_rnd_recalc is only used in boolean context. >> >> Space savings on x86

Re: [PATCH 2/4] flowcache: make flow_cache_hash_size() return "unsigned int"

2017-03-20 Thread Alexey Dobriyan
On Sun, Mar 19, 2017 at 04:13:41PM -0700, Eric Dumazet wrote: > On Mon, 2017-03-20 at 01:24 +0300, Alexey Dobriyan wrote: > > Hash size can't negative so "unsigned int" is logically correct. > > > > struct flow_cache_percpu *fcp = per_cpu_ptr(fc->percpu

[PATCH 4/4] flowcache: more "unsigned int" in struct flow_cache_percpu

2017-03-19 Thread Alexey Dobriyan
Make ->hash_count, ->low_watermark and ->high_watermark unsigned int and propagate unsignedness to other variables. This doesn't change code generation because these fields aren't used in 64-bit contexts but make it anyway: these fields can't be negative numbers. Signed-off-by: Alexey

[PATCH 3/4] flowcache: make struct flow_cache_percpu::hash_rnd_recalc bool

2017-03-19 Thread Alexey Dobriyan
chg -0.00% Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- include/net/flowcache.h |2 +- net/core/flow.c |6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) --- a/include/net/flowcache.h +++ b/include/net/flowcache.h @@ -10,7 +10,7 @@ struct flow_

[PATCH 2/4] flowcache: make flow_cache_hash_size() return "unsigned int"

2017-03-19 Thread Alexey Dobriyan
ore=170822884, After=170822872, chg -0.00% Lookup becomes smaller and this is what matters. Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- net/core/flow.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) --- a/net/core/flow.c +++ b/net/core/flow.c @@ -47,7 +47,7

[PATCH 1/4] flowcache: make flow_key_size() return "unsigned int"

2017-03-19 Thread Alexey Dobriyan
11631159 -4 CSWTCH 75553 75509 -44 Total: Before=170822932, After=170822884, chg -0.00% Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- include/net/flow.h |2 +- net/core/flow.c|6 +++--- 2 files chan

Re: [PATCH 2/5] gtp: Improve another size determination in ipv4_pdp_add()

2017-01-26 Thread Alexey Dobriyan
On Thu, Jan 26, 2017 at 1:18 PM, SF Markus Elfring wrote: > - pctx = kmalloc(sizeof(struct pdp_ctx), GFP_KERNEL); > + pctx = kmalloc(sizeof(*pctx), GFP_KERNEL); The rule about "sizeof(*p)" style of allocation is bogus and should be abolished.

Re: [PATCH 3/3] netns: fix net_generic() "id - 1" bloat

2016-12-14 Thread Alexey Dobriyan
On Tue, Dec 13, 2016 at 5:42 PM, David Laight <david.lai...@aculab.com> wrote: > From: Alexey Dobriyan >> Sent: 13 December 2016 14:23 > ... >> Well, the point of the patch is to save .text, so might as well save >> as much as possible. Any form other than "ptr[i

[PATCH net-next] netlink: revert broken, broken "2-clause nla_ok()"

2016-12-13 Thread Alexey Dobriyan
Commit 4f7df337fe79bba1e4c2d525525d63b5ba186bbd "netlink: 2-clause nla_ok()" is BROKEN. First clause tests if "->nla_len" could even be accessed at all, it can not possibly be omitted. Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- include/net/netlink.h

Re: [PATCH 3/3] netns: fix net_generic() "id - 1" bloat

2016-12-13 Thread Alexey Dobriyan
On Wed, Dec 7, 2016 at 1:49 PM, David Laight <david.lai...@aculab.com> wrote: > From: Alexey Dobriyan >> Sent: 05 December 2016 14:48 >> On Mon, Dec 5, 2016 at 3:49 PM, David Laight <david.lai...@aculab.com> wrote: >> > From: Alexey Dobriyan >> >>

BROKEN Re: [PATCH] netlink: 2-clause nla_ok()

2016-12-05 Thread Alexey Dobriyan
t;nla_len >= sizeof(*nla) && nla->nla_len <= remaining; Those logical ands ensure that memory access is not done if "rem" is small enough to even fetch ->nla_len. Maybe someone could vouch that other checks prevent this kind of situation from happening but not me.

Re: [PATCH 3/3] netns: fix net_generic() "id - 1" bloat

2016-12-05 Thread Alexey Dobriyan
On Mon, Dec 5, 2016 at 3:49 PM, David Laight <david.lai...@aculab.com> wrote: > From: Alexey Dobriyan >> Sent: 02 December 2016 01:22 >> net_generic() function is both a) inline and b) used ~600 times. >> >> It has the following code inside >> >>

[PATCH 3/3] netns: fix net_generic() "id - 1" bloat

2016-12-01 Thread Alexey Dobriyan
nfsd4_lock 38513796 -55 tipc_mon_rcv1012 956 -56 Total: Before=156643951, After=156639743, chg -0.00% Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- include/net/net

[PATCH] netlink: 2-clause nla_ok()

2016-12-01 Thread Alexey Dobriyan
6 -82 nl80211_parse_sched_scan28892780-109 ip_tun_from_nlattr 30862945-141 Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- include/net/netlink.h |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/i

[PATCH 2/3] netns: add dummy struct inside "struct net_generic"

2016-12-01 Thread Alexey Dobriyan
This is precursor to fixing "[id - 1]" bloat inside net_generic(). Name "s" is chosen to complement name "u" often used for dummy unions. Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- include/net/netns/generic.h |6 -- net/core/net_nam

[PATCH 1/3] netns: publish net_generic correctly

2016-12-01 Thread Alexey Dobriyan
s to preallocate 13 pointers which is actually quite a lot. You need IPv6, netfilter, bridging etc together loaded to trigger reallocation in the first place. Trimmed down config are OK. Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- net/core/net_namespace.c | 10

Re: [PATCH] net: fix bogus cast in skb_pagelen() and use unsigned variables

2016-11-23 Thread Alexey Dobriyan
On Wed, Nov 23, 2016 at 3:49 PM, David Laight <david.lai...@aculab.com> wrote: > From: Alexey Dobriyan >> Sent: 19 November 2016 01:08 > ... >> - for (i = (int)skb_shinfo(skb)->nr_frags - 1; i >= 0; i--) >> + for (i = skb_shinfo(skb)->nr_frags - 1;

[PATCH] net: fix bogus cast in skb_pagelen() and use unsigned variables

2016-11-18 Thread Alexey Dobriyan
ip_do_fragment 25492548 -1 ip6_fragment31303128 -2 Total: Before=154865032, After=154865028, chg -0.00% Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- include/linux/skbuff.h |6 ++

[PATCH] netlink: smaller nla_attr_minlen table

2016-11-18 Thread Alexey Dobriyan
Total: Before=154865051, After=154865032, chg -0.00% Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- lib/nlattr.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/lib/nlattr.c +++ b/lib/nlattr.c @@ -14,7 +14,7 @@ #include #include -static con

[PATCH] netlink: use "unsigned int" in nla_next()

2016-11-18 Thread Alexey Dobriyan
-13 nl80211_parse_sched_scan29022888 -14 nl80211_trigger_scan17381720 -18 do_execute_actions 28212738 -83 Total: Before=154865355, After=154865051, chg -0.00% Signed-off-by: Alexey Dobriyan <

[PATCH] net: make struct napi_alloc_cache::skb_count unsigned int

2016-11-18 Thread Alexey Dobriyan
__kfree_skb_flush 56 53 -3 __kfree_skb_defer 97 92 -5 Total: Before=154865639, After=154865629, chg -0.00% Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- net/core/skbuff.c |2 +-

[PATCH] netns: make struct pernet_operations::id unsigned int

2016-11-16 Thread Alexey Dobriyan
27 tcf_bpf_init11061076 -30 nfsd4_encode_fattr 59975930 -67 Total: Before=154856051, After=154854321, chg -0.00% Signed-off-by: Alexey Dobriyan <adobri...@gmail.com> --- drivers/infiniband/core/cma.c |

[PATCH] nf_conntrack: less hairy ifdefs around proc and sysctl

2008-02-25 Thread Alexey Dobriyan
Patch splits creation of /proc/net/nf_conntrack, /proc/net/stat/nf_conntrack and net.netfilter hierarchy into their own functions with dummy ones if PROC_FS or SYSCTL is not set. Also, remove dead ret = 0 write while I'm at it. Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED] --- net/netfilter

2.6.24?: WARNING: at net/core/dev.c: skb_gso_segment()

2008-02-08 Thread Alexey Dobriyan
FYI, this happened several times with OpenVZ kernel here, though one user reported against v2.6.24 but without calltrace: http://marc.info/?l=linux-kernelm=120155594432027w=2 Anyway... Driver is tg3. [ 403.240511] WARNING: at net/core/dev.c:1407 skb_gso_segment() if

[PATCH 3/3] netns netfilter: create per-netns /proc/net/*_tables_*

2008-01-25 Thread Alexey Dobriyan
Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED] --- include/linux/netfilter/x_tables.h |4 ++-- net/ipv4/netfilter/arp_tables.c| 21 ++--- net/ipv4/netfilter/ip_tables.c | 21 ++--- net/ipv6/netfilter/ip6_tables.c| 22

[PATCH 2/3] netns netfilter: netns propagation for /proc/net/*_tables_names

2008-01-25 Thread Alexey Dobriyan
Propagate netns together with AF down to -start/-next/-stop iterators. Choose table based on netns and AF for showing. Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED] --- net/netfilter/x_tables.c | 31 +++ 1 file changed, 19 insertions(+), 12 deletions

Re: [PATCH 1/5] netns netfilter: per-netns ip6tables

2008-01-25 Thread Alexey Dobriyan
On Thu, Jan 24, 2008 at 06:33:37PM +0100, Patrick McHardy wrote: Alexey Dobriyan wrote: * Propagate netns from userspace down to xt_find_table_lock() * Register ip6 tables in netns (modules still use init_net) Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED] --- include/linux

[PATCH 1/3] netns netfilter: semi-rewrite of /proc/net/foo_tables_*

2008-01-25 Thread Alexey Dobriyan
. Code of xt_matches_ops, xt_target_ops is identical except the list chosen for iterating, but I think consolidating code for two files not worth it given 16 hacks needed for it. Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED] --- net/netfilter/x_tables.c | 224

[PATCH 1/5] netns netfilter: per-netns ip6tables

2008-01-24 Thread Alexey Dobriyan
* Propagate netns from userspace down to xt_find_table_lock() * Register ip6 tables in netns (modules still use init_net) Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED] --- include/linux/netfilter_ipv6/ip6_tables.h |3 + net/ipv6/netfilter/ip6_tables.c | 50

[PATCH 2/5] netns netfilter: per-netns IPv6 FILTER, MANGLE, RAW

2008-01-24 Thread Alexey Dobriyan
Now it's possible to list and manipulate per-netns ip6tables rules. Filtering decisions are based on init_net's table so far. P.S.: remove init_net check in inet6_create() to see the effect Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED] --- include/net/netns/ipv6.h |6

[PATCH 3/5] netns netfilter: per-netns arp_tables

2008-01-24 Thread Alexey Dobriyan
* Propagate netns from userspace. * arpt_register_table() registers table in supplied netns. Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED] --- include/linux/netfilter_arp/arp_tables.h |3 + net/ipv4/netfilter/arp_tables.c | 55 +-- net/ipv4

[PATCH 4/5] netns netfilter: per-netns arp_tables FILTER

2008-01-24 Thread Alexey Dobriyan
Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED] --- include/net/netns/ipv4.h |1 net/ipv4/netfilter/arptable_filter.c | 38 +-- 2 files changed, 29 insertions(+), 10 deletions(-) --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h

[PATCH 5/5] netns netfilter: put table module on netns stop

2008-01-24 Thread Alexey Dobriyan
When number of entries exceeds number of initial entries, foo-tables code will pin table module. But during table unregister on netns stop, that additional pin was forgotten. Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED] --- net/ipv4/netfilter/arp_tables.c |3 +++ net/ipv4/netfilter

[PATCH 1/5] netns netfilter: change xt_table_register() return value convention

2008-01-21 Thread Alexey Dobriyan
Switch from 0/-E to ptr/PTR_ERR convention. Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED] --- include/linux/netfilter/x_tables.h |6 +++--- net/ipv4/netfilter/arp_tables.c|7 --- net/ipv4/netfilter/ip_tables.c |7 --- net/ipv6/netfilter/ip6_tables.c|7

[PATCH 2/5] netns netfilter: per-netns xt_tables

2008-01-21 Thread Alexey Dobriyan
In fact all we want is per-netns set of rules, however doing that will unnecessary complicate routines such as ipt_hook()/ipt_do_table, so make full xt_table array per-netns. Every user stubbed with init_net for a while. Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED] --- include/linux

[PATCH 3/5] netns netfilter: return new table from {arp,ip,ip6}t_register_table()

2008-01-21 Thread Alexey Dobriyan
of table modules is done. Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED] --- include/linux/netfilter_arp/arp_tables.h |4 ++-- include/linux/netfilter_ipv4/ip_tables.h |5 +++-- include/linux/netfilter_ipv6/ip6_tables.h |4 ++-- net/ipv4/netfilter/arp_tables.c | 22

[PATCH 4/5] netns netfilter: propagate netns from userspace

2008-01-21 Thread Alexey Dobriyan
.. all the way down to table searching functions. Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED] --- net/ipv4/netfilter/ip_tables.c | 46 - 1 file changed, 23 insertions(+), 23 deletions(-) --- a/net/ipv4/netfilter/ip_tables.c +++ b/net/ipv4

[PATCH 5/5] netns netfilter: per-netns FILTER, MANGLE, RAW

2008-01-21 Thread Alexey Dobriyan
the effect. Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED] --- include/net/netns/ipv4.h|5 net/ipv4/netfilter/iptable_filter.c | 41 --- net/ipv4/netfilter/iptable_mangle.c | 41 --- net/ipv4/netfilter

Re: Broken Make ip6_frags per namespace patch

2008-01-18 Thread Alexey Dobriyan
On Thu, Jan 17, 2008 at 01:01:11PM +0100, Daniel Lezcano wrote: Alexey Dobriyan wrote: On Thu, Jan 17, 2008 at 11:40:42AM +0100, Daniel Lezcano wrote: Alexey Dobriyan wrote: commit c064c4811b3e87ff8202f5a966ff4eea0bc54575 Author: Daniel Lezcano [EMAIL PROTECTED] Date: Thu Jan 10 02:56:03

Broken Make ip6_frags per namespace patch

2008-01-17 Thread Alexey Dobriyan
commit c064c4811b3e87ff8202f5a966ff4eea0bc54575 Author: Daniel Lezcano [EMAIL PROTECTED] Date: Thu Jan 10 02:56:03 2008 -0800 [NETNS][IPV6]: Make ip6_frags per namespace. The ip6_frags is moved to the network namespace structure. Because there can be multiple instances

Re: Broken Make ip6_frags per namespace patch

2008-01-17 Thread Alexey Dobriyan
On Thu, Jan 17, 2008 at 11:40:42AM +0100, Daniel Lezcano wrote: Alexey Dobriyan wrote: commit c064c4811b3e87ff8202f5a966ff4eea0bc54575 Author: Daniel Lezcano [EMAIL PROTECTED] Date: Thu Jan 10 02:56:03 2008 -0800 [NETNS][IPV6]: Make ip6_frags per namespace. The ip6_frags

[PATCH] proc: fix -open'less usage due to -proc_fops flip

2007-12-29 Thread Alexey Dobriyan
. Code: 75 21 68 e1 1a 19 c1 68 87 00 00 00 68 b8 e8 1f c1 68 25 73 1f c1 e8 84 06 e9 ff e8 52 b8 e7 ff 83 c4 10 9c 5f fa e8 28 89 ea ff f0 fe 4e 04 79 0a f3 90 80 7e 04 00 7e f8 eb f0 39 76 34 74 33 EIP: [c1188c1b] mutex_lock_nested+0x75/0x25d SS:ESP 0068:e8ea1ef8 Signed-off-by: Alexey Dobriyan

Re: [Devel] [PATCH 2.6.25] [IPV4] Reduce whitespaces in fib_rules.h.

2007-12-13 Thread Alexey Dobriyan
On Thu, Dec 13, 2007 at 05:18:42PM +0300, Denis V. Lunev wrote: There are to many spaces between type and function name in the declaration of fib rules manipulation routines. Eat them and save a couple of lines. If this patch is going in, it would be nice to get rid of extern as well.

[PATCH] netns: init dev_base_lock only once

2007-11-07 Thread Alexey Dobriyan
* it already statically initialized * reinitializing live global spinlock every time netns is setup is also wrong Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED] --- net/core/dev.c |1 - 1 file changed, 1 deletion(-) --- a/net/core/dev.c +++ b/net/core/dev.c @@ -4330,7 +4330,6 @@ static

  1   2   3   >