Skip to content

Commit 6179983

Browse files
Gerrit Renkerdavem330
authored andcommitted
[DCCP]: Introducing CCMPS
This introduces a CCMPS field for setting a CCID-specific upper bound on the application payload size, as is defined in RFC 4340, section 14. Only the TX CCID is considered in setting this limit, since the RX CCID generates comparatively small (DCCP-Ack) feedback packets. The CCMPS field includes network and transport layer header lengths. The only current CCMPS customer is CCID4 (via RFC 4828). A wrapper is used to allow querying the CCMPS even at times where the CCID modules may not have been fully negotiated yet. In dccp_sync_mss() the variable `mss_now' has been renamed into `cur_mps', to reflect that we are dealing with an MPS, but not an MSS. Since the DCCP code closely follows the TCP code, the identifiers `dccp_sync_mss' and `dccps_mss_cache' have been kept, as they have direct TCP counterparts. Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk> Signed-off-by: Ian McDonald <ian.mcdonald@jandi.co.nz> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 84a97b0 commit 6179983

2 files changed

Lines changed: 25 additions & 7 deletions

File tree

‎net/dccp/ccid.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ struct tcp_info;
2727
* struct ccid_operations - Interface to Congestion-Control Infrastructure
2828
*
2929
* @ccid_id: numerical CCID ID (up to %CCID_MAX, cf. table 5 in RFC 4340, 10.)
30+
* @ccid_ccmps: the CCMPS including network/transport headers (0 when disabled)
3031
* @ccid_name: alphabetical identifier string for @ccid_id
3132
* @ccid_owner: module which implements/owns this CCID
3233
* @ccid_hc_{r,t}x_slab: memory pool for the receiver/sender half-connection
@@ -45,6 +46,7 @@ struct tcp_info;
4546
*/
4647
struct ccid_operations {
4748
unsigned char ccid_id;
49+
__u32 ccid_ccmps;
4850
const char *ccid_name;
4951
struct module *ccid_owner;
5052
struct kmem_cache *ccid_hc_rx_slab,

‎net/dccp/output.c‎

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,31 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
133133
return -ENOBUFS;
134134
}
135135

136+
/**
137+
* dccp_determine_ccmps - Find out about CCID-specfic packet-size limits
138+
* We only consider the HC-sender CCID for setting the CCMPS (RFC 4340, 14.),
139+
* since the RX CCID is restricted to feedback packets (Acks), which are small
140+
* in comparison with the data traffic. A value of 0 means "no current CCMPS".
141+
*/
142+
static u32 dccp_determine_ccmps(const struct dccp_sock *dp)
143+
{
144+
const struct ccid *tx_ccid = dp->dccps_hc_tx_ccid;
145+
146+
if (tx_ccid == NULL || tx_ccid->ccid_ops == NULL)
147+
return 0;
148+
return tx_ccid->ccid_ops->ccid_ccmps;
149+
}
150+
136151
unsigned int dccp_sync_mss(struct sock *sk, u32 pmtu)
137152
{
138153
struct inet_connection_sock *icsk = inet_csk(sk);
139154
struct dccp_sock *dp = dccp_sk(sk);
140-
int mss_now = (pmtu - icsk->icsk_af_ops->net_header_len -
141-
sizeof(struct dccp_hdr) - sizeof(struct dccp_hdr_ext));
155+
u32 ccmps = dccp_determine_ccmps(dp);
156+
int cur_mps = ccmps ? min(pmtu, ccmps) : pmtu;
142157

143-
/* Now subtract optional transport overhead */
144-
mss_now -= icsk->icsk_ext_hdr_len;
158+
/* Account for header lengths and IPv4/v6 option overhead */
159+
cur_mps -= (icsk->icsk_af_ops->net_header_len + icsk->icsk_ext_hdr_len +
160+
sizeof(struct dccp_hdr) + sizeof(struct dccp_hdr_ext));
145161

146162
/*
147163
* FIXME: this should come from the CCID infrastructure, where, say,
@@ -151,13 +167,13 @@ unsigned int dccp_sync_mss(struct sock *sk, u32 pmtu)
151167
* make it a multiple of 4
152168
*/
153169

154-
mss_now -= ((5 + 6 + 10 + 6 + 6 + 6 + 3) / 4) * 4;
170+
cur_mps -= ((5 + 6 + 10 + 6 + 6 + 6 + 3) / 4) * 4;
155171

156172
/* And store cached results */
157173
icsk->icsk_pmtu_cookie = pmtu;
158-
dp->dccps_mss_cache = mss_now;
174+
dp->dccps_mss_cache = cur_mps;
159175

160-
return mss_now;
176+
return cur_mps;
161177
}
162178

163179
EXPORT_SYMBOL_GPL(dccp_sync_mss);

0 commit comments

Comments
 (0)