Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_lro.c
/*- | /*- | ||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD | * SPDX-License-Identifier: BSD-2-Clause-FreeBSD | ||||
* | * | ||||
* Copyright (c) 2007, Myricom Inc. | * Copyright (c) 2007, Myricom Inc. | ||||
* Copyright (c) 2008, Intel Corporation. | * Copyright (c) 2008, Intel Corporation. | ||||
* Copyright (c) 2012 The FreeBSD Foundation | * Copyright (c) 2012 The FreeBSD Foundation | ||||
* Copyright (c) 2016 Mellanox Technologies. | * Copyright (c) 2016-2021 Mellanox Technologies. | ||||
* All rights reserved. | * All rights reserved. | ||||
* | * | ||||
* Portions of this software were developed by Bjoern Zeeb | * Portions of this software were developed by Bjoern Zeeb | ||||
* under sponsorship from the FreeBSD Foundation. | * under sponsorship from the FreeBSD Foundation. | ||||
* | * | ||||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
* modification, are permitted provided that the following conditions | * modification, are permitted provided that the following conditions | ||||
* are met: | * are met: | ||||
▲ Show 20 Lines • Show All 1,842 Lines • ▼ Show 20 Lines | #endif | ||||
if (le->m_head == NULL) { | if (le->m_head == NULL) { | ||||
/* | /* | ||||
* Case where we wer chaining off the inp | * Case where we wer chaining off the inp | ||||
* and now no-longer can. | * and now no-longer can. | ||||
*/ | */ | ||||
le->m_head = m; | le->m_head = m; | ||||
le->m_tail = m_last(m); | le->m_tail = m_last(m); | ||||
le->m_last_mbuf = m; | le->m_last_mbuf = m; | ||||
le->m_prev_last = NULL; | |||||
} else { | } else { | ||||
le->m_prev_last = le->m_last_mbuf; | |||||
/* Mark me in the last spot */ | /* Mark me in the last spot */ | ||||
le->m_last_mbuf->m_nextpkt = m; | le->m_last_mbuf->m_nextpkt = m; | ||||
/* Now set the tail to me */ | /* Now set the tail to me */ | ||||
le->m_last_mbuf = m; | le->m_last_mbuf = m; | ||||
le->tcp_tot_p_len += tcp_data_len; | le->tcp_tot_p_len += tcp_data_len; | ||||
} | } | ||||
#ifdef TCPHPTS | #ifdef TCPHPTS | ||||
compressed: | compressed: | ||||
▲ Show 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | if (nm) { | ||||
nm->m_pkthdr.len += sizeof(struct tcp_ackent); | nm->m_pkthdr.len += sizeof(struct tcp_ackent); | ||||
le->ack_seq = th->th_ack; | le->ack_seq = th->th_ack; | ||||
le->window = th->th_win; | le->window = th->th_win; | ||||
m_freem(m); | m_freem(m); | ||||
counter_u64_add(tcp_extra_mbuf, 1); | counter_u64_add(tcp_extra_mbuf, 1); | ||||
le->m_head = NULL; | le->m_head = NULL; | ||||
le->m_tail = NULL; | le->m_tail = NULL; | ||||
le->m_last_mbuf = NULL; | le->m_last_mbuf = NULL; | ||||
le->m_prev_last = NULL; | |||||
INP_WUNLOCK(le->inp); | INP_WUNLOCK(le->inp); | ||||
return (0); | return (0); | ||||
} else { | } else { | ||||
if (le->inp->inp_flags2 & INP_MBUF_L_ACKS) | if (le->inp->inp_flags2 & INP_MBUF_L_ACKS) | ||||
nm = m_getcl(M_NOWAIT, MT_DATA, (M_ACKCMP|M_PKTHDR)); | nm = m_getcl(M_NOWAIT, MT_DATA, (M_ACKCMP|M_PKTHDR)); | ||||
else { | else { | ||||
nm = m_gethdr(M_NOWAIT, MT_DATA); | nm = m_gethdr(M_NOWAIT, MT_DATA); | ||||
nm->m_flags |= M_ACKCMP; | nm->m_flags |= M_ACKCMP; | ||||
Show All 20 Lines | #endif | ||||
if (need_flush) | if (need_flush) | ||||
le->need_wakeup = need_flush; | le->need_wakeup = need_flush; | ||||
else | else | ||||
le->need_wakeup = 0; | le->need_wakeup = 0; | ||||
m->m_nextpkt = NULL; | m->m_nextpkt = NULL; | ||||
le->m_head = m; | le->m_head = m; | ||||
le->m_tail = m_last(m); | le->m_tail = m_last(m); | ||||
le->m_last_mbuf = m; | le->m_last_mbuf = m; | ||||
le->m_prev_last = NULL; | |||||
/* | /* | ||||
* We keep the total size here for cross checking when we may need | * We keep the total size here for cross checking when we may need | ||||
* to flush/wakeup in the MBUF_QUEUE case. | * to flush/wakeup in the MBUF_QUEUE case. | ||||
*/ | */ | ||||
le->tcp_tot_p_len = tcp_data_len; | le->tcp_tot_p_len = tcp_data_len; | ||||
if (locked) | if (locked) | ||||
INP_WUNLOCK(le->inp); | INP_WUNLOCK(le->inp); | ||||
return (0); | return (0); | ||||
▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines |