netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 1/2] net: frag: add typedef of getfrag callback function
@ 2015-04-08  1:26 Sheng Yong
  2015-04-08  1:26 ` [RFC PATCH 2/2] net: remove extra newlines Sheng Yong
  2015-04-08  2:26 ` [RFC PATCH 1/2] net: frag: add typedef of getfrag callback function David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Sheng Yong @ 2015-04-08  1:26 UTC (permalink / raw)
  To: davem, yoshfuji, kuznet, jmorris, kaber; +Cc: netdev

Add typedef of getfrag callback function to simplify the parameters list
of calling functions.

Signed-off-by: Sheng Yong <shengyong1@huawei.com>
---
 include/net/inet_frag.h |  4 ++++
 include/net/ip.h        | 11 ++++-------
 include/net/ipv6.h      |  8 ++------
 net/core/skbuff.c       |  4 +---
 net/ipv4/ip_output.c    | 12 ++++--------
 net/ipv4/udp.c          |  2 +-
 net/ipv6/ip6_output.c   | 15 ++++-----------
 net/ipv6/udp.c          |  2 +-
 8 files changed, 21 insertions(+), 37 deletions(-)

diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 8d17655..6e4664b 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -2,6 +2,10 @@
 #define __NET_FRAG_H__
 
 #include <linux/percpu_counter.h>
+#include <linux/skbuff.h>
+
+typedef int (*getfrag_callback)(void *from, char *to, int offset, int len,
+				int odd, struct sk_buff *skb);
 
 struct netns_frags {
 	/* The percpu_counter "mem" need to be cacheline aligned.
diff --git a/include/net/ip.h b/include/net/ip.h
index 69cd9cb..ca18bd9 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -121,8 +121,7 @@ static inline int ip_local_out(struct sk_buff *skb)
 int ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl);
 void ip_init(void);
 int ip_append_data(struct sock *sk, struct flowi4 *fl4,
-		   int getfrag(void *from, char *to, int offset, int len,
-			       int odd, struct sk_buff *skb),
+		   getfrag_callback getfrag,
 		   void *from, int len, int protolen,
 		   struct ipcm_cookie *ipc,
 		   struct rtable **rt,
@@ -138,11 +137,9 @@ int ip_send_skb(struct net *net, struct sk_buff *skb);
 int ip_push_pending_frames(struct sock *sk, struct flowi4 *fl4);
 void ip_flush_pending_frames(struct sock *sk);
 struct sk_buff *ip_make_skb(struct sock *sk, struct flowi4 *fl4,
-			    int getfrag(void *from, char *to, int offset,
-					int len, int odd, struct sk_buff *skb),
-			    void *from, int length, int transhdrlen,
-			    struct ipcm_cookie *ipc, struct rtable **rtp,
-			    unsigned int flags);
+			    getfrag_callback getfrag, void *from, int length,
+			    int transhdrlen, struct ipcm_cookie *ipc,
+			    struct rtable **rtp, unsigned int flags);
 
 static inline struct sk_buff *ip_finish_skb(struct sock *sk, struct flowi4 *fl4)
 {
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 65142e6..679c5e2 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -779,9 +779,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
 
 int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr);
 
-int ip6_append_data(struct sock *sk,
-		    int getfrag(void *from, char *to, int offset, int len,
-				int odd, struct sk_buff *skb),
+int ip6_append_data(struct sock *sk, getfrag_callback getfrag,
 		    void *from, int length, int transhdrlen, int hlimit,
 		    int tclass, struct ipv6_txoptions *opt, struct flowi6 *fl6,
 		    struct rt6_info *rt, unsigned int flags, int dontfrag);
@@ -795,9 +793,7 @@ int ip6_send_skb(struct sk_buff *skb);
 struct sk_buff *__ip6_make_skb(struct sock *sk, struct sk_buff_head *queue,
 			       struct inet_cork_full *cork,
 			       struct inet6_cork *v6_cork);
-struct sk_buff *ip6_make_skb(struct sock *sk,
-			     int getfrag(void *from, char *to, int offset,
-					 int len, int odd, struct sk_buff *skb),
+struct sk_buff *ip6_make_skb(struct sock *sk, getfrag_callback getfrag,
 			     void *from, int length, int transhdrlen,
 			     int hlimit, int tclass, struct ipv6_txoptions *opt,
 			     struct flowi6 *fl6, struct rt6_info *rt,
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index cdb939b..10995a4 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2899,9 +2899,7 @@ EXPORT_SYMBOL(skb_find_text);
  * of the skb if any page alloc fails user this procedure returns  -ENOMEM
  */
 int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb,
-			int (*getfrag)(void *from, char *to, int offset,
-					int len, int odd, struct sk_buff *skb),
-			void *from, int length)
+			getfrag_callback getfrag, void *from, int length)
 {
 	int frg_cnt = skb_shinfo(skb)->nr_frags;
 	int copy;
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 26f6f79..d5c5955 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -778,8 +778,7 @@ csum_page(struct page *page, int offset, int copy)
 
 static inline int ip_ufo_append_data(struct sock *sk,
 			struct sk_buff_head *queue,
-			int getfrag(void *from, char *to, int offset, int len,
-			       int odd, struct sk_buff *skb),
+			getfrag_callback getfrag,
 			void *from, int length, int hh_len, int fragheaderlen,
 			int transhdrlen, int maxfraglen, unsigned int flags)
 {
@@ -834,8 +833,7 @@ static int __ip_append_data(struct sock *sk,
 			    struct sk_buff_head *queue,
 			    struct inet_cork *cork,
 			    struct page_frag *pfrag,
-			    int getfrag(void *from, char *to, int offset,
-					int len, int odd, struct sk_buff *skb),
+			    getfrag_callback getfrag,
 			    void *from, int length, int transhdrlen,
 			    unsigned int flags)
 {
@@ -1130,8 +1128,7 @@ static int ip_setup_cork(struct sock *sk, struct inet_cork *cork,
  *	LATER: length must be adjusted by pad at tail, when it is required.
  */
 int ip_append_data(struct sock *sk, struct flowi4 *fl4,
-		   int getfrag(void *from, char *to, int offset, int len,
-			       int odd, struct sk_buff *skb),
+		   getfrag_callback getfrag,
 		   void *from, int length, int transhdrlen,
 		   struct ipcm_cookie *ipc, struct rtable **rtp,
 		   unsigned int flags)
@@ -1457,8 +1454,7 @@ void ip_flush_pending_frames(struct sock *sk)
 
 struct sk_buff *ip_make_skb(struct sock *sk,
 			    struct flowi4 *fl4,
-			    int getfrag(void *from, char *to, int offset,
-					int len, int odd, struct sk_buff *skb),
+			    getfrag_callback getfrag,
 			    void *from, int length, int transhdrlen,
 			    struct ipcm_cookie *ipc, struct rtable **rtp,
 			    unsigned int flags)
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 2162fc6..d1fc362 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -889,7 +889,7 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
 	u8  tos;
 	int err, is_udplite = IS_UDPLITE(sk);
 	int corkreq = up->corkflag || msg->msg_flags&MSG_MORE;
-	int (*getfrag)(void *, char *, int, int, int, struct sk_buff *);
+	getfrag_callback getfrag;
 	struct sk_buff *skb;
 	struct ip_options_data opt_copy;
 
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 654f245..d5c3bf0 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1029,9 +1029,7 @@ struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6,
 EXPORT_SYMBOL_GPL(ip6_sk_dst_lookup_flow);
 
 static inline int ip6_ufo_append_data(struct sock *sk,
-			struct sk_buff_head *queue,
-			int getfrag(void *from, char *to, int offset, int len,
-			int odd, struct sk_buff *skb),
+			struct sk_buff_head *queue, getfrag_callback getfrag,
 			void *from, int length, int hh_len, int fragheaderlen,
 			int transhdrlen, int mtu, unsigned int flags,
 			struct rt6_info *rt)
@@ -1198,8 +1196,7 @@ static int __ip6_append_data(struct sock *sk,
 			     struct inet_cork *cork,
 			     struct inet6_cork *v6_cork,
 			     struct page_frag *pfrag,
-			     int getfrag(void *from, char *to, int offset,
-					 int len, int odd, struct sk_buff *skb),
+			     getfrag_callback getfrag,
 			     void *from, int length, int transhdrlen,
 			     unsigned int flags, int dontfrag)
 {
@@ -1505,9 +1502,7 @@ error:
 	return err;
 }
 
-int ip6_append_data(struct sock *sk,
-		    int getfrag(void *from, char *to, int offset, int len,
-				int odd, struct sk_buff *skb),
+int ip6_append_data(struct sock *sk, getfrag_callback getfrag,
 		    void *from, int length, int transhdrlen, int hlimit,
 		    int tclass, struct ipv6_txoptions *opt, struct flowi6 *fl6,
 		    struct rt6_info *rt, unsigned int flags, int dontfrag)
@@ -1690,9 +1685,7 @@ void ip6_flush_pending_frames(struct sock *sk)
 }
 EXPORT_SYMBOL_GPL(ip6_flush_pending_frames);
 
-struct sk_buff *ip6_make_skb(struct sock *sk,
-			     int getfrag(void *from, char *to, int offset,
-					 int len, int odd, struct sk_buff *skb),
+struct sk_buff *ip6_make_skb(struct sock *sk, getfrag_callback getfrag,
 			     void *from, int length, int transhdrlen,
 			     int hlimit, int tclass,
 			     struct ipv6_txoptions *opt, struct flowi6 *fl6,
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 120aff9..5f0f05f 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1121,7 +1121,7 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
 	int err;
 	int connected = 0;
 	int is_udplite = IS_UDPLITE(sk);
-	int (*getfrag)(void *, char *, int, int, int, struct sk_buff *);
+	getfrag_callback getfrag;
 
 	/* destination address check */
 	if (sin6) {
-- 
1.8.3.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [RFC PATCH 2/2] net: remove extra newlines
  2015-04-08  1:26 [RFC PATCH 1/2] net: frag: add typedef of getfrag callback function Sheng Yong
@ 2015-04-08  1:26 ` Sheng Yong
  2015-04-08  2:24   ` David Miller
  2015-04-08  2:26 ` [RFC PATCH 1/2] net: frag: add typedef of getfrag callback function David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Sheng Yong @ 2015-04-08  1:26 UTC (permalink / raw)
  To: davem, yoshfuji, kuznet, jmorris, kaber; +Cc: netdev

Signed-off-by: Sheng Yong <shengyong1@huawei.com>
---
 include/net/ipv6.h   | 2 --
 net/core/skbuff.c    | 1 -
 net/ipv4/ip_output.c | 3 ---
 net/ipv4/udp.c       | 5 -----
 net/ipv6/udp.c       | 3 ---
 5 files changed, 14 deletions(-)

diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 679c5e2..70e9585 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -47,8 +47,6 @@
 
 #define NEXTHDR_MAX		255
 
-
-
 #define IPV6_DEFAULT_HOPLIMIT   64
 #define IPV6_DEFAULT_MCASTHOPS	1
 
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 10995a4..4dc2f99 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3750,7 +3750,6 @@ void skb_complete_wifi_ack(struct sk_buff *skb, bool acked)
 }
 EXPORT_SYMBOL_GPL(skb_complete_wifi_ack);
 
-
 /**
  * skb_partial_csum_set - set up and verify partial csum values for packet
  * @skb: the skb to set
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index d5c5955..48d6684 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -449,7 +449,6 @@ no_route:
 }
 EXPORT_SYMBOL(ip_queue_xmit);
 
-
 static void ip_copy_metadata(struct sk_buff *to, struct sk_buff *from)
 {
 	to->pkt_type = from->pkt_type;
@@ -812,7 +811,6 @@ static inline int ip_ufo_append_data(struct sock *sk,
 
 		skb->csum = 0;
 
-
 		__skb_queue_tail(queue, skb);
 	} else if (skb_is_gso(skb)) {
 		goto append;
@@ -1208,7 +1206,6 @@ ssize_t	ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page,
 		skb_shinfo(skb)->gso_type = SKB_GSO_UDP;
 	}
 
-
 	while (size > 0) {
 		int i;
 
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index d1fc362..6263737 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -433,7 +433,6 @@ static u32 udp_ehashfn(const struct net *net, const __be32 laddr,
 			      udp_ehash_secret + net_hash_mix(net));
 }
 
-
 /* called with read_rcu_lock() */
 static struct sock *udp4_lib_lookup2(struct net *net,
 		__be32 saddr, __be16 sport,
@@ -1171,7 +1170,6 @@ out:
 	return ret;
 }
 
-
 /**
  *	first_packet_length	- return length of first packet in receive queue
  *	@sk: socket
@@ -1355,7 +1353,6 @@ csum_copy_err:
 	goto try_again;
 }
 
-
 int udp_disconnect(struct sock *sk, int flags)
 {
 	struct inet_sock *inet = inet_sk(sk);
@@ -1579,7 +1576,6 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
 	    udp_lib_checksum_complete(skb))
 		goto csum_error;
 
-
 	if (sk_rcvqueues_full(sk, sk->sk_rcvbuf)) {
 		UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_RCVBUFERRORS,
 				 is_udplite);
@@ -1609,7 +1605,6 @@ drop:
 	return -1;
 }
 
-
 static void flush_stack(struct sock **stack, unsigned int count,
 			struct sk_buff *skb, unsigned int final)
 {
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 5f0f05f..06839a9 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -120,7 +120,6 @@ static u32 udp6_portaddr_hash(const struct net *net,
 	return hash ^ port;
 }
 
-
 int udp_v6_get_port(struct sock *sk, unsigned short snum)
 {
 	unsigned int hash2_nulladdr =
@@ -385,7 +384,6 @@ struct sock *udp6_lib_lookup(struct net *net, const struct in6_addr *saddr, __be
 }
 EXPORT_SYMBOL_GPL(udp6_lib_lookup);
 
-
 /*
  *	This should be easy, if there is something there we
  *	return it, otherwise we block.
@@ -1555,7 +1553,6 @@ static struct inet_protosw udpv6_protosw = {
 	.flags =     INET_PROTOSW_PERMANENT,
 };
 
-
 int __init udpv6_init(void)
 {
 	int ret;
-- 
1.8.3.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH 2/2] net: remove extra newlines
  2015-04-08  1:26 ` [RFC PATCH 2/2] net: remove extra newlines Sheng Yong
@ 2015-04-08  2:24   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2015-04-08  2:24 UTC (permalink / raw)
  To: shengyong1; +Cc: yoshfuji, kuznet, jmorris, kaber, netdev

From: Sheng Yong <shengyong1@huawei.com>
Date: Wed, 8 Apr 2015 01:26:18 +0000

> Signed-off-by: Sheng Yong <shengyong1@huawei.com>

This is fine, applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH 1/2] net: frag: add typedef of getfrag callback function
  2015-04-08  1:26 [RFC PATCH 1/2] net: frag: add typedef of getfrag callback function Sheng Yong
  2015-04-08  1:26 ` [RFC PATCH 2/2] net: remove extra newlines Sheng Yong
@ 2015-04-08  2:26 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2015-04-08  2:26 UTC (permalink / raw)
  To: shengyong1; +Cc: yoshfuji, kuznet, jmorris, kaber, netdev

From: Sheng Yong <shengyong1@huawei.com>
Date: Wed, 8 Apr 2015 01:26:17 +0000

> Add typedef of getfrag callback function to simplify the parameters list
> of calling functions.
> 
> Signed-off-by: Sheng Yong <shengyong1@huawei.com>

Please read chapter 5 in Documentation/CodingStyle.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-04-08  2:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-08  1:26 [RFC PATCH 1/2] net: frag: add typedef of getfrag callback function Sheng Yong
2015-04-08  1:26 ` [RFC PATCH 2/2] net: remove extra newlines Sheng Yong
2015-04-08  2:24   ` David Miller
2015-04-08  2:26 ` [RFC PATCH 1/2] net: frag: add typedef of getfrag callback function David Miller

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).