/*1* Copyright (c) 2005 Andrea Bittau <[email protected]>2*3* This program is free software; you can redistribute it and/or modify4* it under the terms of the GNU General Public License as published by5* the Free Software Foundation; either version 2 of the License, or6* (at your option) any later version.7*8* This program is distributed in the hope that it will be useful,9* but WITHOUT ANY WARRANTY; without even the implied warranty of10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11* GNU General Public License for more details.12*13* You should have received a copy of the GNU General Public License14* along with this program; if not, write to the Free Software15* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.16*/17#ifndef _DCCP_CCID2_H_18#define _DCCP_CCID2_H_1920#include <linux/timer.h>21#include <linux/types.h>22#include "../ccid.h"23#include "../dccp.h"2425/*26* CCID-2 timestamping faces the same issues as TCP timestamping.27* Hence we reuse/share as much of the code as possible.28*/29#define ccid2_time_stamp tcp_time_stamp3031/* NUMDUPACK parameter from RFC 4341, p. 6 */32#define NUMDUPACK 33334struct ccid2_seq {35u64 ccid2s_seq;36u32 ccid2s_sent;37int ccid2s_acked;38struct ccid2_seq *ccid2s_prev;39struct ccid2_seq *ccid2s_next;40};4142#define CCID2_SEQBUF_LEN 102443#define CCID2_SEQBUF_MAX 1284445/**46* struct ccid2_hc_tx_sock - CCID2 TX half connection47* @tx_{cwnd,ssthresh,pipe}: as per RFC 4341, section 548* @tx_packets_acked: Ack counter for deriving cwnd growth (RFC 3465)49* @tx_srtt: smoothed RTT estimate, scaled by 2^350* @tx_mdev: smoothed RTT variation, scaled by 2^251* @tx_mdev_max: maximum of @mdev during one flight52* @tx_rttvar: moving average/maximum of @mdev_max53* @tx_rto: RTO value deriving from SRTT and RTTVAR (RFC 2988)54* @tx_rtt_seq: to decay RTTVAR at most once per flight55* @tx_rpseq: last consecutive seqno56* @tx_rpdupack: dupacks since rpseq57* @tx_av_chunks: list of Ack Vectors received on current skb58*/59struct ccid2_hc_tx_sock {60u32 tx_cwnd;61u32 tx_ssthresh;62u32 tx_pipe;63u32 tx_packets_acked;64struct ccid2_seq *tx_seqbuf[CCID2_SEQBUF_MAX];65int tx_seqbufc;66struct ccid2_seq *tx_seqh;67struct ccid2_seq *tx_seqt;6869/* RTT measurement: variables/principles are the same as in TCP */70u32 tx_srtt,71tx_mdev,72tx_mdev_max,73tx_rttvar,74tx_rto;75u64 tx_rtt_seq:48;76struct timer_list tx_rtotimer;7778u64 tx_rpseq;79int tx_rpdupack;80u32 tx_last_cong;81u64 tx_high_ack;82struct list_head tx_av_chunks;83};8485static inline bool ccid2_cwnd_network_limited(struct ccid2_hc_tx_sock *hc)86{87return hc->tx_pipe >= hc->tx_cwnd;88}8990struct ccid2_hc_rx_sock {91int rx_data;92};9394static inline struct ccid2_hc_tx_sock *ccid2_hc_tx_sk(const struct sock *sk)95{96return ccid_priv(dccp_sk(sk)->dccps_hc_tx_ccid);97}9899static inline struct ccid2_hc_rx_sock *ccid2_hc_rx_sk(const struct sock *sk)100{101return ccid_priv(dccp_sk(sk)->dccps_hc_rx_ccid);102}103#endif /* _DCCP_CCID2_H_ */104105106