netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH 05/22] netfilter: ipset: Split extensions into separate files
Date: Tue, 1 Nov 2016 20:20:30 +0100	[thread overview]
Message-ID: <20161101192030.GE18827@salvia> (raw)
In-Reply-To: <1477255075-15255-6-git-send-email-kadlec@blackhole.kfki.hu>

On Sun, Oct 23, 2016 at 10:37:38PM +0200, Jozsef Kadlecsik wrote:
> Ported from a patch proposed by Sergey Popovich <popovich_sergei@mail.ua>.
> 
> Suggested-by: Sergey Popovich <popovich_sergei@mail.ua>
> Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
> ---
>  include/linux/netfilter/ipset/ip_set.h         | 95 +-------------------------
>  include/linux/netfilter/ipset/ip_set_counter.h | 75 ++++++++++++++++++++
>  include/linux/netfilter/ipset/ip_set_skbinfo.h | 46 +++++++++++++
>  3 files changed, 123 insertions(+), 93 deletions(-)
>  create mode 100644 include/linux/netfilter/ipset/ip_set_counter.h
>  create mode 100644 include/linux/netfilter/ipset/ip_set_skbinfo.h
> 
> diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
> index 7802621..b5bd0fb3 100644
> --- a/include/linux/netfilter/ipset/ip_set.h
> +++ b/include/linux/netfilter/ipset/ip_set.h
> @@ -292,99 +292,6 @@ struct ip_set {
>  	return nla_put_net32(skb, IPSET_ATTR_CADT_FLAGS, htonl(cadt_flags));
>  }
>  
> -static inline void
> -ip_set_add_bytes(u64 bytes, struct ip_set_counter *counter)
> -{
> -	atomic64_add((long long)bytes, &(counter)->bytes);
> -}
> -
> -static inline void
> -ip_set_add_packets(u64 packets, struct ip_set_counter *counter)
> -{
> -	atomic64_add((long long)packets, &(counter)->packets);
> -}
> -
> -static inline u64
> -ip_set_get_bytes(const struct ip_set_counter *counter)
> -{
> -	return (u64)atomic64_read(&(counter)->bytes);
> -}
> -
> -static inline u64
> -ip_set_get_packets(const struct ip_set_counter *counter)
> -{
> -	return (u64)atomic64_read(&(counter)->packets);
> -}
> -
> -static inline void
> -ip_set_update_counter(struct ip_set_counter *counter,
> -		      const struct ip_set_ext *ext,
> -		      struct ip_set_ext *mext, u32 flags)
> -{
> -	if (ext->packets != ULLONG_MAX &&
> -	    !(flags & IPSET_FLAG_SKIP_COUNTER_UPDATE)) {
> -		ip_set_add_bytes(ext->bytes, counter);
> -		ip_set_add_packets(ext->packets, counter);
> -	}
> -	if (flags & IPSET_FLAG_MATCH_COUNTERS) {
> -		mext->packets = ip_set_get_packets(counter);
> -		mext->bytes = ip_set_get_bytes(counter);
> -	}
> -}
> -
> -static inline bool
> -ip_set_put_counter(struct sk_buff *skb, const struct ip_set_counter *counter)
> -{
> -	return nla_put_net64(skb, IPSET_ATTR_BYTES,
> -			     cpu_to_be64(ip_set_get_bytes(counter)),
> -			     IPSET_ATTR_PAD) ||
> -	       nla_put_net64(skb, IPSET_ATTR_PACKETS,
> -			     cpu_to_be64(ip_set_get_packets(counter)),
> -			     IPSET_ATTR_PAD);
> -}
> -
> -static inline void
> -ip_set_init_counter(struct ip_set_counter *counter,
> -		    const struct ip_set_ext *ext)
> -{
> -	if (ext->bytes != ULLONG_MAX)
> -		atomic64_set(&(counter)->bytes, (long long)(ext->bytes));
> -	if (ext->packets != ULLONG_MAX)
> -		atomic64_set(&(counter)->packets, (long long)(ext->packets));
> -}
> -
> -static inline void
> -ip_set_get_skbinfo(struct ip_set_skbinfo *skbinfo,
> -		   const struct ip_set_ext *ext,
> -		   struct ip_set_ext *mext, u32 flags)
> -{
> -	mext->skbinfo = *skbinfo;
> -}
> -
> -static inline bool
> -ip_set_put_skbinfo(struct sk_buff *skb, const struct ip_set_skbinfo *skbinfo)
> -{
> -	/* Send nonzero parameters only */
> -	return ((skbinfo->skbmark || skbinfo->skbmarkmask) &&
> -		nla_put_net64(skb, IPSET_ATTR_SKBMARK,
> -			      cpu_to_be64((u64)skbinfo->skbmark << 32 |
> -					  skbinfo->skbmarkmask),
> -			      IPSET_ATTR_PAD)) ||
> -	       (skbinfo->skbprio &&
> -		nla_put_net32(skb, IPSET_ATTR_SKBPRIO,
> -			      cpu_to_be32(skbinfo->skbprio))) ||
> -	       (skbinfo->skbqueue &&
> -		nla_put_net16(skb, IPSET_ATTR_SKBQUEUE,
> -			     cpu_to_be16(skbinfo->skbqueue)));
> -}
> -
> -static inline void
> -ip_set_init_skbinfo(struct ip_set_skbinfo *skbinfo,
> -		    const struct ip_set_ext *ext)
> -{
> -	*skbinfo = ext->skbinfo;
> -}
> -
>  /* Netlink CB args */
>  enum {
>  	IPSET_CB_NET = 0,	/* net namespace */
> @@ -539,6 +446,8 @@ static inline int nla_put_ipaddr6(struct sk_buff *skb, int type,
>  
>  #include <linux/netfilter/ipset/ip_set_timeout.h>
>  #include <linux/netfilter/ipset/ip_set_comment.h>
> +#include <linux/netfilter/ipset/ip_set_counter.h>
> +#include <linux/netfilter/ipset/ip_set_skbinfo.h>
>  
>  int
>  ip_set_put_extensions(struct sk_buff *skb, const struct ip_set *set,
> diff --git a/include/linux/netfilter/ipset/ip_set_counter.h b/include/linux/netfilter/ipset/ip_set_counter.h
> new file mode 100644
> index 0000000..2b5e784
> --- /dev/null
> +++ b/include/linux/netfilter/ipset/ip_set_counter.h
> @@ -0,0 +1,75 @@
> +#ifndef _IP_SET_COUNTER_H
> +#define _IP_SET_COUNTER_H
> +
> +/* Copyright (C) 2015 Sergey Popovich <popovich_sergei@mail.ua>

git annotate says these functions were done by you:

commit 34d666d489cf70c246ca99b2387741915c34b88c
Author: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Date:   Sat Apr 27 14:38:56 2013 +0200

    netfilter: ipset: Introduce the counter extension in the core

So I don't think we can credit Sergey as copyright owner just to move
functions into a header file.

  reply	other threads:[~2016-11-01 19:20 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-23 20:37 [PATCH 00/22] ipset patches for nf-next, v2 Jozsef Kadlecsik
2016-10-23 20:37 ` [PATCH 01/22] netfilter: ipset: Correct rcu_dereference_bh_nfnl() usage Jozsef Kadlecsik
2016-11-01 19:13   ` Pablo Neira Ayuso
2016-10-23 20:37 ` [PATCH 02/22] netfilter: ipset: Headers file cleanup Jozsef Kadlecsik
2016-11-01 19:14   ` Pablo Neira Ayuso
2016-10-23 20:37 ` [PATCH 03/22] netfilter: ipset: Improve skbinfo get/init helpers Jozsef Kadlecsik
2016-11-01 19:15   ` Pablo Neira Ayuso
2016-10-23 20:37 ` [PATCH 04/22] netfilter: ipset: Improve comment extension helpers Jozsef Kadlecsik
2016-11-01 19:16   ` Pablo Neira Ayuso
2016-10-23 20:37 ` [PATCH 05/22] netfilter: ipset: Split extensions into separate files Jozsef Kadlecsik
2016-11-01 19:20   ` Pablo Neira Ayuso [this message]
2016-11-01 19:21   ` Pablo Neira Ayuso
2016-10-23 20:37 ` [PATCH 06/22] netfilter: ipset: Separate memsize calculation code into dedicated function Jozsef Kadlecsik
2016-11-01 19:23   ` Pablo Neira Ayuso
2016-10-23 20:37 ` [PATCH 07/22] netfilter: ipset: Regroup ip_set_put_extensions and add extern Jozsef Kadlecsik
2016-11-01 19:24   ` Pablo Neira Ayuso
2016-10-23 20:37 ` [PATCH 08/22] netfilter: ipset: Add element count to hash headers Jozsef Kadlecsik
2016-10-23 20:37 ` [PATCH 09/22] netfilter: ipset: Add element count to all set types header Jozsef Kadlecsik
2016-10-23 20:37 ` [PATCH 10/22] netfilter: ipset: Count non-static extension memory for userspace Jozsef Kadlecsik
2016-10-23 20:37 ` [PATCH 11/22] netfilter: ipset: Simplify mtype_expire() for hash types Jozsef Kadlecsik
2016-11-01 19:25   ` Pablo Neira Ayuso
2016-10-23 20:37 ` [PATCH 12/22] netfilter: ipset: Make NLEN compile time constant " Jozsef Kadlecsik
2016-10-23 20:37 ` [PATCH 13/22] netfilter: ipset: Make sure element data size is a multiple of u32 Jozsef Kadlecsik
2016-10-23 20:37 ` [PATCH 14/22] netfilter: ipset: Optimize hash creation routine Jozsef Kadlecsik
2016-10-23 20:37 ` [PATCH 15/22] netfilter: ipset: Make struct htype per ipset family Jozsef Kadlecsik
2016-10-23 20:37 ` [PATCH 16/22] netfilter: ipset: Collapse same condition body to a single one Jozsef Kadlecsik
2016-11-01 19:27   ` Pablo Neira Ayuso
2016-10-23 20:37 ` [PATCH 17/22] netfilter: ipset: Fix reported memory size for hash:* types Jozsef Kadlecsik
2016-10-23 20:37 ` [PATCH 18/22] netfilter: ipset: hash:ipmac type support added to ipset Jozsef Kadlecsik
2016-10-23 20:37 ` [PATCH 19/22] netfilter: ipset: use setup_timer() and mod_timer() Jozsef Kadlecsik
2016-11-01 19:28   ` Pablo Neira Ayuso
2016-10-23 20:37 ` [PATCH 20/22] " Jozsef Kadlecsik
2016-10-23 20:37 ` [PATCH 21/22] " Jozsef Kadlecsik
2016-10-23 20:37 ` [PATCH 22/22] netfilter: ipset: hash: fix boolreturn.cocci warnings Jozsef Kadlecsik
2016-10-27 16:53 ` [PATCH 00/22] ipset patches for nf-next, v2 Pablo Neira Ayuso
2016-11-01 19:06   ` Pablo Neira Ayuso
  -- strict thread matches above, loose matches on Subject: below --
2016-10-17 12:51 [PATCH 00/22] ipset patches for nf-next Jozsef Kadlecsik
2016-10-17 12:51 ` [PATCH 05/22] netfilter: ipset: Split extensions into separate files Jozsef Kadlecsik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161101192030.GE18827@salvia \
    --to=pablo@netfilter.org \
    --cc=kadlec@blackhole.kfki.hu \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).