tso_build_data advances both the TCP sequence number used by the next tso_build_hdr call and a cursor over the payload's virtual addresses. Callers which walk the payload in some other way, such as bnxt_sw_udp_gso_xmit through tso_dma_map, can skip tso_build_data only because UDP headers carry no sequence number, so a TCP user of the same pattern has no way to advance the header state.
Add tso_advance_hdr for that and use it in tso_build_data. Signed-off-by: Ralf Lici <[email protected]> --- include/net/tso.h | 15 +++++++++++++++ net/core/tso.c | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/net/tso.h b/include/net/tso.h index da82aabd1d48..0a8020274882 100644 --- a/include/net/tso.h +++ b/include/net/tso.h @@ -18,6 +18,21 @@ struct tso_t { u32 tcp_seq; }; +/** + * tso_advance_hdr - advance the header state past a segment's payload + * @tso: TSO state initialized by tso_start + * @size: payload length of the segment just built + * + * tso_build_data does this while also moving its cursor over the payload's + * virtual addresses. Callers which walk the payload in some other way, for + * example through tso_dma_map, use this to keep the TCP sequence number of + * the following headers correct. + */ +static inline void tso_advance_hdr(struct tso_t *tso, int size) +{ + tso->tcp_seq += size; /* not worth avoiding this operation for UDP */ +} + /* Calculate the worst case buffer count */ static inline int tso_count_descs(const struct sk_buff *skb) { diff --git a/net/core/tso.c b/net/core/tso.c index d2934bcfa795..c091bee795a7 100644 --- a/net/core/tso.c +++ b/net/core/tso.c @@ -47,7 +47,7 @@ EXPORT_SYMBOL(tso_build_hdr); void tso_build_data(const struct sk_buff *skb, struct tso_t *tso, int size) { - tso->tcp_seq += size; /* not worth avoiding this operation for UDP */ + tso_advance_hdr(tso, size); tso->size -= size; tso->data += size; -- 2.56.0 _______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
