Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_var.h
Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | |||||
#if defined(_KERNEL) || defined(_WANT_TCPCB) | #if defined(_KERNEL) || defined(_WANT_TCPCB) | ||||
/* TCP segment queue entry */ | /* TCP segment queue entry */ | ||||
struct tseg_qent { | struct tseg_qent { | ||||
TAILQ_ENTRY(tseg_qent) tqe_q; | TAILQ_ENTRY(tseg_qent) tqe_q; | ||||
struct mbuf *tqe_m; /* mbuf contains packet */ | struct mbuf *tqe_m; /* mbuf contains packet */ | ||||
struct mbuf *tqe_last; /* last mbuf in chain */ | struct mbuf *tqe_last; /* last mbuf in chain */ | ||||
tcp_seq tqe_start; /* TCP Sequence number start */ | tcp_seq tqe_start; /* TCP Sequence number start */ | ||||
int tqe_len; /* TCP segment data length */ | int tqe_len; /* TCP segment data length */ | ||||
uint32_t tqe_flags; /* The flags from the th->th_flags */ | uint32_t tqe_flags; /* The flags from tcp_get_flags() */ | ||||
uint32_t tqe_mbuf_cnt; /* Count of mbuf overhead */ | uint32_t tqe_mbuf_cnt; /* Count of mbuf overhead */ | ||||
}; | }; | ||||
TAILQ_HEAD(tsegqe_head, tseg_qent); | TAILQ_HEAD(tsegqe_head, tseg_qent); | ||||
struct sackblk { | struct sackblk { | ||||
tcp_seq start; /* start seq no. of sack block */ | tcp_seq start; /* start seq no. of sack block */ | ||||
tcp_seq end; /* end seq no. */ | tcp_seq end; /* end seq no. */ | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 1,151 Lines • ▼ Show 20 Lines | |||||
static inline void | static inline void | ||||
tcp_fields_to_net(struct tcphdr *th) | tcp_fields_to_net(struct tcphdr *th) | ||||
{ | { | ||||
th->th_seq = htonl(th->th_seq); | th->th_seq = htonl(th->th_seq); | ||||
th->th_ack = htonl(th->th_ack); | th->th_ack = htonl(th->th_ack); | ||||
th->th_win = htons(th->th_win); | th->th_win = htons(th->th_win); | ||||
th->th_urp = htons(th->th_urp); | th->th_urp = htons(th->th_urp); | ||||
} | |||||
static inline uint16_t | |||||
glebius: Can we return uint16_t from this function? That of course may require changing type of the… | |||||
Done Inline ActionsSure. Where the function parameter definitions matter, I addressed this already; the local "flags" or "thflags" is mostly defined as an int (not a uint16_t). If that shoud be addressed too, I'd probably do this in another diff, though. rscheff: Sure. Where the function parameter definitions matter, I addressed this already; the local… | |||||
tcp_get_flags(const struct tcphdr *th) | |||||
Done Inline Actionsconst struct tcphdr *th ?? hselasky: const struct tcphdr *th ?? | |||||
{ | |||||
return (((uint16_t)th->th_x2 << 8) | th->th_flags); | |||||
Not Done Inline ActionsThe cast should also be uint16_t, as the whole function, its arguments and return type are unsigned. If I'm not missing anything that will also remove any implicit conversions to the return type. glebius: The cast should also be uint16_t, as the whole function, its arguments and return type are… | |||||
} | |||||
static inline void | |||||
tcp_set_flags(struct tcphdr *th, uint16_t flags) | |||||
{ | |||||
th->th_x2 = (flags >> 8) & 0x0f; | |||||
th->th_flags = flags & 0xff; | |||||
} | } | ||||
static inline void | static inline void | ||||
tcp_account_for_send(struct tcpcb *tp, uint32_t len, uint8_t is_rxt, | tcp_account_for_send(struct tcpcb *tp, uint32_t len, uint8_t is_rxt, | ||||
uint8_t is_tlp, int hw_tls) | uint8_t is_tlp, int hw_tls) | ||||
{ | { | ||||
if (is_tlp) { | if (is_tlp) { | ||||
tp->t_sndtlppack++; | tp->t_sndtlppack++; | ||||
Show All 20 Lines |
Can we return uint16_t from this function? That of course may require changing type of the argument in several calling functions. But if we are on code improving crusade, why not? :)