net-tcp: add new ca opts flag TCP_CONG_WANTS_CE_EVENTS

Add a a new ca opts flag TCP_CONG_WANTS_CE_EVENTS that allows a
congestion control module to receive CE events.

Currently congestion control modules have to set the TCP_CONG_NEEDS_ECN
bit in opts flag to receive CE events but this may incur changes in ECN
behavior elsewhere. This patch adds a new bit TCP_CONG_WANTS_CE_EVENTS
that allows congestion control modules to receive CE events
independently of TCP_CONG_NEEDS_ECN.

Effort: net-tcp
Origin-9xx-SHA1: 9f7e14716cde760bc6c67ef8ef7e1ee48501d95b
Change-Id: I2255506985242f376d910c6fd37daabaf4744f24
Signed-off-by: Juhyung Park <qkrwngud825@gmail.com>
This commit is contained in:
Yousuk Seung 2018-05-23 17:55:54 -07:00 committed by Ksawlii
parent 54113b9ad5
commit f1bd4e759f
2 changed files with 15 additions and 3 deletions

View file

@ -1044,7 +1044,11 @@ enum tcp_ca_ack_event_flags {
#define TCP_CONG_NON_RESTRICTED 0x1 #define TCP_CONG_NON_RESTRICTED 0x1
/* Requires ECN/ECT set on all packets */ /* Requires ECN/ECT set on all packets */
#define TCP_CONG_NEEDS_ECN 0x2 #define TCP_CONG_NEEDS_ECN 0x2
#define TCP_CONG_MASK (TCP_CONG_NON_RESTRICTED | TCP_CONG_NEEDS_ECN) /* Wants notification of CE events (CA_EVENT_ECN_IS_CE, CA_EVENT_ECN_NO_CE). */
#define TCP_CONG_WANTS_CE_EVENTS 0x4
#define TCP_CONG_MASK (TCP_CONG_NON_RESTRICTED | \
TCP_CONG_NEEDS_ECN | \
TCP_CONG_WANTS_CE_EVENTS)
union tcp_cc_info; union tcp_cc_info;
@ -1152,6 +1156,14 @@ static inline char *tcp_ca_get_name_by_key(u32 key, char *buffer)
} }
#endif #endif
static inline bool tcp_ca_wants_ce_events(const struct sock *sk)
{
const struct inet_connection_sock *icsk = inet_csk(sk);
return icsk->icsk_ca_ops->flags & (TCP_CONG_NEEDS_ECN |
TCP_CONG_WANTS_CE_EVENTS);
}
static inline bool tcp_ca_needs_ecn(const struct sock *sk) static inline bool tcp_ca_needs_ecn(const struct sock *sk)
{ {
const struct inet_connection_sock *icsk = inet_csk(sk); const struct inet_connection_sock *icsk = inet_csk(sk);

View file

@ -361,7 +361,7 @@ static void __tcp_ecn_check_ce(struct sock *sk, const struct sk_buff *skb)
tcp_enter_quickack_mode(sk, 2); tcp_enter_quickack_mode(sk, 2);
break; break;
case INET_ECN_CE: case INET_ECN_CE:
if (tcp_ca_needs_ecn(sk)) if (tcp_ca_wants_ce_events(sk))
tcp_ca_event(sk, CA_EVENT_ECN_IS_CE); tcp_ca_event(sk, CA_EVENT_ECN_IS_CE);
if (!(tp->ecn_flags & TCP_ECN_DEMAND_CWR)) { if (!(tp->ecn_flags & TCP_ECN_DEMAND_CWR)) {
@ -372,7 +372,7 @@ static void __tcp_ecn_check_ce(struct sock *sk, const struct sk_buff *skb)
tp->ecn_flags |= TCP_ECN_SEEN; tp->ecn_flags |= TCP_ECN_SEEN;
break; break;
default: default:
if (tcp_ca_needs_ecn(sk)) if (tcp_ca_wants_ce_events(sk))
tcp_ca_event(sk, CA_EVENT_ECN_NO_CE); tcp_ca_event(sk, CA_EVENT_ECN_NO_CE);
tp->ecn_flags |= TCP_ECN_SEEN; tp->ecn_flags |= TCP_ECN_SEEN;
break; break;