Commit Graph

80 Commits

Author SHA1 Message Date
Arnaldo Carvalho de Melo 88f964db6e [DCCP]: Introduce CCID getsockopt for the CCIDs
Allocation for the optnames is similar to the DCCP options, with a
range for rx and tx half connection CCIDs.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-09-18 00:19:32 -07:00
Arnaldo Carvalho de Melo 561713cf47 [DCCP]: Don't use necessarily the same CCID for tx and rx
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-09-18 00:18:52 -07:00
Arnaldo Carvalho de Melo 65299d6c3c [CCID3]: Introduce include/linux/tfrc.h
Moving the TFRC sender and receiver variables to separate structs, so
that we can copy these structs to userspace thru getsockopt,
dccp_diag, etc.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-09-18 00:18:32 -07:00
Arnaldo Carvalho de Melo ae31c3399d [DCCP]: Move the ack vector code to net/dccp/ackvec.[ch]
Isolating it, that will be used when we introduce a CCID2 (TCP-Like)
implementation.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-09-18 00:17:51 -07:00
Arnaldo Carvalho de Melo 67e6b62921 [DCCP]: Introduce DCCP_SOCKOPT_SERVICE
As discussed in the dccp@vger mailing list:

Now applications have to use setsockopt(DCCP_SOCKOPT_SERVICE, service[s]),
prior to calling listen() and connect().

An array of unsigned ints can be passed meaning that the listening sock accepts
connection requests for several services.

With this we can ditch struct sockaddr_dccp and use only sockaddr_in (and
sockaddr_in6 in the future).

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-09-16 16:58:40 -07:00
Arnaldo Carvalho de Melo 0c10c5d968 [DCCP]: More precisely set reset_code when sending RESET packets
Moving the setting of DCCP_SKB_CB(skb)->dccpd_reset_code to the places
where events happen that trigger sending a RESET packet.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-09-16 16:58:33 -07:00
Arnaldo Carvalho de Melo 2b80230a7f [DCCP]: Handle SYNC packets in dccp_rcv_state_process
Eliciting a SYNCACK in response, we were handling SYNC packets
only in the DCCP_OPEN state, in dccp_rcv_established.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2005-09-13 19:05:08 -03:00
Arnaldo Carvalho de Melo 811265b8e8 [DCCP]: Check if already in the CLOSING state in dccp_rcv_closereq
It is possible to receive more than one CLOSEREQ packet if the
CLOSE packet sent in response is somehow lost, change the state
to DCCP_CLOSING only on the first CLOSEREQ packet received.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2005-09-13 19:03:15 -03:00
Arnaldo Carvalho de Melo 59c2353dd0 [CCID3]: Listen socks doesn't have a private CCID block
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-09-12 14:16:58 -07:00
Arnaldo Carvalho de Melo 59d203f9e9 [CCID3] Cleanup ccid3 debug calls
Also use some BUG_ON where appropriate and use LIMIT_NETDEBUG for the unlikely
cases where we, at this stage, want to know about, that in my tests hasn't
appeared in the radar.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2005-09-09 20:01:25 -03:00
Arnaldo Carvalho de Melo dc19336c76 [DCCP] Only call the HC _exit() routines in dccp_v4_destroy_sock
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2005-09-09 19:59:26 -03:00
Arnaldo Carvalho de Melo d7e0fb985c [CCID3] Initialize ccid3hctx_t_ipi to 250ms
To match more closely what is described in RFC 3448.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: Ian McDonald <iam4@cs.waikato.ac.nz>
2005-09-09 19:58:18 -03:00
Arnaldo Carvalho de Melo 59725dc2a2 [CCID3] Introduce ccid3_hc_[rt]x_sk() for overal consistency
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2005-09-09 02:40:58 -03:00
Arnaldo Carvalho de Melo b0e567806d [DCCP] Introduce dccp_timestamp
To start the timestamps with 0.0ms, easing the integer maths in the CCIDs, this
probably will be reworked to use the to be introduced struct timeval_offset
infrastructure out of skb_get_timestamp, etc.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2005-09-09 02:38:35 -03:00
Arnaldo Carvalho de Melo 954ee31f36 [CCID3] Initialize more fields in ccid3_hc_rx_init
The initialization of ccid3hcrx_rtt to 5ms is just a bandaid, I'll continue
auditing the CCID3 HC rx codebase to fix this properly, probably I'll add a
feedback timer as suggested in the CCID3 draft.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2005-09-09 02:37:05 -03:00
Arnaldo Carvalho de Melo b3a3077d96 [CCID3] Make the ccid3hcrx_rtt calc look more like the ccid3hctx_rtt one
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2005-09-09 02:34:10 -03:00
Arnaldo Carvalho de Melo 1a28599a2c [CCID3] Use ELAPSED_TIME in the HC TX RTT estimation
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2005-09-09 02:32:56 -03:00
Arnaldo Carvalho de Melo 1c14ac0ae8 [DCCP] Give precedence to the biggest ELAPSED_TIME
We can get this value in an TIMESTAMP_ECHO and/or in an ELAPSED_TIME option, if
receiving both give precendence to the biggest one.

In my tests they are very close if not equal at all times, so we may well think
about removing the code in CCID3 that inserts this option and leaving this to
the core, and perhaps even use just TIMESTAMP_ECHO including the elapsed time.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2005-09-09 02:32:01 -03:00
Arnaldo Carvalho de Melo 27ae543e6f [CCID3] Calculate ccid3hcrx_x_recv using usecs_div
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2005-09-09 02:31:07 -03:00
Arnaldo Carvalho de Melo 507d37cf26 [CCID] Only call the HC insert_options methods when requested
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2005-09-09 02:30:07 -03:00
Arnaldo Carvalho de Melo 0ba7a3ba66 [CCID3] Avoid unsigned integer overflows in usecs_div
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2005-09-09 02:28:47 -03:00
Arnaldo Carvalho de Melo c530cfb1ce [CCID3]: Call sk->sk_write_space(sk) when receiving a feedback packet
This makes the send rate calculations behave way more closely to what
is specified, with the jitter previously seen on x and x_recv
disappearing completely on non lossy setups.

This resembles the tcp_data_snd_check code, that possibly we'll end up
using in DCCP as well, perhaps moving this code to
inet_connection_sock.

For now I'm doing the simplest implementation tho.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:13:46 -07:00
Arnaldo Carvalho de Melo a84ffe4303 [DCCP]: Introduce DCCP_SOCKOPT_PACKET_SIZE
So that applications can set dccp_sock->dccps_pkt_size, that in turn
is used in the CCID3 half connection init routines to set
ccid3hc[tr]x_s and use it in its rate calculations.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:13:37 -07:00
Arnaldo Carvalho de Melo 29e4f8b3c3 [CCID3]: Move ccid3_hc_rx_detect_loss to packet_history.c
Renaming it to dccp_rx_hist_detect_loss.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:13:17 -07:00
Arnaldo Carvalho de Melo 072ab6c68e [CCID3]: Move ccid3_hc_rx_add_hist to packet_history.c
Renaming it to dccp_rx_hist_add_packet.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:13:10 -07:00
Arnaldo Carvalho de Melo 36729c1a73 [DCCP]: Move the calc_X routines to dccp_tfrc_lib
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:12:47 -07:00
Arnaldo Carvalho de Melo 5cea0ddce5 [DCCP]: Introduce dccp_tfrc_lib module with net/dccp/ccids/lib/*.c
I'll now take a look at the other proposed TFRC DCCP CCIDs to find
more code that is now in ccid3.c and move to this module, the loss
event rate, calc_X, etc most probably will be moved there.

The main goal of these changes is to pave the way for the
implementation of more TFRC based DCCP CCIDs and to shrink ccid3.c,
reducing its complexity and helping in getting it rock solid.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:12:33 -07:00
Arnaldo Carvalho de Melo 4524b25954 [DCCP]: Just move packet_history.[ch] to net/dccp/ccids/lib/
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:12:25 -07:00
Arnaldo Carvalho de Melo ae6706f067 [CCID3]: Move the loss interval code to loss_interval.[ch]
And put this into net/dccp/ccids/lib/, where packet_history.[ch] will also be
moved and then we'll have a tfrc_lib.ko module that will be used by
dccp_ccid3.ko and other CCIDs that are variations of TFRC (RFC 3448).

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:12:17 -07:00
Arnaldo Carvalho de Melo cfc3c525a3 [CCID3]: Move the CCID3 defines to ccid3.h
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:12:10 -07:00
Arnaldo Carvalho de Melo 6b5e633ab1 [CCID3]: Introduce usecs_div
To avoid open coding this all over the place.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:12:03 -07:00
Arnaldo Carvalho de Melo b6ee3d4ada [CCID3]: Reorganise timeval handling
Introducing functions to add to or subtract from a timeval variable
and renaming now_delta to timeval_new_delta that calls do_gettimeofday
and then timeval_delta, that should be used when there are several
deltas made relative to the current time or setting variables to it,
so as to avoid calling do_gettimeofday excessively.

I'm leaving these "timeval_" prefixed funcions internal to DCCP for a
while till we're sure there are no subtle bugs in it.

It also is more correct as it checks if the number of usecs added to
or subtracted from a tv_usec field is more than 2 seconds.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:11:56 -07:00
Arnaldo Carvalho de Melo 1f2333aea3 [CCID3]: Reflow to mostly fit under 80 columns
No code changes.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:11:46 -07:00
Arnaldo Carvalho de Melo d6809c12b3 [DCCP]: Introduce dccp_wait_for_ccid and use it in dccp_write_xmit
This is not quite what I think we should have long term but improves
performance for now, so lets use it till we get CCID3 working well,
then we can think about using sk_write_queue, perhaps using some ideas
from Juwen Lai's old stack for 2.4.20.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:11:38 -07:00
Arnaldo Carvalho de Melo 75b3f207b4 [DCCP]: Make the Debug Menu available when DCCP is statically linked too
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:11:27 -07:00
Eric Dumazet ba89966c19 [NET]: use __read_mostly on kmem_cache_t , DEFINE_SNMP_STAT pointers
This patch puts mostly read only data in the right section
(read_mostly), to help sharing of these data between CPUS without
memory ping pongs.

On one of my production machine, tcp_statistics was sitting in a
heavily modified cache line, so *every* SNMP update had to force a
reload.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:11:18 -07:00
Arnaldo Carvalho de Melo 331968bd0c [DCCP]: Initial dccp_poll implementation
Tested with a patched netcat, no horror stories so far 8)

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:05:45 -07:00
Arnaldo Carvalho de Melo 8efa544f9c [DCCP]: Call the HC exit routines at dccp_v4_destroy_sock
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:05:38 -07:00
Arnaldo Carvalho de Melo 2babe1f6fe [DCCP]: Introduce dccp_get_info
And also hc_tx and hc_rx get_info functions for the CCIDs to fill in
information that is specific to them.

For now reusing struct tcp_info, later I'll try to figure out a better
solution, for now its really nice to get this kind of info:

[root@qemu ~]# ./ss -danemi
State       Recv-Q Send-Q  Local Addr:Port  Peer Addr:Port
LISTEN      0      0                *:5001          *:*     ino:628 sk:c1340040
         mem:(r0,w0,f0,t0) cwnd:0 ssthresh:0
ESTAB       0      0       172.20.0.2:5001 172.20.0.1:32785 ino:629 sk:c13409a0
         mem:(r0,w0,f0,t0) ts rto:1000 rtt:0.004/0 cwnd:0 ssthresh:0 rcv_rtt:61.377

This, for instance, shows that we're not congestion controlling ACKs,
as the above output is in the ttcp receiving host, and ttcp is a one
way app, i.e. the received never calls sendmsg, so
ccid_hc_tx_send_packet is never called, so the TX half connection
stays in TFRC_SSTATE_NO_SENT state and hctx_rtt is never calculated,
stays with the value set in ccid3_hc_tx_init, 4us, as show above in
milliseconds (0.004ms), upcoming patches will fix this.

rcv_rtt seems sane tho, matching ping results :-)

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:05:07 -07:00
Arnaldo Carvalho de Melo 4fded33b3e [CCID3]: Calculate the RTT in the RX half connection
Using TIMESTAMP_ECHO and ELAPSED_TIME options received.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:05:01 -07:00
Arnaldo Carvalho de Melo d4b81ff705 [DCCP]: Export dccp_insert_option_timestamp to CCIDs
And don't insert a TIMESTAMP option in all packets, leave the decision
to the CCIDs.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:04:53 -07:00
Arnaldo Carvalho de Melo 012e13eac7 [CCID]: Make ccid_hc_[rt]x_exit accept NULL arguments
Just like kfree, etc it will just not call the CCID exit
routines when the private data area is set to NULL.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:04:48 -07:00
Arnaldo Carvalho de Melo a4beb1b64f [DCCP]: Send a DATAACK packet when we have a TIMESTAMP_ECHO pending
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:04:43 -07:00
Arnaldo Carvalho de Melo 20472af986 [DCCP]: Fix skb leak in dccp_sendmsg
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:04:38 -07:00
Arnaldo Carvalho de Melo 7ad07e7cf3 [DCCP]: Implement the CLOSING timer
So that we retransmit CLOSE/CLOSEREQ packets till they elicit an
answer or we hit a timeout.

Most of the machinery uses TCP approaches, this code has to be
polished & audited, but this is better than we had before.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:04:31 -07:00
David S. Miller 58e45131dc [DCCP]: Fix printf format warnings on 64-bit.
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:04:27 -07:00
Arnaldo Carvalho de Melo 24117727b7 [DCCP]: Fix ackno setting in SYNC/SYNCACK packets
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:03:52 -07:00
Arnaldo Carvalho de Melo 03ace394ac [DCCP]: Fix the ACK and SEQ window variables settings
This is from a first audit, more eyeballs are more than welcome.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:03:42 -07:00
Arnaldo Carvalho de Melo a3054d48b9 [DCCP]: Give more info on Step 6 failure debug printk
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:03:33 -07:00
Arnaldo Carvalho de Melo 2807d4ffb0 [DCCP]: Fix seqno setting in dccp_v4_ctl_send_reset
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-08-29 16:03:25 -07:00