aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/sock.c
diff options
context:
space:
mode:
authorKrishna Kumar <krkumar2@in.ibm.com>2009-10-19 19:46:20 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-20 21:55:45 -0400
commite022f0b4a03f4fff9323b509df023b8af635716e (patch)
treef287633fd72c4f70882b768836101acff7d1bc62 /net/core/sock.c
parent748879776e3b738d53e64df6dbec7394b829462a (diff)
net: Introduce sk_tx_queue_mapping
Introduce sk_tx_queue_mapping; and functions that set, test and get this value. Reset sk_tx_queue_mapping to -1 whenever the dst cache is set/reset, and in socket alloc. Setting txq to -1 and using valid txq=<0 to n-1> allows the tx path to use the value of sk_tx_queue_mapping directly instead of subtracting 1 on every tx. Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/sock.c')
-rw-r--r--net/core/sock.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 38713aa3faf2..934d9673f084 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -357,6 +357,7 @@ struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie)
357 struct dst_entry *dst = sk->sk_dst_cache; 357 struct dst_entry *dst = sk->sk_dst_cache;
358 358
359 if (dst && dst->obsolete && dst->ops->check(dst, cookie) == NULL) { 359 if (dst && dst->obsolete && dst->ops->check(dst, cookie) == NULL) {
360 sk_tx_queue_clear(sk);
360 sk->sk_dst_cache = NULL; 361 sk->sk_dst_cache = NULL;
361 dst_release(dst); 362 dst_release(dst);
362 return NULL; 363 return NULL;
@@ -953,7 +954,8 @@ static void sock_copy(struct sock *nsk, const struct sock *osk)
953 void *sptr = nsk->sk_security; 954 void *sptr = nsk->sk_security;
954#endif 955#endif
955 BUILD_BUG_ON(offsetof(struct sock, sk_copy_start) != 956 BUILD_BUG_ON(offsetof(struct sock, sk_copy_start) !=
956 sizeof(osk->sk_node) + sizeof(osk->sk_refcnt)); 957 sizeof(osk->sk_node) + sizeof(osk->sk_refcnt) +
958 sizeof(osk->sk_tx_queue_mapping));
957 memcpy(&nsk->sk_copy_start, &osk->sk_copy_start, 959 memcpy(&nsk->sk_copy_start, &osk->sk_copy_start,
958 osk->sk_prot->obj_size - offsetof(struct sock, sk_copy_start)); 960 osk->sk_prot->obj_size - offsetof(struct sock, sk_copy_start));
959#ifdef CONFIG_SECURITY_NETWORK 961#ifdef CONFIG_SECURITY_NETWORK
@@ -997,6 +999,7 @@ static struct sock *sk_prot_alloc(struct proto *prot, gfp_t priority,
997 999
998 if (!try_module_get(prot->owner)) 1000 if (!try_module_get(prot->owner))
999 goto out_free_sec; 1001 goto out_free_sec;
1002 sk_tx_queue_clear(sk);
1000 } 1003 }
1001 1004
1002 return sk; 1005 return sk;