Commit 25450a8d authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

[TCP]: use const in tcp.h

Signed-off-by: default avatarStephen Hemminger <shemminger@osdl.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a9d9697a
...@@ -961,8 +961,8 @@ extern void tcp_send_delayed_ack(struct sock *sk); ...@@ -961,8 +961,8 @@ extern void tcp_send_delayed_ack(struct sock *sk);
extern void tcp_init_xmit_timers(struct sock *); extern void tcp_init_xmit_timers(struct sock *);
extern void tcp_clear_xmit_timers(struct sock *); extern void tcp_clear_xmit_timers(struct sock *);
extern void tcp_delete_keepalive_timer (struct sock *); extern void tcp_delete_keepalive_timer(struct sock *);
extern void tcp_reset_keepalive_timer (struct sock *, unsigned long); extern void tcp_reset_keepalive_timer(struct sock *, unsigned long);
extern unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu); extern unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu);
extern unsigned int tcp_current_mss(struct sock *sk, int large); extern unsigned int tcp_current_mss(struct sock *sk, int large);
...@@ -1083,7 +1083,7 @@ static inline void tcp_fast_path_check(struct sock *sk, struct tcp_opt *tp) ...@@ -1083,7 +1083,7 @@ static inline void tcp_fast_path_check(struct sock *sk, struct tcp_opt *tp)
* Rcv_nxt can be after the window if our peer push more data * Rcv_nxt can be after the window if our peer push more data
* than the offered window. * than the offered window.
*/ */
static __inline__ u32 tcp_receive_window(struct tcp_opt *tp) static __inline__ u32 tcp_receive_window(const struct tcp_opt *tp)
{ {
s32 win = tp->rcv_wup + tp->rcv_wnd - tp->rcv_nxt; s32 win = tp->rcv_wup + tp->rcv_wnd - tp->rcv_nxt;
...@@ -1161,18 +1161,19 @@ struct tcp_skb_cb { ...@@ -1161,18 +1161,19 @@ struct tcp_skb_cb {
/* Due to TSO, an SKB can be composed of multiple actual /* Due to TSO, an SKB can be composed of multiple actual
* packets. To keep these tracked properly, we use this. * packets. To keep these tracked properly, we use this.
*/ */
static inline int tcp_skb_pcount(struct sk_buff *skb) static inline int tcp_skb_pcount(const struct sk_buff *skb)
{ {
return skb_shinfo(skb)->tso_segs; return skb_shinfo(skb)->tso_segs;
} }
/* This is valid iff tcp_skb_pcount() > 1. */ /* This is valid iff tcp_skb_pcount() > 1. */
static inline int tcp_skb_mss(struct sk_buff *skb) static inline int tcp_skb_mss(const struct sk_buff *skb)
{ {
return skb_shinfo(skb)->tso_size; return skb_shinfo(skb)->tso_size;
} }
static inline void tcp_inc_pcount(tcp_pcount_t *count, struct sk_buff *skb) static inline void tcp_inc_pcount(tcp_pcount_t *count,
const struct sk_buff *skb)
{ {
count->val += tcp_skb_pcount(skb); count->val += tcp_skb_pcount(skb);
} }
...@@ -1187,13 +1188,14 @@ static inline void tcp_dec_pcount_explicit(tcp_pcount_t *count, int amt) ...@@ -1187,13 +1188,14 @@ static inline void tcp_dec_pcount_explicit(tcp_pcount_t *count, int amt)
count->val -= amt; count->val -= amt;
} }
static inline void tcp_dec_pcount(tcp_pcount_t *count, struct sk_buff *skb) static inline void tcp_dec_pcount(tcp_pcount_t *count,
const struct sk_buff *skb)
{ {
count->val -= tcp_skb_pcount(skb); count->val -= tcp_skb_pcount(skb);
} }
static inline void tcp_dec_pcount_approx(tcp_pcount_t *count, static inline void tcp_dec_pcount_approx(tcp_pcount_t *count,
struct sk_buff *skb) const struct sk_buff *skb)
{ {
if (count->val) { if (count->val) {
count->val -= tcp_skb_pcount(skb); count->val -= tcp_skb_pcount(skb);
...@@ -1202,7 +1204,7 @@ static inline void tcp_dec_pcount_approx(tcp_pcount_t *count, ...@@ -1202,7 +1204,7 @@ static inline void tcp_dec_pcount_approx(tcp_pcount_t *count,
} }
} }
static inline __u32 tcp_get_pcount(tcp_pcount_t *count) static inline __u32 tcp_get_pcount(const tcp_pcount_t *count)
{ {
return count->val; return count->val;
} }
...@@ -1212,8 +1214,9 @@ static inline void tcp_set_pcount(tcp_pcount_t *count, __u32 val) ...@@ -1212,8 +1214,9 @@ static inline void tcp_set_pcount(tcp_pcount_t *count, __u32 val)
count->val = val; count->val = val;
} }
static inline void tcp_packets_out_inc(struct sock *sk, struct tcp_opt *tp, static inline void tcp_packets_out_inc(struct sock *sk,
struct sk_buff *skb) struct tcp_opt *tp,
const struct sk_buff *skb)
{ {
int orig = tcp_get_pcount(&tp->packets_out); int orig = tcp_get_pcount(&tp->packets_out);
...@@ -1222,7 +1225,8 @@ static inline void tcp_packets_out_inc(struct sock *sk, struct tcp_opt *tp, ...@@ -1222,7 +1225,8 @@ static inline void tcp_packets_out_inc(struct sock *sk, struct tcp_opt *tp,
tcp_reset_xmit_timer(sk, TCP_TIME_RETRANS, tp->rto); tcp_reset_xmit_timer(sk, TCP_TIME_RETRANS, tp->rto);
} }
static inline void tcp_packets_out_dec(struct tcp_opt *tp, struct sk_buff *skb) static inline void tcp_packets_out_dec(struct tcp_opt *tp,
const struct sk_buff *skb)
{ {
tcp_dec_pcount(&tp->packets_out, skb); tcp_dec_pcount(&tp->packets_out, skb);
} }
...@@ -1241,7 +1245,7 @@ static inline void tcp_packets_out_dec(struct tcp_opt *tp, struct sk_buff *skb) ...@@ -1241,7 +1245,7 @@ static inline void tcp_packets_out_dec(struct tcp_opt *tp, struct sk_buff *skb)
* "Packets left network, but not honestly ACKed yet" PLUS * "Packets left network, but not honestly ACKed yet" PLUS
* "Packets fast retransmitted" * "Packets fast retransmitted"
*/ */
static __inline__ unsigned int tcp_packets_in_flight(struct tcp_opt *tp) static __inline__ unsigned int tcp_packets_in_flight(const struct tcp_opt *tp)
{ {
return (tcp_get_pcount(&tp->packets_out) - return (tcp_get_pcount(&tp->packets_out) -
tcp_get_pcount(&tp->left_out) + tcp_get_pcount(&tp->left_out) +
...@@ -1408,18 +1412,19 @@ extern __u32 tcp_init_cwnd(struct tcp_opt *tp, struct dst_entry *dst); ...@@ -1408,18 +1412,19 @@ extern __u32 tcp_init_cwnd(struct tcp_opt *tp, struct dst_entry *dst);
/* Slow start with delack produces 3 packets of burst, so that /* Slow start with delack produces 3 packets of burst, so that
* it is safe "de facto". * it is safe "de facto".
*/ */
static __inline__ __u32 tcp_max_burst(struct tcp_opt *tp) static __inline__ __u32 tcp_max_burst(const struct tcp_opt *tp)
{ {
return 3; return 3;
} }
static __inline__ int tcp_minshall_check(struct tcp_opt *tp) static __inline__ int tcp_minshall_check(const struct tcp_opt *tp)
{ {
return after(tp->snd_sml,tp->snd_una) && return after(tp->snd_sml,tp->snd_una) &&
!after(tp->snd_sml, tp->snd_nxt); !after(tp->snd_sml, tp->snd_nxt);
} }
static __inline__ void tcp_minshall_update(struct tcp_opt *tp, int mss, struct sk_buff *skb) static __inline__ void tcp_minshall_update(struct tcp_opt *tp, int mss,
const struct sk_buff *skb)
{ {
if (skb->len < mss) if (skb->len < mss)
tp->snd_sml = TCP_SKB_CB(skb)->end_seq; tp->snd_sml = TCP_SKB_CB(skb)->end_seq;
...@@ -1434,7 +1439,8 @@ static __inline__ void tcp_minshall_update(struct tcp_opt *tp, int mss, struct s ...@@ -1434,7 +1439,8 @@ static __inline__ void tcp_minshall_update(struct tcp_opt *tp, int mss, struct s
*/ */
static __inline__ int static __inline__ int
tcp_nagle_check(struct tcp_opt *tp, struct sk_buff *skb, unsigned mss_now, int nonagle) tcp_nagle_check(const struct tcp_opt *tp, const struct sk_buff *skb,
unsigned mss_now, int nonagle)
{ {
return (skb->len < mss_now && return (skb->len < mss_now &&
!(TCP_SKB_CB(skb)->flags & TCPCB_FLAG_FIN) && !(TCP_SKB_CB(skb)->flags & TCPCB_FLAG_FIN) &&
...@@ -1449,7 +1455,8 @@ extern void tcp_set_skb_tso_segs(struct sk_buff *, unsigned int); ...@@ -1449,7 +1455,8 @@ extern void tcp_set_skb_tso_segs(struct sk_buff *, unsigned int);
/* This checks if the data bearing packet SKB (usually sk->sk_send_head) /* This checks if the data bearing packet SKB (usually sk->sk_send_head)
* should be put on the wire right now. * should be put on the wire right now.
*/ */
static __inline__ int tcp_snd_test(struct tcp_opt *tp, struct sk_buff *skb, static __inline__ int tcp_snd_test(const struct tcp_opt *tp,
struct sk_buff *skb,
unsigned cur_mss, int nonagle) unsigned cur_mss, int nonagle)
{ {
int pkts = tcp_skb_pcount(skb); int pkts = tcp_skb_pcount(skb);
...@@ -1496,7 +1503,8 @@ static __inline__ void tcp_check_probe_timer(struct sock *sk, struct tcp_opt *tp ...@@ -1496,7 +1503,8 @@ static __inline__ void tcp_check_probe_timer(struct sock *sk, struct tcp_opt *tp
tcp_reset_xmit_timer(sk, TCP_TIME_PROBE0, tp->rto); tcp_reset_xmit_timer(sk, TCP_TIME_PROBE0, tp->rto);
} }
static __inline__ int tcp_skb_is_last(struct sock *sk, struct sk_buff *skb) static __inline__ int tcp_skb_is_last(const struct sock *sk,
const struct sk_buff *skb)
{ {
return skb->next == (struct sk_buff *)&sk->sk_write_queue; return skb->next == (struct sk_buff *)&sk->sk_write_queue;
} }
...@@ -1621,7 +1629,7 @@ static __inline__ int tcp_prequeue(struct sock *sk, struct sk_buff *skb) ...@@ -1621,7 +1629,7 @@ static __inline__ int tcp_prequeue(struct sock *sk, struct sk_buff *skb)
#undef STATE_TRACE #undef STATE_TRACE
#ifdef STATE_TRACE #ifdef STATE_TRACE
static char *statename[]={ static const char *statename[]={
"Unused","Established","Syn Sent","Syn Recv", "Unused","Established","Syn Sent","Syn Recv",
"Fin Wait 1","Fin Wait 2","Time Wait", "Close", "Fin Wait 1","Fin Wait 2","Time Wait", "Close",
"Close Wait","Last ACK","Listen","Closing" "Close Wait","Last ACK","Listen","Closing"
...@@ -1892,17 +1900,17 @@ static inline void tcp_listen_unlock(void) ...@@ -1892,17 +1900,17 @@ static inline void tcp_listen_unlock(void)
wake_up(&tcp_lhash_wait); wake_up(&tcp_lhash_wait);
} }
static inline int keepalive_intvl_when(struct tcp_opt *tp) static inline int keepalive_intvl_when(const struct tcp_opt *tp)
{ {
return tp->keepalive_intvl ? : sysctl_tcp_keepalive_intvl; return tp->keepalive_intvl ? : sysctl_tcp_keepalive_intvl;
} }
static inline int keepalive_time_when(struct tcp_opt *tp) static inline int keepalive_time_when(const struct tcp_opt *tp)
{ {
return tp->keepalive_time ? : sysctl_tcp_keepalive_time; return tp->keepalive_time ? : sysctl_tcp_keepalive_time;
} }
static inline int tcp_fin_time(struct tcp_opt *tp) static inline int tcp_fin_time(const struct tcp_opt *tp)
{ {
int fin_timeout = tp->linger2 ? : sysctl_tcp_fin_timeout; int fin_timeout = tp->linger2 ? : sysctl_tcp_fin_timeout;
...@@ -1912,7 +1920,7 @@ static inline int tcp_fin_time(struct tcp_opt *tp) ...@@ -1912,7 +1920,7 @@ static inline int tcp_fin_time(struct tcp_opt *tp)
return fin_timeout; return fin_timeout;
} }
static inline int tcp_paws_check(struct tcp_opt *tp, int rst) static inline int tcp_paws_check(const struct tcp_opt *tp, int rst)
{ {
if ((s32)(tp->rcv_tsval - tp->ts_recent) >= 0) if ((s32)(tp->rcv_tsval - tp->ts_recent) >= 0)
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment