aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_input.c
diff options
context:
space:
mode:
authorSatoru SATOH <satoru.satoh@gmail.com>2008-05-05 01:14:42 -0400
committerDavid S. Miller <davem@davemloft.net>2008-05-05 01:14:42 -0400
commit5ffc02a158997b1eb91ade8d02bcf521ff79a218 (patch)
tree80f9082f9a35c974236b20053ae4946523311ea3 /net/ipv4/tcp_input.c
parent0bbeafd0118fc3ae54990064760c889d41dc21d6 (diff)
ip: Use inline function dst_metric() instead of direct access to dst->metric[]
There are functions to refer to the value of dst->metric[THE_METRIC-1] directly without use of a inline function "dst_metric" defined in net/dst.h. The following patch changes them to use the inline function consistently. Signed-off-by: Satoru SATOH <satoru.satoh@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r--net/ipv4/tcp_input.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index eda4f4a233f3..8ac15a604e08 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -66,6 +66,7 @@
66#include <linux/mm.h> 66#include <linux/mm.h>
67#include <linux/module.h> 67#include <linux/module.h>
68#include <linux/sysctl.h> 68#include <linux/sysctl.h>
69#include <net/dst.h>
69#include <net/tcp.h> 70#include <net/tcp.h>
70#include <net/inet_common.h> 71#include <net/inet_common.h>
71#include <linux/ipsec.h> 72#include <linux/ipsec.h>
@@ -605,7 +606,7 @@ static u32 tcp_rto_min(struct sock *sk)
605 u32 rto_min = TCP_RTO_MIN; 606 u32 rto_min = TCP_RTO_MIN;
606 607
607 if (dst && dst_metric_locked(dst, RTAX_RTO_MIN)) 608 if (dst && dst_metric_locked(dst, RTAX_RTO_MIN))
608 rto_min = dst->metrics[RTAX_RTO_MIN - 1]; 609 rto_min = dst_metric(dst, RTAX_RTO_MIN);
609 return rto_min; 610 return rto_min;
610} 611}
611 612
@@ -769,7 +770,7 @@ void tcp_update_metrics(struct sock *sk)
769 dst->metrics[RTAX_RTTVAR - 1] = m; 770 dst->metrics[RTAX_RTTVAR - 1] = m;
770 else 771 else
771 dst->metrics[RTAX_RTTVAR-1] -= 772 dst->metrics[RTAX_RTTVAR-1] -=
772 (dst->metrics[RTAX_RTTVAR-1] - m)>>2; 773 (dst_metric(dst, RTAX_RTTVAR) - m)>>2;
773 } 774 }
774 775
775 if (tp->snd_ssthresh >= 0xFFFF) { 776 if (tp->snd_ssthresh >= 0xFFFF) {
@@ -788,21 +789,21 @@ void tcp_update_metrics(struct sock *sk)
788 dst->metrics[RTAX_SSTHRESH-1] = 789 dst->metrics[RTAX_SSTHRESH-1] =
789 max(tp->snd_cwnd >> 1, tp->snd_ssthresh); 790 max(tp->snd_cwnd >> 1, tp->snd_ssthresh);
790 if (!dst_metric_locked(dst, RTAX_CWND)) 791 if (!dst_metric_locked(dst, RTAX_CWND))
791 dst->metrics[RTAX_CWND-1] = (dst->metrics[RTAX_CWND-1] + tp->snd_cwnd) >> 1; 792 dst->metrics[RTAX_CWND-1] = (dst_metric(dst, RTAX_CWND) + tp->snd_cwnd) >> 1;
792 } else { 793 } else {
793 /* Else slow start did not finish, cwnd is non-sense, 794 /* Else slow start did not finish, cwnd is non-sense,
794 ssthresh may be also invalid. 795 ssthresh may be also invalid.
795 */ 796 */
796 if (!dst_metric_locked(dst, RTAX_CWND)) 797 if (!dst_metric_locked(dst, RTAX_CWND))
797 dst->metrics[RTAX_CWND-1] = (dst->metrics[RTAX_CWND-1] + tp->snd_ssthresh) >> 1; 798 dst->metrics[RTAX_CWND-1] = (dst_metric(dst, RTAX_CWND) + tp->snd_ssthresh) >> 1;
798 if (dst->metrics[RTAX_SSTHRESH-1] && 799 if (dst_metric(dst, RTAX_SSTHRESH) &&
799 !dst_metric_locked(dst, RTAX_SSTHRESH) && 800 !dst_metric_locked(dst, RTAX_SSTHRESH) &&
800 tp->snd_ssthresh > dst->metrics[RTAX_SSTHRESH-1]) 801 tp->snd_ssthresh > dst_metric(dst, RTAX_SSTHRESH))
801 dst->metrics[RTAX_SSTHRESH-1] = tp->snd_ssthresh; 802 dst->metrics[RTAX_SSTHRESH-1] = tp->snd_ssthresh;
802 } 803 }
803 804
804 if (!dst_metric_locked(dst, RTAX_REORDERING)) { 805 if (!dst_metric_locked(dst, RTAX_REORDERING)) {
805 if (dst->metrics[RTAX_REORDERING-1] < tp->reordering && 806 if (dst_metric(dst, RTAX_REORDERING) < tp->reordering &&
806 tp->reordering != sysctl_tcp_reordering) 807 tp->reordering != sysctl_tcp_reordering)
807 dst->metrics[RTAX_REORDERING-1] = tp->reordering; 808 dst->metrics[RTAX_REORDERING-1] = tp->reordering;
808 } 809 }