MCPcopy Create free account
hub / github.com/F-Stack/f-stack / tcp_m_copym

Function tcp_m_copym

freebsd/netinet/tcp_output.c:1910–2073  ·  view source on GitHub ↗

* This is a copy of m_copym(), taking the TSO segment size/limit * constraints into account, and advancing the sndptr as it goes. */

Source from the content-addressed store, hash-verified

1908 * constraints into account, and advancing the sndptr as it goes.
1909 */
1910struct mbuf *
1911tcp_m_copym(struct mbuf *m, int32_t off0, int32_t *plen,
1912 int32_t seglimit, int32_t segsize, struct sockbuf *sb, bool hw_tls)
1913{
1914#ifdef KERN_TLS
1915 struct ktls_session *tls, *ntls;
1916 struct mbuf *start;
1917#endif
1918 struct mbuf *n, **np;
1919 struct mbuf *top;
1920 int32_t off = off0;
1921 int32_t len = *plen;
1922 int32_t fragsize;
1923 int32_t len_cp = 0;
1924 int32_t *pkthdrlen;
1925 uint32_t mlen, frags;
1926 bool copyhdr;
1927
1928 KASSERT(off >= 0, ("tcp_m_copym, negative off %d", off));
1929 KASSERT(len >= 0, ("tcp_m_copym, negative len %d", len));
1930 if (off == 0 && m->m_flags & M_PKTHDR)
1931 copyhdr = true;
1932 else
1933 copyhdr = false;
1934 while (off > 0) {
1935 KASSERT(m != NULL, ("tcp_m_copym, offset > size of mbuf chain"));
1936 if (off < m->m_len)
1937 break;
1938 off -= m->m_len;
1939 if ((sb) && (m == sb->sb_sndptr)) {
1940 sb->sb_sndptroff += m->m_len;
1941 sb->sb_sndptr = m->m_next;
1942 }
1943 m = m->m_next;
1944 }
1945 np = &top;
1946 top = NULL;
1947 pkthdrlen = NULL;
1948#ifdef KERN_TLS
1949 if (hw_tls && (m->m_flags & M_EXTPG))
1950 tls = m->m_epg_tls;
1951 else
1952 tls = NULL;
1953 start = m;
1954#endif
1955 while (len > 0) {
1956 if (m == NULL) {
1957 KASSERT(len == M_COPYALL,
1958 ("tcp_m_copym, length > size of mbuf chain"));
1959 *plen = len_cp;
1960 if (pkthdrlen != NULL)
1961 *pkthdrlen = len_cp;
1962 break;
1963 }
1964#ifdef KERN_TLS
1965 if (hw_tls) {
1966 if (m->m_flags & M_EXTPG)
1967 ntls = m->m_epg_tls;

Callers 3

tcp_output.cFile · 0.85
rack.cFile · 0.85
bbr.cFile · 0.85

Calls 6

minFunction · 0.85
m_dup_pkthdrFunction · 0.85
mb_dupclFunction · 0.85
m_gethdrFunction · 0.50
m_getFunction · 0.50
m_freemFunction · 0.50

Tested by

no test coverage detected