netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krishna Kumar <krkumar2@in.ibm.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, herbert@gondor.apana.org.au,
	Krishna Kumar <krkumar2@in.ibm.com>,
	dada1@cosmosbay.com
Subject: [RFC] [PATCH 5/5] net: Encapsulate inner code of __sk_dst_reset
Date: Thu, 15 Oct 2009 11:27:58 +0530	[thread overview]
Message-ID: <20091015055758.30145.77495.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20091015055602.30145.65852.sendpatchset@localhost.localdomain>

From: Krishna Kumar <krkumar2@in.ibm.com>

Reuse code by adding ___sk_dst_reset() which is called by
__sk_dst_reset() and __sk_dst_check(). This new API is also
called from IPv6 to hide the internals of __sk_dst_reset
and the setting of sk_tx_queue_mapping.

Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
---
 include/net/sock.h               |   13 +++++++++----
 net/core/sock.c                  |    4 +---
 net/ipv6/inet6_connection_sock.c |    4 +---
 3 files changed, 11 insertions(+), 10 deletions(-)

diff -ruNp org/include/net/sock.h new/include/net/sock.h
--- org/include/net/sock.h	2009-10-14 18:00:17.000000000 +0530
+++ new/include/net/sock.h	2009-10-14 18:00:30.000000000 +0530
@@ -1186,17 +1186,22 @@ sk_dst_set(struct sock *sk, struct dst_e
 }
 
 static inline void
-__sk_dst_reset(struct sock *sk)
+___sk_dst_reset(struct sock *sk, struct dst_entry *old_dst)
 {
-	struct dst_entry *old_dst;
-
 	sk_record_tx_queue(sk, -1);
-	old_dst = sk->sk_dst_cache;
 	sk->sk_dst_cache = NULL;
 	dst_release(old_dst);
 }
 
 static inline void
+__sk_dst_reset(struct sock *sk)
+{
+	struct dst_entry *old_dst = sk->sk_dst_cache;
+
+	___sk_dst_reset(sk, old_dst);
+}
+
+static inline void
 sk_dst_reset(struct sock *sk)
 {
 	write_lock(&sk->sk_dst_lock);
diff -ruNp org/net/core/sock.c new/net/core/sock.c
--- org/net/core/sock.c	2009-10-14 18:00:22.000000000 +0530
+++ new/net/core/sock.c	2009-10-14 18:00:30.000000000 +0530
@@ -364,9 +364,7 @@ struct dst_entry *__sk_dst_check(struct 
 	struct dst_entry *dst = sk->sk_dst_cache;
 
 	if (dst && dst->obsolete && dst->ops->check(dst, cookie) == NULL) {
-		sk_record_tx_queue(sk, -1);
-		sk->sk_dst_cache = NULL;
-		dst_release(dst);
+		___sk_dst_reset(sk, dst);
 		return NULL;
 	}
 
diff -ruNp org/net/ipv6/inet6_connection_sock.c new/net/ipv6/inet6_connection_sock.c
--- org/net/ipv6/inet6_connection_sock.c	2009-10-14 18:00:17.000000000 +0530
+++ new/net/ipv6/inet6_connection_sock.c	2009-10-14 18:00:30.000000000 +0530
@@ -168,9 +168,7 @@ struct dst_entry *__inet6_csk_dst_check(
 	if (dst) {
 		struct rt6_info *rt = (struct rt6_info *)dst;
 		if (rt->rt6i_flow_cache_genid != atomic_read(&flow_cache_genid)) {
-			sk_record_tx_queue(sk, -1);
-			sk->sk_dst_cache = NULL;
-			dst_release(dst);
+			___sk_dst_reset(sk, dst);
 			dst = NULL;
 		}
 	}

  parent reply	other threads:[~2009-10-15  5:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-15  5:56 [RFC] [PATCH 0/5] net: Implement fast TX queue selection Krishna Kumar
2009-10-15  5:56 ` [RFC] [PATCH 1/5] net: Introduce sk_tx_queue_mapping Krishna Kumar
2009-10-15 10:32   ` Eric Dumazet
2009-10-15  5:57 ` [RFC] [PATCH 2/5] net: Use sk_tx_queue_mapping for connected sockets Krishna Kumar
2009-10-15  9:41   ` Eric Dumazet
2009-10-15  5:57 ` [RFC] [PATCH 3/5] net: IPv6 changes Krishna Kumar
2009-10-15  5:57 ` [RFC] [PATCH 4/5] net: Fix for dst_negative_advice Krishna Kumar
2009-10-15  5:57 ` Krishna Kumar [this message]
2009-10-15  9:53   ` [RFC] [PATCH 5/5] net: Encapsulate inner code of __sk_dst_reset Eric Dumazet
2009-10-15 12:53     ` Krishna Kumar2

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=20091015055758.30145.77495.sendpatchset@localhost.localdomain \
    --to=krkumar2@in.ibm.com \
    --cc=dada1@cosmosbay.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=netdev@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).